3230 lines
107 KiB
JavaScript
3230 lines
107 KiB
JavaScript
/**
|
||
* Igor Ivanov ivanov.i@istt.kz
|
||
* [^\x00-\x7F]
|
||
*/
|
||
|
||
//import * as proj4 from "./proj4js/lib/proj4js.js";
|
||
|
||
|
||
//var ScriptName='../metadata/dbms/records.jsp';
|
||
var ScriptName='../records';
|
||
var ScriptDName='../download';
|
||
var ScriptUName='../upload';
|
||
var ScriptRName='../reports'; //For download reports (?file=name)
|
||
var ScriptSName='../session';
|
||
|
||
|
||
var g_rowColor1='#ffffff'; //Grey
|
||
var g_rowColor2='#f0f0f0'; //DimGray
|
||
var g_backColor1= '#ffffff'; //#3a3a3a
|
||
var g_backColor2= '#ffffff'; //#000000
|
||
var g_backColor3= '#ffffff'; //#454555
|
||
var g_textColor1= '#000000'; //#ffffff
|
||
|
||
|
||
//rec.request.callServer(ScriptName,'<metadata fn="0"><type n="ReportInspectors"></type></metadata>'); TODO: delete this line!
|
||
function showIFrameWindow(title,url)
|
||
{
|
||
var win=new TWin();
|
||
win.BuildGUI(10,10);
|
||
win.setCaption(title);
|
||
win.setContent('<iframe src="'+url+'" frameborder="0" width="100%" height="100%"></iframe>');
|
||
win.setSize("550px","500px");
|
||
win.setCenter();
|
||
win.shadow=true;
|
||
win.hide(false);
|
||
}
|
||
|
||
function showConfigWidget()
|
||
{
|
||
this.win=new TWin();
|
||
this.win.BuildGUI(350,140);
|
||
this.win.setCaption(trt('Settings'));
|
||
|
||
let str=`<div style="width: 100%; height: 100%; padding: 3px; text-align: left;">
|
||
<table style="width: 100%; height: 100%;">
|
||
<tr>
|
||
<td>
|
||
<label for="predict0" style="white-space: nowrap;"><input id="predict0" type="checkbox" style="display: inline;" `+(g_user.getSettings('mailing',false)=='true' ? 'checked' : '')+` onclick="g_user.sendSettings('mailing', this.checked)">`+trt('Allow_sending_mail_with_statistics')+`</label><br>
|
||
<label for="predict1" style="white-space: nowrap;"><input id="predict1" type="checkbox" style="display: inline;" `+(g_user.getSettings('perimeter',true)=='true' ? 'checked' : '')+` onclick="g_user.sendSettings('perimeter', this.checked)">`+trt('Display_survey_perimeter')+`</label>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
<label for="transliteration_`+this.win.uid+`">`+trt('Transliteration')+`</label>
|
||
<select name="transliteration_`+this.win.uid+`" id="transliteration_`+this.win.uid+`" style="width:150px;display: inline;">
|
||
<option value="" selected></option>
|
||
<option value="Latin">Latin script</option>
|
||
<option value="Cyrillic">Кириллица</option>
|
||
</select>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td style="padding-top: 5px;"><button id="btnChangePassword" style="width:100%;" onclick="g_user.changePassword();">`+trt('Change_login_password')+`</button></td>
|
||
</tr>
|
||
</table>
|
||
</div>`;
|
||
|
||
this.win.setSize("400px","140px");
|
||
this.win.setContent(str);
|
||
this.win.setCenter();
|
||
this.win.shadow=true;
|
||
this.win.hide(false);
|
||
|
||
let obj = document.getElementById('transliteration_'+this.win.uid);
|
||
obj.onchange=function() {
|
||
g_user.sendSettings('translit', this.value);
|
||
};
|
||
obj.value=g_user.getSettings('translit','');
|
||
}
|
||
|
||
function makeGreenArea(data,userData)
|
||
{
|
||
var vectorSource = new ol.source.Vector({
|
||
features: (new ol.format.GeoJSON()).readFeatures(data,{featureProjection: 'EPSG:3857'})
|
||
//features: (new ol.format.GeoJSON()).readFeatures(data,{featureProjection: 'EPSG:4326'})
|
||
});
|
||
var features = vectorSource.getFeatures();
|
||
for(i=0;i<features.length;i++)
|
||
{
|
||
features[i].userData = userData;
|
||
|
||
features[i].setStyle(new ol.style.Style({
|
||
fill: new ol.style.Fill({color: 'rgba(0, 255, 76, 0.3)'}),
|
||
stroke: new ol.style.Stroke({color: 'rgba(0, 0, 255, 0.5)', width: 1}),
|
||
text: new ol.style.Text({
|
||
font: 'bold 12px helvetica,sans-serif',
|
||
text: userData.percent+" %",
|
||
fill: new ol.style.Fill({color: 'black'}),
|
||
stroke: new ol.style.Stroke({color: 'white', width: 1}),
|
||
offsetX: 0,
|
||
offsetY: 0
|
||
})
|
||
}));
|
||
vectorSourceArea.addFeature(features[i]);
|
||
}
|
||
}
|
||
|
||
function makeYellowArea(data,userData)
|
||
{
|
||
var vectorSource = new ol.source.Vector({
|
||
features: (new ol.format.GeoJSON()).readFeatures(data,{featureProjection: 'EPSG:3857'})
|
||
//features: (new ol.format.GeoJSON()).readFeatures(data,{featureProjection: 'EPSG:4326'})
|
||
});
|
||
var features = vectorSource.getFeatures();
|
||
for(i=0;i<features.length;i++)
|
||
{
|
||
features[i].userData = userData;
|
||
|
||
features[i].setStyle(new ol.style.Style({
|
||
fill: new ol.style.Fill({color: 'rgba(255, 238, 0, 0.3)'}),
|
||
stroke: new ol.style.Stroke({color: 'rgba(0, 0, 255, 0.5)', width: 1}),
|
||
text: new ol.style.Text({
|
||
font: 'bold 12px helvetica,sans-serif',
|
||
text: userData.percent+ " %",
|
||
fill: new ol.style.Fill({color: 'black'}),
|
||
stroke: new ol.style.Stroke({color: 'white', width: 1}),
|
||
offsetX: 0,
|
||
offsetY: 0
|
||
})
|
||
}));
|
||
vectorSourceArea.addFeature(features[i]);
|
||
}
|
||
}
|
||
|
||
function makeRedArea(data,userData)
|
||
{
|
||
var vectorSource = new ol.source.Vector({
|
||
features: (new ol.format.GeoJSON()).readFeatures(data,{featureProjection: 'EPSG:3857'})
|
||
//features: (new ol.format.GeoJSON()).readFeatures(data,{featureProjection: 'EPSG:4326'})
|
||
});
|
||
var features = vectorSource.getFeatures();
|
||
for(i=0;i<features.length;i++)
|
||
{
|
||
features[i].userData = userData;
|
||
|
||
features[i].setStyle(new ol.style.Style({
|
||
fill: new ol.style.Fill({color: 'rgba(255, 0, 0, 0.3)'}),
|
||
stroke: new ol.style.Stroke({color: 'rgba(0, 0, 255, 0.5)', width: 1,}),
|
||
text: new ol.style.Text({
|
||
font: 'bold 12px helvetica,sans-serif',
|
||
text: userData.percent+ " %",
|
||
fill: new ol.style.Fill({color: 'black'}),
|
||
stroke: new ol.style.Stroke({color: 'white', width: 1}),
|
||
offsetX: 0,
|
||
offsetY: 0
|
||
})
|
||
}));
|
||
vectorSourceArea.addFeature(features[i]);
|
||
}
|
||
}
|
||
|
||
function makeGrayArea(data,userData)
|
||
{
|
||
var vectorSource = new ol.source.Vector({
|
||
features: (new ol.format.GeoJSON()).readFeatures(data,{featureProjection: 'EPSG:3857'})
|
||
//features: (new ol.format.GeoJSON()).readFeatures(data,{featureProjection: 'EPSG:4326'})
|
||
});
|
||
var features = vectorSource.getFeatures();
|
||
for(i=0;i<features.length;i++)
|
||
{
|
||
features[i].userData = userData;
|
||
|
||
features[i].setStyle(new ol.style.Style({
|
||
fill: new ol.style.Fill({color: 'rgba(200, 200, 200, 0.3)'}),
|
||
stroke: new ol.style.Stroke({color: 'rgba(0, 0, 255, 0.5)', width: 1,}),
|
||
text: new ol.style.Text({
|
||
font: 'bold 12px helvetica,sans-serif',
|
||
text: userData.name,
|
||
fill: new ol.style.Fill({color: 'black'}),
|
||
stroke: new ol.style.Stroke({color: 'white', width: 1}),
|
||
offsetX: 0,
|
||
offsetY: 0
|
||
})
|
||
}));
|
||
vectorSourceArea.addFeature(features[i]);
|
||
}
|
||
}
|
||
|
||
function downloadQGISFile(product)
|
||
{
|
||
if(product=='frmlocust')
|
||
{
|
||
var country_id='';
|
||
var locust_type_id='';
|
||
var date_start='';
|
||
var date_end='';
|
||
var registered='';
|
||
var indicator='';
|
||
|
||
input = document.getElementById('filter_X1_country_id');
|
||
if(input!=null) country_id=input.value;
|
||
input = document.getElementById('filter_X1_locust_type_id');
|
||
if(input!=null) locust_type_id=input.value;
|
||
input = document.getElementById('filter_X1_date_start');
|
||
if(input!=null) date_start=input.value;
|
||
input = document.getElementById('filter_X1_date_end');
|
||
if(input!=null) date_end=input.value;
|
||
input = document.getElementById('filter_X1_registered');
|
||
if(input!=null) registered=input.value;
|
||
input = document.getElementById('filter_X1_indicator');
|
||
if(input!=null) indicator=input.value;
|
||
|
||
var url='';
|
||
if(indicator==1)
|
||
url='../QGIS?name=frmlocust_pods_density&country_id='+country_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||
if(indicator==2)
|
||
url='../QGIS?name=frmlocust_hoppers_density&country_id='+country_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||
if(indicator==3)
|
||
url='../QGIS?name=frmlocust_bands&country_id='+country_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||
if(indicator==4)
|
||
url='../QGIS?name=frmlocust_adults_density&country_id='+country_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||
if(indicator==5)
|
||
url='../QGIS?name=frmlocust_swarms&country_id='+country_id+'&locust_type_id='+locust_type_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'';
|
||
|
||
window.open(url,'_blank');
|
||
|
||
}else if(product=='frmlocustdel')
|
||
{
|
||
var country_id='';
|
||
var date_start='';
|
||
var date_end='';
|
||
var registered='';
|
||
|
||
input = document.getElementById('filter_X2_country_id');
|
||
if(input!=null) country_id=input.value;
|
||
input = document.getElementById('filter_X2_date_start');
|
||
if(input!=null)
|
||
{ date_start=input.value;
|
||
}
|
||
input = document.getElementById('filter_X2_date_end');
|
||
if(input!=null)
|
||
{ date_end=input.value;
|
||
}
|
||
input = document.getElementById('filter_X2_registered');
|
||
if(input!=null) registered=input.value;
|
||
|
||
window.open('../QGIS?name='+product+'&country_id='+country_id+'&date_start='+date_start+'&date_end='+date_end+'®istered='+registered+'','_blank');
|
||
|
||
}else if(product=='frmlocustinfo')
|
||
{
|
||
var country_id='';
|
||
var region_id='';
|
||
var year='';
|
||
var locust_type_id='';
|
||
var indicator='';
|
||
|
||
input = document.getElementById('filter_X3_country_id');
|
||
if(input!=null) country_id=input.value;
|
||
input = document.getElementById('filter_X3_region_id');
|
||
if(input!=null) region_id=input.value;
|
||
input = document.getElementById('filter_X3_year');
|
||
if(input!=null) year=input.value;
|
||
input = document.getElementById('filter_X3_locust_type_id');
|
||
if(input!=null) locust_type_id=input.value;
|
||
input = document.getElementById('filter_X3_indicator');
|
||
if(input!=null) indicator=input.value;
|
||
|
||
var url='';
|
||
if(indicator==2)
|
||
{
|
||
if(region_id=='')
|
||
url='../QGIS?name=frmlocustinfo_p2&country_id='+country_id+'&year='+year+'&locust_type_id='+locust_type_id+'','_blank';
|
||
else
|
||
url='../QGIS?name=frmlocustinfo_p2r®ion_id='+region_id+'&year='+year+'&locust_type_id='+locust_type_id+'','_blank';
|
||
}
|
||
if(indicator==3)
|
||
{
|
||
if(region_id=='')
|
||
url='../QGIS?name=frmlocustinfo_p3&country_id='+country_id+'&year='+year+'&locust_type_id='+locust_type_id+'','_blank';
|
||
else
|
||
url='../QGIS?name=frmlocustinfo_p3r®ion_id='+region_id+'&year='+year+'&locust_type_id='+locust_type_id+'','_blank';
|
||
}
|
||
if(indicator==4)
|
||
{
|
||
if(region_id=='')
|
||
url='../QGIS?name=frmlocustinfo_p4&country_id='+country_id+'&year='+year+'&locust_type_id='+locust_type_id+'';
|
||
else
|
||
url='../QGIS?name=frmlocustinfo_p4r®ion_id='+region_id+'&year='+year+'&locust_type_id='+locust_type_id+'';
|
||
}
|
||
window.open(url,'_blank');
|
||
|
||
}else if(product=='soil_temperature')
|
||
{
|
||
let country_id = document.getElementById('filter_soil_country_id').value;
|
||
let time = document.getElementById('filter_soil_day').value;
|
||
time=Math.floor(new Date(time).getTime() / 1000);
|
||
|
||
let country_name='';
|
||
if(country_id=='1') country_name='afghanistan';
|
||
else if(country_id=='2') country_name='armenia';
|
||
else if(country_id=='3') country_name='azerbaijan';
|
||
else if(country_id=='4') country_name='georgia';
|
||
else if(country_id=='5') country_name='kazakhstan';
|
||
else if(country_id=='6') country_name='kyrgyzstan';
|
||
else if(country_id=='7') country_name='russia';
|
||
else if(country_id=='8') country_name='tajikistan';
|
||
else if(country_id=='9') country_name='turkmenistan';
|
||
else if(country_id=='10') country_name='uzbekistan';
|
||
|
||
let url='../QGIS?name=soil_temperature&country_name='+country_name+'&country_id='+country_id+'&time='+time;
|
||
window.open(url,'_blank');
|
||
}else if(product=='air_temperature')
|
||
{
|
||
let country_id = document.getElementById('filter_air_country_id').value;
|
||
let time = document.getElementById('filter_air_day').value;
|
||
time=Math.floor(new Date(time).getTime() / 1000);
|
||
|
||
let country_name='';
|
||
if(country_id=='1') country_name='afghanistan';
|
||
else if(country_id=='2') country_name='armenia';
|
||
else if(country_id=='3') country_name='azerbaijan';
|
||
else if(country_id=='4') country_name='georgia';
|
||
else if(country_id=='5') country_name='kazakhstan';
|
||
else if(country_id=='6') country_name='kyrgyzstan';
|
||
else if(country_id=='7') country_name='russia';
|
||
else if(country_id=='8') country_name='tajikistan';
|
||
else if(country_id=='9') country_name='turkmenistan';
|
||
else if(country_id=='10') country_name='uzbekistan';
|
||
|
||
let url='../QGIS?name=air_temperature&country_name='+country_name+'&country_id='+country_id+'&time='+time;
|
||
window.open(url,'_blank');
|
||
}else if(product=='precipitation')
|
||
{
|
||
let country_id = document.getElementById('filter_precipitation_country_id').value;
|
||
let time = document.getElementById('filter_precipitation_day').value;
|
||
time=Math.floor(new Date(time).getTime() / 1000);
|
||
|
||
let country_name='';
|
||
if(country_id=='1') country_name='afghanistan';
|
||
else if(country_id=='2') country_name='armenia';
|
||
else if(country_id=='3') country_name='azerbaijan';
|
||
else if(country_id=='4') country_name='georgia';
|
||
else if(country_id=='5') country_name='kazakhstan';
|
||
else if(country_id=='6') country_name='kyrgyzstan';
|
||
else if(country_id=='7') country_name='russia';
|
||
else if(country_id=='8') country_name='tajikistan';
|
||
else if(country_id=='9') country_name='turkmenistan';
|
||
else if(country_id=='10') country_name='uzbekistan';
|
||
|
||
let url='../QGIS?name=precipitation&country_name='+country_name+'&country_id='+country_id+'&time='+time;
|
||
window.open(url,'_blank');
|
||
}else if(product=='htc_selyaninov')
|
||
{
|
||
let country_id = document.getElementById('filter_htc_selyaninov_country_id').value;
|
||
let time_start = document.getElementById('filter_htc_selyaninov_time_start').value;
|
||
time_start=Math.floor(new Date(time_start).getTime() / 1000);
|
||
let time_end = document.getElementById('filter_htc_selyaninov_time_end').value;
|
||
time_end=Math.floor(new Date(time_end).getTime() / 1000);
|
||
|
||
let country_name='';
|
||
if(country_id=='1') country_name='afghanistan';
|
||
else if(country_id=='2') country_name='armenia';
|
||
else if(country_id=='3') country_name='azerbaijan';
|
||
else if(country_id=='4') country_name='georgia';
|
||
else if(country_id=='5') country_name='kazakhstan';
|
||
else if(country_id=='6') country_name='kyrgyzstan';
|
||
else if(country_id=='7') country_name='russia';
|
||
else if(country_id=='8') country_name='tajikistan';
|
||
else if(country_id=='9') country_name='turkmenistan';
|
||
else if(country_id=='10') country_name='uzbekistan';
|
||
|
||
let url='../QGIS?name=htc_selyaninov&country_name='+country_name+'&country_id='+country_id+'&time_start='+time_start+'&time_end='+time_end;
|
||
window.open(url,'_blank');
|
||
}else if(product=='NDVI')
|
||
{
|
||
let day='';
|
||
input = document.getElementById('filter_ndvi_day');
|
||
if(input!=null){
|
||
day=input.value;
|
||
if(day.length==2) day='0'+day;
|
||
if(day.length==1) day='00'+day;
|
||
}
|
||
|
||
var url='../QGIS?name=NDVI&day='+day;
|
||
window.open(url,'_blank');
|
||
}else if(product=='IVI')
|
||
{
|
||
let year='';
|
||
input = document.getElementById('filter_ivi_year');
|
||
if(input!=null){
|
||
year=input.value;
|
||
}
|
||
var url='../QGIS?name=IVI&year='+year;
|
||
window.open(url,'_blank');
|
||
}else if(product=='NDWI')
|
||
{
|
||
let day='';
|
||
input = document.getElementById('filter_ndwi_day');
|
||
if(input!=null){
|
||
day=input.value;
|
||
if ( day % 10 == 0 ){
|
||
day=day.padStart(3, "0");
|
||
}else
|
||
day='';
|
||
}
|
||
|
||
var url='../QGIS?name=NDWI&day='+day;
|
||
window.open(url,'_blank');
|
||
}else if(product=='NDWI_CMP')
|
||
{
|
||
let day='';
|
||
input = document.getElementById('filter_ndwi_day_compare');
|
||
if(input!=null){
|
||
day=input.value;
|
||
if(day.length==2) day='0'+day;
|
||
if(day.length==1) day='00'+day;
|
||
}
|
||
|
||
var url='../QGIS?name=NDWI_CMP&day='+day;
|
||
window.open(url,'_blank');
|
||
}else if(product=='NDSI')
|
||
{
|
||
let day='';
|
||
input = document.getElementById('filter_ndsi_day');
|
||
if(input!=null){
|
||
day=input.value;
|
||
if ( day % 10 == 0 ){
|
||
day=day.padStart(3, "0");
|
||
}else
|
||
day='';
|
||
}
|
||
|
||
var url='../QGIS?name=NDSI&day='+day;
|
||
window.open(url,'_blank');
|
||
}else if(product=='SMAP')
|
||
{
|
||
let day='';
|
||
input = document.getElementById('filter_smap_day');
|
||
if(input!=null){
|
||
day=input.value;
|
||
if ( day % 10 == 0 ){
|
||
day=day.padStart(3, "0");
|
||
}else
|
||
day='';
|
||
}
|
||
var url='../QGIS?name=SMAP&day='+day;
|
||
window.open(url,'_blank');
|
||
}else{
|
||
alert2('Info','On development stage.');
|
||
}
|
||
}
|
||
|
||
//Class for making chart from "frmLocustInfo" table
|
||
class TChartFRMLocustInfo
|
||
{
|
||
constructor(userData) {
|
||
this.name='TChartFRMLocustInfo';
|
||
this.userData = userData;
|
||
this.m_win=null;
|
||
this.m_arr = new Array()
|
||
this.m_uid = getUID();
|
||
|
||
this.callData();
|
||
}
|
||
|
||
updateData()
|
||
{
|
||
this.m_win.setSize("150px","100px");
|
||
let str='';
|
||
str='<div style="font-size:12px; position:relative;">\n\
|
||
<div id="tit_'+this.m_uid+'" style="font-weight:bold;"> </div>\n\
|
||
<table id="tbl_'+this.m_uid+'" border="1" style="font-size:inherit; border-collapse:collapse;">\n\
|
||
<thead><tr><th> '+trt('Year')+' </th><th> '+trt('Average')+' </th><th style="white-space:nowrap;"> '+trt('Thous_ha')+' </th><th style="white-space:nowrap;"> '+trt('Dev_of_average')+' </th></tr></thead>\n\
|
||
<tbody id="tblb_'+this.m_uid+'"><tr><td>2005</td><td style="width:100px;vertical-align:middle;"><div style="width:50px; height:15px; background-color:#9999ff; display:inline-block;">​</div></td><td>3</td></tr>\n\
|
||
<tr><td>2006</td><td>2</td><td>30</td></tr>\n\
|
||
<tr><td>2007</td><td>2</td><td>300</td></tr></tbody>\n\
|
||
</table>\n\
|
||
<div id="txt_'+this.m_uid+'" style="font-weight:bold;"> </div>\n\
|
||
<div id="lin_'+this.m_uid+'" style="display:inline-block; width:3px; height:150px; background-color:#dd0000; position: absolute;z-index:100;top: 0px;left: 50px;"> </div>\n\
|
||
</div>';
|
||
|
||
this.m_win.setContent(str);
|
||
this.m_win.hideProgressBar();
|
||
}
|
||
|
||
addField(year,val)
|
||
{
|
||
this.m_arr[year]=val;
|
||
}
|
||
|
||
buildTable(year,currVal,txt)
|
||
{
|
||
let tbl=document.getElementById("tbl_"+this.m_uid);
|
||
let tblb=document.getElementById("tblb_"+this.m_uid);
|
||
for(let i = 0; i < tblb.rows.length;)
|
||
{
|
||
tblb.deleteRow(i);
|
||
}
|
||
//tbl.innerHTML='<thead style="background: #aaaaaa;"><tr style="border: 1px solid black;"><td style="border: 1px solid black;">'+trt('Year')+'</td><td style="border: 1px solid black;"> .2. </td><td style="border: 1px solid black;">'+trt('Value')+'</td></tr></thead><tbody></tbody>';
|
||
let max=parseFloat(currVal);
|
||
let average=0;
|
||
let cnt=0;
|
||
|
||
//Calculating average value
|
||
for (let key in this.m_arr)
|
||
{
|
||
if (this.m_arr.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294)
|
||
{
|
||
//log.info(this.m_arr[key]);
|
||
if(max<this.m_arr[key]) max=this.m_arr[key];
|
||
average+=this.m_arr[key];
|
||
cnt++;
|
||
}
|
||
}
|
||
average=average/cnt;
|
||
let pr=100/max;
|
||
|
||
for(let key in this.m_arr)
|
||
{
|
||
if (this.m_arr.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294)
|
||
{
|
||
let tr; let div;
|
||
tr = document.createElement('tr');
|
||
|
||
let td1 = document.createElement('td');
|
||
td1.appendChild(document.createTextNode(key));
|
||
tr.appendChild(td1);
|
||
|
||
let td2 = document.createElement('td');
|
||
td2.style.cssText='width:100px;height:100%;padding:1px;';
|
||
div = document.createElement('td');
|
||
div.style.cssText='height:15px; background-color:#9999ff; display:inline-block;';
|
||
div.style.width = Math.round(this.m_arr[key]*pr)+"px";
|
||
td2.appendChild(div);
|
||
tr.appendChild(td2);
|
||
|
||
let td3 = document.createElement('td');
|
||
td3.appendChild(document.createTextNode(this.m_arr[key]));
|
||
tr.appendChild(td3);
|
||
|
||
let td4 = document.createElement('td');
|
||
td4.appendChild(document.createTextNode((Math.round((this.m_arr[key]/average-1)*1000)/10)+"%"));
|
||
tr.appendChild(td4);
|
||
|
||
tblb.appendChild(tr);
|
||
}
|
||
}
|
||
//For last value
|
||
let tr; let div;
|
||
tr = document.createElement('tr');
|
||
|
||
let td1 = document.createElement('td');
|
||
td1.appendChild(document.createTextNode(year));
|
||
tr.appendChild(td1);
|
||
|
||
let td2 = document.createElement('td');
|
||
td2.style.cssText='width:100px;height:100%;padding:1px;';
|
||
div = document.createElement('td');
|
||
div.style.cssText='height:15px; background-color:#9999ff; display:inline-block;';
|
||
div.style.width = Math.round(parseFloat(currVal)*pr)+"px";
|
||
td2.appendChild(div);
|
||
tr.appendChild(td2);
|
||
|
||
let td3 = document.createElement('td');
|
||
if(txt!='')
|
||
td3.appendChild(document.createTextNode(txt));
|
||
else
|
||
td3.appendChild(document.createTextNode(currVal));
|
||
tr.appendChild(td3);
|
||
tblb.appendChild(tr);
|
||
|
||
let td4 = document.createElement('td');
|
||
td4.appendChild(document.createTextNode((Math.round((parseFloat(currVal)/average-1)*1000)/10)+"%"));
|
||
tr.appendChild(td4);
|
||
|
||
let eTit=document.getElementById("tit_"+this.m_uid);
|
||
eTit.innerHTML=this.userData.name;
|
||
|
||
let p=(parseFloat(currVal)/average-1)*100;
|
||
|
||
let eTxt=document.getElementById("txt_"+this.m_uid);
|
||
eTxt.innerHTML=trt('Average')+': '+(Math.round(average * 100) / 100)+' ('+trt('thous_ha')+')<br>'+trt('Deviation')+': '+(Math.round(p * 10) / 10)+'%';
|
||
|
||
if(this.m_arr.length<=1){
|
||
let eLin=document.getElementById("lin_"+this.m_uid);
|
||
eLin.style.visibility='hidden';
|
||
}else{
|
||
let eLin=document.getElementById("lin_"+this.m_uid);
|
||
eLin.style.top = (tbl.offsetTop + (tbl.offsetHeight/(cnt+1)))+"px";
|
||
eLin.style.left = td2.offsetLeft+(average*pr)+"px";
|
||
eLin.style.height = (tbl.offsetHeight - 2*(tbl.offsetHeight/(cnt+1)))+"px";
|
||
}
|
||
}
|
||
|
||
prepareData(obj)
|
||
{
|
||
let find=false;
|
||
for(let i=0;i<obj.data.length;i++){
|
||
let year=obj.data[i].row[0];
|
||
let inspect=parseFloat(obj.data[i].row[1]);
|
||
let infested_etd=parseFloat(obj.data[i].row[2]);
|
||
let treated=parseFloat(obj.data[i].row[3]);
|
||
|
||
if(!isNaN(infested_etd))
|
||
{
|
||
//alert('add year = '+year);
|
||
if(this.userData.year!=year)
|
||
{
|
||
if(this.userData.type=="Product2" || this.userData.type=="Product2r")
|
||
{ this.addField(year,infested_etd);
|
||
}else if(this.userData.type=="Product3" || this.userData.type=="Product3r")
|
||
{ this.addField(year,treated);
|
||
}
|
||
}else
|
||
{
|
||
this.updateData();
|
||
if(this.userData.type=="Product2" || this.userData.type=="Product2r")
|
||
{
|
||
this.buildTable(year,infested_etd,'');
|
||
}else if(this.userData.type=="Product3" || this.userData.type=="Product3r")
|
||
{ this.buildTable(year,treated,'');
|
||
}
|
||
find=true;
|
||
}
|
||
}
|
||
}
|
||
//Если в данных нет иследуемого года
|
||
if(!find){
|
||
this.updateData();
|
||
if(this.userData.type=="Product2" || this.userData.type=="Product2r")
|
||
{
|
||
this.buildTable(this.userData.year,0,'none');
|
||
}else if(this.userData.type=="Product3" || this.userData.type=="Product3r")
|
||
{ this.buildTable(this.userData.year,0,'none');
|
||
}
|
||
}
|
||
}
|
||
|
||
callData()
|
||
{
|
||
this.m_win = new TWin();
|
||
this.m_win.BuildGUI(pageX,pageY);
|
||
this.m_win.setCaption(trt('Chart'));
|
||
this.m_win.setSize("220px","100px");
|
||
this.m_win.setCenter();
|
||
|
||
let xs='';
|
||
if(typeof this.userData.region_id != 'undefined' )
|
||
{
|
||
xs='<?xml version="1.0" encoding="utf-8"?>\n\
|
||
<metadata fn="4">\n\
|
||
<type n="SysFrmLocustInfoR" pp="-1">\n\
|
||
<objects-list><filter>\n\
|
||
<column n="region_id"><![CDATA['+this.userData.region_id+']]\></column>\n\
|
||
<column n="locust_type_id"><![CDATA['+this.userData.locust_type_id+']]\></column>\n\
|
||
<column n="year"><![CDATA['+this.userData.year+']]\></column>\n\
|
||
<column n="years"><![CDATA[20]]\></column>\n\
|
||
</filter></objects-list>\n\
|
||
</type>\n\
|
||
</metadata>';
|
||
}else if (typeof this.userData.district_id != 'undefined' )
|
||
{
|
||
xs='<?xml version="1.0" encoding="utf-8"?>\n\
|
||
<metadata fn="4">\n\
|
||
<type n="SysFrmLocustInfoD" pp="-1">\n\
|
||
<objects-list><filter>\n\
|
||
<column n="district_id"><![CDATA['+this.userData.district_id+']]\></column>\n\
|
||
<column n="locust_type_id"><![CDATA['+this.userData.locust_type_id+']]\></column>\n\
|
||
<column n="year"><![CDATA['+this.userData.year+']]\></column>\n\
|
||
<column n="years"><![CDATA[20]]\></column>\n\
|
||
</filter></objects-list>\n\
|
||
</type>\n\
|
||
</metadata>';
|
||
}
|
||
let request=new TRequest(this);
|
||
if(request.callServer(ScriptName,xs))
|
||
{
|
||
this.m_win.showProgressBar();
|
||
}
|
||
|
||
this.m_win.hide(false);
|
||
}
|
||
|
||
applyReq(req,fn,node)
|
||
{
|
||
if(node.errorCode>0) {
|
||
let fullText = node.errorMessage;
|
||
let smallText = '';
|
||
let pos1=fullText.indexOf('[[');
|
||
let pos2=fullText.indexOf(']]');
|
||
if(pos1>=0 && pos2>=0 && pos1<pos2) smallText=fullText.substring(pos1+2, pos2);
|
||
if(fullText.indexOf("id456[[")>=0){ //Если есть идентификатор того что это перезапись
|
||
let okFunc=()=>{
|
||
this.setValue('seq',0);
|
||
this.sendData(); //Применить ещё раз
|
||
};
|
||
if (smallText != '')
|
||
confirm2(trt('Warning'),smallText, fullText, okFunc, null);
|
||
else
|
||
confirm2(trt('Warning'),smallText, '', okFunc, null);
|
||
}else {
|
||
if (smallText != '')
|
||
alert2(trt('Alert'), smallText, fullText);
|
||
else
|
||
alert2(trt('Alert'), fullText);
|
||
}
|
||
return;
|
||
}
|
||
|
||
if (fn==4)
|
||
{
|
||
if(node.n=="SysFrmLocustInfoR" || node.n=="SysFrmLocustInfoD")
|
||
{
|
||
this.prepareData(node);
|
||
}
|
||
}else
|
||
alert("Unknown function! fn=\""+fn+"\"");
|
||
}
|
||
}
|
||
|
||
//Customize the visual elements on the access level.
|
||
function configGUIbyAccessLevel()
|
||
{
|
||
g_user.loadAccess();
|
||
g_user.onLoadAccess=function(user)
|
||
{
|
||
if(GET['cmd']!='' && typeof GET['cmd']!='undefined')
|
||
{
|
||
if(GET['cmd']=='FrmLocust')
|
||
{
|
||
var input;
|
||
input = document.getElementById('filter_X1_country_id');
|
||
if(input!=null) typeof GET['country_id']!='undefined' ? input.value=GET['country_id'] : input.value='';
|
||
input = document.getElementById('filter_X1_locust_type_id');
|
||
if(input!=null) typeof GET['locust_type_id']!='undefined' ? input.value=GET['locust_type_id'] : input.value='';
|
||
input = document.getElementById('filter_X1_date_start');
|
||
if(input!=null) typeof GET['date_start']!='undefined' ? input.value=GET['date_start'] : input.value='';
|
||
input = document.getElementById('filter_X1_date_end');
|
||
if(input!=null) typeof GET['date_end']!='undefined' ? input.value=GET['date_end'] : input.value='';
|
||
input = document.getElementById('filter_X1_device_id');
|
||
if(input!=null) typeof GET['device_id']!='undefined' ? input.value=GET['device_id'] : input.value='';
|
||
input = document.getElementById('filter_X1_registered');
|
||
if(input!=null) typeof GET['registered']!='undefined' ? input.value=GET['registered'] : input.value='';
|
||
input = document.getElementById('filter_X1_indicator');
|
||
if(input!=null) typeof GET['indicator']!='undefined' ? input.value=GET['indicator'] : input.value='';
|
||
|
||
callFrmLocustData();
|
||
}
|
||
}
|
||
|
||
var showT;
|
||
//Devices
|
||
showT=false;
|
||
if(!user.getAccess("Update_Terminals")) deleteHTML(document.getElementById('btnTerminalsShow')); else showT=true;
|
||
//if(!user.getAccess("Update_TerminalsModels")) deleteHTML(document.getElementById('btnTerminalsModelsShow')); else showT=true;
|
||
if(!showT)
|
||
{
|
||
deleteHTML(document.getElementById('lblDevices'));
|
||
}
|
||
//Administration
|
||
showT=false;
|
||
if(!user.getAccess("Update__Actions")) deleteHTML('btnActionsShow'); else showT=true;
|
||
if(!user.getAccess("Update__Access")) deleteHTML('btnAccessShow'); else showT=true;
|
||
if(!user.getAccess("Update__Groups")) deleteHTML('btnGroupsShow'); else showT=true;
|
||
//if(!(user.getAccess("Update__Users") || user.getAccess("set_role_operator"))) deleteHTML('btnUsersShow'); else showT=true;
|
||
|
||
if(!user.getAccess("Update__History")) deleteHTML('btnHistoryShow'); else showT=true;
|
||
if(!user.getAccess("Update__Metadata")) deleteHTML('btnMetadataShow'); else showT=true;
|
||
|
||
if(!showT)
|
||
{
|
||
deleteHTML(document.getElementById('lblAdministration'));
|
||
}
|
||
|
||
//Language
|
||
showT=false;
|
||
if(!user.getAccess("Update__Languages")) deleteHTML(document.getElementById('btnLanguage')); else showT=true;
|
||
if(!user.getAccess("Update__Translations")) deleteHTML(document.getElementById('btnTranslation')); else showT=true;
|
||
if(!showT)
|
||
{
|
||
deleteHTML(document.getElementById('lblLanguage'));
|
||
}
|
||
|
||
showT=false;
|
||
if(!user.getAccess("Update_Companies")) deleteHTML(document.getElementById('btnCompaniesShow')); else showT=true;
|
||
if(!showT)
|
||
{
|
||
deleteHTML(document.getElementById('lblCompanies'));
|
||
}
|
||
|
||
|
||
//Weather
|
||
showT=false;
|
||
if(!user.getAccess("Update_Weather")) deleteHTML(document.getElementById('btnWeather')); else showT=true;
|
||
if(!user.getAccess("Update_WeatherTypes")) deleteHTML(document.getElementById('btnWeatherType')); else showT=true;
|
||
if(!showT)
|
||
{
|
||
deleteHTML(document.getElementById('lblWeather'));
|
||
}
|
||
|
||
|
||
showT=false;
|
||
if(!user.getAccess("Update_Countries")) deleteHTML(document.getElementById('btnCountries')); else showT=true;
|
||
if(!user.getAccess("Update_Sprayers")) deleteHTML(document.getElementById('btnSprayers')); else showT=true;
|
||
if(!user.getAccess("Update_List_Age")) deleteHTML(document.getElementById('btnListAge')); else showT=true;
|
||
if(!user.getAccess("Update_List_Biotope")) deleteHTML(document.getElementById('btnListBiotope')); else showT=true;
|
||
if(!user.getAccess("Update_List_Cover")) deleteHTML(document.getElementById('btnListCover')); else showT=true;
|
||
if(!user.getAccess("Update_List_Damage")) deleteHTML(document.getElementById('btnListDamage')); else showT=true;
|
||
if(!user.getAccess("Update_List_Density")) deleteHTML(document.getElementById('btnListDensity')); else showT=true;
|
||
if(!user.getAccess("Update_List_Directions")) deleteHTML(document.getElementById('btnListDirections')); else showT=true;
|
||
if(!user.getAccess("Update_List_Mortality")) deleteHTML(document.getElementById('btnListMortality')); else showT=true;
|
||
if(!user.getAccess("Update_List_Phase")) deleteHTML(document.getElementById('btnListPhase')); else showT=true;
|
||
if(!user.getAccess("Update_List_Greenery")) deleteHTML(document.getElementById('btnListGreenery')); else showT=true;
|
||
if(!user.getAccess("Update_LocustsTypes")) deleteHTML(document.getElementById('btnListLocustType')); else showT=true;
|
||
if(!user.getAccess("Update_List_OperatorsTypes")) deleteHTML(document.getElementById('btnListOperatorsTypes')); else showT=true;
|
||
if(!user.getAccess("Update_List_Actions")) deleteHTML(document.getElementById('btnListActions')); else showT=true;
|
||
if(!user.getAccess("Update_List_Behaviors")) deleteHTML(document.getElementById('btnListBehaviors')); else showT=true;
|
||
if(!user.getAccess("Update_List_Paintings")) deleteHTML(document.getElementById('btnListPaintings')); else showT=true;
|
||
if(!user.getAccess("Update_Fledgling")) deleteHTML(document.getElementById('btnFledgling')); else showT=true;
|
||
if(!user.getAccess("Update_List_Capacities")) deleteHTML(document.getElementById('btnListCapacities')); else showT=true;
|
||
if(!user.getAccess("Update_List_Containers")) deleteHTML(document.getElementById('btnListСontainers')); else showT=true;
|
||
if(!user.getAccess("Update_List_Markings")) deleteHTML(document.getElementById('btnListMarkings')); else showT=true;
|
||
if(!user.getAccess("Update_Borns")) deleteHTML(document.getElementById('btnBorns')); else showT=true;
|
||
if(!user.getAccess("Update_List_Breeding")) deleteHTML(document.getElementById('btnListBreeding')); else showT=true;
|
||
if(!user.getAccess("Update_List_Vegetation")) deleteHTML(document.getElementById('btnListVegetation')); else showT=true;
|
||
if(!user.getAccess("Update_List_Formulation")) deleteHTML(document.getElementById('btnListFormulation')); else showT=true;
|
||
if(!user.getAccess("Update_List_Height")) deleteHTML(document.getElementById('btnListHeight')); else showT=true;
|
||
if(!user.getAccess("Update_List_Enemies")) deleteHTML(document.getElementById('btnListEnemies')); else showT=true;
|
||
if(!showT)
|
||
{
|
||
deleteHTML(document.getElementById('lblLists'));
|
||
}
|
||
}
|
||
}
|
||
|
||
//Open window to show report by countries
|
||
function showReportCountries()
|
||
{
|
||
let rec=new SRec()
|
||
//rec.create('../metadata/dbms/form/')
|
||
rec.create(null);
|
||
rec.f_TypeName="ReportCountries";
|
||
rec.f_Settings='';
|
||
|
||
rec.f_Settings+="<metadata><type n=\"ReportCountries\">";
|
||
rec.f_Settings+=" <objects-list>";
|
||
rec.f_Settings+=" <filter>";
|
||
rec.f_Settings+=" <column n=\"country_id\"><![CDATA["+country_id+"]]\></column>";
|
||
rec.f_Settings+=" <column n=\"date_start\"><![CDATA["+ (Math.floor(Date.now() / 1000) - 7776000) + "]]\></column>";
|
||
rec.f_Settings+=" <column n=\"date_end\"><![CDATA["+ (Math.floor(Date.now() / 1000) + 86400) +"]]\></column>";
|
||
rec.f_Settings+=" <column n=\"registered\"><![CDATA[1]]\></column>";
|
||
rec.f_Settings+=" </filter>";
|
||
rec.f_Settings+=" </objects-list>";
|
||
rec.f_Settings+="</type></metadata>";
|
||
|
||
//alert(rec.f_Settings);
|
||
|
||
rec.win.setSize("800px","500px");
|
||
//rec.win.setLeftTop(300,40);
|
||
rec.win.setCenter();
|
||
rec.request.callServer(ScriptName,'<metadata fn="0"><type n="ReportCountries"></type></metadata>');
|
||
}
|
||
|
||
//Open window to show report by inspectors
|
||
function showReportInspectors()
|
||
{
|
||
let rec=new SRec();
|
||
rec.create(null);
|
||
rec.f_TypeName="ReportInspectors";
|
||
|
||
rec.f_Settings='';
|
||
rec.f_Settings+="<metadata><type n=\"ReportInspectors\">";
|
||
rec.f_Settings+=" <objects-list>";
|
||
rec.f_Settings+=" <filter>";
|
||
rec.f_Settings+=" <column n=\"country_id\"><![CDATA["+country_id+"]]\></column>";
|
||
rec.f_Settings+=" <column n=\"date_start\"><![CDATA["+ (Math.floor(Date.now() / 1000) - 7776000) + "]]\></column>";
|
||
rec.f_Settings+=" <column n=\"date_end\"><![CDATA["+ (Math.floor(Date.now() / 1000) + 86400) +"]]\></column>";
|
||
rec.f_Settings+=" </filter>";
|
||
rec.f_Settings+=" </objects-list>";
|
||
rec.f_Settings+="</type></metadata>";
|
||
|
||
//alert(rec.f_Settings);
|
||
|
||
rec.win.setSize("800px","500px");
|
||
//rec.win.setHeight(500);
|
||
//rec.win.setLeftTop(300,40);
|
||
rec.win.setCenter();
|
||
rec.request.callServer(ScriptName,'<metadata fn="0"><type n="ReportInspectors"></type></metadata>');
|
||
}
|
||
|
||
function showReportTabletsStatistics()
|
||
{
|
||
let rec=new SRec();
|
||
rec.create(null);
|
||
rec.f_TypeName="ReportTabletsStatistics";
|
||
|
||
rec.f_Settings='';
|
||
rec.f_Settings+="<metadata><type n=\"ReportTabletsStatistics\">";
|
||
rec.f_Settings+=" <objects-list>";
|
||
rec.f_Settings+=" <filter>";
|
||
rec.f_Settings+=" <column n=\"country_id\"><![CDATA["+country_id+"]]\></column>";
|
||
rec.f_Settings+=" <column n=\"date_start\"><![CDATA["+ (Math.floor(Date.now() / 1000) - 7776000) + "]]\></column>";
|
||
rec.f_Settings+=" <column n=\"date_end\"><![CDATA["+ (Math.floor(Date.now() / 1000) + 86400) +"]]\></column>";
|
||
rec.f_Settings+=" </filter>";
|
||
rec.f_Settings+=" </objects-list>";
|
||
rec.f_Settings+="</type></metadata>";
|
||
|
||
//alert(rec.f_Settings);
|
||
|
||
rec.win.setSize("800px","500px");
|
||
//rec.win.setHeight(500);
|
||
//rec.win.setLeftTop(300,40);
|
||
rec.win.setCenter();
|
||
rec.request.callServer(ScriptName,'<metadata fn="0"><type n="ReportTabletsStatistics"></type></metadata>');
|
||
}
|
||
|
||
|
||
|
||
//Green style (norm)
|
||
function createFatypeStyleG(feature)
|
||
{
|
||
return function(){
|
||
var zoom = map.getView().getZoom();
|
||
var text = zoom > 12 ? feature.get('name') : '';
|
||
|
||
var iconStyleG = new ol.style.Style({
|
||
image: new ol.style.Icon(({
|
||
anchor: [0.5, 24],
|
||
anchorXUnits: 'fraction',
|
||
anchorYUnits: 'pixels',
|
||
opacity: 0.75,
|
||
src: '../resources/engine/images/icons/marker_g.png'
|
||
})),
|
||
text: new ol.style.Text({
|
||
font: '12px helvetica,sans-serif',
|
||
offsetY: 10,
|
||
text: text,
|
||
fill: new ol.style.Fill({color: '#000'}),
|
||
stroke: new ol.style.Stroke({color: '#fff', width: 2})
|
||
})
|
||
});
|
||
return iconStyleG;
|
||
}
|
||
}
|
||
|
||
//Yellow (attention)
|
||
function createFatypeStyleY(feature)
|
||
{
|
||
return function(){
|
||
var zoom = map.getView().getZoom();
|
||
var text = zoom > 12 ? feature.get('name') : '';
|
||
|
||
var iconStyleG = new ol.style.Style({
|
||
image: new ol.style.Icon(({
|
||
anchor: [0.5, 24],
|
||
anchorXUnits: 'fraction',
|
||
anchorYUnits: 'pixels',
|
||
opacity: 0.75,
|
||
src: '../resources/engine/images/icons/marker_y.png'
|
||
})),
|
||
text: new ol.style.Text({
|
||
font: '12px helvetica,sans-serif',
|
||
text: text,
|
||
fill: new ol.style.Fill({color: '#000'}),
|
||
stroke: new ol.style.Stroke({color: '#fff', width: 2})
|
||
})
|
||
});
|
||
return iconStyleG;
|
||
}
|
||
}
|
||
|
||
//Red (dangerous)
|
||
function createFatypeStyleR(feature)
|
||
{
|
||
return function(){
|
||
var zoom = map.getView().getZoom();
|
||
var text = zoom > 12 ? feature.get('name') : '';
|
||
|
||
var iconStyleG = new ol.style.Style({
|
||
image: new ol.style.Icon(({
|
||
anchor: [0.5, 24],
|
||
anchorXUnits: 'fraction',
|
||
anchorYUnits: 'pixels',
|
||
opacity: 0.75,
|
||
src: '../resources/engine/images/icons/marker_r.png'
|
||
})),
|
||
text: new ol.style.Text({
|
||
font: '12px helvetica,sans-serif',
|
||
text: text,
|
||
fill: new ol.style.Fill({color: '#000'}),
|
||
stroke: new ol.style.Stroke({color: '#fff', width: 2})
|
||
})
|
||
});
|
||
return iconStyleG;
|
||
}
|
||
}
|
||
|
||
//Red (dangerous)
|
||
function createFatypeStyleNone(feature)
|
||
{
|
||
return function(){
|
||
var zoom = map.getView().getZoom();
|
||
var text = zoom > 12 ? feature.get('name') : '';
|
||
|
||
var iconStyleG = new ol.style.Style({
|
||
image: new ol.style.Icon(({
|
||
anchor: [0.5, 24],
|
||
anchorXUnits: 'fraction',
|
||
anchorYUnits: 'pixels',
|
||
opacity: 0.75,
|
||
src: '../resources/engine/images/icons/marker_e.png'
|
||
})),
|
||
text: new ol.style.Text({
|
||
font: '12px helvetica,sans-serif',
|
||
text: text,
|
||
fill: new ol.style.Fill({color: '#000'}),
|
||
stroke: new ol.style.Stroke({color: '#fff', width: 2})
|
||
})
|
||
});
|
||
return iconStyleG;
|
||
}
|
||
}
|
||
|
||
//Style for the destruction of locusts.
|
||
function createFatypeStyleDel(feature,red)
|
||
{
|
||
return function(){
|
||
var zoom = map.getView().getZoom();
|
||
var text = zoom > 12 ? feature.get('name') : '';
|
||
|
||
var iconStyleG;
|
||
if(red)
|
||
{
|
||
iconStyleG = new ol.style.Style({
|
||
image: new ol.style.Icon(({
|
||
anchor: [0.5, 25],
|
||
anchorXUnits: 'fraction',
|
||
anchorYUnits: 'pixels',
|
||
opacity: 0.75,
|
||
src: '../resources/engine/images/icons/flag.png'
|
||
})),
|
||
text: new ol.style.Text({
|
||
font: '12px helvetica,sans-serif',
|
||
text: text,
|
||
fill: new ol.style.Fill({color: '#000'}),
|
||
stroke: new ol.style.Stroke({color: '#fff', width: 2})
|
||
})
|
||
});
|
||
}else
|
||
{
|
||
iconStyleG = new ol.style.Style({
|
||
image: new ol.style.Icon(({
|
||
anchor: [0.5, 25],
|
||
anchorXUnits: 'fraction',
|
||
anchorYUnits: 'pixels',
|
||
opacity: 0.75,
|
||
src: '../resources/engine/images/icons/flag.png'
|
||
})),
|
||
text: new ol.style.Text({
|
||
font: '12px helvetica,sans-serif',
|
||
text: text,
|
||
fill: new ol.style.Fill({color: '#000'}),
|
||
stroke: new ol.style.Stroke({color: '#fff', width: 2})
|
||
})
|
||
});
|
||
}
|
||
return iconStyleG;
|
||
}
|
||
}
|
||
|
||
//Hide map: country regions.
|
||
function hideFrmLocustInfoData()
|
||
{
|
||
vectorSourceArea.clear(false);
|
||
//Hide legend
|
||
if(typeof g_WinLegend3 != "undefined" && g_WinLegend3!=null)
|
||
{
|
||
g_WinLegend3.hide(true);
|
||
}
|
||
}
|
||
// Call data for build map by country regions.
|
||
function callFrmLocustInfoData()
|
||
{
|
||
var country_id="";
|
||
var region_id="";
|
||
var locust_type_id="";
|
||
var year="";
|
||
var product_id = "";
|
||
|
||
var input;
|
||
input = document.getElementById('filter_X3_country_id');
|
||
if(input!=null) country_id=input.value;
|
||
input = document.getElementById('filter_X3_region_id');
|
||
if(input!=null) region_id=input.value;
|
||
input = document.getElementById('filter_X3_locust_type_id');
|
||
if(input!=null) locust_type_id=input.value;
|
||
input = document.getElementById('filter_X3_year');
|
||
if(input!=null) year=input.value;
|
||
input = document.getElementById('filter_X3_indicator');
|
||
if(input!=null) product_id=input.value;
|
||
|
||
var xs='';
|
||
if(product_id==2) //Product N 2
|
||
{
|
||
if(region_id=='')
|
||
{
|
||
xs='<?xml version="1.0" encoding="utf-8"?>\n\
|
||
<metadata fn="4">\n\
|
||
<type n="Product2" pp="-1">\n\
|
||
<objects-list>\n\
|
||
<filter>\n\
|
||
<column n="country_id"><![CDATA['+country_id+']]></column>\n\
|
||
<column n="locust_type_id"><![CDATA['+locust_type_id+']]></column>\n\
|
||
<column n="year"><![CDATA['+year+']]></column>\n\
|
||
<column n="years"><![CDATA[20]]></column>\n\
|
||
</filter>\n\
|
||
<column n="percent"/>\n\
|
||
<column n="region_id"/>\n\
|
||
<column n="name"/>\n\
|
||
<column n="year"/>\n\
|
||
<column n="locust_type_id"/>\n\
|
||
</objects-list>\n\
|
||
</type>\n\
|
||
</metadata>';
|
||
|
||
var request=new TRequest(this);
|
||
request.userData="FrmLocustInfoData";
|
||
}else
|
||
{
|
||
xs='<?xml version="1.0" encoding="utf-8"?>\n\
|
||
<metadata fn="4">\n\
|
||
<type n="Product2r" pp="-1">\n\
|
||
<objects-list>\n\
|
||
<filter>\n\
|
||
<column n="country_id"><![CDATA['+country_id+']]></column>\n\
|
||
<column n="region_id"><![CDATA['+region_id+']]></column>\n\
|
||
<column n="locust_type_id"><![CDATA['+locust_type_id+']]></column>\n\
|
||
<column n="year"><![CDATA['+year+']]></column>\n\
|
||
<column n="years"><![CDATA[20]]></column>\n\
|
||
</filter>\n\
|
||
<column n="percent"/>\n\
|
||
<column n="district_id"/>\n\
|
||
<column n="name"/>\n\
|
||
<column n="year"/>\n\
|
||
<column n="locust_type_id"/>\n\
|
||
</objects-list>\n\
|
||
</type>\n\
|
||
</metadata>';
|
||
|
||
var request=new TRequest(this);
|
||
request.userData="FrmLocustInfoData_r";
|
||
}
|
||
|
||
}else
|
||
if(product_id==3) //Product N 3
|
||
{
|
||
if(region_id=='')
|
||
{
|
||
xs='<?xml version="1.0" encoding="utf-8"?>\n\
|
||
<metadata fn="4">\n\
|
||
<type n="Product3" pp="-1">\n\
|
||
<objects-list>\n\
|
||
<filter>\n\
|
||
<column n="country_id"><![CDATA['+country_id+']]></column>\n\
|
||
<column n="locust_type_id"><![CDATA['+locust_type_id+']]></column>\n\
|
||
<column n="year"><![CDATA['+year+']]></column>\n\
|
||
<column n="years"><![CDATA[20]]></column>\n\
|
||
</filter>\n\
|
||
<column n="percent"/>\n\
|
||
<column n="region_id"/>\n\
|
||
<column n="name"/>\n\
|
||
<column n="year"/>\n\
|
||
<column n="locust_type_id"/>\n\
|
||
</objects-list>\n\
|
||
</type>\n\
|
||
</metadata>';
|
||
|
||
var request=new TRequest(this);
|
||
request.userData="FrmLocustInfoData";
|
||
}else
|
||
{
|
||
xs='<?xml version="1.0" encoding="utf-8"?>\n\
|
||
<metadata fn="4">\n\
|
||
<type n="Product3r" pp="-1">\n\
|
||
<objects-list>\n\
|
||
<filter>\n\
|
||
<column n="country_id"><![CDATA['+country_id+']]></column>\n\
|
||
<column n="region_id"><![CDATA['+region_id+']]></column>\n\
|
||
<column n="locust_type_id"><![CDATA['+locust_type_id+']]></column>\n\
|
||
<column n="year"><![CDATA['+year+']]></column>\n\
|
||
<column n="years"><![CDATA[20]]></column>\n\
|
||
</filter>\n\
|
||
<column n="percent"/>\n\
|
||
<column n="district_id"/>\n\
|
||
<column n="name"/>\n\
|
||
<column n="year"/>\n\
|
||
<column n="locust_type_id"/>\n\
|
||
</objects-list>\n\
|
||
</type>\n\
|
||
</metadata>';
|
||
|
||
var request=new TRequest(this);
|
||
request.userData="FrmLocustInfoData_r";
|
||
}
|
||
}else
|
||
if(product_id==4) //Product N 4 "Карта уровня угроз"
|
||
{
|
||
if(region_id=='')
|
||
{
|
||
xs='<?xml version="1.0" encoding="utf-8"?>\n\
|
||
<metadata fn="4">\n\
|
||
<type n="Product4" pp="-1">\n\
|
||
<objects-list>\n\
|
||
<filter>\n\
|
||
<column n="country_id"><![CDATA['+country_id+']]></column>\n\
|
||
<column n="locust_type_id"><![CDATA['+locust_type_id+']]></column>\n\
|
||
<column n="year"><![CDATA['+year+']]></column>\n\
|
||
</filter>\n\
|
||
<column n="percent"/>\n\
|
||
<column n="region_id"/>\n\
|
||
<column n="region_name"/>\n\
|
||
<column n="year"/>\n\
|
||
<column n="locust_type_id"/>\n\
|
||
<column n="treated"/>\n\
|
||
<column n="infested_etd"/>\n\
|
||
</objects-list>\n\
|
||
</type>\n\
|
||
</metadata>';
|
||
|
||
var request=new TRequest(this);
|
||
request.userData="FrmLocustInfoData4";
|
||
}else
|
||
{
|
||
xs='<?xml version="1.0" encoding="utf-8"?>\n\
|
||
<metadata fn="4">\n\
|
||
<type n="Product4r" pp="-1">\n\
|
||
<objects-list>\n\
|
||
<filter>\n\
|
||
<column n="country_id"><![CDATA['+country_id+']]></column>\n\
|
||
<column n="region_id"><![CDATA['+region_id+']]></column>\n\
|
||
<column n="locust_type_id"><![CDATA['+locust_type_id+']]></column>\n\
|
||
<column n="year"><![CDATA['+year+']]></column>\n\
|
||
</filter>\n\
|
||
<column n="percent"/>\n\
|
||
<column n="district_id"/>\n\
|
||
<column n="district_name"/>\n\
|
||
<column n="year"/>\n\
|
||
<column n="locust_type_id"/>\n\
|
||
<column n="treated"/>\n\
|
||
<column n="infested_etd"/>\n\
|
||
</objects-list>\n\
|
||
</type>\n\
|
||
</metadata>';
|
||
|
||
var request=new TRequest(this);
|
||
request.userData="FrmLocustInfoData4_r";
|
||
|
||
}
|
||
}
|
||
|
||
if(request.callServer(ScriptName,xs))
|
||
{
|
||
showProgressBar("FrmLocustInfoData");
|
||
}
|
||
|
||
//Show legend
|
||
if(typeof g_WinLegend3 == "undefined" || g_WinLegend3==null || g_WinLegend3.closed)
|
||
{
|
||
g_WinLegend3=new TWin();
|
||
g_WinLegend3.BuildGUI(window.innerWidth-285,40);
|
||
}
|
||
g_WinLegend3.setCaption(trt('Legend'));
|
||
g_WinLegend3.setSize("100px","80px");
|
||
if(product_id==2)
|
||
{
|
||
g_WinLegend3.setContent('<table border="0" style="white-space:nowrap;"><tr><td style="background-color:#ff0000;"> </td><td>>15%</td><td style="padding-left:10px;">'+trt('Increase')+'</td></tr><tr><td style="background-color:#ffee00;"> </td><td>>=15% '+trt('and')+' <=15%</td><td style="padding-left:10px;">'+trt('On_the_same_level')+'</td><tr><td style="background-color:#00ff4c;"> </td><td><15%</td><td style="padding-left:10px;">'+trt('Decrease')+'</td></tr></tr><tr><td style="background-color:#c8c8c8;"> </td><td> </td><td style="padding-left:10px;">'+trt('No_data')+'</td></tr></table>');
|
||
}
|
||
if(product_id==3)
|
||
{
|
||
g_WinLegend3.setContent('<table border="0" style="white-space:nowrap;"><tr><td style="background-color:#ff0000;"> </td><td>>15%</td><td style="padding-left:10px;">'+trt('Increase')+'</td></tr><tr><td style="background-color:#ffee00;"> </td><td>>=15% '+trt('and')+' <=15%</td><td style="padding-left:10px;">'+trt('On_the_same_level')+'</td><tr><td style="background-color:#00ff4c;"> </td><td><15%</td><td style="padding-left:10px;">'+trt('Decrease')+'</td></tr></tr><tr><td style="background-color:#c8c8c8;"> </td><td> </td><td style="padding-left:10px;">'+trt('No_data')+'</td></tr></table>');
|
||
}
|
||
if(product_id==4)
|
||
{
|
||
g_WinLegend3.setContent('<table border="0" style="white-space:nowrap;"><tr><td style="background-color:#00ff4c;"> </td><td>>-25% '+trt('and')+' <25%</td><td style="padding-left:10px;">'+trt('Normal_Multiyear_average_level')+'</td></tr><tr><td style="background-color:#ff0000;"> </td><td><=-25% '+trt('or')+' >=25%</td><td style="padding-left:10px;">'+trt('Danger')+'</td></tr><tr><td style="background-color:#c8c8c8;"> </td><td> </td><td style="padding-left:10px;">'+trt('No_data')+'</td></tr></table>');
|
||
}
|
||
g_WinLegend3.hide(false);
|
||
g_WinLegend3.setLeftTop(window.innerWidth-g_WinLegend3.getWidth()-20,40);
|
||
setTimeout(function() { g_WinLegend3.setLeftTop(window.innerWidth-g_WinLegend3.getWidth()-20,40); }, 1000);
|
||
}
|
||
|
||
function openFrmLocustData()
|
||
{
|
||
var input;
|
||
|
||
var country_id="";
|
||
var date_start="";
|
||
var date_end="";
|
||
var device_id="";
|
||
var registered="";
|
||
var test="";
|
||
|
||
input = document.getElementById('filter_X1_country_id');
|
||
if(input!=null) country_id=input.value;
|
||
var region_id = $('#filter_X1_region_id').val();
|
||
input = document.getElementById('filter_X1_date_start');
|
||
if(input!=null)
|
||
{
|
||
date = new Date(input.value.replace(/-/g, "/"))
|
||
date_start=date.getTime()/1000;
|
||
if(isNaN(date_start)) date_start='';
|
||
}
|
||
input = document.getElementById('filter_X1_date_end');
|
||
if(input!=null)
|
||
{
|
||
date = new Date(input.value.replace(/-/g, "/"))
|
||
date_end=date.getTime()/1000;
|
||
if(isNaN(date_end)) date_end='';
|
||
}
|
||
input = document.getElementById('filter_X1_device_id');
|
||
if(input!=null){
|
||
if(input.value=="2") test="1";
|
||
else device_id=input.value;
|
||
}
|
||
input = document.getElementById('filter_X1_registered');
|
||
if(input!=null) registered=input.value;
|
||
|
||
rec=new SRec();
|
||
rec.create(null);
|
||
rec.f_TypeName="FrmLocust";
|
||
|
||
rec.f_Settings='\
|
||
<metadata><type n="FrmLocust">\n\
|
||
<objects-list>\n\
|
||
<filter height="1">\n\
|
||
<column n="id"><![CDATA[]]></column>\n\
|
||
<column n="country_id"><![CDATA['+country_id+']]></column>\n\
|
||
<column n="region_id"><![CDATA['+region_id+']]></column>\n\
|
||
<column n="date_start"><![CDATA['+date_start+']]></column>\n\
|
||
<column n="date_end"><![CDATA['+date_end+']]></column>\n\
|
||
<column n="device_id"><![CDATA['+device_id+']]></column>\n\
|
||
<column n="user_id"><![CDATA[]]></column>\n\
|
||
<column n="registered"><![CDATA['+registered+']]></column>\n\
|
||
<column n="test"><![CDATA['+test+']]></column>\n\
|
||
</filter>\n\
|
||
<column n=\"lon\" visible=\"0\"/>\n\
|
||
<column n=\"lat\" visible=\"0\"/>\n\
|
||
<column n=\"locust_have\" visible=\"0\"/>\n\
|
||
<column n=\"changed\" visible=\"0\"/>\n\
|
||
<column n=\"photo1\" visible=\"0\"/>\n\
|
||
<column n=\"photo2\" visible=\"0\"/>\n\
|
||
<column n=\"photo3\" visible=\"0\"/>\n\
|
||
<column n=\"have\" visible=\"0\"/>\n\
|
||
</objects-list>\n\
|
||
</type></metadata>\n\
|
||
';
|
||
|
||
//alert("config: "+rec.f_Settings);
|
||
|
||
//rec.win.setSize("400px","100px");
|
||
rec.win.setHeight(500);
|
||
//rec.win.setLeftTop(300,40);
|
||
rec.win.setCenter();
|
||
rec.request.callServer(ScriptName,'<metadata fn="0"><type n="FrmLocust"></type></metadata>');
|
||
}
|
||
|
||
function openLayoutsWin()
|
||
{
|
||
var input;
|
||
|
||
rec=new SRec();
|
||
rec.create(null);
|
||
rec.f_TypeName="Layouts";
|
||
|
||
rec.win.setHeight(500);
|
||
rec.win.setCenter();
|
||
rec.request.callServer(ScriptName,'<metadata fn="0"><type n="Layouts"></type></metadata>');
|
||
}
|
||
|
||
function openFrmLocustDelData()
|
||
{
|
||
var input;
|
||
|
||
var country_id="";
|
||
var date_start="";
|
||
var date_end="";
|
||
var device_id="";
|
||
var registered="";
|
||
var test="";
|
||
|
||
input = document.getElementById('filter_X2_country_id');
|
||
if(input!=null) country_id=input.value;
|
||
var region_id = $('#filter_X2_region_id').val();
|
||
input = document.getElementById('filter_X2_date_start');
|
||
if(input!=null)
|
||
{
|
||
date = new Date(input.value.replace(/-/g, "/"));
|
||
date_start=date.getTime()/1000;// - date.getTimezoneOffset()*60;
|
||
if(isNaN(date_start)) date_start='';
|
||
}
|
||
input = document.getElementById('filter_X2_date_end');
|
||
if(input!=null)
|
||
{
|
||
date = new Date(input.value.replace(/-/g, "/"));
|
||
date_end=date.getTime()/1000;// - date.getTimezoneOffset()*60;
|
||
if(isNaN(date_end)) date_end='';
|
||
}
|
||
input = document.getElementById('filter_X2_device_id');
|
||
if(input!=null){
|
||
if(input.value=="2") test="1";
|
||
else device_id=input.value;
|
||
}
|
||
input = document.getElementById('filter_X2_registered');
|
||
if(input!=null) registered=input.value;
|
||
|
||
rec=new SRec();
|
||
rec.create(null);
|
||
rec.f_TypeName="FrmLocustDel";
|
||
|
||
rec.f_Settings='\
|
||
<metadata><type n="FrmLocustDel">\n\
|
||
<objects-list>\n\
|
||
<filter height="1">\n\
|
||
<column n="id"><![CDATA[]]></column>\n\
|
||
<column n="country_id"><![CDATA['+country_id+']]></column>\n\
|
||
<column n="region_id"><![CDATA['+region_id+']]></column>\n\
|
||
<column n="date_start"><![CDATA['+date_start+']]></column>\n\
|
||
<column n="date_end"><![CDATA['+date_end+']]></column>\n\
|
||
<column n="device_id"><![CDATA['+device_id+']]></column>\n\
|
||
<column n="user_id"><![CDATA[]]></column>\n\
|
||
<column n="registered"><![CDATA['+registered+']]></column>\n\
|
||
<column n="test"><![CDATA['+test+']]></column>\n\
|
||
</filter>\n\
|
||
<column n=\"lon\" visible=\"0\"/>\n\
|
||
<column n=\"lat\" visible=\"0\"/>\n\
|
||
<column n=\"locust_have\" visible=\"0\"/>\n\
|
||
<column n=\"changed\" visible=\"0\"/>\n\
|
||
<column n=\"photo1\" visible=\"0\"/>\n\
|
||
<column n=\"photo2\" visible=\"0\"/>\n\
|
||
<column n=\"photo3\" visible=\"0\"/>\n\
|
||
<column n=\"have\" visible=\"0\"/>\n\
|
||
</objects-list>\n\
|
||
</type></metadata>\n\
|
||
';
|
||
|
||
//rec.win.setSize("400px","100px");
|
||
rec.win.setHeight(500);
|
||
//rec.win.setLeftTop(300,40);
|
||
rec.win.setCenter();
|
||
rec.request.callServer(ScriptName,'<metadata fn="0"><type n="FrmLocustDel"></type></metadata>');
|
||
}
|
||
|
||
function hideFrmLocustData()
|
||
{
|
||
vectorSource.clear(false);
|
||
vectorSourceV.clear(false);
|
||
//Hide legend
|
||
if(typeof g_WinLegend1 != "undefined" && g_WinLegend1!=null)
|
||
{
|
||
g_WinLegend1.hide(true);
|
||
}
|
||
}
|
||
|
||
//Call data for create markers
|
||
function callFrmLocustData()
|
||
{
|
||
let input; let value;
|
||
|
||
let rData = {
|
||
country_id: null,
|
||
region_id: null,
|
||
locust_type_id: null,
|
||
date_start: null,
|
||
date_end: null,
|
||
device_id: null,
|
||
registered: null,
|
||
indicator: null,
|
||
test: null
|
||
};
|
||
value = $('#filter_X1_country_id').val();
|
||
if(value!='') rData.country_id = parseInt(value);
|
||
value = $('#filter_X1_region_id').val();
|
||
if(value!='') rData.region_id = parseInt(value);
|
||
|
||
value = $('#filter_X1_locust_type_id').val();
|
||
if(value!='') rData.locust_type_id = parseInt(value);
|
||
|
||
input = document.getElementById('filter_X1_date_start');
|
||
if(input!=null)
|
||
{
|
||
let date = new Date(input.value.replace(/-/g, "/"));
|
||
rData.date_start=date.getTime()/1000;// - date.getTimezoneOffset()*60;
|
||
if(isNaN(rData.date_start)) rData.date_start=null;
|
||
}
|
||
input = document.getElementById('filter_X1_date_end');
|
||
if(input!=null)
|
||
{
|
||
let date = new Date(input.value.replace(/-/g, "/"));
|
||
rData.date_end=date.getTime()/1000;// - date.getTimezoneOffset()*60;
|
||
if(isNaN(rData.date_end)) rData.date_end=null;
|
||
}
|
||
|
||
value = $('#filter_X1_device_id').val();
|
||
if(value!=''){
|
||
if(value=="2") rData.test="1";
|
||
else rData.device_id = parseInt(value);
|
||
}
|
||
|
||
value = $('#filter_X1_registered').val();
|
||
if(value!='') rData.registered = parseInt(value);
|
||
|
||
input = document.getElementById('filter_X1_indicator');
|
||
if(input!=null) rData.indicator=input.value;
|
||
|
||
$.ajax({
|
||
url: '../get_survey',
|
||
data: JSON.stringify(rData),
|
||
contentType: 'application/json; charset=utf-8',
|
||
type: "POST",
|
||
dataType: "json",
|
||
success: function(data,status){
|
||
if(status=='success')
|
||
{
|
||
if(data.errorCode=='0')
|
||
{
|
||
updatePOILocust(data.data,data.indicator);
|
||
}else
|
||
{
|
||
alert2(trt('Error'),data.errorMessage);
|
||
}
|
||
}else{
|
||
alert2(trt('Alert'),status);
|
||
}
|
||
hideProgressBar('FrmLocustData');
|
||
},
|
||
error: function(jqXHR, exception) {
|
||
alert2(trt('Alert'),jqXHR.responseText);
|
||
hideProgressBar("FrmLocustData");
|
||
}
|
||
});
|
||
showProgressBar("FrmLocustData");
|
||
|
||
/*
|
||
var request=new TRequest(this);
|
||
request.userData="FrmLocustData";
|
||
request.userIndicator=indicator;
|
||
if(request.callServer(ScriptName,xs))
|
||
{
|
||
showProgressBar("FrmLocustData");
|
||
}
|
||
*/
|
||
//Show legend
|
||
if(typeof g_WinLegend1 == "undefined" || g_WinLegend1==null || g_WinLegend1.closed)
|
||
{
|
||
g_WinLegend1=new TWin();
|
||
g_WinLegend1.BuildGUI(window.innerWidth-150,40);
|
||
}
|
||
g_WinLegend1.setCaption(trt('Legend'));
|
||
g_WinLegend1.setSize("100px","80px");
|
||
|
||
if(rData.indicator=="1")
|
||
{
|
||
g_WinLegend1.setContent('<table border="0" style="white-space:nowrap;"><tr><td><img src="../resources/engine/images/icons/marker_r.png" alt=""></td><td>>1</td><td style="padding-left:10px;">'+trt('Danger')+'</td></tr><tr><td><img src="../resources/engine/images/icons/marker_y.png" alt=""></td><td><=1</td><td style="padding-left:10px;">'+trt('Attention')+'</td></tr><tr><td><img src="../resources/engine/images/icons/marker_g.png" alt=""></td><td>=0</td><td style="padding-left:10px;">'+trt('Quietly')+'</td></tr><tr><td><img src="../resources/engine/images/icons/marker_e.png" alt=""></td><td></td><td style="padding-left:10px;">'+trt('No_data')+'</td></tr></table>');
|
||
}
|
||
if(rData.indicator=="2")
|
||
{
|
||
g_WinLegend1.setContent('<table border="0" style="white-space:nowrap;"><tr><td><img src="../resources/engine/images/icons/marker_r.png" alt=""></td><td>>=5</td><td style="padding-left:10px;">'+trt('Danger')+'</td></tr><tr><td><img src="../resources/engine/images/icons/marker_y.png" alt=""></td><td>>=3 ... <5</td><td style="padding-left:10px;">'+trt('Caution')+'</td></tr><tr><td><img src="../resources/engine/images/icons/marker_g.png" alt=""></td><td><=2</td><td style="padding-left:10px;">'+trt('Calm')+'</td></tr><tr><td><img src="../resources/engine/images/icons/marker_e.png" alt=""></td><td></td><td style="padding-left:10px;">'+trt('No_data')+'</td></tr></table>');
|
||
}
|
||
if(rData.indicator=="3")
|
||
{
|
||
g_WinLegend1.setLeftTop(window.innerWidth-200,40)
|
||
g_WinLegend1.setContent('<table border="0" style="white-space:nowrap;"><tr><td><img src="../resources/engine/images/icons/marker_r.png" alt=""></td><td>>=1</td><td style="padding-left:10px;">'+trt('Danger')+'</td></tr><tr><td><img src="../resources/engine/images/icons/marker_g.png" alt=""></td><td><1</td><td style="padding-left:10px;">'+trt('Calm')+'</td></tr><tr><td><img src="../resources/engine/images/icons/marker_e.png" alt=""></td><td></td><td style="padding-left:10px;">'+trt('No_data')+'</td></tr></table>');
|
||
}
|
||
if(rData.indicator=="4")
|
||
{
|
||
g_WinLegend1.setContent('<table border="0" style="white-space:nowrap;"><tr><td><img src="../resources/engine/images/icons/marker_r.png" alt=""></td><td>>=5</td><td style="padding-left:10px;">'+trt('Danger')+'</td></tr><tr><td><img src="../resources/engine/images/icons/marker_y.png" alt=""></td><td>>=3 ... <5</td><td style="padding-left:10px;">'+trt('Caution')+'</td></tr><tr><td><img src="../resources/engine/images/icons/marker_g.png" alt=""></td><td><=2</td><td style="padding-left:10px;">'+trt('Calm')+'</td></tr><tr><td><img src="../resources/engine/images/icons/marker_e.png" alt=""></td><td></td><td style="padding-left:10px;">'+trt('No_data')+'</td></tr></table>');
|
||
}
|
||
if(rData.indicator=="5")
|
||
{
|
||
g_WinLegend1.setContent('<table border="0" style="white-space:nowrap;"><tr><td><img src="../resources/engine/images/icons/marker_r.png" alt=""></td><td>>=1</td><td style="padding-left:10px;">'+trt('Danger')+'</td></tr><tr><td><img src="../resources/engine/images/icons/marker_g.png" alt=""></td><td><1</td><td style="padding-left:10px;">'+trt('Calm')+'</td></tr><tr><td><img src="../resources/engine/images/icons/marker_e.png" alt=""></td><td></td><td style="padding-left:10px;">'+trt('No_data')+'</td></tr></table>');
|
||
}
|
||
g_WinLegend1.hide(false);
|
||
g_WinLegend1.setLeftTop(window.innerWidth-g_WinLegend1.getWidth()-20,40);
|
||
setTimeout(function() { g_WinLegend1.setLeftTop(window.innerWidth-g_WinLegend1.getWidth()-20,40); }, 1000);
|
||
}
|
||
|
||
//Hide data for create markers
|
||
function hideFrmLocustDelData()
|
||
{
|
||
vectorSourceDel.clear(false);
|
||
vectorSourceDelV.clear(false);
|
||
//Hide legend
|
||
if(typeof g_WinLegend0 != "undefined" && g_WinLegend0!=null)
|
||
{
|
||
g_WinLegend0.hide(true);
|
||
}
|
||
}
|
||
//Call data for create markers
|
||
function callFrmLocustDelData()
|
||
{
|
||
let input; let value;
|
||
|
||
let rData = {
|
||
country_id: null,
|
||
region_id: null,
|
||
date_start: null,
|
||
date_end: null,
|
||
device_id: null,
|
||
registered: null,
|
||
test: null
|
||
};
|
||
value = $('#filter_X2_country_id').val();
|
||
if(value!='') rData.country_id = parseInt(value);
|
||
value = $('#filter_X2_region_id').val();
|
||
if(value!='') rData.region_id = parseInt(value);
|
||
input = document.getElementById('filter_X2_date_start');
|
||
if(input!=null)
|
||
{
|
||
let date = new Date(input.value.replace(/-/g, "/"));
|
||
rData.date_start=date.getTime()/1000;// - date.getTimezoneOffset()*60;
|
||
if(isNaN(rData.date_start)) rData.date_start=null;
|
||
}
|
||
input = document.getElementById('filter_X2_date_end');
|
||
if(input!=null)
|
||
{
|
||
let date = new Date(input.value.replace(/-/g, "/"));
|
||
rData.date_end=date.getTime()/1000;// - date.getTimezoneOffset()*60;
|
||
if(isNaN(rData.date_end)) rData.date_end=null;
|
||
}
|
||
value = $('#filter_X2_device_id').val();
|
||
if(value!=''){
|
||
if(value=="2") rData.test="1";
|
||
else rData.device_id = parseInt(value);
|
||
}
|
||
|
||
value = $('#filter_X2_registered').val();
|
||
if(value!='') rData.registered = parseInt(value);
|
||
|
||
$.ajax({
|
||
url: '../get_spray',
|
||
data: JSON.stringify(rData),
|
||
contentType: 'application/json; charset=utf-8',
|
||
type: "POST",
|
||
dataType: "json",
|
||
success: function(data,status){
|
||
if(status=='success')
|
||
{
|
||
if(data.errorCode=='0')
|
||
{
|
||
updatePOILocustDel(data.data);
|
||
}else
|
||
{
|
||
alert2(trt('Error'),data.errorMessage);
|
||
}
|
||
}else{
|
||
alert2(trt('Alert'),status);
|
||
}
|
||
hideProgressBar('FrmLocustDelData');
|
||
},
|
||
error: function(jqXHR, exception) {
|
||
alert2(trt('Alert'),jqXHR.responseText);
|
||
hideProgressBar("FrmLocustData");
|
||
}
|
||
});
|
||
showProgressBar("FrmLocustDelData");
|
||
|
||
/*
|
||
var xs='';
|
||
xs='<?xml version="1.0" encoding="utf-8"?>\n\
|
||
<metadata fn="4">\n\
|
||
<type n="FrmLocustDel" pp="-1">\n\
|
||
<objects-list>\n\
|
||
<filter>\n\
|
||
<column n="id"><![CDATA[]]></column>\n\
|
||
<column n="country_id"><![CDATA['+country_id+']]></column>\n\
|
||
<column n="region_id"><![CDATA['+region_id+']]></column>\n\
|
||
<column n="date_start"><![CDATA['+date_start+']]></column>\n\
|
||
<column n="date_end"><![CDATA['+date_end+']]></column>\n\
|
||
<column n="device_id"><![CDATA['+device_id+']]></column>\n\
|
||
<column n="user_id"><![CDATA[]]></column>\n\
|
||
<column n="registered"><![CDATA['+registered+']]></column>\n\
|
||
</filter>\n\
|
||
<column n="lat_center"/>\n\
|
||
<column n="lon_center"/>\n\
|
||
<column n="terrain"/>\n\
|
||
<column n="treated_area"/>\n\
|
||
<column n="infested_area"/>\n\
|
||
</objects-list>\n\
|
||
</type>\n\
|
||
</metadata>';
|
||
|
||
//alert('xs='+xs);
|
||
|
||
var request=new TRequest(this);
|
||
request.userData="FrmLocustDelData";
|
||
|
||
if(request.callServer(ScriptName,xs))
|
||
{
|
||
showProgressBar("FrmLocustDelData");
|
||
}
|
||
*/
|
||
//Show legend
|
||
if(typeof g_WinLegend0 == "undefined" || g_WinLegend0==null || g_WinLegend0.closed)
|
||
{
|
||
g_WinLegend0=new TWin();
|
||
g_WinLegend0.BuildGUI(window.innerWidth-150,40);
|
||
}
|
||
g_WinLegend0.setCaption(trt('Legend'));
|
||
g_WinLegend0.setSize("145px","65px");
|
||
g_WinLegend0.setContent('<table border="0" style="white-space:nowrap;"><tr><td><img src="../resources/engine/images/icons/flag.png" alt=""></td><td style="padding-left:10px;">'+trt('Spraying')+'</td></tr></table>');
|
||
g_WinLegend0.hide(false);
|
||
g_WinLegend0.setLeftTop(window.innerWidth-g_WinLegend0.getWidth()-20,40);
|
||
setTimeout(function() { g_WinLegend0.setLeftTop(window.innerWidth-g_WinLegend0.getWidth()-20,40); }, 1000);
|
||
}
|
||
|
||
//Call data for create markers
|
||
function callFrmCheckpoints(){
|
||
let input; let value;
|
||
|
||
let rData = {
|
||
country_id: null
|
||
};
|
||
value = $('#filter_checkpoint_country_id').val();
|
||
if(value!='') rData.country_id = parseInt(value);
|
||
|
||
$.ajax({
|
||
url: '../get_checkpoints',
|
||
data: JSON.stringify(rData),
|
||
contentType: 'application/json; charset=utf-8',
|
||
type: "POST",
|
||
dataType: "json",
|
||
success: function(data,status){
|
||
if(status=='success')
|
||
{
|
||
if(data.errorCode=='0')
|
||
{
|
||
//updatePOILocustDel(data.data);
|
||
}else
|
||
{
|
||
alert2(trt('Error'),data.errorMessage);
|
||
}
|
||
}else{
|
||
alert2(trt('Alert'),status);
|
||
}
|
||
hideProgressBar('FrmCheckpointData');
|
||
},
|
||
error: function(jqXHR, exception) {
|
||
alert2(trt('Alert'),jqXHR.responseText);
|
||
hideProgressBar('FrmCheckpointData');
|
||
}
|
||
});
|
||
showProgressBar("FrmCheckpointData");
|
||
|
||
//Show legend
|
||
/*if(typeof g_WinLegend0 == "undefined" || g_WinLegend0==null || g_WinLegend0.closed)
|
||
{
|
||
g_WinLegend0=new TWin();
|
||
g_WinLegend0.BuildGUI(window.innerWidth-150,40);
|
||
}
|
||
g_WinLegend0.setCaption(trt('Legend'));
|
||
g_WinLegend0.setSize("145px","65px");
|
||
g_WinLegend0.setContent('<table border="0" style="white-space:nowrap;"><tr><td><img src="../resources/engine/images/icons/flag.png" alt=""></td><td style="padding-left:10px;">'+trt('Spraying')+'</td></tr></table>');
|
||
g_WinLegend0.hide(false);
|
||
g_WinLegend0.setLeftTop(window.innerWidth-g_WinLegend0.getWidth()-20,40);
|
||
setTimeout(function() { g_WinLegend0.setLeftTop(window.innerWidth-g_WinLegend0.getWidth()-20,40); }, 1000);*/
|
||
}
|
||
|
||
function openFrmCheckpoints(){
|
||
var input;
|
||
|
||
var country_id="";
|
||
|
||
input = document.getElementById('filter_checkpoint_country_id');
|
||
if(input!=null) country_id=input.value;
|
||
|
||
g_FrmCheckpoints = new SRec();
|
||
g_FrmCheckpoints.create(null);
|
||
g_FrmCheckpoints.f_TypeName="FrmCheckpoints";
|
||
|
||
g_FrmCheckpoints.f_Settings='\
|
||
<metadata><type n="FrmCheckpoints">\n\
|
||
<properties>\n\
|
||
<prop n="country_id">\n\
|
||
<![CDATA['+country_id+']]>\n\
|
||
<type n="Countries">\n\
|
||
<objects-list>\n\
|
||
<filter><column n="id"><![CDATA['+country_id+']]></column></filter>\n\
|
||
</objects-list>\n\
|
||
</type>\n\
|
||
</prop>\n\
|
||
</properties>\n\
|
||
<objects-list>\n\
|
||
<filter height="1">\n\
|
||
<column n="id"><![CDATA[]]></column>\n\
|
||
<column n="country_id"><![CDATA['+country_id+']]></column>\n\
|
||
</filter>\n\
|
||
</objects-list>\n\
|
||
</type></metadata>\n\
|
||
';
|
||
|
||
//g_FrmCheckpoints.win.setSize("400px","100px");
|
||
g_FrmCheckpoints.win.setHeight(500);
|
||
//g_FrmCheckpoints.win.setLeftTop(300,40);
|
||
g_FrmCheckpoints.win.setCenter();
|
||
g_FrmCheckpoints.request.callServer(ScriptName,'<metadata fn="0"><type n="FrmCheckpoints"></type></metadata>');
|
||
}
|
||
|
||
function openFrmLocustInfo()
|
||
{
|
||
var input;
|
||
|
||
var country_id="";
|
||
var year="";
|
||
var locust_type_id='';
|
||
|
||
input = document.getElementById('filter_X3_country_id');
|
||
if(input!=null) country_id=input.value;
|
||
input = document.getElementById('filter_X3_year');
|
||
if(input!=null) year=input.value;
|
||
input = document.getElementById('filter_X3_locust_type_id');
|
||
if(input!=null) locust_type_id=input.value;
|
||
|
||
|
||
rec=new SRec();
|
||
rec.create(null);
|
||
rec.f_TypeName="FrmLocustInfo";
|
||
|
||
rec.f_Settings='\
|
||
<metadata><type n="FrmLocustInfo">\n\
|
||
<properties>\n\
|
||
<prop n="country_id">\n\
|
||
<![CDATA['+country_id+']]>\n\
|
||
<type n="Countries">\n\
|
||
<objects-list>\n\
|
||
<filter><column n="id"><![CDATA['+country_id+']]></column></filter>\n\
|
||
</objects-list>\n\
|
||
</type>\n\
|
||
</prop>\n\
|
||
</properties>\n\
|
||
<objects-list>\n\
|
||
<filter height="1">\n\
|
||
<column n="id"><![CDATA[]]></column>\n\
|
||
<column n="country_id"><![CDATA['+country_id+']]></column>\n\
|
||
<column n="year"><![CDATA['+year+']]></column>\n\
|
||
<column n="locust_type_id"><![CDATA['+locust_type_id+']]></column>\n\
|
||
</filter>\n\
|
||
</objects-list>\n\
|
||
</type></metadata>\n\
|
||
';
|
||
|
||
//rec.win.setSize("400px","100px");
|
||
rec.win.setHeight(500);
|
||
//rec.win.setLeftTop(300,40);
|
||
rec.win.setCenter();
|
||
rec.request.callServer(ScriptName,'<metadata fn="0"><type n="FrmLocustInfo"></type></metadata>');
|
||
}
|
||
|
||
function openWeather()
|
||
{
|
||
var input;
|
||
|
||
var country_id="";
|
||
|
||
input = document.getElementById('filter_soil_country_id');
|
||
if(input!=null) country_id=input.value;
|
||
|
||
rec=new SRec();
|
||
rec.create(null);
|
||
rec.f_TypeName="Weather";
|
||
|
||
rec.f_Settings='\
|
||
<metadata><type n="Weather">\n\
|
||
<properties>\n\
|
||
<prop n="country_id">\n\
|
||
<type n="Countries">\n\
|
||
<objects-list>\n\
|
||
<filter><column n="id"><![CDATA['+country_id+']]></column></filter>\n\
|
||
</objects-list>\n\
|
||
</type>\n\
|
||
</prop>\n\
|
||
</properties>\n\
|
||
<objects-list>\n\
|
||
<filter height="1">\n\
|
||
<column n="id"><![CDATA[]]></column>\n\
|
||
<column n="country_id"><![CDATA['+country_id+']]></column>\n\
|
||
</filter>\n\
|
||
</objects-list>\n\
|
||
</type></metadata>\n\
|
||
';
|
||
|
||
//rec.win.setSize("400px","100px");
|
||
rec.win.setHeight(500);
|
||
//rec.win.setLeftTop(300,40);
|
||
rec.win.setCenter();
|
||
rec.request.callServer(ScriptName,'<metadata fn="0"><type n="Weather"></type></metadata>');
|
||
}
|
||
|
||
//Call WMS NDVI data from GeoServer
|
||
function callNDVIData()
|
||
{
|
||
let day = document.getElementById("filter_ndvi_day").value;
|
||
day=day.padStart(3, "0");
|
||
|
||
//Stavropol
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDVI:'+day+'_NDVI_h20v03'}
|
||
});
|
||
wms_h20v03.setSource(wms_source);
|
||
wms_h20v03.setVisible(true);
|
||
|
||
//Krim
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDVI:'+day+'_NDVI_h20v04'}
|
||
});
|
||
wms_h20v04.setSource(wms_source);
|
||
wms_h20v04.setVisible(true);
|
||
|
||
//Stavropol
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDVI:'+day+'_NDVI_h21v03'}
|
||
});
|
||
wms_h21v03.setSource(wms_source);
|
||
wms_h21v03.setVisible(true);
|
||
|
||
//Caspi sea
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDVI:'+day+'_NDVI_h21v04'}
|
||
});
|
||
wms_h21v04.setSource(wms_source);
|
||
wms_h21v04.setVisible(true);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDVI:'+day+'_NDVI_h21v05'}
|
||
});
|
||
wms_h21v05.setSource(wms_source);
|
||
wms_h21v05.setVisible(true);
|
||
|
||
//
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDVI:'+day+'_NDVI_h22v03'}
|
||
});
|
||
wms_h22v03.setSource(wms_source);
|
||
wms_h22v03.setVisible(true);
|
||
|
||
//Aral Sea
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDVI:'+day+'_NDVI_h22v04'}
|
||
});
|
||
wms_h22v04.setSource(wms_source);
|
||
wms_h22v04.setVisible(true);
|
||
|
||
//Turmenistan
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDVI:'+day+'_NDVI_h22v05'}
|
||
});
|
||
wms_h22v05.setSource(wms_source);
|
||
wms_h22v05.setVisible(true);
|
||
|
||
//Sever
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDVI:'+day+'_NDVI_h23v03'}
|
||
});
|
||
wms_h23v03.setSource(wms_source);
|
||
wms_h23v03.setVisible(true);
|
||
|
||
//Kiegizstan
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDVI:'+day+'_NDVI_h23v04'}
|
||
});
|
||
wms_h23v04.setSource(wms_source);
|
||
wms_h23v04.setVisible(true);
|
||
|
||
//Afganistan
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDVI:'+day+'_NDVI_h23v05'}
|
||
});
|
||
wms_h23v05.setSource(wms_source);
|
||
wms_h23v05.setVisible(true);
|
||
|
||
|
||
//Show legend
|
||
if(typeof g_WinLegend == "undefined" || g_WinLegend == null || g_WinLegend.closed)
|
||
{
|
||
g_WinLegend=new TWin();
|
||
g_WinLegend.BuildGUI(window.innerWidth-290,40);
|
||
}
|
||
g_WinLegend.setCaption(trt('Legend'));
|
||
g_WinLegend.setSize("110px","313px");
|
||
g_WinLegend.setContent('<img src="https://geoserver2.ccalm.org/wms?REQUEST=GetLegendGraphic&FORMAT=image/png&LAYER=NDVI:001_NDVI_h20v03" alt="">');
|
||
g_WinLegend.hide(false);
|
||
g_WinLegend.setLeftTop(window.innerWidth-g_WinLegend.getWidth()-30,40);
|
||
setTimeout(function() { g_WinLegend.setLeftTop(window.innerWidth-g_WinLegend.getWidth()-30,40); }, 1000);
|
||
|
||
g_boundaryTile.setVisible(true);
|
||
}
|
||
|
||
//Call WMS IVI data from GeoServer
|
||
function callIVIData()
|
||
{
|
||
let year = document.getElementById("filter_ivi_year").value;
|
||
//year=year.padStart(3, "0");
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'IVI:'+year+'_IVI_h20v03'}
|
||
});
|
||
wms_h20v03.setSource(wms_source);
|
||
wms_h20v03.setVisible(true);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'IVI:'+year+'_IVI_h20v04'}
|
||
});
|
||
wms_h20v04.setSource(wms_source);
|
||
wms_h20v04.setVisible(true);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'IVI:'+year+'_IVI_h21v03'}
|
||
});
|
||
wms_h21v03.setSource(wms_source);
|
||
wms_h21v03.setVisible(true);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'IVI:'+year+'_IVI_h21v04'}
|
||
});
|
||
wms_h21v04.setSource(wms_source);
|
||
wms_h21v04.setVisible(true);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'IVI:'+year+'_IVI_h21v05'}
|
||
});
|
||
wms_h21v05.setSource(wms_source);
|
||
wms_h21v05.setVisible(true);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'IVI:'+year+'_IVI_h22v03'}
|
||
});
|
||
wms_h22v03.setSource(wms_source);
|
||
wms_h22v03.setVisible(true);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'IVI:'+year+'_IVI_h22v04'}
|
||
});
|
||
wms_h22v04.setSource(wms_source);
|
||
wms_h22v04.setVisible(true);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'IVI:'+year+'_IVI_h22v05'}
|
||
});
|
||
wms_h22v05.setSource(wms_source);
|
||
wms_h22v05.setVisible(true);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'IVI:'+year+'_IVI_h23v03'}
|
||
});
|
||
wms_h23v03.setSource(wms_source);
|
||
wms_h23v03.setVisible(true);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'IVI:'+year+'_IVI_h23v04'}
|
||
});
|
||
wms_h23v04.setSource(wms_source);
|
||
wms_h23v04.setVisible(true);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'IVI:'+year+'_IVI_h23v05'}
|
||
});
|
||
wms_h23v05.setSource(wms_source);
|
||
wms_h23v05.setVisible(true);
|
||
|
||
//Show legend
|
||
if(typeof g_WinLegend == "undefined" || g_WinLegend==null || g_WinLegend.closed)
|
||
{
|
||
g_WinLegend=new TWin();
|
||
g_WinLegend.BuildGUI(window.innerWidth-290,40);
|
||
}
|
||
g_WinLegend.setCaption(trt('Legend'));
|
||
g_WinLegend.setSize("110px","313px");
|
||
g_WinLegend.setContent('<img src="https://geoserver2.ccalm.org/wms?REQUEST=GetLegendGraphic&FORMAT=image/png&LAYER=IVI:2022_IVI_h20v03" alt="">');
|
||
g_WinLegend.hide(false);
|
||
g_WinLegend.setLeftTop(window.innerWidth-g_WinLegend.getWidth()-30,40);
|
||
setTimeout(function() { g_WinLegend.setLeftTop(window.innerWidth-g_WinLegend.getWidth()-30,40); }, 1000);
|
||
|
||
g_boundaryTile.setVisible(true);
|
||
}
|
||
|
||
//Call WMS NDWI data from GeoServer
|
||
function callNDWIData()
|
||
{
|
||
let day;
|
||
|
||
day = document.getElementById("filter_ndwi_day_compare").value;
|
||
if(day!=''){
|
||
|
||
if(day%10!==0){
|
||
day="";
|
||
}else{
|
||
day=day.padStart(3, "0")+"_";
|
||
}
|
||
|
||
log.info("layers = "+'NDWI_CMP:'+day+'NDWI_CMP_hxxvxx');
|
||
|
||
//Stavropol
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI_CMP:'+day+'NDWI_CMP_h20v03'}
|
||
});
|
||
wms_h20v03.setSource(wms_source);
|
||
wms_h20v03.setVisible(true);
|
||
|
||
//Krim
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI_CMP:'+day+'NDWI_CMP_h20v04'}
|
||
});
|
||
wms_h20v04.setSource(wms_source);
|
||
wms_h20v04.setVisible(true);
|
||
|
||
//Stavropol
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI_CMP:'+day+'NDWI_CMP_h21v03'}
|
||
});
|
||
wms_h21v03.setSource(wms_source);
|
||
wms_h21v03.setVisible(true);
|
||
|
||
//Caspi sea
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI_CMP:'+day+'NDWI_CMP_h21v04'}
|
||
});
|
||
wms_h21v04.setSource(wms_source);
|
||
wms_h21v04.setVisible(true);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI_CMP:'+day+'NDWI_CMP_h21v05'}
|
||
});
|
||
wms_h21v05.setSource(wms_source);
|
||
wms_h21v05.setVisible(true);
|
||
|
||
//
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI_CMP:'+day+'NDWI_CMP_h22v03'}
|
||
});
|
||
wms_h22v03.setSource(wms_source);
|
||
wms_h22v03.setVisible(true);
|
||
|
||
//Aral Sea
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI_CMP:'+day+'NDWI_CMP_h22v04'}
|
||
});
|
||
wms_h22v04.setSource(wms_source);
|
||
wms_h22v04.setVisible(true);
|
||
|
||
//Turmenistan
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI_CMP:'+day+'NDWI_CMP_h22v05'}
|
||
});
|
||
wms_h22v05.setSource(wms_source);
|
||
wms_h22v05.setVisible(true);
|
||
|
||
//Sever
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI_CMP:'+day+'NDWI_CMP_h23v03'}
|
||
});
|
||
wms_h23v03.setSource(wms_source);
|
||
wms_h23v03.setVisible(true);
|
||
|
||
//Kiegizstan
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI_CMP:'+day+'NDWI_CMP_h23v04'}
|
||
});
|
||
wms_h23v04.setSource(wms_source);
|
||
wms_h23v04.setVisible(true);
|
||
|
||
//Afganistan
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI_CMP:'+day+'NDWI_CMP_h23v05'}
|
||
});
|
||
wms_h23v05.setSource(wms_source);
|
||
wms_h23v05.setVisible(true);
|
||
|
||
//Show legend
|
||
if(typeof g_WinLegend == "undefined" || g_WinLegend == null || g_WinLegend.closed)
|
||
{
|
||
g_WinLegend = new TWin();
|
||
g_WinLegend.BuildGUI(window.innerWidth-290,40);
|
||
}
|
||
g_WinLegend.setCaption(trt('Legend'));
|
||
g_WinLegend.setSize("90px","140px");
|
||
g_WinLegend.setContent('<img src="https://geoserver2.ccalm.org/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&STRICT=false&style=NDWI_CMP:NDWI_CMP" alt="">');
|
||
g_WinLegend.hide(false);
|
||
g_WinLegend.setLeftTop(window.innerWidth-g_WinLegend.getWidth()-30,40);
|
||
setTimeout(function() { g_WinLegend.setLeftTop(window.innerWidth-g_WinLegend.getWidth()-30,40); }, 1000);
|
||
|
||
g_boundaryTile.setVisible(true);
|
||
|
||
}else{
|
||
day = document.getElementById("filter_ndwi_day").value;
|
||
if(day%10!==0){
|
||
day="";
|
||
}else{
|
||
day=day.padStart(3, "0")+"_";
|
||
}
|
||
log.info("layers = "+'NDWI:'+day+'NDWI_hxxvxx');
|
||
|
||
//Stavropol
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI:'+day+'NDWI_h20v03'}
|
||
});
|
||
wms_h20v03.setSource(wms_source);
|
||
wms_h20v03.setVisible(true);
|
||
|
||
//Krim
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI:'+day+'NDWI_h20v04'}
|
||
});
|
||
wms_h20v04.setSource(wms_source);
|
||
wms_h20v04.setVisible(true);
|
||
|
||
//Stavropol
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI:'+day+'NDWI_h21v03'}
|
||
});
|
||
wms_h21v03.setSource(wms_source);
|
||
wms_h21v03.setVisible(true);
|
||
|
||
//Caspi sea
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI:'+day+'NDWI_h21v04'}
|
||
});
|
||
wms_h21v04.setSource(wms_source);
|
||
wms_h21v04.setVisible(true);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI:'+day+'NDWI_h21v05'}
|
||
});
|
||
wms_h21v05.setSource(wms_source);
|
||
wms_h21v05.setVisible(true);
|
||
|
||
//
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI:'+day+'NDWI_h22v03'}
|
||
});
|
||
wms_h22v03.setSource(wms_source);
|
||
wms_h22v03.setVisible(true);
|
||
|
||
//Aral Sea
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI:'+day+'NDWI_h22v04'}
|
||
});
|
||
wms_h22v04.setSource(wms_source);
|
||
wms_h22v04.setVisible(true);
|
||
|
||
//Turmenistan
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI:'+day+'NDWI_h22v05'}
|
||
});
|
||
wms_h22v05.setSource(wms_source);
|
||
wms_h22v05.setVisible(true);
|
||
|
||
//Sever
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI:'+day+'NDWI_h23v03'}
|
||
});
|
||
wms_h23v03.setSource(wms_source);
|
||
wms_h23v03.setVisible(true);
|
||
|
||
//Kiegizstan
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI:'+day+'NDWI_h23v04'}
|
||
});
|
||
wms_h23v04.setSource(wms_source);
|
||
wms_h23v04.setVisible(true);
|
||
|
||
//Afganistan
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDWI:'+day+'NDWI_h23v05'}
|
||
});
|
||
wms_h23v05.setSource(wms_source);
|
||
wms_h23v05.setVisible(true);
|
||
|
||
//Show legend
|
||
if(typeof g_WinLegend == "undefined" || g_WinLegend == null || g_WinLegend.closed)
|
||
{
|
||
g_WinLegend = new TWin();
|
||
g_WinLegend.BuildGUI(window.innerWidth-290,40);
|
||
}
|
||
g_WinLegend.setCaption(trt('Legend'));
|
||
g_WinLegend.setSize("90px","140px");
|
||
g_WinLegend.setContent('<img src="https://geoserver2.ccalm.org/wms?REQUEST=GetLegendGraphic&FORMAT=image/png&LAYER=NDWI:010_NDWI_h20v03" alt="">');
|
||
g_WinLegend.hide(false);
|
||
g_WinLegend.setLeftTop(window.innerWidth-g_WinLegend.getWidth()-30,40);
|
||
setTimeout(function() { g_WinLegend.setLeftTop(window.innerWidth-g_WinLegend.getWidth()-30,40); }, 1000);
|
||
|
||
g_boundaryTile.setVisible(true);
|
||
}
|
||
}
|
||
|
||
//Call WMS NDSI data from GeoServer
|
||
function callNDSIData()
|
||
{
|
||
let day = document.getElementById("filter_ndsi_day").value;
|
||
if(day%10!==0){
|
||
day="";
|
||
}else{
|
||
day=day.padStart(3, "0")+"_";
|
||
}
|
||
|
||
let layers = "";
|
||
|
||
//Stavropol
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDSI:'+day+'NDSI_h20v03'}
|
||
});
|
||
wms_h20v03.setSource(wms_source);
|
||
wms_h20v03.setVisible(true);
|
||
|
||
//Krim
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDSI:'+day+'NDSI_h20v04'}
|
||
});
|
||
wms_h20v04.setSource(wms_source);
|
||
wms_h20v04.setVisible(true);
|
||
|
||
//Stavropol
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDSI:'+day+'NDSI_h21v03'}
|
||
});
|
||
wms_h21v03.setSource(wms_source);
|
||
wms_h21v03.setVisible(true);
|
||
|
||
//Caspi sea
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDSI:'+day+'NDSI_h21v04'}
|
||
});
|
||
wms_h21v04.setSource(wms_source);
|
||
wms_h21v04.setVisible(true);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDSI:'+day+'NDSI_h21v05'}
|
||
});
|
||
wms_h21v05.setSource(wms_source);
|
||
wms_h21v05.setVisible(true);
|
||
|
||
//
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDSI:'+day+'NDSI_h22v03'}
|
||
});
|
||
wms_h22v03.setSource(wms_source);
|
||
wms_h22v03.setVisible(true);
|
||
|
||
//Aral Sea
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDSI:'+day+'NDSI_h22v04'}
|
||
});
|
||
wms_h22v04.setSource(wms_source);
|
||
wms_h22v04.setVisible(true);
|
||
|
||
//Turmenistan
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDSI:'+day+'NDSI_h22v05'}
|
||
});
|
||
wms_h22v05.setSource(wms_source);
|
||
wms_h22v05.setVisible(true);
|
||
|
||
//Sever
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDSI:'+day+'NDSI_h23v03'}
|
||
});
|
||
wms_h23v03.setSource(wms_source);
|
||
wms_h23v03.setVisible(true);
|
||
|
||
//Kiegizstan
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDSI:'+day+'NDSI_h23v04'}
|
||
});
|
||
wms_h23v04.setSource(wms_source);
|
||
wms_h23v04.setVisible(true);
|
||
|
||
//Afganistan
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'NDSI:'+day+'NDSI_h23v05'}
|
||
});
|
||
wms_h23v05.setSource(wms_source);
|
||
wms_h23v05.setVisible(true);
|
||
|
||
|
||
//Show legend
|
||
if(typeof g_WinLegend == "undefined" || g_WinLegend == null || g_WinLegend.closed)
|
||
{
|
||
g_WinLegend=new TWin();
|
||
g_WinLegend.BuildGUI(window.innerWidth-290,40);
|
||
}
|
||
g_WinLegend.setCaption(trt('Legend'));
|
||
g_WinLegend.setSize("90px","140px");
|
||
g_WinLegend.setContent('<img src="https://geoserver2.ccalm.org/wms?REQUEST=GetLegendGraphic&FORMAT=image/png&LAYER=NDSI:NDSI_h20v03" alt="">');
|
||
g_WinLegend.hide(false);
|
||
g_WinLegend.setLeftTop(window.innerWidth-g_WinLegend.getWidth()-30,40);
|
||
setTimeout(function() { g_WinLegend.setLeftTop(window.innerWidth-g_WinLegend.getWidth()-30,40); }, 1000);
|
||
|
||
g_boundaryTile.setVisible(true);
|
||
}
|
||
|
||
//Call WMS SMAP data from GeoServer
|
||
function callSMAPData()
|
||
{
|
||
let day = document.getElementById("filter_smap_day").value;
|
||
if(day%10!==0){
|
||
day="";
|
||
}else{
|
||
day=day.padStart(3, "0")+"_";
|
||
}
|
||
|
||
let layers = "";
|
||
|
||
//Stavropol
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms',
|
||
params: {'LAYERS': 'SMAP:'+day+'SMAP'}
|
||
});
|
||
wms_h20v03.setSource(wms_source);
|
||
wms_h20v03.setVisible(true);
|
||
|
||
|
||
//Show legend
|
||
if(typeof g_WinLegend == "undefined" || g_WinLegend == null || g_WinLegend.closed)
|
||
{
|
||
g_WinLegend=new TWin();
|
||
g_WinLegend.BuildGUI(window.innerWidth-290,40);
|
||
}
|
||
g_WinLegend.setCaption(trt('Legend'));
|
||
g_WinLegend.setSize("90px","150px");
|
||
g_WinLegend.setContent('<img src="https://geoserver2.ccalm.org/wms?REQUEST=GetLegendGraphic&FORMAT=image/png&LAYER=SMAP:SMAP" alt="">');
|
||
g_WinLegend.hide(false);
|
||
g_WinLegend.setLeftTop(window.innerWidth-g_WinLegend.getWidth()-30,40);
|
||
setTimeout(function() { g_WinLegend.setLeftTop(window.innerWidth-g_WinLegend.getWidth()-30,40); }, 1000);
|
||
|
||
g_boundaryTile.setVisible(true);
|
||
}
|
||
|
||
function hideGeoTIFFData()
|
||
{
|
||
wms_h20v03.setVisible(false); //Stavropol
|
||
wms_h20v04.setVisible(false); //Krim
|
||
wms_h21v03.setVisible(false); //Stavropol
|
||
wms_h21v04.setVisible(false); //Caspi sea
|
||
wms_h21v05.setVisible(false);
|
||
wms_h22v03.setVisible(false); //
|
||
wms_h22v04.setVisible(false); //Aral Sea
|
||
wms_h22v05.setVisible(false); //Turmenistan
|
||
wms_h23v03.setVisible(false); //Sever
|
||
wms_h23v04.setVisible(false); //Kiegizstan
|
||
wms_h23v05.setVisible(false); //Afganistan
|
||
|
||
//Hide legend
|
||
if(typeof g_WinLegend != "undefined" && g_WinLegend!=null) g_WinLegend.hide(true);
|
||
|
||
g_boundaryTile.setVisible(false);
|
||
}
|
||
|
||
function callWeatherData()
|
||
{
|
||
let country_id=document.getElementById('filter_soil_country_id').value;
|
||
let time = document.getElementById('filter_soil_day').value;
|
||
time=Math.floor(new Date(time).getTime() / 1000);
|
||
|
||
let layers="";
|
||
if(country_id==1)
|
||
{
|
||
layers = 'cite:soil_temperature_afghanistan';
|
||
}else if(country_id==2)
|
||
{
|
||
layers = 'cite:soil_temperature_armenia';
|
||
}else if(country_id==3)
|
||
{
|
||
layers = 'cite:soil_temperature_azerbaijan';
|
||
}else if(country_id==4)
|
||
{
|
||
layers = 'cite:soil_temperature_georgia';
|
||
}else if(country_id==5)
|
||
{
|
||
layers = 'cite:soil_temperature_kazakhstan';
|
||
}else if(country_id==6)
|
||
{
|
||
layers = 'cite:soil_temperature_kyrgyzstan';
|
||
}else if(country_id==7)
|
||
{
|
||
layers = 'cite:soil_temperature_russia';
|
||
}else if(country_id==8)
|
||
{
|
||
layers = 'cite:soil_temperature_tajikistan';
|
||
}else if(country_id==9)
|
||
{
|
||
layers = 'cite:soil_temperature_turkmenistan';
|
||
}else if(country_id==10)
|
||
{
|
||
layers = 'cite:soil_temperature_uzbekistan';
|
||
}else
|
||
{
|
||
alert2(trt("Alert"),trt("No_data"));
|
||
}
|
||
|
||
log.info("layers = "+layers+' p1='+time);
|
||
|
||
let wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms?viewparams=p1:'+time,
|
||
params: {'LAYERS': layers}
|
||
});
|
||
|
||
wms_layer.setSource(wms_source);
|
||
wms_layer.setVisible(true);
|
||
|
||
//Show legend
|
||
if(typeof g_WeaLegend == "undefined" || g_WeaLegend==null || g_WeaLegend.closed)
|
||
{
|
||
g_WeaLegend=new TWin();
|
||
g_WeaLegend.BuildGUI(window.innerWidth-120,40);
|
||
}
|
||
g_WeaLegend.setCaption(trt('Legend'));
|
||
g_WeaLegend.setSize("92px","313px");
|
||
g_WeaLegend.setContent('<img src="https://geoserver2.ccalm.org/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&STRICT=false&style=cite:TEMPERATURE_VIEW" alt="">');
|
||
g_WeaLegend.hide(false);
|
||
g_WeaLegend.setLeftTop(window.innerWidth-g_WeaLegend.getWidth()-20,40);
|
||
setTimeout(function() { g_WeaLegend.setLeftTop(window.innerWidth-g_WeaLegend.getWidth()-20,40); }, 1000);
|
||
}
|
||
|
||
function hideWeatherData()
|
||
{
|
||
wms_layer.setVisible(false);
|
||
if(typeof g_WeaLegend != "undefined" && g_WeaLegend!=null)
|
||
{
|
||
g_WeaLegend.hide(true);
|
||
}
|
||
}
|
||
|
||
function callAirData()
|
||
{
|
||
let country_id=document.getElementById('filter_air_country_id').value;
|
||
let time = document.getElementById('filter_air_day').value;
|
||
time=Math.floor(new Date(time).getTime() / 1000);
|
||
|
||
let layers="";
|
||
if(country_id==1){
|
||
layers = 'cite:air_temperature_afghanistan';
|
||
}else if(country_id==2){
|
||
layers = 'cite:air_temperature_armenia';
|
||
}else if(country_id==3){
|
||
layers = 'cite:air_temperature_azerbaijan';
|
||
}else if(country_id==4){
|
||
layers = 'cite:air_temperature_georgia';
|
||
}else if(country_id==5){
|
||
layers = 'cite:air_temperature_kazakhstan';
|
||
}else if(country_id==6){
|
||
layers = 'cite:air_temperature_kyrgyzstan';
|
||
}else if(country_id==7){
|
||
layers = 'cite:air_temperature_russia';
|
||
}else if(country_id==8){
|
||
layers = 'cite:air_temperature_tajikistan';
|
||
}else if(country_id==9){
|
||
layers = 'cite:air_temperature_turkmenistan';
|
||
}else if(country_id==10){
|
||
layers = 'cite:air_temperature_uzbekistan';
|
||
}else{
|
||
alert2(trt("Alert"),trt("No_data"));
|
||
}
|
||
|
||
log.info("layers = "+layers+' p1='+time);
|
||
|
||
let wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms?viewparams=p1:'+time,
|
||
params: {'LAYERS': layers}
|
||
});
|
||
|
||
wms_layer.setSource(wms_source);
|
||
wms_layer.setVisible(true);
|
||
|
||
//Show legend
|
||
if(typeof g_AirLegend == "undefined" || g_AirLegend==null || g_AirLegend.closed)
|
||
{
|
||
g_AirLegend=new TWin();
|
||
g_AirLegend.BuildGUI(window.innerWidth-120,40);
|
||
}
|
||
g_AirLegend.setCaption(trt('Legend'));
|
||
g_AirLegend.setSize("77px","223px");
|
||
g_AirLegend.setContent('<img src="https://geoserver2.ccalm.org/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&STRICT=false&style=cite:AIRTMP_VIEW" alt="">');
|
||
g_AirLegend.hide(false);
|
||
g_AirLegend.setLeftTop(window.innerWidth-g_AirLegend.getWidth()-20,40);
|
||
setTimeout(function() { g_AirLegend.setLeftTop(window.innerWidth-g_AirLegend.getWidth()-20,40); }, 1000);
|
||
}
|
||
|
||
function hideAirData()
|
||
{
|
||
wms_layer.setVisible(false);
|
||
if(typeof g_AirLegend != "undefined" && g_AirLegend!=null)
|
||
{
|
||
g_AirLegend.hide(true);
|
||
}
|
||
}
|
||
|
||
function callPrecipitationData()
|
||
{
|
||
let country_id=document.getElementById('filter_precipitation_country_id').value;
|
||
let time = document.getElementById('filter_precipitation_day').value;
|
||
time=Math.floor(new Date(time).getTime() / 1000);
|
||
|
||
let layers="";
|
||
if(country_id==1){
|
||
layers = 'cite:precipitation_afghanistan';
|
||
}else if(country_id==2){
|
||
layers = 'cite:precipitation_armenia';
|
||
}else if(country_id==3){
|
||
layers = 'cite:precipitation_azerbaijan';
|
||
}else if(country_id==4){
|
||
layers = 'cite:precipitation_georgia';
|
||
}else if(country_id==5){
|
||
layers = 'cite:precipitation_kazakhstan';
|
||
}else if(country_id==6){
|
||
layers = 'cite:precipitation_kyrgyzstan';
|
||
}else if(country_id==7){
|
||
layers = 'cite:precipitation_russia';
|
||
}else if(country_id==8){
|
||
layers = 'cite:precipitation_tajikistan';
|
||
}else if(country_id==9){
|
||
layers = 'cite:precipitation_turkmenistan';
|
||
}else if(country_id==10){
|
||
layers = 'cite:precipitation_uzbekistan';
|
||
}else{
|
||
alert2(trt("Alert"),trt("No_data"));
|
||
}
|
||
|
||
log.info("layers = "+layers+' p1='+time);
|
||
|
||
let wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms?viewparams=p1:'+time,
|
||
params: {'LAYERS': layers}
|
||
});
|
||
|
||
wms_layer.setSource(wms_source);
|
||
wms_layer.setVisible(true);
|
||
|
||
//Show legend
|
||
if(typeof g_PreLegend == "undefined" || g_PreLegend==null || g_PreLegend.closed)
|
||
{
|
||
g_PreLegend=new TWin();
|
||
g_PreLegend.BuildGUI(window.innerWidth-120,40);
|
||
}
|
||
g_PreLegend.setCaption(trt('Legend'));
|
||
g_PreLegend.setSize("77px","223px");
|
||
g_PreLegend.setContent('<img src="https://geoserver2.ccalm.org/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&STRICT=false&style=cite:PRECIPITATION_VIEW" alt="">');
|
||
g_PreLegend.hide(false);
|
||
g_PreLegend.setLeftTop(window.innerWidth-g_PreLegend.getWidth()-20,40);
|
||
setTimeout(function() { g_PreLegend.setLeftTop(window.innerWidth-g_PreLegend.getWidth()-20,40); }, 1000);
|
||
}
|
||
|
||
function hidePrecipitationData()
|
||
{
|
||
wms_layer.setVisible(false);
|
||
if(typeof g_PreLegend != "undefined" && g_PreLegend!=null)
|
||
{
|
||
g_PreLegend.hide(true);
|
||
}
|
||
}
|
||
|
||
function callHTCSelyaninovData()
|
||
{
|
||
|
||
let country_id=document.getElementById('filter_htc_selyaninov_country_id').value;
|
||
let time_start = document.getElementById('filter_htc_selyaninov_time_start').value;
|
||
time_start=Math.floor(new Date(time_start).getTime() / 1000);
|
||
let time_end = document.getElementById('filter_htc_selyaninov_time_end').value;
|
||
time_end=Math.floor(new Date(time_end).getTime() / 1000);
|
||
|
||
let wms_source=null;
|
||
|
||
let layers="";
|
||
if(country_id==1){
|
||
layers = 'cite:htc_selyaninov_afghanistan';
|
||
}else if(country_id==2){
|
||
layers = 'cite:htc_selyaninov_armenia';
|
||
}else if(country_id==3){
|
||
layers = 'cite:htc_selyaninov_azerbaijan';
|
||
}else if(country_id==4){
|
||
layers = 'cite:htc_selyaninov_georgia';
|
||
}else if(country_id==5){
|
||
layers = 'cite:htc_selyaninov_kazakhstan';
|
||
}else if(country_id==6){
|
||
layers = 'cite:htc_selyaninov_kyrgyzstan';
|
||
}else if(country_id==7){
|
||
layers = 'cite:htc_selyaninov_russia';
|
||
}else if(country_id==8){
|
||
layers = 'cite:htc_selyaninov_tajikistan';
|
||
}else if(country_id==9){
|
||
layers = 'cite:htc_selyaninov_turkmenistan';
|
||
}else if(country_id==10){
|
||
layers = 'cite:htc_selyaninov_uzbekistan';
|
||
}else{
|
||
alert2(trt("Alert"),trt("No_data"));
|
||
}
|
||
|
||
log.info("layers = "+layers+" time_start = "+time_start+" time_end = "+time_end);
|
||
|
||
wms_source = new ol.source.TileWMS({
|
||
url: 'https://geoserver2.ccalm.org/wms?viewparams=time_start:'+time_start+';time_end='+time_end+';',
|
||
params: {'LAYERS': layers}
|
||
});
|
||
|
||
wms_layer.setSource(wms_source);
|
||
wms_layer.setVisible(true);
|
||
|
||
//Show legend
|
||
if(typeof g_HTCLegend == "undefined" || g_HTCLegend==null || g_HTCLegend.closed)
|
||
{
|
||
g_HTCLegend=new TWin();
|
||
g_HTCLegend.BuildGUI(window.innerWidth-120,40);
|
||
}
|
||
g_HTCLegend.setCaption(trt('Legend'));
|
||
g_HTCLegend.setSize("77px","223px");
|
||
g_HTCLegend.setContent('<img src="https://geoserver2.ccalm.org/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&LAYER=cite:htc_selyaninov_afghanistan" alt="">');
|
||
g_HTCLegend.hide(false);
|
||
g_HTCLegend.setLeftTop(window.innerWidth-g_HTCLegend.getWidth()-20,40);
|
||
setTimeout(function() { g_HTCLegend.setLeftTop(window.innerWidth-g_HTCLegend.getWidth()-20,40); }, 1000);
|
||
}
|
||
|
||
function hideHTCSelyaninovData()
|
||
{
|
||
wms_layer.setVisible(false);
|
||
if(typeof g_HTCLegend != "undefined" && g_HTCLegend!=null)
|
||
{
|
||
g_HTCLegend.hide(true);
|
||
}
|
||
}
|
||
|
||
function updatePOILocust(data,indicator)
|
||
{
|
||
let lat, lon, geom, feature, features = [], featuresV = [];
|
||
let terrain="";
|
||
let locust_populated=0;
|
||
|
||
let eggs_capsules_density=0;
|
||
let eggs_capsules_density_to=0;
|
||
let imago_density=0;
|
||
let larva_density=0;
|
||
let larva_density_to=0;
|
||
let kuliguli_size=0;
|
||
let swarm_maturity="";
|
||
let swarm_density_id="";
|
||
|
||
for(let i=0;i<data.length;i++)
|
||
{
|
||
lat=data[i].lat;
|
||
lon=data[i].lon;
|
||
terrain=data[i].terrain;
|
||
locust_populated=data[i].locust_populated;
|
||
|
||
eggs_capsules_density=data[i].eggs_capsules_density;
|
||
eggs_capsules_density_to=data[i].eggs_capsules_density_to;
|
||
imago_density=data[i].imago_density;
|
||
larva_density=data[i].larva_density;
|
||
larva_density_to=data[i].larva_density_to;
|
||
kuliguli_size=data[i].kuliguli_size;
|
||
swarm_maturity=data[i].swarm_maturity;
|
||
swarm_density_id=data[i].swarm_density_id;
|
||
|
||
if(!isNaN(lat) && !isNaN(lon))
|
||
{
|
||
if(data[i].geom !== undefined && g_user.getSettings('perimeter','true')=='true'){
|
||
let tmpFeatures = (new ol.format.GeoJSON()).readFeatures(data[i].geom, {dataProjection: 'EPSG:4326',featureProjection: 'EPSG:3857'});
|
||
for(let j=0;j<tmpFeatures.length;j++)
|
||
{
|
||
tmpFeatures[j].setStyle(new ol.style.Style({
|
||
fill: new ol.style.Fill({color: 'rgba(0, 0, 255, 0.3)'}),
|
||
stroke: new ol.style.Stroke({color: 'rgba(0, 0, 100, 0.5)', width: 2})
|
||
}));
|
||
featuresV.push(tmpFeatures[j]);
|
||
}
|
||
}
|
||
|
||
feature = new ol.Feature({geometry: new ol.geom.Point(ol.proj.transform([lon, lat], 'EPSG:4326','EPSG:3857')),name: terrain});
|
||
feature.userType="FrmLocust";
|
||
feature.userName=terrain;
|
||
feature.userID=data[i].id;
|
||
|
||
if(indicator==1) //Egg_pods_density_m2 (from, to)
|
||
{
|
||
//log.info("data[i]="+JSON.stringify(data[i]));
|
||
|
||
if(!isNaN(eggs_capsules_density) || !isNaN(eggs_capsules_density_to))
|
||
{
|
||
let val=0;
|
||
if(!isNaN(eggs_capsules_density) && !isNaN(eggs_capsules_density_to)) val=(eggs_capsules_density+eggs_capsules_density_to)/2;
|
||
if(!isNaN(eggs_capsules_density) && isNaN(eggs_capsules_density_to)) val=eggs_capsules_density;
|
||
if(isNaN(eggs_capsules_density) && !isNaN(eggs_capsules_density_to)) val=eggs_capsules_density_to;
|
||
if(val>1)
|
||
feature.setStyle(createFatypeStyleR(feature));
|
||
else if(val<=1 && val>0)
|
||
feature.setStyle(createFatypeStyleY(feature));
|
||
else
|
||
feature.setStyle(createFatypeStyleG(feature));
|
||
}
|
||
|
||
}else if(indicator==2) //Hopper_density_m2
|
||
{
|
||
if(!isNaN(larva_density) || !isNaN(larva_density_to))
|
||
{
|
||
var val=0;
|
||
if(!isNaN(larva_density) && !isNaN(larva_density_to)) val=(larva_density+larva_density_to)/2;
|
||
if(!isNaN(larva_density) && isNaN(larva_density_to)) val=larva_density;
|
||
if(isNaN(larva_density) && !isNaN(larva_density_to)) val=larva_density_to;
|
||
if(val>=5)
|
||
{
|
||
feature.setStyle(createFatypeStyleR(feature));
|
||
}else if (val<5 && val>=3)
|
||
{
|
||
feature.setStyle(createFatypeStyleY(feature));
|
||
}else
|
||
{
|
||
feature.setStyle(createFatypeStyleG(feature));
|
||
}
|
||
}
|
||
}else if(indicator==3) //Bands кулиги
|
||
{
|
||
if(!isNaN(kuliguli_size) && kuliguli_size>=1)
|
||
{
|
||
feature.setStyle(createFatypeStyleR(feature));
|
||
}/*else
|
||
{
|
||
feature.setStyle(createFatypeStyleG(feature));
|
||
}*/
|
||
}else if(indicator==4) //Adult_density_m2
|
||
{
|
||
if(!isNaN(imago_density))
|
||
{
|
||
var val=imago_density;
|
||
if(val>=5)
|
||
{
|
||
feature.setStyle(createFatypeStyleR(feature));
|
||
}else if (val<5 && val>=3)
|
||
{
|
||
feature.setStyle(createFatypeStyleY(feature));
|
||
}else
|
||
{
|
||
feature.setStyle(createFatypeStyleG(feature));
|
||
}
|
||
}
|
||
}else if(indicator==5) //Swarms
|
||
{
|
||
if(!isNaN(swarm_maturity) || !isNaN(swarm_density_id)){
|
||
feature.setStyle(createFatypeStyleR(feature));
|
||
}/*else
|
||
{
|
||
feature.setStyle(createFatypeStyleG(feature));
|
||
}*/
|
||
}
|
||
features.push(feature);
|
||
}
|
||
}
|
||
|
||
vectorSource.clear(false);
|
||
vectorSource.addFeatures(features);
|
||
|
||
vectorSourceV.clear(false);
|
||
vectorSourceV.addFeatures(featuresV);
|
||
return features;
|
||
}
|
||
|
||
function updatePOILocustDel(data)
|
||
{
|
||
let lat, lon, geom, feature, features = [], featuresV = [];
|
||
let terrain="";
|
||
let treated_area=0; //in ha
|
||
let infested_area=0; //in ha
|
||
|
||
for(let i=0;i<data.length;i++)
|
||
{
|
||
lat=data[i].lat;
|
||
lon=data[i].lon;
|
||
terrain=data[i].terrain;
|
||
treated_area=data[i].treated_area;
|
||
infested_area=data[i].infested_area;
|
||
|
||
if(!isNaN(lat) && !isNaN(lon))
|
||
{
|
||
if(data[i].geom !== undefined && g_user.getSettings('perimeter','true')=='true'){
|
||
let tmpFeatures = (new ol.format.GeoJSON()).readFeatures(data[i].geom, {dataProjection: 'EPSG:4326',featureProjection: 'EPSG:3857'});
|
||
for(let j=0;j<tmpFeatures.length;j++)
|
||
{
|
||
tmpFeatures[j].setStyle(new ol.style.Style({
|
||
fill: new ol.style.Fill({color: 'rgba(0, 0, 255, 0.3)'}),
|
||
stroke: new ol.style.Stroke({color: 'rgba(0, 0, 100, 0.5)', width: 2})
|
||
}));
|
||
featuresV.push(tmpFeatures[j]);
|
||
}
|
||
}
|
||
|
||
if(!isNaN(infested_area) && !isNaN(treated_area) && infested_area>treated_area) //red icon
|
||
{
|
||
feature = new ol.Feature({geometry: new ol.geom.Point(ol.proj.transform([lon, lat], 'EPSG:4326','EPSG:3857')),name: terrain});
|
||
feature.userType="FrmLocustDel";
|
||
feature.userName=terrain;
|
||
feature.userID=data[i].id;
|
||
|
||
feature.setStyle(createFatypeStyleDel(feature,true));
|
||
features.push(feature);
|
||
}else //Green icon
|
||
{
|
||
feature = new ol.Feature({geometry: new ol.geom.Point(ol.proj.transform([lon, lat], 'EPSG:4326','EPSG:3857')),name: terrain});
|
||
feature.userType="FrmLocustDel";
|
||
feature.userName=terrain;
|
||
feature.userID=data[i].id;
|
||
|
||
feature.setStyle(createFatypeStyleDel(feature,false));
|
||
features.push(feature);
|
||
}
|
||
}
|
||
}
|
||
|
||
vectorSourceDel.clear(false);
|
||
vectorSourceDel.addFeatures(features);
|
||
|
||
vectorSourceDelV.clear(false);
|
||
vectorSourceDelV.addFeatures(featuresV);
|
||
return features;
|
||
}
|
||
|
||
//Product N 2 and 3
|
||
function updateRegionPolygons(obj)
|
||
{
|
||
vectorSourceArea.clear(false);
|
||
|
||
let id="";
|
||
let percent="";
|
||
let region_id="";
|
||
let name="";
|
||
let year="";
|
||
let locust_type_id="";
|
||
|
||
for(let j=0;j<obj.data.length;j++){
|
||
id=obj.data[j].id;
|
||
percent=parseFloat(obj.data[j].row[0]);
|
||
region_id=parseFloat(obj.data[j].row[1]);
|
||
name=obj.data[j].row[2];
|
||
year=parseFloat(obj.data[j].row[3]);
|
||
locust_type_id=parseFloat(obj.data[j].row[4]);
|
||
//Create polygons on map.
|
||
if(!isNaN(percent))
|
||
{
|
||
if(percent>15)
|
||
{
|
||
$.getJSON('../geojson?table=countriesregions&id='+id,{},function(userData){return function(data){makeRedArea(data,userData);};}({region_id:region_id,name:name,percent:percent,year:year,locust_type_id:locust_type_id,type:obj.n}));
|
||
}else if(percent<-15)
|
||
{
|
||
$.getJSON('../geojson?table=countriesregions&id='+id,{},function(userData){return function(data){makeGreenArea(data,userData);};}({region_id:region_id,name:name,percent:percent,year:year,locust_type_id:locust_type_id,type:obj.n}));
|
||
}else
|
||
{
|
||
$.getJSON('../geojson?table=countriesregions&id='+id,{},function(userData){return function(data){makeYellowArea(data,userData);};}({region_id:region_id,name:name,percent:percent,year:year,locust_type_id:locust_type_id,type:obj.n}));
|
||
}
|
||
}else //If there is no data
|
||
{
|
||
$.getJSON('../geojson?table=countriesregions&id='+id,{},function(userData){return function(data){makeGrayArea(data,userData);};}({region_id:region_id,name:name,percent:''/*percent*/,year:year,locust_type_id:locust_type_id,type:obj.n}));
|
||
}
|
||
}
|
||
return;
|
||
}
|
||
|
||
function updateRegionPolygons_r(obj)
|
||
{
|
||
vectorSourceArea.clear(false);
|
||
|
||
let id="";
|
||
let percent="";
|
||
let district_id="";
|
||
let name="";
|
||
let year="";
|
||
let locust_type_id="";
|
||
|
||
for(let j=0;j<obj.data.length;j++){
|
||
id=obj.data[j].id;
|
||
percent=parseFloat(obj.data[j].row[0]);
|
||
district_id=parseFloat(obj.data[j].row[1]);
|
||
name=obj.data[j].row[2];
|
||
year=parseFloat(obj.data[j].row[3]);
|
||
locust_type_id=parseFloat(obj.data[j].row[4]);
|
||
|
||
//Create polygons on map.
|
||
if(!isNaN(percent))
|
||
{
|
||
if(percent>15)
|
||
{
|
||
$.getJSON('../geojson?table=countriesdistricts&id='+id,{},function(userData){return function(data){makeRedArea(data,userData);};}({district_id:district_id,name:name,percent:percent,year:year,locust_type_id:locust_type_id,type:obj.n}));
|
||
}else if(percent<-15)
|
||
{
|
||
$.getJSON('../geojson?table=countriesdistricts&id='+id,{},function(userData){return function(data){makeGreenArea(data,userData);};}({district_id:district_id,name:name,percent:percent,year:year,locust_type_id:locust_type_id,type:obj.n}));
|
||
}else
|
||
{
|
||
$.getJSON('../geojson?table=countriesdistricts&id='+id,{},function(userData){return function(data){makeYellowArea(data,userData);};}({district_id:district_id,name:name,percent:percent,year:year,locust_type_id:locust_type_id,type:obj.n}));
|
||
}
|
||
}else //If there is no data
|
||
{
|
||
$.getJSON('../geojson?table=countriesdistricts&id='+id,{},function(userData){return function(data){makeGrayArea(data,userData);};}({district_id:district_id,name:name,percent:'',year:year,locust_type_id:locust_type_id,type:obj.n}));
|
||
}
|
||
}
|
||
|
||
return;
|
||
}
|
||
|
||
// Product N 4
|
||
function updateRegionPolygons4(obj)
|
||
{
|
||
vectorSourceArea.clear(false);
|
||
let id="";
|
||
let percent="";
|
||
let region_id="";
|
||
let name="";
|
||
let year="";
|
||
let locust_type_id="";
|
||
let treated="";
|
||
let infested_etd="";
|
||
for(let j=0;j<obj.data.length;j++){
|
||
id=obj.data[j].id;
|
||
percent=parseFloat(obj.data[j].row[0]);
|
||
region_id=parseFloat(obj.data[j].row[1]);
|
||
name=obj.data[j].row[2];
|
||
year=parseFloat(obj.data[j].row[3]);
|
||
locust_type_id=parseFloat(obj.data[j].row[4]);
|
||
treated=parseFloat(obj.data[j].row[5]);
|
||
if(isNaN(treated)) treated=""; else treated=Math.round(treated*100)/100;
|
||
infested_etd=parseFloat(obj.data[j].row[6]);
|
||
if(isNaN(infested_etd)) infested_etd=""; else infested_etd=Math.round(infested_etd*100)/100;
|
||
//Create polygons on map.
|
||
if(!isNaN(percent))
|
||
{
|
||
if(percent>=-25 && percent<=25)
|
||
{
|
||
$.getJSON('../geojson?table=countriesregions&id='+id,{},function(userData){return function(data){makeGreenArea(data,userData);};}({region_id:region_id,name:name,percent:percent,text:"<b>"+trt("Treatedtrt_(thous._ha)")+"</b>: "+treated+"<br>\n<b>"+trt("Infested_(thous._ha)")+"</b>: "+infested_etd+"<br>\n<b>"+trt("Percent")+"</b>: "+percent+"%",year:year,locust_type_id:locust_type_id,type:obj.n}));
|
||
}else
|
||
{
|
||
$.getJSON('../geojson?table=countriesregions&id='+id,{},function(userData){return function(data){makeRedArea(data,userData);};}({region_id:region_id,name:name,percent:percent,text:"<b>"+trt("Treated_(thous._ha)")+"<b>: "+treated+"<br>\n<b>"+trt("Infested_(thous._ha)")+"</b>: "+infested_etd+"</br>\n<b>"+trt("Percent")+"</b>: "+percent+"%",year:year,locust_type_id:locust_type_id,type:obj.n}));
|
||
}
|
||
}else //If there is no data
|
||
{
|
||
$.getJSON('../geojson?table=countriesregions&id='+id,{},function(userData){return function(data){makeGrayArea(data,userData);};}({region_id:region_id,name:name,percent:'',text:'',year:year,locust_type_id:locust_type_id,type:obj.n}));
|
||
}
|
||
}
|
||
return;
|
||
}
|
||
|
||
function updateRegionPolygons4_r(obj)
|
||
{
|
||
vectorSourceArea.clear(false);
|
||
let id="";
|
||
let percent="";
|
||
let district_id="";
|
||
let name="";
|
||
let year="";
|
||
let locust_type_id="";
|
||
let treated="";
|
||
let infested_etd="";
|
||
for(let j=0;j<obj.data.length;j++){
|
||
id=obj.data[j].id;
|
||
percent=parseFloat(obj.data[j].row[0]);
|
||
district_id=parseFloat(obj.data[j].row[1]);
|
||
name=obj.data[j].row[2];
|
||
year=parseFloat(obj.data[j].row[3]);
|
||
locust_type_id=parseFloat(obj.data[j].row[4]);
|
||
treated=parseFloat(obj.data[j].row[5]);
|
||
if(isNaN(treated)) treated="";
|
||
infested_etd=parseFloat(obj.data[j].row[6]);
|
||
if(isNaN(infested_etd)) infested_etd="";
|
||
//Create polygons on map.
|
||
if(!isNaN(percent))
|
||
{
|
||
if(percent>=-25 && percent<=25)
|
||
{
|
||
$.getJSON('../geojson?table=countriesdistricts&id='+id,{},function(userData){return function(data){makeGreenArea(data,userData);};}({district_id:district_id,name:name,percent:percent,text:"<b>"+trt("Treated_(thous._ha)")+"</b>: "+treated+"<br>\n<b>"+trt("Infested_(thous._ha)")+"</b>"+": "+infested_etd+"<br>\n<b>"+trt("Percent")+"</b>: "+percent+"%",year:year,locust_type_id:locust_type_id,type:obj.n}));
|
||
}else
|
||
{
|
||
$.getJSON('../geojson?table=countriesdistricts&id='+id,{},function(userData){return function(data){makeRedArea(data,userData);};}({district_id:district_id,name:name,percent:percent,text:"<b>"+trt("Treated_(thous._ha)")+"</b>"+": "+treated+"<br>\n<b>"+trt("Infested_(thous._ha)")+"</b>"+": "+infested_etd+"<br>\n<b>"+trt("Percent")+"</b>: "+percent+"%",year:year,locust_type_id:locust_type_id,type:obj.n}));
|
||
}
|
||
}else //If there is no data
|
||
{
|
||
$.getJSON('../geojson?table=countriesdistricts&id='+id,{},function(userData){return function(data){makeGrayArea(data,userData);};}({district_id:district_id,name:name,percent:'',year:year,locust_type_id:locust_type_id,type:obj.n}));
|
||
}
|
||
}
|
||
return;
|
||
}
|
||
|
||
function applyReq(req,fn,node)
|
||
{
|
||
if(node.errorCode>0) {
|
||
let fullText = node.errorMessage;
|
||
let smallText = '';
|
||
let pos1=fullText.indexOf('[[');
|
||
let pos2=fullText.indexOf(']]');
|
||
if(pos1>=0 && pos2>=0 && pos1<pos2) smallText=fullText.substring(pos1+2, pos2);
|
||
if(fullText.indexOf("id456[[")>=0){ //Если есть идентификатор того что это перезапись
|
||
let okFunc=()=>{
|
||
this.setValue('seq',0);
|
||
this.sendData(); //Применить ещё раз
|
||
};
|
||
if (smallText != '')
|
||
confirm2(trt('Warning'),smallText, fullText, okFunc, null);
|
||
else
|
||
confirm2(trt('Warning'),smallText, '', okFunc, null);
|
||
}else {
|
||
if (smallText != '')
|
||
alert2(trt('Alert'), smallText, fullText);
|
||
else
|
||
alert2(trt('Alert'), fullText);
|
||
}
|
||
return;
|
||
}
|
||
|
||
if (fn==0)
|
||
{
|
||
//alert('fn==0');
|
||
if(req.userData=="FrmLocustDataPopupInterface")
|
||
{
|
||
m_winPP.hideProgressBar();
|
||
updateFrmLocustDataPopupInterface(node,req.userDataID);
|
||
}
|
||
if(req.userData=="FrmLocustDelDataPopupInterface")
|
||
{
|
||
m_winPP.hideProgressBar();
|
||
updateFrmLocustDelDataPopupInterface(node,req.userDataID);
|
||
}
|
||
|
||
}else if (fn==1)
|
||
{
|
||
alert("Your message has been sent!");
|
||
deleteHTML(this.wdiv);
|
||
qMnu.expand(false);
|
||
}else if (fn==11)
|
||
{
|
||
alert('fn==11');
|
||
}else if (fn==3)
|
||
{
|
||
alert('fn==3');
|
||
}else if (fn==4)
|
||
{
|
||
/*if(req.userData=="FrmLocustData") //For create markers
|
||
{
|
||
hideProgressBar("FrmLocustData");
|
||
updatePOILocust(node,req.userIndicator);
|
||
}else *//*if(req.userData=="FrmLocustDelData") //For create markers
|
||
{
|
||
hideProgressBar("FrmLocustDelData");
|
||
updatePOILocustDel(node);
|
||
}else */if(req.userData=="FrmLocustDataPopup")
|
||
{
|
||
m_winPP.hideProgressBar();
|
||
updatePopupLocust(node);
|
||
}else if(req.userData=="FrmLocustDelDataPopup")
|
||
{
|
||
m_winPP.hideProgressBar();
|
||
updatePopupLocustDel(node);
|
||
}else if(req.userData=="FrmLocustInfoData")
|
||
{
|
||
hideProgressBar("FrmLocustInfoData");
|
||
updateRegionPolygons(node);
|
||
}else if(req.userData=="FrmLocustInfoData_r")
|
||
{
|
||
hideProgressBar("FrmLocustInfoData");
|
||
updateRegionPolygons_r(node);
|
||
}else if(req.userData=="FrmLocustInfoData4")
|
||
{
|
||
hideProgressBar("FrmLocustInfoData");
|
||
updateRegionPolygons4(node);
|
||
}else if(req.userData=="FrmLocustInfoData4_r")
|
||
{
|
||
hideProgressBar("FrmLocustInfoData");
|
||
updateRegionPolygons4_r(node);
|
||
}
|
||
}else if (fn==6)
|
||
{
|
||
alert('fn==6');
|
||
}else if (fn==8)
|
||
{
|
||
alert('fn==8');
|
||
}else
|
||
alert("Unknown function! fn=\""+fn+"\"" );
|
||
} |