Thread: Location Senser
View Single Post

  #4 (permalink)  
Old 08-06-2004
Anonymous Anonymous is offline
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");
		}
Reply With Quote