GeoBlazor Pro


layout: pro title: SketchWidget parent: Pro Classes grand_parent: GeoBlazor Pro —

dymaptic.GeoBlazor.Pro

dymaptic.GeoBlazor.Pro.Components.Widgets

SketchWidget Class

Sketch widget provides a simple UI for creating and updating graphics on a MapView or a SceneView. This significantly minimizes the code required for working with graphics in the view. It is intended to be used with graphics stored in its layer property.
By default, the Sketch widget provides out-of-the-box tools for creating and updating graphics with point, polyline, polygon, rectangle and circle geometries.
ArcGIS Maps SDK for JavaScript

public class SketchWidget : dymaptic.GeoBlazor.Pro.Components.Widgets.ProWidget

Inheritance System.Object 🡒 Microsoft.AspNetCore.Components.ComponentBase 🡒 dymaptic.GeoBlazor.Core.Components.MapComponent 🡒 dymaptic.GeoBlazor.Core.Components.Widgets.Widget 🡒 ProWidget 🡒 SketchWidget

Properties

SketchWidget.AvailableCreateTools Property

Property controlling the visibility and order of create tool buttons.
Default Value:[“point”, “polyline”, “polygon”, “rectangle”, “circle”]

public System.Collections.Generic.IEnumerable<string>? AvailableCreateTools { get; set; }

Property Value

System.Collections.Generic.IEnumerable<System.String>

SketchWidget.CreationMode Property

Defines the default behavior once the create operation is completed. By default, the user will be able to continuously create graphics with same geometry types.

public System.Nullable<dymaptic.GeoBlazor.Pro.Components.Widgets.CreationMode> CreationMode { get; set; }

Property Value

System.Nullable<CreationMode>

SketchWidget.DefaultCreateOptions Property

Default create options set for the Sketch widget.

public dymaptic.GeoBlazor.Pro.Components.Widgets.SketchToolCreateOptions? DefaultCreateOptions { get; set; }

Property Value

SketchToolCreateOptions

SketchWidget.DefaultUpdateOptions Property

Default update options set for the Sketch widget. Update options set on this property will be overwritten if the update options are changed when update() method is called.

public dymaptic.GeoBlazor.Pro.Components.Widgets.SketchToolUpdateOptions? DefaultUpdateOptions { get; set; }

Property Value

SketchToolUpdateOptions

SketchWidget.EventRateLimitInMilliseconds Property

Controls how often the events are fired.

public System.Nullable<int> EventRateLimitInMilliseconds { get; set; }

Property Value

System.Nullable<System.Int32>

SketchWidget.GraphicsLayerId Property

Id reference to the editable graphics layer

public System.Guid GraphicsLayerId { get; set; }

Property Value

System.Guid

SketchWidget.Label Property

The Sketch widget’s default label.

public string? Label { get; set; }

Property Value

System.String

SketchWidget.LabelOptions Property

Options to configure the labels shown next to each segment of the geometry being created or updated.

public dymaptic.GeoBlazor.Pro.Components.Widgets.SketchLabelOptions? LabelOptions { get; set; }

Property Value

SketchLabelOptions

SketchWidget.Layout Property

Determines the layout/orientation of the Sketch widget.

public System.Nullable<dymaptic.GeoBlazor.Pro.Components.Widgets.SketchWidgetLayout> Layout { get; set; }

Property Value

System.Nullable<SketchWidgetLayout>

SketchWidget.OnSketchEvent Property

Event Callback for handling Sketch Events.

public Microsoft.AspNetCore.Components.EventCallback<dymaptic.GeoBlazor.Pro.Model.SketchEvent> OnSketchEvent { get; set; }

Property Value

Microsoft.AspNetCore.Components.EventCallback<SketchEvent>

SketchWidget.SketchWidgetObjectReference Property

DotNetObjectReference to this SketchWidget instance.

public Microsoft.JSInterop.DotNetObjectReference<dymaptic.GeoBlazor.Pro.Components.Widgets.SketchWidget> SketchWidgetObjectReference { get; }

Property Value

Microsoft.JSInterop.DotNetObjectReference<SketchWidget>

SketchWidget.SnappingOptions Property

The SnappingOptions for sketching. It supports self and feature snapping.

public dymaptic.GeoBlazor.Pro.Components.Widgets.SnappingOptions? SnappingOptions { get; set; }

Property Value

SnappingOptions

SketchWidget.State Property

The Sketch widget’s state.

public string? State { get; set; }

Property Value

System.String

SketchWidget.TooltipOptions Property

Options to configure the tooltip shown next to the cursor when creating or updating graphics.

public dymaptic.GeoBlazor.Pro.Components.Widgets.SketchTooltipOptions? TooltipOptions { get; set; }

Property Value

SketchTooltipOptions

SketchWidget.UpdateOnGraphicClick Property

public System.Nullable<bool> UpdateOnGraphicClick { get; set; }

Property Value

System.Nullable<System.Boolean>

SketchWidget.VisibleElements Property

The visible elements that are displayed within the widget. This property provides the ability to turn individual elements of the widget’s display on/off.

public dymaptic.GeoBlazor.Pro.Components.Widgets.SketchWidgetVisibleElements? VisibleElements { get; set; }

Property Value

SketchWidgetVisibleElements

Methods

SketchWidget.Cancel() Method

Cancels the active operation and fires the create or update event. If called in the middle of a create operation, cancel() discards the partially created graphic.

public System.Threading.Tasks.Task Cancel();

Returns

System.Threading.Tasks.Task

SketchWidget.Complete() Method

Completes the active operation and fires the create or update event and changes the event’s state to complete. If called in the middle of a create operation, complete() finishes the active create operation and keeps the valid geometry.

public System.Threading.Tasks.Task Complete();

Returns

System.Threading.Tasks.Task

SketchWidget.Create(SketchTool, SketchToolCreateOptions) Method

Create a graphic with the geometry specified in the tool parameter. When the first vertex of the graphic is added, the create event will start firing. The provided tool will become the activeTool.

public System.Threading.Tasks.Task Create(dymaptic.GeoBlazor.Pro.Components.Widgets.SketchTool tool, dymaptic.GeoBlazor.Pro.Components.Widgets.SketchToolCreateOptions options);

Parameters

tool SketchTool

Name of the create tool. Specifies the geometry for the graphic to be created.
Possible Values:”point”|”polyline”|”polygon”|”rectangle”|”circle”

options SketchToolCreateOptions

Options for the graphic to be created.

Returns

System.Threading.Tasks.Task

SketchWidget.Delete() Method

Deletes the selected graphics used in the update workflow. Calling this method will fire the delete event.

public System.Threading.Tasks.Task Delete();

Returns

System.Threading.Tasks.Task

SketchWidget.Duplicate() Method

Duplicates current graphics used in the update workflow and automatically adds them to the associated layer

public System.Threading.Tasks.Task Duplicate();

Returns

System.Threading.Tasks.Task

SketchWidget.GetActiveTool() Method

When creating new graphics (for example after create() has been called), this property reflects the create tool being used. When updating graphics (for example after update() has been called), this property reflects the update tool being used. If no create or update operation is in progress, this is null.

public System.Threading.Tasks.Task<System.Nullable<dymaptic.GeoBlazor.Pro.Components.Widgets.SketchTool>> GetActiveTool();

Returns

System.Threading.Tasks.Task<System.Nullable<SketchTool>>

SketchWidget.GetCreateGraphic() Method

Returns the graphic that is being created.

public System.Threading.Tasks.Task<dymaptic.GeoBlazor.Core.Components.Layers.Graphic?> GetCreateGraphic();

Returns

System.Threading.Tasks.Task<dymaptic.GeoBlazor.Core.Components.Layers.Graphic>

SketchWidget.GetUpdateGraphics() Method

An array of graphics that are being updated by the Sketch widget.

public System.Threading.Tasks.Task<dymaptic.GeoBlazor.Core.Components.Layers.Graphic[]?> GetUpdateGraphics();

Returns

System.Threading.Tasks.Task<dymaptic.GeoBlazor.Core.Components.Layers.Graphic[]>

SketchWidget.OnSketchUpdate(SketchEvent) Method

Internal JavaScript-invoked method on sketch update. Do not call directly.

public System.Threading.Tasks.Task OnSketchUpdate(dymaptic.GeoBlazor.Pro.Model.SketchEvent sketchEvent);

Parameters

sketchEvent SketchEvent

Returns

System.Threading.Tasks.Task

SketchWidget.Redo() Method

Incrementally redo actions recorded in the stack. Calling this method will fire the redo event. The undo/redo stack is for an individual sketch operation, meaning you can redo/undo actions while creating or updating a graphic.

public System.Threading.Tasks.Task Redo();

Returns

System.Threading.Tasks.Task

SketchWidget.Undo() Method

Incrementally undo actions recorded in the stack. Calling this method will fire the undo event. The undo/redo stack is for an individual sketch operation, meaning you can redo/undo actions while creating or updating a graphic.

public System.Threading.Tasks.Task Undo();

Returns

System.Threading.Tasks.Task

SketchWidget.Update(IEnumerable, SketchToolUpdateOptions) Method

Initializes an update operation for the specified graphic(s) and fires update event.

public System.Threading.Tasks.Task Update(System.Collections.Generic.IEnumerable<dymaptic.GeoBlazor.Core.Components.Layers.Graphic> graphics, dymaptic.GeoBlazor.Pro.Components.Widgets.SketchToolUpdateOptions options);

Parameters

graphics System.Collections.Generic.IEnumerable<dymaptic.GeoBlazor.Core.Components.Layers.Graphic>

A graphic or an array of graphics to be updated. Only graphics added to SketchViewModel’s layer property can be updated.

options SketchToolUpdateOptions

Update options for the graphics to be updated.

Returns

System.Threading.Tasks.Task