You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Christian Kindler <Ch...@draeger.com> on 2003/01/09 11:52:31 UTC

how to get global coordinates for local elements?

Hello,

how can I get the "global" coordinates for an "local" element?

e.g. I have an element somewhere in a <defs> block and this
element is (not directly) referenced by a <use> tag:

Example1:

<svg>
...
<use xlink:href="#ref1" x="30" y="30"/>
...
<defs>
  <g id="ref1" transform="some transformations">
    ...
    <use xlink:href="#ref2" x="25" y="11"/>
  </g>

  <g id="ref2">
    ...
    <circle cx="5" cy="10" r="3"/>
  </g>
</defs>
</svg>

Example2:

<svg>
  ...
  <circle cx="?" cy="?" r="3"/>
</svg>

How do I get the coordinates for the circle element for example2 to have
the circle at the same position like in example1?

I tried to build the GVTTree an get the GraphicsNode (to get the transform
from) for the element but BridgeContext.getGraphicsNode(element) always
returns null.

Any hints?


Regards,
Christian




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


RE: how to get global coordinates for local elements?

Posted by Thomas E Deweese <th...@kodak.com>.
>>>>> "CK" == Christian Kindler <Ch...@draeger.com> writes:

CK> Hello, how can I get the "global" coordinates for an "local"
CK> element?

CK> e.g. I have an element somewhere in a <defs> block and this
CK> element is (not directly) referenced by a <use> tag:

    [...]

CK> How do I get the coordinates for the circle element for example2
CK> to have the circle at the same position like in example1?

CK> I tried to build the GVTTree an get the GraphicsNode (to get the
CK> transform from) for the element but
CK> BridgeContext.getGraphicsNode(element) always returns null.

CK> Any hints?

    The problem is that the element referenced by the Use element may
be referenced multiple times (you could have 10 use elements
referencing it).  So, the simple getGraphicsNode(element) call can't
work.  Unfortunately I think you are in for a lot of work to get this
information but it's there somewhere :).  I could suggest places that
you might start 'hacking code' but I don't think this is really
supported by Batik right now (we don't support modifications to
content referenced by a 'use').

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org