Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.GeometryComponentFilter


   * Adds a Geometry to be processed. May be called multiple times.
   * Any dimension of Geometry may be added; the constituent linework will be
   * extracted.
   */ 
  public void add(Geometry geometry) {
    geometry.apply(new GeometryComponentFilter() {
      public void filter(Geometry component) {
        if (component instanceof LineString) {
          add((LineString)component);
        }
      }     
View Full Code Here


   * @return List<GeometryFacetSequence>
   */
  private static List computeFacetSequences(Geometry g) {
    final List sections = new ArrayList();

    g.apply(new GeometryComponentFilter() {

      public void filter(Geometry geom) {
        CoordinateSequence seq = null;
        if (geom instanceof LineString) {
          seq = ((LineString) geom).getCoordinateSequence();
View Full Code Here

   * extracted.
   *
   * @param geometry geometry to be line-merged
   */ 
  public void add(Geometry geometry) {
    geometry.apply(new GeometryComponentFilter() {
      public void filter(Geometry component) {
        if (component instanceof LineString) {
          add((LineString)component);
        }
      }     
View Full Code Here

   * @return List<GeometryFacetSequence>
   */
  private static List computeFacetSequences(Geometry g) {
    final List sections = new ArrayList();

    g.apply(new GeometryComponentFilter() {

      public void filter(Geometry geom) {
        CoordinateSequence seq = null;
        if (geom instanceof LineString) {
          seq = ((LineString) geom).getCoordinateSequence();
View Full Code Here

        if (geometry instanceof CurvedGeometry<?>) {
            return true;
        }

        final AtomicBoolean curveFound = new AtomicBoolean(false);
        geometry.apply(new GeometryComponentFilter() {

            @Override
            public void filter(Geometry geom) {
                if (geom instanceof CurvedGeometry<?>) {
                    curveFound.set(true);
View Full Code Here

        // the pre-processing might have cut or split the geometry
        final List<Polygon> polygons = new ArrayList<Polygon>();
        if (preProcessed instanceof Polygon) {
            polygons.add((Polygon) preProcessed);
        } else {
            preProcessed.apply(new GeometryComponentFilter() {

                @Override
                public void filter(Geometry geom) {
                    if (geom instanceof Polygon) {
                        polygons.add((Polygon) geom);
View Full Code Here

            private final ArrayList<LineString> originalLines;

            public LinearElevationInterpolator(Geometry original, CoordinateReferenceSystem crs) {
                originalLines = new ArrayList<LineString>();
                original.apply(new GeometryComponentFilter() {
                   
                    @Override
                    public void filter(Geometry geom) {
                        if(geom instanceof LineString) {
                            originalLines.add((LineString) geom);
View Full Code Here

            if(Point.class.isAssignableFrom(target) || MultiPoint.class.isAssignableFrom(target)
                    || GeometryCollection.class.equals(target)) {
                result = clipped;
            } else if(MultiLineString.class.isAssignableFrom(target) || LineString.class.isAssignableFrom(target)) {
                final List<LineString> geoms = new ArrayList<LineString>();
                clipped.apply(new GeometryComponentFilter() {
                   
                    @Override
                    public void filter(Geometry geom) {
                        if(geom instanceof LineString) {
                            geoms.add((LineString) geom);
                        }
                    }
                });
                if(geoms.size() == 0) {
                    result = null;
                } else {
                    LineString[] lsArray = (LineString[]) geoms.toArray(new LineString[geoms.size()]);
                    result = geom.getFactory().createMultiLineString(lsArray);
                }
            } else if(MultiPolygon.class.isAssignableFrom(target) || Polygon.class.isAssignableFrom(target)) {
                final List<Polygon> geoms = new ArrayList<Polygon>();
                clipped.apply(new GeometryComponentFilter() {
                   
                    @Override
                    public void filter(Geometry geom) {
                        if(geom instanceof Polygon) {
                            geoms.add((Polygon) geom);
View Full Code Here

            return geometry;
        }
       
        // filter out only polygonal parts
        final List<Polygon> polygons = new ArrayList<Polygon>();
        geometry.apply(new GeometryComponentFilter() {
           
            public void filter(Geometry geom) {
                if(geom instanceof Polygon) {
                    polygons.add((Polygon) geom);
                }
View Full Code Here

                if (intersection instanceof MultiPolygon) {
                    rasterFilter = (MultiPolygon)intersection;
                } else {
                    final List<Polygon> accum = new ArrayList<Polygon>();
                    intersection.apply(
                        new GeometryComponentFilter() {
                            public void filter(Geometry geom) {
                                if (geom instanceof Polygon) accum.add((Polygon)geom);
                            }
                        }
                    );
View Full Code Here

TOP

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

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.