Codota Logo
PolygonPatch
Code IndexAdd Codota to your IDE (free)

How to use
PolygonPatch
in
org.deegree.geometry.primitive.patches

Best Java code snippets using org.deegree.geometry.primitive.patches.PolygonPatch (Showing top 16 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: deegree/deegree3

  /**
   * Returns a linearized version (i.e. a {@link PolygonPatch} that only uses {@link LinearRing}s as boundaries) of
   * the given {@link PolygonPatch}.
   * 
   * @param patch
   * @param crit
   *            determines the interpolation quality / number of interpolation points
   * @return {@link PolygonPatch} that only uses {@link LinearRing}s as boundaries
   */
  public PolygonPatch linearize( PolygonPatch patch, LinearizationCriterion crit ) {

    Ring exteriorRing = patch.getExteriorRing();
    Ring linearizedExteriorRing = null;
    if ( exteriorRing != null ) {
      linearizedExteriorRing = (Ring) curveLinearizer.linearize( exteriorRing, crit );
    }

    List<Ring> interiorRings = patch.getInteriorRings();
    List<Ring> linearizedInteriorRings = new ArrayList<Ring>( interiorRings.size() );
    for ( Ring interiorRing : interiorRings ) {
      linearizedInteriorRings.add( (Ring) curveLinearizer.linearize( interiorRing, crit ) );
    }
    return geomFac.createPolygonPatch( linearizedExteriorRing, linearizedInteriorRings );
  }
}
origin: deegree/deegree3

private void writePolygonPatch( String id, ICRS crs, PrecisionModel pm, PolygonPatch polyPatch, Writer writer )
            throws IOException {
  PolygonPatchType type = polyPatch.getPolygonPatchType();
  Polygon poly = null;
  switch ( type ) {
  case POLYGON_PATCH:
  case RECTANGLE:
  case TRIANGLE:
    poly = new DefaultPolygon( id, crs, pm, polyPatch.getExteriorRing(), polyPatch.getInteriorRings() );
    break;
  }
  writePolygonWithoutPrefix( poly, writer );
}
origin: deegree/deegree3

void render( TextStyling styling, Font font, String text, Surface surface ) {
  for ( SurfacePatch patch : surface.getPatches() ) {
    if ( patch instanceof PolygonPatch ) {
      PolygonPatch polygonPatch = (PolygonPatch) patch;
      for ( Curve curve : polygonPatch.getBoundaryRings() ) {
        render( styling, font, text, curve );
      }
    } else {
      throw new IllegalArgumentException( "Cannot render non-planar surfaces." );
    }
  }
}
origin: deegree/deegree3

@Override
public Points getExteriorRingCoordinates() {
  if ( patches.size() == 1 ) {
    if ( patches.get( 0 ) instanceof PolygonPatch ) {
      PolygonPatch patch = (PolygonPatch) patches.get( 0 );
      return patch.getExteriorRing().getControlPoints();
    }
    throw new IllegalArgumentException( Messages.getMessage( "SURFACE_IS_NON_PLANAR" ) );
  }
  throw new IllegalArgumentException( Messages.getMessage( "SURFACE_MORE_THAN_ONE_PATCH" ) );
}
origin: deegree/deegree3

@Override
public List<Points> getInteriorRingsCoordinates() {
  List<Points> controlPoints = new ArrayList<Points>();
  if ( patches.size() == 1 ) {
    if ( patches.get( 0 ) instanceof PolygonPatch ) {
      PolygonPatch patch = (PolygonPatch) patches.get( 0 );
      List<Ring> interiorRings = patch.getInteriorRings();
      for ( Ring ring : interiorRings ) {
        controlPoints.add( ring.getControlPoints() );
      }
    } else {
      throw new IllegalArgumentException( Messages.getMessage( "SURFACE_IS_NON_PLANAR" ) );
    }
  } else {
    throw new IllegalArgumentException( Messages.getMessage( "SURFACE_MORE_THAN_ONE_PATCH" ) );
  }
  return controlPoints;
}
origin: deegree/deegree3

@Override
public int getCoordinateDimension() {
  return patches.get( 0 ).getCoordinateDimension();
}
origin: deegree/deegree3

Ring exterior = patch.getExteriorRing();
float[] extC = extractGeometries( exterior, min, max );
if ( extC == null ) {
  LOG.warn( "The exterior ring of a polygon patch did not contain any coordinates, discarding this patch." );
} else {
  List<Ring> interior = patch.getInteriorRings();
  List<float[]> interiors = new ArrayList<float[]>( interior.size() );
  int size = extC.length;
origin: deegree/deegree3

private void exportPolygonPatch( PolygonPatch polygonPatch )
            throws XMLStreamException, UnknownCRSException, TransformationException {
  switch ( polygonPatch.getPolygonPatchType() ) {
  case POLYGON_PATCH:
    writer.writeStartElement( gmlNs, "PolygonPatch" );
    writer.writeStartElement( gmlNs, "exterior" );
    exportRing( polygonPatch.getExteriorRing() );
    writer.writeEndElement();
    for ( Ring ring : polygonPatch.getInteriorRings() ) {
      writer.writeStartElement( gmlNs, "interior" );
      exportRing( ring );
      writer.writeEndElement();
    }
    writer.writeEndElement();
    break;
  case TRIANGLE:
    exportTriangle( (Triangle) polygonPatch );
    break;
  case RECTANGLE:
    exportRectangle( (Rectangle) polygonPatch );
    break;
  }
}
origin: deegree/deegree3

void render( PointStyling styling, Surface surface ) {
  for ( SurfacePatch patch : surface.getPatches() ) {
    if ( patch instanceof PolygonPatch ) {
      PolygonPatch polygonPatch = (PolygonPatch) patch;
      for ( Curve curve : polygonPatch.getBoundaryRings() ) {
        curve.setCoordinateSystem( surface.getCoordinateSystem() );
        renderer.render( styling, curve );
      }
    } else {
      throw new IllegalArgumentException( "Cannot render non-planar surfaces." );
    }
  }
}
origin: deegree/deegree3

  @Override
  protected com.vividsolutions.jts.geom.Geometry buildJTSGeometry() {

    if ( patches.size() < 1 || !( patches.get( 0 ) instanceof PolygonPatch ) ) {
      throw new IllegalArgumentException( Messages.getMessage( "SURFACE_NOT_EQUIVALENT_TO_POLYGON" ) );
    }

    // TODO handle the other patches as well
    PolygonPatch patch = (PolygonPatch) patches.get( 0 );
    Ring exteriorRing = patch.getExteriorRing();
    List<Ring> interiorRings = patch.getInteriorRings();

    LinearRing shell = (LinearRing) getAsDefaultGeometry( exteriorRing ).getJTSGeometry();
    LinearRing[] holes = null;
    if ( interiorRings != null ) {
      holes = new LinearRing[interiorRings.size()];
      int i = 0;
      for ( Ring ring : interiorRings ) {
        holes[i++] = (LinearRing) getAsDefaultGeometry( ring ).getJTSGeometry();
      }
    }
    return jtsFactory.createPolygon( shell, holes );
  }
}
origin: deegree/deegree3

private PolygonPatch transform( PolygonPatch patch, Transformation trans )
            throws TransformationException {
  Ring exterior = patch.getExteriorRing();
  LinearRing transformedExteriorRing = transform( exterior, trans );
  PolygonPatch result = null;
  PolygonPatchType type = patch.getPolygonPatchType();
  switch ( type ) {
  case POLYGON_PATCH:
    List<Ring> interiorRings = ( patch ).getInteriorRings();
    List<Ring> transformedInteriorRings = new ArrayList<Ring>( interiorRings == null ? 0 : interiorRings.size() );
    if ( interiorRings != null && !interiorRings.isEmpty() ) {
      for ( Ring interior : interiorRings ) {
        if ( interior != null ) {
          LinearRing lr = transform( interior, trans );
          transformedInteriorRings.add( lr );
        }
      }
    }
    result = geomFactory.createPolygonPatch( transformedExteriorRing, transformedInteriorRings );
    break;
  case RECTANGLE:
    result = geomFactory.createRectangle( transformedExteriorRing );
    break;
  case TRIANGLE:
    result = geomFactory.createTriangle( transformedExteriorRing );
    break;
  }
  return result;
}
origin: deegree/deegree3

void render( PolygonStyling styling, Surface surface ) {
  for ( SurfacePatch patch : surface.getPatches() ) {
    if ( patch instanceof PolygonPatch ) {
      LinkedList<Double> lines = new LinkedList<Double>();
      PolygonPatch polygonPatch = (PolygonPatch) patch;
      // just appending the holes appears to work, the Java2D rendering mechanism can determine that they lie
      // inside and thus no substraction etc. is needed. This speeds up things SIGNIFICANTLY
      GeneralPath polygon = new GeneralPath( WIND_EVEN_ODD );
      for ( Curve curve : polygonPatch.getBoundaryRings() ) {
        Double d = geomHelper.fromCurve( curve, true );
        lines.add( d );
        polygon.append( d, false );
      }
      fillRenderer.applyFill( styling.fill, styling.uom );
      graphics.fill( polygon );
      for ( Double d : lines ) {
        strokeRenderer.applyStroke( styling.stroke, styling.uom, d, styling.perpendicularOffset,
                      styling.perpendicularOffsetType );
      }
    } else {
      throw new IllegalArgumentException( "Cannot render non-planar surfaces." );
    }
  }
}
origin: deegree/deegree3

Ring exteriorRing = patch.getExteriorRing();
List<Ring> interiorRings = patch.getInteriorRings();
simplified = geomFac.createPolygon( geometry.getId(), geometry.getCoordinateSystem(), exteriorRing,
                  interiorRings );
  Ring exteriorRing = ( (PolygonPatch) patch ).getExteriorRing();
  List<Ring> interiorRings = ( (PolygonPatch) patch ).getInteriorRings();
  members.add( geomFac.createPolygon( null, geometry.getCoordinateSystem(), exteriorRing,
                    interiorRings ) );
origin: deegree/deegree3

void render( LineStyling styling, Surface surface ) {
  for ( SurfacePatch patch : surface.getPatches() ) {
    if ( patch instanceof PolygonPatch ) {
      PolygonPatch polygonPatch = (PolygonPatch) patch;
      for ( Curve curve : polygonPatch.getBoundaryRings() ) {
        if ( curve.getCoordinateSystem() == null ) {
          curve.setCoordinateSystem( surface.getCoordinateSystem() );
        }
        renderer.render( styling, curve );
      }
    } else {
      throw new IllegalArgumentException( "Cannot render non-planar surfaces." );
    }
  }
}
origin: deegree/deegree3

Ring exteriorRing = patch.getExteriorRing();
if ( !validateCurve( exteriorRing, affectedGeometryParticles2 ) ) {
  isValid = false;
List<Ring> interiorRings = patch.getInteriorRings();
List<LinearRing> interiorJTSRings = new ArrayList<LinearRing>( interiorRings.size() );
List<Polygon> interiorJTSRingsAsPolygons = new ArrayList<Polygon>( interiorRings.size() );
origin: deegree/deegree3

for ( SurfacePatch patch : s.getPatches() ) {
  if ( patch instanceof PolygonPatch ) {
    Ring exterior = ( (PolygonPatch) patch ).getExteriorRing();
    LinearRing movedExteriorRing = null;
    if ( exterior != null ) {
                              offx, offy ) );
    List<Ring> interiorRings = ( (PolygonPatch) patch ).getInteriorRings();
    List<Ring> movedInteriorRings = new ArrayList<Ring>( interiorRings.size() );
    for ( Ring interior : interiorRings ) {
org.deegree.geometry.primitive.patchesPolygonPatch

Javadoc

A PolygonPatch is a planar SurfacePatch that is defined by a set of boundary curves and an underlying surface to which these curves adhere. The curves are coplanar and the polygon uses planar interpolation in its interior. Implements GM_Polygon of ISO 19107.

Please note that a PolygonPatch is not restricted to use linear interpolation for its exterior and interior rings.

Most used methods

  • getExteriorRing
  • getInteriorRings
  • getPolygonPatchType
  • getBoundaryRings
    Returns the boundary rings (interior + exteriors)
  • getCoordinateDimension

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • requestLocationUpdates (LocationManager)
  • runOnUiThread (Activity)
  • String (java.lang)
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Set (java.util)
    A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now