Package org.jzy3d.plot3d.primitives.axis
Class AxisBox
- java.lang.Object
-
- org.jzy3d.plot3d.primitives.axis.AxisBox
-
- All Implemented Interfaces:
IAxis
- Direct Known Subclasses:
AxisBox2d
,ContourAxisBox
,FeedbackBufferAxisBox
public class AxisBox extends Object implements IAxis
TheAxisBox
displays a box with front face invisible and ticks labels.- Author:
- Martin Pernollet
-
-
Field Summary
Fields Modifier and Type Field Description protected List<AxeAnnotation>
annotations
static int
AXE_X
static int
AXE_Y
static int
AXE_Z
protected int[][]
axeXquads
protected float[][]
axeXx
protected float[][]
axeXy
protected float[][]
axeXz
protected int[][]
axeYquads
protected float[][]
axeYx
protected float[][]
axeYy
protected float[][]
axeYz
protected int[][]
axeZquads
protected float[][]
axeZx
protected float[][]
axeZy
protected float[][]
axeZz
protected BoundingBox3d
boxBounds
protected Coord3d
center
protected boolean
depthRangeTrick
protected AxisLabelProcessor
labels
protected AxisLayout
layout
static float
NO_OVERLAP_DEPTH_RATIO
The higher the value, the more the line are far from the faces and hence no z-fighting occurs between faces and lines.protected float[]
normx
protected float[]
normy
protected float[]
normz
protected static int
PRECISION
protected boolean[]
quadIsHidden
protected float[][]
quadx
protected float[][]
quady
protected float[][]
quadz
protected AxisLabelRotator
rotateLabel
protected Coord3d
scale
protected SpaceTransformer
spaceTransformer
protected ITextRenderer
textRenderer
protected AxisTickProcessor
ticks
protected View
view
protected BoundingBox3d
wholeBounds
protected float
xrange
protected float
yrange
protected float
zrange
-
Constructor Summary
Constructors Constructor Description AxisBox(BoundingBox3d bbox)
AxisBox(BoundingBox3d bbox, AxisLayout layout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAnnotation(AxeAnnotation annotation)
void
cullingDisable(IPainter painter)
void
cullingEnable(IPainter painter)
void
dispose()
void
doTransform(IPainter painter)
reset to identity and apply scalingvoid
draw(IPainter painter)
Draws the AxisBox.protected void
drawAnnotations(IPainter painter)
protected void
drawCube(IPainter painter, RenderMode mode)
void
drawFace(IPainter painter)
void
drawGrid(IPainter painter)
protected void
drawGridOnQuad(IPainter painter, int quad)
void
drawTicksAndLabels(IPainter painter)
void
drawTicksAndLabelsX(IPainter painter)
void
drawTicksAndLabelsY(IPainter painter)
void
drawTicksAndLabelsZ(IPainter painter)
protected int
findClosestXaxe(Camera cam)
Selects the closest displayable X axe from cameraprotected int
findClosestYaxe(Camera cam)
Selects the closest displayable Y axe from cameraprotected int
findClosestZaxe(Camera cam)
Selects the closest displayable Z axe from cameraList<AxeAnnotation>
getAnnotations()
protected double[]
getAxisTicks(int direction)
BoundingBox3d
getBounds()
Coord3d
getCenter()
BoundingBox3d.Corners
getCorners()
boolean[]
getHiddenQuads(Coord3d scaledEye, Coord3d center)
protected boolean[]
getHiddenQuads(IPainter painter)
Computes the visibility of each cube face.AxisLayout
getLayout()
boolean[]
getQuadIsHidden()
float[][]
getQuadX()
float[][]
getQuadY()
float[][]
getQuadZ()
Coord3d
getScale()
SpaceTransformer
getSpaceTransformer()
ITextRenderer
getTextRenderer()
View
getView()
BoundingBox3d
getWholeBounds()
Return the boundingBox of this axis, including the volume occupied by the texts.protected void
init()
protected boolean
isX(int direction)
protected boolean
isXAxeLabelDisplayed(int direction)
protected boolean
isY(int direction)
protected boolean
isYAxeLabelDisplayed(int direction)
protected boolean
isZ(int direction)
protected boolean
isZAxeLabelDisplayed(int direction)
protected int
min(double[] values)
Return the index of the minimum value contained in the input array of doubles.void
setAnnotations(List<AxeAnnotation> annotations)
void
setAxe(BoundingBox3d bbox)
protected void
setAxeBox(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)
Set the parameters and data of the AxeBox.void
setScale(Coord3d scale)
Set the scaling factor that are applyed on this object before GL2 commands.void
setSpaceTransformer(SpaceTransformer spaceTransformer)
void
setTextRenderer(ITextRenderer renderer)
void
setView(View view)
When setting a current view, the AxeBox can know the view is on mode CameraMode.TOP, and optimize some axis placement.protected void
updateHiddenQuads(IPainter painter)
-
-
-
Field Detail
-
PRECISION
protected static final int PRECISION
- See Also:
- Constant Field Values
-
view
protected View view
-
textRenderer
protected ITextRenderer textRenderer
-
rotateLabel
protected AxisLabelRotator rotateLabel
-
labels
protected AxisLabelProcessor labels
-
ticks
protected AxisTickProcessor ticks
-
layout
protected AxisLayout layout
-
boxBounds
protected BoundingBox3d boxBounds
-
wholeBounds
protected BoundingBox3d wholeBounds
-
center
protected Coord3d center
-
scale
protected Coord3d scale
-
xrange
protected float xrange
-
yrange
protected float yrange
-
zrange
protected float zrange
-
quadx
protected float[][] quadx
-
quady
protected float[][] quady
-
quadz
protected float[][] quadz
-
normx
protected float[] normx
-
normy
protected float[] normy
-
normz
protected float[] normz
-
axeXx
protected float[][] axeXx
-
axeXy
protected float[][] axeXy
-
axeXz
protected float[][] axeXz
-
axeYx
protected float[][] axeYx
-
axeYy
protected float[][] axeYy
-
axeYz
protected float[][] axeYz
-
axeZx
protected float[][] axeZx
-
axeZy
protected float[][] axeZy
-
axeZz
protected float[][] axeZz
-
axeXquads
protected int[][] axeXquads
-
axeYquads
protected int[][] axeYquads
-
axeZquads
protected int[][] axeZquads
-
quadIsHidden
protected boolean[] quadIsHidden
-
AXE_X
public static final int AXE_X
- See Also:
- Constant Field Values
-
AXE_Y
public static final int AXE_Y
- See Also:
- Constant Field Values
-
AXE_Z
public static final int AXE_Z
- See Also:
- Constant Field Values
-
depthRangeTrick
protected boolean depthRangeTrick
-
NO_OVERLAP_DEPTH_RATIO
public static float NO_OVERLAP_DEPTH_RATIO
The higher the value, the more the line are far from the faces and hence no z-fighting occurs between faces and lines. In case of higher value, line will be display more often, but also lines that should be behind the polygon
-
annotations
protected List<AxeAnnotation> annotations
-
spaceTransformer
protected SpaceTransformer spaceTransformer
-
-
Constructor Detail
-
AxisBox
public AxisBox(BoundingBox3d bbox)
-
AxisBox
public AxisBox(BoundingBox3d bbox, AxisLayout layout)
-
-
Method Detail
-
draw
public void draw(IPainter painter)
Draws the AxisBox. The camera is used to determine which axis is closest to the ur point ov view, in order to decide for an axis on which to diplay the tick values.
-
drawAnnotations
protected void drawAnnotations(IPainter painter)
-
doTransform
public void doTransform(IPainter painter)
reset to identity and apply scaling
-
cullingDisable
public void cullingDisable(IPainter painter)
-
cullingEnable
public void cullingEnable(IPainter painter)
-
drawFace
public void drawFace(IPainter painter)
-
drawGrid
public void drawGrid(IPainter painter)
-
drawCube
protected void drawCube(IPainter painter, RenderMode mode)
-
drawGridOnQuad
protected void drawGridOnQuad(IPainter painter, int quad)
-
drawTicksAndLabels
public void drawTicksAndLabels(IPainter painter)
-
drawTicksAndLabelsX
public void drawTicksAndLabelsX(IPainter painter)
-
drawTicksAndLabelsY
public void drawTicksAndLabelsY(IPainter painter)
-
drawTicksAndLabelsZ
public void drawTicksAndLabelsZ(IPainter painter)
-
isZAxeLabelDisplayed
protected boolean isZAxeLabelDisplayed(int direction)
-
isYAxeLabelDisplayed
protected boolean isYAxeLabelDisplayed(int direction)
-
isXAxeLabelDisplayed
protected boolean isXAxeLabelDisplayed(int direction)
-
isZ
protected boolean isZ(int direction)
-
isY
protected boolean isY(int direction)
-
isX
protected boolean isX(int direction)
-
getAxisTicks
protected double[] getAxisTicks(int direction)
-
findClosestXaxe
protected int findClosestXaxe(Camera cam)
Selects the closest displayable X axe from camera
-
findClosestYaxe
protected int findClosestYaxe(Camera cam)
Selects the closest displayable Y axe from camera
-
findClosestZaxe
protected int findClosestZaxe(Camera cam)
Selects the closest displayable Z axe from camera
-
min
protected int min(double[] values)
Return the index of the minimum value contained in the input array of doubles. If no value is smaller than Double.MAX_VALUE, the returned index is -1.
-
updateHiddenQuads
protected void updateHiddenQuads(IPainter painter)
-
getHiddenQuads
protected boolean[] getHiddenQuads(IPainter painter)
Computes the visibility of each cube face.
-
setAxeBox
protected void setAxeBox(float xmin, float xmax, float ymin, float ymax, float zmin, float zmax)
Set the parameters and data of the AxeBox.
-
init
protected void init()
-
getTextRenderer
public ITextRenderer getTextRenderer()
- Specified by:
getTextRenderer
in interfaceIAxis
-
setTextRenderer
public void setTextRenderer(ITextRenderer renderer)
- Specified by:
setTextRenderer
in interfaceIAxis
-
getView
public View getView()
-
getBounds
public BoundingBox3d getBounds()
-
getLayout
public AxisLayout getLayout()
-
getSpaceTransformer
public SpaceTransformer getSpaceTransformer()
- Specified by:
getSpaceTransformer
in interfaceIAxis
-
setSpaceTransformer
public void setSpaceTransformer(SpaceTransformer spaceTransformer)
- Specified by:
setSpaceTransformer
in interfaceIAxis
-
setView
public void setView(View view)
When setting a current view, the AxeBox can know the view is on mode CameraMode.TOP, and optimize some axis placement.
-
setAxe
public void setAxe(BoundingBox3d bbox)
-
getWholeBounds
public BoundingBox3d getWholeBounds()
Return the boundingBox of this axis, including the volume occupied by the texts. This requires callingdraw()
before, which computes actual ticks position in 3d, and updates the bounds.- Specified by:
getWholeBounds
in interfaceIAxis
-
setScale
public void setScale(Coord3d scale)
Set the scaling factor that are applyed on this object before GL2 commands.
-
getAnnotations
public List<AxeAnnotation> getAnnotations()
- Specified by:
getAnnotations
in interfaceIAxis
-
setAnnotations
public void setAnnotations(List<AxeAnnotation> annotations)
- Specified by:
setAnnotations
in interfaceIAxis
-
addAnnotation
public void addAnnotation(AxeAnnotation annotation)
-
getQuadX
public float[][] getQuadX()
-
getQuadY
public float[][] getQuadY()
-
getQuadZ
public float[][] getQuadZ()
-
getQuadIsHidden
public boolean[] getQuadIsHidden()
-
getCorners
public BoundingBox3d.Corners getCorners()
-
-