org.geotools.renderer.shape.shapehandler.simple
Class MultiLineHandler

java.lang.Object
  extended by org.geotools.renderer.shape.shapehandler.simple.MultiLineHandler
All Implemented Interfaces:
ShapeHandler
Direct Known Subclasses:
MultiLineHandler

public class MultiLineHandler
extends java.lang.Object
implements ShapeHandler

Creates Geometry line objects for use by the ShapeRenderer.

Since:
2.1.x
Author:
jeichar

Constructor Summary
MultiLineHandler(ShapeType type, com.vividsolutions.jts.geom.Envelope env, org.opengis.referencing.operation.MathTransform mt, boolean hasOpacity, java.awt.Rectangle screenSize)
          Create new instance
 
Method Summary
 boolean bboxIntersectSegment(boolean intersection, double[] coords, int index)
           
protected  java.lang.Object createGeometry(ShapeType type, com.vividsolutions.jts.geom.Envelope geomBBox, double[][] transformed)
           
 int getLength(java.lang.Object geometry)
          Get the length of the given geometry Object in bytes not 16-bit words.
 ShapeType getShapeType()
          Get the ShapeType of this handler.
static boolean intersect(double x0, double y0, double x1, double y1, double xmin, double ymin, double xmax, double ymax)
          Uses Cohen Sutherland line clipping algorithm to determine intersection.
 java.lang.Object read(java.nio.ByteBuffer buffer, ShapeType type)
          Read a geometry from the ByteBuffer.
 void write(java.nio.ByteBuffer buffer, java.lang.Object geometry)
          Write the geometry into the ByteBuffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiLineHandler

public MultiLineHandler(ShapeType type,
                        com.vividsolutions.jts.geom.Envelope env,
                        org.opengis.referencing.operation.MathTransform mt,
                        boolean hasOpacity,
                        java.awt.Rectangle screenSize)
                 throws org.opengis.referencing.operation.TransformException
Create new instance

Parameters:
type - the type of shape.
env - the area that is visible. If shape is not in area then skip.
mt - the transform to go from data to the envelope (and that should be used to transform the shape coords)
hasOpacity -
screenSize -
Throws:
org.opengis.referencing.operation.TransformException
Method Detail

getShapeType

public ShapeType getShapeType()
Description copied from interface: ShapeHandler
Get the ShapeType of this handler.

Specified by:
getShapeType in interface ShapeHandler
Returns:
The ShapeType.
See Also:
ShapeHandler.getShapeType()

read

public java.lang.Object read(java.nio.ByteBuffer buffer,
                             ShapeType type)
Description copied from interface: ShapeHandler
Read a geometry from the ByteBuffer. The buffer's position, byteOrder, and limit are set to that which is needed. The record has been read as well as the shape type integer. The handler need not worry about reading unused information as the ShapefileReader will correctly adjust the buffer position after this call.

Specified by:
read in interface ShapeHandler
Parameters:
buffer - The ByteBuffer to read from.
Returns:
A geometry object.
See Also:
ShapeHandler.read(java.nio.ByteBuffer, org.geotools.data.shapefile.shp.ShapeType)

createGeometry

protected java.lang.Object createGeometry(ShapeType type,
                                          com.vividsolutions.jts.geom.Envelope geomBBox,
                                          double[][] transformed)

bboxIntersectSegment

public boolean bboxIntersectSegment(boolean intersection,
                                    double[] coords,
                                    int index)

intersect

public static boolean intersect(double x0,
                                double y0,
                                double x1,
                                double y1,
                                double xmin,
                                double ymin,
                                double xmax,
                                double ymax)
Uses Cohen Sutherland line clipping algorithm to determine intersection. See Computer Graphics: Principles and Practice Foley, van Dam, Feiner, Hughes

Parameters:
x0 - DOCUMENT ME!
y0 - DOCUMENT ME!
x1 - DOCUMENT ME!
y1 - DOCUMENT ME!
xmin - DOCUMENT ME!
ymin - DOCUMENT ME!
xmax - DOCUMENT ME!
ymax - DOCUMENT ME!
Returns:
DOCUMENT ME!

write

public void write(java.nio.ByteBuffer buffer,
                  java.lang.Object geometry)
Description copied from interface: ShapeHandler
Write the geometry into the ByteBuffer. The position, byteOrder, and limit are all set. The handler is not responsible for writing the record or shape type integer.

Specified by:
write in interface ShapeHandler
Parameters:
buffer - The ByteBuffer to write to.
geometry - The geometry to write.
See Also:
ShapeHandler.write(java.nio.ByteBuffer, java.lang.Object)

getLength

public int getLength(java.lang.Object geometry)
Description copied from interface: ShapeHandler
Get the length of the given geometry Object in bytes not 16-bit words. This is easier to keep track of, since the ByteBuffer deals with bytes. Do not include the 8 bytes of record.

Specified by:
getLength in interface ShapeHandler
Parameters:
geometry - The geometry to analyze.
Returns:
The number of bytes the shape will take up.
See Also:
ShapeHandler.getLength(java.lang.Object)


Copyright © 1996-2010 Geotools. All Rights Reserved.