Package org.geotools.map.legend
Class Drawer
- Object
-
- Drawer
-
public class Drawer extends Object
This class is used to isolate GeoTools from the specific graphic library being used for rendering.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Drawer
create()
Retrieve the default Drawing implementation.void
drawDirect(BufferedImage bi, SimpleFeature feature, Rule rule)
void
drawDirect(BufferedImage bi, SimpleFeature feature, Style style)
Used to draw a freature directly onto the provided image.void
drawFeature(BufferedImage bi, SimpleFeature feature, AffineTransform worldToScreenTransform)
void
drawFeature(BufferedImage bi, SimpleFeature feature, AffineTransform worldToScreenTransform, boolean drawVertices, MathTransform mt)
void
drawFeature(BufferedImage bi, SimpleFeature feature, AffineTransform worldToScreenTransform, boolean drawVertices, Symbolizer[] symbs, MathTransform mt)
void
drawFeature(BufferedImage bi, SimpleFeature feature, AffineTransform worldToScreenTransform, boolean drawVertices, Symbolizer symbolizer, MathTransform mathTransform, LiteShape shape)
void
drawFeature(BufferedImage bi, SimpleFeature feature, AffineTransform worldToScreenTransform, Style style)
void
drawFeature(BufferedImage bi, SimpleFeature feature, Style style, AffineTransform worldToScreenTransform)
SimpleFeature
feature(Geometry geom)
Just a convinient method to create feature from geometry.SimpleFeature
feature(LineString line)
Simple Feature with a default geometry and no attribtues.SimpleFeature
feature(MultiLineString multilinestring)
Simple Feature with a default geometry and no attribtues.SimpleFeature
feature(MultiPoint multipoint)
Simple Feature with a default geometry and no attribtues.SimpleFeature
feature(MultiPolygon multipolygon)
Simple Feature with a default geometry and no attribtues.SimpleFeature
feature(Point point)
Simple feature with one attribute called "point".SimpleFeature
feature(Polygon polygon)
Simple Feature with a default geometry and no attribtues.static Symbolizer[]
getSymbolizers(Class<? extends Geometry> type, Color baseColor)
static Symbolizer[]
getSymbolizers(Class<? extends Geometry> type, Color baseColor, boolean useTransparency)
static Symbolizer[]
getSymbolizers(SimpleFeature feature)
LineString
line(int[] xy)
Generate LineStrings from two dimensional ordinatesMultiLineString
lines(int[][] xy)
Generate a MultiLineString from two dimensional ordinatesPoint
point(int x, int y)
Generate Point from two dimensional ordinatesPolygon
polygon(int[] xy)
Convience constructor for GeometryFactory.createPolygon.Polygon
polygon(int[] xy, int[][] holes)
Convience constructor for GeometryFactory.createPolygon.LinearRing
ring(int[] xy)
Convience constructor for GeometryFactory.createLinearRing.SimpleFeatureType
schema(String name, String spec)
Create a SimpleFeatureType schema using a type short hand.Point
worldToPixel(Coordinate coord, AffineTransform worldToScreenTransform)
static AffineTransform
worldToScreenTransform(Envelope mapExtent, Rectangle screenSize)
TODO summary sentence for worldToScreenTransform ...
-
-
-
Method Detail
-
create
public static Drawer create()
Retrieve the default Drawing implementation.- Returns:
- Drawing ready for use
-
drawDirect
public void drawDirect(BufferedImage bi, SimpleFeature feature, Style style)
Used to draw a freature directly onto the provided image.Feature coordintes are in the same coordinates as the image.
You may call this method multiple times to draw several features onto the same Image (say for glyph creation).
- Parameters:
bi
- Image to render on tofeature
- Feature to be renderedstyle
- Style to render feature with
-
drawDirect
public void drawDirect(BufferedImage bi, SimpleFeature feature, Rule rule)
-
drawFeature
public void drawFeature(BufferedImage bi, SimpleFeature feature, AffineTransform worldToScreenTransform, boolean drawVertices, MathTransform mt)
-
drawFeature
public void drawFeature(BufferedImage bi, SimpleFeature feature, AffineTransform worldToScreenTransform)
-
drawFeature
public void drawFeature(BufferedImage bi, SimpleFeature feature, AffineTransform worldToScreenTransform, Style style)
-
drawFeature
public void drawFeature(BufferedImage bi, SimpleFeature feature, Style style, AffineTransform worldToScreenTransform)
-
getSymbolizers
public static Symbolizer[] getSymbolizers(SimpleFeature feature)
-
getSymbolizers
public static Symbolizer[] getSymbolizers(Class<? extends Geometry> type, Color baseColor)
-
getSymbolizers
public static Symbolizer[] getSymbolizers(Class<? extends Geometry> type, Color baseColor, boolean useTransparency)
-
drawFeature
public void drawFeature(BufferedImage bi, SimpleFeature feature, AffineTransform worldToScreenTransform, boolean drawVertices, Symbolizer[] symbs, MathTransform mt)
-
drawFeature
public void drawFeature(BufferedImage bi, SimpleFeature feature, AffineTransform worldToScreenTransform, boolean drawVertices, Symbolizer symbolizer, MathTransform mathTransform, LiteShape shape)
-
worldToPixel
public Point worldToPixel(Coordinate coord, AffineTransform worldToScreenTransform)
-
worldToScreenTransform
public static AffineTransform worldToScreenTransform(Envelope mapExtent, Rectangle screenSize)
TODO summary sentence for worldToScreenTransform ...
-
schema
public SimpleFeatureType schema(String name, String spec)
Create a SimpleFeatureType schema using a type short hand.Code Example:
new Drawing().schema("namespace.typename", "id:0,*geom:LineString,name:String,*centroid:Point");
- SimpleFeatureType with identifier "namespace.typename"
- Default Geometry "geom" of type LineStirng indicated with a "*"
- Three attributes: id of type Integer, name of type String and centroid of type Point
- Parameters:
name
- namespace.name- Returns:
- Generated SimpleFeatureType
-
feature
public SimpleFeature feature(Geometry geom)
Just a convinient method to create feature from geometry.- Parameters:
geom
- the geometry to create feature from- Returns:
- feature instance
-
feature
public SimpleFeature feature(Point point)
Simple feature with one attribute called "point".- Returns:
- SimpleFeature with a default geometry and no attribtues
-
feature
public SimpleFeature feature(LineString line)
Simple Feature with a default geometry and no attribtues.- Returns:
- Feature with a default geometry and no attribtues
-
feature
public SimpleFeature feature(Polygon polygon)
Simple Feature with a default geometry and no attribtues.- Returns:
- Feature with a default geometry and no attribtues
-
feature
public SimpleFeature feature(MultiPoint multipoint)
Simple Feature with a default geometry and no attribtues.- Returns:
- Feature with a default geometry and no attribtues
-
feature
public SimpleFeature feature(MultiLineString multilinestring)
Simple Feature with a default geometry and no attribtues.- Returns:
- Feature with a default geometry and no attribtues
-
feature
public SimpleFeature feature(MultiPolygon multipolygon)
Simple Feature with a default geometry and no attribtues.- Returns:
- Feature with a default geometry and no attribtues
-
point
public Point point(int x, int y)
Generate Point from two dimensional ordinates- Returns:
- Point
-
line
public LineString line(int[] xy)
Generate LineStrings from two dimensional ordinates- Returns:
- LineStirng
-
lines
public MultiLineString lines(int[][] xy)
Generate a MultiLineString from two dimensional ordinates- Returns:
- MultiLineStirng
-
polygon
public Polygon polygon(int[] xy)
Convience constructor for GeometryFactory.createPolygon.The provided xy ordinates are turned into a linear rings.
- Parameters:
xy
- Two dimensional ordiantes.- Returns:
- Polygon
-
polygon
public Polygon polygon(int[] xy, int[][] holes)
Convience constructor for GeometryFactory.createPolygon.The provided xy and holes are turned into linear rings.
- Parameters:
xy
- Two dimensional ordiantes.holes
- Holes in polygon or null.- Returns:
- Polygon
-
ring
public LinearRing ring(int[] xy)
Convience constructor for GeometryFactory.createLinearRing.- Parameters:
xy
- Two dimensional ordiantes.- Returns:
- LinearRing for use with polygon
-
-