Modifying an SVG file dynamically ??? How ?

shahpritesh
02-08-2005, 03:12 AM
i am developing a map application, wherein locating a location is not a problem. however the problem is adding data to the map dynamically throough the interface itself.

i hope i am making myself clear....

lets say you have opened up a map, now you want to add a post or anything just a point on the map, throught the map only, and not by hardcoding it in the xml, also the same changes should get reflected in the database on the server side while this is done on the client side.

the other users (clients) who use the same map in future should get the updated information on the map.

do let me know, if anybody has worked on it.. or knows about some APIs or scripting functions for the same...(i am using javascript...)

thankx,

Anonymous
02-08-2005, 07:42 AM
You can add object using javascript as

var str="<circle cx='" + evt.clientX + "' cy='" + evt.clientY + "' r='4' fill='red'/>
var node = parseXML(str, svgdoc) // I suppose that you define your document somewhere as svgdoc
your_map.appendChild(node) // to put over other elements
or
your_map.insertBefore(node, some_map_child) // to put before some child

To save object in database, you can use postURL to send values to server
postURL("save.php",str,callback,"text",null)

In save.php, you retrieve str with
$data = $HTTP_RAW_POST_DATA;

You can perhaps only send coordinates, all depend of your database structure.

If you use not PHP but JSP or other adapt code

Michel

shahpritesh12
02-08-2005, 08:04 AM
hey michele.. that was really great info...

but i ll be using a jsp... and i dont knw how to deal with phps at all....

so kindly gve me a corresponding code for a jsp....

thanx.

Anonymous
02-08-2005, 11:32 AM
For jsp, you can use

InputStream stream = request.getInputStream();
DataInputStream datas = new DataInputStream(stream);

String line_data = new String(datas.readLine());
while (line_data != null)
{
--> make what you want with data ...
};

Michel

shahpritesh
02-09-2005, 01:55 AM
thankz michele... will get back if i have porblems...thanx,

 
Web mp2kmag.com
mapforums.com

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum