private void exportAsPos( Point point ) throws XMLStreamException, UnknownCRSException, TransformationException { writer.writeStartElement( gmlNs, "pos" ); double[] ordinates = getTransformedCoordinate( point.getCoordinateSystem(), point.getAsArray() ); writer.writeCharacters( formatter.format( ordinates[0] ) ); for ( int i = 1; i < ordinates.length; i++ ) { writer.writeCharacters( " " + formatter.format( ordinates[i] ) ); } writer.writeEndElement(); }
private void exportCoordinates( Points points ) throws XMLStreamException, TransformationException, UnknownCRSException { writer.writeStartElement( "gml", "coordinates", GML21NS ); writer.writeAttribute( "decimal", "." ); writer.writeAttribute( "cs", "," ); writer.writeAttribute( "ts", " " ); StringBuilder sb = new StringBuilder(); boolean first = true; for ( Point point : points ) { if ( !first ) { sb.append( " " ); } double[] ords = getTransformedCoordinate( point.getCoordinateSystem(), point.getAsArray() ); sb.append( formatter.format( ords[0] ) ); for ( int i = 1; i < ords.length; i++ ) { sb.append( "," ); sb.append( formatter.format( ords[i] ) ); } first = false; } writer.writeCharacters( sb.toString() ); writer.writeEndElement(); }
private void exportCoord( Point point ) throws XMLStreamException, TransformationException, UnknownCRSException { double[] ords = getTransformedCoordinate( point.getCoordinateSystem(), point.getAsArray() ); writer.writeStartElement( "gml", "coord", GML21NS ); writer.writeStartElement( "gml", "X", GML21NS ); writer.writeCharacters( formatter.format( ords[0] ) ); writer.writeEndElement(); if ( ords.length > 1 ) { writer.writeStartElement( "gml", "Y", GML21NS ); writer.writeCharacters( formatter.format( ords[1] ) ); writer.writeEndElement(); if ( ords.length > 2 ) { writer.writeStartElement( "gml", "Z", GML21NS ); writer.writeCharacters( formatter.format( ords[2] ) ); writer.writeEndElement(); } } writer.writeEndElement(); // </gml:coord> }
private void exportAnonymousPoints( final Points points ) throws XMLStreamException, TransformationException, UnknownCRSException { if ( version != GML_30 ) { writer.writeStartElement( "gml", "posList", gmlNs ); // TODO CITE // writer.writeAttribute( "srsDimension", String.valueOf( srsDimension ) ); boolean first = true; for ( final Point p : points ) { final double[] ordinates = getTransformedCoordinate( p.getCoordinateSystem(), p.getAsArray() ); for ( int i = 0; i < ordinates.length; i++ ) { if ( !first ) { writer.writeCharacters( " " + formatter.format( ordinates[i] ) ); } else { writer.writeCharacters( formatter.format( ordinates[i] ) ); first = false; } } } writer.writeEndElement(); } else { for ( final Point p : points ) { exportAsPos( p ); } } }
private static Points move( Points points, double offx, double offy ) { List<Point> movedPoints = new ArrayList<Point>( points.size() ); GeometryFactory fac = new GeometryFactory(); for ( Point point : points ) { double[] movedCoordinates = new double[] { point.get0() + offx, point.get1() + offy }; movedPoints.add( fac.createPoint( point.getId(), movedCoordinates, point.getCoordinateSystem() ) ); } return new PointsList( movedPoints ); }
Point p0Shifted = new DefaultPoint( null, p0.getCoordinateSystem(), p0.getPrecision(), new double[] { p0.get0() - minOrd0, p0.get1() - minOrd1 } ); Point p1Shifted = new DefaultPoint( null, p1.getCoordinateSystem(), p1.getPrecision(), new double[] { p1.get0() - minOrd0, p1.get1() - minOrd1 } ); Point p2Shifted = new DefaultPoint( null, p2.getCoordinateSystem(), p2.getPrecision(), new double[] { p2.get0() - minOrd0, p2.get1() - minOrd1 } ); ICRS crs = p0Shifted.getCoordinateSystem(); realPoints.add( new DefaultPoint( null, p.getCoordinateSystem(), p.getPrecision(), new double[] { p.get0() + minOrd0, p.get1() + minOrd1 } ) );
Point p0Shifted = new DefaultPoint( null, p0.getCoordinateSystem(), p0.getPrecision(), new double[] { p0.get0() - minOrd0, p0.get1() - minOrd1 } ); Point p1Shifted = new DefaultPoint( null, p1.getCoordinateSystem(), p1.getPrecision(), new double[] { p1.get0() - minOrd0, p1.get1() - minOrd1 } ); Point p2Shifted = new DefaultPoint( null, p2.getCoordinateSystem(), p2.getPrecision(), new double[] { p2.get0() - minOrd0, p2.get1() - minOrd1 } );
Point p0Shifted = new DefaultPoint( null, p0.getCoordinateSystem(), p0.getPrecision(), new double[] { p0.get0() - minOrd0, p0.get1() - minOrd1 } ); Point p1Shifted = new DefaultPoint( null, p1.getCoordinateSystem(), p1.getPrecision(), new double[] { p1.get0() - minOrd0, p1.get1() - minOrd1 } ); Point p2Shifted = new DefaultPoint( null, p2.getCoordinateSystem(), p2.getPrecision(), new double[] { p2.get0() - minOrd0, p2.get1() - minOrd1 } );
if ( min.equals( max ) ) { min = new DefaultPoint( min.getId(), min.getCoordinateSystem(), min.getPrecision(), new double[] { min.get0() - 0.0001, min.get1() - 0.0001 } ); if ( min.equals( max ) ) { min = new DefaultPoint( min.getId(), min.getCoordinateSystem(), min.getPrecision(), new double[] { min.get0() - 0.0001, min.get1() - 0.0001 } );
Point p = (Point) geom; return fac.createPoint( geom.getId(), new double[] { p.get0() + offx, p.get1() + offy }, p.getCoordinateSystem() );
ICRS crs = spline.getControlPoints().get( 0 ).getCoordinateSystem(); PrecisionModel pm = spline.getControlPoints().get( 0 ).getPrecision(); for ( int i = 0; i < numPoints; i++ ) {
Point p0Shifted = new DefaultPoint( null, p0.getCoordinateSystem(), p0.getPrecision(), new double[] { p0.get0() - minOrd0, p0.get1() - minOrd1 } ); Point p1Shifted = new DefaultPoint( null, p1.getCoordinateSystem(), p1.getPrecision(), new double[] { p1.get0() - minOrd0, p1.get1() - minOrd1 } ); Point p2Shifted = new DefaultPoint( null, p2.getCoordinateSystem(), p2.getPrecision(), new double[] { p2.get0() - minOrd0, p2.get1() - minOrd1 } ); circle.y += minOrd1; return geomFac.createPoint( null, new double[] { circle.x, circle.y }, p0Shifted.getCoordinateSystem() );