public class GraphMetrics extends Object
This class extends the GraphMetrics to provide not only metrics on the graphic graph but also on the rendering canvas, and allow to convert from graph metrics to canvas metrics and the reverse.
Here we call the canvas "view port" since this class allows to place a view port inside the graph in order to zoom and pan the view.
Modifier and Type | Field and Description |
---|---|
double |
diagonal
The graph diagonal.
|
Point3 |
hi
Graph higher position (top,right,back).
|
Point3 |
hiVisible
The highest visible point.
|
Point3 |
lo
Graph lower position (bottom,left,front).
|
Point3 |
loVisible
The lowest visible point.
|
double |
px1
The length for one pixel, according to the current transformation.
|
double |
ratioPx2Gu
The scaling factor to pass from graph units to pixels.
|
Vector3 |
size
Graph dimension.
|
double[] |
viewport
The view port size.
|
Constructor and Description |
---|
GraphMetrics()
New canvas metrics with default values.
|
Modifier and Type | Method and Description |
---|---|
double |
getDiagonal()
The graph diagonal (the overall width).
|
Point3 |
getHighPoint()
The graph highest (top,right,back) point.
|
Point3 |
getLowPoint()
The graph lowest (bottom,left,front) point.
|
Vector3 |
getSize()
The graph bounds.
|
double |
graphDepthGU() |
double |
graphHeightGU() |
double |
graphWidthGU() |
double |
lengthToGu(double value,
StyleConstants.Units units)
Convert a value in given units to graph units.
|
double |
lengthToGu(Value value)
Convert a value in a given units to graph units.
|
double |
lengthToGu(Values values,
int index)
Convert one of the given values in a given units to graph units.
|
double |
lengthToPx(double value,
StyleConstants.Units units)
Convert a value in a given units to pixels.
|
double |
lengthToPx(Value value)
Convert a value in a given units to pixels.
|
double |
lengthToPx(Values values,
int index)
Convert one of the given values in a given units pixels.
|
double |
positionPixelToGu(int pixels,
int index) |
void |
setBounds(double minx,
double miny,
double minz,
double maxx,
double maxy,
double maxz)
Set the graphic graph bounds (the lowest and highest points).
|
protected void |
setDefaults()
Set defaults value in the lo, hi and size fields to (-1) and (1)
respectively.
|
void |
setRatioPx2Gu(double ratio)
The ratio to pass by multiplication from pixels to graph units.
|
void |
setViewport(double viewportX,
double viewportY,
double viewportWidth,
double viewportHeight)
Set the output view port size in pixels.
|
String |
toString() |
public double diagonal
public double[] viewport
public double ratioPx2Gu
public double px1
public GraphMetrics()
protected void setDefaults()
public double getDiagonal()
public Point3 getLowPoint()
public Point3 getHighPoint()
public double graphWidthGU()
public double graphHeightGU()
public double graphDepthGU()
public double lengthToGu(double value, StyleConstants.Units units)
value
- The value to convert.units
- The units the value to convert is expressed in.public double lengthToGu(Value value)
value
- The value to convert (it contains its own units).public double lengthToGu(Values values, int index)
values
- The values set containing the value to convert (it contains
its own units).index
- Index of the value to convert.public double lengthToPx(double value, StyleConstants.Units units)
value
- The value to convert.units
- The units the value to convert is expressed in.public double lengthToPx(Value value)
value
- The value to convert (it contains its own units).public double lengthToPx(Values values, int index)
values
- The values set containing the value to convert (it contains
its own units).index
- Index of the value to convert.public double positionPixelToGu(int pixels, int index)
public void setViewport(double viewportX, double viewportY, double viewportWidth, double viewportHeight)
viewportWidth
- The width in pixels of the view port.viewportHeight
- The width in pixels of the view port.public void setRatioPx2Gu(double ratio)
ratio
- The ratio.public void setBounds(double minx, double miny, double minz, double maxx, double maxy, double maxz)
minx
- Lowest abscissa.miny
- Lowest ordinate.minz
- Lowest depth.maxx
- Highest abscissa.maxy
- Highest ordinate.maxz
- Highest depth.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses