Examples of MultiPolygon


Examples of com.vividsolutions.jts.geom.MultiPolygon

         * @param geom DOCUMENT ME!
         *
         * @throws IOException DOCUMENT ME!
         */
        protected void writeGeometry(Geometry geom) throws IOException {
            MultiPolygon mpoly = (MultiPolygon) geom;

            for (int i = 0; i < mpoly.getNumGeometries(); i++) {
                super.writeGeometry(mpoly.getGeometryN(i));
            }
        }
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

                            if (type.isAssignableFrom(Polygon.class)) {
                                Polygon polygon = polygon(bounds);
                                boundedByNode.setValue(polygon);
                            } else if (type.isAssignableFrom(MultiPolygon.class)) {
                                MultiPolygon multiPolygon = geometryFactory.createMultiPolygon(new Polygon[] {
                                        polygon(bounds)
                                });
                                boundedByNode.setValue(multiPolygon);
                            }
                        }
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

      obj.put("paths", arrayTemp2);
    }

    // MultiPolygon
    else if (geometry.getClass().equals(MultiPolygon.class)) {
      MultiPolygon mpg = (MultiPolygon) geometry;
      for (int i = 0, count = mpg.getNumGeometries(); i < count; i++) {
        Geometry geo = mpg.getGeometryN(i);
        if (geo.getClass().equals(Polygon.class)) {
          Polygon pg = (Polygon) geo;
          // TODO
          // If ESRI support multipolygon with hole?
          Coordinate[] coords = pg.getExteriorRing().getCoordinates();
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

          CoordinateReferenceSystem sourceCRS = DefaultGeographicCRS.WGS84;
          String gml = Xml.getString(geom);

          try {
            if (srs != null && !(srs.equals(""))) sourceCRS = CRS.decode(srs);
            MultiPolygon jts = parseGml(parser, gml);
             
            // if we have an srs and its not WGS84 then transform to WGS84
            if (!CRS.equalsIgnoreMetadata(sourceCRS, DefaultGeographicCRS.WGS84)) {
              MathTransform tform = CRS.findMathTransform(sourceCRS, DefaultGeographicCRS.WGS84);
              jts = (MultiPolygon)JTS.transform(jts, tform);
            }

            for (int i = 0; i < jts.getNumGeometries(); i++) {
              allPolygons.add((Polygon) jts.getGeometryN(i));
            }
          } catch (Exception e) {
            errorMessage.put("PARSE", gml + ". Error is:" + e.getMessage());
            Log.error(Geonet.INDEX_ENGINE, "Failed to convert gml to jts object: "+gml+"\n\t"+e.getMessage());
            e.printStackTrace();
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

   
    private static float[] getDistanceFromPerimeter(TriMesh2D mesh){
        float[] d = new float[mesh.getNodeCount()];
       
        Shape shape = mesh.createOutlinePath();
        MultiPolygon mp = JTSUtils.createMultiPolygon(shape);
        LineString[] ls = JTSUtils.getLineStrings(mp);
        MultiLineString mls = JTSUtils.getFactory().createMultiLineString(ls);
       
        for (int i = 0; i < d.length; i++) {
            Node2D n = mesh.getNode(i);
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

    /**
     * Creates an area set with no subareas.
     * @return A new area set that equals the shell of this area set.
     */
    public AreaSet createSingularAreaSet(){
        MultiPolygon mp = (MultiPolygon) shell.clone();
        return new AreaSet(new MultiPolygon[]{mp});
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

     * by the filter.
     * @return a new polygon with the filter applied or the original polygon if
     * no filter was applied
     */
    private MultiPolygon applyMAFilter(MultiPolygon poly, int degree, Geometry preserve){
        MultiPolygon filtered = null;
       
        for(int deg = degree; deg > 0; deg--){
            filtered = (MultiPolygon) poly.clone();
            filtered.apply(new ComponentMovingAverageFilter(deg, preserve));
           
            if(filtered.isValid()){
                ConnectedInteriorTester t1 = new ConnectedInteriorTester(null);
               
                System.err.println("Applied filter degree: " + deg);
                break;
            }
        }
       
        if(filtered != null && filtered.isValid()){
            return filtered;
        } else {
            if(degree > 0)
                System.err.println("No filter applied to polygon");
            return poly;
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

           
            // infill
            for (int i = 0; i < polys.length; i++) {
                double offset = 0.5 * ew + lp.cap_length;
                Geometry g = polys[i].buffer(-offset).intersection(infillArea);
                MultiPolygon p = JTSUtils.toMultiPolygon(g);
                lines = getInfill(p, bounds, obj.getDensity(i), lp.fill_angle, ew);
                ggen.parseAll(lines, lh, ew, lp.infill_speed, t);
            }
        }
       
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

    private LineString[] getOutlines(Geometry poly, LayerProperties lp) throws TopologyException{
        ArrayList<LineString> lines = new ArrayList<>();
       
        for (int i = lp.perimeters-1; i >= 0; i--) {
            double offset = -lp.extrusion_width * (i + 0.5);
            MultiPolygon p = JTSUtils.toMultiPolygon(poly.buffer(offset));
            lines.addAll(Arrays.asList(JTSUtils.getLineStrings(p)));
        }
       
        return lines.toArray(new LineString[lines.size()]);
    }
View Full Code Here

Examples of com.vividsolutions.jts.geom.MultiPolygon

        }
       
        // add small polys to higher order
        for (Polygon p : add) {
            for (int i = 1; i < polygons.length; i++) {
                MultiPolygon poly = polygons[i];
                if(!poly.disjoint(p) || i == polygons.length - 1){
                    // make sure p gets added somewhere
                    polygons[i] = JTSUtils.toMultiPolygon(polygons[i].union(p));
                    break;
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.