Select to view content in your preferred language

Change a Point Symbol's Size by a Relative Amount

70
0
yesterday
DavidSolari
MVP Regular Contributor

I need to take the 2D symbol of an arbitrary point Graphic and multiply the size by 1.5. Is there a sensible way to do this for all potential symbol types? I have simple and picture markers down but I have no idea where to begin with CIM Symbols, and I assume the 3D symbols need shader stuff to scale properly. I have the option of shoving this symbol in a separate layer and applying the scaling there if that works better.

const scale = 1.5
let baseSize: number;
if (pointGraphic.symbol.size != null) {
  baseSize = pointGraphic.symbol.size * scale;
  pointGraphic.symbol.size = baseSize;
} else if ((pointGraphic.symbol as any)?.width != null) {
  const baseWidth = (pointGraphic.symbol as any).width * scale;
  const baseHeight = (pointGraphic.symbol as any).height * scale;
  baseSize = baseWidth > baseHeight ? baseWidth : baseHeight;
  (pointGraphic.symbol as any).width = baseWidth;
  (pointGraphic.symbol as any).height = baseHeight;
} else if ((pointGraphic.symbol as any)?.font != null) {
  baseSize = (pointGraphic.symbol as any).font.size * scale;
  (pointGraphic.symbol as any).font.size = baseSize;
} else {
  // TODO: Scale CIM point
}

 

0 Kudos
0 Replies