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 Philip Miller <pw...@sarnoff.com> on 2001/03/26 21:28:40 UTC
CGM to SVG
My apologies if this is an FAQ. I looked, but could not find the answer
anywhere. Is there some code that I can use to convert CGM to SVG. I
have some legacy data that contains cgm data. I would like to use the
Batik svg viewer for all of my new work, but I cannot find any code that
will let me convert cgm to svg. Is there some Java code that will let
me do this?
Thanks,
Phil
pwmiller@sarnoff.com
Re: how to get real coordinates
Posted by Christophe Jolif <cj...@ilog.fr>.
Carlos,
I'm not sure to exactly understand your question but if your question is
what is the size of the client area you can try the following:
<svg width="100%" height="100%" font-weight="normal">
<script type="text/ecmascript">
function f(evt) {
System.out.println(evt.target.width.baseVal.value)
}
</script>
<g onclick="f(evt)">
<rect x="0" y="0" width="300" height="100" style="fill:blue"/>
</g>
</svg>
Carlos Sanchez wrote:
>
> Hi,
>
> Is there any way in the java script to know the current size of the box
> where the chart is rendered?
>
> Thx a lot,
>
> Carlos
>
> -----Original Message-----
> From: Christophe Jolif [mailto:cjolif@ilog.fr]
> Sent: Tuesday, March 27, 2001 8:07 AM
> To: Batik Users
> Cc: batik-dev@xml.apache.org
> Subject: Re: how to get real coordinates
>
> Hello Carlos,
>
> The screen coordinates are according to your screen, the client
> coordiantes are according to the client area i.e. the SVG Canvas in the
> Batik viewer. If there is no transformation, the client coordinates
> should match the coordinates of the object. But in most cases you have
> transformations and in this case, to get local coordinates to the SVG
> graphic object you will need to transform the client coordinates with
> the CTM. Unfortunately for the time being, the Batik SVG DOM doesn't yet
> implement the useful methods (getCTM()...) to do this transformation.
>
> Carlos Sanchez wrote:
> >
> > I have an SVG file with the following attributes..
> >
> > <svg id="svg" height="100%" width="100%" viewBox="0 0 960 930"><defs>
> >
> > inside of it I have a path defined as <path id="pathGraph"
> > cursor="crosshair" style="fill:red; fill-opacity:0.80; stroke:black;
> > stroke-width:0.2" onmouseover="annotationon(evt)"
> > onmouseout="annotationoff(evt)" onmousemove="annotate(evt)" d="M66.35
> 703.22
> > L157.16 617.83 L247.97 65.00 L338.78 762.81 L429.59 312.09 L520.41 609.68
> > L611.22 845.00 L702.03 758.65 L792.84 277.65 L883.65 781.08 z"></path>
> >
> > As I move the mouse I want to get the X and Y coordinate to and match it
> > with the values in the path. However, in the java script the
> > evt.getClientX() does not return the expected value. (it changes as I a
> > resize the browser) I also tried evt.screenX, but it did not work either.
> >
> > Can any one tell me how I can get the real coordinates (path) regardless
> of
> > the size and viewBox
> >
> > Thx.
> >
> > Carlos
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
>
> --
> Christophe
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-dev-help@xml.apache.org
--
Christophe
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org
RE: how to get real coordinates
Posted by Carlos Sanchez <ca...@ktsi.com>.
Hi,
Is there any way in the java script to know the current size of the box
where the chart is rendered?
Thx a lot,
Carlos
-----Original Message-----
From: Christophe Jolif [mailto:cjolif@ilog.fr]
Sent: Tuesday, March 27, 2001 8:07 AM
To: Batik Users
Cc: batik-dev@xml.apache.org
Subject: Re: how to get real coordinates
Hello Carlos,
The screen coordinates are according to your screen, the client
coordiantes are according to the client area i.e. the SVG Canvas in the
Batik viewer. If there is no transformation, the client coordinates
should match the coordinates of the object. But in most cases you have
transformations and in this case, to get local coordinates to the SVG
graphic object you will need to transform the client coordinates with
the CTM. Unfortunately for the time being, the Batik SVG DOM doesn't yet
implement the useful methods (getCTM()...) to do this transformation.
Carlos Sanchez wrote:
>
> I have an SVG file with the following attributes..
>
> <svg id="svg" height="100%" width="100%" viewBox="0 0 960 930"><defs>
>
> inside of it I have a path defined as <path id="pathGraph"
> cursor="crosshair" style="fill:red; fill-opacity:0.80; stroke:black;
> stroke-width:0.2" onmouseover="annotationon(evt)"
> onmouseout="annotationoff(evt)" onmousemove="annotate(evt)" d="M66.35
703.22
> L157.16 617.83 L247.97 65.00 L338.78 762.81 L429.59 312.09 L520.41 609.68
> L611.22 845.00 L702.03 758.65 L792.84 277.65 L883.65 781.08 z"></path>
>
> As I move the mouse I want to get the X and Y coordinate to and match it
> with the values in the path. However, in the java script the
> evt.getClientX() does not return the expected value. (it changes as I a
> resize the browser) I also tried evt.screenX, but it did not work either.
>
> Can any one tell me how I can get the real coordinates (path) regardless
of
> the size and viewBox
>
> Thx.
>
> Carlos
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
--
Christophe
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org
Re: how to get real coordinates
Posted by Christophe Jolif <cj...@ilog.fr>.
Hello Carlos,
The screen coordinates are according to your screen, the client
coordiantes are according to the client area i.e. the SVG Canvas in the
Batik viewer. If there is no transformation, the client coordinates
should match the coordinates of the object. But in most cases you have
transformations and in this case, to get local coordinates to the SVG
graphic object you will need to transform the client coordinates with
the CTM. Unfortunately for the time being, the Batik SVG DOM doesn't yet
implement the useful methods (getCTM()...) to do this transformation.
Carlos Sanchez wrote:
>
> I have an SVG file with the following attributes..
>
> <svg id="svg" height="100%" width="100%" viewBox="0 0 960 930"><defs>
>
> inside of it I have a path defined as <path id="pathGraph"
> cursor="crosshair" style="fill:red; fill-opacity:0.80; stroke:black;
> stroke-width:0.2" onmouseover="annotationon(evt)"
> onmouseout="annotationoff(evt)" onmousemove="annotate(evt)" d="M66.35 703.22
> L157.16 617.83 L247.97 65.00 L338.78 762.81 L429.59 312.09 L520.41 609.68
> L611.22 845.00 L702.03 758.65 L792.84 277.65 L883.65 781.08 z"></path>
>
> As I move the mouse I want to get the X and Y coordinate to and match it
> with the values in the path. However, in the java script the
> evt.getClientX() does not return the expected value. (it changes as I a
> resize the browser) I also tried evt.screenX, but it did not work either.
>
> Can any one tell me how I can get the real coordinates (path) regardless of
> the size and viewBox
>
> Thx.
>
> Carlos
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
--
Christophe
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org
Re: how to get real coordinates
Posted by Christophe Jolif <cj...@ilog.fr>.
Hello Carlos,
The screen coordinates are according to your screen, the client
coordiantes are according to the client area i.e. the SVG Canvas in the
Batik viewer. If there is no transformation, the client coordinates
should match the coordinates of the object. But in most cases you have
transformations and in this case, to get local coordinates to the SVG
graphic object you will need to transform the client coordinates with
the CTM. Unfortunately for the time being, the Batik SVG DOM doesn't yet
implement the useful methods (getCTM()...) to do this transformation.
Carlos Sanchez wrote:
>
> I have an SVG file with the following attributes..
>
> <svg id="svg" height="100%" width="100%" viewBox="0 0 960 930"><defs>
>
> inside of it I have a path defined as <path id="pathGraph"
> cursor="crosshair" style="fill:red; fill-opacity:0.80; stroke:black;
> stroke-width:0.2" onmouseover="annotationon(evt)"
> onmouseout="annotationoff(evt)" onmousemove="annotate(evt)" d="M66.35 703.22
> L157.16 617.83 L247.97 65.00 L338.78 762.81 L429.59 312.09 L520.41 609.68
> L611.22 845.00 L702.03 758.65 L792.84 277.65 L883.65 781.08 z"></path>
>
> As I move the mouse I want to get the X and Y coordinate to and match it
> with the values in the path. However, in the java script the
> evt.getClientX() does not return the expected value. (it changes as I a
> resize the browser) I also tried evt.screenX, but it did not work either.
>
> Can any one tell me how I can get the real coordinates (path) regardless of
> the size and viewBox
>
> Thx.
>
> Carlos
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
--
Christophe
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
how to get real coordinates
Posted by Carlos Sanchez <ca...@ktsi.com>.
I have an SVG file with the following attributes..
<svg id="svg" height="100%" width="100%" viewBox="0 0 960 930"><defs>
inside of it I have a path defined as <path id="pathGraph"
cursor="crosshair" style="fill:red; fill-opacity:0.80; stroke:black;
stroke-width:0.2" onmouseover="annotationon(evt)"
onmouseout="annotationoff(evt)" onmousemove="annotate(evt)" d="M66.35 703.22
L157.16 617.83 L247.97 65.00 L338.78 762.81 L429.59 312.09 L520.41 609.68
L611.22 845.00 L702.03 758.65 L792.84 277.65 L883.65 781.08 z"></path>
As I move the mouse I want to get the X and Y coordinate to and match it
with the values in the path. However, in the java script the
evt.getClientX() does not return the expected value. (it changes as I a
resize the browser) I also tried evt.screenX, but it did not work either.
Can any one tell me how I can get the real coordinates (path) regardless of
the size and viewBox
Thx.
Carlos
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
how to get real coordinates
Posted by Carlos Sanchez <ca...@ktsi.com>.
I have an SVG file with the following attributes..
<svg id="svg" height="100%" width="100%" viewBox="0 0 960 930"><defs>
inside of it I have a path defined as <path id="pathGraph"
cursor="crosshair" style="fill:red; fill-opacity:0.80; stroke:black;
stroke-width:0.2" onmouseover="annotationon(evt)"
onmouseout="annotationoff(evt)" onmousemove="annotate(evt)" d="M66.35 703.22
L157.16 617.83 L247.97 65.00 L338.78 762.81 L429.59 312.09 L520.41 609.68
L611.22 845.00 L702.03 758.65 L792.84 277.65 L883.65 781.08 z"></path>
As I move the mouse I want to get the X and Y coordinate to and match it
with the values in the path. However, in the java script the
evt.getClientX() does not return the expected value. (it changes as I a
resize the browser) I also tried evt.screenX, but it did not work either.
Can any one tell me how I can get the real coordinates (path) regardless of
the size and viewBox
Thx.
Carlos
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org
Re: CGM to SVG
Posted by Vincent Hardy <vh...@eng.sun.com>.
Philip,
I do not know of any CGM to SVG converter, but that does not mean it
does not exist. If you are interested in writing one to contribute
to Batik, it would be really interesting :-)
Vincent.
Philip Miller wrote:
>
> My apologies if this is an FAQ. I looked, but could not find the answer
> anywhere. Is there some code that I can use to convert CGM to SVG. I
> have some legacy data that contains cgm data. I would like to use the
> Batik svg viewer for all of my new work, but I cannot find any code that
> will let me convert cgm to svg. Is there some Java code that will let
> me do this?
>
> Thanks,
> Phil
>
> pwmiller@sarnoff.com
>
> ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org