...So, in the:
e.setAttributeNS(null, "r", "5");
I can add all the relevant information about the accident?
thx
yasmin
> Hi Yasmin,
>
> [EMAIL PROTECTED] wrote on 02/27/2006 01:26:07 PM:
>
>> yes, it does but how does that work?
>
> Assuming there is no 'obvious' dynamic content in the
> SVG file already (script, event handlers, etc). You need
> to tell the canvas to treat your document as dynamic:
>
> canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
>
> // Do what ever you curently do to load your SVG and get
> // a list of points for circles.
> // Once the document is loaded (onload callback or
> // wait for first rendering):
>
> canvas.getUpdateManager().getUpdateRunnableQueue().
> invokeLater(new Runnable() {
> public void run() {
> SVGDocuemnt doc = canvas.getSVGDocument();
> String SVGNS = "http://www.w3.org/2000/svg"; // SVG namespace
> Iterator i = ...; // get list of points
> Element g = doc.getElementById("circleGroup");
> while (i.hasNext()) {
> Point2D pt2d = i.next();
> Element e = doc.createElementNS(SVGNS, "circle");
> e.setAttributeNS(null, "cx", ""+pt2d.getX());
> e.setAttributeNS(null, "cy", ""+pt2d.getY());
> e.setAttributeNS(null, "r", "5");
> g.appendChild(g);
> }
> });
>
>>
>>
>>
>> > Well you're not adding them to a document in the file system, but the
>> > JSVGCanvas certainly has a reference to an SVGDocument in memory,
> right?
>> >
>> > Michael Bishop
>> >
>> > -----Original Message-----
>> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> > Sent: Monday, February 27, 2006 1:18 PM
>> > To: [email protected]
>> > Subject: RE: Red Spots
>> >
>> > Hi there!
>> >
>> > I can't make the spots part of the document, because they are drawn
>> > after
>> > getting the information from a database (Accident database) ...is
> there
>> > a
>> > way when a mouse clicks on any of the spots to activate an event?
>> >
>> > ThankU
>> >
>> > yasmin
>> >
>> >
>> >
>> >
>> >
>> >> Hi Yasmin,
>> >>
>> >> [EMAIL PROTECTED] wrote on 02/27/2006 12:42:09 PM:
>> >>
>> >>> ...I've drawn the circles on the canvas, they are not part of my svg
>> >>> document such that the actual file is not altered, the the circles
>> > are
>> >> not
>> >>> individual elements - any ideas :(
>> >>
>> >> Yes, make them part of your document ;)
>> >> Really this is the simplest thing. If you want to minimize the
>> >> 'impact' on the original document put all the circle in a special
>> > group
>> >> (probably dynamically created) so you can just delete the group to
>> > 'reset'
>> >> the document. This way you can let the SVG engine do all the event
>> >> tracking.
>> >>
>> >> You could add an event listener (mouse move or the like) to the
>> >> rootmost SVG element and you will get notified of any mouse event
>> >> over any element in the document. You could then manually check
> these
>> >> points against your circles. But this seems like a bunch of extra
>> > work
>> >> for nothing.
>> >>
>> >>>
>> >>> yasmin
>> >>>
>> >>>
>> >>> > Hello,
>> >>> > For events, I attach an event to the entire document. For
>> >>> > individual elements, this may work. You'll need to get your
> circle
>> > as
>> >>> > an org.w3c.dom.Element.
>> >>> >
>> >>> > EventTarget eventTarget = (EventTarget) yourElement;
>> >>> > eventTarget.addEventListener(SVGConstants.SVG_EVENT_MOUSEDOWN, new
>> >>> > YourEventListener(), false);
>> >>> >
>> >>> > Michael Bishop
>> >>> >
>> >>> > -----Original Message-----
>> >>> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> >>> > Sent: Monday, February 27, 2006 12:13 PM
>> >>> > To: [email protected]
>> >>> > Subject: Red Spots
>> >>> >
>> >>> >
>> >>> > Hi Michael Bishop,
>> >>> >
>> >>> > I have been beavering on my project and have successfully
> converted
>> > my
>> >>> > screen coordinates to documents and can interact with my database
>> > to
>> >>> > retrieve the information for the current view and show red spots
> on
>> >> the
>> >>> > areas where accidents have happend on the map ...now I need to
> make
>> >> the
>> >>> > red spots active so when a user clicks on a red spot the relevant
>> >>> > information about that particular accident is displayed ...i
> simply
>> >> used
>> >>> > the following code to create the red spot:
>> >>> >
>> >>> > Graphics spot = canvas.getGraphics();
>> >>> > spot.setColor(Color.RED);
>> >>> > spot.fillOval(x,y,22,22);
>> >>> > spot.dispose();
>> >>> >
>> >>> > but i cant assign an ActionEvent to the spot ...Any ideas?
>> >>> >
>> >>> > Many thanks in advance :)
>> >>> >
>> >>> > Yasmin
>> >>> >
>> >>> >
>> >>> >
>> >>> >
>> >>> >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
>> >>> >> <HTML>
>> >>> >> <HEAD>
>> >>> >> <META HTTP-EQUIV="Content-Type" CONTENT="text/html;
>> >>> > charset=iso-8859-1">
>> >>> >>
>> >>> >>
>> >>> >> <META NAME="Generator" CONTENT="MS Exchange Server version
>> >>> > 6.5.7226.0">
>> >>> >> <TITLE>RE: Coordinates</TITLE>
>> >>> >> </HEAD>
>> >>> >> <BODY>
>> >>> >> <DIV id=idOWAReplyText99836 dir=ltr>
>> >>> >> <DIV dir=ltr><FONT face=Arial color=#000000 size=2>Element
> element
>> >>
>> >>> >>
>> > svgDocument.createElement(SVGConstants.SVG_CIRCLE_TAG);</FONT></DIV>
>> >>> >> <DIV dir=ltr><FONT face=Arial
>> >>> >> size=2>element.setAttribute(SVGConstants.SVG_CX_ATTR,
>> >>> >> xPosition);</FONT></DIV>
>> >>> >> <DIV dir=ltr><FONT face=Arial
>> >>> >> size=2>element.setAttribute(SVGConstants.SVG_CY_ATTR,
>> >>> >> yPosition);</FONT></DIV>
>> >>> >> <DIV dir=ltr><FONT face=Arial
>> >>> >> size=2>element.setAttribute(SVGConstants.SVG_R_ATTR,
>> >>> > radius);</FONT></DIV>
>> >>> >> <DIV dir=ltr><FONT face=Arial
>> >>> >> size=2>element.setAttribute(SVGConstants.SVG_FILL_ATTR,
>> >>> >> "red");</FONT></DIV>
>> >>> >> <DIV dir=ltr><FONT face=Arial
>> >>> >>
>> > size=2>svgDocument.getDocumentElement.append(element);</FONT></DIV>
>> >>> >> <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
>> >>> >> <DIV dir=ltr><FONT face=Arial size=2>Use code completion or the
>> > Batik
>> >>> >> Javadoc. Most of those SVGConstants references are probably
>> >>> >> wrong.</FONT></DIV>
>> >>> >> <DIV dir=ltr><FONT face=Arial size=2></FONT> </DIV>
>> >>> >> <DIV dir=ltr><FONT face=Arial size=2>Michael
>> >> Bishop</FONT></DIV></DIV>
>> >>> >> <DIV dir=ltr><BR>
>> >>> >> <HR tabIndex=-1>
>> >>> >> <FONT face=Tahoma size=2><B>From:</B> [EMAIL PROTECTED]
>> >>> >> [mailto:[EMAIL PROTECTED]<BR><B>Sent:</B> Sun 2/19/2006
>> > 3:07
>> >>> >> PM<BR><B>To:</B>
>> >> [email protected]<BR><B>Subject:</B>
>> >>> > RE:
>> >>> >> Coordinates<BR></FONT><BR></DIV>
>> >>> >> <DIV>
>> >>> >> <P><FONT size=2>me again!<BR><BR>...I think I don't need to
>> > convert
>> >>> > back
>> >>> >> to
>> >>> >> screen coordinates I should be<BR>able to use the document
>> >>> > coordinates,
>> >>> >> but how
>> >>> >> can I draw a red-spot<BR>(filled circle) and a given location on
>> > the
>> >>> >> canvas?<BR><BR>ThankU in advance<BR><BR>yasmin<BR><BR>>
>> >>> > <!DOCTYPE
>> >>> >> HTML
>> >>> >> PUBLIC "-//W3C//DTD HTML 3.2//EN"><BR>>
> <HTML><BR>>
>> >>> >> <HEAD><BR>> <META HTTP-EQUIV="Content-Type"
>> >>> >> CONTENT="text/html;
>> >>> >> charset=iso-8859-1"><BR>><BR>><BR>> <META
>> >>> > NAME="Generator"
>> >>> >> CONTENT="MS Exchange Server version 6.5.7226.0"><BR>>
>> >>> >> <TITLE>Coordinates</TITLE><BR>>
>> > </HEAD><BR>>
>> >>> >> <BODY><BR>> <DIV id=idOWAReplyText8269
>> >> dir=ltr><BR>>
>> >>> >> <DIV
>> >>> >> dir=ltr><FONT face=Arial color=#000000 size=2>Not sure;
>> >>> > haven't
>> >>> >> done<BR>> it in<BR>> reverse.&nbsp; There is a method
>> > for
>> >> an
>> >>> >> SVGLocatable called getScreenCTM<BR>> that<BR>> may be of
>> >>> >> use.</FONT></DIV><BR>> <DIV dir=ltr><FONT
>> >>> >> face=Arial
>> >>> >> size=2></FONT>&nbsp;</DIV><BR>> <DIV
>> >>> >> dir=ltr><FONT face=Arial size=2>Michael
>> >>> >> Bishop</FONT></DIV></DIV><BR>> <DIV
>> >>> >> dir=ltr><BR><BR>> <HR tabIndex=-1><BR>>
>> > <FONT
>> >>> >> face=Tahoma size=2><B>From:</B>
>> >>> >> [EMAIL PROTECTED]<BR>>
>> >>> >> [<A
>> >>> >>
>> >>> >
>> >>
>> >
> href="mailto:[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED]</A>
>> >>> > ]<BR><B>Sent:</B>
>> >>> >> Sun 2/19/2006 1:08<BR>> PM<BR><B>To:</B>
>> >>> >>
>> >>> >
>> >>
>> >
> [email protected]<BR><B>Subject:</B><
>> >>> > BR>>
>> >>> >> Coordinates<BR></FONT><BR></DIV><BR>>
>> >>> >> <DIV><BR>> <P><FONT size=2>Hi Michael
>> >>> >> Bishop,<BR><BR>...I've converted my screen<BR>>
>> >>> > coordinates
>> >>> >> to my
>> >>> >> document coordinates - now<BR>I'm trying to convert<BR>>
>> >>> >> document<BR>> coordinates to screen coordinate so that
>> >>> > at<BR>that
>> >>> >> point
>> >>> >> on the map, I<BR>> can draw<BR>> a red_spot on the
>> > canvas...any
>> >>> >> ideas?<BR><BR>ThankU in<BR>>
>> >>> >>
>> >>> >
>> >>
>> >
> advance<BR><BR>yasmin<BR><BR><BR>---------
>> >>> >
>> >>
>> >
> ------------------------------------------------------------<BR>To
>> >>> > <BR>>
>> >>> >> unsubscribe, e-mail:
>> >>> >>
>> > [EMAIL PROTECTED]<BR>For<BR>>
>> >>> >> additional
>> >>> >> commands, e-mail:<BR>>
>> >>> >>
>> >>> >
>> >>
>> >
> [EMAIL PROTECTED]<BR></FONT></P>
>> >>> > </DIV><BR>><BR>>
>> >>> >> </BODY><BR>>
>> >>> >>
>> >>> >
>> >>
>> >
> </HTML><BR><BR><BR><BR>-------------------------------------------
>> >>> > --------------------------<BR>To
>> >>> >> unsubscribe, e-mail:
>> >>> > [EMAIL PROTECTED]<BR>For
>> >>> >> additional commands, e-mail:
>> >>> >> [EMAIL PROTECTED]<BR></FONT></P></DIV>
>> >>> >>
>> >>> >> </BODY>
>> >>> >> </HTML>
>> >>> >
>> >>> >
>> >>> >
>> >>> >
>> > ---------------------------------------------------------------------
>> >>> > To unsubscribe, e-mail:
>> > [EMAIL PROTECTED]
>> >>> > For additional commands, e-mail:
>> >> [EMAIL PROTECTED]
>> >>> >
>> >>> >
>> > ---------------------------------------------------------------------
>> >>> > To unsubscribe, e-mail:
>> > [EMAIL PROTECTED]
>> >>> > For additional commands, e-mail:
>> >> [EMAIL PROTECTED]
>> >>> >
>> >>> >
>> >>> >
>> >>>
>> >>>
>> >>>
>> >>>
> ---------------------------------------------------------------------
>> >>> To unsubscribe, e-mail:
>> > [EMAIL PROTECTED]
>> >>> For additional commands, e-mail:
>> > [EMAIL PROTECTED]
>> >>>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
>> >> For additional commands, e-mail:
>> > [EMAIL PROTECTED]
>> >>
>> >>
>> >>
>> >
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail:
> [EMAIL PROTECTED]
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail:
> [EMAIL PROTECTED]
>> >
>> >
>> >
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]