Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
72ad25cd
Commit
72ad25cd
authored
Jun 03, 2019
by
Ulises Morales Ramírez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix report
parent
492f3714
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
207 additions
and
200 deletions
+207
-200
minimap.js
reports/static/reports/js/minimap.js
+207
-200
No files found.
reports/static/reports/js/minimap.js
View file @
72ad25cd
...
@@ -13,7 +13,7 @@ const polygonFeature = wktFormat.readFeature(polygon, {
...
@@ -13,7 +13,7 @@ const polygonFeature = wktFormat.readFeature(polygon, {
const
light
=
new
ol
.
layer
.
Tile
({
const
light
=
new
ol
.
layer
.
Tile
({
name
:
'mapbox'
,
name
:
'mapbox'
,
source
:
new
ol
.
source
.
XYZ
({
source
:
new
ol
.
source
.
XYZ
({
url
:
'https://api.tiles.mapbox.com/v4/mapbox.light/{z}/{x}/{y}.png?access_token='
+
MAPBOX_ACCESS_TOKEN
url
:
'https://api.tiles.mapbox.com/v4/mapbox.light/{z}/{x}/{y}.png?access_token='
+
MAPBOX_ACCESS_TOKEN
})
})
});
});
...
@@ -48,7 +48,7 @@ const map = new ol.Map({
...
@@ -48,7 +48,7 @@ const map = new ol.Map({
view
:
new
ol
.
View
({
view
:
new
ol
.
View
({
center
:
ol
.
proj
.
fromLonLat
([
-
99.19
,
19.61
]),
center
:
ol
.
proj
.
fromLonLat
([
-
99.19
,
19.61
]),
zoom
:
4
,
zoom
:
4
,
minZoom
:
4
minZoom
:
4
})
})
});
});
...
@@ -94,7 +94,7 @@ function changeLayers(especific_layerName) {
...
@@ -94,7 +94,7 @@ function changeLayers(especific_layerName) {
name
:
layerName
,
name
:
layerName
,
source
:
new
ol
.
source
.
XYZ
({
source
:
new
ol
.
source
.
XYZ
({
projection
:
'EPSG:3857'
,
projection
:
'EPSG:3857'
,
url
:
'/reports/tiles/'
+
purchase_id
+
'/'
+
zone
+
'/'
+
layerName
+
'/'
+
currentDate
+
'/{z}/{x}/{-y}.png'
,
url
:
'/reports/tiles/'
+
purchase_id
+
'/'
+
zone
+
'/'
+
layerName
+
'/'
+
currentDate
+
'/{z}/{x}/{-y}.png'
,
tilePixelRatio
:
2
tilePixelRatio
:
2
})
})
});
});
...
@@ -112,7 +112,9 @@ function changeLayers(especific_layerName) {
...
@@ -112,7 +112,9 @@ function changeLayers(especific_layerName) {
// remove all if there isn't layername
// remove all if there isn't layername
function
removeLayer
(
layerName
)
{
function
removeLayer
(
layerName
)
{
if
(
!
layerName
)
{
if
(
!
layerName
)
{
layers
.
forEach
(
layer
=>
{
map
.
removeLayer
(
layer
);
});
layers
.
forEach
(
layer
=>
{
map
.
removeLayer
(
layer
);
});
layers
.
clear
();
layers
.
clear
();
return
;
return
;
}
}
...
@@ -124,7 +126,7 @@ function removeLayer(layerName) {
...
@@ -124,7 +126,7 @@ function removeLayer(layerName) {
// set opacity to layers
// set opacity to layers
function
setOpacity
(
value
)
{
function
setOpacity
(
value
)
{
layers
.
forEach
(
layer
=>
{
layers
.
forEach
(
layer
=>
{
if
(
layer
.
get
(
'name'
)
!=
'TCI'
)
{
if
(
layer
.
get
(
'name'
)
!=
'TCI'
)
{
layer
.
setOpacity
(
value
)
layer
.
setOpacity
(
value
)
}
}
})
})
...
@@ -136,16 +138,16 @@ function setOpacity(value) {
...
@@ -136,16 +138,16 @@ function setOpacity(value) {
//vigila cuando se cierra el menu de comparar y cuando se cierra desactiva la comparacion (si la clase de compare incluye menu-open está abierto)
//vigila cuando se cierra el menu de comparar y cuando se cierra desactiva la comparacion (si la clase de compare incluye menu-open está abierto)
var
compareMenu
=
document
.
getElementById
(
'compare'
);
var
compareMenu
=
document
.
getElementById
(
'compare'
);
var
observer
=
new
MutationObserver
(
function
(
mutations
)
{
var
observer
=
new
MutationObserver
(
function
(
mutations
)
{
mutations
.
forEach
(
function
(
mutation
)
{
mutations
.
forEach
(
function
(
mutation
)
{
if
(
mutation
.
attributeName
==
'class'
)
{
if
(
mutation
.
attributeName
==
'class'
)
{
if
(
compareMenu
.
className
.
indexOf
(
"open"
)
===
-
1
)
{
//se cerró el menu de comparacion
if
(
compareMenu
.
className
.
indexOf
(
"open"
)
===
-
1
)
{
//se cerró el menu de comparacion
exitCompare
();
exitCompare
();
}
}
}
}
});
});
});
});
observer
.
observe
(
compareMenu
,
{
attributes
:
true
,
attributeOldValue
:
true
,
attributeFilter
:
[
'class'
],
subtree
:
true
});
observer
.
observe
(
compareMenu
,
{
attributes
:
true
,
attributeOldValue
:
true
,
attributeFilter
:
[
'class'
],
subtree
:
true
});
//crea el control swipe, que sirve para comparar
//crea el control swipe, que sirve para comparar
var
ctrl
=
new
ol
.
control
.
Swipe
();
var
ctrl
=
new
ol
.
control
.
Swipe
();
...
@@ -156,12 +158,12 @@ function compare(labels) {
...
@@ -156,12 +158,12 @@ function compare(labels) {
var
swipeControl
=
false
;
var
swipeControl
=
false
;
map
.
getControls
().
forEach
(
function
(
control
)
{
//checa si ya se añadio el control de comparacion (swipe), si no lo tiene, lo agrega
map
.
getControls
().
forEach
(
function
(
control
)
{
//checa si ya se añadio el control de comparacion (swipe), si no lo tiene, lo agrega
if
(
control
instanceof
ol
.
control
.
Swipe
)
{
//si ya tiene el control agregado
if
(
control
instanceof
ol
.
control
.
Swipe
)
{
//si ya tiene el control agregado
swipeControl
=
true
;
swipeControl
=
true
;
}
}
});
});
if
(
swipeControl
==
true
)
{
//si ya tiene el comparador no hace nada, ya esta en modo comparacion
if
(
swipeControl
==
true
)
{
//si ya tiene el comparador no hace nada, ya esta en modo comparacion
//map.removeControl(swipeControlObj);
//map.removeControl(swipeControlObj);
}
else
{
//si no tiene el comparador lo agrega
}
else
{
//si no tiene el comparador lo agrega
//removeImageLayers();
//removeImageLayers();
...
@@ -169,11 +171,14 @@ function compare(labels) {
...
@@ -169,11 +171,14 @@ function compare(labels) {
ctrl
.
set
(
'position'
,
0.5
);
ctrl
.
set
(
'position'
,
0.5
);
//console.log(map.controls)
//console.log(map.controls)
var
labelDateLeft
=
labels
[
0
]
//por default compara la primera y ultima fecha
var
labelDateLeft
=
labels
[
0
]
//por default compara la primera y ultima fecha
var
labelDateRight
=
labels
[
labels
.
length
-
1
]
var
labelDateRight
=
labels
[
labels
.
length
-
1
]
//pone las fechas por default en los selectores de fechas
//pone las fechas por default en los selectores de fechas
document
.
getElementById
(
"selectLeftCompare"
).
value
=
labelDateLeft
;
//
document.getElementById("selectLeftCompare").value = labelDateLeft;
document
.
getElementById
(
"selectRightCompare"
).
value
=
labelDateRight
;
//
document.getElementById("selectRightCompare").value = labelDateRight;
//agrega las capas izquierda/derecha
//agrega las capas izquierda/derecha
selectLeft
(
labelDateLeft
);
selectLeft
(
labelDateLeft
);
...
@@ -183,13 +188,14 @@ function compare(labels) {
...
@@ -183,13 +188,14 @@ function compare(labels) {
document
.
getElementById
(
"selectLeft"
).
style
.
display
=
"block"
;
document
.
getElementById
(
"selectLeft"
).
style
.
display
=
"block"
;
document
.
getElementById
(
"selectRight"
).
style
.
display
=
"block"
;
document
.
getElementById
(
"selectRight"
).
style
.
display
=
"block"
;
document
.
getElementById
(
"timeLine"
).
style
.
display
=
"none"
;
document
.
getElementById
(
"timeLine"
).
style
.
display
=
"none"
;
}
}
}
}
//sale del modo comparacion
//sale del modo comparacion
function
exitCompare
()
{
function
exitCompare
()
{
map
.
getControls
().
forEach
(
function
(
control
)
{
//checa si ya se añadio el control de comparacion (swipe)
map
.
getControls
().
forEach
(
function
(
control
)
{
//checa si ya se añadio el control de comparacion (swipe)
if
(
control
instanceof
ol
.
control
.
Swipe
)
{
//ya tiene el control agregado lo quita
if
(
control
instanceof
ol
.
control
.
Swipe
)
{
//ya tiene el control agregado lo quita
map
.
removeControl
(
control
);
map
.
removeControl
(
control
);
}
}
});
});
...
@@ -197,7 +203,7 @@ function exitCompare() {
...
@@ -197,7 +203,7 @@ function exitCompare() {
//quita las capas de comparacion izquierda/derecha
//quita las capas de comparacion izquierda/derecha
var
imageLayers
=
map
.
getLayers
().
getArray
().
slice
();
var
imageLayers
=
map
.
getLayers
().
getArray
().
slice
();
imageLayers
.
forEach
(
layer
=>
{
imageLayers
.
forEach
(
layer
=>
{
if
(
layer
.
get
(
'name'
)
===
'left'
||
layer
.
get
(
'name'
)
===
'right'
)
{
if
(
layer
.
get
(
'name'
)
===
'left'
||
layer
.
get
(
'name'
)
===
'right'
)
{
map
.
removeLayer
(
layer
)
map
.
removeLayer
(
layer
)
}
}
})
})
...
@@ -218,7 +224,7 @@ function selectLeft(date) {
...
@@ -218,7 +224,7 @@ function selectLeft(date) {
opacity
:
1
,
opacity
:
1
,
source
:
new
ol
.
source
.
XYZ
({
source
:
new
ol
.
source
.
XYZ
({
projection
:
'EPSG:3857'
,
projection
:
'EPSG:3857'
,
url
:
'/reports/tiles/'
+
purchase_id
+
'/'
+
zone
+
'/'
+
layer_type
+
'/'
+
labelDateLeft
+
'/{z}/{x}/{-y}.png'
,
url
:
'/reports/tiles/'
+
purchase_id
+
'/'
+
zone
+
'/'
+
layer_type
+
'/'
+
labelDateLeft
+
'/{z}/{x}/{-y}.png'
,
tilePixelRatio
:
2
,
tilePixelRatio
:
2
,
minZoom
:
10
,
minZoom
:
10
,
maxZoom
:
15
maxZoom
:
15
...
@@ -229,7 +235,7 @@ function selectLeft(date) {
...
@@ -229,7 +235,7 @@ function selectLeft(date) {
}
}
//selecciona el lado derecho para comparar
//selecciona el lado derecho para comparar
function
selectRight
(
date
){
function
selectRight
(
date
)
{
console
.
log
(
"---------"
);
console
.
log
(
"---------"
);
console
.
log
(
date
)
console
.
log
(
date
)
console
.
log
(
"---------"
);
console
.
log
(
"---------"
);
...
@@ -240,7 +246,7 @@ function selectRight(date){
...
@@ -240,7 +246,7 @@ function selectRight(date){
opacity
:
1
,
opacity
:
1
,
source
:
new
ol
.
source
.
XYZ
({
source
:
new
ol
.
source
.
XYZ
({
projection
:
'EPSG:3857'
,
projection
:
'EPSG:3857'
,
url
:
'/reports/tiles/'
+
purchase_id
+
'/'
+
zone
+
'/'
+
layer_type
+
'/'
+
labelDateRight
+
'/{z}/{x}/{-y}.png'
,
url
:
'/reports/tiles/'
+
purchase_id
+
'/'
+
zone
+
'/'
+
layer_type
+
'/'
+
labelDateRight
+
'/{z}/{x}/{-y}.png'
,
tilePixelRatio
:
2
,
tilePixelRatio
:
2
,
minZoom
:
10
,
minZoom
:
10
,
maxZoom
:
15
maxZoom
:
15
...
@@ -251,21 +257,22 @@ function selectRight(date){
...
@@ -251,21 +257,22 @@ function selectRight(date){
}
}
//selecciona comparacion vertical u horizontal
//selecciona comparacion vertical u horizontal
function
setCompareDirection
(
direction
){
function
setCompareDirection
(
direction
)
{
ctrl
.
set
(
'orientation'
,
direction
)
ctrl
.
set
(
'orientation'
,
direction
)
//mueve los selectores de fechas
//mueve los selectores de fechas
if
(
direction
===
'horizontal'
)
{
if
(
direction
===
'horizontal'
)
{
document
.
getElementById
(
"selectLeft"
).
style
.
bottom
=
"70%"
;
document
.
getElementById
(
"selectLeft"
).
style
.
bottom
=
"70%"
;
document
.
getElementById
(
"selectLeft"
).
style
.
left
=
"15%"
;
document
.
getElementById
(
"selectLeft"
).
style
.
left
=
"15%"
;
document
.
getElementById
(
"selectRight"
).
style
.
left
=
"15%"
;
document
.
getElementById
(
"selectRight"
).
style
.
left
=
"15%"
;
}
}
else
{
else
{
document
.
getElementById
(
"selectLeft"
).
style
.
bottom
=
"50px"
;
document
.
getElementById
(
"selectLeft"
).
style
.
bottom
=
"50px"
;
document
.
getElementById
(
"selectLeft"
).
style
.
left
=
"30%"
;
document
.
getElementById
(
"selectLeft"
).
style
.
left
=
"30%"
;
document
.
getElementById
(
"selectRight"
).
style
.
left
=
"75%"
;
document
.
getElementById
(
"selectRight"
).
style
.
left
=
"75%"
;
}
}
}
}
// Fin funciones de comparacion
// Fin funciones de comparacion
//******************************
//******************************
...
@@ -295,7 +302,7 @@ function changeMap(selectedMap) {
...
@@ -295,7 +302,7 @@ function changeMap(selectedMap) {
}
}
}
}
function
showControlMap
(){
function
showControlMap
()
{
if
(
$
(
'#showControlMap'
).
is
(
':visible'
))
{
if
(
$
(
'#showControlMap'
).
is
(
':visible'
))
{
$
(
"#showControlMap"
).
hide
();
$
(
"#showControlMap"
).
hide
();
$
(
"#hideControlMap"
).
show
();
$
(
"#hideControlMap"
).
show
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment