Package com.treasure.hunt.jts.awt
Class AdvancedShapeWriter
- java.lang.Object
-
- org.locationtech.jts.awt.ShapeWriter
-
- com.treasure.hunt.jts.awt.AdvancedShapeWriter
-
public class AdvancedShapeWriter extends org.locationtech.jts.awt.ShapeWriter
Enhances the jtsShapeWriter
with handling the render process forShapeable
instances. In general, it shares aPointTransformation
object to translate theShapeable
's Geometry into translated and scaled awtShape
's.
-
-
Constructor Summary
Constructors Constructor Description AdvancedShapeWriter(PointTransformation pointTransformation)
Constructor for AdvancedShapeWriter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.geom.Arc2D
createArc(org.locationtech.jts.geom.Coordinate center, double dimension, double start, double extend)
Utility function to construct an already transformedArc2D
with non-scalable width and height.java.awt.geom.Line2D
createFixedLine(org.locationtech.jts.geom.Coordinate fixed, org.locationtech.jts.geom.Coordinate floating, double length)
Utility function to construct an already transformedLine2D
with non-scalable length.java.awt.geom.Line2D
createLine(org.locationtech.jts.geom.Coordinate from, org.locationtech.jts.geom.Coordinate to)
Utility function to construct an already transformedLine2D
.CanvasBoundary
getBoundary()
The boundary of the associatedCanvas
.PointTransformation
getPointTransformation()
ThePointTransformation
transforming a sourceCoordinate
.void
setBoundary(CanvasBoundary boundary)
The boundary of the associatedCanvas
.java.awt.Shape
toShape(java.lang.Object object)
Wrapper function forShapeWriter.toShape(Geometry)
to extend functionality forShapeable
instances.void
transform(org.locationtech.jts.geom.Coordinate src, java.awt.geom.Point2D dest)
Wrapper transform function fortransform(Coordinate, Point2D)
-
-
-
Constructor Detail
-
AdvancedShapeWriter
public AdvancedShapeWriter(PointTransformation pointTransformation)
Constructor for AdvancedShapeWriter.- Parameters:
pointTransformation
-PointTransformation
used in rendering process.
-
-
Method Detail
-
toShape
public java.awt.Shape toShape(java.lang.Object object)
Wrapper function forShapeWriter.toShape(Geometry)
to extend functionality forShapeable
instances.- Parameters:
object
- object to transfer to aShape
- Returns:
Shape
representing theobject
. Could benull
.
-
transform
public void transform(org.locationtech.jts.geom.Coordinate src, java.awt.geom.Point2D dest)
Wrapper transform function fortransform(Coordinate, Point2D)
- Parameters:
src
- source Coordinatedest
- point we want to transform
-
createLine
public java.awt.geom.Line2D createLine(org.locationtech.jts.geom.Coordinate from, org.locationtech.jts.geom.Coordinate to)
Utility function to construct an already transformedLine2D
.- Parameters:
from
- startCoordinate
to
- endCoordinate
- Returns:
Line2D
Shape
representing the line
-
createFixedLine
public java.awt.geom.Line2D createFixedLine(org.locationtech.jts.geom.Coordinate fixed, org.locationtech.jts.geom.Coordinate floating, double length)
Utility function to construct an already transformedLine2D
with non-scalable length.- Parameters:
fixed
- startCoordinate
floating
- directionCoordinate
length
- fixed length the line is rendered with- Returns:
Line2D
Shape
representing the line
-
createArc
public java.awt.geom.Arc2D createArc(org.locationtech.jts.geom.Coordinate center, double dimension, double start, double extend)
Utility function to construct an already transformedArc2D
with non-scalable width and height.- Parameters:
center
- centerCoordinate
the arc is positioned arounddimension
- width and height of the arcstart
- start angle relative to x-axis in radiansextend
- extend angle (relative to start angle) in radians- Returns:
- transformed open
Arc2D
-
getPointTransformation
public PointTransformation getPointTransformation()
ThePointTransformation
transforming a sourceCoordinate
.
-
setBoundary
public void setBoundary(CanvasBoundary boundary)
The boundary of the associatedCanvas
. Enables boundary specific shapes like endless lines, grids etc.
-
getBoundary
public CanvasBoundary getBoundary()
The boundary of the associatedCanvas
. Enables boundary specific shapes like endless lines, grids etc.
-
-