Chris,<br><br>I am not sure if the rest of your code handles this situation, but when I use the 'STICKY' option with overLib and pan the map, the opened tooltip stays in it's position while the marker and map move. <br><br>
I know there is a way to change the location of the tooltip, which is probably best changed upon an event action inside kaMap.<br><br>any thoughts?<br><br>-Sepehr<br><br><div><span class="gmail_quote">On 3/5/06, <b class="gmail_sendername">
Stephen Woodbridge</b> <<a href="mailto:woodbri@swoodbridge.com">woodbri@swoodbridge.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Chris,<br><br>I'm not sure how to do this or if it is possible, but it would seem like<br>you would want to have each marker destroy itself if you panned outside<br>the extended extent or changed zoom scale. Otherwise you will have a
<br>object leak and continue to create these markers as long as the user has<br>the page open.<br><br>One way to do it might be to make a structure the contains all the<br>objects that your create and a variable the describes the valid context
<br>that were created for. Then before you add new markers for an context<br>that does not match the save context, you can destroy all the old<br>markers before adding the new markers.<br><br>Just an idea.<br> -Steve W.
<br><br>Base Bloc wrote:<br>> Hi Guys,<br>><br>><br>><br>> I'm still plugging away to get some workable functions together to draw<br>> markers with tool-tips and it's hard work as I'm experienced with PHP
<br>> but not so hot on JavaScript and DOM so am making all the usual mistakes<br>> but getting there slowly. I now have a system in place that at a curtain<br>> scale places markers within an extended extent of the visible map tiles
<br>> using HttpRequest. All is working fine and I currently have the system<br>> getting markers from a database to place markers on the map at the<br>> required scale (1:300000), then adding more markers as the map is panned.
<br>><br>><br>><br>> The problem I'm encountering now is that although the function is<br>> working correctly as in it won't add markers+tool-tips until the map is<br>> zoomed to 1:300000 when the map is zoomed back out above 1:300000 the
<br>> markers previously called all remain on screen and as there are over<br>> 7000 points you can imagine what this looks like at 1:4000000.<br>><br>><br>><br>> Is there a simple way to clear all of the markers created by
<br>> addObjectGeo when the map is zoomed out past a curtain scale or better<br>> yet add an event related to myKaMap.getCurrentScale() so they are only<br>> displayed when the scale in greater than X?<br>><br>
><br>><br>> Here are the functions I'm using at present:<br>><br>><br>><br>> //creates separate image for each marker<br>><br>> function create_marker (img_id, var_1, lat, lon)<br>><br>> {
<br>><br>><br>><br>> document[img_id] = document.createElement( 'img' );<br>><br>> document[img_id].src = 'images/kamap.gif';<br>><br>><br>><br>> var bname = navigator.appName
;<br>><br>> if (bname == "Microsoft Internet Explorer")<br>><br>> {<br>><br>> document[img_id].attachEvent("onmouseover",tool_tip)
<br>><br>><br>> document[img_id].attachEvent("onmouseout",tool_tip_out)<br>><br>> document[img_id].attachEvent("onclick",page_link)<br>><br>> }
<br>><br>> else<br>><br>> {<br>><br>><br>> document[img_id].addEventListener("mouseover",tool_tip,false)<br>><br>><br>> document[img_id].addEventListener("mouseout",tool_tip_out,false)
<br>><br>><br>> document[img_id].addEventListener("click",page_link,false)<br>><br>> }<br>><br>><br>><br>> //Sends content and format options
<br>> to tool-tip<br>><br>> function tool_tip(){<br>><br>><br>><br>> var test_var = var_1;<br>><br>> var text = "My name is "
<br>> +test_var+ ", and I'm am now understanding JavaScripts";<br>><br>> overlib(text, STICKY,<br>> MOUSEOFF, CAPTION, 'info')<br>><br>> }
<br>><br>><br>><br>> myKaMap.addObjectGeo( myCanvas, lat, lon, document[img_id] );<br>><br>><br>><br>> }<br>><br>><br>><br>> function drawMarkers(){<br>><br>
> Big_Extents = myKaMap.getGeoExpandedExtents();<br>><br>> myCanvas = myKaMap.createDrawingCanvas( 5000 );<br>><br>><br>><br>> //draw Markers within Big_Extents using kaXMLOverlay or just<br>> addObjectGeo()
<br>><br>><br>><br>> var scale = myKaMap.getCurrentScale();<br>><br>><br>><br>> if (scale <= 200000)<br>><br>> {<br>><br>><br>><br>> //this is where the HttpRequest would normally go, but I
<br>> have placed a couple of sample markers to make the script more clear<br>><br>> create_marker('C02573', 'Box', 511275, 1363860);<br>><br>> create_marker('C02574', 'Pipe', 515736, 1364260);
<br>><br>><br>><br>> }<br>><br>><br>><br>> }<br>><br>><br>><br>> var scale = myKaMap.getCurrentScale();<br>><br>><br>><br>><br>><br>> myKaMap.registerForEvent
( KAMAP_SCALE_CHANGED, null,<br>> drawMarkers );<br>><br>> myKaMap.registerForEvent( KAMAP_EXTENTS_CHANGED, null,<br>> maybeRedraw );<br>><br>> myKaMap.registerForEvent( KAMAP_MAP_INITIALIZED, null,
<br>> drawMarkers );<br>><br>><br>><br>> }<br>><br>><br>><br>> Sorry there are a few calls to functions there which I have not added<br>> above, I didn't want to do a 500 line cut and paste, once I have it
<br>> working properly I will post the full code and related functions.<br>><br>><br>><br>> Any suggestions on a fix to this problem would be appreciated.<br>><br>><br>><br>> Thanks,<br>><br>
><br>><br>> Chris<br>><br>><br>><br>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>><br>> Christopher Brown<br>><br>> Head of Internet Development<br>><br>> Base Bloc Cambodia<br>><br>> #33, 123, Phnom Penh, Cambodia.
<br>><br>> P.O. Box 2086<br>><br>> <a href="http://www.basebloc.com">www.basebloc.com</a><br>><br>> Tel (+885) 12 315 302<br>><br>><br>><br>><br>> ------------------------------------------------------------------------
<br>><br>> _______________________________________________<br>> ka-Map-users mailing list<br>> <a href="mailto:ka-Map-users@lists.maptools.org">ka-Map-users@lists.maptools.org</a><br>> <a href="http://lists.maptools.org/mailman/listinfo/ka-map-users">
http://lists.maptools.org/mailman/listinfo/ka-map-users</a><br><br>_______________________________________________<br>ka-Map-users mailing list<br><a href="mailto:ka-Map-users@lists.maptools.org">ka-Map-users@lists.maptools.org
</a><br><a href="http://lists.maptools.org/mailman/listinfo/ka-map-users">http://lists.maptools.org/mailman/listinfo/ka-map-users</a><br></blockquote></div><br><br clear="all"><br>-- <br><br><br><br>..:: Sepehr Sadeghi ::..
<br>..:: <a href="mailto:sadegs@alum.rpi.edu">sadegs@alum.rpi.edu</a> ::..<br>..:: 603-205-4402 ::..