/** * 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,''); TODO: delete this line! function showIFrameWindow(title,url) { var win=new TWin(); win.BuildGUI(10,10); win.setCaption(title); win.setContent(''); 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=`

`; 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 \n\ \n\ \n\ \n\ \n\ \n\
'+trt('Year')+' '+trt('Average')+' '+trt('Thous_ha')+' '+trt('Dev_of_average')+'
2005
3
2006230
20072300
\n\
 
\n\
 
\n\ '; 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=''+trt('Year')+' .2. '+trt('Value')+''; 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'+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\n\ \n\ \n\ \n\ \n\ \n\ '; }else if (typeof this.userData.district_id != 'undefined' ) { xs='\n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ '; } 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=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+=""; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=""; //alert(rec.f_Settings); rec.win.setSize("800px","500px"); //rec.win.setLeftTop(300,40); rec.win.setCenter(); rec.request.callServer(ScriptName,''); } //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+=""; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=""; //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,''); } function showReportTabletsStatistics() { let rec=new SRec(); rec.create(null); rec.f_TypeName="ReportTabletsStatistics"; rec.f_Settings=''; rec.f_Settings+=""; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=" "; rec.f_Settings+=""; //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,''); } //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='\n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ '; var request=new TRequest(this); request.userData="FrmLocustInfoData"; }else { xs='\n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ '; var request=new TRequest(this); request.userData="FrmLocustInfoData_r"; } }else if(product_id==3) //Product N 3 { if(region_id=='') { xs='\n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ '; var request=new TRequest(this); request.userData="FrmLocustInfoData"; }else { xs='\n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ '; var request=new TRequest(this); request.userData="FrmLocustInfoData_r"; } }else if(product_id==4) //Product N 4 "Карта уровня угроз" { if(region_id=='') { xs='\n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ '; var request=new TRequest(this); request.userData="FrmLocustInfoData4"; }else { xs='\n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ '; 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('
    >15%'+trt('Increase')+'
    >=15% '+trt('and')+' <=15%'+trt('On_the_same_level')+'
    <15%'+trt('Decrease')+'
     '+trt('No_data')+'
'); } if(product_id==3) { g_WinLegend3.setContent('
    >15%'+trt('Increase')+'
    >=15% '+trt('and')+' <=15%'+trt('On_the_same_level')+'
    <15%'+trt('Decrease')+'
     '+trt('No_data')+'
'); } if(product_id==4) { g_WinLegend3.setContent('
    >-25% '+trt('and')+' <25%'+trt('Normal_Multiyear_average_level')+'
    <=-25% '+trt('or')+' >=25%'+trt('Danger')+'
     '+trt('No_data')+'
'); } 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='\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \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,''); } 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,''); } 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='\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ '; //rec.win.setSize("400px","100px"); rec.win.setHeight(500); //rec.win.setLeftTop(300,40); rec.win.setCenter(); rec.request.callServer(ScriptName,''); } 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('
>1'+trt('Danger')+'
<=1'+trt('Attention')+'
=0'+trt('Quietly')+'
'+trt('No_data')+'
'); } if(rData.indicator=="2") { g_WinLegend1.setContent('
>=5'+trt('Danger')+'
>=3 ... <5'+trt('Caution')+'
<=2'+trt('Calm')+'
'+trt('No_data')+'
'); } if(rData.indicator=="3") { g_WinLegend1.setLeftTop(window.innerWidth-200,40) g_WinLegend1.setContent('
>=1'+trt('Danger')+'
<1'+trt('Calm')+'
'+trt('No_data')+'
'); } if(rData.indicator=="4") { g_WinLegend1.setContent('
>=5'+trt('Danger')+'
>=3 ... <5'+trt('Caution')+'
<=2'+trt('Calm')+'
'+trt('No_data')+'
'); } if(rData.indicator=="5") { g_WinLegend1.setContent('
>=1'+trt('Danger')+'
<1'+trt('Calm')+'
'+trt('No_data')+'
'); } 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='\n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ '; //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('
'+trt('Spraying')+'
'); 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('
'+trt('Spraying')+'
'); 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='\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \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,''); } 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='\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ '; //rec.win.setSize("400px","100px"); rec.win.setHeight(500); //rec.win.setLeftTop(300,40); rec.win.setCenter(); rec.request.callServer(ScriptName,''); } 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='\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ '; //rec.win.setSize("400px","100px"); rec.win.setHeight(500); //rec.win.setLeftTop(300,40); rec.win.setCenter(); rec.request.callServer(ScriptName,''); } //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(''); 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(''); 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(''); 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(''); 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(''); 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(''); 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(''); 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(''); 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(''); 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(''); 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;itreated_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;j15) { $.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;j15) { $.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=-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:""+trt("Treatedtrt_(thous._ha)")+": "+treated+"
\n"+trt("Infested_(thous._ha)")+": "+infested_etd+"
\n"+trt("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){makeRedArea(data,userData);};}({region_id:region_id,name:name,percent:percent,text:""+trt("Treated_(thous._ha)")+": "+treated+"
\n"+trt("Infested_(thous._ha)")+": "+infested_etd+"
\n"+trt("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:'',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=-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:""+trt("Treated_(thous._ha)")+": "+treated+"
\n"+trt("Infested_(thous._ha)")+""+": "+infested_etd+"
\n"+trt("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){makeRedArea(data,userData);};}({district_id:district_id,name:name,percent:percent,text:""+trt("Treated_(thous._ha)")+""+": "+treated+"
\n"+trt("Infested_(thous._ha)")+""+": "+infested_etd+"
\n"+trt("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; } 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=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+"\"" ); }