UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

46 lines (43 loc) 2.53 kB
import type { ClonableMixin } from "../../core/Clonable.js"; import type { JSONSupport } from "../../core/JSONSupport.js"; import type { FeatureTemplatePrototype, FeatureTemplateThumbnail } from "../../portal/jsonTypes.js"; export interface FeatureTemplateProperties extends Partial<Pick<FeatureTemplate, "description" | "drawingTool" | "name" | "prototype" | "thumbnail">> {} export type DrawingTool = "auto-complete-polygon" | "circle" | "ellipse" | "freehand" | "line" | "none" | "point" | "polygon" | "rectangle" | "arrow" | "triangle" | "left-arrow" | "right-arrow" | "up-arrow" | "down-arrow"; /** * Feature templates define all the information required to create a new feature in a [feature layer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/). * These include information such as the default attribute values with which a feature will be created, and the default tool used to create that feature. * * @since 4.4 */ export default class FeatureTemplate extends FeatureTemplateSuperclass { constructor(properties?: FeatureTemplateProperties); /** Description of the feature template. */ accessor description: string | null | undefined; /** Name of the default drawing tool defined for the template to create a feature. */ accessor drawingTool: DrawingTool | null | undefined; /** Name of the feature template. */ accessor name: string | null | undefined; /** * An instance of the prototypical feature described by the [feature template](https://developers.arcgis.com/javascript/latest/references/core/layers/support/FeatureTemplate/). * It specifies default values for the attribute fields and does not contain geometry. * * @example * // this snippet code shows how to create a feature based on * // feature type prototype. Creates a new feature assigns * // default values for the attributes to the new feature. * view.on("click", function(event) { * let park = fl.templates[0].prototype; * newPark = new Graphic({ * attributes: park.attributes, * geometry: event.mapPoint * }); * * let promise = fl.applyEdits({addFeatures: [newPark]}); * editResultsHandler(promise); * }); */ accessor prototype: FeatureTemplatePrototype; /** An object used to create a thumbnail image that represents a feature type in the feature template. */ accessor thumbnail: FeatureTemplateThumbnail | null | undefined; } declare const FeatureTemplateSuperclass: typeof JSONSupport & typeof ClonableMixin