MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Developer news for Virtual Earth: Dragging Map Elements and Web.Maps.VE updated

This is a discussion on Developer news for Virtual Earth: Dragging Map Elements and Web.Maps.VE updated within the Virtual Earth Blogs forums, part of the Blogs category; Dragging entities on the map object A common request from developers is how to implement dragable map objects on the ...


Go Back   MapPoint Forums > Blogs > Virtual Earth Blogs

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack (2) Thread Tools Display Modes
  2 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 01-03-2008
Senior Member
Blue Belt
 
Join Date: Sep 2007
Posts: 161
Developer news for Virtual Earth: Dragging Map Elements and Web.Maps.VE updated

Dragging entities on the map object
A common request from developers is how to implement dragable map objects on the VE map Control. Virtual Earth supports a number of events on the map object (onmousedown, onmouseup, onmousemove in particular) that make it easy to implement dragging of elements on the map. Grayson Myers and Derrick Quan contributed some nice code samples to illustrate how to use these three events together for seamless drag of pushpins and polygons. Here are the samples -

  • Simple Drag - Draws a default and a custom pushpin and allows re-positioning of either of them
  • Collection Drag - Loads a Collection of travel destinations, each member of which is dragable
  • Shape Drag - Shows how to drag shapes and lines. slightly more complex in that the onmousemove event needs to recalculate the new pixel coordinate of each vertex for the shape being dragged

In each example, there's basically 2 pieces of code that are interesting. first, register the 3 events when initializing the map control like this:

map.AttachEvent("onmousedown",MouseHandler);
map.AttachEvent("onmouseup",MouseHandler);
map.AttachEvent("onmousemove",MouseHandler);

All three events will fire MouseHandler

function MouseHandler(e)
{
** var msg;
** if (e.eventName == "onmousedown" && e.elementID != null)
** {
***** dragShape = map.GetShapeByID(e.elementID);
***** return true; // prevent the default action
** }else if (e.eventName == "onmouseup")
** {
***** dragShape = null;
** }else if (e.eventName == "onmousemove" && dragShape != null)
** {
***** var x = e.mapX;
***** var y = e.mapY;
***** pixel = new VEPixel(x, y);
***** var LL = map.PixelToLatLong(pixel);
***** dragShape.SetPoints(LL);
***** return true; // prevent the default action
** }
}

Web.Maps.VE ASP.NET Ajax library updated
A new version of this Server control for your ASP.NET apps is out. Read about the latest version here featuring support for .NET 3.5 and visit the Simplovation website to download it and view demos. If you want to keep most of your VE coding server-side this should be a helpful library.

Click here to view the full post.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
developer, dragging, elements, map, news, updated, virtual earth, webmapsve


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/developer-news-virtual-earth-dragging-map-elements-web-maps-ve-updated-6950.html

Posted By For Type Date
AJAX coding school » Blog Archive » AJAX News [2008-01-03 11:04:14] This thread Pingback 01-03-2008 06:16 AM
The Magazine for MapPoint - MP2K Magazine This thread Refback 01-03-2008 03:09 AM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Miami in Virtual Earth Makes News VE For Government Virtual Earth Blogs 0 11-21-2007 05:22 PM
Virtual Earth News from GEOINT 2007: Virtual Earth Appliance VE For Government Virtual Earth Blogs 0 10-24-2007 12:10 PM
Virtual Earth News from GEOINT: Microsoft Announces Joins OGC VE For Government Virtual Earth Blogs 0 10-23-2007 06:00 PM
Virtual Earth 3D News - New Cities, greater detail VE Team Virtual Earth Blogs 0 09-15-2007 04:25 PM
Virtual Earth News Eric Frost MapPoint Web Service and Virtual Earth 0 08-02-2005 03:52 PM


All times are GMT -5. The time now is 08:02 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map

Ski USA
USA ski resorts offer some of the best designed ski areas in the world. Choosing to ski in the USA will suit all types of skiers. Book great value ski holidays at Holiday Hypermarket.

Italy Holidays
Find and book Italy Holidays with Travel Counsellors. Holiday destinations around the world including Italy.

Holidays Thailand
Holidays in Thailand are hugely diverse with wonderful luxury resorts and beaches but also some lovely forested mountains with interesting hill tribes. See dealchecker.co.uk.

Cyprus Holidays
Cyprus holidays will offer you a wealth of activities all in the most beautiful surroundings. Relish the beauty of Cyprus on a short break.

Cheap Spain Holidays
Stay well informed when you are searching for cheap holidays online. For useful advice on when to book cheap Spain holidays make sure you look on ulookubook.com

Travel Tickets
Travel tickets need not always be expensive. Check out your best travel comparison site, Travel.co.uk

Holidays to Portugal
Want to take your family on a summer holiday? Visit On The Beach for more information on holidays to Portugal.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52