|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
org.hd.d.pg2k.webSvr.threeD.ThreeDMain
public final class ThreeDMain
Main (UI) class of JWS-based 3D walkthrough. Runs as a Swing App.
This class/file contains as little non-UI code as is reasonably practical, so that if we change the UI details then other classes should be unaffected.
We don't really want/need this class to be Serializable, but this class inherits Serializable from JFrame.
| Nested Class Summary | |
|---|---|
private static class |
ThreeDMain.SISListener
Listener class used to veto attempts to start another app instance. |
| Nested classes/interfaces inherited from class javax.swing.JFrame |
|---|
javax.swing.JFrame.AccessibleJFrame |
| Nested classes/interfaces inherited from class java.awt.Frame |
|---|
java.awt.Frame.AccessibleAWTFrame |
| Nested classes/interfaces inherited from class java.awt.Window |
|---|
java.awt.Window.AccessibleAWTWindow |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
private static javax.media.j3d.TexCoordGeneration[] |
_createTexGen_cache
Cache for _createTexGen; never null. |
private static javax.media.j3d.Text3D[] |
_makeIndexLetter_geomCache
Private geometry cache for _makeIndexLetter; never null. |
private static boolean |
ANIMATE_BANNER
If true, animate the name banner (at the cost of CPU time, etc). |
private static java.lang.String |
APPLICATION_WINDOW_TITLE
Title shown for application. |
private javax.media.j3d.Canvas3D |
canvas3D
3D canvas for Java3D to draw on; only null if Java3D not available. |
private static int |
CANVAS3D_HEIGHT
Canvas height in pixels. |
private static int |
CANVAS3D_WIDTH
Canvas width in pixels. |
private LightweightMetaDataFetchInterface.GalleryBasicMetaData |
currentSet
What exhibit set are we currently displaying; never null. |
static float |
EXHIBIT_CSPACING_M
Exhibit (centres) spacing in metres; strictly positive and no smaller than MAX_EXHIBIT_DIM_M. |
static float |
EXHIBIT_VISIBLE_M
Exhibit visibility spacing in metres; strictly positive and no smaller than MAX_EXHIBIT_DIM_M. |
private javax.media.j3d.BranchGroup |
exhibitsBranchGroup
BranchGroup used to hold the exhibits; never null. |
private static float |
FOG_START
Distance at which fog starts to have an effect, in open range ]0, EXHIBIT_VISIBLE_M[. |
private SimpleLoggerIF |
logger
Central logger instance for uploader; never null. |
private ThreeDLogic |
logic
Our companion "business-logic" class; never null. |
static float |
MAX_EXHIBIT_DIM_M
Maximum exhibit dimension (eg height or width) in metres; strictly positive. |
private static float |
MAX_VPC_X
Maximum (most positive) permitted view-platform-centre X value to avoid losing sight of exhibits. |
private static float |
MAX_VPC_Y
Maximum (most positive) permitted view-platform-centre Y value to avoid losing sight of exhibits. |
private static float |
MAX_VPC_Z
Maximum (most positive) permitted view-platform-centre Z value to avoid losing sight of exhibits. |
private static java.util.concurrent.atomic.AtomicInteger |
maxCaptionCharsSoFar
Maximum number of chars (excluding any trailer) so far found to fit in a caption; no less than MIN_CAPTION_CHARS. |
private static int |
MIN_CAPTION_CHARS
Minimum number of characters that we will show in a caption for comprehensibility; non-negative. |
private static long |
serialVersionUID
Unique Serialisation class ID generated by http://random.hd.org/. |
private com.sun.j3d.utils.universe.SimpleUniverse |
simpleUniverse
Our simple universe; only null if Java3D not available or set-up not yet complete. |
private ThreeDMain.SISListener |
sisListener
Single listener instance. |
private javax.swing.JSlider |
sliderX
X-axis slider; never null. |
private javax.swing.JSlider |
sliderY
Y-axis slider; never null. |
private javax.swing.JSlider |
sliderZ
Z-axis slider; never null. |
private javax.swing.JLabel |
status
Status bar; never null. |
private static javax.vecmath.Color3f |
TEXT_ALT_COLOUR
Alternate/highlight/not-good colour of text/othe3r for captions, etc, logically immutable; never null. |
private static javax.vecmath.Color3f |
TEXT_ALT2_COLOUR
Alternate/highlight/not-good colour of text/othe3r for captions, etc, logically immutable; never null. |
private static javax.vecmath.Color3f |
TEXT_ALT3_COLOUR
Alternate/highlight/not-good colour of text/othe3r for captions, etc, logically immutable; never null. |
private static javax.media.j3d.Appearance |
TEXT_APPEARANCE
Standard text colour/appearance, logically immutable; never null. |
private static javax.vecmath.Color3f |
TEXT_COLOUR
Colour of text for captions, etc, logically immutable; never null. |
private static javax.vecmath.Color3f |
TEXT_OK_COLOUR
Alternate/highlight/OK colour of text/other for captions, etc, logically immutable; never null. |
private static java.lang.String |
TRIMMED_CAPTION_SUFFIX
Suffix to add to any trimmed caption. |
private static boolean |
USE_2D_LAYOUT
If true then lay out exhibits in 2D grid, else use 3D layout. |
| Fields inherited from class javax.swing.JFrame |
|---|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
| Fields inherited from class java.awt.Frame |
|---|
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface javax.swing.WindowConstants |
|---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
private |
ThreeDMain()
Create an instance of the Uploader app main window. |
| Method Summary | |
|---|---|
private static javax.media.j3d.TexCoordGeneration |
_createTexGen(int textureWidth)
Build a tex-gen that maps a texture of the given width across our exhibit box front face; never null. |
private static com.sun.j3d.utils.geometry.Text2D |
_makeCaptionTexture(java.lang.String captionFullText)
Makes the caption for an exhibit as a texture; never null. |
private static javax.media.j3d.Shape3D |
_makeIndexLetter(char indexLetter)
Makes an index letter bottom-right aligned to (0,0,0); never null. |
private static com.sun.j3d.utils.geometry.Text2D |
_makeRawCaptionText2D(java.lang.String sb)
Make raw caption Text2D from the given text; never null. |
void |
actionPerformed(java.awt.event.ActionEvent evt)
This method acts as the Action handler delegate for all the actions. |
private static int |
computeGridXYDim(int exhibitCount)
Compute width/height (X/Y dimension) of exhibit grid given exhibit count. |
private static int |
computeGridZDim(int exhibitCount)
Compute depth (Z dimension) of exhibit grid given exhibit count. |
private float |
computeMinVPCX()
Compute minimum (most negative) permitted view-platform-centre X value to avoid losing sight of exhibits. |
private float |
computeMinVPCY()
Compute minimum (most negative) permitted view-platform-centre Y value to avoid losing sight of exhibits. |
private float |
computeMinVPCZ()
Compute minimum (most negative) permitted view-platform-centre Z value to avoid losing sight of exhibits. |
private static javax.vecmath.Vector3d |
computeViewPlatformVWorldXYZ(com.sun.j3d.utils.universe.SimpleUniverse su)
Compute the view-platform location (x,y,z) in virtual-world coordinates; never null. |
private javax.swing.JPanel |
create3DPane()
Create the (main) 3D component, called during construction; never null. |
private static javax.media.j3d.BranchGroup |
createMainBannerSceneGraph(javax.vecmath.Point3f bottomRight)
Creates the PG2K banner branch graph; never null. |
private static javax.swing.JLabel |
createStatusBar()
Creates and initialises a status bar. |
private void |
initUserControls(com.sun.j3d.utils.universe.SimpleUniverse u,
javax.media.j3d.BranchGroup exhibitsBranchGroup)
Initialise user's location, etc. |
static void |
main(java.lang.String[] args)
Main method invoked from JWS. |
private javax.media.j3d.Node |
makeExhibitSpace(javax.vecmath.Point3f centre,
int index)
Create one exhibit's "space" and "sphere of influence"; never null. |
private javax.media.j3d.BranchGroup |
makeExhibitsScene(LightweightMetaDataFetchInterface.GalleryBasicMetaData galleryBasicMetaData,
javax.vecmath.Point3f topRightFront)
Make the BranchGroup containing the current set of exhibits; never null. |
private void |
pollUI()
Poll UI (in AWT/Swing thread, ie Swing-safe). |
private void |
shutdown()
Perform any activity required to shut down cleanly, eg save state, then exit. |
| Methods inherited from class javax.swing.JFrame |
|---|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update |
| Methods inherited from class java.awt.Frame |
|---|
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
| Methods inherited from class java.awt.Window |
|---|
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.awt.MenuContainer |
|---|
getFont, postEvent |
| Field Detail |
|---|
private final SimpleLoggerIF logger
private final ThreeDLogic logic
private final javax.swing.JLabel status
private final ThreeDMain.SISListener sisListener
private static final java.lang.String APPLICATION_WINDOW_TITLE
private volatile com.sun.j3d.utils.universe.SimpleUniverse simpleUniverse
private final javax.media.j3d.Canvas3D canvas3D
private final javax.media.j3d.BranchGroup exhibitsBranchGroup
private final javax.swing.JSlider sliderX
private final javax.swing.JSlider sliderY
private final javax.swing.JSlider sliderZ
private static final int CANVAS3D_WIDTH
private static final int CANVAS3D_HEIGHT
private static final boolean ANIMATE_BANNER
public static final float MAX_EXHIBIT_DIM_M
public static final float EXHIBIT_CSPACING_M
public static final float EXHIBIT_VISIBLE_M
We ensure that the nearest exhibit to the user is visible in their initial view.
private static final float FOG_START
private static final javax.vecmath.Color3f TEXT_COLOUR
private static final javax.vecmath.Color3f TEXT_ALT_COLOUR
private static final javax.vecmath.Color3f TEXT_ALT2_COLOUR
private static final javax.vecmath.Color3f TEXT_ALT3_COLOUR
private static final javax.vecmath.Color3f TEXT_OK_COLOUR
private static final javax.media.j3d.Appearance TEXT_APPEARANCE
private static final int MIN_CAPTION_CHARS
private static final java.util.concurrent.atomic.AtomicInteger maxCaptionCharsSoFar
private static final java.lang.String TRIMMED_CAPTION_SUFFIX
private static final javax.media.j3d.Text3D[] _makeIndexLetter_geomCache
Accessed under a lock on this array for thread-safety.
private static final javax.media.j3d.TexCoordGeneration[] _createTexGen_cache
This is likely to remain largely empty since we are only likely to use the slots corresponding to textures that are powers of two.
private static final boolean USE_2D_LAYOUT
private static final float MAX_VPC_X
private static final float MAX_VPC_Y
private static final float MAX_VPC_Z
private volatile LightweightMetaDataFetchInterface.GalleryBasicMetaData currentSet
Marked volatile for thread-safe lock-free access.
Initially an empty set of exhibits.
private static final long serialVersionUID
| Constructor Detail |
|---|
private ThreeDMain()
| Method Detail |
|---|
private void shutdown()
throws java.lang.UnsupportedOperationException
This may throw an UnsupportedOperationException to try to veto an exit that the user changes their mind about, eg because we have work in progress!
java.lang.UnsupportedOperationException - if the user vetoes the shut-downprivate javax.swing.JPanel create3DPane()
private static javax.media.j3d.BranchGroup createMainBannerSceneGraph(javax.vecmath.Point3f bottomRight)
We add some other misc bits of the scene here, such as fog.
private javax.media.j3d.Node makeExhibitSpace(javax.vecmath.Point3f centre,
int index)
When outside the lo-red bounds the exhibit may be invisible and indeed only the scheduling bounds may exist to conserve memory.
centre - the centre of the exhibit and exhibit's space; never nullindex - the index in the server's ordered list of exhibits;
non-negativeprivate static com.sun.j3d.utils.geometry.Text2D _makeCaptionTexture(java.lang.String captionFullText)
captionFullText - printable-ASCII string; never nullprivate static com.sun.j3d.utils.geometry.Text2D _makeRawCaptionText2D(java.lang.String sb)
private static javax.media.j3d.Shape3D _makeIndexLetter(char indexLetter)
indexLetter - printable ASCII character (up to 'z')private static javax.vecmath.Vector3d computeViewPlatformVWorldXYZ(com.sun.j3d.utils.universe.SimpleUniverse su)
private static javax.media.j3d.TexCoordGeneration _createTexGen(int textureWidth)
textureWidth - positive power of twoprivate static int computeGridXYDim(int exhibitCount)
private static int computeGridZDim(int exhibitCount)
private float computeMinVPCX()
private float computeMinVPCY()
private float computeMinVPCZ()
private javax.media.j3d.BranchGroup makeExhibitsScene(LightweightMetaDataFetchInterface.GalleryBasicMetaData galleryBasicMetaData,
javax.vecmath.Point3f topRightFront)
galleryBasicMetaData - new exhibit set meta-datatopRightFront - origin/offset of this exhibit set; never null
private void initUserControls(com.sun.j3d.utils.universe.SimpleUniverse u,
javax.media.j3d.BranchGroup exhibitsBranchGroup)
private static javax.swing.JLabel createStatusBar()
public void actionPerformed(java.awt.event.ActionEvent evt)
private void pollUI()
public static void main(java.lang.String[] args)
|
DHD Multimedia Gallery V1.57.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||