Hi all,

Alastair Fettes wrote:

Now I'm not a Batik master but I do believe that I can answer some of your questions.

1. You could simply just wrap these layers in a <g/> element and do something similar to the following:
<g class="hide">
layer SVG
</g>
<style type="text/css">
.hide
{
opacity: 0;
}
</style>

This will work but is _horribly_ inefficient as the whole subtree will still be drawn and then none of it will be shown because of the opacity setting. Ideally we would detect this but currently we don't (I don't know if other viewers have this optimization either). The proper way to do this is through either 'visibility' or 'display'.

2. Every element in SVG is allowed to have the metadata element. See http://www.w3.org/TR/SVG11/metadata.html#MetadataElement. And I quote:

"Metadata which is included with SVG content should be specified within 'metadata' elements. The contents of the 'metadata' should be elements from other XML namespaces, with these elements from these namespaces expressed in a manner conforming with the "Namespaces in XML" Recommendation [XML-NS]."

I use this fact when programming a couple of my UI widgets from another project that I work on. Example:

Yes, this is very useful. Also an SVG engine is required to ignore unknown elements/attributes that are not in the SVG namespace (it is an error to have unknown elements in the SVG namespace).

   So you could even do something like:

   <jj:heightMap>
       <svg ....>  [regular SVG content]
       </svg>
   </jj:heightMap>

  The entire subtree under jj:heightMap should be ignored.

   BTW for line of sight calculations I would suggest that
you render the heightMap to an offscreen image buffer as
this will be much simpler than trying to work with the vector
data directly (although it would be possible).

3. It is possible to do this sub-map idea if these sub maps are saved as seperate SVG content and you load them dynamically on the fly while getting rid of the main map. Check out www.GalacticPathways.com, an svg based game, to see how he does his maps as a simple example of doing this. Not sure if it is quite what you want though.

This is the trickest of the questions. I can think of a number of ways to achieve this. The simplest is to simply have one large map file load the entire map file and then use the getIntersectionList DOM method to get the list of all elements that intersect the rectangle of interest. Then just delete everything else from the map DOM in memory. There are two main issues with this approach, first at some point you need to have the entire map in memory which is a big hog (related to this you may have issues with the time it takes to do the cleaning - which would best be done "off line"). The second issue is that 'large' features (say a many branched river that crosses most/all of the map) will not be simplified (in graphics clipped) to just the part that intersects the rectangle of interest, the entire piece of geometry will be in memory and perhaps more importantly used when rendering, even though perhaps a tiny portion is actually visible.

   You might be able to reduce the second issue by using the Java2D
Area class to actually clip the intersecting geometry to the region
of interest.

   I think the best way to handle this would be to 'pre-tile' the
map.   So you might draw one large map but then have software that
splits the large map into manageable chunks (say 1-5km squares) then
you could just dynamically build the requested section of the map
by adding the chunks to the viewing DOM.  Another issue you are
likely to run into is Level of Detail.  So when the person is
zoomed way in they are likely to be interested in features that are
quite small (perhaps as small as a meter or less) but when zoomed
out to a 20Km view this level of detail will swamp the rendering
engine.  Thus in maps it is common to have multiple levels of
detail.  There is a new set of elements in SVG 1.2 that are designed
to handle exactly this use case.  If used properly you can actually
use them to simply describe the whole map and let the rendering
engine figure out what needs to be loaded when.  The elements are
multiImage and subImage/subImageRef.  There are examples
of them in the samples/tests/spec12/structure directory,
the opera directory in particular.  These examples tend to use
raster content but the elements/concepts work just as well for
SVG files.

   Good Luck!



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to