void render( PointStyling styling, Curve curve ) { if ( curve.getCurveSegments().size() != 1 || !( curve.getCurveSegments().get( 0 ) instanceof LineStringSegment ) ) { // TODO handle non-linear and multiple curve segments throw new IllegalArgumentException(); } LineStringSegment segment = ( (LineStringSegment) curve.getCurveSegments().get( 0 ) ); // coordinate representation is still subject to change... for ( Point point : segment.getControlPoints() ) { point.setCoordinateSystem( curve.getCoordinateSystem() ); renderer.render( styling, point ); } }
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." ); } } }
/** * Writes a CURVE * * @param geometry * @param writer * @throws IOException */ public void writeCurveGeometry( Curve geometry, Writer writer ) throws IOException { if ( flags.contains( WKTFlag.USE_DKT ) ) { writer.append( "CURVE " ); appendObjectProps( writer, geometry ); writer.append( '(' ); writeCurveSegments( geometry, writer ); writer.append( ')' ); } else if ( flags.contains( WKTFlag.USE_SQL_MM ) ) { // s.append( "COMPOUNDCURVE(" ); throw new UnsupportedOperationException( "Handling curves within 'SQL-MM Part 3' is not implemented yet." ); } else { CurveLinearizer cl = new CurveLinearizer( new GeometryFactory() ); LinearizationCriterion crit = new NumPointsCriterion( linearizedControlPoints ); Curve c = cl.linearize( geometry, crit ); LineString ls = new DefaultLineString( c.getId(), c.getCoordinateSystem(), c.getPrecision(), c.getControlPoints() ); writeLineString( ls, writer ); } }
/** * Writes the CURVE without the 'CURVE()'-specific envelope. <br/> * It writes just the CURVE-coordinates. * * @param geometry * @param writer * @throws IOException */ private void writeCurveGeometryWithoutPrefix( Curve geometry, Writer writer ) throws IOException { if ( flags.contains( WKTFlag.USE_SQL_MM ) ) { throw new UnsupportedOperationException( "Handling curves within 'SQL-MM Part 3' is not implemented yet." ); } CurveLinearizer cl = new CurveLinearizer( new GeometryFactory() ); LinearizationCriterion crit = new NumPointsCriterion( linearizedControlPoints ); Curve c = cl.linearize( geometry, crit ); LineString ls = new DefaultLineString( c.getId(), c.getCoordinateSystem(), c.getPrecision(), c.getControlPoints() ); writer.append( '(' ); writeLineStringWithoutPrefix( ls, writer ); writer.append( ')' ); }
linearSegments[i] = linearize( segments.get( i ), crit ); linearizedCurve = geomFac.createCurve( curve.getId(), curve.getCoordinateSystem(), linearSegments );
fixedCurve = new DefaultCompositeCurve( curve.getId(), curve.getCoordinateSystem(), curve.getPrecision(), fixedMemberCurves ); break; fixedCurve = new DefaultCurve( curve.getId(), curve.getCoordinateSystem(), curve.getPrecision(), fixedSegments ); break; fixedCurve = new DefaultLineString( curve.getId(), curve.getCoordinateSystem(), curve.getPrecision(), invertOrientation( lineString.getControlPoints() ) ); break; fixedCurve = new DefaultOrientableCurve( curve.getId(), curve.getCoordinateSystem(), invertOrientation( orientableCurve.getBaseCurve() ), orientableCurve.isReversed() );
LOG.warn( "Cannot fix " + lastSegment.getSegmentType() + " segments." ); fixedCurve = new DefaultCurve( curve.getId(), curve.getCoordinateSystem(), curve.getPrecision(), fixedSegments ); break; LineString lineString = (LineString) curve; Points fixedPoints = getFixedPoints( lineString.getControlPoints(), lastPoint ); fixedCurve = new DefaultLineString( curve.getId(), curve.getCoordinateSystem(), curve.getPrecision(), fixedPoints ); break; fixedMemberCurves.set( fixedMemberCurves.size() - 1, fixCurve( fixedMemberCurves.get( fixedMemberCurves.size() - 1 ), lastPoint ) ); fixedCurve = new DefaultCompositeCurve( curve.getId(), curve.getCoordinateSystem(), curve.getPrecision(), fixedMemberCurves ); break; OrientableCurve orientableCurve = (OrientableCurve) curve; Curve fixedBaseCurve = fixCurve( orientableCurve.getBaseCurve(), lastPoint ); fixedCurve = new DefaultOrientableCurve( curve.getId(), curve.getCoordinateSystem(), fixedBaseCurve, orientableCurve.isReversed() ); break;
if ( selfIntersection ) { LOG.debug( "Detected self-intersection." ); Point location = getPoint( isSimpleOp.getNonSimpleLocation(), curve.getCoordinateSystem() ); if ( !fireEvent( new CurveSelfIntersection( curve, location, affectedGeometryParticles2 ) ) ) { isValid = false;
Double fromCurve( Curve curve, boolean close ) { Double line = new Double(); // TODO use error criterion ICRS crs = curve.getCoordinateSystem(); curve = linearizer.linearize( curve, new NumPointsCriterion( 100 ) ); curve.setCoordinateSystem( crs ); Points points = curve.getControlPoints(); Iterator<Point> iter = points.iterator(); Point p = iter.next(); double x = p.get0(), y = p.get1(); line.moveTo( x, y ); while ( iter.hasNext() ) { p = iter.next(); if ( iter.hasNext() ) { line.lineTo( p.get0(), p.get1() ); } else { if ( close && isZero( x - p.get0() ) && isZero( y - p.get1() ) ) { line.closePath(); } else { line.lineTo( p.get0(), p.get1() ); } } } line.transform( worldToScreen ); return line; }
ps.add( (Point) move( p, offx, offy ) ); return fac.createLineString( geom.getId(), c.getCoordinateSystem(), new PointsList( ps ) );
result = geomFactory.createOrientableCurve( curve.getId(), result.getCoordinateSystem(), result, ( (OrientableCurve) curve ).isReversed() );