MapWindow 4 - Plugins : MapWindow Discussion Forum
It appears as though this overloaded function is ambiguous in Globals.cs: public static double PtDistance(ref MapWinGIS.Point pt0, ref MapWinGIS.Point pt1) public static double PtDistance(MapWinGIS.Point pt0, MapWinGIS.Point pt1) I don't see any way to c
Ambiguous overloads
Posted by: Phil ()
Date: May 18, 2010 12:46PM

It appears as though this overloaded function is ambiguous in Globals.cs:

public static double PtDistance(ref MapWinGIS.Point pt0, ref MapWinGIS.Point pt1)

public static double PtDistance(MapWinGIS.Point pt0, MapWinGIS.Point pt1)

I don't see any way to call either function in VB.NET. The compiler just won't allow it.

Any workaround?

Thanks.

-Phil

Re: Ambiguous overloads
Posted by: bmarch ()
Date: May 18, 2010 05:17PM

Hi Phil,

Thats a curious one, they should be exactly the same, I can't see why it would even let it compile with both in Global.cs.

In any case they are both identical methods internally. I'll take one out and send in the changes but it will take a while to get released. In the mean time you can just use the code directly, its only 4 lines.

Brian

Re: Ambiguous overloads
Posted by: Phil ()
Date: May 19, 2010 12:27PM

Maybe this is a difference between C# and VB.NET. Is there a way in a C# function call to specify passing a param by reference or by value as a way to aid the compiler in knowing which overload to select? In VB.NET it does not appear as though there's any way to do that.

I did write my own distance calculation, although for a different reason. It turns out that working with a very large number of MapWinGIS.Point objects can be horrendously slow. Pulling out the X and Y coords from all points, putting them into an array and working only with the array in my case was about 3 orders of magnitude faster (1000x) compared to working with the shapefile points themselves. Probably the .NET/COM overhead for shapefiles - or maybe shapefiles are just slow, relatively speaking.

Thanks.

-Phil

Re: Ambiguous overloads
Posted by: pmeems ()
Date: May 25, 2010 01:27AM

Phil,

The COM overhead is most likely the main reason why it is so slow.
You could use a custom struct/class to hold the coordinates and use that instead of MapWinGIS.Point.
That will speed things up.

Sergei is also working on something in the OCX to overcome this issue, because we see the same slowness when reprojecting points.
I don't know when he will finish that.

--
Paul

--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group

Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.

---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS

Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl

*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn

Sorry, only registered users may post in this forum.





Banner Exchange




GISCP.com




Send us your banner logo (160x120) for the space above, and add this MapWindow banner ad to your site:

Just paste this text in your page: