Loading ...
Sorry, an error occurred while loading the content.

Re: SVG tag which specifies the data of the layer for an element.

Expand Messages
  • Helder Magalhães
    Hi Naveen, ... In SVG, visual elements are stacked according to the order they are declared [1]. As far as I know, there is not a specific layer concept,
    Message 1 of 7 , Mar 9, 2009
    • 0 Attachment
      Hi Naveen,


      > I am not able to find the tag in svg which could specify
      > about the layer data of the element present.

      In SVG, visual elements are stacked according to the order they are declared [1]. As far as I know, there is not a specific "layer" concept, although this is usually modeled using through group elements [2]: a nice example from carto.net [3] shows how can this be achieved (toggle the checkboxes to show/hide the "layers").


      Hope this helps,
      Helder Magalhães


      [1] http://www.w3.org/TR/SVG11/render.html#RenderingOrder
      [2] http://www.w3.org/TR/SVG11/struct.html#Groups
      [3] http://www.carto.net/papers/svg/samples/canvas.shtml
    • simonshutter
      Thanks, Samy and Helder - I will check out the script Simon
      Message 2 of 7 , Mar 9, 2009
      • 0 Attachment
        Thanks, Samy and Helder - I will check out the script

        Simon


        --- In svg-developers@yahoogroups.com, Helder Magalhães <helder.magalhaes@...> wrote:
        >
        > > There is an ecma-script function of Holger Will, with modifications
        > > of Jeff Schiller that does the job.
        >
        > Yes, I believe there is a slightly updated version in a drag sample [1] by Jeff Schiller. (View source and search for "getScreenCTM" if you are curious).
        >
        > Hope this helps,
        > Helder Magalhães
        >
        > [1] http://www.codedread.com/dragtest2.svg
        >
      • ddailey
        ... I gather that you are looking for something like a z-index in HTML. In SVG, this is just the rendering order (within the parent node) [1]. So I suppose if
        Message 3 of 7 , Mar 9, 2009
        • 0 Attachment
          Naveen wrote:

          >Ex: If there are 2 elements present in the svg file where one element is present in 1st layer and the other is present in the 2nd layer. Which tag represents the layer data for the elements?

          I gather that you are looking for something like a z-index in HTML. In SVG, this is just the rendering order (within the parent node) [1]. So I suppose if you don't know where something is, you could retrieve its parent, and then loop through the children of the parent keeping track of the index until you find the node in question -- that would be the rough equivalent of its stacking order.

          The question often arises when you wish to change the stacking order (front to back) of objects. This is typically done by removing an object in the middle of the stack and appending it either to the front or bottom of the stack to move it up or down. I think Andreas Neumann has some nice examples at http://www.carto.net/papers/svg/manipulating_svg_with_dom_ecmascript/ , and I found another one by googling http://wiki.svg.org/Rendering_Order (unfortunately it isn't loading right now, but I suppose that is just a temporary thing).

          Hope this helps
          David


          [1] http://www.w3.org/TR/1999/WD-SVG-19990211/render.html

          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.