|
Hi,
When i first saw the doc of those renderers i
thought that the ShapeRenderer only Render ShapeFIles layers, while
StreamRenderer Render the rest (sorry about my english). But, i added a non
ShapeFile Layer to my context and, surprisely, appears my layer at my map. But i
start to see a thing:
When i load all my shapes, the performance was ok,
but when i load "1 point" the performance decreased considerably. So i
start to look at ShapeFileRenderer and found that the variable that tell
SheFileRenderer to render like a ShapeFile or like a Stream was wrong(pontualy,
i didnt see other impacts), it only consider the last layer, so if the last
layer was a non shape file layer, it renderer all the context with the
StreamRenderer. Id like to share with u these changes...
i will try to put the code here...
change the ShapeFileRenderer.setContext()
to:
public void setContext( MapContext context ){ if( context == null ){ context = new DefaultMapContext();} this.context = context;}
in the paint() method, before : if ( layerIndexInfo == null ){ renderWithStreamingRenderer( currLayer, graphics, paintArea, envelope, transform ); }
put this: MapLayer[] layers = context.getLayers(); layerIndexInfo = new IndexInfo[layers.length];DataStore ds = layers[i].getFeatureSource().getDataStore(); if( ds instanceof ShapefileDataStore ){ ShapefileDataStore sds = (ShapefileDataStore) ds; try{ layerIndexInfo[i] = useIndex( sds );} catch( Exception e ){ layerIndexInfo[i] = new IndexInfo( IndexInfo.TREE_NONE, null, null ); LOGGER.fine( "Exception while trying to use index" + e.getLocalizedMessage() );} } else{ layerIndexInfo = null;}
then it will delegate only the non ShapeFiles Layer to StreamRenderer.
i Hope it helps. Bye, Fred. |
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
