{"version":3,"file":"PolygonLayer.vue2.mjs","sources":["../../../../packages/PolygonLayer/PolygonLayer.vue"],"sourcesContent":["<template>\r\n  <div />\r\n</template>\r\n<script setup lang=\"ts\">\r\nimport {defineOptions} from 'vue';\r\nimport {useRegister} from \"@vuemap/vue-amap\";\r\nimport {buildLocaProps, commonEmitNames} from \"../../utils/buildHelper\";\r\nimport {useWatchFn, useLocaEvents} from '../../mixins/useLoca';\r\n\r\ndefineOptions({\r\n  name: 'ElAmapLocaPolygon',\r\n  inheritAttrs: false\r\n});\r\n\r\nconst props = defineProps(buildLocaProps({\r\n  cullface: {\r\n    type: String\r\n  }, // 剔除背面/前面的面（选择剔除将会提升性能），可选：back/front/none，back是剔除背面的面，front是剔除前面的面，none是不进行剔除。\r\n  acceptLight: {\r\n    type: Boolean,\r\n    default: true\r\n  }, // 面是否接受光照，光照信息在 loca 对象中配置\r\n  shininess: {\r\n    type: Number\r\n  }, // 立体网格的粗糙度，值越高，说明表面越粗糙。\r\n  hasSide: {\r\n    type: Boolean,\r\n    default: true\r\n  }, // 当面有厚度的时候，有没有侧面\r\n  hasBottom: {\r\n    type: Boolean,\r\n    default: false\r\n  },//当面有厚度的时候，有没有底面。\r\n  blockHide: {\r\n    type: Boolean,\r\n    default: true\r\n  },//是否开启被遮挡的面隐藏，默认开启，如果关闭，在有透明度的时候，会显示出被遮挡的面。\r\n  depth: {\r\n    type: Boolean,\r\n    default: true\r\n  }// 是否开启深度检测，开启后可能会影响zIndex\r\n}));\r\nconst emits = defineEmits(commonEmitNames);\r\n\r\nlet $amapComponent: any;\r\n\r\nlet _destroyComponent: () => void;\r\nlet _setSource: () => void;\r\n\r\nconst {$$getInstance, parentInstance} = useRegister<Loca.PolygonLayer, Loca.Container>((options) => {\r\n  return new Promise<any>((resolve) => {\r\n    $amapComponent = new Loca.PolygonLayer(options);\r\n    const useResult = useLocaEvents({\r\n      parentInstance,\r\n      $amapComponent,\r\n      emits,\r\n      props,\r\n      setStyle () {\r\n        const defaultStyleValue = {\r\n          topColor: '#fff',\r\n          sideTopColor: '#fff',\r\n          sideBottomColor: '#fff',\r\n          altitude: 0,\r\n          height: 0,\r\n          texture: null,\r\n          textureSize: [20, 3],\r\n          label: undefined,\r\n          labelAltitude: 0\r\n        };\r\n        const style = Object.assign({}, defaultStyleValue, props.defaultStyleValue);\r\n        const defaultLayerStyle = {\r\n          topColor: (index, feature) => {\r\n            feature.properties = feature.properties || {};\r\n            return feature.properties.topColor === undefined ? style.topColor : feature.properties.topColor;\r\n          },\r\n          sideTopColor: (index, feature) => {\r\n            feature.properties = feature.properties || {};\r\n            return feature.properties.sideTopColor === undefined ? style.sideTopColor : feature.properties.sideTopColor;\r\n          },\r\n          sideBottomColor: (index, feature) => {\r\n            feature.properties = feature.properties || {};\r\n            return feature.properties.sideBottomColor === undefined ? style.sideBottomColor : feature.properties.sideBottomColor;\r\n          },\r\n          altitude: (index, feature) => {\r\n            feature.properties = feature.properties || {};\r\n            return feature.properties.altitude === undefined ? style.altitude : feature.properties.altitude;\r\n          },\r\n          height: (index, feature) => {\r\n            feature.properties = feature.properties || {};\r\n            return feature.properties.height === undefined ? style.height : feature.properties.height;\r\n          },\r\n          texture: style.texture,\r\n          textureSize: (index, feature) => {\r\n            feature.properties = feature.properties || {};\r\n            return feature.properties.textureSize === undefined ? style.textureSize : feature.properties.textureSize;\r\n          },\r\n          label: (index, feature) => {\r\n            feature.properties = feature.properties || {};\r\n            return feature.properties.label === undefined ? style.label : feature.properties.label;\r\n          },\r\n          labelAltitude: (index, feature) => {\r\n            feature.properties = feature.properties || {};\r\n            return feature.properties.labelAltitude === undefined ? style.labelAltitude : feature.properties.labelAltitude;\r\n          }\r\n        };\r\n        const layerStyle = Object.assign({}, defaultLayerStyle, props.layerStyle);\r\n        $amapComponent.setStyle(layerStyle);\r\n      },\r\n    });\r\n    _destroyComponent = useResult._destroyComponent;\r\n    _setSource = useResult.setSource;\r\n    resolve($amapComponent);\r\n  });\r\n\r\n}, {\r\n  emits,\r\n  watchRedirectFn: useWatchFn({\r\n    setSource (){\r\n      if(_setSource){\r\n        _setSource();\r\n      }\r\n    },\r\n    $amapComponent: () => $amapComponent,\r\n    props\r\n  }),\r\n  destroyComponent () {\r\n    if(_destroyComponent){\r\n      _destroyComponent();\r\n    }\r\n    $amapComponent = null;\r\n  },\r\n});\r\n\r\ndefineExpose({\r\n  $$getInstance,\r\n});\r\n\r\n</script>\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AA4Bd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAEd,IAAI,IAAA,cAAA,CAAA;AAEJ,IAAI,IAAA,iBAAA,CAAA;AACJ,IAAI,IAAA,UAAA,CAAA;AAEJ,IAAA,MAAM,EAAC,aAAe,EAAA,cAAA,EAAkB,GAAA,WAAA,CAA+C,CAAC,OAAY,KAAA;AAClG,MAAO,OAAA,IAAI,OAAa,CAAA,CAAC,OAAY,KAAA;AACnC,QAAiB,cAAA,GAAA,IAAI,IAAK,CAAA,YAAA,CAAa,OAAO,CAAA,CAAA;AAC9C,QAAA,MAAM,YAAY,aAAc,CAAA;AAAA,UAC9B,cAAA;AAAA,UACA,cAAA;AAAA,UACA,KAAA;AAAA,UACA,KAAA;AAAA,UACA,QAAY,GAAA;AACV,YAAA,MAAM,iBAAoB,GAAA;AAAA,cACxB,QAAU,EAAA,MAAA;AAAA,cACV,YAAc,EAAA,MAAA;AAAA,cACd,eAAiB,EAAA,MAAA;AAAA,cACjB,QAAU,EAAA,CAAA;AAAA,cACV,MAAQ,EAAA,CAAA;AAAA,cACR,OAAS,EAAA,IAAA;AAAA,cACT,WAAA,EAAa,CAAC,EAAA,EAAI,CAAC,CAAA;AAAA,cACnB,KAAO,EAAA,KAAA,CAAA;AAAA,cACP,aAAe,EAAA,CAAA;AAAA,aACjB,CAAA;AACA,YAAA,MAAM,QAAQ,MAAO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