Hi Emily: That may be a result of poor QA after refactoring the code to use FeatureLayer; rather than the earlier MapLayer. No change in functionality was intended and this would be considered a regression.
Can I ask you to open up a GeoTools bug report on this one; you have provided more than sufficient detail :-) -- Jody Garnett On Thursday, 15 September 2011 at 5:26 PM, Emily Gouge wrote: > One of the features I used to like about uDig was being able to set a > layers projection if the layer does not have a projection (or if the > projection is wrong). However this no longer works. > > To reproduce: > > 1. Load a shapefile without a .prj file. > 2. Set the layers projection. > 3. Set the map projection to be the same as the layer projection & zoom > to your layer. This works and displays the layer. > 4. Set the map projection to something else. The layer no longer renders. > > I did some digging and found in the BasicFeatureRenderer these lines > (from the prepareDraw) function were commented out: > > FeatureCollection<SimpleFeatureType, SimpleFeature> reprojectingFc = new > ForceCoordinateSystemFeatureResults(featureSource.getFeatures(), > layer.getCRS()); > layers[0] = new DefaultMapLayer(reprojectingFc, style, "Test"); > > and replaced with this: > > layers[0] = new DefaultMapLayer(featureSource, style, "Test"); > DefaultQuery query = new DefaultQuery(Query.ALL); > query.setTypeName(featureSource.getSchema().getTypeName()); > query.setCoordinateSystem(layerCRS); > layers[0].setQuery(query); > > If I un-do this change then the layer renders fine. > > I think there are multiple issues with this "new" code: > 1) The layers[0].setQuery is called here, however it is also called > later in the execution process in the setQueries() function. So first > query which is supposed to set the CRS is over-written and not used when > rendering. > > 2) Geotools ignores the CoordinateSystem of the layer passed in the > layer. Even when I fixed the problem outlined in (1), the issues was > not resolved. I looked a bit into the geotools StreamingRenderer and it > didn't look to me like it used the CRS of the query, however I am not > familiar enough with this code to pinpoint the issue (if there even is one). > > > I'm wondering if anyone knows what prompted this change in the rendering > process and if it can be reverted back or made to work so projections > can be set on layers. > > Thanks, > Emily > > > > > > > _______________________________________________ > User-friendly Desktop Internet GIS (uDig) > http://udig.refractions.net > http://lists.refractions.net/mailman/listinfo/udig-devel
_______________________________________________ User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel
