Package mgui.interfaces.maps
Class Map3D
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.interfaces.maps.Map
mgui.interfaces.maps.Map3D
- All Implemented Interfaces:
InterfaceObject
,NamedObject
,TreeObject
,CleanableObject
,XMLObject
public class Map3D extends Map
Class to provide an interface for mapping a 3D viewing platform. Basic implementation generates
Transform3D nodes for a Java3D scene graph, based upon a center-of-rotation (),
zoom level, viewing angle (), and pan location ()
The viewing platform is rotated about the , and this rotation
is determined by . Zoom level is the magnitude of ,
described by . Any translation of the viewing platform is then applied by
means of .
Notes:
1. The above is now implemented using Camera3D, which uses a lineOfSight vector (same as
), a centerOfRotation, a targetPoint (specifying camera pannning), and an
upVector (specifying the camera's up position)... uses Transform3D's lookAt function to
obtain the camera transform. Map3D simply calls the camera's getCameraTransform method to
set the target transform.
2. It is good to know that the default ViewPosition is located at 0, 0, 0 and the
default viewingVector is (0, 0, 1); i.e., the initial viewingVector is the pos Z-axis. All
transformations generated here are with respect to this default orientation.
3. The viewing platform is essentially a fixed-size 3D planar quadrangle, one side of which
is the viewport to the 3D model. You can position this viewport however you like. In the
present object, the intent is to provide a line-of-sight from some specific 3D point (the
center-of-rotation offset by the translation vector) to the viewer's eye, and to specify
a "zoom" about this point, which is essentially a translation along the viewing vector (or,
equivalently, a scaling of the platform if you relax the fixed-size requirement). Thus, zoom
is expressed as a radius (a distance from the target point).
- Author:
- Andrew Reid
-
Nested Class Summary
Nested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType
-
Field Summary
Fields Modifier and Type Field Description protected Camera3D
camera
protected org.jogamp.vecmath.Point3f
centerPt
protected org.jogamp.java3d.TransformGroup
targetTransform
protected Sphere3D
thisBounds
protected org.jogamp.java3d.View
thisView
protected boolean
update_clip_bounds
protected double
zoomClip
Fields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes
-
Constructor Summary
Constructors Constructor Description Map3D()
-
Method Summary
Modifier and Type Method Description void
addLightSource(org.jogamp.java3d.DirectionalLight light)
void
addLightSource(org.jogamp.java3d.DirectionalLight light, org.jogamp.vecmath.Vector2d offset)
Camera3D
getCamera()
java.lang.String
getDTD()
Returns the Data Type Declaration (DTD) for this object's XML representationjava.lang.String
getLocalName()
Returns the local name associated with this XML object.java.lang.String
getShortXML(int tab)
Returns a short XML representation of this object.int
getType()
org.jogamp.java3d.Transform3D
getViewPlatformTransform()
java.lang.String
getXML()
Returns this object's XML representation as a single string.java.lang.String
getXML(int tab)
Returns this object's XML representation as a single string.java.lang.String
getXMLSchema()
Returns the XML schema for this object's XML representationdouble
getZoom()
void
handleXMLElementEnd(java.lang.String localName)
Handles the end of an XML element.void
handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type)
Handles the start of an XML element.void
handleXMLString(java.lang.String s)
Handles a string within an XML element.void
removeLightSource(org.jogamp.java3d.DirectionalLight light)
void
setBounds(Sphere3D bounds)
void
setCamera(Camera3D camera)
void
setCenter(org.jogamp.vecmath.Point3f c)
void
setTargetTransform(org.jogamp.java3d.TransformGroup thisTarget)
void
setTreeNode(InterfaceTreeNode treeNode)
Sets the children for this node'sInterfaceTreeNode
.void
setUpdateClipBounds(boolean b)
Indicates whether this map should update the view clip bounds if its bounds are updatedvoid
setView(org.jogamp.java3d.View v)
void
setViewPlatformTransform(org.jogamp.java3d.Transform3D thisTransform)
Deprecated.void
setZoom(double z)
java.lang.String
toString()
void
updateClipBounds()
void
updateTargetTransform()
void
updateViewPlatformTransform(org.jogamp.java3d.Transform3D thisTransform)
void
writeXML(int tab, java.io.Writer writer)
Writes the XML representation of this object to file.void
writeXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar)
Writes the XML representation of this object to file, asXMLType.Normal
.void
writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar)
Writes the XML representation of this object to file.Methods inherited from class mgui.interfaces.maps.Map
addMapListener, fireMapListeners, removeMapListener
Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, destroy, getName, getTreeLabel, isDestroyed, issueTreeNode, setName, updateTreeNodes
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
camera
-
targetTransform
protected org.jogamp.java3d.TransformGroup targetTransform -
thisView
protected org.jogamp.java3d.View thisView -
thisBounds
-
centerPt
protected org.jogamp.vecmath.Point3f centerPt -
zoomClip
protected double zoomClip -
update_clip_bounds
protected boolean update_clip_bounds
-
-
Constructor Details
-
Map3D
public Map3D()
-
-
Method Details
-
setViewPlatformTransform
@Deprecated public void setViewPlatformTransform(org.jogamp.java3d.Transform3D thisTransform)Deprecated. -
setUpdateClipBounds
public void setUpdateClipBounds(boolean b)Indicates whether this map should update the view clip bounds if its bounds are updated- Parameters:
b
-
-
getCamera
-
setCamera
-
updateViewPlatformTransform
public void updateViewPlatformTransform(org.jogamp.java3d.Transform3D thisTransform) -
getViewPlatformTransform
public org.jogamp.java3d.Transform3D getViewPlatformTransform() -
updateTargetTransform
public void updateTargetTransform() -
setTargetTransform
public void setTargetTransform(org.jogamp.java3d.TransformGroup thisTarget) -
setView
public void setView(org.jogamp.java3d.View v) -
setBounds
-
setCenter
public void setCenter(org.jogamp.vecmath.Point3f c) -
updateClipBounds
public void updateClipBounds() -
getType
public int getType() -
getZoom
public double getZoom() -
setZoom
public void setZoom(double z) -
addLightSource
public void addLightSource(org.jogamp.java3d.DirectionalLight light) -
addLightSource
public void addLightSource(org.jogamp.java3d.DirectionalLight light, org.jogamp.vecmath.Vector2d offset) -
removeLightSource
public void removeLightSource(org.jogamp.java3d.DirectionalLight light) -
setTreeNode
Description copied from interface:TreeObject
Sets the children for this node'sInterfaceTreeNode
.- Specified by:
setTreeNode
in interfaceTreeObject
- Overrides:
setTreeNode
in classAbstractInterfaceObject
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getDTD
public java.lang.String getDTD()Description copied from interface:XMLObject
Returns the Data Type Declaration (DTD) for this object's XML representationSee http://en.wikipedia.org/wiki/Document_Type_Definition for a description.
- Returns:
-
getXMLSchema
public java.lang.String getXMLSchema()Description copied from interface:XMLObject
Returns the XML schema for this object's XML representation- Returns:
-
getXML
public java.lang.String getXML()Description copied from interface:XMLObject
Returns this object's XML representation as a single string. NOTE: this is not feasible for larger objects and containers, thus may not be implemented for these objects. Use theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)
functions to write larger objects to file.- Returns:
-
getXML
public java.lang.String getXML(int tab)Description copied from interface:XMLObject
Returns this object's XML representation as a single string. NOTE: this is not feasible for larger objects and containers, thus may not be implemented for these objects. Use theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)
functions to write larger objects to file.- Parameters:
tab
- The number of tabs to place before the opening XML wrapper- Returns:
-
handleXMLElementStart
public void handleXMLElementStart(java.lang.String localName, org.xml.sax.Attributes attributes, XMLObject.XMLType type) throws org.xml.sax.SAXExceptionDescription copied from interface:XMLObject
Handles the start of an XML element.- Parameters:
localName
- Local name of the elementattributes
- Set of element attributestype
- TheXMLType
of this element- Throws:
org.xml.sax.SAXException
-
handleXMLElementEnd
public void handleXMLElementEnd(java.lang.String localName) throws org.xml.sax.SAXExceptionDescription copied from interface:XMLObject
Handles the end of an XML element.- Parameters:
localName
- Local name of the element- Throws:
org.xml.sax.SAXException
-
handleXMLString
public void handleXMLString(java.lang.String s) throws org.xml.sax.SAXExceptionDescription copied from interface:XMLObject
Handles a string within an XML element.- Parameters:
s
- String to handle- Throws:
org.xml.sax.SAXException
-
getLocalName
public java.lang.String getLocalName()Description copied from interface:XMLObject
Returns the local name associated with this XML object.- Returns:
-
writeXML
public void writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format ofXMLFormat.Ascii
will be used.- Parameters:
tab
- The number of tabs to place before the XML textwriter
- The writeroptions
- XMLOutputOptions defining the write parametersprogress_bar
- Optional progress updater (may benull
)- Throws:
java.io.IOException
-
writeXML
public void writeXML(int tab, java.io.Writer writer, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file, asXMLType.Normal
. The default format ofXMLFormat.Ascii
will be used. The basic contract for this method is that it should not write a newline character at its start or end.- Parameters:
tab
- The number of tabs to place before the XML textwriter
- The writerprogress_bar
- Optional progress updater (may benull
)- Throws:
java.io.IOException
-
writeXML
public void writeXML(int tab, java.io.Writer writer) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format ofXMLFormat.Ascii
will be used.- Parameters:
tab
- The number of tabs to place before the XML textwriter
- The writer- Throws:
java.io.IOException
-
getShortXML
public java.lang.String getShortXML(int tab)Description copied from interface:XMLObject
Returns a short XML representation of this object.- Returns:
-