Class S100MapControl
- Assembly
- EncDotNet.S100.Renderers.Mapsui.Avalonia.dll
A batteries-included Avalonia map control that attaches a reusable S-100 session to itself in one call and owns that session's lifetime.
public class S100MapControl : CaptureSynchronizedMapControl, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, INamed, IInputElement, IDataTemplateHost, ISetterValue, IMapControl, IDisposable, INotifyPropertyChanged
- Inheritance
-
AvaloniaObjectAnimatableStyledElementVisualLayoutableInteractiveInputElementControlTemplatedControlContentControlUserControlMapControlS100MapControl
- Implements
-
IDataContextProviderILogicalIThemeVariantHostIResourceHostIResourceNodeIStyleHostISetLogicalParentISetInheritanceParentINamedIInputElementIDataTemplateHostISetterValueIMapControl
- Inherited Members
-
MapControl.MapPropertyMapControl.InvalidateCanvas()MapControl.ClearTouchState()MapControl.OnPropertyChanged(AvaloniaPropertyChangedEventArgs)MapControl.GetPixelDensity()MapControl.Dispose()MapControl.SetMapRenderer(IMapRenderer)MapControl.ForceUpdate()MapControl.Unsubscribe()MapControl.Refresh(ChangeType)MapControl.RefreshGraphics()MapControl.RefreshData(ChangeType)MapControl.OnMapInfo(MapInfoEventArgs)MapControl.OnMapTapped(ScreenPosition, MPoint, GestureType)MapControl.OnMapPointerPressed(ScreenPosition, MPoint)MapControl.OnMapPointerMoved(ScreenPosition, MPoint, GestureType)MapControl.OnMapPointerReleased(ScreenPosition, MPoint)MapControl.UseContinuousMouseWheelZoomMapControl.ContinuousMouseWheelZoomStepSizeMapControl.MaxTapGestureMovementMapControl.UseFlingMapControl.MapMapControl.InfoMapControl.MapTappedMapControl.MapPointerPressedMapControl.MapPointerMovedMapControl.MapPointerReleasedMapControl.PropertyChangedUserControl.OnCreateAutomationPeer()ContentControl.ContentPropertyContentControl.ContentTemplatePropertyContentControl.HorizontalContentAlignmentPropertyContentControl.VerticalContentAlignmentPropertyContentControl.RegisterContentPresenter(ContentPresenter)ContentControl.ContentContentControl.ContentTemplateContentControl.PresenterContentControl.HorizontalContentAlignmentContentControl.VerticalContentAlignmentTemplatedControl.BackgroundPropertyTemplatedControl.BackgroundSizingPropertyTemplatedControl.BorderBrushPropertyTemplatedControl.BorderThicknessPropertyTemplatedControl.CornerRadiusPropertyTemplatedControl.FontFamilyPropertyTemplatedControl.FontFeaturesPropertyTemplatedControl.FontSizePropertyTemplatedControl.FontStylePropertyTemplatedControl.FontWeightPropertyTemplatedControl.FontStretchPropertyTemplatedControl.ForegroundPropertyTemplatedControl.LetterSpacingPropertyTemplatedControl.PaddingPropertyTemplatedControl.TemplatePropertyTemplatedControl.IsTemplateFocusTargetPropertyTemplatedControl.TemplateAppliedEventTemplatedControl.GetIsTemplateFocusTarget(Control)TemplatedControl.ApplyTemplate()TemplatedControl.GetTemplateFocusTarget()TemplatedControl.OnAttachedToLogicalTree(LogicalTreeAttachmentEventArgs)TemplatedControl.OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs)TemplatedControl.OnApplyTemplate(TemplateAppliedEventArgs)TemplatedControl.OnTemplateChanged(AvaloniaPropertyChangedEventArgs)TemplatedControl.BackgroundTemplatedControl.BackgroundSizingTemplatedControl.BorderBrushTemplatedControl.BorderThicknessTemplatedControl.CornerRadiusTemplatedControl.FontFamilyTemplatedControl.FontFeaturesTemplatedControl.FontSizeTemplatedControl.FontStyleTemplatedControl.FontWeightTemplatedControl.FontStretchTemplatedControl.ForegroundTemplatedControl.LetterSpacingTemplatedControl.PaddingTemplatedControl.TemplateTemplatedControl.TemplateAppliedControl.FocusAdornerPropertyControl.TagPropertyControl.ContextMenuPropertyControl.ContextFlyoutPropertyControl.RequestBringIntoViewEventControl.LoadedEventControl.UnloadedEventControl.SizeChangedEventControl.OnLoaded(RoutedEventArgs)Control.OnUnloaded(RoutedEventArgs)Control.OnSizeChanged(SizeChangedEventArgs)Control.OnAttachedToVisualTreeCore(VisualTreeAttachmentEventArgs)Control.OnDetachedFromVisualTreeCore(VisualTreeAttachmentEventArgs)Control.OnGotFocus(FocusChangedEventArgs)Control.OnLostFocus(FocusChangedEventArgs)Control.OnPointerReleased(PointerReleasedEventArgs)Control.OnKeyUp(KeyEventArgs)Control.FocusAdornerControl.DataTemplatesControl.ContextMenuControl.ContextFlyoutControl.IsLoadedControl.TagControl.LoadedControl.UnloadedControl.SizeChangedInputElement.FocusablePropertyInputElement.IsEnabledPropertyInputElement.IsEffectivelyEnabledPropertyInputElement.CursorPropertyInputElement.IsKeyboardFocusWithinPropertyInputElement.IsFocusedPropertyInputElement.IsHitTestVisiblePropertyInputElement.IsPointerOverPropertyInputElement.IsTabStopPropertyInputElement.GotFocusEventInputElement.GettingFocusEventInputElement.LostFocusEventInputElement.LosingFocusEventInputElement.KeyDownEventInputElement.KeyUpEventInputElement.TabIndexPropertyInputElement.TextInputEventInputElement.TextInputMethodClientRequestedEventInputElement.PointerEnteredEventInputElement.PointerExitedEventInputElement.PointerMovedEventInputElement.PointerPressedEventInputElement.PointerReleasedEventInputElement.PointerCaptureLostEventInputElement.PointerWheelChangedEventInputElement.ContextRequestedEventInputElement.ContextCanceledEventInputElement.IsHoldingEnabledPropertyInputElement.IsHoldWithMouseEnabledPropertyInputElement.PinchEventInputElement.PinchEndedEventInputElement.PullGestureEventInputElement.PullGestureEndedEventInputElement.SwipeGestureEventInputElement.SwipeGestureEndedEventInputElement.ScrollGestureEventInputElement.ScrollGestureInertiaStartingEventInputElement.ScrollGestureEndedEventInputElement.PointerTouchPadGestureMagnifyEventInputElement.PointerTouchPadGestureRotateEventInputElement.PointerTouchPadGestureSwipeEventInputElement.TappedEventInputElement.RightTappedEventInputElement.HoldingEventInputElement.DoubleTappedEventInputElement.Focus(NavigationMethod, KeyModifiers)InputElement.OnAccessKey(RoutedEventArgs)InputElement.OnGettingFocus(FocusChangingEventArgs)InputElement.OnLosingFocus(FocusChangingEventArgs)InputElement.OnKeyDown(KeyEventArgs)InputElement.OnTextInput(TextInputEventArgs)InputElement.OnPointerEntered(PointerEventArgs)InputElement.OnPointerExited(PointerEventArgs)InputElement.OnPointerMoved(PointerEventArgs)InputElement.OnPointerPressed(PointerPressedEventArgs)InputElement.GetNextTabStopOverride()InputElement.GetPreviousTabStopOverride()InputElement.GetFirstFocusableElementOverride()InputElement.GetLastFocusableElementOverride()InputElement.OnPointerCaptureLost(PointerCaptureLostEventArgs)InputElement.OnPointerWheelChanged(PointerWheelEventArgs)InputElement.OnTapped(TappedEventArgs)InputElement.OnRightTapped(TappedEventArgs)InputElement.OnDoubleTapped(TappedEventArgs)InputElement.OnHolding(HoldingRoutedEventArgs)InputElement.UpdateIsEffectivelyEnabled()InputElement.GetIsHoldingEnabled(StyledElement)InputElement.GetIsHoldWithMouseEnabled(StyledElement)InputElement.FocusableInputElement.IsEnabledInputElement.CursorInputElement.IsKeyboardFocusWithinInputElement.IsFocusedInputElement.IsHitTestVisibleInputElement.IsPointerOverInputElement.IsTabStopInputElement.IsEffectivelyEnabledInputElement.TabIndexInputElement.KeyBindingsInputElement.IsEnabledCoreInputElement.GestureRecognizersInputElement.GotFocusInputElement.GettingFocusInputElement.LostFocusInputElement.LosingFocusInputElement.KeyDownInputElement.KeyUpInputElement.TextInputInputElement.TextInputMethodClientRequestedInputElement.PointerEnteredInputElement.PointerExitedInputElement.PointerMovedInputElement.PointerPressedInputElement.PointerReleasedInputElement.PointerCaptureLostInputElement.PointerWheelChangedInputElement.ContextRequestedInputElement.ContextCanceledInputElement.PinchInputElement.PinchEndedInputElement.PullGestureInputElement.PullGestureEndedInputElement.ScrollGestureInputElement.ScrollGestureInertiaStartingInputElement.ScrollGestureEndedInputElement.PointerTouchPadGestureMagnifyInputElement.PointerTouchPadGestureRotateInputElement.SwipeGestureInputElement.SwipeGestureEndedInputElement.PointerTouchPadGestureSwipeInputElement.TappedInputElement.RightTappedInputElement.HoldingInputElement.DoubleTappedInteractive.RaiseEvent(RoutedEventArgs)Interactive.BuildEventRoute(RoutedEvent)Layoutable.DesiredSizePropertyLayoutable.WidthPropertyLayoutable.HeightPropertyLayoutable.MinWidthPropertyLayoutable.MaxWidthPropertyLayoutable.MinHeightPropertyLayoutable.MaxHeightPropertyLayoutable.MarginPropertyLayoutable.HorizontalAlignmentPropertyLayoutable.VerticalAlignmentPropertyLayoutable.UseLayoutRoundingPropertyLayoutable.UpdateLayout()Layoutable.Measure(Size)Layoutable.Arrange(Rect)Layoutable.InvalidateMeasure()Layoutable.InvalidateArrange()Layoutable.AffectsMeasure<T>(params AvaloniaProperty[])Layoutable.AffectsArrange<T>(params AvaloniaProperty[])Layoutable.MeasureCore(Size)Layoutable.MeasureOverride(Size)Layoutable.ArrangeCore(Rect)Layoutable.ArrangeOverride(Size)Layoutable.OnMeasureInvalidated()Layoutable.OnVisualParentChanged(Visual, Visual)Layoutable.WidthLayoutable.HeightLayoutable.MinWidthLayoutable.MaxWidthLayoutable.MinHeightLayoutable.MaxHeightLayoutable.MarginLayoutable.HorizontalAlignmentLayoutable.VerticalAlignmentLayoutable.DesiredSizeLayoutable.IsMeasureValidLayoutable.IsArrangeValidLayoutable.UseLayoutRoundingLayoutable.EffectiveViewportChangedLayoutable.LayoutUpdatedVisual.BoundsPropertyVisual.ClipToBoundsPropertyVisual.ClipPropertyVisual.IsVisiblePropertyVisual.OpacityPropertyVisual.OpacityMaskPropertyVisual.CacheModePropertyVisual.EffectPropertyVisual.HasMirrorTransformPropertyVisual.RenderTransformPropertyVisual.RenderTransformOriginPropertyVisual.FlowDirectionPropertyVisual.VisualParentPropertyVisual.ZIndexPropertyVisual.GetFlowDirection(Visual)Visual.SetFlowDirection(Visual, FlowDirection)Visual.InvalidateVisual()Visual.AffectsRender<T>(params AvaloniaProperty[])Visual.OnAttachedToVisualTree(VisualTreeAttachmentEventArgs)Visual.OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs)Visual.InvalidateMirrorTransform()Visual.BoundsVisual.ClipToBoundsVisual.ClipVisual.IsEffectivelyVisibleVisual.IsVisibleVisual.OpacityVisual.OpacityMaskVisual.CacheModeVisual.EffectVisual.HasMirrorTransformVisual.RenderTransformVisual.RenderTransformOriginVisual.FlowDirectionVisual.ZIndexVisual.VisualChildrenVisual.VisualRootVisual.BypassFlowDirectionPoliciesVisual.AttachedToVisualTreeVisual.DetachedFromVisualTreeStyledElement.DataContextPropertyStyledElement.NamePropertyStyledElement.ParentPropertyStyledElement.TemplatedParentPropertyStyledElement.ThemePropertyStyledElement.BeginInit()StyledElement.EndInit()StyledElement.ApplyStyling()StyledElement.InitializeIfNeeded()StyledElement.OnDataContextBeginUpdate()StyledElement.OnDataContextEndUpdate()StyledElement.OnInitialized()StyledElement.NameStyledElement.ClassesStyledElement.DataContextStyledElement.IsInitializedStyledElement.StylesStyledElement.StyleKeyStyledElement.ResourcesStyledElement.TemplatedParentStyledElement.ThemeStyledElement.LogicalChildrenStyledElement.PseudoClassesStyledElement.StyleKeyOverrideStyledElement.ParentStyledElement.ActualThemeVariantStyledElement.AttachedToLogicalTreeStyledElement.DetachedFromLogicalTreeStyledElement.DataContextChangedStyledElement.InitializedStyledElement.ResourcesChangedStyledElement.ActualThemeVariantChangedAnimatable.TransitionsPropertyAnimatable.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs)Animatable.TransitionsAvaloniaObject.CheckAccess()AvaloniaObject.VerifyAccess()AvaloniaObject.ClearValue(AvaloniaProperty)AvaloniaObject.ClearValue<T>(AvaloniaProperty<T>)AvaloniaObject.ClearValue<T>(StyledProperty<T>)AvaloniaObject.ClearValue<T>(DirectPropertyBase<T>)AvaloniaObject.GetHashCode()AvaloniaObject.GetValue(AvaloniaProperty)AvaloniaObject.GetValue<T>(StyledProperty<T>)AvaloniaObject.GetValue<T>(DirectPropertyBase<T>)AvaloniaObject.GetBaseValue<T>(StyledProperty<T>)AvaloniaObject.IsAnimating(AvaloniaProperty)AvaloniaObject.IsSet(AvaloniaProperty)AvaloniaObject.SetValue<T>(StyledProperty<T>, T, BindingPriority)AvaloniaObject.SetValue<T>(DirectPropertyBase<T>, T)AvaloniaObject.SetCurrentValue<T>(StyledProperty<T>, T)AvaloniaObject.Bind(AvaloniaProperty, BindingBase)AvaloniaObject.CoerceValue(AvaloniaProperty)AvaloniaObject.RaisePropertyChanged<T>(DirectPropertyBase<T>, T, T)AvaloniaObject.SetAndRaise<T>(DirectPropertyBase<T>, ref T, T)AvaloniaObject.InheritanceParentAvaloniaObject.this[AvaloniaProperty]AvaloniaObject.this[IndexerDescriptor]AvaloniaObject.Dispatcher
- Extension Methods
Remarks
This is the smallest-wiring entry point for an Avalonia host: drop the
control in XAML and call Configure(S100MapsuiOptions) once from the code-behind.
It creates an EPSG:3857 map if one is not already set, runs
AddS100(MapControl, S100MapsuiOptions?) to attach the session and the
AvaloniaMapsuiMapAdapter, exposes both through
Session and Adapter, and disposes them together
when the control is disposed — collapsing the map creation, the
AddS100 tuple, the adapter/session fields, the pick plumbing, and the
two-object disposal a host would otherwise write by hand.
It derives from CaptureSynchronizedMapControl, so
RenderCurrentViewToPngAsync(int, int, double, CancellationToken) captures are
race-safe against the live paint. A host that needs to inject shared
collaborators, keep its own paint diagnostics, or otherwise drive the wiring
itself can instead call mapControl.AddS100(...) on a plain control; this
control is the convenience path, not the only one.
The control owns the session and adapter, so a host disposes it (e.g. from the
window's Closed handler) to release them; disposal does not dispose any
collaborator the host supplied on the options. All members follow the base
control's threading contract — call them on Avalonia's UI thread.
Fields
WebMercatorCrs
The Web Mercator CRS the S-100 renderer and the pick / coordinate adapters require. Configure(S100MapsuiOptions) creates or normalizes the map to it and rejects any other CRS.
public const string WebMercatorCrs = "EPSG:3857"
Field Value
Properties
Adapter
The attached Avalonia adapter (redraw, coordinate conversion, capture, pointer picking).
public AvaloniaMapsuiMapAdapter Adapter { get; }
Property Value
Exceptions
- InvalidOperationException
Configure(S100MapsuiOptions) has not been called.
- ObjectDisposedException
The control is disposed.
IsConfigured
Whether the control currently has a usable attached session — that is, Configure(S100MapsuiOptions) has run and the control has not been disposed.
public bool IsConfigured { get; }
Property Value
Session
The attached S-100 session.
public IS100MapSession Session { get; }
Property Value
Exceptions
- InvalidOperationException
Configure(S100MapsuiOptions) has not been called.
- ObjectDisposedException
The control is disposed.
Methods
Configure(S100MapsuiOptions)
Attaches an S-100 session and adapter to this control. Creates an
EPSG:3857 Mapsui.Map when the control has no
map, then runs AddS100(MapControl, S100MapsuiOptions?).
public IS100MapSession Configure(S100MapsuiOptions options)
Parameters
optionsS100MapsuiOptionsRendering configuration. Supply a CrsTransformFactory (or a prebuilt DatasetRenderer); see AddS100(Map, S100MapsuiOptions?) for the full set.
Returns
- IS100MapSession
The attached session (also available through Session).
Exceptions
- ArgumentNullException
optionsis null.- InvalidOperationException
The control is already configured, the call is not on Avalonia's UI thread, the map could not be attached, or the control's map has a CRS other than
EPSG:3857.- ObjectDisposedException
The control is disposed.
Dispose(bool)
Disposes the attached adapter and session alongside the base control. Idempotent; safe when Configure(S100MapsuiOptions) was never called. Does not dispose collaborators the host supplied on the options (e.g. a shared processor owner).
protected override void Dispose(bool disposing)
Parameters
PickAsync(double, double, double, int?, CancellationToken)
Picks the S-100 features and coverage samples under a live-viewport pixel, delegating to PickAtScreenAsync(IS100MapQuery, double, double, double, int?, CancellationToken) against this control's Session query.
public Task<IReadOnlyList<S100Pick>> PickAsync(double xPx, double yPx, double radiusMeters = 50, int? maxResults = null, CancellationToken cancellationToken = default)
Parameters
xPxdoubleHorizontal live-control pixel coordinate.
yPxdoubleVertical live-control pixel coordinate.
radiusMetersdoublePoint/curve tolerance in metres.
maxResultsint?Optional cap on the returned picks (topmost-first).
cancellationTokenCancellationTokenOptional cancellation token.
Returns
- Task<IReadOnlyList<S100Pick>>
The ranked picks, topmost-first.
Exceptions
- InvalidOperationException
Configure(S100MapsuiOptions) has not been called.
- ObjectDisposedException
The control is disposed.
- OperationCanceledException
cancellationTokenis canceled.
RequestRedraw()
Schedules a live redraw of the map on Avalonia's UI thread.
public void RequestRedraw()
Exceptions
- InvalidOperationException
Configure(S100MapsuiOptions) has not been called.
- ObjectDisposedException
The control is disposed.