Package org.geotools.geometry.jts

Examples of org.geotools.geometry.jts.LiteCoordinateSequence


        return gf.createMultiLineString(new LineString[] { lineString(), lineString() });
    }

    public static LineString compoundCurve() {
        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);
        return compound;
    }
View Full Code Here


        return gf.createMultiPolygon(new Polygon[] { polygon(), polygon() });
    }

    public static Polygon curvePolygon() {
        LineString curve1 = gf.createCurvedGeometry(2, 0, 0, 2, 0, 2, 1, 2, 3, 4, 3);
        LineString line1 = gf.createLineString(new LiteCoordinateSequence(4, 3, 4, 5, 1, 4, 0, 0));
        LinearRing shell = (LinearRing) gf.createCurvedGeometry(Arrays.asList(curve1, line1));
        LinearRing hole = (LinearRing) gf.createCurvedGeometry(2, 1.7, 1, 1.4, 0.4, 1.6, 0.4,
                1.6, 0.5, 1.7, 1);
        return gf.createPolygon(shell, new LinearRing[] { hole });
    }
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

    }

    static CoordinateSequence positions(LineString line) {
        if (line instanceof SingleCurvedGeometry<?>) {
            SingleCurvedGeometry<?> curved = (SingleCurvedGeometry<?>) line;
            return new LiteCoordinateSequence(curved.getControlPoints());
        } else {
            return line.getCoordinateSequence();
        }
    }
View Full Code Here

        if (envelope.isNull()) {
            return null;
        }

        if (name.getLocalPart().equals("lowerCorner")) {
          return new LiteCoordinateSequence(new double[] { envelope.getMinX(), envelope.getMinY() }, 2);
        }

        if (name.getLocalPart().equals("upperCorner")) {
          return new LiteCoordinateSequence(new double[] { envelope.getMaxX(), envelope.getMaxY() }, 2);
        }

        if (envelope instanceof ReferencedEnvelope) {
            String localName = name.getLocalPart();
            if (localName.equals("srsName")) {
View Full Code Here

        assertEquals(1, dom.getElementsByTagNameNS(GML.NAMESPACE, "Point").getLength());
    }

    public void testEncodeCurve() 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.geometryMember);
        print(dom);
        XpathEngine xpath = XMLUnit.newXpathEngine();
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

      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

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.