Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Géocontrib Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
externe Matthieu
Géocontrib Frontend
Commits
84fd72e3
Commit
84fd72e3
authored
2 years ago
by
Timothee P
Browse files
Options
Downloads
Patches
Plain Diff
add snap on feature edition & fix undefined feature_type in popup
parent
7655fd95
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/services/edition-service.js
+23
-1
23 additions, 1 deletion
src/services/edition-service.js
src/services/map-service.js
+1
-1
1 addition, 1 deletion
src/services/map-service.js
src/views/Feature/FeatureEdit.vue
+1
-0
1 addition, 0 deletions
src/views/Feature/FeatureEdit.vue
with
25 additions
and
2 deletions
src/services/edition-service.js
+
23
−
1
View file @
84fd72e3
import
{
Draw
}
from
'
ol/interaction
'
;
import
{
Draw
,
Snap
}
from
'
ol/interaction
'
;
import
GeometryType
from
'
ol/geom/GeometryType
'
;
import
GeometryType
from
'
ol/geom/GeometryType
'
;
import
Modify
from
'
ol/interaction/Modify
'
;
import
Modify
from
'
ol/interaction/Modify
'
;
import
Select
from
'
ol/interaction/Select
'
;
import
Select
from
'
ol/interaction/Select
'
;
...
@@ -267,6 +267,28 @@ const editionService = {
...
@@ -267,6 +267,28 @@ const editionService = {
removeActiveFeatures
()
{
removeActiveFeatures
()
{
this
.
drawnFeature
=
null
;
this
.
drawnFeature
=
null
;
this
.
featureToEdit
=
null
;
this
.
featureToEdit
=
null
;
},
addSnapInteraction
(
map
)
{
// The snap interaction must be added after the Modify and Draw interactions
// in order for its map browser event handlers to be fired first. Its handlers
// are responsible of doing the snapping.
// Since we can't give a list of source to snap,
// we use this workaround, an interaction collection: https://github.com/openlayers/openlayers/issues/7100
let
interactions
=
[];
map
.
getLayers
().
forEach
((
layer
)
=>
{
if
(
layer
instanceof
VectorLayer
)
{
let
interaction
=
new
Snap
({
source
:
layer
.
getSource
()
});
interactions
.
push
(
interaction
);
}
});
for
(
let
snap
of
interactions
)
{
map
.
addInteraction
(
snap
);
}
}
}
};
};
...
...
This diff is collapsed.
Click to expand it.
src/services/map-service.js
+
1
−
1
View file @
84fd72e3
...
@@ -554,7 +554,7 @@ const mapService = {
...
@@ -554,7 +554,7 @@ const mapService = {
Statut :
${
status
}
Statut :
${
status
}
</div>
</div>
<div>
<div>
Type : <a id="goToFeatureTypeDetail" class="pointer">
${
feature_type
.
title
}
</a>
Type :
${
feature_type
?
'
<a id="goToFeatureTypeDetail" class="pointer">
'
+
feature_type
.
title
+
'
</a>
'
:
'
Type de signalement inconnu
'
}
</div>
</div>
<div>
<div>
Dernière mise à jour :
${
date_maj
}
Dernière mise à jour :
${
date_maj
}
...
...
This diff is collapsed.
Click to expand it.
src/views/Feature/FeatureEdit.vue
+
1
−
0
View file @
84fd72e3
...
@@ -888,6 +888,7 @@ export default {
...
@@ -888,6 +888,7 @@ export default {
)[
0
];
)[
0
];
editionService
.
setFeatureToEdit
(
currentFeature
);
editionService
.
setFeatureToEdit
(
currentFeature
);
this
.
updateMap
(
currentFeature
);
this
.
updateMap
(
currentFeature
);
editionService
.
addSnapInteraction
(
this
.
map
);
}
}
}
}
this
.
mapLoading
=
false
;
this
.
mapLoading
=
false
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment