01: /*
02: * Geotools2 - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002, Geotools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package org.geotools.renderer.shape.shapehandler.jts;
18:
19: import java.awt.Rectangle;
20:
21: import org.geotools.data.shapefile.shp.ShapeType;
22: import org.geotools.geometry.jts.LiteCoordinateSequence;
23: import org.geotools.geometry.jts.LiteCoordinateSequenceFactory;
24: import org.opengis.referencing.operation.MathTransform;
25: import org.opengis.referencing.operation.TransformException;
26:
27: import com.vividsolutions.jts.geom.Envelope;
28: import com.vividsolutions.jts.geom.GeometryFactory;
29: import com.vividsolutions.jts.geom.impl.PackedCoordinateSequenceFactory;
30:
31: /**
32: * A ShapeHandler that reads PointHandler objects from a file. It returns a
33: * SimpleGeometry and decimates all points that map to the same screen location.
34: *
35: * @author jeichar
36: * @since 2.1.x
37: * @source $URL:
38: * http://svn.geotools.org/geotools/branches/2.2.x/ext/shaperenderer/src/org/geotools/renderer/shape/PointHandler.java $
39: */
40: public class PointHandler extends
41: org.geotools.renderer.shape.shapehandler.simple.PointHandler {
42: private static final GeometryFactory factory = new GeometryFactory(
43: new LiteCoordinateSequenceFactory());
44:
45: public PointHandler(ShapeType type, Envelope env,
46: Rectangle screenSize, MathTransform mt, boolean hasOpacity)
47: throws TransformException {
48: super (type, env, screenSize, mt, hasOpacity);
49: }
50:
51: protected Object createGeometry(ShapeType type, Envelope geomBBox,
52: double[][] transformed) {
53: return factory.createPoint(new LiteCoordinateSequence(
54: transformed[0]));
55: }
56:
57: }
|