Martin Desruisseaux wrote:
2. I want to change this behaviour to pan the map. So, when moving
the mouse, the map also moves, but doesn't zoom or anything else. Is
this possible?
You can create yours own subclass of StyledMapPane and override the
following method:
protected void mouseSelectionPerformed(Shape area) {
}
thanks, I've found it. I think I'll try it by altering the preferredArea
or the mapPane
And another question: As already mentioned, I'm using the methods as
in the Spearfish Sample, which uses J2D-renderer. I experienced
OutOfMemoryExceptions when dealing with larger shapefiles (3x 30
MB). Is there a possibility to avoid that?
Technically yes, but it is hard to use at this time.
There is some chances that the shapefile datastore stores the
geometries as JTS object with arrays of CoordinatePoint. This storage
scheme is expensive. You can "compress" them, but with a cost: the
lost of the underlying JTS geometries. Explanation:
J2D renderer internally stores all geometries as
org.geotools.renderer.geom.Geometry objects using an abstract
PointArray structure. The point array may be JTS's Coordinate[] array,
a plain double[] array, etc. The idea is to switch from the
Coordinate[] representation to a float[] representation.
We first need to find the underlying Geometry objects. One possible
way is to invokes MapPane.getRenderer().getLayers(). Then iterates
through those layers and search for "if (layer instanceof
RenderedGeometries)". Invokes RenderedGeometries.getGeometry(). You
should not have a GeometryCollection (maybe not the only one, the
search should continue for other layers).
Invoke Geometry.compress(CompressionLevel.DIRECT_AS_FLOATS). If you
get an UnmodifiableGeometryException, try to clone the geometry before
to compress it.
Set the new geometry to the RenderedGeometries layer.
Make sure that there is no reference to the original JTS geometry
floating around (you may need to checks in a profiler to make sure
that their memory is reclaimed).
Maybe this is easier to realise with the LiteRenderer?
Is there btw. any Tutorial showing howto Render Shapefiles with the
LiteRenderer? I only found Tutorials which rendered manually generated
FeatureCollections and have no idea how to render Shapefiles with
LiteRenderer...
Bernhard
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users