Google Groups Home
Help | Sign in
Want to add drag and drop events to each marker in uploaded xml/gpx
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nirak  
View profile
 More options Aug 20 2008, 5:40 am
From: Nirak <kari...@hotmail.com>
Date: Wed, 20 Aug 2008 04:40:32 -0700 (PDT)
Local: Wed, Aug 20 2008 5:40 am
Subject: Want to add drag and drop events to each marker in uploaded xml/gpx
Hi
I'm trying to upload a xml-/gpx-file to my map and add drag-and-drop-
event to each marker.

//get all points from doc
var trackpoints = xml.documentElement.getElementsByTagName("trkpt");

      //set focus to first point
      for (var i=0;i<trackpoints.length;i++) {
        if(i == 0){
            this.map.setCenter(new
GLatLng(parseFloat(trackpoints[i].getAttribute("lat")),
            parseFloat(trackpoints[i].getAttribute("lon"))), 13);
       }

      var point = new
GLatLng(parseFloat(trackpoints[i].getAttribute("lat")),

parseFloat(trackpoints[i].getAttribute("lon")));

      // get marker
      var new_marker = addMarker(point);

      GEvent.addListener(new_marker, "dragstart", function() {
           for(i in line) {
               if(line[i].equals(new_marker.getPoint())) {
                      line_index_shift = i;
               }
          }
      });

     GEvent.addListener(new_marker, "dragend", function() {
            shiftMarker(line[line_index_shift],
new_marker.getPoint());
     });

}

but when I try to drag one of the markers the line in dragstart:
      if(line[i].equals(new_marker.getPoint()))
allways has new_marker to the last marker in doc.

How can I set the event on each marker?

http://mappingspot.com/MyPage/uploadRout.aspx

Thanx


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Williams  
View profile
 More options Aug 20 2008, 10:59 am
From: Mike Williams <nos...@econym.demon.co.uk>
Date: Wed, 20 Aug 2008 17:59:41 +0100
Local: Wed, Aug 20 2008 10:59 am
Subject: Re: Want to add drag and drop events to each marker in uploaded xml/gpx
Put your marker creation and addListener into a createMarker() function
which will hold function closure on your variables.

http://econym.googlepages.com/basic1.htm
Potential Pitfall 3

--
http://econym.googlepages.com/index.htm
The Blackpool Community Church Javascript Team


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nirak  
View profile
 More options Aug 27 2008, 2:00 pm
From: Nirak <kari...@hotmail.com>
Date: Wed, 27 Aug 2008 13:00:23 -0700 (PDT)
Local: Wed, Aug 27 2008 2:00 pm
Subject: Re: Want to add drag and drop events to each marker in uploaded xml/gpx
I don't know how to :(
I think I've tried everything but it allways takes the last point to
work with in my drag and drop events.
On this last change I think I put everything in an own method
http://mappingspot.com/MyPage/tesuploadRout.aspx
Thanx for our help!

On 20 Aug, 18:59, Mike Williams <nos...@econym.demon.co.uk> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nirak  
View profile
 More options Sep 7 2008, 7:23 am
From: Nirak <kari...@hotmail.com>
Date: Sun, 7 Sep 2008 06:23:29 -0700 (PDT)
Local: Sun, Sep 7 2008 7:23 am
Subject: Re: Want to add drag and drop events to each marker in uploaded xml/gpx
Yes I put  e v e r y t h i n g  about the "markercreation" in an own
function :) It worked perfect. THANX!!

On 20 Aug, 18:59, Mike Williams <nos...@econym.demon.co.uk> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google