MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




Location Senser

This is a discussion on Location Senser within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; HI How to code Location sensor using with Mappoint in c#? please help...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-04-2004
Junior Member
Yellow Belt
 
Join Date: Jul 2004
Posts: 14
Location Senser

HI
How to code Location sensor using with Mappoint in c#?
please help
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 08-04-2004
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,322
Blog Entries: 1
This is VB.NET, but perhaps it will give you some ideas?

http://www.mp2kmag.com/a66--location....mappoint.html

Eric
__________________
~ Now taking orders for MapPoint 2009 ~
~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 08-06-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
This is a C++ attempt using two labels. It works fine when first loaded but after loading another map programatically, the labels are no longer updated and reaction time slows, eg when using the mouse to select an area, the drawing of the selection box is noticably slowed. I tried disabling the mousemove event while the different map was being loaded, but it didn't help.

[code]
private: System::Void axMappointControl1_MouseMoveEvent(System::Object * sender, AxInterop::MapPoint::_IMappointCtrlEvents_MouseMov eEvent * e)
{
MapPoint::Location * loc=pMap->XYToLocation(e->x,e->y);
//following instruction causes problems after a map is loaded programatically;
double lat=90-180*pMap->Distance(locNorthPole,loc)/halfEarth;
double d=pMap->Distance(pMap->GetLocation(lat,0,1),loc);
double rlat=(lat/180)*Math::PI;
double lon=180*Math::Acos((Math::Cos((d*2*Math::PI)/(2*halfEarth))-Math::Sin(rlat)*Math::Sin(rlat))/(Math::Cos(rlat)*Math::Cos(rlat)))/Math::PI;
if(pMap->Distance(locSantaCruz,loc)<(halfEarth/2)) lon=-lon;
labelLatitude->Text=lat.ToString(S"F4");
labelLongitude->Text=lon.ToString(S"F4");
}
[\code]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 08-06-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Sorry about that.

Code:
	private: System::Void axMappointControl1_MouseMoveEvent(System::Object *  sender, AxInterop::MapPoint::_IMappointCtrlEvents_MouseMoveEvent *  e)
		{
		MapPoint::Location * loc=pMap->XYToLocation(e->x,e->y);
		//following instruction causes problems after a map is loaded programatically;
		double lat=90-180*pMap->Distance(locNorthPole,loc)/halfEarth;
		double d=pMap->Distance(pMap->GetLocation(lat,0,1),loc);
		double rlat=(lat/180)*Math::PI;
		double lon=180*Math::Acos((Math::Cos((d*2*Math::PI)/(2*halfEarth))-Math::Sin(rlat)*Math::Sin(rlat))/(Math::Cos(rlat)*Math::Cos(rlat)))/Math::PI;
		if(pMap->Distance(locSantaCruz,loc)<(halfEarth/2)) lon=-lon;
		labelLatitude->Text=lat.ToString(S"F4");
		labelLongitude->Text=lon.ToString(S"F4");
		}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 08-06-2004
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Found part of my problem.

When I loaded another map, I had to recalculate NorthPole and SantaCruz locations. This also fixed my problem where I could not calculate the lat/long of a pushpin once another map was loaded.

Now I get lat/long printed out, except that after a while there are long periods of a second or more where the labels are not updated.
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


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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 12:54 AM.


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

Flight only
With Holiday Hypermarket the choices are endless. Only want to book a cheap flight? No problem, flight only is fine. Check it out!

Best Travel Agent
Book your Travel with the UK's best Travel Agent - as named at the Guardian Unlimited Travel awards.

Cheap Flight
Find cheap flights online at dealchecker.co.uk. We search the latest offers from the UK's leading Travel Agents, Tour Operators and Airlines.

Holidays to Sri Lanka
Holidays to Sri Lanka are enriched by the glittering tapestry of culture and breath taking mountain views. Book a holiday there today!

Cheap Turkey Holidays
The best time of year to sneak in cheap Turkey holidays is during the off-peak season. Check out the great deals available during April, May or October. For other tips on how to bag a great value holiday simply check online at ulookubook.com

Cheap family holidays
To plan cheap family holidays, use Travel.co.uk to explore all the delightful possibilities that there are.

Cheap Holidays to Lanzarote
Visit the Canary Islands, even if you're cash strapped! View cheap holidays to Lanzarote at On The Beach!


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