Commit f8931e6d authored by Ulises Morales Ramírez's avatar Ulises Morales Ramírez

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

parents 8a95213e cf3484d5
MAPBOX_ACCESS_TOKEN = 'pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw';
// create wkt polygon
const format = new ol.format.WKT();
const feature = format.readFeature(polygon, {
dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857'
});
// Create layers
const mapbox = new ol.layer.Tile({
name: 'mapbox',
......@@ -8,13 +16,7 @@ const mapbox = new ol.layer.Tile({
})
});
// add wkt polygon
const format = new ol.format.WKT();
const feature = format.readFeature(polygon, {
dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857'
});
var vector = new ol.layer.Vector({
const vector = new ol.layer.Vector({
name: 'polygon',
source: new ol.source.Vector({
features: [feature]
......@@ -32,6 +34,9 @@ const map = new ol.Map({
})
});
// fit to polygon
map.getView().fit(feature.getGeometry());
// show first date and current date
let currentDate;
......@@ -76,10 +81,7 @@ function addImageLayer(labelDate) {
map.addLayer(xyz);
})
let currentZoom = map.getView().getZoom();
// fit and zoom
// map.getView().fit(ol.proj.transformExtent(data.boundingBox, 'EPSG:4326', 'EPSG:3857'))
map.getView().setZoom(currentZoom);
map.getView().setMinZoom(data.zoom.min);
map.getView().setMaxZoom(data.zoom.max);
}
......
......@@ -150,7 +150,7 @@
<table data-toggle="table" id="example" class="table table-striped table-bordered"
style="width:100%">
<thead>
<th>Zone</th>
<th>Title</th>
<th>Process</th>
<th>Purchase date</th>
<th>Start Date</th>
......
......@@ -139,26 +139,24 @@
<div class="row col-lg-11 title">
<div class="box box-success box-solid info">
<div class="box-header with-border">
<h3 sytle="font-size: 30px !important;">{{ report_name }}</h3>
<h3>{{ searchInfo.title }} {{ searchInfo.startDate }} to {{ searchInfo.endDate}}</h3>
<h6>{{ searchInfo.report_name }}</h6>
<!-- /.box-tools -->
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-lg-2 text-center col-lg-offset-1">
<h4>Platform: {{ platform }}</h4>
<div class="col-lg-3 text-center">
<h4>Platform: {{ searchInfo.platform }}</h4>
</div>
<div class="col-lg-2 text-center">
<h4>Product level: {{ productLevel }}</h4>
<div class="col-lg-3 text-center">
<h4>Product level: {{ searchInfo.productLevel }}</h4>
</div>
<div class="col-lg-2 text-center">
<h4>Start date: {{ startDate }}</h4>
<div class="col-lg-3 text-center">
<h4>Process: {{ searchInfo.process }}</h4>
</div>
<div class="col-lg-2 text-center">
<h4>End date: {{ endDate }}</h4>
</div>
<div class="col-lg-2 text-center">
<h4>Clouds: {{ clouds }} %</h4>
<div class="col-lg-3 text-center">
<h4>Clouds: {{ searchInfo.clouds }} %</h4>
</div>
</div>
</div>
......@@ -322,49 +320,22 @@
</script>
<!-- page script -->
<script>
var defaultLegendClickHandler = Chart.defaults.global.legend.onClick;
var newLegendClickHandler = function (e, legendItem) {
var legendOnClickHandler = function (e, legendItem) {
var index = legendItem.datasetIndex;
var ch = this.chart;
var meta = ch.getDatasetMeta(index);
var layer = legendItem.text.toLowerCase().replace(/\s/g, '-');
let checkbox_id = '#sclcheck-'+layer;
var activePoint = ch.getElementAtEvent(e);
let checkbox_id = '#sclcheck-'+legendItem.text.toLowerCase().replace(/\s/g, '-');
// isDatasetVisible return the opposite status?
// change checkbox in imagelayer
if (ch.getDatasetMeta(index).hidden === null) {
ch.getDatasetMeta(index).hidden = false;
} else {
ch.getDatasetMeta(index).hidden = !ch.getDatasetMeta(index).hidden;
}
ch.update();
$(checkbox_id+" :input").prop("checked", !ch.isDatasetVisible(index));
$(checkbox_id+" :input").prop("checked", !ch.getDatasetMeta(index).hidden);
addImageLayer(currentDate);
// myChart.config.data.datasets
// myChart.getDatasetMeta(4).hidden=true
//console.log(document.getElementById("titleMap").textContent)
// var label = document.getElementById("titleMap").textContent; //obtiene la fecha que se está viendo
// label = label.replace(/\//g,''); // reemplaza los diagonales por nada
// console.log(label)
// if(meta.hidden){
// console.log("Mostrar!!!")
// SCLlayers.push(layer)
// document.getElementById("scl_"+layer).src = "../../static/reports/tmpImages/repsat_test_dev/{{ SCL_PATH }}"+label+"_SCL_60m_"+layer+".png"
// }
// else{
// console.log("Ocultar!!")
// SCLlayers.splice(SCLlayers.indexOf(layer), 1);
// document.getElementById("scl_"+layer).src = ""
// }
//if (index > 1) {
// Do the original logic
//console.log("wooooo")
//defaultLegendClickHandler(e, legendItem);
defaultLegendClickHandler.call(this, e, legendItem);
//} else {
// console.log("holaaaa")
//}
};
var showSCLcheckboxes = function(datasets) {
......@@ -386,23 +357,23 @@
let scl_path = "{{SCL_PATH}}";
let zone = "{{ zone }}"
let purchase_id = "{{ purchaseID }}"
let platform = "{{ platform }}";
let productLevel = "{{ productLevel }}";
let startDate = "{{ startDate }}";
let endDate = "{{ endDate }}";
let clouds = "{{ clouds }}";
let platform = "{{ searchInfo.platform }}";
let productLevel = "{{ searchInfo.productLevel }}";
let startDate = "{{ searchInfo.startDate }}";
let endDate = "{{ searchInfo.endDate }}";
let clouds = "{{ searchInfo.clouds }}";
let oldLabel = "{{defaultDataSet}}";
let labels = {{labels}};
var config = {{graphData}};
let polygon = "{{polygon}}"
let polygon = "{{searchInfo.polygon}}"
config.options = {
responsive: true,
maintainAspectRatio: false,
// scales: { xAxes: [{ stacked: true }], yAxes: [{ stacked: true }] },
legend: {
display: true,
onClick: newLegendClickHandler,
display: true,
onClick: legendOnClickHandler,
}
};
......
......@@ -46,8 +46,9 @@ def report_L2ASCL(request, purchase_id):
template = "sclData.html"
reporteDir = 'mask'
folders = ""
purchase = Purchase.objects.values('user__email', 'is_public').filter(pk=purchase_id)
email = purchase[0]['user__email']
purchase = Purchase.objects.values('user__email', 'is_public', 'search__search_name',
'search__process_id__name').get(pk=purchase_id)
email = purchase['user__email']
path = USERS_PATH + email + '/' + purchase_id + '/'
scl_data_path = USERS_PATH + email + "/" + purchase_id + "/scl_data.json"
......@@ -68,16 +69,25 @@ def report_L2ASCL(request, purchase_id):
else:
PDFGenerator(request, path, reporteDir, datasets)
searchInfo = {
"title": purchase['search__search_name'],
"process": purchase['search__process_id__name'],
"startDate": startDate,
"endDate": endDate,
"clouds": dataProduct['clouds'],
"platform": dataProduct['platform'],
"productLevel": dataProduct['productLevel'],
"polygon": dataProduct['wkt'],
"report_name": "SCL Image Classification Data(Km²)"
}
return render(request, template, {"graphData": json.dumps(graphData),
"report_name": "SCL Image Classification Data(Km²)",
"startDate": startDate, "endDate": endDate,
"clouds": dataProduct['clouds'], "platform": dataProduct['platform'],
"productLevel": dataProduct['productLevel'], "IMAGE_PATH": image_path,
"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'],
"polygon": dataProduct['wkt'], "email": email})
"email": email})
# -------------------------------------------------------------------------------def Reports(request):
......
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