Loading...

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

This sample demonstrates how to style Point graphics on GraphicsLayer with CIMSymbol.

The app uses SketchViewModel to allow users to add new Graphics. Users could choose to use number or letter to represent the new Graphics by choosing the corresponding tool from the top-right toolbar. The following snippet shows how graphics are added to the map.

// called when sketchViewModel's create-complete event is fired.
function addGraphic(event) {
  if (event.state === "complete") {
    const cimSymbol = {
    type: "cim",
    // get JSON data defining CIMPointSymbol
    data: getPointSymbolData()
  };
  graphicsLayer.remove(event.graphic);
    const newGraphic = new Graphic({
      geometry: event.graphic.geometry,
      symbol: cimSymbol
    });
    graphicsLayer.add(newGraphic);
    sketchViewModel.create("point");
  }
}

CIMSymbol data is created from the getPointSymbolData() method which increments the value of the textString field on the CIMTextSymbol in the CIMSymbol by one every time it is called. Currently only the CIMPointSymbol for Point geometry is supported. See the CIM specification for more information.

Sample search results

TitleSample
Loading...