private double computeScale( ReferencedEnvelope envelope, Rectangle paintArea, AffineTransform worldToScreen, Map hints) { if (getScaleComputationMethod().equals(SCALE_ACCURATE)) { try { return RendererUtilities.calculateScale( envelope, paintArea.width, paintArea.height, hints); } catch (Exception e) // probably either (1) no CRS (2) error xforming { LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e); } } if (XAffineTransform.getRotation(worldToScreen) != 0.0) { return RendererUtilities.calculateOGCScaleAffine( envelope.getCoordinateReferenceSystem(), worldToScreen, hints); } return RendererUtilities.calculateOGCScale(envelope, paintArea.width, hints); }
public void testOGCScaleFeet() throws Exception { try { ReferencedEnvelope re = new ReferencedEnvelope( new Envelope(0, 10, 0, 10), CRS.decode("EPSG:2927", true)); int tenMetersPixels = (int) Math.round(10 / 0.00028); RendererUtilities.SCALE_UNIT_COMPENSATION = false; double scale = RendererUtilities.calculateOGCScale(re, tenMetersPixels, new HashMap()); assertEquals(1, scale, 0.0001); RendererUtilities.SCALE_UNIT_COMPENSATION = true; scale = RendererUtilities.calculateOGCScale(re, tenMetersPixels, new HashMap()); assertEquals(0.304803, scale, 0.0001); } finally { RendererUtilities.SCALE_UNIT_COMPENSATION = true; } }
private double computeScale(ReferencedEnvelope envelope, Rectangle paintArea, AffineTransform worldToScreen, Map hints) { if(getScaleComputationMethod().equals(SCALE_ACCURATE)) { try { return RendererUtilities.calculateScale(envelope, paintArea.width, paintArea.height, hints); } catch (Exception e) // probably either (1) no CRS (2) error xforming { LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e); } } if (XAffineTransform.getRotation(worldToScreen) != 0.0) { return RendererUtilities.calculateOGCScaleAffine(envelope.getCoordinateReferenceSystem(), worldToScreen, hints); } return RendererUtilities.calculateOGCScale(envelope, paintArea.width, hints); }
public void testOGCScaleProjected() throws Exception { ReferencedEnvelope re = new ReferencedEnvelope( new Envelope(0, 10, 0, 10), DefaultEngineeringCRS.CARTESIAN_2D); int tenMetersPixels = (int) Math.round(10 / 0.00028); double scale = RendererUtilities.calculateOGCScale(re, tenMetersPixels, new HashMap()); assertEquals(1.0, scale, 0.0001); }
private double computeScale(ReferencedEnvelope envelope, CoordinateReferenceSystem crs, Rectangle paintArea, AffineTransform worldToScreen, Map hints) { if(getScaleComputationMethod().equals(SCALE_ACCURATE)) { try { return RendererUtilities.calculateScale(envelope, paintArea.width, paintArea.height, hints); } catch (Exception e) // probably either (1) no CRS (2) error xforming { LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e); } } if (XAffineTransform.getRotation(worldToScreen) != 0.0) { return RendererUtilities.calculateOGCScaleAffine(envelope.getCoordinateReferenceSystem(), worldToScreen, hints); } return RendererUtilities.calculateOGCScale(envelope, paintArea.width, hints); }
public void testOGCScaleGeographic() throws Exception { // same example as page 29 in the SLD OGC spec, but with the expected scale corrected // since the OGC document contains a very imprecise one ReferencedEnvelope re = new ReferencedEnvelope(new Envelope(0, 2, 0, 2), DefaultGeographicCRS.WGS84); double scale = RendererUtilities.calculateOGCScale(re, 600, new HashMap()); assertEquals(1325232.03, scale, 0.01); }
getCoordinateReferenceSystem(), at, hints); } else { return RendererUtilities.calculateOGCScale( getViewport().getBounds(), getMapWidth(), hints);
private double computeScale(ReferencedEnvelope envelope, Rectangle paintArea, Map hints) { if(getScaleComputationMethod().equals(SCALE_ACCURATE)) { try { return RendererUtilities.calculateScale(envelope, paintArea.width, paintArea.height, hints); } catch (Exception e) // probably either (1) no CRS (2) error xforming { LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e); } } return RendererUtilities.calculateOGCScale(envelope, paintArea.width, hints); }
private double computeScale(ReferencedEnvelope envelope, CoordinateReferenceSystem crs, Rectangle paintArea, Map hints) { if(getScaleComputationMethod().equals(SCALE_ACCURATE)) { try { return RendererUtilities.calculateScale(envelope, paintArea.width, paintArea.height, hints); } catch (Exception e) // probably either (1) no CRS (2) error xforming { LOGGER.log(Level.WARNING, e.getLocalizedMessage(), e); } } return RendererUtilities.calculateOGCScale(envelope, paintArea.width, hints); }
double originalOGCScale = RendererUtilities.calculateOGCScale(mapEnvelope, mapWidth, hints);