-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05684a9
commit 1f47c09
Showing
15 changed files
with
309 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<script setup lang="ts"> | ||
import { computed } from 'vue' | ||
import { storeToRefs } from 'pinia' | ||
import { useTranslation } from 'i18next-vue' | ||
import { PROJECTIONS } from '@/services/projection.utils' | ||
import { useMapStore } from '@/stores/map.store' | ||
import DropdownList from '@/components/common/dropdown-list.vue' | ||
const PROJECTIONS_OPTIONS = { | ||
LUREF: PROJECTIONS.LUREF, | ||
'Lon/Lat WGS84': PROJECTIONS.WGS84, | ||
'Lon/Lat WGS84 DMS': PROJECTIONS.WGS84DMS, | ||
'Lon/Lat WGS84 DM': PROJECTIONS.WGS84DM, | ||
'WGS84 UTM 32|31': PROJECTIONS.WGS84UTM3231, | ||
} // legacy name is "projectionOptions" | ||
const { t } = useTranslation() | ||
const { viewZoom } = storeToRefs(useMapStore()) | ||
const mapStore = useMapStore() | ||
const placeholder = computed(() => 'LUREF') | ||
const dropdownOptions = computed(() => | ||
Object.keys(PROJECTIONS_OPTIONS).map(projectionLabel => ({ | ||
label: projectionLabel, | ||
value: PROJECTIONS_OPTIONS[projectionLabel], | ||
ariaLabel: t(`Changer de projection : {{proj}}`, { | ||
scale: PROJECTIONS_OPTIONS[projectionLabel], | ||
}), | ||
})) | ||
) | ||
function onChangeScale(scale: number) { | ||
// mapStore.setViewZoom(scale) | ||
} | ||
</script> | ||
|
||
<template> | ||
<dropdown-list | ||
class="lux-dropdown min-w-[120px]" | ||
:options="dropdownOptions" | ||
:placeholder="placeholder" | ||
@change="onChangeScale" | ||
></dropdown-list> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<script setup lang="ts"> | ||
import { onMounted, ref, watch } from 'vue' | ||
import { storeToRefs } from 'pinia' | ||
import MousePosition from 'ol/control/MousePosition' | ||
import { Coordinate, CoordinateFormat } from 'ol/coordinate' | ||
import useControl from '@/composables/control/control.composable' | ||
import { useMapStore } from '@/stores/map.store' | ||
import { PROJECTIONS, coordinatesToString } from '@/services/projection.utils' | ||
const { mapProjection } = storeToRefs(useMapStore()) | ||
const controlElement = ref(null) | ||
const props = withDefaults( | ||
defineProps<{ | ||
className?: string | ||
coordinateFormat?: CoordinateFormat | ||
}>(), | ||
{ | ||
className: 'lux-mouse-coordinates', | ||
} | ||
) | ||
let mousePositionControl: MousePosition | ||
watch(mapProjection, mapProjection => | ||
mousePositionControl.setCoordinateFormat(coordinateFormat(mapProjection)) | ||
) | ||
// TODO: watch proj and set new format position | ||
function coordinateFormat(mapProjection?: string) { | ||
return (coordinate: number[] | undefined) => { | ||
if (mapProjection === PROJECTIONS.WGS84DMS) { | ||
return coordinatesToString( | ||
<Coordinate>coordinate, | ||
mapProjection, | ||
PROJECTIONS.WGS84, | ||
true, | ||
false | ||
) | ||
} else if (mapProjection === PROJECTIONS.WGS84DM) { | ||
return coordinatesToString( | ||
<Coordinate>coordinate, | ||
mapProjection, | ||
PROJECTIONS.WGS84, | ||
false, | ||
true | ||
) | ||
} else { | ||
return coordinatesToString( | ||
<Coordinate>coordinate, | ||
mapProjection!, | ||
mapProjection!, | ||
false, | ||
false | ||
) // TODO: verify return this.coordinateString_( | ||
// coord, mapEpsgCode, this['projection']['value'], false, false) | ||
} | ||
return '' | ||
} | ||
} | ||
onMounted(() => { | ||
if (controlElement.value) { | ||
const newControl = useControl(MousePosition, { | ||
className: props.className, | ||
...{ target: controlElement.value }, | ||
}) | ||
mousePositionControl = newControl.control as MousePosition | ||
mousePositionControl.setCoordinateFormat( | ||
coordinateFormat(mapProjection.value) | ||
) | ||
newControl.addControlToMap() | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div ref="controlElement" class="p-3"></div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script setup lang="ts"> | ||
import { onMounted, ref, watch } from 'vue' | ||
import ScaleLine from 'ol/control/ScaleLine' | ||
import useControl from '@/composables/control/control.composable' | ||
const controlElement = ref(null) | ||
const props = withDefaults( | ||
defineProps<{ | ||
className?: string | ||
}>(), | ||
{ | ||
className: 'lux-scale-line', // Default from ol:'ol-scale-line' | ||
} | ||
) | ||
onMounted(() => { | ||
if (controlElement.value) { | ||
const scaleLineControl = useControl(ScaleLine, { | ||
className: props.className, | ||
...{ target: controlElement.value }, | ||
}) | ||
scaleLineControl.addControlToMap() | ||
} | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div ref="controlElement" class="p-3"></div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.