pipeEnhancementStore.js 775 B

1234567891011121314151617181920212223242526
  1. import { defineStore } from 'pinia'
  2. import { ref } from 'vue'
  3. import { enhancementSelection } from '../domain/pipeEnhancement.js'
  4. import { neighborhoodRadius } from '../domain/pipeNeighborhood.js'
  5. /** Cesium 与 Three.js 之间共享的局部增强选择态。 */
  6. export const usePipeEnhancementStore = defineStore('pipeEnhancementStore', () => {
  7. const selected = ref(null)
  8. const radiusM = ref(50)
  9. function setRadius(value) {
  10. radiusM.value = neighborhoodRadius(value)
  11. }
  12. function select(kind, code) {
  13. selected.value = enhancementSelection(kind, code)
  14. return selected.value
  15. }
  16. function clear() {
  17. selected.value = null
  18. radiusM.value = 50
  19. }
  20. return { selected, radiusM, setRadius, select, clear }
  21. })