svipxu / winforms-geplugin-control-library

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

Support for creation of Multi-Geometries via Helper #74

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
All of the current Helper methods for the creation of placemarks assume that 
all placemarks will be points and there does not appear to be any mechanism for 
the creation of multi-geometry placemarks. (Such as a point with line) 

Original issue reported on code.google.com by SableBl...@gmail.com on 17 Feb 2012 at 12:57

GoogleCodeExporter commented 8 years ago
The  KmlHelpers class has a few static methods for this. Sorry, the wiki page 
is not quite done for it.

KmlHelpers.CreateLineString allows you to create a 'linestring' placemark 
easily.

/// <summary>
/// Draws a line string between the given placemarks or points
/// </summary>
/// <param name="ge">The plugin instance</param>
/// <param name="start">The first placemark or point</param>
/// <param name="end">The second placemark or point</param>
/// <param name="id">Optional ID of the linestring placemark. Default is 
empty</param>
/// <param name="tessellate">Optionally sets tessellation for the linestring. 
Default is true</param>
/// <param name="addFeature">Optionally adds the linestring directly to the 
plugin. Default is true</param>
/// <param name="width">Optional linestring-width, default is 1</param>
/// <param name="color">Optional KmlColor, default is white/opaque</param>
/// <returns>A linestring placemark (or null)</returns>
public static dynamic CreateLineString(
    dynamic ge,
    dynamic start,
    dynamic end,
    string id = "",
    bool tessellate = true,
    bool addFeature = true,
    int width = 1,
    KmlColor color = new KmlColor()

To use it...

// draw some lines of different widths and colours 
dynamic linestring = KmlHelpers.CreateLineString(ge, pm1, pm3, width:4, color: 
Color.Ivory.ToKmlColor());
KmlHelpers.CreateLineString(ge, pm1, pm2, width: 3, color: 
Color.Red.ToKmlColor());
KmlHelpers.CreateLineString(ge, pm2, pm3, width: 2, color: 
Color.DeepSkyBlue.ToKmlColor());
KmlHelpers.CreateLineString(ge, pm3, pm4, width: 1, color: 
Color.LawnGreen.ToKmlColor());

There is also an overloaded version of the method, it accepts an 
IList<Coordinate> parameter rather than a dynamic start and end point. Apart 
from that it has the same optional parameters as the other version.

List<Coordinate> list = new List<Coordinate>()
    {
        new Coordinate(1,2),
        new Coordinate(3,4),
        new Coordinate(5,6),
        new Coordinate(6,7)
    };

KmlHelpers.CreateLineString(ge, list);

I plan to add more factory methods to the KmlHelpers class in due course, once 
it is done I will make sure it is documented.

Also, you can always create an object in the native api by directly calling the 
methods in it.

Thanks,

F

Original comment by fraser.c...@gmail.com on 17 Feb 2012 at 7:16

GoogleCodeExporter commented 8 years ago
Issue 73 has been merged into this issue.

Original comment by fraser.c...@gmail.com on 17 Feb 2012 at 9:40

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi,
Maybe you got this in the works... I don't know... but seeing as you are 
looking at multi geometry placemarks, the following could be included as well.
It's always nice to be able to draw circles :D and I'm currently going about 
this through the native api and it works just fine. Never the less, a nice 
addition to the kmlHelper class could be a KmlHelpers.CreateCircle(). 
Taking something like the following arguments:
KmlHelpers.CreateCircle(ge, Coordinate centroid or a pm, double radius, double 
stepsInDegrees*, KmlColor color, int opacity, etc...)

*I think It is recommended to use at least 25 points(ie ~14 deg) in order for 
the polygon placemark to look like a circle. 

hope this can be to some use :D

Regards,
TKM

Original comment by tho...@gmail.com on 27 Feb 2012 at 5:51

GoogleCodeExporter commented 8 years ago
Many thanks for the suggestions, I have recently updated the controls massively 
and have added helper methods for geometry creation such as you suggest. Thanks 
again!

Original comment by fraser.c...@gmail.com on 1 May 2012 at 3:42

GoogleCodeExporter commented 8 years ago

Original comment by fraser.c...@gmail.com on 4 Sep 2012 at 1:03

GoogleCodeExporter commented 8 years ago
Unable to cast COM object of type 'System.__ComObject' to interface type 
'GEPlugin.KmlLineStringCoClass'. This operation failed because the 
QueryInterface call on the COM component for the interface with IID 
'{DE556AEC-1266-2931-2441-0BFC47A92DD3}' failed due to the following error: No 
such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

This is one of the most difficult libraries to use. The dynamics were 
especially bad ideas.

Original comment by christia...@gmail.com on 19 Jan 2013 at 5:28

GoogleCodeExporter commented 8 years ago
@christian.shiel - 

Where and how are you getting that error? On what OS, with what version of IE?

If you are having problems, have found a bug, etc then please ask in the proper 
way rather than simply dismissing something as 'a bad idea'...

http://code.google.com/p/winforms-geplugin-control-library/issues/entry?template
=Defect%20report%20from%20user

The library uses the DLR to overcome the issues with the type library version 
differences for the Plugin. There is an older version of the library that uses 
an early binding model, but that has severe limitations to it - such as only 
working against the specific version of the plugin it is built to reference. 

If you aren't distributing your application then maybe you could look at early 
binding to the type library instead...

Using dynamics isn't a bad idea, as with the DLR you can use the Google Earth 
Plugin *exactly* as you would in the JavaScript api - so anything you can do 
with the api you can do with this library. Further more, because of this - the 
documentation for the Google Earth Plugin is totally applicable to this library 
as well...

See this basic example:
http://code.google.com/p/winforms-geplugin-control-library/wiki/ExampleForm

Original comment by fraser.c...@gmail.com on 20 Jan 2013 at 2:26

GoogleCodeExporter commented 8 years ago
Hi Fraser,
Has the this and "issue" 73 been implemented ?

/TKM

Original comment by tho...@gmail.com on 16 May 2013 at 2:04

GoogleCodeExporter commented 8 years ago
Not as yet, as I said I plan to add more factory methods to the KmlHelpers 
class as soon as I get a chance...

Just to note I have not had a dev machine for a while hence the lack of 
activity - that is resolved now and I plan to work on this and a few other 
things in the library asap.

Thanks

Original comment by fraser.c...@gmail.com on 16 May 2013 at 9:42

GoogleCodeExporter commented 8 years ago

Original comment by fraser.c...@gmail.com on 17 May 2013 at 10:54

GoogleCodeExporter commented 8 years ago
No further development now that the Earth API is depreciated. 

Original comment by fraser.c...@gmail.com on 17 Dec 2014 at 3:20