My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
GEWebBrowser  
GEWebBrowser control notes
Featured
Updated Mar 14, 2012 by fraser.c...@gmail.com

Introduction

The main control that holds the Google Earth Plugin. All other controls in the library interact with the plugin object hosted in this control.

Key features

  • Load the plugin from a hosted page or from an embeded file in the library
  • Get the current plugin view as a Bitmap
  • Load Kml or Kmz files into the plugin
  • Inject and invoke Javascript at runtime
  • Add and remove API event listeners

Details

The GEWebBrowser inherits from the standard System.Windows.Forms.WebBrowser control class and has the same base members, methods, properties and events.

The GEWebBrowser control cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code

Public Events

PluginReady

/// <summary>
/// Raised when the plugin is ready
/// </summary>
public event EventHandler<GEEventArgs> PluginReady;

KmlEvent

/// <summary>
/// Raised when there is a kmlEvent
/// </summary>
public event EventHandler<GEEventArgs> KmlEvent;

KmlLoaded

/// <summary>
/// Raised when a kml/kmz file has loaded
/// </summary>
public event EventHandler<GEEventArgs> KmlLoaded;

ScriptError

/// <summary>
/// Raised when there is a script error in the document 
/// </summary>
public event EventHandler<GEEventArgs> ScriptError;

PluginEvent

/// <summary>
/// Rasied when there is a GEPlugin event
/// </summary>
public event EventHandler<GEEventArgs> PluginEvent;

ViewEvent

/// <summary>
/// Rasied when there is a viewchangebegin, viewchange or viewchangeend event 
/// </summary>
public event EventHandler<GEEventArgs> ViewEvent;

Public Properties

Plugin

/// <summary>
/// Gets the plugin instance associated with the control
/// </summary>
public dynamic Plugin

ImageyBase

/// <summary>
/// Gets or sets the current imagery base for the plug-in
/// </summary>
public ImageryBase ImageyBase

PluginIsReady

/// <summary>
/// Gets a value indicating whether the plug-in is ready
/// </summary>
public bool PluginIsReady

RedirectLinksToSystemBrowser

/// <summary>
/// Gets or sets a value indicating whether to redirect html links to the system browser
/// Default is true, setting this false opens links inside the GEWebBrowser control.
/// </summary>
public bool RedirectLinksToSystemBrowser

Public Methods

AddEventListener

/// <summary>
/// Wrapper for the the google.earth.addEventListener method
/// </summary>
/// <param name="feature">The target feature</param>
/// <param name="action">The event Id</param>
/// <param name="javascript">The name of javascript callback function to use, or an anonymous function</param>
/// <param name="useCapture">Optionally use event capture</param>
/// <example>GEWebBrowser.AddEventListener(object, "click", "someFunction");</example>
/// <example>GEWebBrowser.AddEventListener(object, "click", "function(event){alert(event.getType);}");</example>
public void AddEventListener(dynamic feature, EventId action, string javascript = null, bool useCapture = false)

CreateInstance

/// <summary>
/// Wrapper for the google.earth.createInstance method
/// See: http://code.google.com/apis/earth/documentation/reference/google_earth_namespace.html#70288485024d8129dd1c290fb2e5553b
/// </summary>
/// <param name="database">The database name</param>
/// <example>GEWebBrowser.CreateInstance(ImageryBase.Moon);</example>
public void CreateInstance(ImageryBase database)

ExecuteBatch

/// <summary>
/// Wrapper for the google.earth.executeBatch method
/// See: http://code.google.com/apis/earth/documentation/reference/google_earth_namespace.html#b26414915202d39cad12bcd5bd99e739
/// Efficiently executes an arbitrary, user-defined function (the batch function),minimizing
/// the amount of overhead incurred during cross-process communication between the browser
/// and Google Earth Plugin. 
/// </summary>
public void ExecuteBatch()

FetchKml

/// <summary>
/// Load a remote kml/kmz file 
/// This function requires a 'twin' LoadKml function in javascript
/// this twin function will call "google.earth.fetchKml"
/// </summary>
/// <param name="url">string path to a kml reasource</param>
/// <example>GEWebBrowser.FetchKml("http://www.site.com/file.kml");</example>
public void FetchKml(string url)

FetchKml

/// <summary>
/// Load a remote kml/kmz file 
/// This function requires a 'twin' LoadKml function in javascript
/// this twin function will call "google.earth.fetchKml"
/// </summary>
/// <param name="url">Uri to a kml reasource</param>
/// <example>GEWebBrowser.FetchKml("http://www.site.com/file.kml");</example>
public void FetchKml(Uri url)

FetchKml

/// <summary>
/// Load a remote kml/kmz file 
/// This function requires a 'twin' LoadKml function in javascript
/// this twin function will call "google.earth.fetchKml"
/// </summary>
/// <param name="url">path to a kml/kmz file</param>
/// <param name="completionCallback">name of javascript callback function to call after fetching completes</param>
/// <example>GEWebBrowser.FetchKml("http://www.site.com/file.kml", "createCallback_(OnKmlLoaded)");</example>
public void FetchKml(string url, string completionCallback)

FetchKmlSynchronous

/// <summary>
/// Same as FetchKml but returns the IKmlObject
/// </summary>
/// <param name="url">path to a kml/kmz file</param>
/// <param name="timeout">time to wait for return in ms</param>
/// <returns>The kml as a kmlObject</returns>
/// <example>GEWebBrowser.FetchKmlSynchronous("http://www.site.com/file.kml");</example>
public object FetchKmlSynchronous(string url, int timeout = 1000)

FetchKmlLocal

/// <summary>
/// Loads a local kml file 
/// </summary>
/// <param name="path">path to a local kml file</param>
/// <example>GWEebBrower.FetchKml("C:\file.kml");</example>
public void FetchKmlLocal(string path)

ParseKml

/// <summary>
/// GEPlugin.parseKml() wrapper
/// Parses a kml string and loads it into the plugin
/// </summary>
/// <param name="kml">kml string to process</param>
public void ParseKml(string kml)

ParseKmlObject

/// <summary>
/// Parses a KmlObject  and loads it into the plugin.
/// </summary>
/// <param name="kml">kml object to process</param>
public void ParseKmlObject(dynamic kml)

InvokeDoGeocode

/// <summary>
/// Invokes the javascript function 'doGeocode'
/// Automatically flys to the location if one is found
/// </summary>
/// <param name="input">the location to geocode</param>
/// <returns>the point object (if any)</returns>
/// <example>GEWebBrowser.InvokeDoGeocode("London");</example>
public object InvokeDoGeocode(string input)

InjectJavascript

/// <summary>
/// Inject a javascript element into the document head
/// </summary>
/// <param name="javascript">the script code</param>
/// <example>GEWebBrowser.InjectJavascript("var say=function(msg){alert(msg);}");</example>
public void InjectJavascript(string javascript)

InvokeJavascript

/// <summary>
/// Executes a script function defined in the currently loaded document. 
/// </summary>
/// <param name="function">The name of the function to invoke</param>
/// <returns>The result of the evaluated function</returns>
/// <example>GEWebBrowser.InvokeJavascript("say");</example>
public object InvokeJavascript(string function)

InvokeJavascript

/// <summary>
/// Executes a script function that is defined in the currently loaded document. 
/// </summary>
/// <param name="function">The name of the function to invoke</param>
/// <param name="args">any arguments</param>
/// <returns>The result of the evaluated function</returns>
/// <example>GEWebBrowser.InvokeJavascript("say", new object[] { "hello" });</example>
public object InvokeJavascript(string function, object[] args)

InvokeJavascript

/// <summary>
/// Kills all running geplugin processes on the system
/// </summary>
public void KillAllPluginProcesses()

LoadEmbededPlugin

/// <summary>
/// Load the embeded html document into the browser 
/// </summary>
public void LoadEmbededPlugin()

RemoveEventListener

/// <summary>
/// Wrapper for the the google.earth.removeEventListener method
/// </summary>
/// <param name="feature">The target feature</param>
/// <param name="action">The event Id</param>
/// <param name="useCapture">Optional, use event capture</param>
public void RemoveEventListener(object feature, EventId action, bool useCapture = false)

ScreenGrab

/// <summary>
/// Take a 'screen grab' of the current GEWebBrowser view
/// </summary>
/// <returns>bitmap image</returns>
public Bitmap ScreenGrab()

SetLanguage

/// <summary>
/// Set the plugin langauge
/// </summary>
/// <param name="code">The language code to use</param>
public void SetLanguage(string code)

Refresh

/// <summary>
/// Reloads the document currently displayed in the control
/// Overides the default WebBrowser Refresh method
/// </summary>
public override void Refresh()

Source

GEWebBrowser.cs

Comment by cuneyta...@gmail.com, Oct 2, 2011

perfect

Comment by dev.ama...@gmail.com, Dec 27, 2011

how can i download the control

Comment by timcurti...@gmail.com, Jan 1, 2012

I am writing somewhat of a GE style app. It will be in Visual Basic 2010 (VS2010 Premium iDE) and incorporates a Webbrowser control. I can easily show the basic Google Earth 3D in the webrowser control of my VB2010 app but now need to embed (somehow) grid lines (KML Linestrings) into my HTML file which is loaded LOCALLY from the user's computer and not via the web. Internet access is required for my app however. Please contact me at timcurtin1966@gmail.com. I am legally blind and I have GREAT difficulty reading forums. Please help . Thanks. Tim

Comment by project member fraser.c...@gmail.com, Feb 6, 2012

@dev.amanyh - sometimes there are test applications here: http://code.google.com/p/winforms-geplugin-control-library/downloads/list

But I occasionally remove these when they need updating.

You can always just check out the project as a public user here - it is just a Subversion repository: http://code.google.com/p/winforms-geplugin-control-library/source/checkout

Also, if you just wanted the library you could just grab the latest dll http://winforms-geplugin-control-library.googlecode.com/svn/trunk/bin/Release/FC.GEPluginCtrls.dll

@timcurtin1966 Hi, sorry for not replying - I will email you asap.

Comment by khatra...@gmail.com, Aug 2, 2013

Hi. I got the error of plugin_ax.dll when compiling the app in win7 64bit (x86) and running in winxp 32bit. Any idea?

Comment by tcra...@janteq.com, Feb 17, 2014

Is there a way to capture the click event in the gewebbrowser when not clicking on the globe? My code only captures kmlevents as clicks when clicking on the globe. Thank you.

Comment by fra...@cfcca.org.uk, Feb 21, 2014

@tcra...@janteq.com

To listen to events from the whole window attach to GEWindow rather than GEGlobe.


Sign in to add a comment
Powered by Google Project Hosting