Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GetCenterLatLong()
- {
- //Check if in Birdseye or Oblique Map Style
- if (map.GetMapStyle() == VEMapStyle.Birdseye || map.GetMapStyle() == VEMapStyle.BirdseyeHybrid)
- {
- //IN Birdseye or Oblique Map Style
- //Get the BirdseyeScene being displayed
- var birdseyeScene = map.GetBirdseyeScene();
- //Get approximate center coordinate of the map
- var x = birdseyeScene.GetWidth() / 2;
- var y = birdseyeScene.GetHeight() / 2;
- // Get the Lat/Long
- var center = birdseyeScene.PixelToLatLong(new VEPixel(x,y), map.GetZoomLevel());
- // Convert the BirdseyeScene LatLong to a normal LatLong we can use
- return (new _xy1).Decode(center);
- }
- else
- {
- // NOT in Birdseye or Oblique Map Style
- return map.GetCenter();
- }
- }
- function getBirdseyeViewLatLong(vePixel)
- {
- var be = map.GetBirdseyeScene();
- var centrePixel = be.LatLongToPixel(map.GetCenter(), map.GetZoomLevel());
- var currentPixelWidth = be.GetWidth();
- var currentPixelHeight = be.GetHeight();
- var mapDiv = document.getElementById("map");
- var mapDivPixelWidth = mapDiv.offsetWidth;
- var mapDivPixelHeight = mapDiv.offsetHeight;
- var xScreenPixel = centrePixel.x - (mapDivPixelWidth / 2) + vePixel.x;
- var yScreenPixel = centrePixel.y - (mapDivPixelHeight / 2) + vePixel.y;
- var position = be.PixelToLatLong(new VEPixel(xScreenPixel, yScreenPixel), map.GetZoomLevel())
- return (new _xy1).Decode(position);
- }
- var northWestLL = (new _xy1).Decode(map.GetMapView().TopLeftLatLong);
- var southEastLL = (new _xy1).Decode(map.GetMapView().BottomRightLatLong);
- function GetInfo()
- {
- alert('The latitude,longitude at the center of the map is: '+map.GetCenter());
- }
Add Comment
Please, Sign In to add comment