Click here to Skip to main content
Click here to Skip to main content

a little Virtual Earth Control

By , 2 Jun 2008
 

Screenshot - scr.png

Introduction

I simply want to realize a User Control to load VEarth Maps into a Windows Form.

The Main problem is that you can load these maps in HTML pages.

So.. i will load in a WebBrowser Control... but a new problem occurs... capture events from HTML pages.

Background

If you use these maps for commercial purposes; read the Microsoft license ($$$$).

To save maps and copy pictures, i use a class from SharpDevelop (Juergen Thomas, Berlin (Germany) - http://www.codeproject.com/csharp/FormPrintPackage.asp).

Using the code

Using this control is very easy.

Create a New Windows Forms Project, then include the DLL as component.

Insert the Control in the form and simply call the method:

 
vEarthControl1.ShowInitialMap();

There are various method to control the map and the visualisation, I think no explication is needed:

// To Show the initial map 
public void ShowInitialMap()


// and to close the map
public void unInit() 

This methods are to change the map type and to show (or hide) the dashboard, and change it's style.

 
public enum DashboardStyleEnum  {
       Small,
       Normal,
       Tiny
}
public void DashBoardShow()
public void DashBoardHide()
public void DashBoardSet(DashboardStyleEnum dStyle)
 
 
public enum MapStyleEnum  {
        Road ,
        Aerial ,
        Hybrid ,
    BirdsEye
}
public void SetMapStyle(MapStyleEnum mStyle)
 

To move in the map and zoom:
All Coordinates are in decimal format.

 
public void GoToCoordinates(double Latit, double Longit) 
public void SetZoomLevel(Int16 zLevel)
public void ZoomOut()
public void ZoomIn()
public void ZoomWorld()
public void ZoomBest()
 

To add and remove pushpin on the map:

 
public void AddPushpin(Int32 IDPush, Double lat, Double lon, String Descrizione)
public void AddPushpin(Int32 IDPush, Double lat, Double lon, String Descrizione, String iconAddress)
public void RemovePushpin(Int32 IDPush)
public void RemoveAllPushpins()
 

To save the map and print it:

 
public Bitmap GetMapImage()
public Boolean SaveMapAsBitmap(String FileName)
public Boolean SaveMapAsBitmap()
public void PrintMapDefaultSettings()
public void PrintMapPreview()
public void PrintOptions()
 

Advanced methods, do not use them if you don't know how you can send as parameter!!!
I declared public to allow everyone send different command directly to the map, based on SDK specification:

 
public void ExecuteCommandOnMap(String commandText)
public void ExecuteCommandOnMap(String commandText, String commandParameters)
public void ExecuteCommand(String commandText)
public void ExecuteCommand(String commandText, String commandParameters)
  

The two events; always handle them to avoid a noisy sound when the mouse is on the map:

 
public class OnMoveOnMapEventArgs : EventArgs
{
public Double Lat;
public Double Lon;
public DateTime ora;
}

private void OnClickOnMap(object sender, VEarth.OnClickOnMapEventArgs e)
private void OnMoveOnMap(object sender, VEarth.OnMoveOnMapEventArgs e)
 

Points of Interest

Virtual Earth SDK: http://msdn2.microsoft.com/en-us/library/bb429619.aspx

History

uh.. first version :p

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Andrea_86
Web Developer
Italy Italy
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 1memberSedArash16 Oct '11 - 4:24 
GeneralExecuteCommand and ExecuteCommandOnMapmemberjonnesvik26 Aug '10 - 1:06 
GeneralMy vote of 1memberKerkia4 Mar '09 - 14:43 
Questioncs_Andr.ControlsmemberKerkia4 Mar '09 - 14:41 
GeneralUse with compact frameworkmemberDalli15 Feb '09 - 7:05 
GeneralMouse movement on BirdsEye viewmembersteve gregory20 Jan '09 - 1:55 
GeneralNot much usememberRichardTrainer5 Aug '08 - 3:20 
NewsThey uploaded the source.memberAlpha Nerd2 Jun '08 - 9:55 
GeneralSource for the dllmemberMetalRob1 Jun '08 - 23:47 
GeneralRoutes and DirectionsmemberMegaSurfer19 May '08 - 11:01 
Generalneed helpmemberAmine barigo8 May '08 - 14:30 
GeneralWould appreciate source for DLLmembercwford0124 Apr '08 - 4:03 
QuestionHow to get the Place name??memberMember 38458158 Apr '08 - 18:58 
Generalany news on the source for the DLLmemberpcummings17 Feb '08 - 4:20 
QuestionAdding several pushpinsmembergunnarJonsson4 Dec '07 - 22:00 
QuestionRe: Adding several pushpinsmemberMember 361493031 Aug '08 - 18:19 
GeneralIconAddressmembergunnarJonsson29 Nov '07 - 3:25 
GeneralSourcesmemberthaos2K26 Nov '07 - 6:28 
GeneralRe: SourcesmemberAndrea_866 Nov '07 - 6:30 
GeneralRe: SourcesmemberJohn Witcher7 Dec '07 - 9:22 
QuestionSourceCodemembermichbex11 Nov '07 - 8:32 
QuestionSourcecode to VEarthControl.dll ?memberGMEKS14 Aug '07 - 8:22 
AnswerRe: Sourcecode to VEarthControl.dll ?memberPiascas14 Sep '07 - 1:24 
GeneralRe: Sourcecode to VEarthControl.dll ?membercnlsmuts17 Nov '07 - 10:10 
GeneralRe: Sourcecode to VEarthControl.dll ?memberJohn Witcher27 Nov '07 - 17:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 2 Jun 2008
Article Copyright 2007 by Andrea_86
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid