I’m setting up my layers using an instance of your RotationProjection class, to allow rotating our map (assuming your map ever supports also rotating the satellite image in sync). The setup is quite simple as seen below.
InMemoryFeatureLayer layer = new InMemoryFeatureLayer( );
layer.FeatureSource.Projection = rotateProjection;
While trying to use your sample code to provide functions that would allow our users to click on and select dynamic point objects added to
instances of InMemoryFeatureLayer, I added the following code based on your sample “GetFeatureClickedOnWithProjection”.
Collection<
Feature
> features = featureLayer.QueryTools.GetFeaturesWithinDistanceOf( new PointShape( e.WorldX, e.WorldY ), DesktopMap.MapUnit, DistanceUnit.Feet, distanceBuffer, ReturningColumnsType.NoColumns );
However, when this line executes, we get the following exception regarding your projection object’s InternalGeographyUnit.
System.InvalidOperationException was unhandled
_HResult=-2146233079
_message=Cannot get the projection’s InternalGeographyUnit, please provide it by overriding the Projection’s GetInternalGeographyUnitCore() method.
HResult=-2146233079
IsTransient=false
Message=Cannot get the projection’s InternalGeographyUnit, please provide it by overriding the Projection’s GetInternalGeographyUnitCore() method.
Source=MapSuiteCore
StackTrace:
at ThinkGeo.MapSuite.Core.FeatureSource.GetFeaturesWithinDistanceOf(BaseShape targetShape, GeographyUnit unitOfData, DistanceUnit distanceUnit, Double distance, IEnumerable`1 returningColumnNames)
at ThinkGeo.MapSuite.Core.FeatureSource.GetFeaturesWithinDistanceOf(BaseShape targetShape, GeographyUnit unitOfData, DistanceUnit distanceUnit, Double distance, ReturningColumnsType returningColumnNamesType)
at ThinkGeo.MapSuite.Core.QueryTools.GetFeaturesWithinDistanceOf(BaseShape targetShape, GeographyUnit unitOfData, DistanceUnit distanceUnit, Double distance, ReturningColumnsType returningColumnNamesType)
at Toro.Client.Shared.Map.LynxMap.DesktopMapOnMapClick(Object sender, MapClickWinformsMapEventArgs e) in d:\Toro\Map\Prototypes\LynxMapPrototype\LynxMap\LynxMap.cs:line 77
at System.EventHandler`1.Invoke(Object sender, TEventArgs 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.yBQ=(Object yRQ=, EventArgs yhQ=)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ShapesDisplay.Program.Main() in d:\Toro\Map\Prototypes\LynxMapPrototype\DriverForm\Program.cs:line 16
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
My requirement is simply to loop through a collection of simple layers (from top to bottom) that contain nothing but a number of points within the layers, looking to try to find the first layer (and associated feature) that is within the buffer range of the click point. It does not care about “columns to return” or anything of the like, I just need the point feature they tried to click, and it has to work with a rotation projection.
Can you please provide a sample of how can this be done?