Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.LineString


              assert layerCrs != null;
             
              splitLineCrs = layerCrs;
          }
         
            LineString splitlineInMapCRS = (LineString) GeoToolsUtils.reproject(lineInLayerCrs, splitLineCrs, targetCrs);
           
            splitlineInMapCRS.setUserData(targetCrs);

         
            return splitlineInMapCRS;
      } catch (Exception e) {
       
View Full Code Here


        BufferedImage finalImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        // Polygon polygon = d.polygon(new int[]{40,30, 60,70, 30,130, 130,130, 130,30});

        int[] xy = new int[]{(int) (height * 0.15), (int) (width * 0.85), (int) (height * 0.35), (int) (width * 0.15),
                (int) (height * 0.75), (int) (width * 0.85), (int) (height * 0.85), (int) (width * 0.15)};
        LineString line = d.line(xy);
        d.drawDirect(finalImage, d.feature(line), newRule);
        Graphics2D g2d = finalImage.createGraphics();
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.drawImage(finalImage, 0, 0, null);
        g2d.dispose();
View Full Code Here

                }
                Coordinate[] coordArray = (Coordinate[]) coordList.toArray(new Coordinate[coordList.size()]);
                if (coordArray.length < 2) {
                    continue;
                }
                LineString lineString = gF.createLineString(coordArray);
                LineString reprojectLineString = (LineString) JTS.transform(lineString, transform);
                MultiLineString multiLineString = gF.createMultiLineString(new LineString[]{reprojectLineString});

                SimpleFeatureBuilder builder = new SimpleFeatureBuilder(featureType);
                Object[] values = new Object[]{multiLineString, startDate, endDate, log.text};
                builder.addAll(values);
View Full Code Here

                Geometry geometry = multiGeometry.getGeometryN(g);
                if (geometry.getGeometryType().equals("Polygon")){
                    polygon = (Polygon) geometry;
                   
                    // get the exterior rings
                    LineString exterior = polygon.getExteriorRing();
                   
                    // collects the internal holes if there are any
                    for (int i=0; i<polygon.getNumInteriorRing(); i++) {
                        if (innerPolygons == null) {
                            innerPolygons = polygon.getInteriorRingN(i);
                        }
                        else {
                            innerPolygons = innerPolygons.union(polygon.getInteriorRingN(i));
                        }
                       
                    }
                   
                    Coordinate[] coordinates = exterior.getCoordinates();
                   
                    // move to the first point
                    Point point = null;
                    if (coordinates.length > 0) {
                        point = context.worldToPixel(coordinates[0]);
View Full Code Here

       
        double maxx = -120;
        double maxy = 59.9;
        double minx = -125;
        double miny = 50;
        LineString linestring = gfac.createLineString(new Coordinate[]{
                new Coordinate(minx,miny),
                new Coordinate(maxx,maxy)
        });
       
        linestring=(LineString) JTS.transform(linestring, CRS.findMathTransform(DefaultGeographicCRS.WGS84, crs, true));
View Full Code Here

        handler.setEditBlackboard(new EditBlackboard(500,500, map.getViewportModel().worldToScreenTransform(),
                map.getLayersInternal().get(0).layerToMapTransform()));
       
        FeatureStore<SimpleFeatureType, SimpleFeature> resource = map.getLayersInternal().get(0).getResource(FeatureStore.class, null);
        GeometryFactory factory=new GeometryFactory();
        LineString line1=factory.createLineString(new Coordinate[]{
                map.getViewportModel().pixelToWorld(10,10), map.getViewportModel().pixelToWorld(10,20)
        });
        LineString line2=factory.createLineString(new Coordinate[]{
                map.getViewportModel().pixelToWorld(20,10), map.getViewportModel().pixelToWorld(20,20)
        });
       
        MultiLineString multiline = factory.createMultiLineString(new LineString[]{line1, line2});
       
View Full Code Here

    private TestHandler handler;

    @Before
    public void setUp() throws Exception {
        GeometryFactory fac=new GeometryFactory();
        LineString line = fac.createLineString(new Coordinate[]{
           new Coordinate(0,10),new Coordinate(10,10), new Coordinate(20,10)
        });
        Polygon poly = fac.createPolygon(fac.createLinearRing(new Coordinate[]{
                new Coordinate(20,20),new Coordinate(40,20), new Coordinate(40,40),
                new Coordinate(20,40), new Coordinate(20,20)
View Full Code Here

  Coordinate[] segmentCoordinates = new Coordinate[2];
  segmentCoordinates[0] = coordinates[i];
  segmentCoordinates[1] = (startsFromEnd) ? coordinates[i - 1]
    : coordinates[i + 1];

  LineString segment = boundary.getFactory().createLineString(
    segmentCoordinates);

  Geometry intersection = boundary.intersection(segment);

  assert intersection instanceof MultiPoint
View Full Code Here

      if (indexInLineCoords < lineCoords.length - 1) {
    Coordinate[] firstSeg = new Coordinate[] {
      lineCoords[indexInLineCoords],
      lineCoords[indexInLineCoords + 1] };
    LineString firstSegment = fc.createLineString(firstSeg);

    return containsLineString(polygonGeometry
      .intersection(firstSegment));
      }
View Full Code Here

  if (CoordinateArrays.indexOf(vertex, lineCoords) > 0) {
      return line;
  }
  Coordinate[] newLineCoords = insertVertexInLine(lineCoords, vertex);

  LineString newLine = line.getFactory().createLineString(newLineCoords);

  return newLine;
    }
View Full Code Here

TOP

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

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.