Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.LinearRing


            e[0].orig().getCoordinate(),
            e[1].orig().getCoordinate(),
            e[2].orig().getCoordinate(),
            e[0].orig().getCoordinate()};
        GeometryFactory fact = new GeometryFactory();
        LinearRing ring = fact.createLinearRing(ringPts);
        Polygon tri = fact.createPolygon(ring, null);
        return tri;
    }
View Full Code Here


        Coordinate[] ring = getCoordinates();
        return CGAlgorithms.isPointInRing(pt, ring);
    }

    public Geometry getGeometry(GeometryFactory fact) {
        LinearRing ring = fact.createLinearRing(getCoordinates());
        Polygon tri = fact.createPolygon(ring, null);
        return tri;
    }
View Full Code Here

      Coordinate c = new Coordinate(v.getLng(), v.getLat());
      coords[i] = c;
    }
   
    // now create a line string from the coordinates array where null = no holes in the polygon
    LinearRing ring = new GeometryFactory().createLinearRing(coords);
    Geometry geometry = new GeometryFactory().createPolygon(ring, null);
   
    // Note: the centroid for the ZoneDetail vertices is never
    // stored in the database. It was just as easy to calculate
    // it on the fly in ZoneDAO.getZoneDetails()
View Full Code Here

     * @param coords
     * @return Geometry
     */
    public <T extends Geometry> T safeCreateGeometry( Class<T> type, Coordinate[] coords ) {
        if (LinearRing.class.isAssignableFrom(type)) {
            LinearRing ring = safeCreateLinearRing( coords );
      return type.cast(ring);
        }
        if (LineString.class.isAssignableFrom(type)) {
            if (coords.length < 2) {
                Coordinate[] tmp = new Coordinate[2];
View Full Code Here

     * @param currentGeom
     * @return Polygon
     */
    public static Polygon createPolygon( EditGeom currentGeom ) {
        Coordinate[] shellCoords = currentGeom.getShell().coordArray();
        LinearRing shell = GeometryBuilder.create().safeCreateLinearRing(shellCoords);

        try {
            if (CGAlgorithms.isCCW(shellCoords)) {
                shell = JTSUtilities.reverseRing(shell);
            }
        } catch (Exception e) {
            EditPlugin.log("Not a critical problem, just an FYI", e); //$NON-NLS-1$
        }
        List<LinearRing> currentHoles = new ArrayList<LinearRing>();
       
        for( PrimitiveShape shape : currentGeom.getHoles() ) {
            Coordinate[] coordArray = shape.coordArray();

            if (coordArray.length == 0) {
                continue;
            }
            LinearRing hole = GeometryBuilder.create().safeCreateLinearRing(coordArray);
            // FIXME test when the hole has only one coordinate.
            if (!(coordArray.length <= 2) && !CGAlgorithms.isCCW(coordArray)) {
                hole = JTSUtilities.reverseRing((LinearRing) hole);
            }
            currentHoles.add(hole);
View Full Code Here

    // add the rings to the ringList.
    for (Polygon pol : polyCollection) {

      Coordinate[] polCoord = pol.getExteriorRing().getCoordinates();

      LinearRing polygonRing = this.gf.createLinearRing(polCoord);
      ringList.add(polygonRing);
    }

    // get the remaining line.
    Geometry result = getRemainingLine(line.getCoordinates(), ringList);
View Full Code Here

      holesRing = holesList.toArray(new LinearRing[holesList.size()]);
    }

    // form a closed linearRing.
    shellClosed = GeometryUtil.closeGeometry(shellClosed);
    LinearRing shellRing = fc.createLinearRing(shellClosed);

    result = fc.createPolygon(shellRing, holesRing);

    return result;
  }
View Full Code Here

     * </p>
     * @param xy Two dimensional ordiantes.
     * @return Polygon
     */
    public Polygon polygon( int[] xy ) {
        LinearRing shell = ring(xy);
        return gf.createPolygon(shell, null);
    }
View Full Code Here

     */
    public Polygon polygon( int[] xy, int[] holes[] ) {
        if (holes == null || holes.length == 0) {
            return polygon(xy);
        }
        LinearRing shell = ring(xy);

        LinearRing[] rings = new LinearRing[holes.length];

        for( int i = 0; i < xy.length; i++ ) {
            rings[i] = ring(holes[i]);
View Full Code Here

     * @param xy Two dimensional ordiantes.
     * @return Polygon
     */
    // THIS
    public Polygon polygon( int[] xy ) {
        LinearRing shell = ring(xy);
        return gf.createPolygon(shell, null);
    }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.LinearRing

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.