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 Peppe <pe...@gmail.com> on 2006/12/09 16:41:26 UTC
update bounding box position
Hi, i get bounding box of my shape but when i move the shape and i reclick on
shape the bounding box is calculated in old position, why? I move my shape
creating a point by ctm Matrix and then i update attributeNS "transform"
with SVG point values...
--
View this message in context: http://www.nabble.com/update-bounding-box-position-tf2786041.html#a7773323
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: update bounding box position
Posted by Phil Wright <ph...@gmail.com>.
Because the transform is applied to the values of the bounding box to
determine the current position. The bounding box isn't changed _by_ the
transform.
On 12/9/06, Peppe <pe...@gmail.com> wrote:
>
>
> Hi, i get bounding box of my shape but when i move the shape and i reclick
> on
> shape the bounding box is calculated in old position, why? I move my shape
> creating a point by ctm Matrix and then i update attributeNS "transform"
> with SVG point values...
> --
> View this message in context:
> http://www.nabble.com/update-bounding-box-position-tf2786041.html#a7773323
> Sent from the Batik - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>
--
Visit http://www.darkisle.com for photos of castles, cairns and other
historic sites in the British Isles.
Re: update bounding box position
Posted by Peppe <pe...@gmail.com>.
so, when i release mouse button i map the new position of my shape and then i
get the bounding box...at this point i create a new svgpoint...i read your
answer to K.W. Landry...but...i don't know how to continue:
DOMMouseEvent eleEvt = (DOMMouseEvent)evt;
shape = (Element)eleEvt.getTarget();
SVGMatrix mat = ((SVGLocatable)shape).getScreenCTM();
SVGMatrix imat = mat.inverse();
shapeBound = ((SVGLocatable)shape).getBBox();
SVGPoint cPt = doc.getRootElement().createSVGPoint();
cPt.setX(eleEvt.getClientX());
cPt.setY(eleEvt.getClientY());
cPt = cPt.matrixTransform(imat);
--
View this message in context: http://www.nabble.com/update-bounding-box-position-tf2786041.html#a7919092
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: update bounding box position
Posted by th...@kodak.com.
Hi Peppe,
> Peppe wrote:
> > So, i wrote this code but i don't know how to continue:
Take a look at my response to K.W. Landry (limiting
drag):
http://www.nabble.com/Limiting-Drag-tf2805187.html
It uses a lot of the same methods as you would use.
> >
> > SVGGraphicsElement graphics = (SVGGraphicsElement) ee;
> > SVGRect box = graphics.getBBox();
> > SVGMatrix matr = graphics.getScreenCTM();
> >
> > where ee is my shape that i move.
> >
>
> i try to solve my problem from 4 days but i failed...somebody can help
me?
>
> --
> View this message in context: http://www.nabble.com/update-bounding-
> box-position-tf2786041.html#a7869469
> Sent from the Batik - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
Re: update bounding box position
Posted by Peppe <pe...@gmail.com>.
Peppe wrote:
>
>
> So, i wrote this code but i don't know how to continue:
>
> SVGGraphicsElement graphics = (SVGGraphicsElement) ee;
> SVGRect box = graphics.getBBox();
> SVGMatrix matr = graphics.getScreenCTM();
>
> where ee is my shape that i move.
>
i try to solve my problem from 4 days but i failed...somebody can help me?
--
View this message in context: http://www.nabble.com/update-bounding-box-position-tf2786041.html#a7869469
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: update bounding box position
Posted by Peppe <pe...@gmail.com>.
So, i wrote this code but i don't know how to continue:
SVGGraphicsElement graphics = (SVGGraphicsElement) ee;
SVGRect box = graphics.getBBox();
SVGMatrix matr = graphics.getScreenCTM();
where ee is my shape that i move.
--
View this message in context: http://www.nabble.com/update-bounding-box-position-tf2786041.html#a7776696
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: update bounding box position
Posted by th...@kodak.com.
Hi Peppe,
Peppe <pe...@gmail.com> wrote on 12/09/2006 10:41:26 AM:
> Hi, i get bounding box of my shape but when i move the shape and i
reclick on
> shape the bounding box is calculated in old position, why?
Because the bounding box of an object is always given in it's
local coordinate system. Since you don't change the 'x','y' it's
bbox in the local coordiate system doesn't change. The transform
just changes the mapping from the local coordinate system to the screen.
> I move my shape creating a point by ctm Matrix and then i update
> attributeNS "transform" with SVG point values...
Then you need to transform the bbox to some other coordinate system
(like the screen or the root most SVG element). The following two
SVG DOM functions (on SVGLocatable) can be helpful for this:
SVGMatrix getScreenCTM ( );
SVGMatrix getTransformToElement ( in SVGElement element )
You can then use the SVGMatrix to map the corners of the bbox to
what ever coordinate system you want.