Commit f1909472 authored by Luis Dominguez's avatar Luis Dominguez

Merge branch 'dev' of gitlab.geoint.mx:mario.chirinos/GeoInt_SIDT into dev

parents a02fb58a 79df01e2
......@@ -182,6 +182,23 @@ sidtMap.prototype.changeInteraction = function() {
this.map.addInteraction(this.interaction);
}
// this shit is really hack hahahahah
sidtMap.prototype.listenShiftButton = function() {
inDown = (evt) => {
if (evt.key != "Shift" || evt.keyCode != 16 || this.interaction.geometryFunction_.name === "r") return;
this.interaction.geometryFunction_ = new ol.interaction.Draw.createRegularPolygon(4);
}
inUp = (evt) => {
if (evt.key != "Shift" || evt.keyCode != 16 || this.interaction.geometryFunction_.name === "r") return;
this.interaction.geometryFunction_ = new ol.interaction.Draw.createRegularPolygon(4, Math.PI/4);
};
document.addEventListener('keydown', inDown);
document.addEventListener('keyup', inUp);
}
//------------------------------------------------------------------------------
sidtMap.prototype.onMousemove = function(e)
{
......
......@@ -33,7 +33,8 @@
<link rel="stylesheet" href="{% static 'catalog/adminlte/bower_components/guides-master/dist/guides.css' %}">
</head>
<body class="hold-transition skin-yellow sidebar-mini">
<body style="overflow: hidden;" class="hold-transition skin-yellow sidebar-mini">
<!-- <div id="map" class="map" tabindex="0"> </div>-->
<!-- <iframe id="catalogFrame" name="catalogFrame">my frame</iframe>-->
......
......@@ -368,6 +368,7 @@
var osmap = new sidtMap("map", -89.63873079999999, 21.0404457, 7);
osmap.geolocation();
osmap.addInteraction();
osmap.listenShiftButton();
var req_url = "{% url 'search-submit' %}"; // url for requesting polygon data
var prod_req_url = "{% url 'productList' %}"; // url for requesting product data
......
.cross-range {
input[type=range] {
height: 6px;
-webkit-appearance: none;
margin: 6px 0;
width: 100%;
}
input[type=range]:focus {
outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
width: 100%;
height: 14px;
cursor: pointer;
animate: 0.2s;
box-shadow: 1px 1px 1px #50555C;
background: #50555C;
border-radius: 14px;
border: 0px solid #000000;
}
input[type=range]::-webkit-slider-thumb {
box-shadow: 0px 0px 0px #000000;
border: 0px solid #000000;
height: 20px;
width: 40px;
border-radius: 12px;
background: #dc7828;
cursor: pointer;
-webkit-appearance: none;
margin-top: -3px;
}
input[type=range]:focus::-webkit-slider-runnable-track {
background: #50555C;
}
input[type=range]::-moz-range-track {
width: 100%;
height: 14px;
cursor: pointer;
animate: 0.2s;
box-shadow: 1px 1px 1px #50555C;
background: #50555C;
border-radius: 14px;
border: 0px solid #000000;
}
input[type=range]::-moz-range-thumb {
box-shadow: 0px 0px 0px #000000;
border: 0px solid #000000;
height: 20px;
width: 40px;
border-radius: 12px;
background: #529DE1;
cursor: pointer;
}
input[type=range]::-ms-track {
width: 100%;
height: 14px;
cursor: pointer;
animate: 0.2s;
background: transparent;
border-color: transparent;
color: transparent;
}
input[type=range]::-ms-fill-lower {
background: #50555C;
border: 0px solid #000000;
border-radius: 28px;
box-shadow: 1px 1px 1px #50555C;
}
input[type=range]::-ms-fill-upper {
background: #50555C;
border: 0px solid #000000;
border-radius: 28px;
box-shadow: 1px 1px 1px #50555C;
}
input[type=range]::-ms-thumb {
margin-top: 1px;
box-shadow: 0px 0px 0px #000000;
border: 0px solid #000000;
height: 20px;
width: 40px;
border-radius: 12px;
background: #529DE1;
cursor: pointer;
}
input[type=range]:focus::-ms-fill-lower {
background: #50555C;
}
input[type=range]:focus::-ms-fill-upper {
background: #50555C;
}
/*.cross-range {
-webkit-appearance: none;
width: 100%;
margin: 4.05px 0;
......@@ -89,3 +180,4 @@
padding-left: 10px;
padding-right: 10px;
}
*/
\ No newline at end of file
......@@ -318,4 +318,41 @@ select::-ms-expand {
border-top-color: #ffa74f;
border-width: 11px;
margin-left: -11px;
}
\ No newline at end of file
}
/*progress bar effect*/
/*left and right arrows for slider with font-awesome*/
.fas.fa-chevron-left {
position: absolute;
left: 0;
top: 40%;
margin-left: 5px;
color: rgba(11, 15, 192, 0.3);
font-size: 60px;
z-index: 100;
}
.fas.fa-chevron-right {
position: absolute;
right: 0;
top: 40%;
margin-right: 5px;
color: rgba(11, 15, 192, 0.3);
font-size: 60px;
z-index: 100;
}
.fas.fa-chevron-left:hover{
color: blue;
}
.fas.fa-chevron-right:hover {
color: blue;
}
\ No newline at end of file
......@@ -25,9 +25,6 @@
<script type="text/javascript">
</script>
{% endblock %}
{% block messages %}
......@@ -130,7 +127,7 @@
<br>
<ul class="sidebar-menu" data-widget="tree">
<li>
<a class="treeview " href="{% url 'map' %}">
<a class="treeview " href="{% url 'map' %}">
<i class="fa fa-map"></i>
<span>Home</span>
<span class="pull-right-container">
......@@ -189,11 +186,14 @@
{% for product in productList %}
<tr>
<td>
<a href="#" id="title{{ product.purchase_id }}" data-toggle="popover" data-trigger="hover"
data-content="{% if product.description %}{{ product.description }}{% else %}Without Description{% endif %}"
<a href="#" id="title{{ product.purchase_id }}" data-toggle="popover"
data-trigger="hover"
data-content="
{% if product.description %}{{ product.description }}{% else %}Without Description{% endif %}"
onclick="showMyModalSetTitle('{{ product.search_name }}','{{ product.polygon }}');"> {{ product.search_name }}</a>
<a href="#" onclick="showEditModal('{{ product.search_name }}','{{ product.description }}','{{ product.purchase_id }}')"><span
<a href="#"
onclick="showEditModal('{{ product.search_name }}','{{ product.description }}','{{ product.purchase_id }}')"><span
class="fas fa-pencil-alt"
style="margin:3px 0 0 0"></span></a>
</td>
......@@ -237,14 +237,18 @@
href="../../static/reports/tmpImages/repsat_test_dev/{{ request.user.email }}/{{ product.purchase_id }}/myzip.zip"
{% else %}
href="#"
{% endif %} class="btn btn-warning btn-sm col-md-4 col-xs-4 col-sm-4 col-lg-4 col-xl-4">
{% endif %}
class="btn btn-warning btn-sm col-md-4 col-xs-4 col-sm-4 col-lg-4 col-xl-4">
<i class="fa fa-file-zip-o"></i>
</a>
<a title="Download PDF" {% if product.progress == 100 %}
<a title="Download PDF" {% if product.progress == 100 %}
href="{% url 'PDF' product.purchase_id %}"
{% else %}
href="#"
{% endif %} class="btn btn-info btn-sm col-md-4 col-xs-4 col-sm-4 col-lg-4 col-xl-4" target="_blank" download="{{ product.search_name }} ({{ product.purchase_date }}).pdf">
{% endif %}
class="btn btn-info btn-sm col-md-4 col-xs-4 col-sm-4 col-lg-4 col-xl-4"
target="_blank"
download="{{ product.search_name }} ({{ product.purchase_date }}).pdf">
<i class="fa fa-file-pdf-o"></i>
</a>
<!--a title="View Log" href="#" class="btn btn-info"
......@@ -263,7 +267,7 @@
<!-- /.content -->
</div>
<!-- Footer -->
<footer class=" page-footer font-small special-color-dark pt-5" >
<footer class=" page-footer font-small special-color-dark pt-5">
<!-- Footer Elements -->
<div class="container">
</div>
......@@ -310,15 +314,16 @@
<div id="map" class="map"></div>
</div>
<div class="modal-footer">
<div align = "left">
<textarea id ="polygonText" readonly rows="5" style="width: 61em; resize:none; font-size: 7pt;">
<div align="left">
<textarea id="polygonText" readonly rows="5" style="width: 61em; resize:none; font-size: 7pt;">
POLYGON
</textarea>
</div>
<button style="float: left; type="button" class="btn btn-default" onclick="copyPolygonText()">Copy polygon</button>
</div>
<button style="float: left; type=" button
" class="btn btn-default" onclick="copyPolygonText()">Copy polygon</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
......
......@@ -120,26 +120,29 @@
{% block content %}
<!-- Content Wrapper. Contains page content -->
<!-- Main content -->
<div id="timeLine" class="container floating-panel slidecontainer" style="position:absolute; display:block; bottom: 40px; left: 12%; width: 500px; z-index: 1000">
<div class="range-control" id="rangecontrol">
<div id="rangecontrol2"></div>
<input class="cross-range" id="inputRange" type="range" min="0" max="{{ labels|length|add:'-1' }}" step="1" value="0" data-thumbwidth="20" style="background: transparent;">
<div id="timeLine" class="container col-md-12 floating-panel slidecontainer"
style="position:absolute; display:block; bottom: 40px; width: 500px; z-index: 1000">
<div id="set_Range_date" class="col-md-4 pull-left" style="margin-right: -15%">{{ labels|first|slice:"6:8" }}/{{ labels|first|slice:"4:6" }}/{{ labels|first|slice:"0:4" }}</div>
<div class="range-control col-md-8" id="rangecontrol">
<input class="cross-range" id="inputRange" type="range" min="0" max="{{ labels|length|add:'-1' }}" step="1"
value="0" data-thumbwidth="20" style="background: transparent;">
<datalist class="range__list" id="number">
{% for label in labels %}
<option class="range__opt" value="{{ label }}">{{ label|slice:"6:8" }}/{{ label|slice:"4:6" }}/{{label|slice:"0:4" }}</option>
<option class="range__opt"
value="{{ label }}">{{ label|slice:"6:8" }}/{{ label|slice:"4:6" }}/{{ label|slice:"0:4" }}</option>
{% endfor %}
</datalist>
</div>
</div>
<div id="selectLeft" class="container floating-panel"
<div id="selectLeft" class="container col-md-12 floating-panel"
style="position:absolute; display:none; bottom: 50px; left: 30%; width: 300px; z-index: 1000">
<div class="">
<div id="rangecontrol3"></div>
<div id="set_Range_date2" class="col-md-4 pull-left">{{ labels|first|slice:"6:8" }}/{{ labels|first|slice:"4:6" }}/{{ labels|first|slice:"0:4" }}</div>
<div class="col-md-8">
<!--<select onchange="selectLeft(this.value)" id="selectLeftCompare">
{% for label in labels %}
<option value="{{label}}" >{{ label|slice:"6:8" }}/{{ label|slice:"4:6" }}/{{label|slice:"0:4" }}</option>
......@@ -150,17 +153,18 @@
</div>
</div>
<div id="selectRight" class="container floating-panel"
<div id="selectRight" class="container col-md-12 floating-panel"
style="position:absolute; display:none; bottom: 50px; left: 75%; width: 300px; z-index: 1000">
<div>
<div id="rangecontrol4"></div>
<div id="set_Range_date3" class="col-md-4 pull-left">{{ labels|last|slice:"6:8" }}/{{ labels|last|slice:"4:6" }}/{{ labels|last|slice:"0:4" }}</div>
<div class="col-md-8">
<!--<select onchange="selectRight(this.value)" id="selectRightCompare">
{% for label in labels %}
<option value="{{label}}" >{{ label|slice:"6:8" }}/{{ label|slice:"4:6" }}/{{label|slice:"0:4" }}</option>
{% endfor %}
</select>-->
<input class="cross-range" id="selectRightCompare" type="range" min="0" max="{{ labels|length|add:'-1' }}"
step="1" value="0" data-thumbwidth="20" style="background: transparent;">
step="1" value="{{ labels|length|add:'-1' }}" data-thumbwidth="20" style="background: transparent;">
</div>
</div>
......@@ -209,14 +213,19 @@
</div>
</div>
<div id="reportPage" class="wrapper" style="background-color: #ecf0f5">
<div id="minimap" class="minimap"></div>
<section class="content">
<a href="#" id="button_left" title="Previous" onclick="previus_report({{ request.path_info|slice:"9:" }})"><i class="fas fa-chevron-left"></i></a>
<a href="#" id="button_right" title="Next" onclick="next_report({{ request.path_info|slice:"9:" }})"><i class="fas fa-chevron-right"></i></a>
<div class="row col-lg-11 title">
<div class="box box-success box-solid info">
<div class="box-header with-border">
<h3>{{ searchInfo.title }}, {{ searchInfo.startDate }} to {{ searchInfo.endDate}}</h3>
<h3>{{ searchInfo.title }}, {{ searchInfo.startDate }} to {{ searchInfo.endDate }}</h3>
<h6>{{ searchInfo.report_name }}</h6>
<!-- /.box-tools -->
</div>
......@@ -370,15 +379,17 @@
var pixelPostion = slider3.clientWidth * sliderPos;
addImageLayer({
layerDate: valor
layerDate: valor
});
$("#tooltiptext").empty();
$("#tooltiptext").append(fecha);
$("#rangecontrol2").empty();
$("#rangecontrol2").append('<span class="arrow_box" id="tooltiptext">'+fecha+'</span>');
$('.arrow_box').css({'left':Math.round(pixelPostion-35) + 'px'})
$("#set_Range_date").empty();
//$("#rangecontrol2").append('<span class="arrow_box" id="tooltiptext">' + fecha + '</span>');
$("#set_Range_date").append(fecha);
$('.arrow_box').css({'left': Math.round(pixelPostion - 35) + 'px'})
});
$('input[id="selectLeftCompare"]').on('input', function () {
......@@ -400,13 +411,11 @@
var pixelPostion = slider3.clientWidth * sliderPos;
$("#tooltiptext2").empty();
$("#tooltiptext2").append(fecha);
$("#rangecontrol3").empty();
$("#rangecontrol3").append('<span class="arrow_box_left" id="tooltiptext2">'+fecha+'</span>');
$('.arrow_box_left').css({'left':Math.round(pixelPostion-35) + 'px'})
$("#set_Range_date2").empty();
$("#set_Range_date2").append(fecha);
$('.arrow_box_left').css({'left': Math.round(pixelPostion - 35) + 'px'})
});
......@@ -429,13 +438,11 @@
var pixelPostion = slider3.clientWidth * sliderPos;
$("#tooltiptext3").empty();
$("#tooltiptext3").append(fecha);
$("#rangecontrol4").empty();
$("#rangecontrol4").append('<span class="arrow_box_right" id="tooltiptext3">'+fecha+'</span>');
$('.arrow_box_right').css({'left':Math.round(pixelPostion-35) + 'px'})
$("#set_Range_date3").empty();
$("#set_Range_date3").append(fecha);
$('.arrow_box_right').css({'left': Math.round(pixelPostion - 35) + 'px'})
});
</script>
......@@ -444,76 +451,78 @@
const legendOnClickHandler = function (e, legendItem) {
const index = legendItem.datasetIndex;
const ch = this.chart;
const checkbox_id = '#sclcheck-'+legendItem.text.toLowerCase().replace(/\s/g, '-');
const checkbox_id = '#sclcheck-' + legendItem.text.toLowerCase().replace(/\s/g, '-');
// isDatasetVisible return the opposite status?
if (ch.getDatasetMeta(index).hidden === null) {
ch.getDatasetMeta(index).hidden = false;
ch.getDatasetMeta(index).hidden = false;
} else {
ch.getDatasetMeta(index).hidden = !ch.getDatasetMeta(index).hidden;
ch.getDatasetMeta(index).hidden = !ch.getDatasetMeta(index).hidden;
}
ch.update();
const layerInput = $(checkbox_id+" :input");
const layerInput = $(checkbox_id + " :input");
layerInput.prop("checked", !ch.getDatasetMeta(index).hidden);
if (layerInput.prop("checked")) {
addImageLayer({
layerName: layerInput.val()
});
addImageLayer({
layerName: layerInput.val()
});
} else {
removeLayer(layerInput.val());
removeLayer(layerInput.val());
}
};
const showSCLcheckboxes = function (datasets) {
if (!datasets || datasets.length < 1) {
return;
}
datasets.forEach(function(data) {
let checkbox_id = '#sclcheck-'+data.label.toLowerCase().replace(' ','-');
$(checkbox_id).show();
$(checkbox_id+" :input").prop("checked", false);
});
if (!datasets || datasets.length < 1) {
return;
}
datasets.forEach(function (data) {
let checkbox_id = '#sclcheck-' + data.label.toLowerCase().replace(' ', '-');
$(checkbox_id).show();
$(checkbox_id + " :input").prop("checked", false);
});
}
const getSelectedLayersName = function () {
const inputs = $("input[name=layer_type]:checked");
let values = []
const inputs = $("input[name=layer_type]:checked");
let values = []
Object.keys(inputs).forEach(key => {
let value = inputs[key].value;
if (value) {values.push(value)}
});
Object.keys(inputs).forEach(key => {
let value = inputs[key].value;
if (value) {
values.push(value)
}
});
return values;
return values;
}
const getChartDataIndex = function (id) {
const datasetsLabels = myChart.config.data.datasets.map(data =>
'sclcheck-' + data.label.toLowerCase().replace(' ', '-')
);
return datasetsLabels.indexOf(id);
const datasetsLabels = myChart.config.data.datasets.map(data =>
'sclcheck-' + data.label.toLowerCase().replace(' ', '-')
);
return datasetsLabels.indexOf(id);
}
$('input[name=layer_type]').on('click', function() {
const input = $(this);
const index = getChartDataIndex(input.parent().attr('id'));
$('input[name=layer_type]').on('click', function () {
const input = $(this);
const index = getChartDataIndex(input.parent().attr('id'));
if (index > -1) {
myChart.getDatasetMeta(index).hidden=!input.prop("checked");
myChart.update();
}
if (index > -1) {
myChart.getDatasetMeta(index).hidden = !input.prop("checked");
myChart.update();
}
if (input.prop("checked")) {
addImageLayer({
layerName: input.val()
});
} else {
removeLayer(input.val());
}
if (input.prop("checked")) {
addImageLayer({
layerName: input.val()
});
} else {
removeLayer(input.val());
}
});
var label;
......@@ -530,6 +539,7 @@
let clouds = "{{ searchInfo.clouds }}";
let oldLabel = "{{defaultDataSet}}";
let labels = {{labels}};
let lista_productos = {{ lista }}
var config = {{graphData}};
let polygon = "{{searchInfo.polygon}}"
......@@ -538,13 +548,41 @@
maintainAspectRatio: false,
// scales: { xAxes: [{ stacked: true }], yAxes: [{ stacked: true }] },
legend: {
display: true,
onClick: legendOnClickHandler,
display: true,
onClick: legendOnClickHandler,
}
};
showSCLcheckboxes(config.data.datasets);
{% endautoescape %}
console.log(lista_productos);
function next_report(number) {
let index = lista_productos.indexOf(number);
console.log(index);
index++;
console.log(index);
if (index >= lista_productos.length)
index = 0;
console.log(lista_productos[index]);
window.location.replace("../reports/"+lista_productos[index]);
}
function previus_report(number) {
let index = lista_productos.indexOf(number);
console.log(index);
index--;
console.log(index);
if (index < 0)
index = lista_productos.length-1;
console.log(lista_productos[index]);
window.location.replace("../reports/"+lista_productos[index]);
}
</script>
<script type="text/javascript" src="{% static 'reports/js/reportImg.js' %}"></script>
<script type="text/javascript" src="{% static 'reports/js/reportPdf.js' %}"></script>
......
......@@ -47,6 +47,7 @@ def report_L2ASCL(request, purchase_id):
template = "sclData.html"
reporteDir = 'mask'
folders = ""
productList = []
purchase = Purchase.objects.values('user__email', 'is_public', 'name', 'search__search_name',
'search__process_id__name','description','aggreg_date').get(pk=purchase_id)
email = purchase['user__email']
......@@ -90,13 +91,34 @@ def report_L2ASCL(request, purchase_id):
#PDFGenerator(request, path, reporteDir, datasets,searchInfo)
pass
if request.user.is_authenticated:
product_list = Purchase.objects.values('id').filter(
user_id__in=[request.user.id],
purchased=1,
progress=100
)
else:
product_list = Purchase.objects.values('id').filter(
is_public=True,
progress=100,
user__email= email
)
for producto in product_list:
if os.path.exists(USERS_PATH + email+'/'+str(producto['id'])+'/scl_data.json' ):
productList.append(
producto['id'],
)
print (product_list)
return render(request, template, {"graphData": json.dumps(graphData),
"searchInfo": searchInfo, "IMAGE_PATH": image_path,
"SCL_PATH": SCL_path, 'dafaultLabel': defaultLabel,
'defaultDataSet': defaultDataset, "folders": folders,
"zone": reporteDir, "purchaseID": purchase_id,
"labels": graphData['data']['labels'],
"email": email})
"email": email,"lista":productList})
# -------------------------------------------------------------------------------def Reports(request):
......@@ -145,10 +167,11 @@ def Reports(request):
progress = 60
if 'Finalizing...' in open(log_info).read():
progress = 100
# item = Purchase.objects.filter(pk=producto['id'])
# item = Purchase.objects.get(pk=producto['id'])
# item.progress = progress
# item.save()
#item = Purchase.objects.filter(pk=producto['id'])
item = Purchase.objects.get(pk=producto['id'])
item.progress = progress
item.save()
with open(log_info, 'r') as myfile:
log = myfile.read().replace('\n', '')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment