{"version":3,"file":"ngx-ol-library-style-regular-shape.mjs","sources":["../../../src/style/regular-shape/regular-shape-style.component.ts","../../../src/style/regular-shape/regular-shape-style.module.ts","../../../src/style/regular-shape/ngx-ol-library-style-regular-shape.ts"],"sourcesContent":["import { \n  ChangeDetectionStrategy, \n  Component, \n  InjectOptions, \n  Input, \n  OnChanges, \n  OnDestroy, \n  OnInit, \n  SimpleChanges, \n  inject\n} from '@angular/core';\nimport { Size } from 'ol/size';\nimport { Fill, Stroke } from 'ol/style';\nimport { DeclutterMode } from 'ol/style/Style';\nimport RegularShape, { Options } from 'ol/style/RegularShape';\nimport { NolPrefixedOptions } from 'ngx-ol-library/core';\nimport { useImageStyleHost } from 'ngx-ol-library/style/image';\n\n/**\n * The component that set regular shape style for vector features.\n * @name nol-regular-shape-style\n * @order 1\n */\n@Component({\n  selector: 'nol-regular-shape-style',\n  exportAs: 'nolRegularShapeStyle',\n  standalone: true,\n  template: `<ng-content></ng-content>`,\n  changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class NolRegularShapeStyleComponent \n  implements NolPrefixedOptions<Options>, OnInit, OnChanges, OnDestroy {\n\n  @Input() nolFill?: Fill;\n  @Input() nolPoints!: number;\n  @Input() nolRadius!: number;\n  @Input() nolRadius2?: number;\n  @Input() nolAngle?: number;\n  @Input() nolDisplacement?: number[];\n  @Input() nolStroke?: Stroke;\n  @Input() nolRotation?: number;\n  @Input() nolRotateWithView?: boolean;\n  @Input() nolScale?: number | Size;\n  @Input() nolDeclutterMode?: DeclutterMode;\n\n  private readonly host = useImageStyleHost('nol-regular-shape-style');\n  private instance!: RegularShape;\n\n  getInstance() {\n    return this.instance;\n  }\n\n  update(): void {\n    this.host.setImage(this.instance);\n  }\n\n  ngOnInit(): void {\n    this.instance = new RegularShape({\n      fill: this.nolFill,\n      points: this.nolPoints,\n      radius: this.nolRadius,\n      radius2: this.nolRadius2,\n      angle: this.nolAngle,\n      displacement: this.nolDisplacement,\n      stroke: this.nolStroke,\n      rotation: this.nolRotation,\n      rotateWithView: this.nolRotateWithView,\n      scale: this.nolScale,\n      declutterMode: this.nolDeclutterMode,\n    });\n\n    this.host.setImage(this.instance);\n  }\n\n  ngOnChanges(changes: SimpleChanges): void {\n    if (!this.instance) {\n      return;\n    }\n\n    const {\n      nolFill,\n      nolDisplacement,\n      nolStroke,\n      nolRotation,\n      nolRotateWithView,\n      nolScale,\n    } = changes;\n\n    if (nolFill) {\n      this.instance.setFill(nolFill.currentValue);\n    }\n\n    if (nolDisplacement) {\n      this.instance.setDisplacement(nolDisplacement.currentValue);\n    }\n\n    if (nolStroke) {\n      this.instance.setStroke(nolStroke.currentValue);\n    }\n\n    if (nolRotation) {\n      this.instance.setRotation(nolRotation.currentValue);\n    }\n\n    if (nolRotateWithView) {\n      this.instance.setRotateWithView(nolRotateWithView.currentValue);\n    }\n\n    if (nolScale) {\n      this.instance.setScale(nolScale.currentValue);\n    }\n\n    this.update();\n  }\n\n  ngOnDestroy(): void {\n    this.host.setImage(null);    \n  }\n\n}\n\nexport function useRegularShapeStyle(): NolRegularShapeStyleComponent;\nexport function useRegularShapeStyle(options: InjectOptions & {optional?: false}): NolRegularShapeStyleComponent;\nexport function useRegularShapeStyle(options: InjectOptions): NolRegularShapeStyleComponent | null;\nexport function useRegularShapeStyle(options?: InjectOptions): NolRegularShapeStyleComponent | null  {\n  return inject(NolRegularShapeStyleComponent, options || {}) || null;\n}\n","import { NgModule } from '@angular/core';\nimport { NolRegularShapeStyleComponent } from './regular-shape-style.component';\n\n\n\n@NgModule({\n  imports: [NolRegularShapeStyleComponent],\n  exports: [NolRegularShapeStyleComponent]\n})\nexport class NolRegularShapeStyleModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAkBA;;;;AAIG;MAQU,6BAA6B,CAAA;AAP1C,IAAA,WAAA,GAAA;AAsBmB,QAAA,IAAA,CAAA,IAAI,GAAG,iBAAiB,CAAC,yBAAyB,CAAC,CAAC;AA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