UNPKG

@arcgis/core

Version:

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

116 lines (114 loc) 9.13 kB
import type Color from "../Color.js"; import type { JSONSupport } from "../core/JSONSupport.js"; import type { SymbolType } from "./types.js"; import type { ColorLike } from "../Color.js"; export interface SymbolProperties { /** * The color of the symbol. * This can be autocast with an array of rgb(a) values, named string, hex string or an hsl(a) string, * an object with `r`, `g`, `b`, and `a` properties, or a [Color](https://developers.arcgis.com/javascript/latest/references/core/Color/) object. * * @default "black" * @example * // CSS color string * symbol.color = "dodgerblue"; * @example * // HEX string * symbol.color = "#33cc33"; * @example * // array of RGBA values * symbol.color = [51, 204, 51, 0.3]; * @example * // object with rgba properties * symbol.color = { * r: 51, * g: 51, * b: 204, * a: 0.7 * }; */ color?: ColorLike | null; } /** * Symbol is the base class for all symbols. Symbols represent point, line, polygon, * and mesh geometries as vector graphics within a [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/). * Symbols can only be set directly on individual [graphics](https://developers.arcgis.com/javascript/latest/references/core/Graphic/#symbol) * in a [GraphicsLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GraphicsLayer/) or in [View.graphics](https://developers.arcgis.com/javascript/latest/references/core/views/View/#graphics). * Otherwise they are assigned to a [Renderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/Renderer/) that is applied to a * [Layer](https://developers.arcgis.com/javascript/latest/references/core/layers/Layer/). * * Numerous symbols are available for depicting features. Choosing a symbol type * depends on the following: * * * The type of [View](https://developers.arcgis.com/javascript/latest/references/core/views/View/) in which the symbols will be rendered - * either [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) (for 2D) or [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/) (for 3D) * * The [geometry type](https://developers.arcgis.com/javascript/latest/references/core/geometry/Geometry/#type) of the feature(s) * * The purpose and context of the visualization * * The following table indicates which symbol subclasses you should work with depending on the view type. * * View type | Symbol subclasses * ----------|------------------ * [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/) (2D) | [FillSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/FillSymbol/), [LineSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/LineSymbol/), [MarkerSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/MarkerSymbol/), [TextSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/TextSymbol/), [WebStyleSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/WebStyleSymbol/), [CIMSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/CIMSymbol/) * [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/) (3D) | [Symbol3D](https://developers.arcgis.com/javascript/latest/references/core/symbols/Symbol3D/), [WebStyleSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/WebStyleSymbol/), [CIMSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/CIMSymbol/) * * If working with data in a [MapView](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/), use the following table as a guide * for choosing a symbol type. * * Geometry type | Valid symbol types * --------------|------------------- * [Point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/) | [SimpleMarkerSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/SimpleMarkerSymbol/), [PictureMarkerSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/PictureMarkerSymbol/), [TextSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/TextSymbol/), [WebStyleSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/WebStyleSymbol/), [CIMSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/CIMSymbol/) * [Polyline](https://developers.arcgis.com/javascript/latest/references/core/geometry/Polyline/) | [SimpleLineSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/SimpleLineSymbol/), [TextSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/TextSymbol/), [CIMSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/CIMSymbol/) * [Polygon](https://developers.arcgis.com/javascript/latest/references/core/geometry/Polygon/) | [SimpleFillSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/SimpleFillSymbol/), [PictureFillSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/PictureFillSymbol/), [SimpleMarkerSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/SimpleMarkerSymbol/), [TextSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/TextSymbol/), [CIMSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/CIMSymbol/) * * If working with data in a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/), use the following table as a guide * when selecting a symbol type. * * Geometry type | Valid symbol types * --------------|------------------- * [Point](https://developers.arcgis.com/javascript/latest/references/core/geometry/Point/) | [PointSymbol3D](https://developers.arcgis.com/javascript/latest/references/core/symbols/PointSymbol3D/), [LabelSymbol3D](https://developers.arcgis.com/javascript/latest/references/core/symbols/LabelSymbol3D/), [WebStyleSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/WebStyleSymbol/), [CIMSymbol](https://developers.arcgis.com/javascript/latest/references/core/symbols/CIMSymbol/) * [Polyline](https://developers.arcgis.com/javascript/latest/references/core/geometry/Polyline/) | [LineSymbol3D](https://developers.arcgis.com/javascript/latest/references/core/symbols/LineSymbol3D/), [LabelSymbol3D](https://developers.arcgis.com/javascript/latest/references/core/symbols/LabelSymbol3D/) * [Polygon](https://developers.arcgis.com/javascript/latest/references/core/geometry/Polygon/) | [PolygonSymbol3D](https://developers.arcgis.com/javascript/latest/references/core/symbols/PolygonSymbol3D/), [LabelSymbol3D](https://developers.arcgis.com/javascript/latest/references/core/symbols/LabelSymbol3D/) * [Mesh](https://developers.arcgis.com/javascript/latest/references/core/geometry/Mesh/) | [MeshSymbol3D](https://developers.arcgis.com/javascript/latest/references/core/symbols/MeshSymbol3D/), [LabelSymbol3D](https://developers.arcgis.com/javascript/latest/references/core/symbols/LabelSymbol3D/) * * While not expressly indicated in the tables above, 2D symbols are supported in 3D * [SceneViews](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/) while 3D symbols are not * supported in 2D [MapViews](https://developers.arcgis.com/javascript/latest/references/core/views/MapView/). However, it is recommended * to favor 3D symbol types over 2D symbols when working in a [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/). * * @since 4.0 * @see [Symbol Builder](https://developers.arcgis.com/javascript/latest/symbol-builder/) * @see [Styles and data visualization](https://developers.arcgis.com/javascript/latest/visualization/) * @see [Renderer](https://developers.arcgis.com/javascript/latest/references/core/renderers/Renderer/) * @see [Graphic](https://developers.arcgis.com/javascript/latest/references/core/Graphic/) */ export default abstract class Symbol extends JSONSupport { /** * The color of the symbol. * This can be autocast with an array of rgb(a) values, named string, hex string or an hsl(a) string, * an object with `r`, `g`, `b`, and `a` properties, or a [Color](https://developers.arcgis.com/javascript/latest/references/core/Color/) object. * * @default "black" * @example * // CSS color string * symbol.color = "dodgerblue"; * @example * // HEX string * symbol.color = "#33cc33"; * @example * // array of RGBA values * symbol.color = [51, 204, 51, 0.3]; * @example * // object with rgba properties * symbol.color = { * r: 51, * g: 51, * b: 204, * a: 0.7 * }; */ get color(): Color | null | undefined; set color(value: ColorLike | null | undefined); /** The symbol type. */ get type(): SymbolType; }