@Override public GeometryValidationState validate(Geometry geometry, GeometryIndex index) { if (GeometryService.getNumPoints(geometry) > 7) { rollBack = true; return GeometryValidationState.INVALID_COORDINATE; } rollBack = false; return GeometryValidationState.VALID; }
@Override public double getArea(Geometry geometry) { return org.geomajas.geometry.service.GeometryService.getArea(geometry); }
@Override public double getLength(Geometry geometry) { return org.geomajas.geometry.service.GeometryService.getLength(geometry); }
public Bbox getBounds() { if (bounds == null && !features.isEmpty()) { for (Feature feature : features) { org.geomajas.geometry.Geometry geom = feature.getGeometry(); if (geom != null) { Bbox b = GeometryService.getBounds(geom); if (bounds == null) { bounds = b; } else { bounds = BboxService.union(bounds, b); } } } } return bounds; }
public CanvasPath(Geometry geometry) { this.geometry = geometry; bounds = GeometryService.getBounds(geometry); }
protected Bbox calcBounds() { Bbox result = calcBounds(coordinates); for (SubPath s : subPaths) { result = BboxService.union(result, calcBounds(s.getCoordinates())); } return result; }
@Override public void update(Bbox mapBounds) { // Only update the mapBounds if it's outside the region we already fetched. if (this.mapBounds == null || !BboxService.contains(this.mapBounds, mapBounds)) { this.mapBounds = BboxService.buffer(mapBounds, mapBounds.getWidth() / 2); fetch = true; } else { fetch = false; } } }
/** * Parse the given Well Known Text string into a geometry. * * @param wkt * The WKT text. * @return The resulting geometry, or null in case something went wrong. */ public Geometry toGeometry(String wkt) { try { return WktService.toGeometry(wkt); } catch (WktException e) { return null; } }
public Geometry transform(Geometry geometry, Matrix matrix) { Geometry copy = GeometryService.clone(geometry); transformInplace(copy, matrix); return copy; }
@Override public void setTranslation(double deltaX, double deltaY) { matrix = new Matrix(matrix.getXx(), 0.0, 0.0, matrix.getYy(), deltaX, deltaY); updateTransform(); if (!BboxService.contains(bufferBounds, canvasBounds)) { repaintBuffer(); } copyBufferToCanvas(); }
private double abs(Coordinate c) { return MathService.distance(c, new Coordinate()); }
@Override public boolean isEmpty(Geometry geometry) { return org.geomajas.geometry.service.GeometryService.isEmpty(geometry); }
protected Bbox asBounds(View view) { double deltaScale = view.getResolution() / resolution; Bbox bounds = viewPort.asBounds(view); return BboxService.scale(bounds, deltaScale); }
@Override public void applyBounds(Bbox bounds, ZoomOption zoomOption) { double tempResolution = getResolutionForBounds(bounds, zoomOption); Coordinate tempPosition = checkPosition(BboxService.getCenterPoint(bounds), tempResolution); View copy = copy(view, tempPosition, tempResolution); applyViewNoChecks(copy); }
/** * Format the given geometry object to Well Known Text representation. * * @param geometry * The geometry to format. * @return Get WKT representation of the given geometry, or null in case something went wrong. */ public String toWkt(Geometry geometry) { try { return WktService.toWkt(geometry); } catch (WktException e) { return null; } }
public CanvasPath(Geometry geometry) { this.geometry = geometry; bounds = GeometryService.getBounds(geometry); }
@Override public double getNumPoints(Geometry geometry) { return org.geomajas.geometry.service.GeometryService.getNumPoints(geometry); }
private Bbox calcBounds(Coordinate[] coordinates) { Coordinate c = coordinates[0]; Bbox result = new Bbox(c.getX(), c.getY(), 0, 0); for (int i = 1; i < coordinates.length; i++) { c = coordinates[i]; result = BboxService.union(result, new Bbox(c.getX(), c.getY(), 0, 0)); } return result; }
/** * Is the event at the same location as the "down" event? * * @param event * The event to check. * @return true or false. */ private boolean isDownPosition(HumanInputEvent<?> event) { if (onDownLocation != null) { Coordinate location = getLocation(event, RenderSpace.SCREEN); if (MathService.distance(onDownLocation, location) < clickDelta) { return true; } } return false; }
private Bbox calcBounds(Coordinate[] coordinates) { Coordinate c = coordinates[0]; Bbox result = new Bbox(c.getX(), c.getY(), 0, 0); for (int i = 1; i < coordinates.length; i++) { c = coordinates[i]; result = BboxService.union(result, new Bbox(c.getX(), c.getY(), 0, 0)); } return result; }