Select to view content in your preferred language

CIM Symbol doesn't update text color via CIMPrimitiveOverride

1226
10
Jump to solution
10-29-2024 06:03 AM
Jonas1
by
Occasional Contributor

I am defining a cimsymbol in the function with primitiveOverrides to update the style at runtime. This works fine for all border and background color, but for some reason it doesn't update the text color when i override the primitive (line 67). Am i missing something here? Thanks in advance 

 

//https://esri.github.io/cim-symbol-builder-js/
export function getCIMSymbolData() {
  return {
    type: 'CIMSymbolReference',
    primitiveOverrides: [
      {
        type: 'CIMPrimitiveOverride',
        primitiveName: 'locationIndex',
        propertyName: 'TextString',
        valueExpressionInfo: {
          type: 'CIMExpressionInfo',
          expression: '$feature.text',
          returnType: 'Default',
        },
      },
      {
        type: 'CIMPrimitiveOverride',
        primitiveName: 'markerBackgroundColor',
        propertyName: 'Color',
        valueExpressionInfo: {
          type: 'CIMExpressionInfo',
          expression: '$feature.markerBackgroundColor',
          returnType: 'Default',
        },
      },
      {
        type: 'CIMPrimitiveOverride',
        primitiveName: 'markerTextAndBorderColor',
        propertyName: 'Color',
        valueExpressionInfo: {
          type: 'CIMExpressionInfo',
          expression: '$feature.markerTextAndBorderColor',
          returnType: 'Default',
        },
      },
    ],
    symbol: {
      type: 'CIMPointSymbol',
      symbolLayers: [
        {
          type: 'CIMVectorMarker',
          enable: true,
          size: 32,
          anchorPointUnits: 'Relative',
          frame: {
            xmin: -5,
            ymin: -5,
            xmax: 5,
            ymax: 5,
          },
          markerGraphics: [
            {
              type: 'CIMMarkerGraphic',
              primitiveName: 'locationIndex',
              geometry: {
                x: 0,
                y: 0,
              },
              symbol: {
                type: 'CIMTextSymbol',
                height: 4,
                horizontalAlignment: 'Center',
                offsetX: 0,
                offsetY: 5.5,
                symbol: {
                  type: 'CIMPolygonSymbol',
                  //todo find out why the text color is not getting overwritten
                  symbolLayers: [
                    {
                      type: 'CIMSolidFill',
                      primitiveName: 'markerTextAndBorderColor',
                      enable: true,
                      color: [0, 0, 0, 255],
                      //color: [255, 255, 255, 255],
                    },
                  ],
                },
                verticalAlignment: 'Center',
              },
              textString: '',
            },
          ],
          scaleSymbolsProportionally: true,
          respectFrame: true,
          anchorPoint: {
            x: 0,
            y: 0,
          },
          offsetY: 8,
        },
        {
          type: 'CIMVectorMarker',
          enable: true,
          anchorPoint: {
            x: 0,
            y: -0.5,
          },
          anchorPointUnits: 'Relative',
          dominantSizeAxis3D: 'Y',
          size: 40,
          billboardMode3D: 'FaceNearPlane',
          frame: {
            xmin: 0,
            ymin: 0,
            xmax: 21,
            ymax: 21,
          },
          scaleSymbolsProportionally: true,
          respectFrame: true,
          markerGraphics: [
            {
              type: 'CIMMarkerGraphic',
              geometry: {
                rings: [
                  [
                    [17.17, 14.33],
                    [16.97, 12.96],
                    [16.38, 11.37],
                    [12.16, 3.98],
                    [11.2, 1.94],
                    [10.5, 0],
                    [9.8, 1.96],
                    [8.84, 4.02],
                    [4.61, 11.41],
                    [4.02, 12.98],
                    [3.83, 14.33],
                    [3.96, 15.63],
                    [4.34, 16.88],
                    [4.95, 18.03],
                    [5.78, 19.04],
                    [6.8, 19.88],
                    [7.95, 20.49],
                    [9.2, 20.87],
                    [10.5, 21],
                    [11.8, 20.87],
                    [13.05, 20.5],
                    [14.2, 19.88],
                    [15.22, 19.05],
                    [16.05, 18.03],
                    [16.66, 16.88],
                    [17.04, 15.63],
                    [17.17, 14.33],
                  ],
                ],
              },
              symbol: {
                type: 'CIMPolygonSymbol',
                symbolLayers: [
                  {
                    type: 'CIMSolidStroke',
                    primitiveName: 'markerTextAndBorderColor',
                    enable: true,
                    capStyle: 'Round',
                    joinStyle: 'Round',
                    lineStyle3D: 'Strip',
                    miterLimit: 10,
                    width: 0.5,
                    color: 'black',
                  },
                  {
                    type: 'CIMSolidFill',
                    primitiveName: 'markerBackgroundColor',
                    enable: true,
                    color: '#c1dba3',
                  },
                ],
              },
            },
          ],
        },
      ],
    },
  };
}

 

 

0 Kudos
10 Replies
AnneFitz
Esri Regular Contributor

Ok, this seems like a bug - we'll take another look. Thanks for letting us know!

0 Kudos