visad.bom
Class SceneGraphRenderer
- java.lang.Object
-
- visad.bom.SceneGraphRenderer
-
public class SceneGraphRenderer extends java.lang.ObjectRender the non-texture components of a scene graph to a Graphics2D. This does not handle any 3D aspect, rotation, etc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description classSceneGraphRenderer.ChartExceptionChart exceptionclassSceneGraphRenderer.HatchingProvide a set of simple hatching patterns
-
Field Summary
Fields Modifier and Type Field and Description static intMODE_2D2D modestatic intMODE_3D3D mode
-
Constructor Summary
Constructors Constructor and Description SceneGraphRenderer()Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddrawShape(float[][] vertices, java.awt.Color colour, float width, java.awt.Graphics2D graphics)Draw the outline of a shape onto the chartvoiddrawShape(float[][] vertices, java.awt.Color colour, float width, int dashStyle, java.awt.Graphics2D graphics)Draw the outline of a shape onto the chartvoiddrawShapeReprojected(float[][] vertices, java.awt.Color colour, float width, java.awt.Graphics2D graphics)Draw a reprojected shapevoiddrawShapeReprojected(float[][] vertices, java.awt.Color colour, float width, int dashStyle, java.awt.Graphics2D graphics)Draw a reprojected shapevoiddrawShapeReprojected(float[][] vertices, java.awt.Color colour, float width, int dashStyle, java.awt.Graphics2D graphics, boolean isScreen)Draw a reprojected shapevoiddrawString(java.lang.String text, java.awt.Font font, java.awt.Color colour, float x, float y, java.awt.Graphics2D graphics)Draw text onto the chartvoidfillShape(float[][] vertices, java.awt.Color colour, java.awt.Graphics2D graphics)Fill a shape onto the chartvoidfillShape(float[][] data, int texture, java.awt.Graphics2D graphics)Fill a shape onto the chartvoidfillShapeReprojected(float[][] vertices, java.awt.Color colour, java.awt.Graphics2D graphics)Fill a reprojected shapevoidfillShapeReprojected(float[][] vertices, java.awt.Color colour, java.awt.Graphics2D graphics, boolean isScreen)Fill a reprojected shapevoidfillShapeReprojected(float[][] vertices, int texture, java.awt.Graphics2D graphics)Fill a reprojected shape from a texturevoidfillShapeReprojected(float[][] vertices, int texture, java.awt.Graphics2D graphics, boolean isScreen)Fill a reprojected shape from a texturejava.awt.Color[]getColours()Get a list of the colours used in the chart This may be necessary if the chart is being plotted to a medium with limited colours, eg.floatgetLineWidth()Get the line widthfloat[][]getLonLatSamples(int xSize, int ySize)Return an array of Longitudes/Latitudes corresponding to the pixels of the chart.voidplot(java.awt.Graphics2D graphics, DisplayImpl display, CoordinateSystem cs, int width, int height)Implements the Plottable interface.intprint(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex, DisplayImpl display, CoordinateSystem cs)Print the displayvoidsetTransformToScreenCoords(boolean value)Set whether the vertices should be transformed from display coords to screen coords before drawing.
-
-
-
Field Detail
-
MODE_2D
public static final int MODE_2D
2D mode- See Also:
- Constant Field Values
-
MODE_3D
public static final int MODE_3D
3D mode- See Also:
- Constant Field Values
-
-
Method Detail
-
getLonLatSamples
public float[][] getLonLatSamples(int xSize, int ySize)Return an array of Longitudes/Latitudes corresponding to the pixels of the chart. Based on the Charts CoordinateSystem and ViewPort. In the case of an A0 chart, the number of pixels may be huge, so supply an X and Y size allowing a smaller subset to be used if necessary The purpose of this method is to allow an image to be interpolated onto the chart as an overlay (eg. sat image)- Parameters:
xSize- The size of the target X dimensionySize- The size of the target Y dimension- Returns:
- An array of Longitudes/Latitudes corresponding to the pixels of the chart, sampled to match the target x/y size. Based on the Charts CoordinateSystem and ViewPort
-
getColours
public java.awt.Color[] getColours()
Get a list of the colours used in the chart This may be necessary if the chart is being plotted to a medium with limited colours, eg. 8 bit PNG. The antialiasing and gradient fill used in some charts can easily grab all the available colours By taking the ones used specifically by the chart, the important colours can be reserved in the colour table ensuring that any colour loss has only minimal cosmetic effect- Returns:
- The colours used by this chart
-
getLineWidth
public float getLineWidth()
Get the line width- Returns:
- the line width
-
plot
public void plot(java.awt.Graphics2D graphics, DisplayImpl display, CoordinateSystem cs, int width, int height)Implements the Plottable interface. This will plot the chart to a vector graphics file Don't use this method directly. It is called by the Plotter class- Parameters:
graphics- The java2d object used by the third party graphics library to render the graphics filedisplay- the display to rendercs- the display side coordinate systemwidth- the width of the outputheight- the height of the output
-
print
public int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex, DisplayImpl display, CoordinateSystem cs)Print the display- Parameters:
graphics- Graphics to print topageFormat- the page formatpageIndex- the page indexdisplay- the display to rendercs- the display side coordinate system- Returns:
- flag for success
-
drawShapeReprojected
public void drawShapeReprojected(float[][] vertices, java.awt.Color colour, float width, java.awt.Graphics2D graphics)Draw a reprojected shape- Parameters:
vertices- verticescolour- default colorwidth- line widthgraphics- the graphics
-
drawShapeReprojected
public void drawShapeReprojected(float[][] vertices, java.awt.Color colour, float width, int dashStyle, java.awt.Graphics2D graphics)Draw a reprojected shape- Parameters:
vertices- verticescolour- default colorwidth- line widthdashStyle- line dash stylegraphics- the graphics
-
drawShapeReprojected
public void drawShapeReprojected(float[][] vertices, java.awt.Color colour, float width, int dashStyle, java.awt.Graphics2D graphics, boolean isScreen)Draw a reprojected shape- Parameters:
vertices- verticescolour- default colorwidth- line widthdashStyle- line dash stylegraphics- the graphicsisScreen- vertices are in screen coordinates
-
drawShape
public void drawShape(float[][] vertices, java.awt.Color colour, float width, int dashStyle, java.awt.Graphics2D graphics) throws VisADExceptionDraw the outline of a shape onto the chart- Parameters:
vertices- The vertices of the shape. A 2-Dimensional array. The first dimension contains the longitude values of the shape The second dimension contains the latitude values of the shapecolour- The colour of the shapewidth- The thickness of the outlinedashStyle- Set to 0 if the outline is to be drawn as dashesgraphics- The java2d graphics object supplied by the plotting/printing medium- Throws:
VisADException
-
drawShape
public void drawShape(float[][] vertices, java.awt.Color colour, float width, java.awt.Graphics2D graphics) throws VisADExceptionDraw the outline of a shape onto the chart- Parameters:
vertices- The vertices of the shape. A 2-Dimensional array. The first dimension contains the longitude values of the shape The second dimension contains the latitude values of the shapecolour- The colour of the shapewidth- The thickness of the outlinegraphics- The java2d graphics object supplied by the plotting/printing medium- Throws:
VisADException
-
fillShapeReprojected
public void fillShapeReprojected(float[][] vertices, java.awt.Color colour, java.awt.Graphics2D graphics)Fill a reprojected shape- Parameters:
vertices- the vertices of the shapecolour- the colorgraphics- the graphics
-
fillShapeReprojected
public void fillShapeReprojected(float[][] vertices, java.awt.Color colour, java.awt.Graphics2D graphics, boolean isScreen)Fill a reprojected shape- Parameters:
vertices- the vertices of the shapecolour- the colorgraphics- the graphicsisScreen- true if vertices are in screen (AWT) coordinates
-
fillShape
public void fillShape(float[][] vertices, java.awt.Color colour, java.awt.Graphics2D graphics) throws VisADExceptionFill a shape onto the chart- Parameters:
vertices- The vertices of the shape. A 2-Dimensional array. The first dimension contains the longitude values of the shape The second dimension contains the latitude values of the shapecolour- The colour of the shapegraphics- The java2d graphics object supplied by the plotting/printing medium- Throws:
VisADException
-
fillShapeReprojected
public void fillShapeReprojected(float[][] vertices, int texture, java.awt.Graphics2D graphics)Fill a reprojected shape from a texture- Parameters:
vertices- the shape verticestexture- The hatching texture to fill the shape with can be Hatching.DIAGONAL1, Hatching.DIAGONAL2, Hatching.DIAGONAL_BOTH, Hatching.HORIZONTAL = 3, Hatching.VERTICAL or Hatching.SQUAREgraphics- The java2d graphics object supplied by the plotting/printing medium
-
fillShapeReprojected
public void fillShapeReprojected(float[][] vertices, int texture, java.awt.Graphics2D graphics, boolean isScreen)Fill a reprojected shape from a texture- Parameters:
vertices- the shape verticestexture- The hatching texture to fill the shape with can be Hatching.DIAGONAL1, Hatching.DIAGONAL2, Hatching.DIAGONAL_BOTH, Hatching.HORIZONTAL = 3, Hatching.VERTICAL or Hatching.SQUAREgraphics- The java2d graphics object supplied by the plotting/printing mediumisScreen- true if vertices are in screen (AWT) coordinates
-
fillShape
public void fillShape(float[][] data, int texture, java.awt.Graphics2D graphics) throws VisADExceptionFill a shape onto the chart- Parameters:
data- The vertices of the shape. A 2-Dimensional array. The first dimension contains the longitude values of the shape The second dimension contains the latitude values of the shapetexture- The hatching texture to fill the shape with can be Hatching.DIAGONAL1, Hatching.DIAGONAL2, Hatching.DIAGONAL_BOTH, Hatching.HORIZONTAL = 3, Hatching.VERTICAL or Hatching.SQUAREgraphics- The java2d graphics object supplied by the plotting/printing medium- Throws:
VisADException- problem transforming from lat/lon to display space
-
drawString
public void drawString(java.lang.String text, java.awt.Font font, java.awt.Color colour, float x, float y, java.awt.Graphics2D graphics) throws VisADExceptionDraw text onto the chart- Parameters:
text- The text to draw onto the chartfont- The font of the textcolour- The colour of the textx- The x position of the text (longitude)y- The y position of the text (latitude)graphics- The java2d graphics object supplied by the plotting/printing medium- Throws:
VisADException
-
setTransformToScreenCoords
public void setTransformToScreenCoords(boolean value)
Set whether the vertices should be transformed from display coords to screen coords before drawing. This ends up bypassing the use of the AffineTransform when drawing. Use this if you are in a rotated 3D display.- Parameters:
value- true to transform
-
-
DMelt 3.0 © DataMelt by jWork.ORG