use of com.revolsys.geometry.model.Punctual in project com.revolsys.open by revolsys.
the class GmlGeometryFieldType method geometry.
private void geometry(final XmlWriter out, final Object value, final boolean writeSrsName) {
if (value instanceof Geometry) {
final Geometry geometry = (Geometry) value;
if (geometry instanceof Point) {
final Point point = (Point) geometry;
point(out, point, writeSrsName);
} else if (geometry instanceof LineString) {
final LineString line = (LineString) geometry;
lineString(out, line, writeSrsName);
} else if (geometry instanceof Polygon) {
final Polygon polygon = (Polygon) geometry;
polygon(out, polygon, writeSrsName);
} else if (geometry instanceof Punctual) {
final Punctual punctual = (Punctual) geometry;
multiPoint(out, punctual, writeSrsName);
} else if (geometry instanceof Lineal) {
final Lineal lineal = (Lineal) geometry;
multiLineString(out, lineal, writeSrsName);
} else if (geometry instanceof Polygonal) {
final Polygonal polygonal = (Polygonal) geometry;
multiPolygon(out, polygonal, writeSrsName);
} else if (geometry.isGeometryCollection()) {
geometryCollection(out, geometry, writeSrsName);
}
}
}
use of com.revolsys.geometry.model.Punctual in project com.revolsys.open by revolsys.
the class MeasureOverlay method paintComponent.
@Override
protected void paintComponent(final Viewport2D viewport, final Graphics2D graphics) {
if (!this.measureGeometry.isEmpty()) {
final GeometryFactory geometryFactory = getGeometryFactory2d();
try (BaseCloseable transformCloseable = viewport.setUseModelCoordinates(graphics, true)) {
MEASURE_RENDERER.paintSelected(viewport, graphics, geometryFactory, this.measureGeometry);
if (this.measureGeometry instanceof Polygon) {
final Polygon polygon = (Polygon) this.measureGeometry;
GeometryStyleRenderer.renderPolygon(viewport, graphics, polygon, POLYGON_STYLE);
}
}
if (!(this.measureGeometry instanceof Punctual)) {
final TextStyle measureTextStyle = new TextStyle();
measureTextStyle.setTextBoxColor(WebColors.Violet);
measureTextStyle.setTextSize(Quantities.getQuantity(14, CustomUnits.PIXEL));
measureTextStyle.setTextFaceName(Font.MONOSPACED);
Point textPoint;
measureTextStyle.setTextHorizontalAlignment("right");
if (this.measureDataType == DataTypes.POLYGON && this.measureGeometry instanceof Polygon) {
measureTextStyle.setTextDx(Quantities.getQuantity(-5, CustomUnits.PIXEL));
measureTextStyle.setTextPlacementType("vertex(n-1)");
measureTextStyle.setTextVerticalAlignment("middle");
textPoint = this.measureGeometry.getToVertex(0, 1);
} else {
measureTextStyle.setTextDx(Quantities.getQuantity(-7, CustomUnits.PIXEL));
measureTextStyle.setTextDy(Quantities.getQuantity(-2, CustomUnits.PIXEL));
measureTextStyle.setTextPlacementType("vertex(n)");
measureTextStyle.setTextVerticalAlignment("top");
textPoint = this.measureGeometry.getToVertex(0);
}
TextStyleRenderer.renderText(viewport, graphics, this.measureLabel, textPoint, measureTextStyle);
}
}
drawXorGeometry(graphics);
}
use of com.revolsys.geometry.model.Punctual in project com.revolsys.open by revolsys.
the class MultiPointVertex method next.
@Override
public Vertex next() {
final Punctual punctual = getPunctual();
this.partIndex++;
if (this.partIndex < punctual.getGeometryCount()) {
return this;
} else {
throw new NoSuchElementException();
}
}
use of com.revolsys.geometry.model.Punctual in project com.revolsys.open by revolsys.
the class ShapefileGeometryHandler method writeMultipoint.
private void writeMultipoint(final EndianOutput out, final Geometry geometry, final int shapeType, final int wordsPerPoint) {
if (geometry instanceof Punctual) {
final int vertexCount = geometry.getVertexCount();
if (this.writeLength) {
final int recordLength = 20 + wordsPerPoint * vertexCount;
// (BYTES_IN_INT + 4 * BYTES_IN_DOUBLE + BYTES_IN_INT +
// (vertexCount * 2 * BYTES_IN_DOUBLE)) / BYTES_IN_SHORT;
out.writeInt(recordLength);
}
out.writeLEInt(shapeType);
final BoundingBox envelope = geometry.getBoundingBox();
writeEnvelope(out, envelope);
out.writeLEInt(vertexCount);
writeXYCoordinates(out, geometry);
} else {
throw new IllegalArgumentException("Expecting Punctual geometry got " + geometry.getGeometryType());
}
}
use of com.revolsys.geometry.model.Punctual in project com.revolsys.open by revolsys.
the class EWktWriter method write.
public static void write(final Writer out, final Geometry geometry) {
if (geometry != null) {
if (geometry instanceof Point) {
final Point point = (Point) geometry;
write(out, point);
} else if (geometry instanceof Punctual) {
final Punctual punctual = (Punctual) geometry;
write(out, punctual);
} else if (geometry instanceof LinearRing) {
final LinearRing line = (LinearRing) geometry;
write(out, line);
} else if (geometry instanceof LineString) {
final LineString line = (LineString) geometry;
write(out, line);
} else if (geometry instanceof Lineal) {
final Lineal lineal = (Lineal) geometry;
write(out, lineal);
} else if (geometry instanceof Polygon) {
final Polygon polygon = (Polygon) geometry;
write(out, polygon);
} else if (geometry instanceof Polygonal) {
final Polygonal polygonal = (Polygonal) geometry;
write(out, polygonal);
} else if (geometry.isGeometryCollection()) {
writeGeometryCollection(out, geometry);
} else {
throw new IllegalArgumentException("Unknown geometry type" + geometry.getClass());
}
}
}
Aggregations