|
ChartCat 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectli.netcat.chart.util.AbstractPart
li.netcat.chart.util.PerspectivePart
Adds a 3D effect to a given Part
and changes its look for example to the following:
It is possible to specify the perspective as well as the position and brightness of the light source.
The implementation of the 3D effect is
separated from the Part
implementation and can thereby easily be replaced.
The whole chart is divided into its basic elements like lines and shapes
whereas each element has its perspective "position".
This class supports three different perspective "positions":
The value FOREGROUND
will paint the element in the foreground, BACKGROUND
in the
background and PERSPECTIVE
will foreshorten it. Other implementations may support other
perspective positions.
The elements of a Part
usually have already the right perspective position.
If not, use its perspective position to change it. For example:
CartesianGridPart.setHorizontalLinesPerspective(ChartConatants.PERSPECTIVE);
.
Field Summary |
Fields inherited from class li.netcat.chart.util.AbstractPart |
BACKGROUND, FOREGROUND, PERSPECTIVE |
Constructor Summary | |
PerspectivePart(Part part)
Constructs a new perspective part that adds a 3D perspective to the given part. |
Method Summary | |
Layout |
getLayout(java.awt.Graphics g)
Returns an instance of a layout that is able to report the bounds of this part and is able to paint this part. |
int |
getLightX()
Returns the x-direction of the light vector. |
int |
getLightY()
Returns the y-direction of the light vector. |
float |
getVanishingPointX()
Returns the vanishing point in x-direction. |
float |
getVanishingPointY()
Returns the vanishing point in y-direction. |
void |
setChart(Chart chart)
Sets the container of this part. |
void |
setLight(int lightX,
int lightY)
Sets the light vector. |
void |
setVanishingPoint(float vanishingX,
float vanishingY)
Sets the vanishing point of the 3D view. |
Methods inherited from class li.netcat.chart.util.AbstractPart |
getChart, getPerspective, invalidate, setPerspective |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PerspectivePart(Part part)
part
- The wrapped part that gets a 3D perspective.Method Detail |
public int getLightX()
public int getLightY()
public void setLight(int lightX, int lightY)
lightX
- The x-direction of the light vector.lightY
- The y-direction of the light vector.public float getVanishingPointX()
public float getVanishingPointY()
public void setVanishingPoint(float vanishingX, float vanishingY)
vanishingX
- The vanishing point in x-direction.vanishingY
- The vanishing point in y-direction.public Layout getLayout(java.awt.Graphics g)
Part
g
- The relevant graphics object.
null
.public void setChart(Chart chart)
Part
Part
is added to a chart by calling
chart.setContent(part);
. Implementers of parts must keep this reference
and invoke for example chart.invalidate()
when a property in this part changes.
setChart
in interface Part
setChart
in class AbstractPart
|
ChartCat 1.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |