-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding measurement widget #196
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using dymaptic.GeoBlazor.Core.Components.Widgets; | ||
using dymaptic.GeoBlazor.Core.Serialization; | ||
using System.Text.Json.Serialization; | ||
|
||
|
||
namespace dymaptic.GeoBlazor.Core.Components; | ||
|
||
/// <summary> | ||
/// A collection of possible positions for setting a <see cref="Widget" /> or <see cref="CustomOverlay" /> | ||
/// </summary> | ||
[JsonConverter(typeof(EnumToKebabCaseStringConverter<ActiveTool>))] | ||
public enum ActiveTool | ||
{ | ||
#pragma warning disable CS1591 | ||
Area, | ||
Distance, | ||
DirectLine | ||
#pragma warning restore CS1591 | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using dymaptic.GeoBlazor.Core.Objects; | ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.JSInterop; | ||
using System.Text.Json.Serialization; | ||
|
||
|
||
namespace dymaptic.GeoBlazor.Core.Components.Widgets; | ||
|
||
/// <summary> | ||
/// The Image Measurement widget allows you to perform measurements on image services with mensuration capability. | ||
/// Mensuration is a method of applying geometric rules to find length of lines, area of surfaces, or volume using information obtained | ||
/// from lines and angles. It can also include measuring the height and absolute location of a feature. | ||
/// <a target="_blank" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Measurement.html"> | ||
/// ArcGIS | ||
/// JS API | ||
/// </a> | ||
/// </summary> | ||
public class MeasurementWidget : Widget | ||
{ | ||
/// <inheritdoc /> | ||
[JsonPropertyName("type")] | ||
public override string WidgetType => "measurement"; | ||
|
||
/// <summary> | ||
/// A .NET object reference for calling this class from JavaScript. | ||
/// </summary> | ||
public DotNetObjectReference<MeasurementWidget> MeasurementWidgetObjectReference => DotNetObjectReference.Create(this); | ||
|
||
[Parameter] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need xml comments on all public types for the doc generation. |
||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
public ActiveTool? ActiveTool { get; set; } | ||
|
||
[Parameter] | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
public AreaUnit? AreaUnit { get; set; } | ||
|
||
[Parameter] | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
public LinearUnit? LinearUnit { get; set; } | ||
|
||
|
||
[Parameter] | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
public string? Label { get; set; } | ||
|
||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,14 @@ public abstract class Widget : MapComponent | |
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
public string? ContainerId { get; set; } | ||
|
||
/// <summary> | ||
/// Icon which represents the widget. It is typically used when the widget is controlled by another one (e.g. in the Expand widget). | ||
/// <a href="https://developers.arcgis.com/calcite-design-system/icons/">Calcite Icons</a> | ||
/// </summary> | ||
[Parameter] | ||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] | ||
public string? Icon { get; set; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need to be in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it should be removed from the measurement widget and inherited from the widget class |
||
|
||
/// <summary> | ||
/// The type of widget | ||
/// </summary> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using dymaptic.GeoBlazor.Core.Serialization; | ||
using dymaptic.GeoBlazor.Core.Components; | ||
using dymaptic.GeoBlazor.Core.Serialization; | ||
using System.Text.Json.Serialization; | ||
|
||
|
||
|
@@ -22,6 +23,58 @@ public enum ArealUnit | |
SquareFeet, | ||
SquareMeters, | ||
SquareYards, | ||
SquareKilometers | ||
SquareKilometers, | ||
SquareMiles | ||
#pragma warning restore CS1591 | ||
} | ||
|
||
/// <summary> | ||
/// Units for area measurement. Use one of the possible values listed below or any of the numeric codes for area units. | ||
/// <a target="_blank" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-units.htm"> | ||
/// ArcGIS | ||
/// JS API | ||
/// </a> | ||
/// </summary> | ||
[JsonConverter(typeof(EnumToKebabCaseStringConverter<AreaUnit>))] | ||
public enum AreaUnit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need a better way to identify the units used in GeometryEngine vs. the ones used in the new widget. Since they changed the names on me anyways, could we create a new |
||
{ | ||
#pragma warning disable CS1591 | ||
Metric, | ||
Imperial, | ||
Acres, | ||
Ares, | ||
Hectares, | ||
SquareFeet, | ||
SquareMeters, | ||
SquareYards, | ||
SquareKilometers, | ||
SquareMiles, | ||
SquareInches, | ||
SquareUSFeet, | ||
#pragma warning restore CS1591 | ||
} | ||
|
||
/// <summary> | ||
/// Units for linear measurement. Use one of the possible values listed below or any of the numeric codes for linear units. | ||
/// <a target="_blank" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-units.htm"> | ||
/// ArcGIS | ||
/// JS API | ||
/// </a>` | ||
/// </summary> | ||
[JsonConverter(typeof(EnumToKebabCaseStringConverter<LengthUnit>))] | ||
public enum LengthUnit | ||
{ | ||
#pragma warning disable CS1591 | ||
Millimeters, | ||
Centimeters, | ||
Decimeters, | ||
Meters, | ||
Kilometers, | ||
Inches, | ||
Feet, | ||
Yards, | ||
Miles, | ||
NauticalMiles, | ||
USFeet | ||
#pragma warning restore CS1591 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you were right about this formatting, I solved it another way by fixing it in
docCopy.ps1
, so we can let the XML formatter do its thing.