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
206ca7b6
Commit
206ca7b6
authored
Jan 31, 2019
by
Sergio Adrian Gongora Euan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added to draw polygon of the selected products
parent
4e827166
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
24 deletions
+35
-24
dataRetrieval.js
catalog/static/catalog/js/dataRetrieval.js
+13
-11
openLayers4.js
catalog/static/catalog/js/openLayers4.js
+22
-13
No files found.
catalog/static/catalog/js/dataRetrieval.js
View file @
206ca7b6
...
@@ -114,7 +114,7 @@ $("#id_polygon").on('keyup', function (e) {
...
@@ -114,7 +114,7 @@ $("#id_polygon").on('keyup', function (e) {
// this function cleans list of available products
// this function cleans list of available products
function
erase_product_list_globe
()
{
function
erase_product_list_globe
()
{
prevfeature
=
n
ull
;
prevfeature
=
n
ew
Map
()
;
var
pol_element
=
document
.
getElementById
(
'product-list-globe'
);
var
pol_element
=
document
.
getElementById
(
'product-list-globe'
);
while
(
pol_element
.
firstChild
)
{
while
(
pol_element
.
firstChild
)
{
pol_element
.
removeChild
(
pol_element
.
firstChild
);
pol_element
.
removeChild
(
pol_element
.
firstChild
);
...
@@ -140,21 +140,23 @@ function erase_product_list_cart() {
...
@@ -140,21 +140,23 @@ function erase_product_list_cart() {
}
}
var
prevfeature
=
n
ull
;
var
prevfeature
=
n
ew
Map
()
;
function
drawApiResponse
(
element
)
{
function
drawApiResponse
(
element
)
{
var
list_globe
=
document
.
getElementById
(
'product-list-globe'
).
children
;
for
(
var
i
=
0
;
i
<
list_globe
.
length
;
i
++
)
{
var
listElement
=
list_globe
[
i
];
listElement
.
style
.
textDecoration
=
'none'
;
}
for
(
var
i
=
0
;
i
<
product_list
.
catalog
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
product_list
.
catalog
.
length
;
i
++
)
{
var
data
=
product_list
.
catalog
[
i
];
var
data
=
product_list
.
catalog
[
i
];
if
(
data
.
uuid
===
element
.
id
.
replace
(
"-li"
,
''
))
{
if
(
data
.
uuid
===
element
.
id
.
replace
(
"-li"
,
''
))
{
element
.
style
.
textDecoration
=
'underline'
;
console
.
log
(
"footprint:
\n
"
,
data
.
product
.
footprint
);
console
.
log
(
"footprint:
\n
"
,
data
.
product
.
footprint
);
prevfeature
=
osmap
.
addfootprint
(
data
.
product
.
footprint
,
prevfeature
);
if
(
!
prevfeature
.
has
(
data
.
uuid
)){
element
.
style
.
textDecoration
=
'underline'
;
prevfeature
.
set
(
data
.
uuid
,
osmap
.
addfootprint
(
data
.
product
.
footprint
,
prevfeature
));
}
else
{
if
(
prevfeature
.
length
!=
0
){
element
.
style
.
textDecoration
=
'none'
;
osmap
.
deletefootprint
(
prevfeature
.
get
(
data
.
uuid
));
prevfeature
.
delete
(
data
.
uuid
);
}
}
}
}
}
}
}
}
...
...
catalog/static/catalog/js/openLayers4.js
View file @
206ca7b6
...
@@ -121,12 +121,13 @@ OpenStreetMapsClass.prototype.addWKTPolygon = function(wkt)
...
@@ -121,12 +121,13 @@ OpenStreetMapsClass.prototype.addWKTPolygon = function(wkt)
document
.
getElementById
(
"id_polygon"
).
value
=
wkt
;
document
.
getElementById
(
"id_polygon"
).
value
=
wkt
;
}
}
OpenStreetMapsClass
.
prototype
.
addfootprint
=
function
(
wkt
,
prevFeature
)
OpenStreetMapsClass
.
prototype
.
deletefootprint
=
function
(
prevFeature
)
{
{
if
(
prevFeature
){
if
(
prevFeature
)
{
this
.
vectorLayer
.
getSource
().
removeFeature
(
prevFeature
);
this
.
vectorLayer
.
getSource
().
removeFeature
(
prevFeature
);
}
}
}
OpenStreetMapsClass
.
prototype
.
addfootprint
=
function
(
wkt
,
prevFeature
){
var
format
=
new
ol
.
format
.
WKT
();
var
format
=
new
ol
.
format
.
WKT
();
var
feature
=
format
.
readFeature
(
wkt
,
{
var
feature
=
format
.
readFeature
(
wkt
,
{
...
@@ -136,7 +137,7 @@ OpenStreetMapsClass.prototype.addfootprint = function(wkt, prevFeature)
...
@@ -136,7 +137,7 @@ OpenStreetMapsClass.prototype.addfootprint = function(wkt, prevFeature)
var
style
=
new
ol
.
style
.
Style
({
var
style
=
new
ol
.
style
.
Style
({
stroke
:
new
ol
.
style
.
Stroke
({
stroke
:
new
ol
.
style
.
Stroke
({
color
:
'#dc7828'
,
color
:
getRandomColor
()
,
width
:
1
width
:
1
}),
}),
fill
:
new
ol
.
style
.
Fill
({
fill
:
new
ol
.
style
.
Fill
({
...
@@ -263,3 +264,11 @@ OpenStreetMapsClass.prototype.iconStyle = function(url,x,y)
...
@@ -263,3 +264,11 @@ OpenStreetMapsClass.prototype.iconStyle = function(url,x,y)
}
}
function
getRandomColor
()
{
var
letters
=
'0123456789ABCDEF'
;
var
color
=
'#'
;
for
(
var
i
=
0
;
i
<
6
;
i
++
)
{
color
+=
letters
[
Math
.
floor
(
Math
.
random
()
*
16
)];
}
return
color
;
}
\ No newline at end of file
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