org.vfny.geoserver.responses.wms.map
Class SVGEncoder

java.lang.Object
  extended byorg.vfny.geoserver.responses.wms.map.SVGEncoder

public class SVGEncoder
extends java.lang.Object

DOCUMENT ME!


Constructor Summary
SVGEncoder()
          Creates a new SVGEncoder object.
 
Method Summary
 void abort()
          DOCUMENT ME!
 void encode(org.geotools.data.FeatureResults features, java.io.OutputStream out)
          DOCUMENT ME!
 void encode(FeatureTypeInfo[] layers, org.geotools.data.FeatureResults[] results, org.geotools.styling.Style[] styles, java.io.OutputStream out)
          DOCUMENT ME!
 boolean isAborted()
          DOCUMENT ME!
 void setCollect(boolean collect)
          If collect == true, then all the geometries will be grouped in a single SVG element by FeatureTypeInfo requested.
 void setHeight(java.lang.String height)
          sets the SVG canvas height
 void setReferenceSpace(com.vividsolutions.jts.geom.Envelope env)
          sets the "viewBox" of the generated SVG with a blur factor of 5000
 void setReferenceSpace(com.vividsolutions.jts.geom.Envelope env, float blurFactor)
          sets the "viewBox" of the generated SVG and establishes the encoding blur factor to blurFactor
 void setWidth(java.lang.String width)
          sets the SVG canvas width
 void setWriteHeader(boolean includeHeader)
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVGEncoder

public SVGEncoder()
Creates a new SVGEncoder object.

Method Detail

isAborted

public boolean isAborted()
DOCUMENT ME!

Returns:
DOCUMENT ME!

abort

public void abort()
DOCUMENT ME!


setWidth

public void setWidth(java.lang.String width)
sets the SVG canvas width

Parameters:
width - DOCUMENT ME!

setHeight

public void setHeight(java.lang.String height)
sets the SVG canvas height

Parameters:
height - DOCUMENT ME!

setCollect

public void setCollect(boolean collect)
If collect == true, then all the geometries will be grouped in a single SVG element by FeatureTypeInfo requested. The effect is like a union operation upon the geometries of the whole FeatureResults resulting in a single geometry collection.

NOTE: if this field is set, then writting of ids and attributes will be ignored, since a single <path/%gt; svg element will be printed with it's "d" attribute holding all the geometries from a single FeatureResults.

Parameters:
collect - wether to collect geometries into a single svg element for each FeatureResults

setReferenceSpace

public void setReferenceSpace(com.vividsolutions.jts.geom.Envelope env)
sets the "viewBox" of the generated SVG with a blur factor of 5000

Parameters:
env - DOCUMENT ME!
See Also:
setReferenceSpace(Envelope, float)

setWriteHeader

public void setWriteHeader(boolean includeHeader)
DOCUMENT ME!

Parameters:
includeHeader - DOCUMENT ME!

setReferenceSpace

public void setReferenceSpace(com.vividsolutions.jts.geom.Envelope env,
                              float blurFactor)
sets the "viewBox" of the generated SVG and establishes the encoding blur factor to blurFactor

establishing the blur factor means that the greatest dimension between the width and height of the new SVG coordinate space env will be divided by this factor to obtain the minimun distance allowable between two coordinates to actually encode them.

This method updates the minCoordDistance field, wich every coordinate -except the first 3 of a path element-, will be compared against the most previously written to decide if such distance is enough to encode such coordinate or it can be just skipped

In a path element, the first 3 coordinates do not get compared against the minimun coordinate separation distance as the easyest way of keeping polygon shapes consistent

NOTE: if you don't want that klind of hacky geometry generalyzation, just pass 0 (zero) as blurFactor

Parameters:
env - DOCUMENT ME!
blurFactor - DOCUMENT ME!

encode

public void encode(org.geotools.data.FeatureResults features,
                   java.io.OutputStream out)
            throws java.io.IOException
DOCUMENT ME!

Parameters:
features - DOCUMENT ME!
out - DOCUMENT ME!
Throws:
java.io.IOException - DOCUMENT ME!

encode

public void encode(FeatureTypeInfo[] layers,
                   org.geotools.data.FeatureResults[] results,
                   org.geotools.styling.Style[] styles,
                   java.io.OutputStream out)
            throws java.io.IOException
DOCUMENT ME!

Parameters:
layers - the outermost SVGg element id wich will group all the features in the collection
results - the features to be encoded as SVG vectors
styles - DOCUMENT ME!
out - SVG encoder output stream
Throws:
java.io.IOException - DOCUMENT ME!