require(["esri/widgets/CoordinateConversion/support/Format"], (Format) => { /* code goes here */ });
import Format from "@arcgis/core/widgets/CoordinateConversion/support/Format.js";
esri/widgets/CoordinateConversion/support/Format
The Format class represents one of the formats in the Coordinate Conversion widget. Each format describes how a Point should be transformed into a coordinate for display purposes.
Constructors
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
Contains information that describes how this Format should be converted. | Format | ||
A array of Coordinate Segments. | Format | ||
A string that serves as a pattern describing how this Format should be displayed. | Format | ||
The name of the class. | Accessor | ||
The default pattern describing how this Format should be displayed. | Format | ||
A string that is used to label this Format in the UI. | Format | ||
The name of the coordinate. | Format | ||
The SpatialReference for this format. | Format | ||
The view model of the CoordinateConversion widget that is utilizing this format. | Format |
Property Details
-
conversionInfo
conversionInfo ConversionInfo
-
Contains information that describes how this Format should be converted. This property should only be set when creating a custom Format.
- Default Value:null
-
coordinateSegments
coordinateSegments CoordinateSegment[]
-
A array of Coordinate Segments. Each segment represents a section of the Format's coordinate.
- Default Value:null
-
currentPattern
currentPattern String
-
A string that serves as a pattern describing how this Format should be displayed. The pattern should contain all of aliases specified by the Format's coordinateSegments property.
- Default Value:null
Example// Remove the spaces from an mgrs coordinate let format = coordinateConversionWidget.formats.find(function(format) { return format.name === "mgrs"; }); console.log.(format.currentPattern); // > Z S X Y format.currentPattern = "ZSXY"
-
defaultPattern
defaultPattern String
-
The default pattern describing how this Format should be displayed. See currentPattern.
- Default Value:null
-
name
name String
-
The name of the coordinate. A CoordinateConversion widget should not contain multiple Formats with the same name.
- Default Value:null
-
spatialReference
spatialReference SpatialReference
-
The SpatialReference for this format. Coordinates generated for a format will be derived from points in this spatial reference.
-
viewModel
viewModel CoordinateConversionViewModel
-
The view model of the CoordinateConversion widget that is utilizing this format.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
Returns true if a named group of handles exist. | Accessor | ||
Removes a group of handles owned by the object. | Accessor |
Method Details
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, addHandles added at 4.25. -
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles const handle = reactiveUtils.when( () => !view.updating, () => { wkidSelect.disabled = false; }, { once: true } ); this.addHandles(handle); // Destroy the object this.destroy();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from AccessorSince: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, hasHandles added at 4.25. -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType Description Boolean Returns true
if a named group of handles exist.Example// Remove a named group of handles if they exist. if (obj.hasHandles("watch-view-updates")) { obj.removeHandles("watch-view-updates"); }
-
Inherited from Accessor
Since: ArcGIS Maps SDK for JavaScript 4.25Accessor since 4.0, removeHandles added at 4.25. -
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");
Type Definitions
-
ConversionInfo
ConversionInfo Object
-
This object describes how a Format should be projected and formatted for display. Used to define custom Formats that require custom conversion and/or projection logic.
- Properties
-
convert ConvertFunction
A function that takes a point and returns a position.
reverseConvert ReverseConvertFunctionA function that takes a string and returns a Point.
-
ConvertFunction
ConvertFunction(point){Position}
-
A user-provided function that converts a Point into a Position. This function may be necessary to provide as part of ConversionInfo when creating a custom Format.
Parameterpoint PointA point to be converted.
ReturnsType Description Position The returned position.
-
A coordinate segment represents one piece of a coordinate string.
A MGRS coordinate, for example
30UVG898998
, is described by four segments:- Alias
Z
, the gridzone:30U
- Alias
S
, the 100,000 meter square designator:VG
- Alias
X
, the easting (x coordinate with respect to the 10,000 meter square):898
- Alias
Y
, the northing (y coordinate with respect to the 10,000 meter square):998
- Alias
-
ReverseConvertFunction
ReverseConvertFunction(coordinate){Point}
-
A user-provided function that converts a coordinate string into a Point. This function may be necessary to provide as part of ConversionInfo when creating a custom Format.
Parametercoordinate StringThe string to be reversed.
ReturnsType Description Point The returned point