|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectGLJPanel
edu.ohiou.cs456_badabing.sceneapi.exec.ViewPanel
public class ViewPanel
OpenGL accelerated panel that renders 3D visualization data.
Description: extends GLJPanel and renders Map. Responds to user interaction.
Copyright: Copyright (c) 2008, Lev A Neiman
Company: Ohio University EECS
| Nested Class Summary | |
|---|---|
private class |
ViewPanel.zoomerInner
inner class to handle zooming in stuff. |
| Field Summary | |
|---|---|
(package private) java.util.HashMap<java.awt.Color,java.lang.String> |
color2name
mapping of RGB color to county name. |
GLContext |
context
GLContext of this panel. |
private int |
cur_m_button
mouse button that was pressed. |
private boolean |
enable_transperency
if this is false then transperency is disabled. |
private boolean |
enable_transperency_p
previouis value for enable_transperency. |
int |
frames
frame counter. |
private LightNode |
light
handle to light source. |
private MainUIPanel |
main_panel
handle to MainUIPanel |
Map |
map
handle to Map |
private static double |
max_radius
the radius of the Sphere representing the county with largest deer harvest. |
(package private) java.lang.Thread |
measure_fps
handle to thread that measures and prints out FPS info. |
private static double |
min_radius
the radius of the Sphere representing the county with smallest deer harvest. |
private int |
mX
x position of last mouse move. |
private int |
mY
y position of the last mouse move. |
(package private) java.util.HashMap<java.lang.String,java.awt.Color> |
name2color
mapping of county name to RGB color |
private int |
num_inits
how many times has this panel been re-initialized. |
java.lang.Thread |
render_thread
handle to thread that calls display() continuously. |
boolean |
should_display
|
private boolean |
should_update
if this is switched to true, ViewPanel will attempt to read DataBaseModel from MainUIPanel and update Spheres and PieCharts accordingly. |
private static double |
xdisp
x position of camera. |
private static double |
xtilt
xtilt of the camera. |
private static double |
ydisp
y position of camera. |
private static double |
ytilt
ytilt of the camera. |
private static double |
zdisp
z position of camera (how close is it to the map?). |
private ViewPanel.zoomerInner |
zooming
handle to the zoomerInner object. |
| Constructor Summary | |
|---|---|
ViewPanel(MainUIPanel main_panel)
default constructor. |
|
| Method Summary | |
|---|---|
private void |
addSM(java.lang.String name,
java.awt.Color color)
add county name to RGB color mapping. |
void |
changeTransperency(int transperency)
set a new Transperency. |
void |
display(GLAutoDrawable gLDrawable)
render ViewPanel. |
void |
displayChanged(GLAutoDrawable gLDrawable,
boolean modeChanged,
boolean deviceChanged)
|
private java.awt.Color |
getColor(int x,
int y)
return the color at x, y position on the screen. |
Map |
getMap()
return handle to Map object. |
void |
init(GLAutoDrawable gLDrawable)
Set up our scene. |
double |
interpolate(double y1,
double y2,
double t1,
double t2,
long ti)
Interpolation function between (t1, y1) and (t2, y2). |
private void |
jbInit()
adds some event listeners. |
void |
keyPressed(java.awt.event.KeyEvent k)
|
void |
keyReleased(java.awt.event.KeyEvent k)
|
void |
keyTyped(java.awt.event.KeyEvent k)
|
void |
mouseClicked(java.awt.event.MouseEvent e)
on mouse Clicked event. |
void |
mouseDragged(java.awt.event.MouseEvent e)
on mouse dragged. |
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
on mouse moved. |
void |
mousePressed(java.awt.event.MouseEvent e)
on mouse pressed. |
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e)
handle mouse wheel events. |
void |
reshape(GLAutoDrawable gLDrawable,
int x,
int y,
int width,
int height)
calls when ViewPanel is being reshaped. |
void |
run()
run method for rendering thread. |
private java.lang.String |
selectCounty()
method to select county based on the color that is at mX, mY position. |
void |
setTransperency(boolean transp)
set whether transperency should be used or not. |
boolean |
takeScreenshot(java.io.File file,
java.lang.String format)
saves the screen shot of the color buffer into file in some format. |
void |
triggerUpdate()
triggers ViewPanel to update sizes of Spheres and PieCharts |
private void |
update()
Updates all objects in map to reflect information from DataBaseModel and current year. |
void |
updateDeerTuple(DeerTuple info)
take a deer Tuple |
void |
zoomDefault()
zoom in to default view. |
void |
zoomIn()
zoom in a little bit. |
void |
zoomIn(java.lang.String county_name)
causes ViewPanel to zoom in on selected county. |
void |
zoomOut()
zoom out a little bit. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private ViewPanel.zoomerInner zooming
java.lang.Thread measure_fps
public int frames
private MainUIPanel main_panel
public Map map
private LightNode light
private int mX
private int mY
private static double xdisp
private static double ydisp
private static double zdisp
private static double xtilt
private static double ytilt
private int cur_m_button
public java.lang.Thread render_thread
public GLContext context
private int num_inits
java.util.HashMap<java.lang.String,java.awt.Color> name2color
java.util.HashMap<java.awt.Color,java.lang.String> color2name
private boolean should_update
private boolean enable_transperency_p
private boolean enable_transperency
private static final double min_radius
private static final double max_radius
public boolean should_display
| Constructor Detail |
|---|
public ViewPanel(MainUIPanel main_panel)
main_panel - MainUIPanel| Method Detail |
|---|
public double interpolate(double y1,
double y2,
double t1,
double t2,
long ti)
y1 - doubley2 - doublet1 - doublet2 - doubleti - long
public void setTransperency(boolean transp)
transp - boolean
private void addSM(java.lang.String name,
java.awt.Color color)
name - Stringcolor - Colorpublic void triggerUpdate()
public void updateDeerTuple(DeerTuple info)
private void update()
public Map getMap()
public void zoomIn()
public void zoomOut()
public void display(GLAutoDrawable gLDrawable)
gLDrawable - GLAutoDrawable
public void displayChanged(GLAutoDrawable gLDrawable,
boolean modeChanged,
boolean deviceChanged)
public void init(GLAutoDrawable gLDrawable)
gLDrawable - GLAutoDrawable
public void reshape(GLAutoDrawable gLDrawable,
int x,
int y,
int width,
int height)
gLDrawable - GLAutoDrawablex - inty - intwidth - intheight - intpublic void changeTransperency(int transperency)
transperency - int
private void jbInit()
throws java.lang.Exception
java.lang.Exceptionpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenere - MouseEventpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenere - MouseEventpublic void zoomIn(java.lang.String county_name)
county_name - Stringpublic void zoomDefault()
private java.awt.Color getColor(int x,
int y)
x - inty - int
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved in interface java.awt.event.MouseMotionListenere - MouseEventprivate java.lang.String selectCounty()
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged in interface java.awt.event.MouseMotionListenere - MouseEventpublic void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved in interface java.awt.event.MouseWheelListenere - MouseWheelEventpublic void keyReleased(java.awt.event.KeyEvent k)
keyReleased in interface java.awt.event.KeyListenerpublic void keyPressed(java.awt.event.KeyEvent k)
keyPressed in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent k)
keyTyped in interface java.awt.event.KeyListenerpublic void run()
run in interface java.lang.Runnable
public boolean takeScreenshot(java.io.File file,
java.lang.String format)
file - Fileformat - String
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||