Package org.geotools.geometry.jts

Examples of org.geotools.geometry.jts.LiteCoordinateSequence


      for (int i = 0; i < length; i++) {
        decimateTransformGeneralize(collection.getGeometryN(i),
            transform);
      }
    } else if (geometry instanceof Point) {
      LiteCoordinateSequence seq = (LiteCoordinateSequence) ((Point) geometry)
          .getCoordinateSequence();
      decimateTransformGeneralize(seq, transform);
    } else if (geometry instanceof Polygon) {
      Polygon polygon = (Polygon) geometry;
      decimateTransformGeneralize(polygon.getExteriorRing(), transform);
      final int length = polygon.getNumInteriorRing();
      for (int i = 0; i < length; i++) {
        decimateTransformGeneralize(polygon.getInteriorRingN(i),
            transform);
      }
    } else if (geometry instanceof LineString) {
      LiteCoordinateSequence seq = (LiteCoordinateSequence) ((LineString) geometry)
          .getCoordinateSequence();
      decimateTransformGeneralize(seq, transform);
    }
  }
View Full Code Here


     
    } else if (geom instanceof LineString) {
      LineString line = (LineString) geom;
      CoordinateSequence seq = (CoordinateSequence) line
          .getCoordinateSequence();
      LiteCoordinateSequence lseq=new LiteCoordinateSequence(seq.toCoordinateArray());
     
      if (decimateOnEnvelope(line, lseq)) {
        if(lseq.size()>=2)
          return gFac.createLineString(lseq);
      }
      if(lseq.size()>=2)
        return gFac.createLineString(decimate(lseq));
      return null;
    } else if (geom instanceof Polygon) {
      Polygon line = (Polygon) geom;
      Coordinate[] exterior=decimate(line.getExteriorRing()).getCoordinates();
View Full Code Here

    }
   
    @Test
    public void testScreenMapMemory() {
        // build a feature source with two zig-zag line occupying the same position
        LiteCoordinateSequence cs = new LiteCoordinateSequence(new double[] {0, 0, 1, 1, 2, 0, 3, 1, 4, 0});
        SimpleFeature zigzag1 = SimpleFeatureBuilder.build(testLineFeatureType, new Object[] { gf.createLineString(cs) }, "zz1");
        SimpleFeature zigzag2 = SimpleFeatureBuilder.build(testLineFeatureType, new Object[] { gf.createLineString(cs) }, "zz2");
        DefaultFeatureCollection fc = new DefaultFeatureCollection();
        fc.add(zigzag1);
        fc.add(zigzag2);
View Full Code Here

        assertEquals(3, controlPoints[9], 0d);
    }

    public void testEncodeSimple() throws Exception {
        LineString curve = new CurvedGeometryFactory(0.1)
                .createCurvedGeometry(new LiteCoordinateSequence(new double[] { 1, 1, 2, 2, 3, 1,
                        5, 5, 7, 3 }));
        Document dom = encode(curve, GML.curveProperty);
        // print(dom);
        XpathEngine xpath = XMLUnit.newXpathEngine();
        String basePath = "/gml:curveProperty/gml:Curve/gml:segments/gml:ArcString";
View Full Code Here

    }

    public void testEncodeCompound() throws Exception {
        // create a compound curve
        CurvedGeometryFactory factory = new CurvedGeometryFactory(0.1);
        LineString curve = factory.createCurvedGeometry(new LiteCoordinateSequence(1, 1, 2, 2, 3,
                1, 5, 5, 7, 3));
        LineString straight = factory.createLineString(new LiteCoordinateSequence(7, 3, 10, 15));
        LineString compound = factory.createCurvedGeometry(curve, straight);

        // encode
        Document dom = encode(compound, GML.curveProperty);
        // print(dom);
View Full Code Here

        assertEquals(1, CoordinateSequences.coordinateDimension(geom));
    }
   
    @Test
    public void testCoordinateDimensionPointLite2D() {
        Geometry geom = liteGF.createPoint(new LiteCoordinateSequence(new double[] { 1, 2 }, 2));
        assertEquals(2, CoordinateSequences.coordinateDimension(geom));
    }
View Full Code Here

    }

    @Test
    public void testCoordinateDimensionPointLite3D() {
        Geometry geom = liteGF
                .createPoint(new LiteCoordinateSequence(new double[] { 1, 2, 99 }, 3));
        assertEquals(3, CoordinateSequences.coordinateDimension(geom));
    }
View Full Code Here

            }
        }

        @Override
        public Polygon getBuffer(double distance) {
            CoordinateSequence cs = new LiteCoordinateSequence(quadrantSegments * 4 + 1, 2);

            for (int i = 0; i < (cs.size() - 1); i++) {
                double azimuth = 360.0 * i / cs.size() - 180;
                calculator.setDirection(azimuth, distance);
                Point2D dp = calculator.getDestinationGeographicPoint();
                if (latLon) {
                    cs.setOrdinate(i, 0, dp.getY());
                    cs.setOrdinate(i, 1, dp.getX());
                } else {
                    cs.setOrdinate(i, 0, dp.getX());
                    cs.setOrdinate(i, 1, dp.getY());
                }
            }
            cs.setOrdinate(cs.size() - 1, 0, cs.getOrdinate(0, 0));
            cs.setOrdinate(cs.size() - 1, 1, cs.getOrdinate(0, 1));

            return gf.createPolygon(gf.createLinearRing(cs), null);
        }
View Full Code Here

     * with a 2D coordinate.
     *
     * @return a 2D Point
     */
    public static Point pointLite2D() {
        return liteGF.createPoint(new LiteCoordinateSequence(new double[] { 1, 2}, 2));
    }
View Full Code Here

     * with a 2D coordinate.
     *
     * @return a 2D Point
     */
    public static Point pointLite3D() {
        return liteGF.createPoint(new LiteCoordinateSequence(new double[] { 1, 2, 100}, 3));
    }
View Full Code Here

TOP

Related Classes of org.geotools.geometry.jts.LiteCoordinateSequence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.