ChartCat 1.2

li.netcat.chart.util
Class PerspectivePart

java.lang.Object
  extended byli.netcat.chart.util.AbstractPart
      extended byli.netcat.chart.util.PerspectivePart
All Implemented Interfaces:
Part

public class PerspectivePart
extends AbstractPart

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);.

Author:
Arthur Marxer

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

PerspectivePart

public PerspectivePart(Part part)
Constructs a new perspective part that adds a 3D perspective to the given part.

Parameters:
part - The wrapped part that gets a 3D perspective.
Method Detail

getLightX

public int getLightX()
Returns the x-direction of the light vector.

Returns:
The x-direction of the light vector.

getLightY

public int getLightY()
Returns the y-direction of the light vector.

Returns:
The y-direction of the light vector.

setLight

public void setLight(int lightX,
                     int lightY)
Sets the light vector. The longer the vector the brighter the light.

Parameters:
lightX - The x-direction of the light vector.
lightY - The y-direction of the light vector.

getVanishingPointX

public float getVanishingPointX()
Returns the vanishing point in x-direction.

Returns:
The vanishing point in x-direction.

getVanishingPointY

public float getVanishingPointY()
Returns the vanishing point in y-direction.

Returns:
The vanishing point in y-direction.

setVanishingPoint

public void setVanishingPoint(float vanishingX,
                              float vanishingY)
Sets the vanishing point of the 3D view.

Parameters:
vanishingX - The vanishing point in x-direction.
vanishingY - The vanishing point in y-direction.

getLayout

public Layout getLayout(java.awt.Graphics g)
Description copied from interface: Part
Returns an instance of a layout that is able to report the bounds of this part and is able to paint this part.

Parameters:
g - The relevant graphics object.
Returns:
A layout that is able to report the bounds of this part and is able to paint this part. This method may also return null.

setChart

public void setChart(Chart chart)
Description copied from interface: Part
Sets the container of this part. This method should not be called by custom code. It gets called when this 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.

Specified by:
setChart in interface Part
Overrides:
setChart in class AbstractPart

ChartCat 1.2

Copyright © 2003 - 2005 NetCat Inc.. All rights reserved. Feedback

Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print, Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print, Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print