Package org.tinfour.voronoi
Class BoundedVoronoiStylerDefault
- java.lang.Object
-
- org.tinfour.voronoi.BoundedVoronoiStylerDefault
-
- All Implemented Interfaces:
IBoundedVoronoiStyler
public class BoundedVoronoiStylerDefault extends Object implements IBoundedVoronoiStyler
A default implementation of the styler interface.
-
-
Constructor Summary
Constructors Constructor Description BoundedVoronoiStylerDefault()Standard constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyStylingForAreaFill(Graphics2D g, ThiessenPolygon polygon)Applies styling for area fill operations.voidapplyStylingForLineDrawing(Graphics2D g, ThiessenPolygon polygon)Applies styling for line drawing operations.IBoundedVoronoiVertexSymbolgetVertexSymbol(ThiessenPolygon polygon)Tests to see if the polygon is enabled for rendering a symbol at the vertex position and, if it is, returns a vertex symbol that can be used for rendering.voidinitializeRendering(Graphics2D g)Called once at the beginning of rendering to set up the Graphics2D surface for rendering.booleanisAreaFillEnabled()Indicates whether area-fill operations are enabledbooleanisFeatureTypeEnabled(BoundedVoronoiRenderingType type)Indicates whether features of the specified type are enabled for rendering.booleanisRenderingEnabled(ThiessenPolygon polygon, BoundedVoronoiRenderingType type)Indicates whether the specified type of rendering is enabled for the specified polygon object.voidsetAreaFillColor(Color color)Set the area fill rendering to use a single, uniform color or paint for all polygons.voidsetAreaFillEnabled(boolean enabled)Sets the option for enabling area fill operationsvoidsetAreaFillPalette(Color[] paletteSpecification)Set the area fill rendering to use a single, uniform color or paint for all polygons.voidsetLineColor(Color color)Set the color for rendering linesvoidsetLineStroke(Stroke stroke)Set the stroke for rendering linesvoidsetVertexColor(Color color)Set the color for rendering verticesvoidsetVertexLabelingEnabled(boolean enabled)Specifies whether vertex labeling is enabled.voidsetVertexLabelingFont(Font font)Sets the font for labeling verticesvoidsetVertexSymbolEnabled(boolean enabled)Specifies whether vertex symbols are to be rendered.voidsetVertexSymbolSize(double vertexSymbolSize)Sets the size for rendering vertices.
-
-
-
Method Detail
-
isFeatureTypeEnabled
public boolean isFeatureTypeEnabled(BoundedVoronoiRenderingType type)
Description copied from interface:IBoundedVoronoiStylerIndicates whether features of the specified type are enabled for rendering.This method is useful in cases where an application is required to control whether broad classes of feature types are rendered. For example, an application might be configured to draw line features, while suppressing area-fill features.
- Specified by:
isFeatureTypeEnabledin interfaceIBoundedVoronoiStyler- Parameters:
type- a valid instance of a feature type enumeration- Returns:
- true if the type is enabled for rendering; otherwise, false.
-
isRenderingEnabled
public boolean isRenderingEnabled(ThiessenPolygon polygon, BoundedVoronoiRenderingType type)
Description copied from interface:IBoundedVoronoiStylerIndicates whether the specified type of rendering is enabled for the specified polygon object.This method is useful in cases where rendering of one type to be enabled for a specific polygon while rendering of another type is not. For example, an application may be configured to draw line features for most polygons while area-filling a specific polygon.
- Specified by:
isRenderingEnabledin interfaceIBoundedVoronoiStyler- Parameters:
polygon- a valid polygontype- a valid instance of a feature type enumeration- Returns:
- true if the polygon is enabled for the specified rendering type; otherwise, false.
-
initializeRendering
public void initializeRendering(Graphics2D g)
Description copied from interface:IBoundedVoronoiStylerCalled once at the beginning of rendering to set up the Graphics2D surface for rendering. One common use of this routine is to ensure that anti-aliasing is activated, though other settings may also be applied.- Specified by:
initializeRenderingin interfaceIBoundedVoronoiStyler- Parameters:
g- the graphics surface for rendering
-
applyStylingForAreaFill
public void applyStylingForAreaFill(Graphics2D g, ThiessenPolygon polygon)
Description copied from interface:IBoundedVoronoiStylerApplies styling for area fill operations. Styling may include setting a Java Color or Paint, a Composite, clipping, etc.- Specified by:
applyStylingForAreaFillin interfaceIBoundedVoronoiStyler- Parameters:
g- the graphics surface for renderingpolygon- a valid polygon instance
-
applyStylingForLineDrawing
public void applyStylingForLineDrawing(Graphics2D g, ThiessenPolygon polygon)
Description copied from interface:IBoundedVoronoiStylerApplies styling for line drawing operations. Styling may include setting a Java Color or Paint, a Stroke, a Composite, clipping, etc.- Specified by:
applyStylingForLineDrawingin interfaceIBoundedVoronoiStyler- Parameters:
g- the graphics surface for renderingpolygon- a valid polygon instance
-
setLineColor
public void setLineColor(Color color)
Set the color for rendering lines- Parameters:
color- a valid color object
-
setLineStroke
public void setLineStroke(Stroke stroke)
Set the stroke for rendering lines- Parameters:
stroke- a valid stroke object
-
setAreaFillColor
public void setAreaFillColor(Color color)
Set the area fill rendering to use a single, uniform color or paint for all polygons.- Parameters:
color- a valid Color or Paint object
-
setAreaFillPalette
public void setAreaFillPalette(Color[] paletteSpecification)
Set the area fill rendering to use a single, uniform color or paint for all polygons.- Parameters:
paletteSpecification- a valid array of Color or Paint objects
-
setVertexColor
public void setVertexColor(Color color)
Set the color for rendering vertices- Parameters:
color- a valid color object
-
setVertexLabelingFont
public void setVertexLabelingFont(Font font)
Sets the font for labeling vertices- Parameters:
font- a valid font
-
setVertexLabelingEnabled
public void setVertexLabelingEnabled(boolean enabled)
Specifies whether vertex labeling is enabled.- Parameters:
enabled- true if vertices are to be labeled; otherwise, false
-
setVertexSymbolSize
public void setVertexSymbolSize(double vertexSymbolSize)
Sets the size for rendering vertices. By default, vertices are rendered as a filled circle using the line color specification. The size is the diameter (width and height) of the circle. Applications using other presentations for vertices are free to interpret this value as appropriate.- Parameters:
vertexSymbolSize- a value greater than zero
-
setVertexSymbolEnabled
public void setVertexSymbolEnabled(boolean enabled)
Specifies whether vertex symbols are to be rendered.- Parameters:
enabled- true if vertex symbols are to be rendered; otherwise, false
-
getVertexSymbol
public IBoundedVoronoiVertexSymbol getVertexSymbol(ThiessenPolygon polygon)
Tests to see if the polygon is enabled for rendering a symbol at the vertex position and, if it is, returns a vertex symbol that can be used for rendering.- Specified by:
getVertexSymbolin interfaceIBoundedVoronoiStyler- Parameters:
polygon- a valid polygon- Returns:
- if rendering is enabled, a valid symbol instance; otherwise, a null.
-
setAreaFillEnabled
public void setAreaFillEnabled(boolean enabled)
Sets the option for enabling area fill operations- Specified by:
setAreaFillEnabledin interfaceIBoundedVoronoiStyler- Parameters:
enabled- true if the Theissen polygons (Voronoi cells) are to be area-filled; otherwise, false.
-
isAreaFillEnabled
public boolean isAreaFillEnabled()
Indicates whether area-fill operations are enabled- Returns:
- true if the Theissen polygons (Voronoi cells) are to be area-filled; otherwise, false.
-
-