Class Drawer


  • public class Drawer
    extends Object
    This class is used to isolate GeoTools from the specific graphic library being used for rendering.
    • 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 to
        feature - Feature to be rendered
        style - Style to render feature with
      • getSymbolizers

        public static Symbolizer[] getSymbolizers​(Class<? extends Geometry> type,
                                                  Color baseColor,
                                                  boolean useTransparency)
      • 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