When attempting to edit a Field boundary layer our application is generating a NetTopologySuite IComparer exception executing EditOverLay.CalculateAllControlPoints method. Any idea what may be causing this error based on the below Process Description, Code Snippet, and Exception error information.
Application build target framework is .NET 4.5.2.
MapSuite Desktop Edition 8.0.0.351
Thanks
Process
Process starts with clicking within a boundary layer displayed on the map
A) Determine screen point based on clicked map position
B) Load all field boundary layers into InMemoryFeatureLayer (can be multiple field layers)
C) Determine if screen point is within one of the feature layers
D) If point resides in feature layer, load feature into EditShapesLayer and calculate all points
Code Snipet
Dim lol As LayerOverlay = Nothing
Dim lay As InMemoryFeatureLayer = Nothing
Static bBusy As Boolean = False
Dim screenPoint As PointShape = Nothing
Dim polyShape As BaseShape = Nothing
Dim feat As Feature = Nothing
Dim clickArea As MultipolygonShape = Nothing
Dim bFound As Boolean = False
Dim i As Int16 = 0
Try
If Not skipCheck Then
If gMap.TrackOverlay.TrackShapeLayer.IsVisible Or gMap.EditOverlay.EditShapesLayer.IsVisible Then
Exit Sub
End If
End If
If bBusy Then
Exit Sub
End If
bBusy = True
’A) *** Determine screen point based on map position
lol = gMap.Overlays.Item(K_MAPPING_OVERLAY_ELE)
screenPoint = New PointShape(e.WorldX, e.WorldY)
Select Case sTrackMode
Case K_FIELD() + K_EDIT(), K_CROPZONE() + K_EDIT()
tsCmdOk.Enabled = False
’B) *** Load all field layers into InMemoryFeatureLayer
If sTrackMode = K_FIELD() + K_EDIT() Then
lay = lol.Layers.Item(K_FIELDS_ELE_LC)
Else
lay = lol.Layers.Item(K_CROPZONES_ELE_LC)
End If
’C) *** For each feature layer check for clicked point within boundary
For Each feat In lay.InternalFeatures
If TypeName(feat.GetShape()) = “PolygonShape” Or TypeName(feat.GetShape()) = “MultipolygonShape” Then
polyShape = feat.GetShape()
If Not IsNothing(polyShape) Then
If polyShape.Contains(screenPoint) Then
’D) *** Point found within boundary. Load into EditShapesLayer and calculate all points
gMap.EditOverlay.EditShapesLayer.InternalFeatures.Add(“EDITING”, feat)
gMap.EditOverlay.CalculateAllControlPoints()
gMap.EditOverlay.CanAddVertex = True
gMap.EditOverlay.CanRemoveVertex = True
sTrackMode = sTrackMode + K_END_UC()
workFeat = feat
gMap.EditOverlay.EditShapesLayer.IsVisible = True
tsCmdOk.Enabled = True
Exit For
End If
End If
End If
Next
Exception Error
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.ArgumentException: Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: ‘GisSharpBlog.NetTopologySuite.Index.Strtree.STRtree+AnonymousXComparerImpl’.
at System.Array.SorterObjectArray.DepthLimitedQuickSort(Int32 left, Int32 right, Int32 depthLimit)
at System.Array.Sort(Array keys, Array items, Int32 index, Int32 length, IComparer comparer)
at System.Collections.ArrayList.Sort(Int32 index, Int32 count, IComparer comparer)
at System.Collections.ArrayList.Sort(IComparer comparer)
at GisSharpBlog.NetTopologySuite.Index.Strtree.STRtree.CreateParentBoundables(IList childBoundables, Int32 newLevel)
at GisSharpBlog.NetTopologySuite.Index.Strtree.AbstractSTRtree.CreateHigherLevels(IList boundablesOfALevel, Int32 level)
at GisSharpBlog.NetTopologySuite.Index.Strtree.AbstractSTRtree.CreateHigherLevels(IList boundablesOfALevel, Int32 level)
at GisSharpBlog.NetTopologySuite.Index.Strtree.AbstractSTRtree.Build()
at ThinkGeo.MapSuite.Core.InMemoryFeatureSource.BuildIndex()
at ThinkGeo.MapSuite.Core.InMemoryFeatureLayer.BuildIndex()
at ThinkGeo.MapSuite.DesktopEdition.EditInteractiveOverlay.CalculateVertexControlPoints()
at ThinkGeo.MapSuite.DesktopEdition.EditInteractiveOverlay.CalculateAllControlPoints()
at AGRIS.Agy.AgyMapping.ucMapping.gMap_MapClick(Object sender, MapClickWinformsMapEventArgs e)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.OnMapClick(MapClickWinformsMapEventArgs e)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.5xM=(InteractionArguments iBc=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.0hM=(Object dhc=, 0xU= dxc=)
at ThinkGeo.MapSuite.DesktopEdition.MouseEventAnalyzer.OnMouseEvent(0xU= e)
at ThinkGeo.MapSuite.DesktopEdition.MouseEventAnalyzer.txQ=(Double uBQ=, Double uRQ=, Double uhQ=, Double uxQ=)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.fBc=(Object fRc=, MouseEventArgs fhc=)
at System.Windows.Forms.MouseEventHandler.Invoke(Object sender, MouseEventArgs e)
at System.Windows.Forms.Control.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
AGRIS.Agy.AgyMenuGUI
Assembly Version: 1.0.6001.25000
Win32 Version: 1.0
CodeBase: file:///C:/APPS/AGRIS/Bin/AGRIS.Agy.AgyMenuGUI.DLL
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34239 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 10.0.0.0
Win32 Version: 12.0.20806.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
AGRIS.Agy.AgyGlobal
Assembly Version: 1.0.6000.25001
Win32 Version: 1.0
CodeBase: file:///C:/APPS/AGRIS/Bin/AGRIS.Agy.AgyGlobal.DLL
----------------------------------------
AGRIS.Agy.AgyUtilityObjects
Assembly Version: 1.0.6000.25001
Win32 Version: 1.0
CodeBase: file:///C:/APPS/AGRIS/Bin/AGRIS.Agy.AgyUtilityObjects.DLL
----------------------------------------
AGRIS.Agy.AgyUtilityScreens
Assembly Version: 1.0.6000.25001
Win32 Version: 1.0
CodeBase: file:///C:/APPS/AGRIS/Bin/AGRIS.Agy.AgyUtilityScreens.DLL
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34230 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
AGRIS.Agy.AgyUserControls
Assembly Version: 1.0.6000.25001
Win32 Version: 1.0
CodeBase: file:///C:/APPS/AGRIS/Bin/AGRIS.Agy.AgyUserControls.DLL
----------------------------------------
AGRIS.Agy.AgyMapping
Assembly Version: 1.0.6000.25001
Win32 Version: 1.0
CodeBase: file:///C:/APPS/AGRIS/Bin/AGRIS.Agy.AgyMapping.DLL
----------------------------------------
Microsoft.VisualBasic.PowerPacks.Vs
Assembly Version: 10.0.0.0
Win32 Version: 11.0.50727.1
CodeBase: file:///C:/APPS/AGRIS/Bin/Microsoft.VisualBasic.PowerPacks.Vs.DLL
----------------------------------------
MapSuiteCore
Assembly Version: 8.0.0.0
Win32 Version: 8.0.0.351
CodeBase: file:///C:/APPS/AGRIS/Bin/MapSuiteCore.DLL
----------------------------------------
DesktopEdition
Assembly Version: 8.0.0.0
Win32 Version: 8.0.0.351
CodeBase: file:///C:/APPS/AGRIS/Bin/DesktopEdition.DLL
----------------------------------------
NetTopologySuite
Assembly Version: 1.7.3.31740
Win32 Version: 1.7.3.31740
CodeBase: file:///C:/APPS/AGRIS/Bin/NetTopologySuite.DLL
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.34209 built by: FX452RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
CustomMarshalers
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/CustomMarshalers/v4.0_4.0.0.0__b03f5f7f11d50a3a/CustomMarshalers.dll
----------------------------------------
GeoAPI
Assembly Version: 1.1.0.0
Win32 Version: 1.1.0.0
CodeBase: file:///C:/APPS/AGRIS/Bin/GeoAPI.DLL
----------------------------------------
Microsoft.mshtml
Assembly Version: 7.0.3300.0
Win32 Version: 7.0.3300.0
CodeBase: file:///C:/Windows/assembly/GAC/Microsoft.mshtml/7.0.3300.0__b03f5f7f11d50a3a/Microsoft.mshtml.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging=“true” />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
NetTopologySuite IComparer Exception - Unable to Sort
Hi Rudolph,
We noticed you opened ticket on the same issue in out ticket system, so we will reply it in the ticket. But I will update here if solved in case others meet the same issue.
Thanks,
Troy