public class CoordinateSystemFactory extends Object
This is
created for an existing SceneGraphComponent (or for a given extent).
For a given SceneGraphComponent the factory creates a bounding box
and axes through the origin including ticks with their labels.
A new SceneGraphNode containing the coordinate system is added to
the children of the given SceneGraphComponent.
Use the factory as following:
Above line creates the coordinate system using default properties and adds it to the scene.
SceneGraphCompontent component;
double axisScale = 10.0;
[...]
CoordinateSystemFactory factory = new CoordinateSystemFactory(component, axisScale);
axisScale
(i.e. the distance between two ticks on the coordinate axes) depends on size of component.
You can change properties afterwards:
factory.showAxes(false);
factory.showBox(true);
factory.beautify(true);
[setting more properties]
The coordinate system may be removed from the SceneGraph by
component.removeChild(factory.getCoordinateSystem());
Modifier and Type | Field and Description |
---|---|
static int |
X
Index of coordinate x (use in arrays).
|
static int |
Y
Index of coordinate y (use in arrays).
|
static int |
Z
Index of coordinate z (use in arrays).
|
Constructor and Description |
---|
CoordinateSystemFactory(double extent)
see
CoordinateSystemFactory(double extent, double axisScale) here axisScale is set to 1.0 |
CoordinateSystemFactory(double[] extent)
see
CoordinateSystemFactory(double[] extent, double axisScale) here axisScale is set to 1.0 |
CoordinateSystemFactory(double[] extent,
double axisScale)
Creates a coordinate system where min and max values of each of the three coordinate
axes is specified by
extent ,
i.e. |
CoordinateSystemFactory(double extent,
double axisScale)
Creates a coordinate system where min and max values of each coordinate
axis are specified by
extent ,
i.e. |
CoordinateSystemFactory(SceneGraphComponent component)
see
CoordinateSystemFactory(SceneGraphComponent component, double axisScale) here axisScale is set to 1.0 |
CoordinateSystemFactory(SceneGraphComponent component,
double axisScale)
Creates a coordinate system where min and max values of each coordinate
axis are specified by a given SceneGraphComponent.
A new SceneGraphNode containing the coordinate system is added to the children of component . |
Modifier and Type | Method and Description |
---|---|
void |
beautify(boolean b)
Beautify the coordinate system automatically iff set to true,
i.e.
|
void |
dispose() |
double |
getAxisScale()
Get the current axis scale, i.e.
|
Color |
getBoxColor()
Get the current color of the bounding box.
|
Color |
getColor()
Get the current color of the coordinate system (axes and bounding box).
|
SceneGraphComponent |
getCoordinateSystem()
Get the coordinate system specified in this factory.
(The coordinate system may be removed from the SceneGraph using this method.) |
Color |
getGridColor()
Get the current color of the grid on the bounding box faces.
|
Color |
getLabelColor()
Get the current color of all labels of the coordinate system.
|
Font |
getLabelFont()
Get the current font of all labels of the coordinate system.
|
double |
getLabelScale()
Get the current label scale, i.e.
|
void |
setAxisScale(double axisScale)
Set the axis scale, i.e.
|
void |
setBoxColor(Color c)
Set the color of the bounding box.
|
void |
setColor(Color c)
Set the color of the coordinate system (axes and bounding box).
|
void |
setGridColor(Color c)
Set the color of the grid on the bounding box faces.
|
void |
setLabelBoxEdges(int[][] edges)
Set the box edges on which labels are to be shown.
|
void |
setLabelColor(Color c)
Set the color of all labels of the coordinate system.
|
void |
setLabelFont(Font f)
Set the font of all labels of the coordinate system.
|
void |
setLabelScale(double labelScale)
Set the label scale, i.e.
|
void |
showAxes(boolean b)
Show or hide the axes of the coordinate system going through the origin.
|
void |
showAxesArrows(boolean b)
Show or hide the arrows of the axes of the coordinate system going through the origin.
|
void |
showBox(boolean b)
Show or hide the bounding box of the coordinate system.
|
void |
showBoxArrows(boolean b)
Show or hide the arrows of the bounding box of the coordinate system.
|
void |
showGrid(boolean b)
Show or hide the grid on the bounding box faces.
|
void |
showLabels(boolean b)
Show or hide the tick & axis labels of axes and bounding box of the coordinate system.
|
void |
updateBox(double[] cameraToObject)
Beautifies the box regarding the current transformation from camera coordinates to local coordinates of the coordiante system,
i.e.
|
public static final int X
public static final int Y
public static final int Z
public CoordinateSystemFactory(double extent, double axisScale)
extent
,
i.e. x,y,z are within [-extent
, extent
].extent
- extent of each coordinate axisaxisScale
- the axis scale, i.e. the distance between two ticks on the coordinate axespublic CoordinateSystemFactory(double extent)
CoordinateSystemFactory(double extent, double axisScale)
public CoordinateSystemFactory(double[] extent, double axisScale)
extent
,
i.e. x is within [-extent[0]
, extent[0]
] etc.extent
- the extent of each of the three coordinate axesaxisScale
- the axis scale, i.e. the distance between two ticks on the coordinate axespublic CoordinateSystemFactory(double[] extent)
CoordinateSystemFactory(double[] extent, double axisScale)
public CoordinateSystemFactory(SceneGraphComponent component, double axisScale)
component
.component
- the SceneGraphComponent specifying the extent of the coordinate systemaxisScale
- the axis scale, i.e. the distance between two ticks on the coordinate axespublic CoordinateSystemFactory(SceneGraphComponent component)
CoordinateSystemFactory(SceneGraphComponent component, double axisScale)
public void dispose()
public void updateBox(double[] cameraToObject)
cameraToObject
- the transformation matrix from camera coordinates to local coordinates of the coordinate system within the SceneGraphpublic SceneGraphComponent getCoordinateSystem()
public void setAxisScale(double axisScale)
axisScale
- the axis scalepublic double getAxisScale()
public void setLabelScale(double labelScale)
labelScale
- the label scalepublic double getLabelScale()
public void showAxes(boolean b)
b
- true iff axes are to be shownpublic void showBox(boolean b)
b
- true iff the box is to be shownpublic void showGrid(boolean b)
b
- true iff the grid is to be shownpublic void showAxesArrows(boolean b)
b
- true iff the arrows are to be shownpublic void showBoxArrows(boolean b)
b
- true iff the arrows are to be shownpublic void showLabels(boolean b)
b
- true iff the labels are to be shownpublic void setColor(Color c)
c
- the colorpublic Color getColor()
public void setGridColor(Color c)
c
- the colorpublic Color getGridColor()
public void setBoxColor(Color c)
c
- the colorpublic Color getBoxColor()
public void setLabelColor(Color c)
c
- the colorpublic Color getLabelColor()
public void setLabelFont(Font f)
f
- the fontpublic Font getLabelFont()
public void beautify(boolean b)
b
- true iff coordinate system is to be beautified automaticallypublic void setLabelBoxEdges(int[][] edges)
edges
- specifies on which edges of the bounding box labels are to be shown