From: Jody G. (JIRA) <ji...@co...> - 2006-12-06 01:32:44
|
RenderUtilities.scale throws IllegalArgumentException when used with DefaultGeographic.CRS ------------------------------------------------------------------------------------------ Key: GEOT-1056 URL: http://jira.codehaus.org/browse/GEOT-1056 Project: GeoTools Issue Type: Bug Components: core main Affects Versions: 2.3 Reporter: Jody Garnett Assigned To: Martin Desruisseaux Finally sorting through one of the last interesting changes between 2.2.x and trunk for the uDig code base... Envelope centerTile = new Envelope( x1, x2, y1, y2 ); // actually 0, 36, -18, 18 crs = DefaultGeographicCRS scale = RendererUtilities.calculateScale( centerTile, crs, 512, 512, 72.0 ); On 2.2.x the above produces: .....21931519 And on trunk this produces .... > java.lang.IllegalArgumentException: Argument "crs" should not be null. > at org.geotools.geometry.TransformedDirectPosition.ensureNonNull(TransformedDirectPosition.java:315) > at org.geotools.geometry.TransformedDirectPosition.setCoordinateReferenceSystem(TransformedDirectPosition.java:190) > at org.geotools.geometry.GeneralDirectPosition.setLocation(GeneralDirectPosition.java:275) > at org.geotools.geometry.TransformedDirectPosition.transform(TransformedDirectPosition.java:245) > at org.geotools.referencing.GeodeticCalculator.setStartingPosition(GeodeticCalculator.java:575) > at org.geotools.geometry.jts.JTS.orthodromicDistance(JTS.java:355) > at org.geotools.renderer.lite.RendererUtilities.calculateScale(RendererUtilities.java:397) This appears to be from the use of JTS.POSITIONS static final: > private static final GeneralDirectPosition[] POSITIONS = new GeneralDirectPosition[4]; > static { > for (int i=0; i<POSITIONS.length; i++) { > POSITIONS[i] = new GeneralDirectPosition(i); > } > } Which appears to be a shared synchronized buffer for storing parameters to the GeodecCalculator ... as in this code block: > copy(p1, pos.ordinates); > gc.setStartingPosition(pos); > copy(p2, pos.ordinates); > gc.setDestinationPosition(pos); > return gc.getOrthodromicDistance(); The required CRS has been dropped from the copy method above ... so it is null by the time the geodeccalculator gets a hold of it? -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |