AxelGong / winforms-geplugin-control-library

Automatically exported from code.google.com/p/winforms-geplugin-control-library
GNU General Public License v3.0
0 stars 1 forks source link

Is there any method that accepts a coordinate and navigate to it? #104

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I searched around all the classes and methods and still not able to figure out 
how to implement a function like this:

I get the latitude and longitude from a GPS, and the GEPlugin navigate to that 
location and zoom in to a certain altitude.

Thank you.

Original issue reported on code.google.com by collectc...@gmail.com on 13 Apr 2013 at 4:34

GoogleCodeExporter commented 8 years ago
Sure, there are a couple of ways. Probably the easiest would be to use the 
KmlHelpers.CreateLookAt method.

        /// <summary>
        /// Look at the given coordinates
        /// </summary>
        /// <param name="ge">the plugin</param>
        /// <param name="latitude">latitude in decimal degrees</param>
        /// <param name="longitude">longitude in decimal degrees</param>
        /// <param name="id">Optional LookAt Id. Default is empty</param>
        /// <param name="altitude">Optional altitude. Default is 0</param>
        /// <param name="altitudeMode">Optional altitudeMode. Default is AltitudeMode.RelativeToGround</param>
        /// <param name="heading">Optional heading in degrees. Default is 0 (north)</param>
        /// <param name="tilt">Optional tilt in degrees. Default is 0</param>
        /// <param name="range">Optional range in metres. Default is 1000</param>
        /// <param name="setView">Optional set the current view to the lookAt. Default is true</param>
        /// <returns>a lookat object (or null)</returns>
        public static dynamic CreateLookAt

By 'zoom in to a certain altitude' I presume you mean the view range from the 
coordinate in meters.

The method uses a number of optional parameters to make this easy.

You can use it like so.

KmlHelpers.CreateLookAt(ge, latitude: 12.3523, longitude: 23.2313, range: 
300000);

Obviously if the coordinate has an altitude... 

KmlHelpers.CreateLookAt(ge, latitude: 12.3523, longitude: 23.2313, altitude: 
2345, range: 300000);

You can use the parameters in any combination, but if you skip any (such as the 
ID, etc) then you must use the parameter labels in the method call (as I have 
done in the examples here.)

Hope that helps.

Fraser

Original comment by fraser.c...@gmail.com on 13 Apr 2013 at 5:56

GoogleCodeExporter commented 8 years ago
Thank you very much.

Original comment by collectc...@gmail.com on 15 Apr 2013 at 1:15