W3C home > Mailing lists > Public > www-svg@w3.org > October 2001

Re: Groups with non-zero intersections

From: Ivan Herman <ivan@w3.org>
Date: Sun, 28 Oct 2001 09:37:46 +0200
Message-Id: <5.1.0.14.2.20011028092743.00abb988@Localhost>
To: Jason Foster <jafoster@uwaterloo.ca>, <www-svg@w3.org>
I am not sure what <group id="route2"> reference-to-road-1, 
reference-to-road-2 </group> means if not using 'use'. My impression is 
(unless I misunderstood your question) that you mis-read the 
recommendation; g's may have intersecting content, using your terminology. 
The attachment svg file does just that.

You do have a valid point, though: using 'use' and referring to the same 
line elements will indeed force multiple copies of those lines to be 
rendered. However, I would not be surprised if smart implementations of SVG 
would not optimize this somehow (maybe not now, but eventually). Another 
possibility (though less portable) is that you attach a script to your 
different groups and you would try to massage the final DOM tree yourself 
by trying to optimize things. I am afraid this would become very messy, 
though...


At 03:44 28-10-01, Jason Foster wrote:
>I'm pretty new to SVG and am trying to figure out a solution to what I think
>would be a fairly standard problem.
>
>The problem is how to highlight routes on a road network, given that
>multiple routes may have zero or more roads in common.
>
>Before reading the SVG specification, my plan was to define the roads
>individually with unique identifiers, and to then create groups that
>referred back to those identifiers.  In other words (and mutilating
>syntax)...
>
><line id="road1" ... />
><line id="road2" ... />
>
><group id="route1"> reference-to-road-1 </group>
><group id="route2"> reference-to-road-1, reference-to-road-2 </group>
>
>Then I was going to do the equivalent of "Set all lines in group 'route2' to
>green".
>
>Based on my reading of the specification this isn't possible using the "g"
>element, as the sets defined by different "g"s must have no intersections.
>The "use" element looked interesting, but I got the impression that copies
>the element, which would mean that I would have multiple lines being
>rendered, which seems to be a waste.
>
>I though about specifying the route using a class, eg.
>
><line id="road1" class="route1 route2 ... " .../>
>
>I could then mess with the class to make my changes.  This doesn't feel too
>bad except for one problem: I am looking at 30,000 routes and about 10,000
>roads.  I'm a little worried that using classes might be a bad idea,
>although I don't yet know the maximum number of routes (classes) in which a
>particular road will be a member.
>
>Any suggestions on the "right" way to handle this kind of problem would be
>greatly appreciated.  Ideally my interpretation of the "use" element is
>completely wrong and using it does not create multiple instances of the
>element, in which case this was a lame question all around.
>
>Thanks for your help,
>
>Jason Foster

Ivan Herman

Head of Offices, World Wide Web Consortium
C/o W3C Dutch Office at CWI,  Kruislaan 413, 1098 SJ Amsterdam
tel:           +31-20-5924163
fax:          +31-20-5924312
mobile:     +33-608872517
email:       ivan@w3.org


example.svg
(image/svg attachment: example.svg)

Received on Sunday, 28 October 2001 03:38:12 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:21 GMT