Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSLUX-707 activate style edition for drawings #161

Merged
merged 28 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
9d0c0d3
activate style edition for drawings
mki-c2c Oct 14, 2024
ffda25e
fix type errors
mki-c2c Oct 14, 2024
185b5dd
additional style properties (direction, lineStyle)
mki-c2c Oct 14, 2024
2bb5b48
connect symbol style editor
mki-c2c Oct 21, 2024
78e0a77
select clipart symbols
mki-c2c Oct 21, 2024
66468e3
fix typee
mki-c2c Oct 21, 2024
f124d43
write e2e tests
mki-c2c Oct 22, 2024
1bb4384
fix tests
mki-c2c Oct 22, 2024
eccb8e4
apply review comments
mki-c2c Oct 28, 2024
9c3add4
implement tests:
mki-c2c Oct 31, 2024
c7101a8
rename feature edit layer for better distinction in tests + cleanup
mki-c2c Oct 31, 2024
46d066f
fix tests
mki-c2c Nov 5, 2024
9a92015
fix layer selection
mki-c2c Nov 5, 2024
4f815ea
use set of two potential test results because of resolution descrepan…
mki-c2c Nov 5, 2024
b70e1ec
test improved cypress setup
mki-c2c Nov 5, 2024
7fcff64
ci test polygon
mki-c2c Nov 5, 2024
50539b4
simplify geometry tests (no check of decimals
mki-c2c Nov 5, 2024
2debbd7
increase timeout to have more stable e2e tests
mki-c2c Nov 5, 2024
aabac78
consider review comments
mki-c2c Nov 5, 2024
1f39d6a
reorganize individual tests (it) + review remarks
mki-c2c Nov 6, 2024
5a98680
review comments
mki-c2c Nov 12, 2024
b9b3a73
refactor but clone featureStyle objects
mki-c2c Nov 12, 2024
f8fd266
fix typing
mki-c2c Nov 12, 2024
b11af06
deactivate highlighting of feature during style edition
mki-c2c Nov 14, 2024
96a788d
improvements of useability:
mki-c2c Nov 14, 2024
66ef329
fix typing
mki-c2c Nov 14, 2024
f7fde7c
some architectural bugfixes:
mki-c2c Nov 15, 2024
eae429f
fix test
mki-c2c Nov 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions src/components/draw/feature-edit-style.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,35 +32,39 @@ const currentStyleComponent = computed(() =>
)

function onColorSelect(colorEvent: Event) {
feature.featureStyle.color = (colorEvent.target as HTMLInputElement).value
feature.changed()
feature.featureStyle = {
...feature.featureStyle,
color: (colorEvent.target as HTMLInputElement).value,
}
}

function onSizeChange(newSize: number) {
feature.featureStyle.size = newSize
feature.changed()
feature.featureStyle = { ...feature.featureStyle, size: newSize }
}

function onAngleChange(newAngle: number) {
feature.featureStyle.angle = (newAngle * Math.PI) / 180
feature.changed()
feature.featureStyle = {
...feature.featureStyle,
angle: (newAngle * Math.PI) / 180,
}
}

function onWidthChange(newWidth: number) {
feature.featureStyle.stroke = newWidth
feature.changed()
feature.featureStyle = { ...feature.featureStyle, stroke: newWidth }
}

function onTransparencyChange(newTransparency: number) {
feature.featureStyle.opacity = (100 - newTransparency) / 100
feature.changed()
feature.featureStyle = {
...feature.featureStyle,
opacity: (100 - newTransparency) / 100,
}
}

function onShowDirection(event: Event) {
feature.featureStyle.showOrientation = (
event.target as HTMLInputElement
).checked
feature.changed()
feature.featureStyle = {
...feature.featureStyle,
showOrientation: (event.target as HTMLInputElement).checked,
}
}

function onClickChangeOrientation() {
Expand All @@ -72,8 +76,7 @@ function onClickChangeOrientation() {
}

function onClickChangeLineStyle(style: string) {
feature.featureStyle.linestyle = style
feature.changed()
feature.featureStyle = { ...feature.featureStyle, linestyle: style }
}
</script>

Expand Down
18 changes: 10 additions & 8 deletions src/components/draw/feature-edit-symbol.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,21 @@
function onClickSymbol(
component: (typeof symbolComponents)[keyof typeof symbolComponents]
) {
let newShape = undefined
if (component === symbolComponents.Circle) {
feature.featureStyle.shape = 'circle'
newShape = 'circle'
} else if (component === symbolComponents.Square) {
feature.featureStyle.shape = 'square'
newShape = 'square'
} else if (component === symbolComponents.Cross) {
feature.featureStyle.shape = 'cross'
newShape = 'cross'
} else if (component === symbolComponents.Triangle) {
feature.featureStyle.shape = 'triangle'
newShape = 'triangle'
}
feature.featureStyle = {
...feature.featureStyle,
shape: newShape,

Check failure on line 61 in src/components/draw/feature-edit-symbol.vue

View workflow job for this annotation

GitHub Actions / build-lint-test

Type 'string | undefined' is not assignable to type 'string'.
symbolId: undefined,
}
feature.featureStyle.symbolId = undefined

feature.changed()

closePopup()
}

Expand Down
1 change: 0 additions & 1 deletion src/components/draw/feature-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ function onResetInfo(prevLabel: string, prevDescription: string) {

function onResetStyle(prevStyle: DrawnFeatureStyle) {
localFeature.featureStyle = { ...prevStyle }
localFeature.changed()
}

function onSubmitEditFeature() {
Expand Down
13 changes: 11 additions & 2 deletions src/services/draw/drawn-feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class DrawnFeature extends Feature {
map_id: string | undefined // mymap uuid
saving: boolean
featureType: DrawnFeatureType
featureStyle: DrawnFeatureStyle
_featureStyle: DrawnFeatureStyle
map = useMap().getOlMap()

constructor(drawnFeature?: DrawnFeature) {
Expand All @@ -41,7 +41,7 @@ export class DrawnFeature extends Feature {
this.display_order = drawnFeature.display_order
this.editable = drawnFeature.editable
this.selected = drawnFeature.selected
this.featureStyle = drawnFeature.featureStyle
this._featureStyle = drawnFeature.featureStyle
this.id = drawnFeature.id
this.saving = drawnFeature.saving
this.setProperties(drawnFeature.getProperties())
Expand All @@ -50,6 +50,15 @@ export class DrawnFeature extends Feature {
}
}

public get featureStyle() {
return this._featureStyle
}

public set featureStyle(featureStyle: DrawnFeatureStyle) {
this._featureStyle = featureStyle
this.changed()
}

mki-c2c marked this conversation as resolved.
Show resolved Hide resolved
fit() {
const size = this.map.getSize()
const extent = <Extent>this.getGeometry()?.getExtent()
Expand Down
Loading