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
17244ee6
Commit
17244ee6
authored
May 23, 2018
by
Emmanuel René Huchim Puc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove prev layes
parent
ec886ca4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
21 deletions
+22
-21
openLayers4.js
catalog/static/js/openLayers4.js
+1
-1
sidtMap.js
catalog/static/js/sidtMap.js
+21
-20
No files found.
catalog/static/js/openLayers4.js
View file @
17244ee6
...
@@ -94,7 +94,7 @@ OpenStreetMapsClass.prototype.addPolygon = function(coords)
...
@@ -94,7 +94,7 @@ OpenStreetMapsClass.prototype.addPolygon = function(coords)
polyCoords
.
push
(
ol
.
proj
.
fromLonLat
([
parseFloat
(
c
[
0
]),
parseFloat
(
c
[
1
])],
'EPSG:3857'
,
'EPSG:4326'
));
polyCoords
.
push
(
ol
.
proj
.
fromLonLat
([
parseFloat
(
c
[
0
]),
parseFloat
(
c
[
1
])],
'EPSG:3857'
,
'EPSG:4326'
));
}
}
//
todo: remove older features in map, if there is a feature
//
remove previous layers
this
.
vectorLayer
.
getSource
().
clear
();
this
.
vectorLayer
.
getSource
().
clear
();
// create feature
// create feature
...
...
catalog/static/js/sidtMap.js
View file @
17244ee6
...
@@ -89,10 +89,16 @@ function sidtMap(divID, lng, lat, z)
...
@@ -89,10 +89,16 @@ function sidtMap(divID, lng, lat, z)
var
self
=
this
;
var
self
=
this
;
this
.
features
=
new
ol
.
Collection
();
this
.
features
=
new
ol
.
Collection
();
this
.
interaction
=
new
ol
.
interaction
.
Draw
({
features
:
this
.
features
,
type
:
"Polygon"
});
this
.
interaction
=
new
ol
.
interaction
.
Draw
({
features
:
this
.
features
,
type
:
"Polygon"
});
this
.
tempFeature
=
null
;
var
style
=
new
ol
.
style
.
Style
({
stroke
:
new
ol
.
style
.
Stroke
({
color
:
'rgba(0,0,100,0.8)'
,
width
:
2
}),
var
style
=
new
ol
.
style
.
Style
({
fill
:
new
ol
.
style
.
Fill
({
color
:
'rgba(0,100,200,0.5)'
})
});
stroke
:
new
ol
.
style
.
Stroke
({
color
:
'rgba(0,0,100,0.8)'
,
width
:
2
}),
fill
:
new
ol
.
style
.
Fill
({
color
:
'rgba(0,100,200,0.5)'
})
});
this
.
map
.
on
(
"moveend"
,
function
(
e
){
self
.
onMapMove
(
e
)});
this
.
map
.
on
(
"moveend"
,
function
(
e
){
self
.
onMapMove
(
e
)});
this
.
map
.
on
(
"pointerdrag"
,
function
(
e
){
self
.
onDrag
(
e
)});
this
.
map
.
on
(
"pointerdrag"
,
function
(
e
){
self
.
onDrag
(
e
)});
...
@@ -104,26 +110,21 @@ sidtMap.prototype = Object.create( OpenStreetMapsClass.prototype );
...
@@ -104,26 +110,21 @@ sidtMap.prototype = Object.create( OpenStreetMapsClass.prototype );
sidtMap
.
prototype
.
addInteraction
=
function
()
sidtMap
.
prototype
.
addInteraction
=
function
()
{
{
var
self
=
this
;
var
self
=
this
;
this
.
interaction
=
new
ol
.
interaction
.
Draw
({
this
.
interaction
=
new
ol
.
interaction
.
Draw
({
source
:
this
.
vectorLayer
.
getSource
(),
source
:
this
.
vectorLayer
.
getSource
(),
features
:
this
.
features
,
features
:
this
.
features
,
type
:
"Polygon"
type
:
"Polygon"
});
});
this
.
interaction
.
on
(
"drawend"
,
function
(
e
){
this
.
interaction
.
on
(
"drawend"
,
function
(
e
){
document
.
getElementById
(
"id_polygon"
).
value
=
e
.
feature
.
getGeometry
().
clone
().
transform
(
'EPSG:3857'
,
'EPSG:4326'
).
getCoordinates
();
document
.
getElementById
(
"id_polygon"
).
value
=
e
.
feature
.
getGeometry
().
clone
().
transform
(
'EPSG:3857'
,
'EPSG:4326'
).
getCoordinates
();
});
self
.
tempFeature
=
e
.
feature
;
}
);
this
.
interaction
.
on
(
"drawstart"
,
function
(
e
){
this
.
interaction
.
on
(
"drawstart"
,
function
(
e
){
if
(
self
.
tempFeature
!=
null
)
self
.
vectorLayer
.
getSource
().
clear
();
{
});
self
.
vectorLayer
.
getSource
().
removeFeature
(
self
.
tempFeature
);
}
}
);
this
.
map
.
addInteraction
(
this
.
interaction
);
this
.
map
.
addInteraction
(
this
.
interaction
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
...
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