import { getCIMSymbolSize, scaleCIMSymbolTo, getCIMSymbolColor, applyCIMSymbolColor, getCIMSymbolRotation } from "@arcgis/core/symbols/support/cimSymbolUtils.js";const { getCIMSymbolSize, scaleCIMSymbolTo, getCIMSymbolColor, applyCIMSymbolColor, getCIMSymbolRotation } = await $arcgis.import("@arcgis/core/symbols/support/cimSymbolUtils.js");- Since
- ArcGIS Maps SDK for JavaScript 4.16
Provides utility functions for CIMSymbols. These methods will allow you to get and set the size, color, and rotation of a CIMsymbol.
Type definitions
ScaleCIMSymbolOptions
preserveOutlineWidth
- Type
- boolean
When true, this property will preserve the outline
width of the symbol. This property will only work when scaleSymbolsProportionally
is false on the symbol layer. If scaleSymbolsProportionally is true, this property will be ignored.
ApplyCIMSymbolColorOptions
layersToColor
- Type
- "fill" | "outline" | "fill-and-outline"
The symbol layers to apply the color to.
This only applies to CIMPolygonSymbols and CIMPointSymbols with embedded polygon marker graphics.
The "fill" option will only apply the color to the fill symbol layers - CIMSolidFill, CIMHatchFill, CIMPictureFill, etc.
The "outline" option will only apply the color to the stroke symbol layers - like CIMSolidStroke and CIMPictureStroke.
The "fill-and-outline" option will apply the color to both fill and stroke layers. The default value is "fill".
Functions
getCIMSymbolSize
Returns the size of a given CIMSymbol. The size of a CIMSymbol is defined as the size of the largest symbol layer.
- Signature
-
getCIMSymbolSize (symbol: CIMSymbol): number
scaleCIMSymbolTo
Scales the largest layer of a CIMSymbol to a given size. The other symbol layers will scale accordingly.
- Signature
-
scaleCIMSymbolTo (symbol: CIMSymbol | null | undefined, size: number, options?: ScaleCIMSymbolOptions): void
getCIMSymbolColor
Returns the first color of the symbol layers in a CIMSymbol.
Known Limitations
- Not supported on CIMGradientStroke and CIMGradientFill symbol layers.
- Signature
-
getCIMSymbolColor (symbol: CIMSymbol): Color | null | undefined
applyCIMSymbolColor
Sets the color of the symbol layers of a CIMSymbol to a given value if the symbol layer is not color locked.
Known Limitations
- Not supported on CIMGradientStroke and CIMGradientFill symbol layers.
- Signature
-
applyCIMSymbolColor (symbol: CIMSymbol, color: Color, options?: ApplyCIMSymbolColorOptions): void
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| symbol | The CIMSymbol to set the color on. | | |
| color | The desired color value for the symbol. | | |
| options | Since 4.23 The options for setting the color of the CIMSymbol. | |
- Returns
- void
getCIMSymbolRotation
Returns the rotation value of a CIMSymbol.
- Signature
-
getCIMSymbolRotation (symbol: CIMSymbol, clockwise?: boolean): number