Note that there are some explanatory texts on larger screens.

plurals
  1. POMake a stored polyline editable again?
    primarykey
    data
    text
    <p>I am bit stuck with making a saved polyline editable again. At the moment i have stored the points in a mysql database and i am able to show the route/polyline again with custom markers.</p> <p>Now i like the polyline to be editable again and for this i was looking into: <a href="http://www.birdtheme.org/useful/v3tool.html" rel="nofollow">http://www.birdtheme.org/useful/v3tool.html</a></p> <p>Issues i have:</p> <ol> <li>i can't get the already saved points/markers to act as if they where just placed on the map. For example the points can't be dragged and dropped. A marker can be picked up but i am not able to put it on the map again (i already tried event dragend).</li> <li>i don't want the midmarkers, just the ability to move markers, add and delete markers</li> </ol> <p>At the moment my startediting function looks like:</p> <pre><code>function startEditing(){ if(editing === true){ stopediting(); }else{ routeCoords = theRoute.getPath(); //remove custom icons //setAllMap(null); if(routeCoords.length &gt; 0){ for(var i = 0; i &lt; routeCoords.length; i++) { var marker = setmarkers(routeCoords.getAt(i)); //alert("marker: "+marker); markers.push(marker); /*if(i &gt; 0) { var midmarker = setmidmarkers(routeCoords.getAt(i)); midmarkers.push(midmarker); }*/ } editing = true; jQuery('#btnEditing').removeClass('green'); jQuery('#btnEditing').val('Stop Editing').addClass('red'); } } } </code></pre> <p>and function setmarkers looks like</p> <pre><code>function setmarkers(point){ var marker = new google.maps.Marker({ position: point, map: map, icon: imageNormal, raiseOnDrag: false, draggable: true }); google.maps.event.addListener(marker, "mouseover", function() { marker.setIcon(imageHover); }); google.maps.event.addListener(marker, "mouseout", function() { marker.setIcon(imageNormal); }); google.maps.event.addListener(marker, "drag", function() { for (var i = 0; i &lt; markers.length; i++) { if (markers[i] === marker) { theRoute.getPath().setAt(i, marker.getPosition()); movemidmarker(i); //movemarker(i); break; } } routeCoords = theRoute.getPath(); var stringtobesaved = marker.getPosition().lat().toFixed(6) + ',' + marker.getPosition().lng().toFixed(6); pointsArray.splice(i,1,stringtobesaved); }); ////#end markers van DB google.maps.event.addListener(marker, "click", function() { for (var i = 0; i &lt; markers.length; i++) { if (markers[i] === marker &amp;&amp; markers.length !== 1) { marker.setMap(null); markers.splice(i, 1); theRoute.getPath().removeAt(i); removemidmarker(i); break; } } routeCoords = theRoute.getPath(); if(markers.length &gt; 0) { pointsArray.splice(i,1); } }); return marker; } </code></pre> <p>Any suggestions?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload