Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
vMap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository 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
Marty Fabien
vMap
Commits
847e66e4
Commit
847e66e4
authored
6 years ago
by
Armand Bahi
Browse files
Options
Downloads
Patches
Plain Diff
Amélioration performances
parent
f9f4d2c0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/module_vmap/module/javascript/app/vmap/map/mapcompare.js
+71
-35
71 additions, 35 deletions
src/module_vmap/module/javascript/app/vmap/map/mapcompare.js
with
71 additions
and
35 deletions
src/module_vmap/module/javascript/app/vmap/map/mapcompare.js
+
71
−
35
View file @
847e66e4
...
@@ -446,6 +446,26 @@ nsVmap.MapCompare.prototype.mapCompareController = function ($scope, $window, $e
...
@@ -446,6 +446,26 @@ nsVmap.MapCompare.prototype.mapCompareController = function ($scope, $window, $e
*/
*/
this
.
duration
=
1000
;
this
.
duration
=
1000
;
/**
* Timestamp of the last map center sync
*/
this
.
lastMapSyncCenter_
=
0
;
/**
* Timestamp of the last map compare center sync
*/
this
.
lastCompareMapSyncCenter_
=
0
;
/**
* Timestamp of the last map scale sync
*/
this
.
lastMapSyncScale_
=
0
;
/**
* Timestamp of the last map compare scale sync
*/
this
.
lastCompareMapSyncScale_
=
0
;
/**
/**
* @type {ol.Map}
* @type {ol.Map}
* @private
* @private
...
@@ -547,24 +567,30 @@ nsVmap.MapCompare.prototype.mapCompareController.prototype.startAnimation = func
...
@@ -547,24 +567,30 @@ nsVmap.MapCompare.prototype.mapCompareController.prototype.startAnimation = func
this
.
animationDelay
.
start
();
this
.
animationDelay
.
start
();
};
};
/**
/**
* Update the map size with animation
* Update the map size with animation
* @returns {undefined}
* @returns {undefined}
*/
*/
nsVmap
.
MapCompare
.
prototype
.
mapCompareController
.
prototype
.
synchronizeMap
=
function
()
{
nsVmap
.
MapCompare
.
prototype
.
mapCompareController
.
prototype
.
synchronizeMap
=
function
()
{
oVmap
.
log
(
'
nsVmap.MapCompare.prototype.mapCompareController.prototype.synchronizeMap
'
);
oVmap
.
log
(
'
nsVmap.MapCompare.prototype.mapCompareController.prototype.synchronizeMap
'
);
var
this_
=
this
;
var
this_
=
this
;
// blocage infinite loop
// Synchro Échelle
oVmap
.
getMap
().
getOLMap
().
getTargetElement
().
addEventListener
(
'
mouseenter
'
,
function
(){
oVmap
.
getMap
().
getOLMap
().
getTargetElement
().
addEventListener
(
'
mouseenter
'
,
function
(){
oVmap
.
getMap
().
getOLMap
().
getView
().
on
(
"
change:resolution
"
,
this_
.
updateCompareScaleMap
,
this_
);
oVmap
.
getMap
().
getOLMap
().
on
(
"
moveend
"
,
this_
.
updateCompareScaleMap
,
this_
);
this_
.
map
.
getView
().
un
(
"
change:resolution
"
,
this_
.
updateScaleMap
,
this_
);
this_
.
map
.
un
(
"
moveend
"
,
this_
.
updateScaleMap
,
this_
);
});
});
this_
.
map
.
getTargetElement
().
addEventListener
(
'
mouseenter
'
,
function
(){
this_
.
map
.
getTargetElement
().
addEventListener
(
'
mouseenter
'
,
function
(){
oVmap
.
getMap
().
getOLMap
().
getView
().
un
(
"
change:resolution
"
,
this_
.
updateCompareScaleMap
,
this_
);
oVmap
.
getMap
().
getOLMap
().
un
(
"
moveend
"
,
this_
.
updateCompareScaleMap
,
this_
);
this_
.
map
.
getView
().
on
(
"
change:resolution
"
,
this_
.
updateScaleMap
,
this_
);
this_
.
map
.
on
(
"
moveend
"
,
this_
.
updateScaleMap
,
this_
);
});
});
// position du curseur sur l'autre carte
// Synchro centre
oVmap
.
getMap
().
getOLMap
().
on
(
"
pointerdrag
"
,
this_
.
updateCenterCompareMap
,
this_
);
this_
.
map
.
on
(
"
pointerdrag
"
,
this_
.
updateCenterMap
,
this_
);
// Synchro curseur sur l'autre carte
oVmap
.
getMap
().
getOLMap
().
on
(
'
pointermove
'
,
function
(
e
){
oVmap
.
getMap
().
getOLMap
().
on
(
'
pointermove
'
,
function
(
e
){
var
coord
=
e
.
coordinate
;
var
coord
=
e
.
coordinate
;
//si le composant existe sur l'autre composant on le supprime
//si le composant existe sur l'autre composant on le supprime
...
@@ -623,50 +649,58 @@ nsVmap.MapCompare.prototype.mapCompareController.prototype.synchronizeMap = func
...
@@ -623,50 +649,58 @@ nsVmap.MapCompare.prototype.mapCompareController.prototype.synchronizeMap = func
this_
.
targetOverlay_
.
setPosition
(
convertCoord
);
this_
.
targetOverlay_
.
setPosition
(
convertCoord
);
});
});
// synchro de la carte avec la carte de comparaison
oVmap
.
getMap
().
getOLMap
().
on
(
"
pointerdrag
"
,
this_
.
updateCenterCompareMap
,
this_
);
// synchro de la carte de comapraison avec la carte de base
this_
.
map
.
on
(
"
pointerdrag
"
,
this_
.
updateCenterMap
,
this_
);
};
};
/**
/**
* Update the map extent with animation
* Update the map extent with animation
* @returns {undefined}
* @returns {undefined}
*/
*/
nsVmap
.
MapCompare
.
prototype
.
mapCompareController
.
prototype
.
updateCompareScaleMap
=
function
(
e
){
nsVmap
.
MapCompare
.
prototype
.
mapCompareController
.
prototype
.
updateCompareScaleMap
=
function
(
e
)
{
console
.
log
(
'
updateCompareScaleMap
'
);
var
this_
=
this
var
this_
=
this
this_
.
updateCenterCompareMap
();
this_
.
updateCenterCompareMap
();
oVmap
.
getMapCompare
().
setScale
(
oVmap
.
getMap
().
getScale
());
oVmap
.
getMapCompare
().
setScale
(
oVmap
.
getMap
().
getScale
());
this
.
lastCompareMapSyncScale_
=
Date
.
now
();
}
}
/**
/**
* Update the map extent with animation
* Update the map extent with animation
* @returns {undefined}
* @returns {undefined}
*/
*/
nsVmap
.
MapCompare
.
prototype
.
mapCompareController
.
prototype
.
updateScaleMap
=
function
(
e
){
nsVmap
.
MapCompare
.
prototype
.
mapCompareController
.
prototype
.
updateScaleMap
=
function
(
e
)
{
console
.
log
(
'
updateScaleMap
'
);
var
this_
=
this
var
this_
=
this
this_
.
updateCenterMap
();
this_
.
updateCenterMap
();
oVmap
.
getMap
().
setScale
(
oVmap
.
getMapCompare
().
getScale
())
oVmap
.
getMap
().
setScale
(
oVmap
.
getMapCompare
().
getScale
());
this
.
lastMapSyncScale_
=
Date
.
now
();
}
}
/**
/**
* Update the map extent with animation
* Update the map extent with animation
* @returns {undefined}
* @returns {undefined}
*/
*/
nsVmap
.
MapCompare
.
prototype
.
mapCompareController
.
prototype
.
updateCenterMap
=
function
(
e
){
nsVmap
.
MapCompare
.
prototype
.
mapCompareController
.
prototype
.
updateCenterMap
=
function
(
e
)
{
var
this_
=
this
// Récupère l'étendue de la carte principale
var
this_
=
this
var
oldCenter
=
this_
.
map
.
getView
().
getCenter
();
// Récupère l'étendue de la carte principale
var
oldCenter
=
this_
.
map
.
getView
().
getCenter
();
// Récupère l'ancienne et la nouvelle projection
// Récupère l'ancienne et la nouvelle projection
var
newProjection
=
oVmap
.
getMap
().
getOLMap
().
getView
().
getProjection
().
getCode
();
var
newProjection
=
oVmap
.
getMap
().
getOLMap
().
getView
().
getProjection
().
getCode
();
var
oldProjection
=
this_
.
map
.
getView
().
getProjection
().
getCode
();
var
oldProjection
=
this_
.
map
.
getView
().
getProjection
().
getCode
();
var
newCenter
=
ol
.
proj
.
transform
(
oldCenter
,
oldProjection
,
newProjection
);
var
newCenter
=
ol
.
proj
.
transform
(
oldCenter
,
oldProjection
,
newProjection
);
oVmap
.
getMap
().
getOLMap
().
getView
().
setCenter
(
newCenter
);
oVmap
.
getMap
().
getOLMap
().
getView
().
setCenter
(
newCenter
);
this
.
lastMapSyncCenter_
=
Date
.
now
();
}
}
/**
/**
* Update the map extent with animation
* Update the map extent with animation
* @returns {undefined}
* @returns {undefined}
*/
*/
nsVmap
.
MapCompare
.
prototype
.
mapCompareController
.
prototype
.
updateCenterCompareMap
=
function
(
e
){
nsVmap
.
MapCompare
.
prototype
.
mapCompareController
.
prototype
.
updateCenterCompareMap
=
function
(
e
)
{
var
this_
=
this
;
var
this_
=
this
;
// Récupère l'étendue de la carte principale
// Récupère l'étendue de la carte principale
var
oldCenter
=
oVmap
.
getMap
().
getOLMap
().
getView
().
getCenter
();
var
oldCenter
=
oVmap
.
getMap
().
getOLMap
().
getView
().
getCenter
();
...
@@ -677,6 +711,8 @@ nsVmap.MapCompare.prototype.mapCompareController.prototype.updateCenterCompareMa
...
@@ -677,6 +711,8 @@ nsVmap.MapCompare.prototype.mapCompareController.prototype.updateCenterCompareMa
var
newCenter
=
ol
.
proj
.
transform
(
oldCenter
,
oldProjection
,
newProjection
);
var
newCenter
=
ol
.
proj
.
transform
(
oldCenter
,
oldProjection
,
newProjection
);
this_
[
'
map
'
].
getView
().
setCenter
(
newCenter
);
this_
[
'
map
'
].
getView
().
setCenter
(
newCenter
);
this
.
lastCompareMapSyncCenter_
=
Date
.
now
();
}
}
/**
/**
...
...
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