/** * Creates a new {@link PreparedGeometry} appropriate for the argument {@link Geometry}. * * @param geom the geometry to prepare * @return the prepared geometry */ public PreparedGeometry create(Geometry geom) { if (geom instanceof Polygonal) { return new PreparedPolygon((Polygonal) geom); } if (geom instanceof Lineal) { return new PreparedLineString((Lineal) geom); } if (geom instanceof Puntal) { return new PreparedPoint((Puntal) geom); } /** * Default representation. */ return new BasicPreparedGeometry(geom); }
@Override public Rectangle2D drawShape(final Geometry geometry, final ShapeDrawingAttributes attributes) { if (geometry == null) { return null; } if (geometry instanceof GeometryCollection) { final Rectangle2D result = new Rectangle2D.Double(); GeometryUtils.applyToInnerGeometries(geometry, (g) -> result.add(drawShape(g, attributes))); return result; } final boolean isLine = geometry instanceof Lineal || geometry instanceof Puntal; GamaColor border = isLine ? attributes.getColor() : attributes.getBorder(); if (border == null && attributes.isEmpty()) { border = attributes.getColor(); } if (highlight) { attributes.setColor(GamaColor.getInt(data.getHighlightColor().getRGB())); if (border != null) border = attributes.getColor(); } final Shape s = sw.toShape(geometry); try { final Rectangle2D r = s.getBounds2D(); currentRenderer.setColor(attributes.getColor()); if (!isLine && !attributes.isEmpty()) { currentRenderer.fill(s); } if (isLine || border != null || attributes.isEmpty()) { if (border != null) { currentRenderer.setColor(border); } currentRenderer.draw(s); } return r; } catch (final Exception e) { e.printStackTrace(); return null; } }
/** * Creates a new {@link PreparedGeometry} appropriate for the argument {@link Geometry}. * * @param geom the geometry to prepare * @return the prepared geometry */ public PreparedGeometry create(Geometry geom) { if (geom instanceof Polygonal) return new PreparedPolygon((Polygonal) geom); if (geom instanceof Lineal) return new PreparedLineString((Lineal) geom); if (geom instanceof Puntal) return new PreparedPoint((Puntal) geom); /** * Default representation. */ return new BasicPreparedGeometry(geom); }
static Rank getRank(Geometry geometry) { if (geometry instanceof Puntal) { return Rank.POINT; } else if (geometry instanceof Lineal) { return Rank.LINE; } else if (geometry instanceof Polygonal) { return Rank.AREA; } else { return Rank.NOT_SPECIFIED; } }
public static Geometry union(Puntal pointGeom, Geometry otherGeom) { PointGeometryUnion unioner = new PointGeometryUnion(pointGeom, otherGeom); return unioner.union(); }
public PointGeometryUnion(Puntal pointGeom, Geometry otherGeom) { this.pointGeom = (Geometry) pointGeom; this.otherGeom = otherGeom; this.geomFact = otherGeom.getFactory(); }
public PreparedPoint(Puntal point) { super((Geometry) point); }
public static boolean isPuntal(Geometry geom) { return geom instanceof Puntal; }