/** * Adds the geometries into the collection by recursively splitting apart geometry collections, * so that geoms will contains only simple geometries. * * @param geoms * @param geometry * @param geomType * @return the geometry type that all geometries added to the collection conform to. Worst case * it's going to be Geometry.class */ private Class accumulate(List<Geometry> geoms, Geometry geometry, Class geomType) { Class gtype = null; for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry g = geometry.getGeometryN(i); if (g instanceof GeometryCollection) { gtype = accumulate(geoms, g, geomType); } else { if (renderingEnvelope.intersects(g.getEnvelopeInternal())) { geoms.add(g); gtype = g.getClass(); } } if (gtype == null) { gtype = g.getClass(); } else if (geomType != null && !g.getClass().equals(geomType)) { gtype = Geometry.class; } } return gtype; }
/** * Provides the strategy with the area we want to render and its CRS (the SPI lookup will do * this step) * * @throws FactoryException */ public WrappingProjectionHandler( ReferencedEnvelope renderingEnvelope, ReferencedEnvelope validArea, CoordinateReferenceSystem sourceCrs, double centralMeridian, int maxWraps) throws FactoryException { super(sourceCrs, validArea, renderingEnvelope); this.maxWraps = maxWraps; // if we are wrapping, we query across the dateline no matter what this.queryAcrossDateline = true; // this will compute the radius setCentralMeridian(centralMeridian); }
geogCrs.getDatum().getPrimeMeridian().getGreenwichLongitude(); WrappingProjectionHandler handler = new WrappingProjectionHandler( renderingEnvelope, validArea, sourceCrs, centralMeridian, maxWraps); handler.setDatelineWrappingCheckEnabled( !isWrappingException(crs, horizontalSourceCrs)); return handler;
if (wrap && maxWraps > 0) { handler = new WrappingProjectionHandler( renderingEnvelope, VALID_AREA,
((WrappingProjectionHandler) handler).setDatelineWrappingCheckEnabled(false);
public ProjectionHandler getHandler(ReferencedEnvelope renderingEnvelope, boolean wrap, int maxWraps) { CoordinateReferenceSystem crs = renderingEnvelope.getCoordinateReferenceSystem(); if (renderingEnvelope != null && crs instanceof GeographicCRS) { GeographicCRS geogCrs = (GeographicCRS) crs; if(wrap && maxWraps > 0) { double centralMeridian = geogCrs.getDatum().getPrimeMeridian().getGreenwichLongitude(); return new WrappingProjectionHandler(renderingEnvelope, null, centralMeridian, maxWraps); } else { return new ProjectionHandler(renderingEnvelope, null); } } return null; }
geomType = accumulate(geoms, geometry, geomType); while (curr <= highLimit) { double offset = curr - base; offseted.apply(new OffsetOrdinateFilter(northEast ? 1 : 0, offset)); offseted.geometryChanged(); geomType = accumulate(geoms, offseted, geomType);
public ProjectionHandler getHandler(ReferencedEnvelope renderingEnvelope, boolean wrap, int maxWraps) { MapProjection mapProjection = CRS.getMapProjection(renderingEnvelope .getCoordinateReferenceSystem()); if (renderingEnvelope != null && mapProjection instanceof Mercator) { if(wrap && maxWraps > 0) { double centralMeridian = mapProjection.getParameterValues().parameter( AbstractProvider.CENTRAL_MERIDIAN.getName().getCode()).doubleValue(); return new WrappingProjectionHandler(renderingEnvelope, VALID_AREA, centralMeridian, maxWraps); } else { return new ProjectionHandler(renderingEnvelope, VALID_AREA); } } return null; }
Class gtype = null; if (g instanceof GeometryCollection) { gtype = accumulate(geoms, g, geomType); } else { if(renderingEnvelope.intersects(g.getEnvelopeInternal())) {
geomType = accumulate(geoms, geometry, geomType); while (min <= highLimit) { double offset = min - env.getMinX(); offseted.apply(new OffsetOrdinateFilter(0, offset)); offseted.geometryChanged(); geomType = accumulate(geoms, offseted, geomType);