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
52fbd4ad
Commit
52fbd4ad
authored
May 29, 2018
by
Emmanuel René Huchim Puc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
draw footprint
parent
c5a3ec78
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
2 deletions
+43
-2
dataRetrieval.js
catalog/static/js/dataRetrieval.js
+11
-2
openLayers4.js
catalog/static/js/openLayers4.js
+32
-0
No files found.
catalog/static/js/dataRetrieval.js
View file @
52fbd4ad
...
...
@@ -43,6 +43,7 @@
var
OPT_LIST_IS_HIDDEN
=
true
;
var
INPUT_ON_FOCUS
=
false
;
var
polygonList
;
var
product_list
=
[]
var
makeRequest
=
function
(
value
)
{
var
pol_element
=
document
.
getElementById
(
'polygon-list'
);
...
...
@@ -118,6 +119,15 @@ function drawPolygon(element) {
})
}
var
prevfeature
=
null
;
function
drawApiResponse
(
element
)
{
product_list
.
catalog
.
forEach
(
function
(
data
)
{
if
(
data
.
id
===
element
.
id
)
{
// osmap.removePolygon();
prevfeature
=
osmap
.
addfootprint
(
data
.
product
.
footprint
,
prevfeature
);
}
})
}
$
(
'#ajax-input'
).
focus
(
function
()
{
console
.
log
(
'in'
);
...
...
@@ -182,7 +192,6 @@ $(document).ready(function () {
var
productListGlobe
=
[];
// this array represent DB where products will be stored
var
PRODUCT_IN_LIST
=
false
;
var
product_list
=
[]
// function for making POST request to productList in view.py
$
(
'#product-form'
).
submit
(
function
(
event
)
{
...
...
@@ -226,7 +235,7 @@ $(document).ready(function () {
}
});
var
product_html
=
'<li id="'
+
data
.
id
+
' class="hover-me">'
+
var
product_html
=
'<li id="'
+
data
.
id
+
'
" onclick="drawApiResponse(this)"
class="hover-me">'
+
'<a href="javascript:void(0)">'
+
'<i class="menu-icon glyphicon glyphicon-bookmark bg-red"></i>'
+
'<div class="menu-info">'
+
...
...
catalog/static/js/openLayers4.js
View file @
52fbd4ad
...
...
@@ -120,6 +120,38 @@ OpenStreetMapsClass.prototype.addWKTPolygon = function(wkt)
document
.
getElementById
(
"id_polygon"
).
value
=
wkt
;
}
OpenStreetMapsClass
.
prototype
.
addfootprint
=
function
(
wkt
,
prevFeature
)
{
if
(
prevFeature
)
{
this
.
vectorLayer
.
getSource
().
removeFeature
(
prevFeature
);
}
var
format
=
new
ol
.
format
.
WKT
();
var
feature
=
format
.
readFeature
(
wkt
,
{
dataProjection
:
'EPSG:4326'
,
featureProjection
:
'EPSG:3857'
});
var
style
=
new
ol
.
style
.
Style
({
stroke
:
new
ol
.
style
.
Stroke
({
color
:
'#dc7828'
,
width
:
1
}),
fill
:
new
ol
.
style
.
Fill
({
color
:
'rgba(255,255,0,0.1)'
})
})
feature
.
setStyle
(
style
);
this
.
map
.
getView
().
fit
(
feature
.
getGeometry
(),
{
duration
:
1000
,
padding
:
[
0
,
0
,
70
,
0
]});
this
.
vectorLayer
.
getSource
().
addFeature
(
feature
);
return
feature
;
}
//------------------------------------------------------------------------------
/**
* calculate the area of each polygon and return the coords of the biggest polygon
...
...
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