From b9bddc6ec63e3ec6141bc7bd3e06ef98588c44e2 Mon Sep 17 00:00:00 2001 From: Orestis Moresis Date: Wed, 8 Feb 2023 12:58:54 +0200 Subject: [PATCH] bug fix descriptor and criteria dropdowns in mrus --- public/js/more-info.js | 126 + public/js/mru-info.js | 84 + public/js/poseidon-charts.js | 0 public/js/sidebar.js | 8 +- .../trash/maptab/lib/attributesFunctions.js | 643 ----- .../js/trash/maptab/lib/featureFunctions.js | 2407 ----------------- public/js/trash/maptab/lib/layersFunctions.js | 127 - .../js/trash/maptab/lib/servicesFunctions.js | 65 - public/js/trash/maptab/map.js | 801 ------ .../trash/maptab/maptab_east_search_panel.js | 1031 ------- .../trash/maptab/maptab_services_manager.js | 76 - .../arcgismapservice.js | 566 ---- .../maptab/maptab_services_manager/atom.js | 328 --- .../maptab/maptab_services_manager/csw.js | 214 -- .../maptab/maptab_services_manager/dxf.js | 369 --- .../maptab/maptab_services_manager/georss.js | 328 --- .../maptab/maptab_services_manager/kml.js | 312 --- .../maptab_services_manager/shapefile.js | 459 ---- .../maptab/maptab_services_manager/wfs.js | 603 ----- .../maptab/maptab_services_manager/wmc.js | 384 --- .../maptab/maptab_services_manager/wms.js | 611 ----- .../maptab/maptab_services_manager/wmts.js | 596 ---- .../js/trash/maptab/maptab_toolbar_general.js | 571 ---- .../map_controls_featureInfo.js | 519 ---- .../map_controls_measureArea.js | 294 -- .../map_controls_measureDistance.js | 230 -- .../js/trash/maptab/maptab_toolbar_search.js | 548 ---- .../maptab_west_general_settings_panel.js | 979 ------- .../maptab/maptab_west_layer_tree_panel.js | 830 ------ .../maptab_west_search_settings_panel.js | 168 -- .../maptab/maptab_west_selection_panel.js | 96 - 31 files changed, 214 insertions(+), 14159 deletions(-) create mode 100644 public/js/more-info.js create mode 100644 public/js/mru-info.js create mode 100644 public/js/poseidon-charts.js delete mode 100644 public/js/trash/maptab/lib/attributesFunctions.js delete mode 100644 public/js/trash/maptab/lib/featureFunctions.js delete mode 100644 public/js/trash/maptab/lib/layersFunctions.js delete mode 100644 public/js/trash/maptab/lib/servicesFunctions.js delete mode 100644 public/js/trash/maptab/map.js delete mode 100644 public/js/trash/maptab/maptab_east_search_panel.js delete mode 100644 public/js/trash/maptab/maptab_services_manager.js delete mode 100644 public/js/trash/maptab/maptab_services_manager/arcgismapservice.js delete mode 100644 public/js/trash/maptab/maptab_services_manager/atom.js delete mode 100644 public/js/trash/maptab/maptab_services_manager/csw.js delete mode 100644 public/js/trash/maptab/maptab_services_manager/dxf.js delete mode 100644 public/js/trash/maptab/maptab_services_manager/georss.js delete mode 100644 public/js/trash/maptab/maptab_services_manager/kml.js delete mode 100644 public/js/trash/maptab/maptab_services_manager/shapefile.js delete mode 100644 public/js/trash/maptab/maptab_services_manager/wfs.js delete mode 100644 public/js/trash/maptab/maptab_services_manager/wmc.js delete mode 100644 public/js/trash/maptab/maptab_services_manager/wms.js delete mode 100644 public/js/trash/maptab/maptab_services_manager/wmts.js delete mode 100644 public/js/trash/maptab/maptab_toolbar_general.js delete mode 100644 public/js/trash/maptab/maptab_toolbar_general/map_controls_featureInfo.js delete mode 100644 public/js/trash/maptab/maptab_toolbar_general/map_controls_measureArea.js delete mode 100644 public/js/trash/maptab/maptab_toolbar_general/map_controls_measureDistance.js delete mode 100644 public/js/trash/maptab/maptab_toolbar_search.js delete mode 100644 public/js/trash/maptab/maptab_west_general_settings_panel.js delete mode 100644 public/js/trash/maptab/maptab_west_layer_tree_panel.js delete mode 100644 public/js/trash/maptab/maptab_west_search_settings_panel.js delete mode 100644 public/js/trash/maptab/maptab_west_selection_panel.js diff --git a/public/js/more-info.js b/public/js/more-info.js new file mode 100644 index 0000000..dc9c20e --- /dev/null +++ b/public/js/more-info.js @@ -0,0 +1,126 @@ +function moreInfo() { + return { + entityGroup: selectedEntityGroup, + entityId: selectedEntityId || Alpine.store('entity').id, + dopen: false, + copen: false, + loading: false, + isGrid: Alpine.store('entity').hasOwnProperty('cellcode'), + d: {}, + c: {}, + tagName(type, id) { + if (id == null) + return; + if (type === 'd') { + return this.d.find(i => i.id == id).code; + } else if (type === 'c') { + return this.c.find(i => i.id == id).code; + } + }, + did: null, + cid: [], + date: {}, + search() { + this.drawDataChart(); + // check if entity has an external source + if (this.$store.entity.hasOwnProperty('ctStationCode')) { + requestExternalData(this.did, this.cid, this.date.from, this.date.to, this.entityGroup, this.entityId); + } else { + requestEntityData(this.did, this.cid, this.date.from, this.date.to, this.entityGroup, this.entityId); + } + }, + selectEntry(element, entry) { + console.debug(element.text.substr(0, element.text.indexOf(' '))); + if (element.id.split('-')[1] === 'desc') { + // highlight + element.parentElement.querySelectorAll('a').forEach(el => el.classList.remove('is-active')); + element.classList.add('is-active'); + // update variables; + this.cid = []; + this.did = entry; + this.dopen = false; + } else if (element.id.split('-')[1] === 'crit') { + // toggle + element.classList.toggle('is-active'); + // update variables; + this.cid.indexOf(entry) === -1 ? this.cid.push(entry) : this.cid = this.cid.filter(function(id) { return id !== entry}); + this.copen = false; + // add tag + } + }, + getDropdownData(dropdown) { + this.loading = true; + let url = BASE_URL; + let gridCode; + if (this.isGrid) { + gridCode = Alpine.store('entity').cellcode.substr(0,4); + } + + switch(dropdown) { + case 'd': + url += '/interface/dropdowns/descriptors?entityid=' + this.entityId + '&cellcode=' + gridCode; + break; + case 'c': + url += '/interface/dropdowns/criterias?descriptor_id=' + this.did + '&cellcode=' + gridCode; + break; + } + + fetch(url) + .then(res => res.json()) + .then(data => { + this.isLoading = false; + eval('this.' + dropdown + '=data'); + }); + }, + loadCal() { + const calendars = bulmaCalendar.attach('[type=date]', {dateFormat: 'dd/MM/yyyy', isRange: true}); + // Loop on each calendar initialized + calendars.forEach(calendar => { + calendar.on('save', data => { + this.date = { + from: calendar.startDate.toLocaleDateString(), + to: calendar.endDate.toLocaleDateString() + } + }); + }); + }, + populateFeatureGrid(grid) { + const features = Alpine.store('entity'); + console.debug(features); + const featureCols = Object.getOwnPropertyNames(Alpine.store('entity')).filter(name => aliasMap.has(name)); + const featureVals = featureCols.map(col => {return {feature: aliasMap.get(col), value: features[col]}}); + console.debug(featureVals); + new gridjs.Grid({ + data: featureVals + }).render(grid); + }, + drawDataChart() { + if (this.entityGroup != 'POSEIDON') + return; + const url = `/data/external/POSEIDON/${Alpine.store('entity').tspr}_${Alpine.store('entity').type}_${Alpine.store('entity').pid}`; + fetch(url) + .then(res => res.json()) + .then(data => { + this.isLoading = false; + console.debug(data); + }); + + const config = { + type: 'line', + data: data, + options: { + responsive: true, + plugins: { + legend: { + position: 'top', + }, + title: { + display: true, + text: 'Chart.js Line Chart' + } + } + }, + }; + } + }; +} diff --git a/public/js/mru-info.js b/public/js/mru-info.js new file mode 100644 index 0000000..e14976f --- /dev/null +++ b/public/js/mru-info.js @@ -0,0 +1,84 @@ +function mruInfo() { + return { + dopen: false, + copen: false, + loading: false, + d: {}, + c: {}, + tagName(type, id) { + if (id == null) + return; + if (type === 'd') { + return this.d.find(i => i.id == id).code; + } else if (type === 'c') { + return this.c.find(i => i.id == id).code; + } + }, + bid: Alpine.store('mru').objectid, + did: null, + cid: [], + date: {}, + search() { + generateRequest(this.did, this.cid, this.date.from, this.date.to, this.bid); + }, + selectEntry(element, entry) { + console.debug(element.text.substr(0, element.text.indexOf(' '))); + if (element.id.split('-')[1] === 'desc') { + // highlight + element.parentElement.querySelectorAll('a').forEach(el => el.classList.remove('is-active')); + element.classList.add('is-active'); + // update variables; + this.cid = []; + this.did = entry; + this.dopen = false; + } else if (element.id.split('-')[1] === 'crit') { + // toggle + element.classList.toggle('is-active'); + // update variables; + this.cid.indexOf(entry) === -1 ? this.cid.push(entry) : this.cid = this.cid.filter(function(id) { return id !== entry}); + this.copen = false; + // add tag + } + }, + getDropdownData(dropdown) { + this.loading = true; + let url = BASE_URL; + switch(dropdown) { + case 'd': + url += '/interface/dropdowns/descriptors?bodyid=' + this.bid; + break; + case 'c': + url += '/interface/dropdowns/criterias?descriptor_id=' + this.did; + break; + } + fetch(url) + .then(res => res.json()) + .then(data => { + this.isLoading = false; + eval('this.' + dropdown + '=data'); + }); + }, + loadCal() { + const calendars = bulmaCalendar.attach('[type=date]', {dateFormat: 'dd/MM/yyyy', isRange: true}); + // Loop on each calendar initialized + calendars.forEach(calendar => { + calendar.on('save', data => { + this.date = { + from: calendar.startDate.toLocaleDateString(), + to: calendar.endDate.toLocaleDateString() + } + }); + }); + }, + populateFeatureGrid(grid) { + console.debug(grid); + const features = Alpine.store('mru'); + const featureCols = Object.getOwnPropertyNames(Alpine.store('mru')).filter(name => aliasMap.has(name)); + const featureVals = featureCols.map(col => {return {feature: aliasMap.get(col), value: features[col]}}); + console.debug(featureVals); + new gridjs.Grid({ + data: featureVals + }).render(grid); + } + }; +} diff --git a/public/js/poseidon-charts.js b/public/js/poseidon-charts.js new file mode 100644 index 0000000..e69de29 diff --git a/public/js/sidebar.js b/public/js/sidebar.js index 8636c38..c82e215 100644 --- a/public/js/sidebar.js +++ b/public/js/sidebar.js @@ -336,10 +336,10 @@ function moreInfo() { switch(dropdown) { case 'd': - url += '/interface/dropdowns/descriptors?entityid=' + this.entityId + '&cellcode=' + gridCode; + url += '/interface/dropdowns/descriptors?entity_id=' + this.entityId + '&cellcode=' + gridCode; break; case 'c': - url += '/interface/dropdowns/criterias?descriptor_id=' + this.did + '&cellcode=' + gridCode; + url += '/interface/dropdowns/criterias?desc_id=' + this.did + '&cellcode=' + gridCode; break; } @@ -451,10 +451,10 @@ function mruInfo() { let url = BASE_URL; switch(dropdown) { case 'd': - url += '/interface/dropdowns/descriptors?bodyid=' + this.bid; + url += '/interface/dropdowns/descriptors?body_id=' + this.bid; break; case 'c': - url += '/interface/dropdowns/criterias?descriptor_id=' + this.did; + url += '/interface/dropdowns/criterias?desc_id=' + this.did; break; } fetch(url) diff --git a/public/js/trash/maptab/lib/attributesFunctions.js b/public/js/trash/maptab/lib/attributesFunctions.js deleted file mode 100644 index 74a67ef..0000000 --- a/public/js/trash/maptab/lib/attributesFunctions.js +++ /dev/null @@ -1,643 +0,0 @@ -function fn_createAttributesStore(_layerAttributes) -{ - Ext.define('featureAttributes', { - extend: 'Ext.data.Model', - idProperty: 'featureAttributes_id', - fields: fn_createAttributesColumns(_layerAttributes) - }); - - var s=Ext.create('Ext.data.Store', - { - data:[], - model:'featureAttributes' - }); - - return s; -} - -function fn_createAttributesColumns(_layerAttributes) -{ - var _fields=new Array(); - - Ext.each(_layerAttributes,function(item) - { - var columnexist=fn_objIndexOf(_fields,"name",item._attributeName); - - if ((!item._attributeIsGeometry) && (columnexist<0)) - { - _fields.push({ - name: item._attributeName, - type: item._attributeType - }); - } - }); - - return _fields; -} - -function fn_createAttributesColumnModel(_layerAttributes) -{ - var _columns=new Array(); - - Ext.each(_layerAttributes,function(item){ - - if (!item._attributeIsGeometry) - { - var _trans=item._attributeTranslation; - - if ((_trans==null) || (typeof _trans=="undefined")) - { - _trans=item._attributeName; - } - - var width=140; - - if (item.width) - { - width=item.width; - } - - var renderer=""; - - if (item.renderer) - { - renderer=item.renderer; - } - - var flex=""; - - if (item.flex) - { - flex=item.flex; - } - - var hidden=false; - - if (item.hidden) - { - hidden=item.hidden; - } - - if (typeof item._attributeIsVisible!=="undefined") - { - if(item._attributeIsVisible==false) - { - hidden=true; - } - else - { - hidden=false; - } - } - - var hideable=true; - - if (item.hideable==false) - { - hideable=false; - } - - - if (typeof item._attributeVisible!=="undefined") - { - hideable=item._attributeVisible; - } - - _columns.push({ - header: _trans, - dataIndex: item._attributeName, - sortable: item._attributeIsSortable, - width:width, - renderer:renderer, - hidden:hidden, - hideable:hideable, - flex:flex - }); - - } - }); - - return _columns; -} - -function fn_addRecordsToStore(_store,_data) -{ - _store.loadData(_data); -} - -function fn_createAttributeSummary(_record,_layerAttributes) -{ - var _summary=new Array(); - - if (_layerAttributes.length>0) - { - Ext.each(_layerAttributes,function(item){ - - if ((item._attributeShowOnSummary) && (!item._attributeIsGeometry) && (item._attributeVisible)) - { - var _trans=item._attributeTranslation; - - if ((_trans==null) || (typeof _trans=="undefined")) - { - _trans=item._attributeName; - } - - var _value=_record[item._attributeName]; - - if(typeof _value=="undefined") - { - _value=""; - } - - _summary.push(""+_trans+" : "+_value); - } - }); - - if (_summary.length==0) - { - var i=0; - - Ext.each(_layerAttributes,function(item){ - - if (i<4) - { - var _trans=item._attributeTranslation; - - if ((!item._attributeIsGeometry) && (item._attributeVisible)) - { - if ((_trans==null) || (typeof _trans=="undefined")) - { - _trans=item._attributeName; - } - - var _value=_record[item._attributeName]; - - if(typeof _value=="undefined") - { - _value=""; - } - - _summary.push(""+_trans+" : "+_value); - - i++; - } - } - - }); - - } - - }else{ - - var _attributesFields = []; - - for(var _k in _record) - { - if ((_k!="_layerId") && (_k!="_featureId") && (_k!="_srsName") && (_k!="_featureUrl") && (_k!="_featureGeomFormat")) - { - _attributesFields.push({ - "_attributeName":_k.toString(), - "_attributeType":"string", - "_attributeTranslation":null, - "_attributeValue":null, - "_attributeEditor":null, - "_attributeIsSortable":true, - "_attributeIsEditable":true, - "_attributeOrder":0, - "_attributeIsVisible":true, - "_attributeIsSearchable":true, - "_attributeIsGeometry":false, - "_attributeVisible":true, - "_geometryIsMulti":false, - "_attributeShowOnSummary":true - }); - - _summary.push(""+_k+" : "+_record[_k]); - } - } - - if(typeof _record!=="undefined") - { - mapFindLayerById(_record._layerId)._layerObject._attributesFields=_attributesFields; - } - - } - - _record._summary=_summary.join("
"); - - return _record; -} - -function fn_createAttributesGrid(_layerAttributes) -{ - - var g=Ext.create('Ext.grid.Panel', - { - border:true, - columnLines:true, - split: true, - store:fn_createAttributesStore(_layerAttributes), - columns:fn_createAttributesColumnModel(_layerAttributes) - }); - - return g; - -} - - - -function fn_createAttributesPivotGrid(_feature) -{ - var _store=fn_createStorePivotGrid(); - - var cellEditing = ""; - - var _editBbar=""; - - if (mapFindLayerById(_feature._layerId)._layerObject._isEdited) - { - - cellEditing= Ext.create('Ext.grid.plugin.CellEditing', { - clicksToEdit: 2, - listeners:{ - 'beforeedit': function(editor, e, eOpts ) - { - var _editor=e.record.get("_attributeEditor"); - - if ((_editor=="") || (_editor==null) || (typeof _editor==="undefined")) - { - _editor={xtype:'textfield'}; - } - - e.column.setEditor(_editor); - }, - 'afteredit':function(editor, e, eOpts) - { - var isDirty=false; - - _store.each(function(item){ - if(item.dirty == true){ - isDirty = true; - } - }); - - var _f=this.getCmp().getDockedItems('toolbar[dock="bottom"]')[0].items.items; - - if (isDirty) - { - _f[1].enable(); - }else - { - _f[1].disable(); - } - } - } - }); - - _editBbar=[ - '->', - { - xtype:'button', - iconCls:'features_toolbar_save', - disabled:true, - tooltip:_maptab_edit_windowinfo_save_attributes_button, - handler:function(cmp, e) - { - var _newAttributes=[]; - - _store.each(function(item){ - if(item.dirty == true){ - _newAttributes.push({ - _attributeName:item.get("_attributeName"), - _attributeValue:item.get("_attributeValue") - }); - } - }); - - maptab_edit_change_attributes(_feature,_newAttributes); - } - }, - { - xtype:'button', - iconCls:'features_toolbar_cancel', - tooltip:_maptab_edit_windowinfo_cancel_attributes_button, - handler:function(cmp, e) - { - - Ext.getCmp(this.findParentByType("window").id).destroy(); - } - } - ] - } - - var g=Ext.create('Ext.grid.Panel', - { - border:true, - columnLines:true, - split: true, - bbar:_editBbar, - store:_store, - _feature:_feature, - columns:fn_createColumnModelPivotGrid(), - plugins:cellEditing, - disableSelection: true, - selModel: - { - selType: 'cellmodel' - } - }); - - return g; - -} - -function fn_createStorePivotGrid() -{ - Ext.define('propertyAttributes', { - extend: 'Ext.data.Model', - idProperty: 'featureAttributes_id', - fields:['_attributeName','_attributeTranslation','_attributeValue','_attributeType','_attributeEditor','_attributeIsEditable'] - }); - - var s=Ext.create('Ext.data.Store', - { - data:[], - model: 'propertyAttributes' - }); - - return s; -} - -function fn_createColumnModelPivotGrid() -{ - var _columns=[{ - header: '', - dataIndex: "_attributeName", - hidden:true, - hideable:false - }, - { - header: _feature_Attributes_Pivot_AttributeName, - dataIndex: "_attributeTranslation", - hidden:false, - hideable:false - }, - { - header: _feature_Attributes_Pivot_AttributeValue, - dataIndex: "_attributeValue", - hidden:false, - hideable:false, - flex: 3, - field: { - allowBlank: false - } - }, - { - header: '', - dataIndex: "_attributeType", - hidden:true, - hideable:false - }, - { - header: '', - dataIndex: "_attributeEditor", - hidden:true, - hideable:false - }, - { - header: '', - dataIndex: "_attributeIsEditable", - hidden:true, - hideable:false - }]; - - return _columns; -} - -function fn_createAttributesRecords(_data,_layerAttributes) -{ - var _records=new Array(); - - Ext.each(_layerAttributes,function(item){ - - var _trans=item._attributeTranslation; - - if ((!item._attributeIsGeometry) && (item._attributeVisible==true)) - { - if ((_trans==null) || (typeof _trans=="undefined")) - { - _trans=item._attributeName; - } - - var _value=""; - - if (typeof _data!=="undefined") - { - _value=_data[item._attributeName]; - - if(typeof _value=="undefined") - { - _value="(Null)"; - } - } - - - if(typeof item.renderer!=="undefined") - { - _value=item.renderer(_value,"","","","","",""); - } - - _records.push({ - _attributeName:item._attributeName, - _attributeTranslation:_trans, - _attributeValue:_value, - _attributeType:item._attributeType, - _attributeEditor:item._attributeEditor, - _attributeIsEditable:item._attributeIsEditable - }); - - } - - }); - - return _records; -} - -function fn_createAttributesComboBox(_layerAttributes,_cmpId) -{ - - var s = new fn_createAttributesComboStore(_layerAttributes); - - if ((typeof _cmpId==="undefined") || (_cmpId=="")) - { - _cmpId=Ext.id(); - } - - var c=Ext.create('Ext.form.ComboBox', - { - border:false, - store: s, - id:_cmpId, - queryMode: 'local', - displayField: '_attributeTranslation', - valueField: '_attributeName', - emptyText:_maptab_east_search_panel_criteria_choose_attribute, - value:"", - forceSelection: true, - selectOnFocus: false, - triggerAction: 'all', - tpl: new Ext.XTemplate('' + '
  • ' + '{_attributeTranslation}' + '
  • '), - editable: false - }); - - return c; -} - -function fn_createAttributesComboStore(_layerAttributes) -{ - var s=new fn_createStorePivotGrid(); - - var _records=new Array(); - - Ext.each(_layerAttributes,function(item){ - - var _trans=item._attributeTranslation; - - if ((!item._attributeIsGeometry) && (item._attributeVisible==true) && (item._attributeIsSearchable==true)) - { - - if ((_trans==null) || (typeof _trans=="undefined")) - { - _trans=item._attributeName; - } - - var _value=""; - - if (typeof _data!=="undefined") - { - _value=_data[item._attributeName]; - - if(typeof _value=="undefined") - { - _value="(Null)"; - } - } - - _records.push({ - _attributeName:item._attributeName, - _attributeTranslation:_trans, - _attributeValue:_value, - _attributeType:item._attributeType, - _attributeEditor:item._attributeEditor, - _attributeIsEditable:item._attributeIsEditable - }); - - } - - }); - - s.loadData(_records); - - return s; -} - -function fn_createCriteriaComboConditions(_attributeType) -{ - var _data=new Array(); - - switch(_attributeType) - { - case "string": - _data=[{"condition":'=',"disableValue":false},{"condition":'!=',"disableValue":false},{"condition":'LIKE',"disableValue":false},{"condition":'NOT LIKE',"disableValue":false},{"condition":'IS NOT NULL',"disableValue":true},{"condition":'IS NULL',"disableValue":true}]; - break; - - case "int": - _data=[{condition:'=',disableValue:false},{condition:'>=',disableValue:false},{condition:'>',disableValue:false},{condition:'<=',disableValue:false},{condition:'<',disableValue:false},{condition:'IS NOT NULL',disableValue:true},{condition:'IS NULL',disableValue:true}]; - break; - - case "integer": - _data=[{condition:'=',disableValue:false},{condition:'>=',disableValue:false},{condition:'>',disableValue:false},{condition:'<=',disableValue:false},{condition:'<',disableValue:false},{condition:'IS NOT NULL',disableValue:true},{condition:'IS NULL',disableValue:true}]; - break; - - case "double": - _data=[{condition:'=',disableValue:false},{condition:'>=',disableValue:false},{condition:'>',disableValue:false},{condition:'<=',disableValue:false},{condition:'<',disableValue:false},{condition:'IS NOT NULL',disableValue:true},{condition:'IS NULL',disableValue:true}]; - break; - - case "decimal": - _data=[{condition:'=',disableValue:false},{condition:'>=',disableValue:false},{condition:'>',disableValue:false},{condition:'<=',disableValue:false},{condition:'<',disableValue:false},{condition:'IS NOT NULL',disableValue:true},{condition:'IS NULL',disableValue:true}]; - break; - - case "date": - _data=[{condition:'=',disableValue:false},{condition:'>=',disableValue:false},{condition:'>',disableValue:false},{condition:'<=',disableValue:false},{condition:'<',disableValue:false},{condition:'IS NOT NULL',disableValue:true},{condition:'IS NULL',disableValue:true}]; - break; - - default: - _data=[{condition:'=',disableValue:false},{condition:'!=',disableValue:false},{condition:'LIKE',disableValue:false},{condition:'NOT LIKE',disableValue:false},{condition:'>=',disableValue:false},{condition:'>',disableValue:false},{condition:'<=',disableValue:false},{condition:'<',disableValue:false},{condition:'IS NOT NULL',disableValue:true},{condition:'IS NULL',disableValue:true}]; - break; - } - - return _data; -} - -function fn_createCriteriaAndOrCombo(_cmpId) -{ - - if ((typeof _cmpId==="undefined") || (_cmpId=="")) - { - _cmpId=Ext.id(); - } - - - var c=Ext.create('Ext.form.ComboBox', - { - store: new Ext.data.SimpleStore({ - fields: ['name','value'], - data: [ - ["",""], - ["AND","AND"], - ["OR","OR"] - ] - }), - displayField: 'name', - valueField: 'value', - emptyText:"AND", - width:60, - id:_cmpId, - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - editable: false, - tpl: new Ext.XTemplate('' + '
  • ' + '{name}' + '
  • ') - }); - - return c; -} - -function fn_createCriteriaParenthesis() -{ - var c=Ext.create('Ext.form.ComboBox', - { - store: new Ext.data.SimpleStore({ - fields: ['name','value'], - data: [ - ["",""], - ["(","("], - [")",")"] - ] - }), - displayField: 'name', - valueField: 'value', - emptyText:"", - width:60, - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - editable: false, - tpl: new Ext.XTemplate('' + '
  • ' + '{name}' + '
  • ') - }); - - return c; -} - diff --git a/public/js/trash/maptab/lib/featureFunctions.js b/public/js/trash/maptab/lib/featureFunctions.js deleted file mode 100644 index 706c6a6..0000000 --- a/public/js/trash/maptab/lib/featureFunctions.js +++ /dev/null @@ -1,2407 +0,0 @@ -var infowindowoffsetposition = -200; -var postgresql_field_domains = []; -var sqlite_field_domains = []; - -function fn_get_postgresql_field_domains() { - var _proxy_url_getdomains = host + "src/proxy/getdomains.php"; - _proxy_url_getdomains.replace('admin/', ''); - Ext.Ajax.request({ - url: _proxy_url_getdomains + '?db=postgres', - success: function (response, opts) { - try { - postgresql_field_domains = Ext.decode(response.responseText); - } catch (err) { - } - }, - failure: function (response, opts) { - console.log('server-side failure with field domains ' + response.status); - } - }); -} - -function fn_get_sqlite_field_domains() { - var _proxy_url_getdomains = host + "src/proxy/getdomains.php"; - _proxy_url_getdomains.replace('admin/', ''); - Ext.Ajax.request({ - url: _proxy_url_getdomains + '?db=sqlite', - success: function (response, opts) { - try { - sqlite_field_domains = Ext.decode(response.responseText); - } catch (err) { - } - }, - failure: function (response, opts) { - console.log('server-side failure with field domains ' + response.status); - } - }); -} - -try { - fn_get_postgresql_field_domains(); -} catch (err) { } - -try { - fn_get_sqlite_field_domains(); -} catch (err) { } - -function fn_featureObject(record) { - - var _featureId = record.get("_featureId"); - var _layerId = record.get("_layerId"); - var _srsName = record.get("_srsName"); - var _featureUrl = record.get("_featureUrl"); - var _featureGeomFormat = record.get("_featureGeomFormat"); - var feature = { - _featureId: _featureId, - _layerId: _layerId, - _srsName: _srsName, - _featureUrl: _featureUrl, - _featureGeomFormat: _featureGeomFormat, - _featureAttributes: "" - }; - - return feature; - -} - -function fn_featureColumnModelForGrid(_appendColumns) { - var output = new Array(); - - output = [ - { - _attributeName: "_featureUrl", - _attributeSortable: false, - _attributeType: "string", - _attributeTranslation: "", - hideable: false, - hidden: true - }, - { - _attributeName: "_featureGeomFormat", - _attributeSortable: false, - _attributeType: "string", - _attributeTranslation: "", - hideable: false, - hidden: true - }, - { - _attributeName: "_srsName", - _attributeSortable: false, - _attributeType: "string", - _attributeTranslation: "", - hideable: false, - hidden: true - }, - { - _attributeName: "_featureId", - _attributeSortable: false, - _attributeType: "string", - _attributeTranslation: "", - width: 30, - hideable: false, - renderer: fn_featureShowOnMapRenderer - }, - { - _attributeName: "_featureId", - _attributeSortable: false, - _attributeType: "string", - _attributeTranslation: "", - width: 30, - hidden: true, - hideable: false, - renderer: fn_featureHighlightRenderer - }, - { - _attributeName: "_featureId", - _attributeSortable: false, - _attributeType: "string", - _attributeTranslation: "", - width: 30, - hidden: true, - hideable: true, - renderer: fn_featureAddToSelectedRenderer - }, - { - _attributeName: "_featureId", - _attributeSortable: false, - _attributeType: "string", - _attributeTranslation: "", - width: 30, - hideable: false, - renderer: fn_featureInfoWindowRenderer - }, - { - _attributeName: "_featureId", - _attributeSortable: false, - _attributeType: "string", - _attributeTranslation: "", - width: 30, - hideable: false, - hidden: false, - renderer: fn_featureDownloadRenderer - }, - { - _attributeName: "_layerId", - _attributeSortable: false, - _attributeType: "string", - _attributeTranslation: "", - hidden: !admin, - width: 30, - hideable: false, - renderer: fn_featureEditRenderer - }]; - - if (typeof _appendColumns != "undefined") { - output.push.apply(output, _appendColumns); - } - - return output; -} - -var fetureGridTopBarRightBtns = []; - -var fetureGridTopBarLeftBtns = []; - -function fn_createFetureGridTopBar() { - var tbar = [ - '->', - { - xtype: 'button', - tooltip: _feature_gridicons_qtip_showOnMap, - iconCls: 'features_toolbar_showonmap', - hidden: true, - handler: function () { - - } - }, - { - xtype: 'button', - tooltip: _feature_gridicons_qtip_highlight, - iconCls: 'features_toolbar_highlight', - hidden: true, - handler: function () { - - } - }, - { - xtype: 'button', - tooltip: _feature_gridicons_qtip_featureInfoWindow, - iconCls: 'features_toolbar_showinfow', - handler: function () { - var selected = Ext.getCmp(this.findParentByType("grid").id).getSelectionModel().getSelection(); - - infowindowoffsetposition = -200; - - Ext.each(selected, function (item) { - infowindowoffsetposition = infowindowoffsetposition + 10; - - fn_callFeatureFnFromGrid(item.get("_featureId"), item.get("_layerId"), item.get("_srsName"), item.get("_featureUrl"), item.get("_featureGeomFormat"), 'getInfo'); - }); - } - }, - { - xtype: 'button', - tooltip: _feature_gridicons_qtip_download, - iconCls: 'features_toolbar_download', - handler: function () { - featureDownloadArray = []; - - var selected = Ext.getCmp(this.findParentByType("grid").id).getSelectionModel().getSelection(); - - Ext.each(selected, function (item) { - var _feature = { - _featureId: item.get("_featureId"), - _layerId: item.get("_layerId"), - _srsName: item.get("_srsName"), - _featureUrl: item.get("_featureUrl"), - _featureGeomFormat: item.get("_featureGeomFormat") - }; - - featureDownloadArray.push(_feature); - - }); - - var _w = fn_featureDonwloadWindow(); - - _w.show(); - } - }, - { - xtype: 'button', - tooltip: _feature_gridicons_qtip_addtoselected, - iconCls: 'features_toolbar_addtoselected', - handler: function () { - var selected = Ext.getCmp(this.findParentByType("grid").id).getSelectionModel().getSelection(); - - Ext.each(selected, function (item) { - maptab_west_selection_panel_grid_add_record(item.get("_featureId"), item.get("_layerId"), item.get("_featureUrl"), item.get("_srsName"), item.get("_featureGeomFormat")); - - }); - } - }, - { - xtype: 'button', - tooltip: _feature_gridicons_qtip_PDF, - iconCls: 'pdf', - hidden: false, - handler: function () { - var grid = Ext.getCmp(this.findParentByType("grid").id); - var colums = Ext.getCmp(this.findParentByType("grid").id).columns; - var selected = Ext.getCmp(this.findParentByType("grid").id).getSelectionModel().getSelection(); - var dt = []; - var tt = []; - var i = 0; - var j = 0; - selected.forEach(function (item, index) { - delete item.raw['_featureGeomFormat']; - delete item.raw['_featureId']; - delete item.raw['_featureUrl']; - delete item.raw['_layerId']; - delete item.raw['_srsName']; - dt.push(item.raw); - - var keyNames = Object.keys(item.raw); - if (j <= keyNames.length) { - i = index - } - j = keyNames.length; - }); - colums.forEach(function (col) { - var keyNames = Object.keys(selected[i].raw); - keyNames.forEach(function (key) { - if (key === col['dataIndex']) { - var tmp = { - id: key, - translate: col.text - }; - var index = tt.findIndex(function (s) { - if (s.id === key) { - return true - } - }); - if (index === -1) { - tt.push(tmp) - } - } - }); - - }); - var tableRows = []; - var tm = []; - tt.forEach(function (item) { - tm.push(item.translate); - }); - tableRows.push(tm); - dt.forEach(function (raw) { - var tmp = []; - tt.forEach(function (item) { - if (typeof raw[item.id] === 'undefined') { - tmp.push(''); - } else { - var keyNames = Object.keys(raw); - keyNames.forEach(function (key) { - if (item.id === key) { - tmp.push(raw[key]); - } - }) - } - }); - tableRows.push(tmp); - }); - var page = ''; - if (tt.length <= 6) { - page = 'A4' - } else if (tt.length > 6 && tt.length <= 10) { - page = 'A3' - } else if (tt.length > 10) { - page = 'A2' - } - var docDefinition = { - pageSize: page, - pageOrientation: 'landscape', - content: [ - { text: grid.title, style: 'header' }, - { - style: 'table', - table: { - body: tableRows - } - } - ], - styles: { - header: { - fontSize: 18, - bold: true, - margin: [0, 0, 0, 10] - }, - subheader: { - fontSize: 16, - bold: true, - margin: [0, 10, 0, 5] - }, - table: { - margin: [0, 5, 0, 15] - }, - tableHeader: { - bold: true, - fontSize: 13, - color: 'black' - } - }, - defaultStyle: { - fontSize: 8 - } - }; - window.pdfMake.createPdf(docDefinition).download(); - } - }, - { - xtype: 'button', - tooltip: _feature_gridicons_qtip_edit, - iconCls: 'features_toolbar_edit', - hidden: !admin, - handler: function () { - var selected = Ext.getCmp(this.findParentByType("grid").id).getSelectionModel().getSelection(); - var _features = []; - var _layerId = ""; - - Ext.each(selected, function (item) { - _layerId = item.get("_layerId"); - - _features.push(item.get("_featureId")); - - }); - - - fn_maptab_edit_init_edit_from_grid(_layerId, _features); - - } - } - - ]; - - tbar.push.apply(fetureGridTopBarLeftBtns, tbar); - - tbar.push.apply(tbar, fetureGridTopBarRightBtns); - - return tbar; - -} - -var featureDownloadArray = new Array(); - -function fn_featureDonwloadWindow() { - var _projection_systems = new Array(); - - var _config = new _config_init_map(); - - for (var i = 0; i < _config._mapProjections.length; i++) { - var _proj = _config._mapProjections[i]; - - _projection_systems.push([_proj._title, _proj._epsg]); - } - - var _w = new Ext.Window({ - width: 380, - height: 240, - modal: true, - resizable: false, - plain: true, - layout: 'border', - listeners: - { - show: function (cmp) { - if (featureDownloadArray.length > 1) { - Ext.getCmp("featuredownload_separately_id").show(); - } else { - Ext.getCmp("featuredownload_separately_id").hide(); - } - - }, - hide: function () { - - - } - }, - items: [{ - xtype: 'form', - region: 'center', - items: [ - { - xtype: 'combo', - loadMask: true, - autoScroll: true, - autoShow: true, - id: 'featuredownload_outputformat_id', - fieldLabel: _featuredownload_outputformat, - store: new Ext.data.SimpleStore({ - fields: ['title', 'value'], - data: [ - ["DXF", "DXF"], - ["GML2", "GML2"], - ["GML3", "GML3"], - ["Shapefile", "shape-zip"], - ["JSON", "application/json"], - // ["JSONP", "text/javascript"], - ["KML", "kml"], - ["CSV", "csv"] - ] - }), - displayField: 'title', - valueField: 'value', - emptyText: "Shapefile", - value: "shape-zip", - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - editable: false - }, - { - xtype: 'combo', - loadMask: true, - autoScroll: true, - autoShow: true, - id: 'featuredownload_charset_id', - fieldLabel: _featuredownload_charset, - store: new Ext.data.SimpleStore({ - fields: ['title', 'value'], - data: _config._charsets - }), - displayField: 'title', - valueField: 'value', - emptyText: "UTF-8", - value: "UTF-8", - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - editable: false - }, - { - xtype: 'combo', - loadMask: true, - autoScroll: true, - autoShow: true, - id: 'featuredownload_srs_id', - fieldLabel: _featuredownload_srs, - store: new Ext.data.SimpleStore({ - fields: ['title', 'value'], - data: _projection_systems - }), - displayField: 'title', - valueField: 'value', - emptyText: _config._mapProjections[0]._title, - value: _config._mapProjections[0]._epsg, - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - editable: false - }, - { - xtype: 'checkbox', - checked: false, - id: 'featuredownload_separately_id', - labelStyle: 'width:200px', - fieldLabel: _featuredownload_download_separately - }], - bbar: ['->', { - xtype: 'button', - text: _featuredownload_downloadbtn, - iconCls: 'features_toolbar_download', - handler: function () { - var _outputFormat = Ext.getCmp("featuredownload_outputformat_id").getValue(); - - var _charset = Ext.getCmp("featuredownload_charset_id").getValue(); - - var _srs = Ext.getCmp("featuredownload_srs_id").getValue(); - - var _seperated = Ext.getCmp("featuredownload_separately_id").getValue(); - - if (_seperated) { - Ext.each(featureDownloadArray, function (item) { - if (_outputFormat === 'kml') { - var _url = fn_featureDonwloadCreateFeatureLink(item._layerId, [item._featureId], _outputFormat, _charset, _srs); - fn_downloadoptions(item._layerName + '.kml', _url) - } else { - window.open(fn_featureDonwloadCreateFeatureLink(item._layerId, [item._featureId], _outputFormat, _charset, _srs)); - } - }); - } - else { - var _featureId = []; - - Ext.each(featureDownloadArray, function (item) { - _featureId.push(item._featureId); - }); - - if (_outputFormat === 'kml') { - var _url = fn_featureDonwloadCreateFeatureLink(featureDownloadArray[0]._layerId, _featureId, _outputFormat, _charset, _srs); - fn_downloadoptions(featureDownloadArray[0]._featureId.split('.')[0] + '.kml', _url) - } else if (_outputFormat === 'shape-zip') { - fn_downloadoptions(featureDownloadArray[0]._featureId.split('.')[0] + '.zip', fn_featureDonwloadCreateFeatureLink(featureDownloadArray[0]._layerId, _featureId, _outputFormat, _charset, _srs)); - } else if (_outputFormat === 'GML2' || _outputFormat === 'GML3') { - fn_downloadoptions(featureDownloadArray[0]._featureId.split('.')[0] + '.gml', fn_featureDonwloadCreateFeatureLink(featureDownloadArray[0]._layerId, _featureId, _outputFormat, _charset, _srs)); - } else if (_outputFormat === 'application/json') { - fn_downloadoptions(featureDownloadArray[0]._featureId.split('.')[0] + '.json', fn_featureDonwloadCreateFeatureLink(featureDownloadArray[0]._layerId, _featureId, _outputFormat, _charset, _srs)); - } else if (_outputFormat === 'text/javascript') { - fn_downloadoptions(featureDownloadArray[0]._featureId.split('.')[0] + '.txt', fn_featureDonwloadCreateFeatureLink(featureDownloadArray[0]._layerId, _featureId, _outputFormat, _charset, _srs)); - } else if (_outputFormat === 'csv') { - fn_downloadoptions(featureDownloadArray[0]._featureId.split('.')[0] + '.csv', fn_featureDonwloadCreateFeatureLink(featureDownloadArray[0]._layerId, _featureId, _outputFormat, _charset, _srs)); - } else if (_outputFormat === 'DXF') { - fn_downloadoptions(featureDownloadArray[0]._featureId.split('.')[0] + '.dxf', fn_featureDonwloadCreateFeatureLink(featureDownloadArray[0]._layerId, _featureId, _outputFormat, _charset, _srs)); - } - } - } - }] - }] - }); - - return _w; - -} - -function fn_featureDonwloadCreateFeatureLink(_layerId, _featureId, _outputFormat, _charset, _srs) { - - if (_outputFormat === 'kml') { - - var _layerObject = mapFindLayerById(_layerId)._layerObject; - - var _serviceObject = mapFindLayerById(_layerId)._serviceObject; - - var _format = 'kml'; - - var _content_type = 'application/vnd.google-earth.kml+xml kml'; - - var _charset = ""; - - var _epsg = ""; - - var _bbox = new layerDownloadBBOX(_layerObject); - - var _width = _bbox.getWidth(); - - var _height = _bbox.getHeight(); - - var _newWidth = 800; - - var _ratio = (_height / _width); - - var _newHeight = Math.floor(_newWidth * _ratio); - - var lTIME = ''; - - var lSTYLE = ''; - - if (typeof _layerObject._layer.params['TIME'] !== 'undefined') { - lTIME = _layerObject._layer.params['TIME']; - } - - if (typeof _layerObject._layer.params['STYLES'] !== 'undefined') { - lSTYLE = _layerObject._layer.params['STYLES']; - } - - var _url = Ext.urlAppend(_serviceObject._serviceUrl, "REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&LAYERS=" + _layerObject._layerName + "&FORMAT=" + _format + "&TRANSPARENT=TRUE&SRS=EPSG:4326&BBOX=" + _bbox.toString() + "&WIDTH=" + _newWidth + "&HEIGHT=" + _newHeight - + "&TIME=" + lTIME - + "&STYLE=" + lSTYLE - ); - - if (_charset != "") { - _url = Ext.urlAppend(_url, "FORMAT_OPTIONS=CHARSET:" + _charset); - } - - if (_epsg != "") { - _url = Ext.urlAppend(_url, "SRSNAME=" + _epsg); - } - - _url = Ext.urlAppend(_url, "FEATUREID=" + _featureId.join(',')); - - if (_serviceObject._isSecure) { - _url = _proxy_url + "?proxy=raw&contentype=" + _content_type + "&url=" + _url; - } - - return _url; - - } else { - - var url = mapFindLayerById(_layerId)._serviceObject._serviceUrl; - - var parser = document.createElement('a'); - - parser.href = url; - - var queries = parser.search.replace(/^\?/, '').split('&'); - - var q = []; - - for (i = 0; i < queries.length; i++) { - - var split = queries[i].split('='); - - var key = split[0]; - - var value = split[1]; - - if ((key.toLowerCase() != "service") && (key.toLowerCase() != "version") && (key != null) && (key != "")) { - q.push(key + "=" + value); - } - } - - q.push("FEATUREID=" + _featureId.join(',')); - q.push("OUTPUTFORMAT=" + _outputFormat); - q.push("SRSNAME=" + _srs); - q.push("REQUEST=GETFEATURE"); - q.push("TYPENAMES=" + mapFindLayerById(_layerId)._layerObject._layerName); - q.push("SERVICE=WFS"); - q.push("VERSION=1.1.0"); - - if (_charset != "") { - q.push("FORMAT_OPTIONS=CHARSET:" + _charset); - } - - var _scheme = parser.protocol; - - var _host = parser.host; - - var _path = parser.pathname; - - var _security = ""; - - if (((mapFindLayerById(_layerId)._serviceObject._username) != null) && - ((mapFindLayerById(_layerId)._serviceObject._username) != "") && - ((mapFindLayerById(_layerId)._serviceObject._password) != "") && - ((mapFindLayerById(_layerId)._serviceObject._password) != null)) { - _security = mapFindLayerById(_layerId)._serviceObject._username + ":" + mapFindLayerById(_layerId)._serviceObject._password + "@"; - } - - var host = _scheme + "//" + _security + _host + _path + "?" + q.join('&'); - - // return host; - - _url = _proxy_url + "?proxy=raw&contentype=" + _content_type + "&url=" + host; - - return _url; - - } - -} - - -function fn_createDateAttribute(value, metaData, record, row, col, store, gridView) { - if (value != "") { - value = value.replace('Z', ''); - - //value = Ext.Date.format(value,'d/m/Y'); - - } - - return value; -} - -function fn_featureEditRenderer(value, metaData, record, row, col, store, gridView) { - var _layerId = record.get("_layerId"); - - var _feature = fn_featureObject(record); - - if (mapFindLayerById(_layerId)._layerObject._isEditable) { - return ""; - } - return ""; -} - -function fn_featureShowOnMapRenderer(value, metaData, record, row, col, store, gridView) { - var _feature = fn_featureObject(record); - - return ""; -} - -function fn_featureShowOnMap(_featureId, _layerId, _srsName, _featureUrl, _featureGeomFormat, fn_param) { - if (mapGetFeatureByFid(_layerId, _featureId) != null) { - var _fetaure_Extent = mapGetFeatureByFid(_layerId, _featureId).geometry.getBounds(); - - map.zoomToExtent(_fetaure_Extent); - } - else { - - switch (_featureGeomFormat) { - case "gml": - var p = new fn_get(); - - p._async = false; - - p._url = fn_surl(_featureUrl, mapFindLayerById(_layerId)._serviceObject._username, mapFindLayerById(_layerId)._serviceObject._password, "getfeatures&method=get"); - - p._timeout = 5000; - - var url = p._url; - - var _xy = mapFindLayerById(_layerId)._layerObject._xy; - - if (url.indexOf("GETFEATUREINFO") >= 0) { - _xy = true; - } - - p._url += '&srsName=' + mapGetCurrentProjection(); - - p._success = function (_response, _opts) { - - // var gmlReader = new OpenLayers.Format.GML({ - // extractAttributes: true, - // internalProjection: new OpenLayers.Projection(mapGetCurrentProjection()), - // externalProjection: new OpenLayers.Projection(mapFindLayerById(_layerId)._layerObject._nativeSRS), - // xy: _xy - // }); - - var gmlReader = new OpenLayers.Format.GML(); - - var features = gmlReader.read(_response.responseText); - - setTimeout(function () { - map.zoomToExtent(features[0].geometry.getBounds()); - }, 500); - }; - - p.get(); - break; - - case "esriJSON": - - var feature = { - _featureId: _featureId, - _layerId: _layerId, - _srsName: _srsName, - _featureUrl: _featureUrl, - _featureGeomFormat: _featureGeomFormat, - _featureAttributes: "" - }; - - arcgis93resFetchESRIJSON(feature, "showonmap"); - - break; - - } - } -} - -function fn_featureHighlightRenderer(value, metaData, record, row, col, store, gridView) { - var _feature = fn_featureObject(record); - - return ""; -} - -function fn_featureIsHiglighted(_featureId, _layerId) { - if (mapGetFeatureByFid(map_highlightLayer.id, _featureId)) { - return true; - } - else { - return false; - } -} - -function fn_featureUnHiglighted(_featureId, _layerId) { - if (mapGetFeatureByFid(map_highlightLayer.id, _featureId)) { - map_highlightLayer.removeFeatures([mapGetFeatureByFid(map_highlightLayer.id, _featureId)]); - - } -} - -function fn_toggleHightlightFromAllResultsGrids(_featureId, _layerId, _gridId) { - Ext.each(fn_grid_results_ids_array, function (item) { - if (item != _gridId) { - Ext.getCmp(_gridId).getStore().each(function (record) { - - var _r = Ext.getCmp(item).getStore().findRecord('_featureId', record.get("_featureId")); - - if (mapGetFeatureByFid(map_highlightLayer.id, record.get("_featureId"))) { - if (_r) { - Ext.getCmp(item).getSelectionModel().select(_r, true, true); - } - } - else { - if (_r) { - Ext.getCmp(item).getSelectionModel().deselect(_r, true); - } - } - - }); - } - }); -} - - -function fn_featureHighlight(_featureId, _layerId, _srsName, _featureUrl, _featureGeomFormat, fn_param) { - if (mapGetFeatureByFid(map_highlightLayer.id, _featureId) == null) { - if (mapGetFeatureByFid(_layerId, _featureId)) { - var _cloneFeature = mapGetFeatureByFid(_layerId, _featureId).clone(); - - _cloneFeature.fid = _featureId; - - _cloneFeature.attributes = mapGetFeatureByFid(_layerId, _featureId).attributes; - - map_highlightLayer.addFeatures(_cloneFeature); - } - else { - - switch (_featureGeomFormat) { - - case "gml": - var p = new fn_get(); - - p._async = false; - - p._url = fn_surl(_featureUrl, mapFindLayerById(_layerId)._serviceObject._username, mapFindLayerById(_layerId)._serviceObject._password, "getfeatures&method=get"); - - p._timeout = 5000; - - var url = p._url; - - var _xy = mapFindLayerById(_layerId)._layerObject._xy; - - if (url.indexOf("GETFEATUREINFO") >= 0) { - _xy = true; - } - - p._url += '&srsName=' + mapGetCurrentProjection(); - - p._success = function (_response, _opts) { - - // var gmlReader = new OpenLayers.Format.GML({ - // extractAttributes: true, - // internalProjection: new OpenLayers.Projection(mapGetCurrentProjection()), - // externalProjection: new OpenLayers.Projection(mapFindLayerById(_layerId)._layerObject._nativeSRS), - // xy: _xy - // }); - - var gmlReader = new OpenLayers.Format.GML(); - - var features = gmlReader.read(_response.responseText); - - map_highlightLayer.addFeatures(features); - }; - - p.get(); - - break; - - case "esriJSON": - - var feature = { - _featureId: _featureId, - _layerId: _layerId, - _srsName: _srsName, - _featureUrl: _featureUrl, - _featureGeomFormat: _featureGeomFormat, - _featureAttributes: "" - }; - - arcgis93resFetchESRIJSON(feature, "highlight"); - - break; - - } - } - - if (fn_param != "") { - fn_param(_featureId, _layerId, _featureUrl, _featureGeomFormat); - } - } -} - -function fn_featureInfoWindowRenderer(value, metaData, record, row, col, store, gridView) { - var _feature = fn_featureObject(record); - - return ""; -} - -function fn_callFeatureFnFromGrid(_featureId, _layerId, _srsName, _featureUrl, _featureGeomFormat, fn_param) { - - var feature = { - _featureId: _featureId, - _layerId: _layerId, - _srsName: _srsName, - _featureUrl: _featureUrl, - _featureGeomFormat: _featureGeomFormat - }; - - switch (fn_param) { - case "getInfo": - var _infowin = fn_featureInfoWindow(feature); - _infowin.show(); - _infowin.alignTo(Ext.getCmp('maptab_center'), "c", [infowindowoffsetposition, infowindowoffsetposition]); - break; - } -} - -function fn_featureDownloadRenderer(value, metaData, record, row, col, store, gridView) { - var _feature = fn_featureObject(record); - - if (mapFindLayerById(_feature._layerId)._serviceObject._isService) { - return ""; - } - - return ""; -} - -function fn_featureDownload(_featureId, _layerId, _srsName, _featureUrl, _featureGeomFormat) { - featureDownloadArray = []; - - var _feature = { - _featureId: _featureId, - _layerId: _layerId, - _srsName: _srsName, - _featureUrl: _featureUrl, - _featureGeomFormat: _featureGeomFormat - }; - - featureDownloadArray.push(_feature); - - var _w = new fn_featureDonwloadWindow(); - - _w.show(); -} - -function fn_featurehowOnlySelectedOnMap(_feature) { - -} - -function fn_featureAddToSelectedRenderer(value, metaData, record, row, col, store, gridView) { - var _feature = fn_featureObject(record); - - return ""; -} - -function fn_featureAddToSelected(_featureId, _layerId, _featureUrl, _srsName, _featureGeomFormat) { - maptab_west_selection_panel_grid_add_record(_featureId, _layerId, _featureUrl, _srsName, _featureGeomFormat); -} - - -function fn_createAttributePanel(_feature) { - var a = ""; - - if (mapGetFeatureByFid(_feature._layerId, _feature._featureId) != null) { - a = fn_createAttributesPivotGrid(_feature); - - if (_feature._featureGeomFormat == "CUSTOM") { - var _attributesFields = new Array(); - - for (var k in mapGetFeatureByFid(_feature._layerId, _feature._featureId).attributes) { - _attributesFields.push({ - "_attributeName": k.toString(), - "_attributeType": "string", - "_attributeTranslation": null, - "_attributeValue": null, - "_attributeEditor": null, - "_attributeIsSortable": true, - "_attributeIsEditable": true, - "_attributeOrder": 0, - "_attributeIsVisible": true, - "_attributeIsSearchable": true, - "_attributeIsGeometry": false, - "_attributeVisible": true, - "_geometryIsMulti": false, - "_attributeShowOnSummary": false - }); - - } - - var _attributes = fn_createAttributesRecords(mapGetFeatureByFid(_feature._layerId, _feature._featureId).attributes, _attributesFields); - - a.getStore().loadData(_attributes); - - } else { - - var _attributes = fn_createAttributesRecords(mapGetFeatureByFid(_feature._layerId, _feature._featureId).attributes, mapFindLayerById(_feature._layerId)._layerObject._attributesFields); - - a.getStore().loadData(_attributes); - - - ///////// new for edit ///////////////////////////////////////////////////////////////////////////////////////////////// - - var _store = a.getStore(); - - var _dirty = false; - - var editid = Ext.id(); - - var formid = Ext.id(); - - if (mapFindLayerById(_feature._layerId)._layerObject._isEdited) { - - var formitems = []; - - _store.each(function (item) { - - var formitem = null; - - if (postgresql_field_domains.length > 0 && _config_field_domains_database === 'postgres') { - - postgresql_field_domains.forEach(function (domain) { - - if (mapFindLayerById(_feature._layerId)._layerObject._layerName === domain._layer_name && - mapFindLayerById(_feature._layerId)._serviceObject._serviceUrl === domain._service_url && - item.get("_attributeName") === domain._field_name) { - - var domainvalues = Ext.create('Ext.data.Store', { - fields: ['name', 'value'], - data: domain._field_domain - }); - - formitem = Ext.create('Ext.form.ComboBox', { - fieldLabel: item.get("_attributeTranslation"), - name: item.get("_attributeName"), - store: domainvalues, - queryMode: 'local', - displayField: 'name', - valueField: 'value', - value: item.get("_attributeValue"), - editable: false, - listeners: { - change: function () { - _dirty = true; - Ext.getCmp(editid).enable(); - } - } - }); - - if (containsObject(formitem, formitems) === false) { - formitems.push(formitem); - } - } - - }); - - } - - if (sqlite_field_domains.length > 0 && _config_field_domains_database === 'sqlite') { - - sqlite_field_domains.forEach(function (domain) { - - if (mapFindLayerById(_feature._layerId)._layerObject._layerName === domain._layer_name && - mapFindLayerById(_feature._layerId)._serviceObject._serviceUrl === domain._service_url && - item.get("_attributeName") === domain._field_name) { - - var domainvalues = Ext.create('Ext.data.Store', { - fields: ['name', 'value'], - data: domain._field_domain - }); - - formitem = Ext.create('Ext.form.ComboBox', { - fieldLabel: item.get("_attributeTranslation"), - name: item.get("_attributeName"), - store: domainvalues, - queryMode: 'local', - displayField: 'name', - valueField: 'value', - value: item.get("_attributeValue"), - editable: false, - listeners: { - change: function () { - _dirty = true; - Ext.getCmp(editid).enable(); - } - } - }); - - if (containsObject(formitem, formitems) === false) { - formitems.push(formitem); - } - } - - }); - - } - - if (_config_field_domains.length > 0) { - - _config_field_domains.forEach(function (domain) { - - if (mapFindLayerById(_feature._layerId)._layerObject._layerName === domain._layer_name && - mapFindLayerById(_feature._layerId)._serviceObject._serviceUrl === domain._service_url && - item.get("_attributeName") === domain._field_name) { - - var domainvalues = Ext.create('Ext.data.Store', { - fields: ['name', 'value'], - data: domain._field_domain - }); - - formitem = Ext.create('Ext.form.ComboBox', { - fieldLabel: item.get("_attributeTranslation"), - name: item.get("_attributeName"), - store: domainvalues, - queryMode: 'local', - displayField: 'name', - valueField: 'value', - value: item.get("_attributeValue"), - editable: false, - listeners: { - change: function () { - _dirty = true; - Ext.getCmp(editid).enable(); - } - } - }); - - if (containsObject(formitem, formitems) === false) { - formitems.push(formitem); - } else { - formitems.splice(formitems.indexOf(formitem), 1); - formitems.push(formitem); - } - } - - }); - } - - }); - - var sort_order = []; - _store.each(function (item) { - sort_order.push(item.data._attributeName); - var formitem = fn_create_edit_field(mapFindLayerById(_feature._layerId)._layerObject, item, editid, _dirty); - if (containsObject(formitem, formitems) === false) { - formitems.push(formitem); - } - }); - - formitems.sort(function (a, b) { - return sort_order.indexOf(a.name) < sort_order.indexOf(b.name) ? -1 : 1; - }); - - var _editBbar = [ - '->', - { - xtype: 'button', - id: editid, - iconCls: 'features_toolbar_save', - disabled: true, - tooltip: _maptab_edit_windowinfo_save_attributes_button, - handler: function (cmp, e) { - - if (Ext.getCmp(formid).isValid()) { - - var _newAttributes = []; - - _store.each(function (item) { - - formitems.forEach(function (newitem) { - - if (newitem.componentCls == 'x-panel' && Ext.getCmp(newitem.id).name === item.get("_attributeName") && Ext.getCmp(newitem.id).filetoupload !== item.get("_attributeValue")) { - _newAttributes.push({ - _attributeName: Ext.getCmp(newitem.id).name, - _attributeValue: newitem.filetoupload - }); - } - - else if (newitem.componentCls == 'x-panel') { - - } - - else if (Ext.getCmp(newitem.id).name === item.get("_attributeName") && Ext.getCmp(newitem.id).getValue() !== item.get("_attributeValue")) { - - var val_new = null; - - if (item.get("_attributeType") === 'date') { - val_new = moment(Ext.getCmp(newitem.id).getValue()).add(-1, 'day').format("YYYY-MM-DD"); - if (val_new == 'Invalid date') { - val_new = null; - } - } - else if (item.get("_attributeType") === 'dateTime') { - val_new = moment(Ext.getCmp(newitem.id).getValue()).format("YYYY-MM-DD"); - if (val_new == 'Invalid date') { - val_new = null; - } - } - else { - val_new = Ext.getCmp(newitem.id).getValue(); - } - - _newAttributes.push({ - _attributeName: Ext.getCmp(newitem.id).name, - _attributeValue: val_new - }); - } - }); - }); - - maptab_edit_change_attributes(_feature, _newAttributes); - } - } - }, - { - xtype: 'button', - iconCls: 'features_toolbar_cancel', - tooltip: _maptab_edit_windowinfo_cancel_attributes_button, - handler: function (cmp, e) { - Ext.getCmp(this.findParentByType("window").id).destroy(); - } - } - ]; - - a = Ext.create('Ext.form.Panel', { - id: formid, - height: 350, - width: 300, - bodyPadding: 10, - defaultType: 'textfield', - autoScroll: true, - items: formitems, - bbar: _editBbar - }); - } - - ///////// new for edit ///////////////////////////////////////////////////////////////////////////////////////////////// - - - } - - } - else { - a = fn_createAttributesPivotGrid(_feature); - var p = new fn_get(); - p._async = true; - var _servicePort = ""; - - if (typeof mapFindLayerById(_feature._layerId)._serviceObject._servicePort !== "undefined") { - _servicePort = mapFindLayerById(_feature._layerId)._serviceObject._servicePort; - } - - p._data = [{ - _layerId: _feature._layerId, - _serviceType: mapFindLayerById(_feature._layerId)._serviceObject._serviceType, - _serviceName: mapFindLayerById(_feature._layerId)._serviceObject._serviceName, - _servicePort: _servicePort, - _username: mapFindLayerById(_feature._layerId)._serviceObject._username, - _serviceUrl: mapFindLayerById(_feature._layerId)._serviceObject._serviceUrl, - _password: mapFindLayerById(_feature._layerId)._serviceObject._password, - _layerName: mapFindLayerById(_feature._layerId)._layerObject._layerName, - _version: mapFindLayerById(_feature._layerId)._serviceObject._version, - _isService: mapFindLayerById(_feature._layerId)._serviceObject._isService, - _featureType: mapFindLayerById(_feature._layerId)._layerObject._featureType, - _cqlFilter: mapFindLayerById(_feature._layerId)._layerObject._cqlFilter, - _featureInfoFormat: mapFindLayerById(_feature._layerId)._serviceObject._featureInfoFormat, - _featureUrl: _feature._featureUrl, - _request: "getAttributes" - }] - - p._timeout = 5000; - if (["815a434a567cddcef4f19b6e1fbb82acb0b6e81c9f2de090be0e0b612b827817", "815a434a567cddcef4f19b6e1fbb82ac0cf39c00301f606f538c63abf898f29b", - "815a434a567cddcef4f19b6e1fbb82aca2bf4f1238d6f458d21a93572fe8f72e", - "815a434a567cddcef4f19b6e1fbb82ac229ba27c135415c502e344d80217a33b", - "815a434a567cddcef4f19b6e1fbb82ac5455ddd53ae84b811122b207f135129c"].includes(_feature._layerId)) { - return; - } - /* -if (_feature._layerId === '815a434a567cddcef4f19b6e1fbb82acf41da801728a69b525e253fff951790d') { - return; - }*/ - - p._success = function (_response, _opts) { - var _response = Ext.JSON.decode(_response.responseText)[0]; - var t_attributes = _response._response._attributes[0][0]; - var _attributes = fn_createAttributesRecords(t_attributes, mapFindLayerById(_feature._layerId)._layerObject._attributesFields); - - a.getStore().loadData(_attributes); - }; - - p.get(); - } - - return a; -} - - -function fn_fetchGML(_feature) { - - var _output; - - if (mapGetFeatureByFid(_feature._layerId, _feature._featureId) != null) { - _output = mapGetFeatureByFid(_feature._layerId, _feature._featureId); - } - else { - - switch (_feature._featureGeomFormat) { - - case "gml": - - var p = new fn_get(); - - p._async = false; - - p._url = fn_surl(_feature._featureUrl, mapFindLayerById(_feature._layerId)._serviceObject._username, mapFindLayerById(_feature._layerId)._serviceObject._password, "getfeatures&method=get"); - - p._timeout = 5000; - - var url = p._url; - - var _xy = mapFindLayerById(_feature._layerId)._layerObject._xy; - - if (url.indexOf("GETFEATUREINFO") >= 0) { - _xy = true; - } - - p._url += '&srsName=' + mapGetCurrentProjection(); - - p._success = function (_response, _opts) { - - // var gmlReader = new OpenLayers.Format.GML({ - // extractAttributes: true, - // internalProjection: new OpenLayers.Projection(mapGetCurrentProjection()), - // externalProjection: new OpenLayers.Projection(mapFindLayerById(_feature._layerId)._layerObject._nativeSRS), - // xy: _xy - // }); - - var gmlReader = new OpenLayers.Format.GML(); - - _output = gmlReader.read(_response.responseText)[0]; - - }; - - p.get(); - - break; - - case "esriJSON": - - _output = arcgis93resFetchESRIJSON(_feature, ""); - - break; - - } - - } - - return _output; -} - -function fn_featureCreateMiniMap(_feature, _mapId, _layerId) { - var mini_map = new OpenLayers.Map(_mapId, { controls: [] }); - - mini_map.addControl(new OpenLayers.Control.Navigation()); - - var _map_config_object = new _config_init_map(); - - for (var k = 0; k < _map_config_object._basemapLayers.length; k++) { - mini_map.addLayer(_map_config_object._basemapLayers[k]._layer); - } - - var featurelayer = new OpenLayers.Layer.Vector("featureLayer", { - displayInLayerSwitcher: false, - styleMap: new OpenLayers.StyleMap({ - "default": new OpenLayers.Style({ - pointRadius: 5, - fillColor: "#FFCB50", - fillOpacity: 0.4, - strokeColor: "#FF9428", - strokeWidth: 1, - strokeOpacity: 0.8 - }) - }) - }); - - mini_map.addLayer(featurelayer); - - mini_map.addControl(new OpenLayers.Control.LayerSwitcher()); - - var mini_map_previousMapExtent; - - var mini_map_previousMapProjection = mini_map.getProjectionObject().toString(); - - var mini_map_map_currentMapProjection = mini_map.getProjectionObject().toString(); - - var _f = _feature.clone(); - - if (mapGetProjectionCode(mapGetCurrentProjection()) != mapGetProjectionCode(mini_map_map_currentMapProjection)) { - _f.geometry.transform(new OpenLayers.Projection(mapGetCurrentProjection()), new OpenLayers.Projection(mapGetProjectionCode(mini_map.getProjectionObject().toString()))); - } - - mini_map.events.on({ - "changebaselayer": function (evtObj) { - mini_map_map_currentMapProjection = mini_map.getProjectionObject().toString(); - - if (mapGetProjectionCode(mini_map_previousMapProjection) != mapGetProjectionCode(mini_map_map_currentMapProjection)) { - _f.geometry.transform(new OpenLayers.Projection(mini_map_previousMapProjection), new OpenLayers.Projection(mapGetProjectionCode(mini_map_map_currentMapProjection))); - } - - featurelayer.refresh(); - - mini_map.zoomIn(); - - mini_map.zoomOut(); - - mini_map_previousMapProjection = mini_map.getProjectionObject().toString(); - - mini_map.zoomToExtent(featurelayer.getDataExtent()); - - } - }); - - - featurelayer.addFeatures(_f); - - setTimeout(function () { - mini_map.zoomToExtent(_f.geometry.getBounds()); - - if (mini_map.getZoom() > 20) { - mini_map.zoomTo(18); - } - - }, 500); - -} - -function fn_createGeometryPanel(_theFeature, _feature) { - var _g = ""; - - if (_theFeature) { - var _data = []; - - var i = 1; - - var _theFeatureClone = _theFeature.clone(); - - var _theGeometry = _theFeatureClone.geometry; - - if (_theGeometry != null) { - if (mapGetProjectionCode(mapFindLayerById(_feature._layerId)._layerObject._nativeSRS) != mapGetCurrentProjection()) { - _theGeometry = _theGeometry.transform(new OpenLayers.Projection(mapGetCurrentProjection()), new OpenLayers.Projection(mapGetProjectionCode(mapFindLayerById(_feature._layerId)._layerObject._nativeSRS))); - } - - - var _config = new _config_init_map(); - - var _numDigitsIndex = fn_objIndexOf(_config._mapProjections, "_epsg", mapGetProjectionCode(mapFindLayerById(_feature._layerId)._layerObject._nativeSRS)); - - var _numDigits; - - if (_numDigitsIndex >= 0) { - _numDigits = _config._mapProjections[_numDigitsIndex]._numDigits; - } - - if (typeof _theGeometry.components == "undefined") { - if (typeof _numDigits !== "undefined") { - var x = _theGeometry.x; - var y = _theGeometry.y; - - _data.push([x.toFixed(_numDigits), y.toFixed(_numDigits), 0]); - - } else { - _data.push([_theGeometry.x, _theGeometry.y, 0]); - } - } - else { - Ext.each(_theGeometry.components, function (item) { - var _vertices = item.getVertices(); - - for (var a = 0; a < _vertices.length; a++) { - - var x = _vertices[a].x; - var y = _vertices[a].y; - - if (typeof _numDigits !== "undefined") { - _data.push([x.toFixed(_numDigits), y.toFixed(_numDigits), i]); - } else { - _data.push([x, y, i]); - } - } - - i++; - - }); - } - - var _s = new Ext.data.SimpleStore({ - fields: ['lon', 'lat', 'componentNum'], - data: _data - }); - - _s.group("componentNum"); - - _g = Ext.create('Ext.grid.Panel', - { - border: true, - columnLines: true, - split: true, - store: _s, - _feature: _feature, - columns: [{ - header: _feature_geometry_lon, - dataIndex: 'lon', - hidden: false, - sortable: false, - flex: 2, - hideable: false - }, - { - header: _feature_geometry_lat, - dataIndex: 'lat', - flex: 2, - hidden: false, - sortable: false, - hideable: false - }, - { - header: '', - dataIndex: 'componentNum', - hidden: true, - hideable: false - }], - tbar: [ - { - xtype: 'label', - text: _feature_projection_system + ": " + mapGetProjectionCode(mapFindLayerById(_feature._layerId)._layerObject._nativeSRS) - } - ], - features: [{ - ftype: 'grouping', - groupHeaderTpl: [ - '{name:this.formatName}', - { - formatName: function (name) { - return _feature_geometry_component + ":" + name; - } - } - ] - }], - bbar: ['->', { - xtype: 'exporterbutton', - iconCls: 'features_toolbar_download', - text: 'CSV' - }] - }); - } - } - - return _g; -} - -function fn_createDetailsPanel(_feature) { - var d; - - return d; -} - -var init_featureInfoWindow_tabs = new Array(); -var init_featureInfoWindow_bbar = new Array(); -var init_featureInfoWindow_tbar = new Array(); -var init_featureInfoWindow_btns = new Array(); -var featureInfoWindow_isMinimized = false; - -function fn_featureInfoWindow(_feature) { - var infolayertitle = mapFindLayerById(_feature._layerId)._layerObject._layerTitle; - var _w_id = Ext.id(); - var attributes = ""; - var geometry = ""; - var _theFeature = ""; - var _tabsItems = []; - var ly = mapFindLayerById(_feature._layerId); - - if (!_feature._featureUrl.includes('sentinel')) { - _feature._featureUrl = ly._serviceObject._serviceUrl + "?REQUEST=GETFEATURE&SERVICE=WFS&VERSION=2.0.0&OUTPUTFORMAT=GML2&TYPENAME=" + ly._layerObject._layerName + "&FEATUREID=" + _feature._featureId; - - } - - attributes = fn_createAttributePanel(_feature); - _theFeature = fn_fetchGML(_feature); - geometry = fn_createGeometryPanel(_theFeature, _feature); - console.debug('feature info: ', attributes); - - var a = Ext.create('Ext.Panel', - { - title: _maptab_featureInfoWindow_Attributes_Tab_title, - border: false, - id: "attributes_panel_" + _w_id, - layout: 'fit', - items: [ - attributes - ] - }); - if (_feature._layerId === 'da3386bf44588b37a7ff447ae374582f18340009637aa630afaa963a41d3650d') { - _tabsItems.push(a); - } - var mapid = Ext.id(); - var m = ""; - - // MINIMAP tab - /* - if (geometry != "") { - m = Ext.create('Ext.Panel', - { - title: _maptab_featureInfoWindow_Map_Tab_title, - border: false, - id: "minimap_panel_" + _w_id, - _isFirstTime: true, - layout: 'fit', - listeners: { - boxready: function () { - if (this._isFirstTime) { - fn_featureCreateMiniMap(_theFeature, mapid, _feature._layerId); - this._isFirstTime = false; - } - } - }, - items: [{ - xtype: 'panel', - html: "
    " - }] - }); - _tabsItems.push(m); - } - */ - var g = ""; - - // GEOMETRY tab - /* - if (geometry != "") { - g = Ext.create('Ext.Panel', - { - title: _maptab_featureInfoWindow_Geometry_Tab_title, - border: false, - id: "geometry_panel_" + _w_id, - layout: 'fit', - items: [ - geometry - ] - }); - - _tabsItems.push(g); - } - */ - - var details = fn_createDetailsPanel(_feature); - var d = Ext.create('Ext.Panel', - { - title: _maptab_featureInfoWindow_Details_Tab_title, - border: false, - layout: 'fit', - items: [ - details - ] - }); - - - var _tabs = { - xtype: 'tabpanel', - region: 'center', - layout: 'fit', - _feature: _feature, - border: false, - items: _tabsItems - }; - - - var i = new Ext.Window({ - width: 440, - height: 405, - id: _w_id, - title: _maptab_featureInfoWindow_title + ': ' + infolayertitle, - plain: true, - bbar: init_featureInfoWindow_bbar, - tbar: init_featureInfoWindow_tbar, - _feature: _feature, - shim: true, - layout: 'border', - closeAction: 'destroy', - minimizable: true, - constrain: true, - resizable: { - listeners: { - resize: function () { - Ext.getCmp('maptab_mapPanel').getEl().unmask(); - }, - beforeresize: function () { - Ext.getCmp('maptab_mapPanel').getEl().mask().dom.style.zIndex = Ext.getCmp(_w_id).getEl().dom.style.zIndex; - } - } - }, - listeners: { - destroy: function () { - Ext.getCmp('maptab_mapPanel').getEl().unmask(); - }, - show: function (window, eOpts) { - window.tools.restore.hide(); - Ext.getCmp('maptab_mapPanel').getEl().unmask(); - }, - "minimize": function (window, opts) { - window.tools.restore.show(); - window.tools.minimize.hide(); - window.collapse(); - Ext.getCmp('maptab_mapPanel').getEl().unmask(); - }, - render: function (w) { - Ext.each(init_featureInfoWindow_tabs, function (item) { - if (item) { - var _t = item(w); - - if ((_t != null) && (_t != "")) { - - w.items.items[0].items.items[0].add(_t); - } - } - }); - } - }, - tools: [{ - type: 'restore', - handler: function (evt, toolEl, owner, tool) { - var window = owner.up('window'); - window.tools.restore.hide(); - window.tools.minimize.show(); - window.expand('', false); - Ext.getCmp('maptab_mapPanel').getEl().unmask(); - } - }], - items: [{ - xtype: 'panel', - region: 'center', - layout: 'border', - items: [_tabs] - }] - }); - - return i; -} - -function fn_createPhotoAttribute(value, metaData, record, row, col, store, gridView) { - if (value != "") { - if (value != null) { - if (value.indexOf("http") >= 0) { - value = ""; - } else { - value = ""; - } - } - } - - return value; -} - -function fn_createMultiPhotoAttribute(value, metaData, record, row, col, store, gridView) { - if (value != "") { - if ((value != null) && (value != "(Null)")) { - var valueArr = value.replaceAll('%7C', '|').split('|'); - - value = ""; - - for (var i = 0; i < valueArr.length; i++) { - if (valueArr[i].indexOf("http") >= 0) { - value += "
    "; - } else { - value += "
    "; - } - } - } - } - - return value; -} - -function fn_createSensor(value, metaData, record, row, col, store, gridView) { - if (value != "") { - if (value != null) { - value = 'value'; - } - } - - return value; -} - -function fn_link_to_tab(value, metaData, record, row, col, store, gridView) { - return value + ' Προβολή'; -} - -function goToSensorTab(value) { - Ext.WindowMgr.each( - function (win) { - if (win.isVisible()) { - win.close(); - } - } - ); -} - -function fn_createLinkAttribute(value, metaData, record, row, col, store, gridView) { - if (value != "") { - - if (value != null) { - var valueArr = value.split(', '); - - value = ""; - - for (var i = 0; i < valueArr.length; i++) { - value += "" + valueArr[i] + ""; - } - } - } - - return value; -} - -function fn_createDownloadDXF(value, metaData, record, row, col, store, gridView) { - if (value != "") { - - if (value != null) { - var valueArr = value.split('|'); - - value = ""; - - for (var i = 0; i < valueArr.length; i++) { - value += valueArr[i] + "
    ([+] " + _feature_gridicons_qtip_download + ")

    "; - } - } - } - - return value; -} - -function fn_downloadDXF(url) { - var p = new fn_get(); - - p._async = true; - p._url = _proxy_url + "?proxy=raw&contenttype=application/dxf&url=" + url; - p._timeout = 5000; - p._success = function (_response, _opts) { - var data = _response.responseText; - var filename = url.substring(url.lastIndexOf('/') + 1); - var element = document.createElement('a'); - element.setAttribute('href', 'data:application/dxf,' + encodeURIComponent(data)); - element.setAttribute('download', filename); - - element.style.display = 'none'; - document.body.appendChild(element); - - element.click(); - - document.body.removeChild(element); - }; - - p.get(); -} - -function fn_createMailAttribute(value, metaData, record, row, col, store, gridView) { - if (value != "") { - if (value != null) { - var valueArr = value.split(', '); - - value = ""; - - for (var i = 0; i < valueArr.length; i++) { - value += "" + valueArr[i] + ""; - } - } - } - - return value; -} - -function fn_createBreakLinksAttribute(value, metaData, record, row, col, store, gridView) { - if (value != "") { - if ((value != null) && (value != "(Null)")) { - var valueArr = value.split('|'); - - value = ""; - - for (var i = 0; i < valueArr.length; i++) { - value += "" + valueArr[i] + "

    "; - } - } - } - - return value; -} - -function fn_createAddDiagramAttribute(value, metaData, record, row, col, store, gridView) { - if (value != "") { - if ((value != null) && (value != "(Null)")) { - var valueArr = value.split('|'); - - value = ""; - - for (var i = 0; i < valueArr.length; i++) { - value += valueArr[i] + "
    ([+] " + poleodomia_translations[language].add_diag_tomap + ")

    "; - } - } - } - - return value; -} - -function fn_createBreakAttribute(value, metaData, record, row, col, store, gridView) { - if (value != "") { - if ((value != null) && (value != "(Null)")) { - var valueArr = value.split('|'); - value = ""; - - for (var i = 0; i < valueArr.length; i++) { - value += "- " + valueArr[i] + "
    "; - } - } - } - - return value; -} - -function fn_goToFiles(value, metaData, record, row, col, store, gridView) { - var path = ""; - - if (value != "") { - if ((value != null) && (value != "(Null)")) { - path = "Μετάβαση στον φάκελο"; - } - } - - return path; -} - -function goToFilesTab(folder) { - // Ext.getCmp('viewport_center').setActiveTab('viewport_filestab'); - // filestree_store.getRootNode().expand(); - // var record = filestree_store.getNodeById('files/' + folder); - // record.expand(); - // filestree.getSelectionModel().select(record); - - Ext.getCmp('viewport_center').setActiveTab('viewport_filestab'); - filestree_store.load(); - - var record = filestree_store.getNodeById('files'); - record.expand(); - - setTimeout(() => { - var item = filestree_store.getNodeById('files/' + folder.split('/')[0]); - item.expand(); - - setTimeout(() => { - var item = filestree_store.getNodeById('files/' + folder.split('/')[0] + '/' + folder.split('/')[1]); - item.expand(); - - setTimeout(() => { - var item = filestree_store.getNodeById('files/' + folder.split('/')[0] + '/' + folder.split('/')[1] + '/' + folder.split('/')[2]); - item.expand(); - - setTimeout(() => { - var item = filestree_store.getNodeById('files/' + folder.split('/')[0] + '/' + folder.split('/')[1] + '/' + folder.split('/')[2] + '/' + folder.split('/')[3]); - item.expand(); - - setTimeout(() => { - filestree.getSelectionModel().select(item); - }, 500); - - }, 500); - - }, 500); - - }, 500); - - }, 500); - -} - -function fn_goToRestrictFiles(value, metaData, record, row, col, store, gridView) { - var path = ""; - - if (value != "") { - if ((value != null) && (value != "(Null)")) { - path = "Μετάβαση στον φάκελο"; - } - } - - return path; -} - -function goToRestrictFilesTab(folder) { - Ext.getCmp('viewport_center').setActiveTab('viewport_restrictfilestab'); - restrictfiles_filestree_store.getRootNode().expand(); - var record = restrictfiles_filestree_store.getNodeById('files/' + folder); - record.expand(); - restrictfiles_filestree.getSelectionModel().select(record); -} - -function containsObject(obj, list) { - var i; - for (i = 0; i < list.length; i++) { - if (list[i].name === obj.name) { - return true; - } - } - - return false; -} - - -function fn_create_edit_field(layerObject, item, editid, _dirty) { - - var formitem = null; - - var formitemid = Ext.id(); - - var blank = true; - - Ext.each(layerObject._attributesFields, function (fieldproperties) { - if (typeof fieldproperties._attributeBlank !== 'undefined' && fieldproperties._attributeName === item.get("_attributeName")) { - blank = fieldproperties._attributeBlank; - } - }); - - if (item.get("_attributeType") === 'string') { - - var vtxt = item.get("_attributeValue"); - - if (item.get("_attributeValue").startsWith('")[1]; - var fntxt = inittxt.split("<")[0]; - fld.setRawValue(fntxt); - } - } - }, - combofolder - ], - - buttons: [{ - text: 'Upload', - handler: function () { - var form = this.up('form').getForm(); - if (form.isValid()) { - form.submit({ - url: 'upload.php?path=../data/pinakes/', - waitMsg: 'Uploading your file...', - success: function (form, action) { - Ext.Msg.alert('Success', 'Your file "' + action.result.file + '" has been uploaded.'); - Ext.getCmp(formitemid).setRawValue(action.result.file); - Ext.getCmp(formid).filetoupload = action.result.file; - }, - failure: function (form, action) { - Ext.Msg.alert('Failed', action.result ? action.result.message : 'No response'); - } - }); - } - } - }] - }); - - } - - /* - if (layerObject._layerName === "maroussi:mar_ot_pl_geom_moved_clipped" && ['ped_pdf'].includes(item.get("_attributeName"))) { - - var formid = Ext.id(); - formitem = Ext.create('Ext.form.Panel', { - id: formid, - disabled: !item.get("_attributeIsEditable"), - name: item.get("_attributeName"), - title: item.get("_attributeTranslation"), - width: 385, - bodyPadding: 5, - frame: true, - style: { 'margin-top': '10px;' }, - renderTo: Ext.getBody(), - filetoupload: item.get("_attributeValue"), - items: [ - { - xtype: 'filefield', - id: formitemid, - name: 'files[]', - fieldLabel: 'Αρχείαο', - labelWidth: 50, - msgTarget: 'side', - allowBlank: true, - anchor: '100%', - buttonText: 'Επιλέξτε αρχεία...', - listeners: { - change: function (fld, value) { - //var newValue = value.replace(/C:\\fakepath\\/g, ''); - //fld.setRawValue(newValue); - //Ext.getCmp(editid).enable(); - - var upload = fld.fileInputEl.dom; - var files = upload.files; - var names = []; - var names2 = []; - - if (files) { - for (var i = 0; i < files.length; i++) { - names.push(files[i].name); - names2.push({ archivo: files[i].name }) - value = names.join(', '); - } - } - fld.setRawValue(value); - Ext.getCmp(editid).enable(); - - }, - afterrender: function (cmp) { - cmp.fileInputEl.set({ - multiple: 'multiple' - }); - } - } - } - ], - - buttons: [{ - text: 'Μεταφόρτωση', - handler: function () { - var form = this.up('form').getForm(); - if (form.isValid()) { - form.submit({ - url: 'uploads.php?path=../data/pped/', - waitMsg: 'Μεταφόρτωση αρχείων...', - success: function (form, action) { - Ext.Msg.alert('Success', 'Τα αρχεία έχουν μεταφορτωθεί.'); - Ext.getCmp(formitemid).setRawValue(action.result.file.join('|')); - Ext.getCmp(formid).filetoupload = action.result.file.join('|'); - }, - failure: function (form, action) { - Ext.Msg.alert('Failed', action.result ? action.result.message : 'No response'); - } - }); - } - } - }] - }); - - } */ - - return formitem; -} diff --git a/public/js/trash/maptab/lib/layersFunctions.js b/public/js/trash/maptab/lib/layersFunctions.js deleted file mode 100644 index 3c15e1e..0000000 --- a/public/js/trash/maptab/lib/layersFunctions.js +++ /dev/null @@ -1,127 +0,0 @@ -Ext.define('serviceLayersStoreModel', { - extend: 'Ext.data.Model', - fields: [ - {name: '_layerId', type: 'string'}, - {name: '_layerName', type: 'string'}, - {name: '_layerTitle', type: 'string'}, - {name: '_layerAbstract', type:'string'}, - {name: '_layerLegend', type: 'string'}, - {name: '_loadedStatus', type: 'int'}, - {name: '_supportedEPSG', type: 'string'}, - {name: '_layerObject', type: 'object'}, - {name: '_serviceObject', type: 'object'} - ] - }); - -function fn_storeColumnsServiceLayers() -{ - var obj={ - store:Ext.create('Ext.data.Store', { - model:'serviceLayersStoreModel', - data:[] - }), - columns:[ - { - dataIndex:'_layerId', - hidden:true, - hideable: false - }, - { - dataIndex:'_layerLegend', - sortable: true, - width:35, - maxWidth:35, - minWidth:35, - hideable: false, - renderer:fn_gridLayerLegend - }, - { - header:_maptab_services_manager_storecolumns_column_layer_name, - dataIndex:'_layerName', - sortable: true, - width:200 - }, - { - header:_maptab_services_manager_storecolumns_column_layer_title, - dataIndex:'_layerTitle', - sortable: true, - width:200 - }, - { - dataIndex:'_loadedStatus', - sortable: true, - width:35, - maxWidth:35, - minWidth:35, - hidden:false, - renderer:fn_loadedStatus - }, - { - dataIndex:'_layerObject', - hidden:true, - hideable: false - }, - { - dataIndex:'_serviceObject', - hidden:true, - hideable: false - } - ] - }; - - return obj; -} - -function fn_gridLayerLegend(value, metaData, record, row, col, store, gridView) -{ - - if (value.length>0) - return "\">"; - else - return ""; -} - -function fn_loadedStatus(value, metaData, record, row, col, store, gridView) -{ - var output=""; - - var status=mapLayerIsLoaded(record.get("_layerObject")._layerId); - - if (status<1) - { - status=record.get("_layerObject")._loadedStatus; - } - - switch(status) - { - case 1: - output=""; - break; - - case 2: - output=""; - break; - } - - - return output; -} - -function fn_loadStart(_layerId) -{ - var _node=maptab_west_layer_tree_panel_tree_json_store.getRootNode().findChild("id", _layerId, true); - - _node.set("icon",host+"images/loading.gif"); - - mapFindLayerById(_layerId)._layerObject._isLoaded=false; -} - -function fn_loadEnd(_layerId) -{ - var _node=maptab_west_layer_tree_panel_tree_json_store.getRootNode().findChild("id", _layerId, true); - - _node.set("icon",mapFindLayerById(_layerId)._layerObject._layerLegend); - - mapFindLayerById(_layerId)._layerObject._isLoaded=true; -} - diff --git a/public/js/trash/maptab/lib/servicesFunctions.js b/public/js/trash/maptab/lib/servicesFunctions.js deleted file mode 100644 index 974f9ef..0000000 --- a/public/js/trash/maptab/lib/servicesFunctions.js +++ /dev/null @@ -1,65 +0,0 @@ -Ext.define('serviceStoreModel', { - extend: 'Ext.data.Model', - fields: [ - {name: '_isSecure', type: 'string'}, - {name: '_serviceTitle', type: 'string'}, - {name: '_serviceUrl', type: 'string'}, - {name: '_serviceAbstract', type: 'string'}, - {name: '_version', type: 'string'}, - {name: '_serviceObject', type: 'object'} - ] -}); - -function fn_storeColumnsService() -{ - var obj={ - store:Ext.create('Ext.data.Store', { - model:'serviceStoreModel', - data:[] - }), - columns:[ - { - dataIndex:'_isSecure', - sortable: true, - width:40, - hideable: false, - renderer:fn_isSecure - }, - { - header:_maptab_services_manager_storecolumns_column_service_title, - dataIndex:'_serviceTitle', - sortable: true, - width:200 - }, - { - header:_maptab_services_manager_storecolumns_column_service_url, - dataIndex:'_serviceUrl', - sortable: true, - width:200 - }, - { - header:_maptab_services_manager_storecolumns_column_service_version, - dataIndex:'_version', - sortable: true, - width:60 - }, - { - dataIndex:'_serviceObject', - hidden:true, - hideable: false - } - ] - }; - - return obj; -} - -function fn_isSecure(value, metaData, record, row, col, store, gridView) -{ - - if (value=="true") - return ""; - else - return ""; -} - diff --git a/public/js/trash/maptab/map.js b/public/js/trash/maptab/map.js deleted file mode 100644 index 1ae78ca..0000000 --- a/public/js/trash/maptab/map.js +++ /dev/null @@ -1,801 +0,0 @@ -var map; -var mapL; -var activeLayer; -var activeLayerList = {}; -var activeLayerIds = []; -var activeGeoJson; -var map_previousProjection; -var map_currentProjection; -var map_controls; -var map_highlightLayer; -var map_basemapProjections = new Array(); -var map_isGeodesic = true; - -var map_contextMenu=Ext.create("Ext.menu.Menu",{ - floating:true, - ignoreParentClick: true, - items:[{ - text:_map_contextMenu_Cancel - }] - -}); - -Proj4js.defs["EPSG:900913"]= "+title= Google Mercator EPSG:900913 +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"; -Proj4js.defs["EPSG:4326"] = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"; -Proj4js.defs["EPSG:2100"] = "+proj=tmerc +lat_0=0 +lon_0=24 +k=0.9996 +x_0=500000 +y_0=0 +ellps=GRS80 +towgs84=-199.87,74.79,246.62,0,0,0,0 +units=m +no_defs"; -Proj4js.defs["EPSG:3857"]="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"; -Proj4js.defs["EPSG:32661"] = "+proj=stere +lat_0=90 +lat_ts=90 +lon_0=0 +k=0.994 +x_0=2000000 +y_0=2000000 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"; -Proj4js.defs["EPSG:4258"] = "+proj=longlat +ellps=GRS80 +no_defs"; -Proj4js.defs["EPSG:32717"] = "+proj=utm +zone=17 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs"; -Proj4js.defs["EPSG:3035"] = "+proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs"; - - -function mapCheckLayerSupportedProjection() -{ - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=overlayers.length-1;i>=0;i--) - { - var layer=overlayers[i]; - - if (typeof layer._layerObject!=="undefined") { - if ((!layer._serviceObject._isVector) &&(layer._serviceObject._isService)) - { - if (layer._layerObject._supportedEPSG!=null) - { - var _supportedEPSG=layer._layerObject._supportedEPSG; - - if (_supportedEPSG.indexOf(mapGetCurrentProjection())<0) { - maptab_west_layer_get_node_from_id(layer._layerObject._layerId).set('cls', 'disabled'); - } else { - maptab_west_layer_get_node_from_id(layer._layerObject._layerId).set('cls', ''); - } - } - } - } - } -} - - -function mapChangeBaseLayer(a,b) -{ - if (typeof map.baseLayer._restrictedExtent!=="undefined") { - map.setOptions({restrictedExtent:map.baseLayer._restrictedExtent}); - } else { - map.setOptions({restrictedExtent:null}); - } - - if (typeof map.baseLayer.isGeodesic!=="undefined") { - map_isGeodesic = map.baseLayer.isGeodesic; - } - - if (a!=b) { - for(var i=0;i=0;i--) { - var _layer=overlayers[i]; - - if (_layer._serviceObject._serviceType=="WMS") - { - mapL.addLayer(_layer._layer._serviceObject._serviceUrl); - _layer.projection = new OpenLayers.Projection(map_currentProjection); - } - } - - map.updateSize(); - } - - map.zoomOut(); - map.zoomIn(); -} - -function mapRedrawNonVector() -{ - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=overlayers.length-1;i>=0;i--) - { - var layer=overlayers[i]; - - if(!layer._layerObject._isVector) { - layer.redraw(); - } - } -} - -function mapSetVisibilityBaseOnScales() -{ - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=overlayers.length-1;i>=0;i--) - { - var layer=overlayers[i]; - - if ((typeof layer._layerObject._scales!=="undefined") && (layer._layerObject._visibility===true) && (layer._layerObject._scales!==null)) - { - layer.setVisibility(false); - - for(var l=0;l=_min) && (_currentMapScale<_max)) - { - layer.setVisibility(true); - - break; - } - } - } - } - } -} - - -function mapSetCenter(lon,lat,zoom) -{ - map.setCenter(new OpenLayers.LonLat(Number(lon),Number(lat)),zoom); -} - -function mapGetZoom() -{ - return map.getZoom(); -} - -function mapGetCenter() -{ - var _mc=map.getCenter(); - - if (mapGetCurrentProjection()!=mapGetCurrentDisplayProjection()) { - _mc.transform(new OpenLayers.Projection(mapGetCurrentProjection()), new OpenLayers.Projection(mapGetCurrentDisplayProjection())); - } - var _mz=map.getZoom(); - var _c={ - lon:_mc.lon, - lat:_mc.lat, - zoom:_mz - } - - return _c -} - -function mapSetDisplayProjection(_epsg) -{ - map.setOptions({displayProjection:new OpenLayers.Projection(_epsg)}); -} - -function mapBeforeAddLayer(_serviceObject,_layerObject) -{ - if (installing) { - config_update_addLayer(_layerObject,_serviceObject); - } -} - - -function mapAddLayer(_serviceObject,_layerObject) -{ - var _node=maptab_west_layer_tree_panel_tree_json_store.getNodeById('maptab_west_layer_tree_panel_tabs_layers_layers_node'); - - if(_layerObject._groupId!="") - { - _node=maptab_west_layer_tree_panel_tree_json_store.getRootNode().findChild("_groupId",_layerObject._groupId,true); - } - - if (_node==null) { - _node=maptab_west_layer_tree_panel_tree_json_store.getNodeById('maptab_west_layer_tree_panel_tabs_layers_layers_node'); - } - - if (!mapFindLayerById(_layerObject._layerId)) { - var _layerNode=maptab_west_layer_add_layer(_layerObject._layer,_node); - - mapOnLayerLoadStart(_layerObject._layer,fn_loadStart); - mapOnLayerLoadEnd(_layerObject._layer,fn_loadEnd); - - map.addLayer(_layerObject._layer); - - if (_layerObject._layerName === 'MSFD_NEW:pt_marine_region') { - let activeLayer = L.tileLayer.betterWms(BASE_URL + '/modules/geoserver/wms.php', { layers: _layerObject._layerName, transparent: true, format: "image/png"}).addTo(mapL); - activeLayer.internalId = _layerObject._layerId; - activeLayerList[_layerObject._layerName] = activeLayer; - } - if (installing) { - config_update_addLayer(_layerObject,_serviceObject); - } - - config_init_layerScales(_layerObject); - maptab_west_layer_reorder_layer(); - } -} - - -function mapRemoveLayerNode(_layer) -{ - if (mapRemoveLayer(_layer)) { - maptab_west_layer_remove_node(_layer._layerObject._layerId); - } -} - -function mapRemoveLayer(_layer) -{ - if (_layer) - { - if ((typeof _layer._layerObject!=="undefined") && (_layer._layerObject!=null)) - { - if (mapFindLayerById(_layer._layerObject._layerId)) - { - map.removeLayer(_layer); - - _layer._layerObject._isLoaded=false; - _layer._layerObject._loadedStatus=0; - - return true; - } - } - } - - return false; -} - - -function mapFindLayerById(_layerId) -{ - return map.getLayer(_layerId); -} - -function mapChangeLayerVisibility(_layerId,_visibility) -{ - mapFindLayerById(_layerId).setVisibility(_visibility); - - if (mapFindLayerById(_layerId)._layerObject) { - mapFindLayerById(_layerId)._layerObject._visibility=_visibility; - } -} - - -function mapGetCountOfOverlayers() -{ - return mapGetlayersBy("isBaseLayer",false).length; -} - -function mapGetlayersBy(_find,_value) -{ - var _array=[]; - var _layers=map.getLayersBy(_find,_value); - - for(var i=0;i<_layers.length;i++) - { - if ((typeof _layers[i]._layerObject!=="undefined") && (typeof _layers[i]._serviceObject!=="undefined")) { - _array.push(_layers[i]); - } - } - - return _array; -} - - -function mapReorderLayer(_layerId,_index) -{ - map.setLayerIndex(mapFindLayerById(_layerId),_index); -} - - -function mapLayerIsLoaded(_layerId) -{ - if(mapFindLayerById(_layerId)) { - return mapFindLayerById(_layerId)._layerObject._loadedStatus; - } - - return false; -} - -function mapListOfBasemapProjections() -{ - var basemaps=map.getLayersBy("isBaseLayer",true); - var _supportedEPSG=new Array(); - - for(var i=0;i= 0; i--) { - var res = resolutions[i]; - - mapScales.push([(OpenLayers.Util.getScaleFromResolution(res, units)-1),"1:"+Math.round(OpenLayers.Util.getScaleFromResolution(res, units))]); - } - - return mapScales; -} - -function mapZoomToScale(scale) -{ - map.zoomToScale(scale); -} - -function mapGetProjectionCode(projection) -{ - var p=new OpenLayers.Projection(projection); - - return p.getCode().toString(); -} - -function mapBBOXToString(_layerObject) -{ - var b=_layerObject._bboxMinX+","+_layerObject._bboxMinY+","+_layerObject._bboxMaxX+","+_layerObject._bboxMaxY; - - return b.toString(); -} - - -function mapOnChangeBaseLayer(fn_param) -{ - map.events.on({ - "changebaselayer":function() - { - - fn_param(map_previousProjection,map_currentProjection); - - map_previousProjection=map.getProjectionObject().toString(); - } - }); -} - -function mapOnZoomEnd(fn_param) -{ - map.events.on({ - "zoomend":function() - { - fn_param(); - } - }); -} - -function mapOnMoveEnd(fn_param) -{ - map.events.on({ - "moveend":function() - { - fn_param(); - } - }); -} - -function mapOnBeforeAddLayer(fn_param) -{ - map.events.on({ - "preaddlayer":fn_param - }); -} - -function mapOnAddLayer(fn_param) -{ - map.events.on({ - "addlayer":fn_param - }); -} - -function mapOnRemoveLayer(fn_param) -{ - map.events.on({ - "removelayer":function(_layer) - { - fn_param(_layer); - } - }); -} - -function mapOnMouseMove(fn_param) -{ - map.events.on({ - "mousemove":fn_param - }); -} - -function mapOnChangeLayer(fn_param) -{ - map.events.on({ - "changelayer":fn_param - }); -} - -function mapOnFeatureOver(fn_param) -{ - map.events.on({ - "featureover":fn_param - }); -} - -function mapOnFeatureOut(fn_param) -{ - map.events.on({ - "featureout":fn_param - }); -} - -function mapOnClick(fn_param) -{ - map.events.on({ - "click":fn_param - }); - -} - -function mapOnLayerLoadStart(layer,fn_param) -{ - layer.events.on({ - loadstart: function() - { - fn_param(layer.id); - } - }); -} - -function mapOnLayerLoadEnd(layer,fn_param) -{ - layer.events.on({ - loadend: function() - { - fn_param(layer.id); - } - }); -} - -function mapUnregisterEvents(event,fn_param) -{ - map.events.unregister(event,map,fn_param); -} - -function mapExtentToLayer(_layerId) -{ - - map.zoomToExtent(mapLayerBounds(mapFindLayerById(_layerId)._layerObject)); -} - - -function mapLayerBounds(_layerObject) -{ - var b=new OpenLayers.Bounds.fromString(mapBBOXToString(_layerObject)); - - if(mapGetCurrentProjection()!="EPSG:4326") - { - b=b.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection(mapGetCurrentProjection())); - } - - if (mapFindLayerById(_layerObject._layerId)!==null) - { - if ((mapFindLayerById(_layerObject._layerId)._serviceObject._isVector) && (!mapFindLayerById(_layerObject._layerId)._serviceObject._isService)) - { - return mapFindLayerById(_layerObject._layerId).getDataExtent(); - } - } - - return b; -} - -function mapCoordinatesFromPixels(xy) -{ - return map.getLonLatFromViewPortPx(xy); -} - -function mapSetOpacity(_layerId,_value) -{ - mapFindLayerById(_layerId).setOpacity(_value); - - mapFindLayerById(_layerId)._layerObject._opacity=_value; -} - -function mapGetOpacity(_layerId) -{ - return mapFindLayerById(_layerId).opacity; -} - -function mapGetSize() -{ - return map.size; -} - -function mapGetExtent() -{ - return map.getExtent(); -} - -function mapAddControl(_control) -{ - map.addControl(_control); -} - -function mapZoomLevels() -{ - return map.getNumZoomLevels(); -} - -function mapGetFeatureByFid(_layerId,_featureId) -{ - try{ - return mapFindLayerById(_layerId).getFeatureByFid(_featureId); - }catch(err){ - return; - } -} - -function mapGetFeatureByAttribute(_layerId,_attributeName,_attributeValue) -{ - try{ - return mapFindLayerById(_layerId).getFeaturesByAttribute(_attributeName,_attributeValue); - }catch(err){ - return; - } -} - -function mapSetBaseMapLayer(_layerId) -{ - map.setBaseLayer(mapFindLayerById(_layerId)); - - map.setLayerIndex(mapFindLayerById(_layerId),0); -} - -function mapLayerIsBaseLayer(_layerId) -{ - return mapFindLayerById(_layerId).isBaseLayer; -} - -function mapGetFeatureById(_layerId,_featureId) -{ - return mapFindLayerById(_layerId).getFeatureById(_featureId); -} - -function mapRemoveControl(_control) -{ - map.removeControl(_control); -} - -function mapAddFeatures(_layerId,_features) -{ - if (_features!="") - { - if(_features.length>0) - { - var p=_features.length; - - for(var i=0;i0) - { - var p=_features.length; - - for(var i=0;i0) - { - var p=_features.length; - - for(var i=0;i": - _comparison = OpenLayers.Filter.Comparison.GREATER_THAN; - break; - - case "<=": - _comparison = OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO; - break; - - case ">=": - _comparison = OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO; - break; - - case "LIKE": - _comparison = OpenLayers.Filter.Comparison.LIKE; - break; - - case "IS NULL": - _comparison = OpenLayers.Filter.Comparison.IS_NULL; - _propertyValue = true; - break; - - case "IS NOT NULL": - _comparison = OpenLayers.Filter.Comparison.IS_NULL; - _propertyValue = false; - break; - } - - var _filter = new OpenLayers.Filter.Comparison( - { - type: _comparison, - property: _propertyName, - value: _propertyValue - }); - - return _filter; -} - -function createLogicalFilter(_operator, _filter) -{ - switch(_operator) - { - case "OR": - _operator = OpenLayers.Filter.Logical.OR; - break; - - default: - _operator = OpenLayers.Filter.Logical.AND; - break; - } - - var _filter = new OpenLayers.Filter.Logical({ - type: _operator, - filters: _filter - }); - - return _filter; -} diff --git a/public/js/trash/maptab/maptab_east_search_panel.js b/public/js/trash/maptab/maptab_east_search_panel.js deleted file mode 100644 index 1442465..0000000 --- a/public/js/trash/maptab/maptab_east_search_panel.js +++ /dev/null @@ -1,1031 +0,0 @@ -var maptab_east_search_panel_last_result_id=""; - -var maptab_east_search_panel_toolbar=[ - { - xtype:'button', - id:'maptab_east_search_panel_toolbar_polygon', - iconCls:'maptab_toolbar_search_polygon', - enableToggle: true, - toggleGroup:'map_control_one_btn_allowed_group', - tooltip:_maptab_toolbar_search_polygon, - toggleHandler:function(item,state){ - - if (state) - { - maptab_toolbar_search_attribute_mode=true; - - Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").getStore().removeAll(); - - var data=[ - ["INTERSECTS",_maptab_search_geometry_criteria_intersects], - ["WITHIN",_maptab_search_geometry_criteria_within] - ]; - - Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").getStore().loadData(data); - Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").setValue("INTERSECTS"); - - }else - { - Ext.getCmp("maptab_toolbar_search_geometry_criteria").getStore().removeAll(); - } - - fn_toggleControl('drawpolygon',state,maptab_toolbar_search_controls); - } - }, - { - xtype:'button', - id:'maptab_east_search_panel_toolbar_line', - iconCls:'maptab_toolbar_search_line', - enableToggle: true, - toggleGroup:'map_control_one_btn_allowed_group', - tooltip:_maptab_toolbar_search_line, - toggleHandler:function(item,state){ - - if (state) - { - maptab_toolbar_search_attribute_mode=true; - - Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").getStore().removeAll(); - - var data=[ - ["INTERSECTS",_maptab_search_geometry_criteria_intersects], - ["CROSSES",_maptab_search_geometry_criteria_crosses]]; - - Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").getStore().loadData(data); - Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").setValue("INTERSECTS"); - } - else - { - Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").getStore().removeAll(); - Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").setValue("INTERSECTS"); - } - - fn_toggleControl('drawline',state,maptab_toolbar_search_controls); - } - }, - { - xtype:'button', - id:'maptab_east_search_panel_toolbar_rectangle', - iconCls:'maptab_toolbar_search_rectangle', - enableToggle: true, - toggleGroup:'map_control_one_btn_allowed_group', - tooltip:_maptab_toolbar_search_rectangle, - toggleHandler:function(item,state){ - - if (state) - { - maptab_toolbar_search_attribute_mode=true; - - Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").getStore().removeAll(); - - var data=[ - ["INTERSECTS",_maptab_search_geometry_criteria_intersects], - ["WITHIN",_maptab_search_geometry_criteria_within] - ]; - - Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").getStore().loadData(data); - Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").setValue("INTERSECTS"); - } else { - Ext.getCmp("maptab_toolbar_search_geometry_criteria").getStore().removeAll(); - } - - fn_toggleControl('drawrectangle',state,maptab_toolbar_search_controls); - } - }, - { - xtype:'button', - id:'maptab_east_search_panel_toolbar_circle', - iconCls:'maptab_toolbar_search_circle', - enableToggle: true, - toggleGroup:'map_control_one_btn_allowed_group', - tooltip:_maptab_toolbar_search_circle, - toggleHandler:function(item,state){ - - if (state) - { - maptab_toolbar_search_attribute_mode=true; - - Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").getStore().removeAll(); - - var data=[ - ["INTERSECTS",_maptab_search_geometry_criteria_intersects], - ["WITHIN",_maptab_search_geometry_criteria_within] - ]; - - Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").getStore().loadData(data); - - Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").setValue("INTERSECTS"); - - }else - { - Ext.getCmp("maptab_toolbar_search_geometry_criteria").getStore().removeAll(); - } - - fn_toggleControl('drawcircle',state,maptab_toolbar_search_controls); - } - }, - { - xtype:'combo', - loadMask:true, - width:120, - id:'maptab_east_search_panel_toolbar_geometry_criteria', - emptyText:_maptab_search_geometry_criteria_intersects, - value:"INTERSECTS", - store: new Ext.data.SimpleStore({ - fields: ['value','name'], - data: [ - ["INTERSECTS",_maptab_search_geometry_criteria_intersects], - ["WITHIN",_maptab_search_geometry_criteria_within] - ] - }), - displayField: 'name', - valueField: 'value', - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - queryMode: 'local', - editable: false - }, - {xtype:'tbseparator'}, - { - xtype:'button', - id:'maptab_east_search_panel_toolbar_clear', - iconCls:'maptab_toolbar_search_clear', - tooltip:_maptab_toolbar_search_clear, - handler:function(){ - fn_toolbar_search_clear_drawings(); - } - }, - { - xtype:'button', - tooltip:_maptab_east_search_panel_criteria_tab_add_attribute_btn, - iconCls:'map_general_add_btn', - handler:function() - { - var c=new fn_east_search_panel_addCriteria(); - - Ext.getCmp('maptab_east_search_panel_criteria_panel').add(c); - - Ext.getCmp('maptab_east_search_panel_criteria_panel').doLayout(); - - } - }, - { - xtype:'combo', - id:'maptab_toolbar_search_andor', - store: new Ext.data.SimpleStore({ - fields: ['name','value'], - data: [ - [_maptab_toolbar_search_and,"AND"], - [_maptab_toolbar_search_or,"OR"] - ] - }), - displayField: 'name', - valueField: 'value', - emptyText:_maptab_toolbar_search_and, - value:'AND', - width:60, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - editable: true - } -] - -var maptab_east_search_panel_choose_LayerCombo=new fn_storeColumnsServiceLayers(); - -var maptab_east_search_panel={ - xtype:'panel', - layout:'border', - title:_maptab_east_search_panel, - hidden: true, - iconCls:'maptab_accordion_icon', - id:'maptab_east_search_panel', - tbar:[{ - xtype:'combobox', - flex:3, - id:'maptab_east_search_panel_choose_LayerCombo', - emptyText: _maptab_east_search_panel_criteria_choose_layer, - store: maptab_east_search_panel_choose_LayerCombo.store, - queryMode: 'local', - displayField: '_layerTitle', - valueField: '_layerId', - forceSelection: true, - triggerAction: 'all', - editable: false, - listeners:{ - beforequery:fn_populate_east_search_panel_choose_LayerCombo, - select:fn_east_search_panel_onselectlayer - } - }], - items:[{ - xtype:'tabpanel', - region:'center', - layout:'fit', - disabled:true, - id:'maptab_east_search_panel_tabs', - border:false, - items:[{ - xtype:'panel', - title:_maptab_east_search_panel_criteria_tab, - id:'maptab_east_search_panel_criteria_tab', - border:false, - layout:'fit', - dockedItems: [ - { - xtype: 'toolbar', - dock: 'top', - items: [ - { - xtype:'checkbox', - boxLabel:'Επιλέξτε ένα αντικείμενο από τα επιλεγμένα', - id:'maptab_east_search_results_selected_obj', - handler:function(e){ - if(e.value){ - Ext.getCmp('maptab_east_search_panel_toolbar_polygon').disable(); - Ext.getCmp('maptab_east_search_panel_toolbar_line').disable(); - Ext.getCmp('maptab_east_search_panel_toolbar_rectangle').disable(); - Ext.getCmp('maptab_east_search_panel_toolbar_circle').disable(); - Ext.getCmp('maptab_east_search_panel_toolbar_polygon').toggle(false); - Ext.getCmp('maptab_east_search_panel_toolbar_line').toggle(false); - Ext.getCmp('maptab_east_search_panel_toolbar_rectangle').toggle(false); - Ext.getCmp('maptab_east_search_panel_toolbar_circle').toggle(false); - fn_toggleControl('drawpolygon',false,maptab_toolbar_search_controls); - fn_toolbar_search_clear_drawings(); - fn_east_search_panel_clear(); - }else{ - Ext.getCmp('maptab_east_search_panel_toolbar_polygon').enable(); - Ext.getCmp('maptab_east_search_panel_toolbar_line').enable(); - Ext.getCmp('maptab_east_search_panel_toolbar_rectangle').enable(); - Ext.getCmp('maptab_east_search_panel_toolbar_circle').enable(); - fn_east_search_panel_clear(); - } - } - } - ] - }, - { - xtype: 'toolbar', - dock: 'top', - items: maptab_east_search_panel_toolbar - } - ], - items:[{ - xtype:'panel', - autoScroll:true, - id:'maptab_east_search_panel_criteria_panel', - bbar:[ - '->', - { - xtype:'button', - iconCls:'map_general_clear_btn', - text:_maptab_east_search_panel_criteria_tab_clear_btn, - handler:fn_east_search_panel_clear - }, - { - xtype:'checkbox', - boxLabel:_maptab_east_search_results_new_tab, - id:'maptab_east_search_results_new_tab' - }, - { - xtype:'button', - iconCls:'maptab_toolbar_search', - text:_maptab_east_search_panel_criteria_tab_search_btn, - handler:function(){ - - var _cql_filter=fn_east_search_panel_createCQLStatement(); - - Ext.getCmp("maptab_east_search_panel_cql_statement_textarea").setValue(_cql_filter); - - var _layer=mapFindLayerById(Ext.getCmp("maptab_east_search_panel_choose_LayerCombo").getValue()); - - fn_east_search_panel_search(_layer, _cql_filter, - maptab_east_search_panel_createCQLStatement_json, - maptab_east_search_panel_createCQLStatement_geometry, - Ext.getCmp("maptab_east_search_results_new_tab").getValue(), - true - ); - - } - }] - }] - },{ - xtype:'panel', - title:_maptab_east_search_panel_cql_statement_tab, - id:'maptab_east_search_panel_cql_statement_tab', - border:false, - layout:'fit', - items:[{ - xtype:'textarea', - id:'maptab_east_search_panel_cql_statement_textarea' - }] - },{ - xtype:'panel', - title:_maptab_east_search_panel_history_tab, - id:'maptab_east_search_panel_history_tab', - border:false, - layout:'fit', - items:[{ - xtype:'grid', - border:false, - id:'maptab_east_search_panel_history_grid', - columnLines:true, - bbar:['->',{ - xtype:'button', - text:_maptab_east_search_panel_history_remove_btn, - iconCls:"map_general_remove_btn", - handler:function() - { - var selected=Ext.getCmp('maptab_east_search_panel_history_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - Ext.getCmp('maptab_east_search_panel_history_grid').getStore().remove(item); - - }); - } - }, - { - xtype:'button', - text:_maptab_east_search_panel_history_reload_btn, - handler:function() - { - var selected=Ext.getCmp('maptab_east_search_panel_history_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - fn_east_search_panel_load_from_history(item); - }); - } - }], - selModel: Ext.create('Ext.selection.CheckboxModel',{mode:'SINGLE',checkOnly:true}), - store: new Ext.data.Store({ - fields: ['_searchNumber','_gridId','_layerTitle','_serviceType','_layerId','_jsonAttributes','_jsonGeometry'], - data: [] - }), - columns:[ - { - dataIndex:'_searchNumber', - sortable: true, - width:35, - maxWidth:35, - minWidth:35, - hideable: false, - hidden:false - }, - { - dataIndex:'_gridId', - sortable: true, - hideable: false, - hidden:true - }, - { - dataIndex:'_layerTitle', - sortable: true, - hideable: false, - hidden:false - }, - { - dataIndex:'_serviceType', - sortable: true, - hideable: false, - hidden:false - }, - { - dataIndex:'_layerId', - sortable: true, - hideable: false, - hidden:true - }, - { - dataIndex:'_jsonAttributes', - sortable: true, - hideable: false, - hidden:true - }, - { - dataIndex:'_jsonGeometry', - sortable: true, - hideable: false, - hidden:true - } - ] - }] - }] - }] -}; - -function fn_populate_east_search_panel_choose_LayerCombo() -{ - maptab_east_search_panel_choose_LayerCombo.store.removeAll(); - - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=overlayers.length-1;i>=0;i--) - { - var layer=overlayers[i]; - - if ((layer._layerObject._isSearchable==true) && (layer._layerObject._visibility==true)) - { - maptab_east_search_panel_choose_LayerCombo.store.add({ - _layerId:layer._layerObject._layerId, - _layerName:layer._layerObject._layerName, - _layerTitle:layer._layerObject._layerTitle+" ("+layer._serviceObject._serviceType+")", - _layerAbstract:layer._layerObject._layerAbstract, - _layerLegend:layer._layerObject._layerLegend, - _loadedStatus:layer._layerObject._loadedStatus, - _layerObject:layer._layerObject, - _serviceObject:layer._serviceObject - }); - } - } -} - -var east_search_panel_criteria_count=0; - -function fn_east_search_panel_addCriteria() -{ - var layerId=Ext.getCmp('maptab_east_search_panel_choose_LayerCombo').getValue(); - - var attributes=mapFindLayerById(layerId)._layerObject._attributesFields; - - var cmbId="attributes_search_combobox_id_"+east_search_panel_criteria_count; - - var valueId="value_search_combobox_id_"+east_search_panel_criteria_count; - - var conditionsId="condition_search_combobox_id_"+east_search_panel_criteria_count; - - var cmb=new fn_createAttributesComboBox(attributes,cmbId); - - var cnd=Ext.create('Ext.form.ComboBox',{ - id:conditionsId, - store: new Ext.data.SimpleStore({ - fields: ['condition','disableValue'], - data: [] - }), - displayField: 'condition', - valueField: 'condition', - region:'west', - width:100, - emptyText:_maptab_east_search_conditions_empty_text, - queryMode: 'local', - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - editable: false, - listeners:{ - select:function(combo,record) - { - var record=record[0]; - - if(record.data.disableValue) - { - Ext.getCmp(valueId).setDisabled(true); - } - else - { - Ext.getCmp(valueId).setDisabled(false); - } - } - } - }); - - cmb.on('select',function(combo,record){ - - var record=record[0]; - - var conditions=fn_createCriteriaComboConditions(record.data._attributeType); - - cnd.store.loadData(conditions); - }); - - var panelId=Ext.id(); - - var c=[{ - xtype:'panel', - border:true, - id:panelId, - panelCount:east_search_panel_criteria_count, - layout:'form', - items:[cmb, - { - xtype:'panel', - layout:'border', - border:false, - height:22, - items:[cnd, - { - xtype:'textfield', - id:valueId, - width:200, - emptyText:_maptab_east_search_value_empty_text, - region:'center' - },{ - xtype:'button', - iconCls:'map_general_remove_btn', - region:'east', - handler:function() - { - Ext.getCmp("maptab_east_search_panel_criteria_panel").remove(Ext.getCmp(panelId)); - } - }] - } - ] - }]; - - east_search_panel_criteria_count++; - - return c; -} - -var maptab_east_search_panel_createCQLStatement_json=new Array(); - -var maptab_east_search_panel_createCQLStatement_geometry=""; - -function fn_east_search_panel_createCQLStatement() -{ - maptab_east_search_panel_createCQLStatement_json=new Array(); - - var q=new Array(); - - var r; - - var _layerId=Ext.getCmp('maptab_east_search_panel_choose_LayerCombo').getValue(); - - for(var i=0;i0){ - q.push(' AND ' + maptab_east_search_panel_createCQLStatement_geometry); - }else { - q.push(maptab_east_search_panel_createCQLStatement_geometry); - } - }else - { - if (maptab_toolbar_search_draw_layer.features.length>0) - { - - var _cqlFilter=fn_toolbar_search_fetch_search_geometry(_layerId,Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").getValue()); - - var _andor=""; - - if (q.length>0) - { - _andor=' AND '; - } - - q.push(_andor+_cqlFilter); - - maptab_east_search_panel_createCQLStatement_geometry = _cqlFilter; - - }else if(Ext.getCmp('maptab_east_search_results_selected_obj').value){ - - var _selected=maptab_west_selection_panel_grid.getSelectionModel().getSelection(); - - var _layer = mapFindLayerById(_layerId); - - var _featureGeometry=_selected[0].data._feature.clone().geometry; - - if (mapGetCurrentProjection()!=mapGetProjectionCode(_layer._layerObject._nativeSRS)) - { - _featureGeometry=_featureGeometry.transform(new OpenLayers.Projection(mapGetCurrentProjection()), new OpenLayers.Projection(_layer._layerObject._nativeSRS)).toString(); - } - - if (_layer._layerObject._xy==false) - { - _featureGeometry=fn_reverseAxis(_featureGeometry); - } - - var _geometryCriteria = Ext.getCmp("maptab_east_search_panel_toolbar_geometry_criteria").getValue(); - - var _cqlFilter=_geometryCriteria+"("+_layer._layerObject._geometryField+","+_featureGeometry+")"; - - var _andor=""; - - if (q.length>0) - { - _andor=' AND '; - } - - q.push(_andor+_cqlFilter); - - maptab_east_search_panel_createCQLStatement_geometry = _cqlFilter; - } - } - - return q.join(' '); -} - - -function fn_east_search_panel_search(_layer, _cql_filter , _cql_filter_json, _cql_filter_geometry , _newTab, _showEmpty) -{ - var _servicePort = ""; - - if (typeof _layer._serviceObject._servicePort!=="undefined") - { - _servicePort = _layer._serviceObject._servicePort; - } - - - if(_cql_filter.split(' ').length >= 2){ - _cql_filter = '(' + _cql_filter.split(' ')[0] + ') ' + _cql_filter.split(' ')[1]; - } - - var _queryObject=[{ - _layerId:_layer._layerObject._layerId, - _serviceType:_layer._serviceObject._serviceType, - _serviceName:_layer._serviceObject._serviceName, - _servicePort:_servicePort, - _username:_layer._serviceObject._username, - _serviceUrl:_layer._serviceObject._serviceUrl, - _password:_layer._serviceObject._password, - _layerName:_layer._layerObject._layerName, - _version:_layer._serviceObject._version, - _isService:_layer._serviceObject._isService, - _featureType:_layer._layerObject._featureType, - _cqlFilter:_cql_filter, - _cqlFilterJSON:_cql_filter_json, - _geometryField:_layer._layerObject._geometryField, - _nativeSRS:_layer._layerObject._nativeSRS, - _geomFilter:_cql_filter_geometry, - _featureInfoFormat:_layer._serviceObject._featureInfoFormat, - _request:"search" - }]; - - var p=new fn_get(); - - p._async=true; - - p._data=_queryObject; - - p._timeout=15000; - - var r; - - if (_newTab) - { - r=fn_east_search_panel_results_grid(_layer._layerObject._layerId, _cql_filter); - - fn_grid_results_ids_array.push(r.id); - - maptab_search_results_count++; - - r.setTitle(mapFindLayerById(_layer._layerObject._layerId)._layerObject._layerTitle + " ("+mapFindLayerById(_layer._layerObject._layerId)._serviceObject._serviceType+")"+" "+maptab_search_results_count); - - Ext.getCmp("maptab_south").expand(); - - Ext.getCmp("").add(r); - - Ext.getCmp("maptab_south_tabpanel").setActiveTab(r); - - if(_showEmpty==false) - { - r.setVisible(false); - } - - } - else - { - if (Ext.getCmp(maptab_east_search_panel_last_result_id)) - { - r=Ext.getCmp(maptab_east_search_panel_last_result_id); - - Ext.getCmp("maptab_south_tabpanel").setActiveTab(r); - } - else - { - r=fn_east_search_panel_results_grid(_layer._layerObject._layerId, _cql_filter); - - fn_grid_results_ids_array.push(r.id); - - maptab_search_results_count++; - - r.setTitle(mapFindLayerById(_layer._layerObject._layerId)._layerObject._layerTitle + " ("+mapFindLayerById(_layer._layerObject._layerId)._serviceObject._serviceType+")"+" "+maptab_search_results_count); - - Ext.getCmp("maptab_south").expand(); - - Ext.getCmp("maptab_south_tabpanel").add(r); - - Ext.getCmp("maptab_south_tabpanel").setActiveTab(r); - } - } - - fn_east_search_panel_add_to_history(); - - var mask=fn_loadingMask(r,_mask_loading_message_default); - - mask.show(); - - p._success=function(_response, _opts) - { - - var _response=Ext.JSON.decode(_response.responseText) - - var _data=new Array(); - - Ext.each(_response,function(item) - { - Ext.each(item._response._attributes,function(record) - { - _data.push(record[0]); - }); - - }); - - r.getStore().loadData(_data); - - var _f=r.getDockedItems('toolbar[dock="top"]')[0].items.items; - - _f[0].setText(mapFindLayerById(_layer._layerObject._layerId)._layerObject._layerTitle + " ("+mapFindLayerById(_layer._layerObject._layerId)._serviceObject._serviceType+")"); - - _f[2].setText(_maptab_east_search_results_count_text+r.getStore().getCount()); - - _f[4].setText(_maptab_east_search_results_selected_count_text+r.getSelectionModel().getSelection().length); - - mask.hide(); - - if(_showEmpty==false) - { - if(r.getStore().getCount()>0) - { - r.setVisible(true); - }else{ - Ext.getCmp("maptab_south_tabpanel").remove(r); - } - } - - mapFindLayerById(_layer._layerObject._layerId).mergeNewParams({'CQL_FILTER': '1=1'}); - if(_queryObject[0]._cqlFilter !== ''){ - mapFindLayerById(_layer._layerObject._layerId).mergeNewParams({'CQL_FILTER':_queryObject[0]._cqlFilter}); - } - }; - - - p._failure=function() - { - mask.hide(); - }; - - p.get(); - - - -} - -function fn_east_search_panel_results_grid(_layerId, _cql_filter) -{ - var _attributesFields=mapFindLayerById(_layerId)._layerObject._attributesFields; - - var maptab_east_search_panel_results_grid_tbar=fn_createFetureGridTopBar(); - - maptab_east_search_panel_results_grid_tbar.unshift( - {xtype:'label'}, - {xtype:'tbseparator'}, - {xtype:'label'}, - {xtype:'tbseparator'}, - {xtype:'label'}); - - var gId=Ext.id(); - - maptab_east_search_panel_last_result_id=gId; - - var g=Ext.create('Ext.grid.Panel', - { - border:false, - columnLines:true, - closable:true, - id:gId, - enableColumnMove:mapFindLayerById(_layerId)._layerObject._attributesReorder, - title:_maptab_east_search_results, - _layerId:_layerId, - plugins: [{ - ptype: 'bufferedrenderer', - trailingBufferZone: 20, - leadingBufferZone: 50 - } - ], - selModel: Ext.create('Ext.selection.CheckboxModel',{mode:'SIMPLE',checkOnly:true}), - store:fn_createAttributesStore(fn_featureColumnModelForGrid(_attributesFields)), - columns:fn_createAttributesColumnModel(fn_featureColumnModelForGrid(_attributesFields)), - tbar:maptab_east_search_panel_results_grid_tbar, - listeners:{ - select:function(row, record, index, eOpts) - { - var _feature=fn_featureObject(record); - - fn_featureHighlight(_feature._featureId,_feature._layerId,_feature._srsName,_feature._featureUrl,_feature._featureGeomFormat,''); - - fn_toggleHightlightFromAllResultsGrids(_feature._featureId,_feature._layerId,g.id); - - var _f=g.getDockedItems('toolbar[dock="top"]')[0].items.items; - - _f[4].setText(_maptab_east_search_results_selected_count_text+g.getSelectionModel().getSelection().length); - - }, - hide:function() - { - mapFindLayerById(_layerId).mergeNewParams({'CQL_FILTER': '1=1'}); - }, - show:function() - { - var _f=g.getDockedItems('toolbar[dock="top"]')[0].items.items; - - _f[4].setText(_maptab_east_search_results_selected_count_text+g.getSelectionModel().getSelection().length); - - mapFindLayerById(_layerId).mergeNewParams({'CQL_FILTER': _cql_filter}); - }, - deselect:function(row, record, index, eOpts) - { - var _feature=fn_featureObject(record); - - fn_featureUnHiglighted(_feature._featureId,_feature._layerId); - - fn_toggleHightlightFromAllResultsGrids(_feature._featureId,_feature._layerId,g.id); - - var _f=g.getDockedItems('toolbar[dock="top"]')[0].items.items; - - _f[4].setText(_maptab_east_search_results_selected_count_text+g.getSelectionModel().getSelection().length); - }, - beforeclose:function(grid, eOpts) - { - Ext.Array.remove(fn_grid_results_ids_array,g.id); - - Ext.Array.clean(fn_grid_results_ids_array); - - grid.store.each(function(item){ - - if(fn_featureIsHiglighted(item.get("_featureId"),item.get("_layerId"))) - { - fn_featureUnHiglighted(item.get("_featureId"),item.get("_layerId")); - - fn_toggleHightlightFromAllResultsGrids(item.get("_featureId"),item.get("_layerId"),g.id); - } - }); - - mapFindLayerById(_layerId).mergeNewParams({'CQL_FILTER': '1=1'}); - }, - viewready:function(grid, eOpts) - { - grid.store.each(function(item){ - - if(fn_featureIsHiglighted(item.get("_featureId"),item.get("_layerId"))) - { - grid.getSelectionModel().select(item,true,true); - } - }); - - var _f=g.getDockedItems('toolbar[dock="top"]')[0].items.items; - - _f[4].setText(_maptab_east_search_results_selected_count_text+g.getSelectionModel().getSelection().length); - - } - } - }); - - return g; -} - -function fn_east_search_panel_onselectlayer() -{ - maptab_east_search_panel_last_result_id=""; - - fn_east_search_panel_clear(); -} - -function fn_east_search_panel_clear() -{ - fn_toolbar_search_clear_drawings(); - - maptab_east_search_panel_createCQLStatement_geometry=""; - - Ext.getCmp("maptab_east_search_panel_tabs").enable(); - - Ext.getCmp("maptab_east_search_panel_criteria_panel").removeAll(); - - Ext.getCmp("maptab_east_search_panel_cql_statement_textarea").setValue(""); - - east_search_panel_criteria_count=0; -} - - - -function fn_east_search_panel_add_to_history() -{ - try - { - var _record=Ext.getCmp("maptab_east_search_panel_history_grid").getStore().findRecord('_searchNumber', maptab_search_results_count); - - if (_record!=null) - { - _record.set('_searchNumber',maptab_search_results_count); - _record.set('_gridId',maptab_east_search_panel_last_result_id); - _record.set('_layerTitle',Ext.getCmp("maptab_east_search_panel_choose_LayerCombo").getRawValue()); - _record.set('_serviceType',mapFindLayerById(Ext.getCmp("maptab_east_search_panel_choose_LayerCombo").getValue())._serviceObject._serviceType); - _record.set('_layerId',Ext.getCmp("maptab_east_search_panel_choose_LayerCombo").getValue()); - _record.set('_jsonAttributes',maptab_east_search_panel_createCQLStatement_json); - _record.set('_jsonGeometry',maptab_east_search_panel_createCQLStatement_geometry); - _record.commit(); - - }else - { - Ext.getCmp("maptab_east_search_panel_history_grid").getStore().add({ - _searchNumber:maptab_search_results_count, - _gridId:maptab_east_search_panel_last_result_id, - _layerTitle:Ext.getCmp("maptab_east_search_panel_choose_LayerCombo").getRawValue(), - _serviceType:mapFindLayerById(Ext.getCmp("maptab_east_search_panel_choose_LayerCombo").getValue())._serviceObject._serviceType, - _layerId:Ext.getCmp("maptab_east_search_panel_choose_LayerCombo").getValue(), - _jsonAttributes:maptab_east_search_panel_createCQLStatement_json, - _jsonGeometry:maptab_east_search_panel_createCQLStatement_geometry - }); - } - }catch(err){} -} - - -function fn_east_search_panel_load_from_history(_record) -{ - fn_east_search_panel_clear(); - - Ext.getCmp("maptab_east_search_panel_tabs").setActiveTab(Ext.getCmp("maptab_east_search_panel_criteria_tab")); - Ext.getCmp("maptab_east_search_panel_choose_LayerCombo").setValue(_record.get("_layerId")); - - var _jsonAttributes=_record.get("_jsonAttributes"); - var index=0; - - Ext.each(_jsonAttributes,function(item){ - - var c=new fn_east_search_panel_addCriteria(); - Ext.getCmp('maptab_east_search_panel_criteria_panel').add(c); - Ext.getCmp('maptab_east_search_panel_criteria_panel').doLayout(); - Ext.getCmp("attributes_search_combobox_id_"+index).setValue(item.attribute); - var record = Ext.getCmp("attributes_search_combobox_id_"+index).findRecord(item.attribute); - var conditions=fn_createCriteriaComboConditions(record.data._attributeType); - Ext.getCmp("condition_search_combobox_id_"+index).getStore().loadData(conditions); - Ext.getCmp("condition_search_combobox_id_"+index).setValue(item.condition); - var value=item.value.replace(/'/g,""); - Ext.getCmp("value_search_combobox_id_"+index).setValue(value); - - index++; - - }); - - maptab_east_search_panel_createCQLStatement_geometry=_record.get("_jsonGeometry"); -} - diff --git a/public/js/trash/maptab/maptab_services_manager.js b/public/js/trash/maptab/maptab_services_manager.js deleted file mode 100644 index 76e52d3..0000000 --- a/public/js/trash/maptab/maptab_services_manager.js +++ /dev/null @@ -1,76 +0,0 @@ -// Ext.define('serviceType', { -// extend: 'Ext.data.Model', -// fields: [ -// {name: 'servicetype', type: 'string'}, -// {name: 'serviceform', type: 'object'} -// ] -// }); -// -// var maptab_services_manager_gridpanel_store=Ext.create('Ext.data.Store', { -// model: 'serviceType', -// data:[] -// }); -// -// var maptab_services_manager= new Ext.Window({ -// width:740, -// height:550, -// minWidth:740, -// minHeight:550, -// constrain:true, -// modal:true, -// shim:true, -// title:_maptab_services_manager, -// resizable:true, -// closeAction:'hide', -// layout:'fit', -// listeners:{ -// show:function(){ -// -// Ext.getCmp('maptab_services_manager_gridpanel_columns_service_type').items.each(function(form){ -// if (form.isVisible()) -// { -// form.hide(); -// form.show(); -// } -// }); -// } -// -// }, -// items:[ -// { -// xtype:'panel', -// layout:'border', -// border:false, -// items: -// [ -// { -// xtype:'gridpanel', -// region:'west', -// id:'maptab_services_manager_gridpanel_service_type', -// width:160, -// listeners:{ -// itemclick:function(dv, record, item, index, e) { -// -// Ext.getCmp('maptab_services_manager_gridpanel_columns_service_type').items.each(function(form){ -// form.hide(); -// }); -// -// record.get('serviceform').show(); -// } -// }, -// store:maptab_services_manager_gridpanel_store, -// columns:[{ -// header:_maptab_services_manager_gridpanel_columns_service_title, dataIndex: "servicetype", sortable: true,width:158 -// }] -// }, -// { -// xtype:'panel', -// region:'center', -// layout:'fit', -// id:'maptab_services_manager_gridpanel_columns_service_type', -// items:[] -// } -// ] -// } -// ] -// }); diff --git a/public/js/trash/maptab/maptab_services_manager/arcgismapservice.js b/public/js/trash/maptab/maptab_services_manager/arcgismapservice.js deleted file mode 100644 index a448511..0000000 --- a/public/js/trash/maptab/maptab_services_manager/arcgismapservice.js +++ /dev/null @@ -1,566 +0,0 @@ -/** - * Created by taskaris on 2017-09-28. - */ - -var arcgismapservice_StoreColumnsService = new fn_storeColumnsService(); -var arcgismapservice_StoreColumnsServiceLayers = new fn_storeColumnsServiceLayers(); - -init_onload_fn.push(wms_init); - -function wms_init() { - maptab_services_manager_gridpanel_store.add({ - servicetype: 'ArcGIS Map Service', - serviceform: arcgismapservice_service_form - }); - Ext.getCmp("maptab_services_manager_gridpanel_columns_service_type").add(arcgismapservice_service_form); -} - -var arcgismapservice_service_form = new Ext.Panel({ - xtype: 'panel', - title: 'Διαχείριση Υπηρεσιών ArcGIS Map Service', - id: 'arcgismapservice_service_form', - layout: 'border', - border: false, - hidden: true, - listeners: { - show: function () { - Ext.getCmp('arcgismapservice_service_form_layers_grid').getView().refresh(); - } - }, - items: [ - { - xtype: 'panel', - region: 'north', - layout: 'form', - border: true, - height: 80, - items: [ - { - xtype: 'textfield', - fieldLabel: _maptab_services_manager_service_address, - id: 'maptab_services_manager_arcgismapservice_service_address', - width: 300 - } - ], - bbar: ['->', - { - xtype: 'checkbox', - id: 'maptab_services_manager_arcgismapservice_service_require_authentication', - boxLabel: _maptab_services_manager_required_authentication - }, - { - xtype: 'button', - iconCls: 'maptab_services_manager_register', - text: _maptab_services_manager_register_service, - handler: function () { - Ext.getCmp('arcgismapservice_service_form_service_grid').setLoading(true); - - if (Ext.getCmp("maptab_services_manager_arcgismapservice_service_require_authentication").getValue()) { - var _w = arcgismapservice_serviceCredentialsWindow(Ext.getCmp('maptab_services_manager_arcgismapservice_service_address').getValue()); - - _w.show(); - } - else { - arcgismapservice_register_service(Ext.getCmp('maptab_services_manager_arcgismapservice_service_address').getValue(), "", ""); - } - - Ext.getCmp('arcgismapservice_service_form_service_grid').setLoading(false); - } - } - ] - }, - { - xtype: 'gridpanel', - region: 'center', - border: true, - minHeight: 180, - columnLines: true, - split: true, - id: 'arcgismapservice_service_form_service_grid', - store: arcgismapservice_StoreColumnsService.store, - columns: arcgismapservice_StoreColumnsService.columns, - selModel: Ext.create('Ext.selection.CheckboxModel'), - plugins: [{ - ptype: 'rowexpander', - pluginId: 'rowexpanderWMSService', - rowBodyTpl: [ - '
    ' + _maptab_services_manager_storecolumns_column_service_abstract + ':
    {_serviceAbstract}
    ' - ] - }], - bbar: ['->', - { - xtype: 'button', - iconCls: 'maptab_services_manager_unregister', - text: _maptab_services_manager_unregister_service, - handler: function () { - var selected = Ext.getCmp('arcgismapservice_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.each(selected, function (item) { - var overlayers = mapGetlayersBy("isBaseLayer", false); - - for (var i = (overlayers.length - 1); i >= 0; i--) { - if (overlayers[i]._serviceObject._serviceUrl == item.get("_serviceUrl")) { - if (typeof overlayers[i]._layerObject !== "undefined") { - // maptab_west_layer_remove_node(maptab_west_layer_get_node_from_id(overlayers[i]._layerObject._layerId)); - } - } - } - - Ext.getCmp('arcgismapservice_service_form_service_grid').getStore().remove(item); - }); - - Ext.getCmp('arcgismapservice_service_form_layers_grid').getStore().removeAll(); - } - }, - { - xtype: 'button', - text: _maptab_services_manager_show_layers, - handler: function () { - - var selected = Ext.getCmp('arcgismapservice_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.getCmp('arcgismapservice_service_form_layers_grid').setLoading(true); - - Ext.each(selected, function (item) { - arcgismapservice_fetch_layers(item.get("_serviceObject")); - - }); - - Ext.getCmp('arcgismapservice_service_form_layers_grid').setLoading(false); - } - } - ] - }, - { - xtype: 'gridpanel', - region: 'south', - border: true, - height: 200, - split: true, - columnLines: true, - viewConfig: {preserveScrollOnRefresh: true}, - id: 'arcgismapservice_service_form_layers_grid', - store: arcgismapservice_StoreColumnsServiceLayers.store, - columns: arcgismapservice_StoreColumnsServiceLayers.columns, - plugins: [{ - ptype: 'rowexpander', - pluginId: 'rowexpanderWMSLayer', - rowBodyTpl: [ - '
    ' + _maptab_services_manager_storecolumns_column_service_abstract + ':
    {_layerAbstract}
    ' - ] - }, { - ptype: 'bufferedrenderer', - trailingBufferZone: 20, - leadingBufferZone: 20 - }], - selModel: Ext.create('Ext.selection.CheckboxModel'), - bbar: ['->', - { - xtype: 'button', - iconCls: 'maptab_services_manager_unregister', - text: _maptab_services_manager_unregister_layer, - handler: function () { - - var selected = Ext.getCmp('arcgismapservice_service_form_layers_grid').getSelectionModel().getSelection(); - - Ext.each(selected, function (item) { - - var _message = _maptab_services_manager_unregister_layer_message; - - _message = _message.replace("{_layerTitle}", item.get("_layerTitle")); - - _message = _message.replace("{_layerName}", item.get("_layerName")); - - var mask = fn_loadingMask(maptab_services_manager, _message); - - mask.show(); - - maptab_west_layer_remove_node(maptab_west_layer_get_node_from_id(item.get("_layerObject")._layerId)); - - Ext.getCmp('arcgismapservice_service_form_layers_grid').getView().refresh(); - - if (mapFindLayerById(item.get("_layerId"))) - { - var _layer2remove = mapFindLayerById(item.get("_layerId")); - map.removeLayer(_layer2remove); - } - - mask.hide(); - - }); - - } - }, - { - xtype: 'button', - iconCls: 'map_general_setting_btn', - text: _maptab_services_manager_settings_layer, - hidden: true, - handler: function () { - // wms_layer_settings_window.show(); - } - }, - { - xtype: 'button', - iconCls: 'maptab_services_manager_register', - text: _maptab_services_manager_register_layer, - handler: function () { - - var selected = Ext.getCmp('arcgismapservice_service_form_layers_grid').getSelectionModel().getSelection(); - - Ext.each(selected, function (item) { - - // var arcgis_layer = new OpenLayers.Layer.ArcGIS93Rest( - // item.data._serviceObject._serviceId + '//' + item.data._layerId, - // item.data._serviceObject._serviceUrl + "/export", - // { - // layers: "show:" + item.data._layerId, - // transparent: true, format: 'image/png' - // }, - // { - // projection: new OpenLayers.Projection("EPSG:3857"), - // isBaseLayer: false - // } - // ); - // - // map.addLayer(arcgis_layer); - - - var _message = _maptab_services_manager_loading_layer_message; - - _message = _message.replace("{_layerTitle}", item.get("_layerTitle")); - - _message = _message.replace("{_layerName}", item.get("_layerName")); - - var mask = fn_loadingMask(maptab_services_manager, _message); - - mask.show(); - - arcgismapservice_register_layer(item.get("_layerObject")); - - Ext.getCmp('arcgismapservice_service_form_layers_grid').getView().refresh(); - - mask.hide(); - }); - } - } - ] - } - ] -}); - - -function arcgismapservice_serviceCredentialsWindow(_serviceUrl) { - var _w = new Ext.Window({ - width: 250, - height: 120, - modal: true, - shim: true, - title: _maptab_services_manager_service_credentials, - resizable: true, - closeAction: 'destroy', - layout: 'fit', - items: [{ - xtype: 'panel', - layout: 'form', - bbar: ['->', - { - xtype: 'button', - text: _maptab_services_manager_service_cancel, - iconCls: 'map_general_cancel_btn', - tabIndex: 3, - handler: function (btn, e) { - btn.findParentByType("window").hide(); - } - }, - { - xtype: 'button', - text: _maptab_services_manager_register_service, - iconCls: 'maptab_services_issecure', - tabIndex: 4, - handler: function (btn, e) { - var _panel = btn.findParentByType("panel").items.items; - - var _username = fn_encrypt(_panel[0].getValue()); - - var _password = fn_encrypt(_panel[1].getValue()); - - if ((_username != "") && (_password != "")) { - arcgismapservice_register_service(_serviceUrl, _username, _password); - } - - _username = null; - _password = null; - - btn.findParentByType("window").hide(); - } - } - ], - items: [ - { - xtype: 'textfield', - fieldLabel: _maptab_services_manager_service_username, - tabIndex: 1 - }, - { - xtype: 'textfield', - fieldLabel: _maptab_services_manager_service_password, - inputType: 'password', - tabIndex: 2 - } - ] - }] - }); - - return _w; -} - -function arcgismapservice_register_service(_serviceUrl, _username, _password) { - var r = new fn_get(); - - r._async = false; - - r._data.push({ - _serviceType: "ARCGISMAPSERVICE", - _serviceUrl: _serviceUrl, - _request: "registerService", - _username: _username, - _password: _password, - _projections: map_basemapProjections - }); - - var response; - - try { - response = Ext.JSON.decode(r.get().responseText); - } - catch (err) { - return; - } - - - switch (response[0]._responseCode) { - case "401": - - var _w = arcgismapservice_serviceCredentialsWindow(_serviceUrl); - - _w.show(); - - break; - - case "200": - - var records = response[0]._response; - - if ((records._version != "") || (records._version != null)) { - arcgismapservice_StoreColumnsService.store.add({ - _isSecure: false, - _serviceTitle: records._mapName, - _serviceUrl: records._serviceUrl, - _serviceAbstract: records._serviceDescription, - _version: records._currentVersion, - _serviceObject: records - }); - } - return records; - - break; - } -} - -function arcgismapservice_fetch_layers(_serviceObject) { - if (typeof _serviceObject !== "undefined") { - arcgismapservice_StoreColumnsServiceLayers.store.removeAll(); - - var r = new fn_get(); - - r._async = false; - - r._data.push({ - _serviceType: "ARCGISMAPSERVICE", - _serviceUrl: _serviceObject._serviceUrl, - _request: "fetchLayers", - _username: _serviceObject._username, - _password: _serviceObject._password - }); - - var response = Ext.JSON.decode(r.get().responseText); - - var records = response[0]._response; - - Ext.each(records, function (item) { - item._layerTitle = config_getProperty(item, _serviceObject, "_layerTitle", item._name); - - item._layerAbstract = config_getProperty(item, _serviceObject, "_layerAbstract", item._layerAbstract); - - var legend_url = item._layerLegend; - - if (_serviceObject._isSecure == true) { - legend_url = fn_surl(item._layerLegend, _serviceObject._username, _serviceObject._password, "proxy&method=get"); - } - - arcgismapservice_StoreColumnsServiceLayers.store.add({ - _layerId: item._layerId, - _layerName: item._name, - _layerTitle: item._name, - _layerAbstract: item._name, - _layerObject: item - }); - }); - } -} - -function arcgismapservice_register_layer(_servicelayerObject) { - if (!mapFindLayerById(_servicelayerObject._layerId)) { - var r = new fn_get(); - - r._async = false; - - r._data.push({ - _serviceType: "ARCGISMAPSERVICE", - _serviceUrl: _servicelayerObject._serviceUrl, - _request: "registerLayer", - _username: _servicelayerObject._username, - _password: _servicelayerObject._password, - _layerName: _servicelayerObject._layerName, - _layerId: _servicelayerObject._id - }); - - var response = Ext.JSON.decode(r.get().responseText); - - var records = response[0]._response; - - var _node = maptab_west_layer_tree_panel_tree_json_store.getNodeById('maptab_west_layer_tree_panel_tabs_layers_layers_node'); - - if (_node == null) { - _node = maptab_west_layer_tree_panel_tree_json_store.getNodeById('maptab_west_layer_tree_panel_tabs_layers_layers_node'); - } - - if (!mapFindLayerById(records._layerId)) { - var _layerNode = maptab_west_layer_add_arcgismaplayer(records, _node); - - var arcgis_layer = new OpenLayers.Layer.ArcGIS93Rest( - records._layerId, - records._serviceUrl + "/export", - { - layers: "show:" + records._id, - transparent: true, - format: 'png' - }, - { - projection: new OpenLayers.Projection("EPSG:3857"), - isBaseLayer: false - } - ); - arcgis_layer.id = records._layerId; - - map.addLayer(arcgis_layer); - - // if (installing) - // { - // config_update_addLayer(_layerObject,_serviceObject); - // } - // - // config_init_layerScales(_layerObject); - - // maptab_west_layer_reorder_layer(); - - } - - // - // var record; - // - // record = config_findConfig(_layerObject,_serviceObject); - // - // if (!record) - // { - // var response=Ext.JSON.decode(r.get().responseText); - // - // record = response[0]._response; - // - // _layerObject._attributesFields=record._attributes; - // - // }else{ - // - // _layerObject._attributesFields=record._attributesFields; - // - // _layerObject._visibility = record._visibility; - // - // _layerObject._opacity = record._opacity; - // - // _layerObject._singleTile = record._singleTile; - // } - // - // _layerObject._nativeSRS=record._nativeSRS; - // - // _layerObject._supportedEPSG=_serviceObject._supportedEPSG; - // - // var legend_url=_layerObject._layerLegend; - // - // if (_serviceObject._isSecure==true) - // { - // legend_url=fn_surl(_layerObject._layerLegend,_serviceObject._username,_serviceObject._password,"proxy&method=get"); - // } - // - // _layerObject._layerLegend=legend_url; - // - // _layerObject._xy=fn_determineAxisOrder(record._nativeSRS); - // - // _layerObject._geometryField=record._geometryField; - // - // mapBeforeAddLayer(_serviceObject,_layerObject); - // - // if ((_layerObject._nativeSRS) && (_layerObject._geometryField)) - // { - // - // _layerObject._isSearchable=true; - // - // _layerObject._loadedStatus=1; - // - // }else - // { - // _layerObject._loadedStatus=2; - // } - // - // _layerObject._layer=wms_map_layer(_serviceObject,_layerObject); - // - // mapAddLayer(_serviceObject,_layerObject); - - - } -} - -function maptab_west_layer_add_arcgismaplayer(_layer, _node) { - var r = new fn_get(); - - r._async = false; - - r._data.push({ - _serviceType: "ARCGISMAPSERVICE", - _serviceUrl: _layer._serviceUrl, - _request: "getLegend", - _username: _layer._username, - _password: _layer._password, - _layerName: _layer._layerName, - _layerId: _layer._id - }); - - var response = Ext.JSON.decode(r.get().responseText); - - var legend = response[0]._response[0]; - - _node.insertBefore({ - id: _layer._layerId, - text: legend.label, - leaf: true, - qtip: '', - icon: 'data:image/png;base64,' + legend.imageData, - iconCls: 'maptab_services_manager_layer_legend_size', - checked: true, - tools: "" + legend.label + "
    " + legend.label + "
    " + legend.label + "\"> " - }, _node.firstChild); - - return _node; -} - - diff --git a/public/js/trash/maptab/maptab_services_manager/atom.js b/public/js/trash/maptab/maptab_services_manager/atom.js deleted file mode 100644 index 1a104a0..0000000 --- a/public/js/trash/maptab/maptab_services_manager/atom.js +++ /dev/null @@ -1,328 +0,0 @@ -var atom_StoreColumnsService=new fn_storeColumnsService(); -var atom_StoreColumnsServiceLayers=new fn_storeColumnsServiceLayers(); - -init_onload_fn.push(atom_init); - -function atom_init() -{ - maptab_services_manager_gridpanel_store.add({servicetype: 'ATOM',serviceform:atom_service_form}); - Ext.getCmp("maptab_services_manager_gridpanel_columns_service_type").add(atom_service_form); -} - -var atom_service_form=new Ext.Panel({ - xtype:'panel', - title:_maptab_services_manager_service_atom_title_form, - id:'atom_service_form', - layout:'border', - border:false, - hidden:true, - items:[ - { - xtype:'panel', - region:'north', - layout:'form', - border:true, - height:100, - items:[ - { - xtype: 'textfield', - fieldLabel:_maptab_services_manager_service_title, - id:'maptab_services_manager_atom_service_title', - width:300 - }, - { - xtype: 'textfield', - fieldLabel:_maptab_services_manager_service_address, - id:'maptab_services_manager_atom_service_address', - width:300 - } - ], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_service, - handler:function() - { - Ext.getCmp('atom_service_form_service_grid').setLoading(true); - - atom_register_service(Ext.getCmp('maptab_services_manager_atom_service_address').getValue(),Ext.getCmp('maptab_services_manager_atom_service_title').getValue()); - - Ext.getCmp('atom_service_form_service_grid').setLoading(false); - } - } - ] - }, - { - xtype:'gridpanel', - region:'center', - border:true, - minHeight:180, - columnLines:true, - split: true, - id:'atom_service_form_service_grid', - store:atom_StoreColumnsService.store, - columns:atom_StoreColumnsService.columns, - selModel: Ext.create('Ext.selection.CheckboxModel'), - plugins: [{ - ptype: 'rowexpander', - pluginId: 'rowexpanderATOMService', - rowBodyTpl : [ - '
    '+_maptab_services_manager_storecolumns_column_service_abstract+':
    {_serviceAbstract}
    ' - ] - }], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_unregister', - text:_maptab_services_manager_unregister_service, - handler:function() - { - var selected=Ext.getCmp('atom_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=(overlayers.length-1);i>=0;i--) - { - if (overlayers[i]._serviceObject._serviceUrl==item.get("_serviceUrl")) - { - if(typeof overlayers[i]._layerObject!=="undefined") - { - maptab_west_layer_remove_node(maptab_west_layer_get_node_from_id(overlayers[i]._layerObject._layerId)); - } - } - } - - Ext.getCmp('atom_service_form_service_grid').getStore().remove(item); - }); - } - }, - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_layer, - handler:function() - { - var selected=Ext.getCmp('atom_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var _message=_maptab_services_manager_loading_layer_message; - - _message=_message.replace("{_layerTitle}",item.get("_layerTitle")); - - var mask=fn_loadingMask(maptab_services_manager,_message); - - mask.show(); - - atom_register_layer(item.get("_serviceObject"),item.get("_serviceObject")._layers); - - Ext.getCmp('atom_service_form_service_grid').getView().refresh(); - - mask.hide(); - }); - } - } - ] - } - ] -}); - - -function atom_register_service(_serviceUrl,_serviceTitle,_username,_password) -{ - var r=new fn_get(); - - r._async=false; - - r._data.push({ - _serviceType:"ATOM", - _serviceUrl:_serviceUrl, - _serviceTitle:_serviceTitle, - _request:"registerService", - _username:_username, - _password:_password - }); - - var response=Ext.JSON.decode(r.get().responseText); - - switch(response[0]._responseCode) - { - case "401": - - var _w=atom_serviceCredentialsWindow(_serviceUrl); - - _w.show(); - - break; - - case "200": - var records=response[0]._response; - - atom_StoreColumnsService.store.add({ - _isSecure:records._isSecure, - _serviceTitle:records._serviceTitle, - _serviceUrl:records._serviceUrl, - _serviceAbstract:records._serviceAbstract, - _version:records._version, - _serviceObject:records - }); - - return records; - break; - - } -} - -function atom_register_layer(_serviceObject,_layerObject) -{ - - if (!mapFindLayerById(_layerObject._layerId)) - { - mapBeforeAddLayer(_serviceObject,_layerObject); - - _layerObject._loadedStatus = 1; - - _layerObject._nativeSRS = "EPSG:4326"; - - _layerObject._layer=atom_map_layer(_serviceObject,_layerObject); - - mapAddLayer(_serviceObject,_layerObject); - - } -} - - -function atom_map_layer(_serviceObject, _layerObject) -{ - var _refreshStrategy = new OpenLayers.Strategy.Refresh({force: true, active: true}); - - var style=new OpenLayers.StyleMap({ - "default":new OpenLayers.Style({ - pointRadius: 5, - fillColor: "#"+_layerObject._color, - fillOpacity: 0.6, - strokeColor: "#"+_layerObject._color, - strokeWidth: 1, - strokeOpacity:1 - }), - "select":{ - fillColor: '#a9a8a7', - strokeColor: '#5d7cc4', - strokeWidth: 1, - cursor: 'pointer', - graphicZIndex: 100 - } - }); - - var _strategies=[]; - _strategies.push(new OpenLayers.Strategy.Fixed()); - _strategies.push(_refreshStrategy); - - var service_url=fn_surl(_serviceObject._serviceUrl,_serviceObject._username,_serviceObject._password,'proxy'); - - var layer=new OpenLayers.Layer.Vector( - _layerObject._layerTitle, - { - strategies: _strategies, - styleMap:style, - projection:new OpenLayers.Projection("EPSG:4326"), - rendererOptions: { zIndexing: true }, - protocol: new OpenLayers.Protocol.HTTP({ - url: service_url, - format: new OpenLayers.Format.Atom() - }), - _layerObject:_layerObject, - _serviceObject:_serviceObject, - visibility:_layerObject._visibility, - eventListeners: { - "featuresadded": function(evt){ - var features=evt.features; - - for(var i=0;i', - { - xtype:'button', - text:_maptab_services_manager_service_cancel, - iconCls:'map_general_cancel_btn', - handler:function(btn,e) - { - btn.findParentByType("window").hide(); - } - }, - { - xtype:'button', - text:_maptab_services_manager_register_service, - iconCls:'maptab_services_issecure', - handler:function(btn,e) - { - var _panel=btn.findParentByType("panel").items.items; - - var _username=fn_encrypt(_panel[0].getValue()); - - var _password=fn_encrypt(_panel[1].getValue()); - - if ((_username!="") && (_password!="")) - { - atom_register_service(_serviceUrl,_username,_password); - } - - btn.findParentByType("window").hide(); - } - } - ], - items:[ - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_username - }, - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_password - } - ] - }] - }); - - return _w; -} - - diff --git a/public/js/trash/maptab/maptab_services_manager/csw.js b/public/js/trash/maptab/maptab_services_manager/csw.js deleted file mode 100644 index 35c4754..0000000 --- a/public/js/trash/maptab/maptab_services_manager/csw.js +++ /dev/null @@ -1,214 +0,0 @@ -var csw_StoreColumnsService=new fn_storeColumnsService(); -var csw_StoreColumnsServiceLayers=new fn_storeColumnsServiceLayers(); - -init_onload_fn.push(csw_init); - -function csw_init() -{ - maptab_services_manager_gridpanel_store.add({servicetype: 'CSW',serviceform:csw_service_form}); - Ext.getCmp("maptab_services_manager_gridpanel_columns_service_type").add(csw_service_form); -} - -var csw_service_form=new Ext.Panel({ - xtype:'panel', - title:_maptab_services_manager_service_csw_title_form, - id:'csw_service_form', - layout:'border', - border:false, - hidden:true, - items:[ - { - xtype:'panel', - region:'north', - layout:'form', - border:true, - height:80, - items:[ - { - xtype: 'textfield', - fieldLabel:_maptab_services_manager_service_address, - id:'maptab_services_manager_csw_service_address', - width:300 - } - ], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_service, - handler:function() - { - Ext.getCmp('csw_service_form_service_grid').setLoading(true); - - csw_register_service(Ext.getCmp('maptab_services_manager_csw_service_address').getValue()); - - Ext.getCmp('csw_service_form_service_grid').setLoading(false); - } - } - ] - }, - { - xtype:'gridpanel', - region:'center', - border:true, - minHeight:180, - columnLines:true, - split: true, - id:'csw_service_form_service_grid', - store:csw_StoreColumnsService.store, - columns:csw_StoreColumnsService.columns, - selModel: Ext.create('Ext.selection.CheckboxModel'), - plugins: [{ - ptype: 'rowexpander', - pluginId: 'rowexpanderCSWService', - rowBodyTpl : [ - '
    '+_maptab_services_manager_storecolumns_column_service_abstract+':
    {_serviceAbstract}
    ' - ] - }], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_unregister', - text:_maptab_services_manager_unregister_service, - handler:function() - { - var selected=Ext.getCmp('csw_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=(overlayers.length-1);i>=0;i--) - { - if (overlayers[i]._serviceObject._serviceUrl==item.get("_serviceUrl")) - { - if(typeof overlayers[i]._layerObject!=="undefined") - { - maptab_west_layer_remove_node(overlayers[i]._layerObject._layerId); - } - } - } - - Ext.getCmp('csw_service_form_service_grid').getStore().remove(item); - }); - } - } - ] - } - ] -}); - - -function csw_register_service(_serviceUrl,_username,_password) -{ - var r=new fn_get(); - - r._async=false; - - r._data.push({ - _serviceType:"CSW", - _serviceUrl:_serviceUrl, - _request:"registerService", - _username:_username, - _password:_password - }); - - var response=Ext.JSON.decode(r.get().responseText); - - switch(response[0]._responseCode) - { - case "401": - - var _w=csw_serviceCredentialsWindow(_serviceUrl); - - _w.show(); - - break; - - case "200": - var records=response[0]._response; - - csw_StoreColumnsService.store.add({ - _isSecure:records._isSecure, - _serviceTitle:records._serviceTitle, - _serviceUrl:records._serviceUrl, - _serviceAbstract:records._serviceAbstract, - _version:records._version, - _serviceObject:records - }); - - metadata_settings_choose_service_checked_store.add({ - _serviceId:records._serviceId, - _serviceTitle:records._serviceTitle, - _serviceUrl:records._serviceUrl - }); - - return records; - break; - - } -} - - -function csw_serviceCredentialsWindow(_serviceUrl) -{ - var _w=new Ext.Window({ - width:250, - height:120, - modal:true, - shim:true, - title:_maptab_services_manager_service_credentials, - resizable:true, - closeAction:'destroy', - layout:'fit', - items:[{ - xtype:'panel', - layout:'form', - bbar:['->', - { - xtype:'button', - text:_maptab_services_manager_service_cancel, - iconCls:'map_general_cancel_btn', - handler:function(btn,e) - { - btn.findParentByType("window").hide(); - } - }, - { - xtype:'button', - text:_maptab_services_manager_register_service, - iconCls:'maptab_services_issecure', - handler:function(btn,e) - { - var _panel=btn.findParentByType("panel").items.items; - - var _username=fn_encrypt(_panel[0].getValue()); - - var _password=fn_encrypt(_panel[1].getValue()); - - if ((_username!="") && (_password!="")) - { - csw_register_service(_serviceUrl,_username,_password); - } - - btn.findParentByType("window").hide(); - } - } - ], - items:[ - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_username - }, - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_password - } - ] - }] - }); - - return _w; -} - - diff --git a/public/js/trash/maptab/maptab_services_manager/dxf.js b/public/js/trash/maptab/maptab_services_manager/dxf.js deleted file mode 100644 index 6442a4c..0000000 --- a/public/js/trash/maptab/maptab_services_manager/dxf.js +++ /dev/null @@ -1,369 +0,0 @@ -Ext.define('serviceDXFLayersStoreModel', { - extend: 'Ext.data.Model', - fields: [ - { name: '_layerId', type: 'string' }, - { name: '_zoomto' }, - { name: '_layerName', type: 'string' }, - { name: '_layerFile', type: 'string' }, - { name: '_layerExtent', type: 'object' }, - { name: '_layerObject', type: 'object' }, - { name: '_serviceObject', type: 'object' } - ] -}); - -function fn_storeColumnsDXFServiceLayers() { - var obj = { - store: Ext.create('Ext.data.Store', { - model: 'serviceDXFLayersStoreModel', - data: [] - }), - columns: [ - { - dataIndex: '_layerId', - hidden: true, - hideable: false - }, - { - header: '', - dataIndex: 'mydrawzoomto', - width: 40, - renderer: dxf_zoomto_renderer - }, - { - header: _maptab_services_manager_storecolumns_column_layer_name, - dataIndex: '_layerName', - sortable: true, - width: 200 - }, - { - header: _maptab_services_manager_storecolumns_column_layer_file, - dataIndex: '_layerFile', - sortable: true, - width: 200 - }, - { - dataIndex: '_layerExtent', - hidden: true, - hideable: false - }, - { - dataIndex: '_layerObject', - hidden: true, - hideable: false - }, - { - dataIndex: '_serviceObject', - hidden: true, - hideable: false - } - ] - }; - - return obj; -} - -function dxf_zoomto_renderer(value, metaData, record, row, col, store, gridView) { - return ""; -} - -function fn_dxf_zoomto(extent) { - var e = extent.split(','); - var bounds = new OpenLayers.Bounds(parseFloat(e[0]), parseFloat(e[1]), parseFloat(e[2]), parseFloat(e[3])); - map.zoomToExtent(bounds); -} - -var dxf_StoreColumnsServiceLayers = new fn_storeColumnsDXFServiceLayers(); - -init_onload_fn.push(dxf_init); - -function dxf_init() { - maptab_services_manager_gridpanel_store.add({ servicetype: 'DXF', serviceform: dxf_service_form }); - Ext.getCmp("maptab_services_manager_gridpanel_columns_service_type").add(dxf_service_form); -} - -var dxf_service_form_layers_grid = { - xtype: 'gridpanel', - region: 'south', - border: true, - height: 375, - split: true, - columnLines: true, - viewConfig: { preserveScrollOnRefresh: true }, - id: 'dxf_service_form_layers_grid', - store: dxf_StoreColumnsServiceLayers.store, - columns: dxf_StoreColumnsServiceLayers.columns, - selModel: Ext.create('Ext.selection.CheckboxModel'), - bbar: ['->', - { - xtype: 'button', - iconCls: 'maptab_services_manager_unregister', - text: _maptab_services_manager_unregister_layer, - handler: function () { - var selected = Ext.getCmp('dxf_service_form_layers_grid').getSelectionModel().getSelection(); - - Ext.each(selected, function (item) { - var _message = _maptab_services_manager_unregister_layer_message; - _message = _message.replace("{_layerFile}", item.get("_layerFile")); - _message = _message.replace("{_layerName}", item.get("_layerName")); - var mask = fn_loadingMask(maptab_services_manager, _message); - mask.show(); - map.layers.forEach(function (ly) { - if (ly.name === item.get("_layerId")) { - map.removeLayer(ly); - dxf_StoreColumnsServiceLayers.store.remove(dxf_StoreColumnsServiceLayers.store.findRecord('_layerId', ly.name, 0, false, true, true)); - } - }); - Ext.getCmp('dxf_service_form_layers_grid').getView().refresh(); - mask.hide(); - }); - } - } - ] -} - -var dxf_service_form = new Ext.Panel({ - xtype: 'panel', - title: 'DXF', - id: 'dxf_service_form', - layout: 'border', - border: false, - hidden: true, - items: [ - { - xtype: 'form', - region: 'north', - anchor: '100%', - fileUpload: true, - isUpload: true, - id: 'maptab_services_manager_dxf_form', - method: 'POST', - enctype: 'multipart/form-data', - border: true, - height: 120, - items: [ - { - xtype: 'textfield', - fieldLabel: _maptab_services_manager_service_name, - id: 'maptab_services_manager_dxf_name', - anchor: '100%' - }, - { - xtype: 'filefield', - fieldLabel: 'Αρχείο DXF', - name: 'dxf', - id: 'maptab_services_manager_dxf_file', - anchor: '100%' - }, - { - xtype: 'combo', - loadMask: true, - autoScroll: true, - autoShow: true, - anchor: '100%', - id: 'maptab_services_manager_dxf_projection', - fieldLabel: 'Σύστημα Συντεταγμένων', - store: new Ext.data.SimpleStore({ - fields: ['value', 'name'], - data: [ - ["EPSG:2100", "EPSG:2100"], - ["EPSG:4326", "EPSG:4326"], - ["EPSG:3785", "EPSG:3785"], - ["EPSG:3857", "EPSG:3857"], - ["EPSG:32717", "EPSG:32717"] - ] - }), - displayField: 'name', - valueField: 'value', - emptyText: "", - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - editable: false - } - ], - bbar: ['->', - { - xtype: 'button', - iconCls: 'maptab_services_manager_register', - text: _maptab_services_manager_register_layer, - handler: function () { - - Ext.getCmp('maptab_services_manager_dxf_form').setLoading(true); - - var file = this.up().up().down('filefield').el.down('input[type=file]').dom.files[0]; - var reader = new FileReader(); - reader.readAsText(file); - reader.onload = function (e) { - var fileText = e.target.result; - var parser = new DxfParser(); - var dxf = null; - try { - dxf = parser.parseSync(fileText); - } catch (err) { - alert("error..."); - Ext.getCmp('maptab_services_manager_dxf_form').setLoading(false); - } - - var style = new OpenLayers.Style({ - fillColor: '#000000', - fillOpacity: 0, - strokeColor: '#000000', - strokeWidth: 1, - label: '${getLabel}', - labelAlign: 'lb', - fontColor: "black", - fontFamily: "Arial", - fontSize: '${getFontSize}', - }, { - context: { - getLabel: function (feature) { - if (feature.attributes.text === '-') { - return ''; - } else { - return feature.attributes.text; - } - }, - getFontSize: function (feature) { - if (map.zoom > 19) { - return 8; - } else if (map.zoom === 19) { - return 6; - } else if (map.zoom === 18) { - return 4; - } else { - return 1; - } - }, - } - }); - - var features = []; - dxf.entities.forEach(function (e) { - if (/*e.type === "POINT" ||*/ e.type === "TEXT") { - var x = null; - var y = null; - var text = '-'; - if (e.type === "TEXT") { - x = e.startPoint.x; - y = e.startPoint.y; - text = e.text; - } else { - x = e.position.x; - y = e.position.y; - } - var geom = new OpenLayers.Geometry.Point(x, y); - if (Ext.getCmp('maptab_services_manager_dxf_projection').getValue() !== mapGetCurrentProjection()) { - geom.transform(new OpenLayers.Projection(Ext.getCmp('maptab_services_manager_dxf_projection').getValue()), new OpenLayers.Projection(mapGetCurrentProjection())); - } - var attributes = { layer: e.layer, text: text }; - var feature = new OpenLayers.Feature.Vector(geom, attributes); - features.push(feature); - } else if (e.type === "LWPOLYLINE" && e.shape) { - var vertices = []; - for (let i = 0; i < e.vertices.length; i++) { - var geom = new OpenLayers.Geometry.Point(e.vertices[i].x, e.vertices[i].y); - if (Ext.getCmp('maptab_services_manager_dxf_projection').getValue() !== mapGetCurrentProjection()) { - geom.transform(new OpenLayers.Projection(Ext.getCmp('maptab_services_manager_dxf_projection').getValue()), new OpenLayers.Projection(mapGetCurrentProjection())); - } - vertices.push(geom); - } - - var geom = new OpenLayers.Geometry.Point(e.vertices[0].x, e.vertices[0].y); - if (Ext.getCmp('maptab_services_manager_dxf_projection').getValue() !== mapGetCurrentProjection()) { - geom.transform(new OpenLayers.Projection(Ext.getCmp('maptab_services_manager_dxf_projection').getValue()), new OpenLayers.Projection(mapGetCurrentProjection())); - } - vertices.push(geom); - - var attributes = { layer: e.layer, text: '-' }; - var feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(vertices), attributes); - features.push(feature); - } else if (e.type === "POLYLINE" && e.shape) { - var vertices = []; - for (let i = 0; i < e.vertices.length; i++) { - var geom = new OpenLayers.Geometry.Point(e.vertices[i].x, e.vertices[i].y); - if (Ext.getCmp('maptab_services_manager_dxf_projection').getValue() !== mapGetCurrentProjection()) { - geom.transform(new OpenLayers.Projection(Ext.getCmp('maptab_services_manager_dxf_projection').getValue()), new OpenLayers.Projection(mapGetCurrentProjection())); - } - vertices.push(geom); - } - - var geom = new OpenLayers.Geometry.Point(e.vertices[0].x, e.vertices[0].y); - if (Ext.getCmp('maptab_services_manager_dxf_projection').getValue() !== mapGetCurrentProjection()) { - geom.transform(new OpenLayers.Projection(Ext.getCmp('maptab_services_manager_dxf_projection').getValue()), new OpenLayers.Projection(mapGetCurrentProjection())); - } - vertices.push(geom); - - var attributes = { layer: e.layer, text: '-' }; - var feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(vertices), attributes); - features.push(feature); - } else if (e.type === "LWPOLYLINE" || e.type === "POLYLINE" || e.type === "LINE") { - var vertices = []; - e.vertices.forEach(function (v) { - var geom = new OpenLayers.Geometry.Point(v.x, v.y); - if (Ext.getCmp('maptab_services_manager_dxf_projection').getValue() !== mapGetCurrentProjection()) { - geom.transform(new OpenLayers.Projection(Ext.getCmp('maptab_services_manager_dxf_projection').getValue()), new OpenLayers.Projection(mapGetCurrentProjection())); - } - vertices.push(geom); - }) - var attributes = { layer: e.layer, text: '-' }; - var feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(vertices), attributes); - features.push(feature); - } else if (e.type === "CIRCLE") { - var pCenter = new OpenLayers.Geometry.Point(e.center.x, e.center.y); - var geom = new OpenLayers.Geometry.Polygon.createRegularPolygon(pCenter, e.radius, 70, 0); - if (Ext.getCmp('maptab_services_manager_dxf_projection').getValue() !== mapGetCurrentProjection()) { - geom.transform(new OpenLayers.Projection(Ext.getCmp('maptab_services_manager_dxf_projection').getValue()), new OpenLayers.Projection(mapGetCurrentProjection())); - } - var attributes = { layer: e.layer, text: '-' }; - var feature = new OpenLayers.Feature.Vector(geom, attributes); - features.push(feature); - } - }) - - var layer = new OpenLayers.Layer.Vector("DXF-" + Ext.getCmp('maptab_services_manager_dxf_name').getValue(), { styleMap: style }); - layer.addFeatures(features); - - map.addLayer(layer); - - map.zoomToExtent(layer.getDataExtent()); - - dxf_StoreColumnsServiceLayers.store.add({ - _layerId: "DXF-" + Ext.getCmp('maptab_services_manager_dxf_name').getValue(), - _layerExtent: layer.getDataExtent(), - _layerObject: layer, - _layerName: Ext.getCmp('maptab_services_manager_dxf_name').getValue(), - _layerFile: Ext.getCmp('maptab_services_manager_dxf_file').getValue().split('\\')[2], - _layerAbstract: Ext.getCmp('maptab_services_manager_dxf_file').getValue() - }); - - Ext.getCmp('maptab_services_manager_dxf_form').setLoading(false); - }; - - } - } - ] - }, - dxf_service_form_layers_grid - ] -}); - -function dxf_register_layer(_serviceObject, _layerObject) { - - if (!mapFindLayerById(_layerObject._layerId)) { - mapBeforeAddLayer(_serviceObject, _layerObject); - - _layerObject._loadedStatus = 1; - - var _attributesFields = _layerObject._attributesFields; - - _attributesFields.forEach(function (entry) { - entry._attributeName = entry._attributeName.name; - }); - - _layerObject._layer = dxf_map_layer(_serviceObject, _layerObject); - - mapAddLayer(_serviceObject, _layerObject); - - } -} \ No newline at end of file diff --git a/public/js/trash/maptab/maptab_services_manager/georss.js b/public/js/trash/maptab/maptab_services_manager/georss.js deleted file mode 100644 index c1ba9a5..0000000 --- a/public/js/trash/maptab/maptab_services_manager/georss.js +++ /dev/null @@ -1,328 +0,0 @@ -var georss_StoreColumnsService=new fn_storeColumnsService(); -var georss_StoreColumnsServiceLayers=new fn_storeColumnsServiceLayers(); - -init_onload_fn.push(georss_init); - -function georss_init() -{ - maptab_services_manager_gridpanel_store.add({servicetype: 'GEORSS',serviceform:georss_service_form}); - Ext.getCmp("maptab_services_manager_gridpanel_columns_service_type").add(georss_service_form); -} - -var georss_service_form=new Ext.Panel({ - xtype:'panel', - title:_maptab_services_manager_service_georss_title_form, - id:'georss_service_form', - layout:'border', - border:false, - hidden:true, - items:[ - { - xtype:'panel', - region:'north', - layout:'form', - border:true, - height:100, - items:[ - { - xtype: 'textfield', - fieldLabel:_maptab_services_manager_service_title, - id:'maptab_services_manager_georss_service_title', - width:300 - }, - { - xtype: 'textfield', - fieldLabel:_maptab_services_manager_service_address, - id:'maptab_services_manager_georss_service_address', - width:300 - } - ], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_service, - handler:function() - { - Ext.getCmp('georss_service_form_service_grid').setLoading(true); - - georss_register_service(Ext.getCmp('maptab_services_manager_georss_service_address').getValue(),Ext.getCmp('maptab_services_manager_georss_service_title').getValue()); - - Ext.getCmp('georss_service_form_service_grid').setLoading(false); - } - } - ] - }, - { - xtype:'gridpanel', - region:'center', - border:true, - minHeight:180, - columnLines:true, - split: true, - id:'georss_service_form_service_grid', - store:georss_StoreColumnsService.store, - columns:georss_StoreColumnsService.columns, - selModel: Ext.create('Ext.selection.CheckboxModel'), - plugins: [{ - ptype: 'rowexpander', - pluginId: 'rowexpanderGEORSSService', - rowBodyTpl : [ - '
    '+_maptab_services_manager_storecolumns_column_service_abstract+':
    {_serviceAbstract}
    ' - ] - }], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_unregister', - text:_maptab_services_manager_unregister_service, - handler:function() - { - var selected=Ext.getCmp('georss_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=(overlayers.length-1);i>=0;i--) - { - if (overlayers[i]._serviceObject._serviceUrl==item.get("_serviceUrl")) - { - if(typeof overlayers[i]._layerObject!=="undefined") - { - alert(overlayers[i]._layerObject._layerId); - maptab_west_layer_remove_node(maptab_west_layer_get_node_from_id(overlayers[i]._layerObject._layerId)); - } - } - } - - Ext.getCmp('georss_service_form_service_grid').getStore().remove(item); - }); - } - }, - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_layer, - handler:function() - { - var selected=Ext.getCmp('georss_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var _message=_maptab_services_manager_loading_layer_message; - - _message=_message.replace("{_layerTitle}",item.get("_layerTitle")); - - var mask=fn_loadingMask(maptab_services_manager,_message); - - mask.show(); - - georss_register_layer(item.get("_serviceObject"),item.get("_serviceObject")._layers); - - Ext.getCmp('georss_service_form_service_grid').getView().refresh(); - - mask.hide(); - }); - } - } - ] - } - ] -}); - - -function georss_register_service(_serviceUrl,_serviceTitle,_username,_password) -{ - var r=new fn_get(); - - r._async=false; - - r._data.push({ - _serviceType:"GEORSS", - _serviceUrl:_serviceUrl, - _serviceTitle:_serviceTitle, - _request:"registerService", - _username:_username, - _password:_password - }); - - var response=Ext.JSON.decode(r.get().responseText); - - switch(response[0]._responseCode) - { - case "401": - - var _w=georss_serviceCredentialsWindow(_serviceUrl); - - _w.show(); - - break; - - case "200": - var records=response[0]._response; - - georss_StoreColumnsService.store.add({ - _isSecure:records._isSecure, - _serviceTitle:records._serviceTitle, - _serviceUrl:records._serviceUrl, - _serviceAbstract:records._serviceAbstract, - _version:records._version, - _serviceObject:records - }); - - return records; - break; - - } -} - -function georss_register_layer(_serviceObject,_layerObject) -{ - - if (!mapFindLayerById(_layerObject._layerId)) - { - mapBeforeAddLayer(_serviceObject,_layerObject); - - _layerObject._loadedStatus=1; - - _layerObject._layer=georss_map_layer(_serviceObject,_layerObject); - - mapAddLayer(_serviceObject,_layerObject); - - } -} - - -function georss_map_layer(_serviceObject, _layerObject) -{ - var _refreshStrategy = new OpenLayers.Strategy.Refresh({force: true, active: true}); - - var style=new OpenLayers.StyleMap({ - "default":new OpenLayers.Style({ - pointRadius: 5, - fillColor: "#"+_layerObject._color, - fillOpacity: 0.6, - strokeColor: "#"+_layerObject._color, - strokeWidth: 1, - strokeOpacity:1 - }), - "select":{ - fillColor: '#a9a8a7', - strokeColor: '#5d7cc4', - strokeWidth: 1, - cursor: 'pointer', - graphicZIndex: 100 - } - }); - - var _strategies=[]; - _strategies.push(new OpenLayers.Strategy.Fixed()); - _strategies.push(_refreshStrategy); - - var service_url=fn_surl(_serviceObject._serviceUrl,_serviceObject._username,_serviceObject._password,'proxy'); - - var layer=new OpenLayers.Layer.Vector( - _layerObject._layerTitle, - { - strategies: _strategies, - styleMap:style, - projection:new OpenLayers.Projection("EPSG:4326"), - rendererOptions: { zIndexing: true }, - protocol: new OpenLayers.Protocol.HTTP({ - url: service_url, - format: new OpenLayers.Format.GeoRSS() - }), - _layerObject:_layerObject, - _serviceObject:_serviceObject, - visibility:_layerObject._visibility, - eventListeners: { - "featuresadded": function(evt){ - var features=evt.features; - - for(var i=0;i', - { - xtype:'button', - text:_maptab_services_manager_service_cancel, - iconCls:'map_general_cancel_btn', - handler:function(btn,e) - { - btn.findParentByType("window").hide(); - } - }, - { - xtype:'button', - text:_maptab_services_manager_register_service, - iconCls:'maptab_services_issecure', - handler:function(btn,e) - { - var _panel=btn.findParentByType("panel").items.items; - - var _username=fn_encrypt(_panel[0].getValue()); - - var _password=fn_encrypt(_panel[1].getValue()); - - if ((_username!="") && (_password!="")) - { - georss_register_service(_serviceUrl,_username,_password); - } - - btn.findParentByType("window").hide(); - } - } - ], - items:[ - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_username - }, - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_password - } - ] - }] - }); - - return _w; -} - - diff --git a/public/js/trash/maptab/maptab_services_manager/kml.js b/public/js/trash/maptab/maptab_services_manager/kml.js deleted file mode 100644 index 4ad84e7..0000000 --- a/public/js/trash/maptab/maptab_services_manager/kml.js +++ /dev/null @@ -1,312 +0,0 @@ -var kml_StoreColumnsService=new fn_storeColumnsService(); -var kml_StoreColumnsServiceLayers=new fn_storeColumnsServiceLayers(); - -init_onload_fn.push(kml_init); - -function kml_init() -{ - maptab_services_manager_gridpanel_store.add({servicetype: 'KML',serviceform:kml_service_form}); - Ext.getCmp("maptab_services_manager_gridpanel_columns_service_type").add(kml_service_form); -} - -var kml_service_form=new Ext.Panel({ - xtype:'panel', - title:_maptab_services_manager_service_kml_title_form, - id:'kml_service_form', - layout:'border', - border:false, - hidden:true, - items:[ - { - xtype:'panel', - region:'north', - layout:'form', - border:true, - height:100, - items:[ - { - xtype: 'textfield', - fieldLabel:_maptab_services_manager_service_title, - id:'maptab_services_manager_kml_service_title', - width:300 - }, - { - xtype: 'textfield', - fieldLabel:_maptab_services_manager_service_address, - id:'maptab_services_manager_kml_service_address', - width:300 - } - ], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_service, - handler:function() - { - Ext.getCmp('kml_service_form_service_grid').setLoading(true); - - kml_register_service(Ext.getCmp('maptab_services_manager_kml_service_address').getValue(),Ext.getCmp('maptab_services_manager_kml_service_title').getValue()); - - Ext.getCmp('kml_service_form_service_grid').setLoading(false); - } - } - ] - }, - { - xtype:'gridpanel', - region:'center', - border:true, - minHeight:180, - columnLines:true, - split: true, - id:'kml_service_form_service_grid', - store:kml_StoreColumnsService.store, - columns:kml_StoreColumnsService.columns, - selModel: Ext.create('Ext.selection.CheckboxModel'), - plugins: [{ - ptype: 'rowexpander', - pluginId: 'rowexpanderKMLService', - rowBodyTpl : [ - '
    '+_maptab_services_manager_storecolumns_column_service_abstract+':
    {_serviceAbstract}
    ' - ] - }], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_unregister', - text:_maptab_services_manager_unregister_service, - handler:function() - { - var selected=Ext.getCmp('kml_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=(overlayers.length-1);i>=0;i--) - { - if (overlayers[i]._serviceObject._serviceUrl==item.get("_serviceUrl")) - { - if(typeof overlayers[i]._layerObject!=="undefined") - { - maptab_west_layer_remove_node(maptab_west_layer_get_node_from_id(overlayers[i]._layerObject._layerId)); - } - } - } - - Ext.getCmp('kml_service_form_service_grid').getStore().remove(item); - }); - } - }, - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_layer, - handler:function() - { - var selected=Ext.getCmp('kml_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var _message=_maptab_services_manager_loading_layer_message; - - _message=_message.replace("{_layerTitle}",item.get("_layerTitle")); - - var mask=fn_loadingMask(maptab_services_manager,_message); - - mask.show(); - - kml_register_layer(item.get("_serviceObject"),item.get("_serviceObject")._layers); - - Ext.getCmp('kml_service_form_service_grid').getView().refresh(); - - mask.hide(); - }); - } - } - ] - } - ] -}); - - -function kml_register_service(_serviceUrl,_serviceTitle,_username,_password) -{ - var r=new fn_get(); - - r._async=false; - - r._data.push({ - _serviceType:"KML", - _serviceUrl:_serviceUrl, - _serviceTitle:_serviceTitle, - _request:"registerService", - _username:_username, - _password:_password - }); - - var response=Ext.JSON.decode(r.get().responseText); - - switch(response[0]._responseCode) - { - case "401": - - var _w=kml_serviceCredentialsWindow(_serviceUrl); - - _w.show(); - - break; - - case "200": - var records=response[0]._response; - - kml_StoreColumnsService.store.add({ - _isSecure:records._isSecure, - _serviceTitle:records._serviceTitle, - _serviceUrl:records._serviceUrl, - _serviceAbstract:records._serviceAbstract, - _version:records._version, - _serviceObject:records - }); - - return records; - break; - - } -} - -function kml_register_layer(_serviceObject,_layerObject) -{ - - if (!mapFindLayerById(_layerObject._layerId)) - { - mapBeforeAddLayer(_serviceObject,_layerObject); - - _layerObject._loadedStatus=1; - - _layerObject._layer=kml_map_layer(_serviceObject,_layerObject); - - mapAddLayer(_serviceObject,_layerObject); - - } -} - - -function kml_map_layer(_serviceObject, _layerObject) -{ - var _refreshStrategy = new OpenLayers.Strategy.Refresh({force: true, active: true}); - - var _strategies=[]; - _strategies.push(new OpenLayers.Strategy.Fixed()); - _strategies.push(_refreshStrategy); - - var service_url=fn_surl(_serviceObject._serviceUrl,_serviceObject._username,_serviceObject._password,'proxy'); - - var layer=new OpenLayers.Layer.Vector( - _layerObject._layerTitle, - { - strategies: _strategies, - projection:new OpenLayers.Projection("EPSG:4326"), - rendererOptions: { zIndexing: true }, - protocol: new OpenLayers.Protocol.HTTP({ - url: service_url, - format: new OpenLayers.Format.KML({ - extractStyles: true, - extractAttributes: true, - maxDepth: 2 - }) - }), - _layerObject:_layerObject, - _serviceObject:_serviceObject, - visibility:_layerObject._visibility, - eventListeners: { - "featuresadded": function(evt){ - var features=evt.features; - - for(var i=0;i', - { - xtype:'button', - text:_maptab_services_manager_service_cancel, - iconCls:'map_general_cancel_btn', - handler:function(btn,e) - { - btn.findParentByType("window").hide(); - } - }, - { - xtype:'button', - text:_maptab_services_manager_register_service, - iconCls:'maptab_services_issecure', - handler:function(btn,e) - { - var _panel=btn.findParentByType("panel").items.items; - - var _username=fn_encrypt(_panel[0].getValue()); - - var _password=fn_encrypt(_panel[1].getValue()); - - if ((_username!="") && (_password!="")) - { - kml_register_service(_serviceUrl,_username,_password); - } - - btn.findParentByType("window").hide(); - } - } - ], - items:[ - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_username - }, - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_password - } - ] - }] - }); - - return _w; -} - - diff --git a/public/js/trash/maptab/maptab_services_manager/shapefile.js b/public/js/trash/maptab/maptab_services_manager/shapefile.js deleted file mode 100644 index 05226b5..0000000 --- a/public/js/trash/maptab/maptab_services_manager/shapefile.js +++ /dev/null @@ -1,459 +0,0 @@ -var shapefile_StoreColumnsService=new fn_storeColumnsService(); -var shapefile_StoreColumnsServiceLayers=new fn_storeColumnsServiceLayers(); - -var shapefile_charsets = new _config_init_map(); - -shapefile_charsets = shapefile_charsets._charsets; - -init_onload_fn.push(shapefile_init); - -function shapefile_init() -{ - maptab_services_manager_gridpanel_store.add({servicetype: 'SHAPEFILE',serviceform:shapefile_service_form}); - Ext.getCmp("maptab_services_manager_gridpanel_columns_service_type").add(shapefile_service_form); -} - -var shapefile_service_form=new Ext.Panel({ - xtype:'panel', - title:_maptab_services_manager_service_shapefile_title_form, - id:'shapefile_service_form', - layout:'border', - border:false, - hidden:true, - items:[ - { - xtype:'form', - region:'north', - anchor:'100%', - fileUpload: true, - isUpload: true, - id:'maptab_services_manager_shapefile_form', - method:'POST', - enctype:'multipart/form-data', - border:true, - height:220, - items:[ - { - xtype: 'textfield', - fieldLabel:_maptab_services_manager_service_name, - id:'maptab_services_manager_shapefile_name', - anchor:'100%' - }, - { - xtype: 'filefield', - fieldLabel:_maptab_services_manager_shapefile_shp, - name:'shapefile', - id:'maptab_services_manager_shapefile_shp', - anchor:'100%' - }, - { - xtype: 'filefield', - fieldLabel:_maptab_services_manager_shapefile_dbf, - name:'dbf', - id:'maptab_services_manager_shapefile_dbf', - anchor:'100%' - }, - { - xtype: 'filefield', - fieldLabel:_maptab_services_manager_shapefile_shx, - name:'shx', - id:'maptab_services_manager_shapefile_shx', - anchor:'100%' - }, - // { - // xtype: 'filefield', - // fieldLabel:_maptab_services_manager_shapefile_prj, - // name:'prj', - // id:'maptab_services_manager_shapefile_prj', - // anchor:'100%' - // }, - { - xtype:'combo', - loadMask:true, - autoScroll:true, - autoShow: true, - anchor:'100%', - id:'maptab_services_manager_shapefile_projection', - fieldLabel:_maptab_services_manager_shapefile_projection, - store: new Ext.data.SimpleStore({ - fields: ['value','name'], - data:[ - ["EPSG:2100","EPSG:2100"], - ["EPSG:4326","EPSG:4326"], - ["EPSG:3785","EPSG:3785"], - ["EPSG:3857","EPSG:3857"], - ["EPSG:32717","EPSG:32717"] - ] - }), - displayField: 'name', - valueField: 'value', - emptyText:"", - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - editable: false - }, - // { - // xtype:'combo', - // anchor:'100%', - // loadMask:true, - // autoScroll:true, - // autoShow: true, - // id:'maptab_services_manager_shapefile_charset', - // fieldLabel:_maptab_services_manager_shapefile_charset, - // store: new Ext.data.SimpleStore({ - // fields: ['name','value'], - // data:shapefile_charsets - // }), - // displayField: 'name', - // valueField: 'value', - // emptyText:"", - // forceSelection: true, - // triggerAction: 'all', - // selectOnFocus: false, - // mode: 'local', - // editable: false - // }, - { - xtype: 'label', - text: _maptab_services_manager_shapefile_comment - } - ], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_service, - handler:function() - { - - Ext.getCmp('shapefile_service_form_service_grid').setLoading(true); - - var _params = [{ - _serviceType:"SHAPEFILE", - _serviceUrl:'', - _serviceTitle:Ext.getCmp('maptab_services_manager_shapefile_name').getValue(), - _request:"registerService", - _nativeSRS:Ext.getCmp('maptab_services_manager_shapefile_projection').getValue(), - // _charset:Ext.getCmp('maptab_services_manager_shapefile_charset').getValue(), - _username:'', - _password:'' - }] - - Ext.getCmp('maptab_services_manager_shapefile_form').submit({ - url: _proxy_url, - params:{data:Ext.JSON.encode(_params)}, - success: function(result, response){ - - }, - failure: function(form, action){ - - var records = Ext.JSON.decode(action.response.responseText); - - var record = records[0]; - - if(record._errorStatus<0) - { - var _response = record._response; - - shapefile_register_service(_response); - - Ext.getCmp('shapefile_service_form_service_grid').setLoading(false); - } - - } - }); - - - } - } - ] - }, - { - xtype:'gridpanel', - region:'center', - border:true, - minHeight:180, - columnLines:true, - split: true, - id:'shapefile_service_form_service_grid', - store:shapefile_StoreColumnsService.store, - columns:shapefile_StoreColumnsService.columns, - selModel: Ext.create('Ext.selection.CheckboxModel'), - plugins: [{ - ptype: 'rowexpander', - pluginId: 'rowexpandershapefileService', - rowBodyTpl : [ - '
    '+_maptab_services_manager_storecolumns_column_service_abstract+':
    {_serviceAbstract}
    ' - ] - }], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_unregister', - text:_maptab_services_manager_unregister_service, - handler:function() - { - var selected=Ext.getCmp('shapefile_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=(overlayers.length-1);i>=0;i--) - { - if (overlayers[i]._serviceObject._serviceUrl==item.get("_serviceUrl")) - { - if(typeof overlayers[i]._layerObject!=="undefined") - { - maptab_west_layer_remove_node(maptab_west_layer_get_node_from_id(overlayers[i]._layerObject._layerId)); - } - } - } - - Ext.getCmp('shapefile_service_form_service_grid').getStore().remove(item); - }); - } - }, - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_layer, - handler:function() - { - var selected=Ext.getCmp('shapefile_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var _message=_maptab_services_manager_loading_layer_message; - - _message=_message.replace("{_layerTitle}",item.get("_layerTitle")); - - var mask=fn_loadingMask(maptab_services_manager,_message); - - mask.show(); - - shapefile_register_layer(item.get("_serviceObject"),item.get("_serviceObject")._layers); - - Ext.getCmp('shapefile_service_form_service_grid').getView().refresh(); - - mask.hide(); - }); - } - } - ] - } - ] -}); - - -function shapefile_register_service(record) -{ - shapefile_StoreColumnsService.store.add({ - _isSecure:record._isSecure, - _serviceTitle:record._serviceTitle, - _serviceUrl:record._serviceUrl, - _serviceAbstract:record._serviceAbstract, - _version:record._version, - _serviceObject:record, - _nativeSRS:record._nativeSRS - }); -} - -function shapefile_register_layer(_serviceObject,_layerObject) -{ - - if (!mapFindLayerById(_layerObject._layerId)) - { - mapBeforeAddLayer(_serviceObject,_layerObject); - - _layerObject._loadedStatus=1; - - var _attributesFields = _layerObject._attributesFields; - - _attributesFields.forEach(function(entry) { - entry._attributeName = entry._attributeName.name; - }); - - _layerObject._layer=shapefile_map_layer(_serviceObject,_layerObject); - - mapAddLayer(_serviceObject,_layerObject); - - } -} - - -function shapefile_map_layer(_serviceObject, _layerObject) -{ - var _refreshStrategy = new OpenLayers.Strategy.Refresh({force: true, active: true}); - - var style=new OpenLayers.StyleMap({ - "default":new OpenLayers.Style({ - pointRadius: 5, - fillColor: "#"+_layerObject._color, - fillOpacity: 0.6, - strokeColor: "#"+_layerObject._color, - strokeWidth: 1, - strokeOpacity:1 - }), - "select":{ - fillColor: '#a9a8a7', - strokeColor: '#5d7cc4', - strokeWidth: 1, - cursor: 'pointer', - graphicZIndex: 100 - } - }); - - var _strategies=[]; - _strategies.push(new OpenLayers.Strategy.Fixed()); - _strategies.push(_refreshStrategy); - - var service_url=fn_surl(_serviceObject._serviceUrl,_serviceObject._username,_serviceObject._password,'proxy'); - - var layer=new OpenLayers.Layer.Vector( - _layerObject._layerTitle, - { - projection:new OpenLayers.Projection(_layerObject._nativeSRS), - styleMap:style, - rendererOptions: { zIndexing: true }, - _layerObject:_layerObject, - _serviceObject:_serviceObject, - _currentProjection:mapGetCurrentProjection(), - visibility:_layerObject._visibility, - eventListeners: { - "featuresadded": function(evt) - { - var features=evt.features; - - for(var i=0;i', - { - xtype:'button', - text:_maptab_services_manager_service_cancel, - iconCls:'map_general_cancel_btn', - handler:function(btn,e) - { - btn.findParentByType("window").hide(); - } - }, - { - xtype:'button', - text:_maptab_services_manager_register_service, - iconCls:'maptab_services_issecure', - handler:function(btn,e) - { - var _panel=btn.findParentByType("panel").items.items; - - var _username=fn_encrypt(_panel[0].getValue()); - - var _password=fn_encrypt(_panel[1].getValue()); - - if ((_username!="") && (_password!="")) - { - shapefile_register_service(_serviceUrl,_username,_password); - } - - btn.findParentByType("window").hide(); - } - } - ], - items:[ - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_username - }, - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_password - } - ] - }] - }); - - return _w; -} \ No newline at end of file diff --git a/public/js/trash/maptab/maptab_services_manager/wfs.js b/public/js/trash/maptab/maptab_services_manager/wfs.js deleted file mode 100644 index e67926e..0000000 --- a/public/js/trash/maptab/maptab_services_manager/wfs.js +++ /dev/null @@ -1,603 +0,0 @@ -var wfs_StoreColumnsService=new fn_storeColumnsService(); -var wfs_StoreColumnsServiceLayers=new fn_storeColumnsServiceLayers(); - -init_onload_fn.push(wfs_init); - -function wfs_init() -{ - maptab_services_manager_gridpanel_store.add({servicetype: 'WFS',serviceform:wfs_service_form}); - Ext.getCmp("maptab_services_manager_gridpanel_columns_service_type").add(wfs_service_form); -} - -var wfs_service_form=new Ext.Panel({ - xtype:'panel', - id:'wfs_service_form', - title:_maptab_services_manager_service_wfs_title_form, - layout:'border', - border:false, - hidden:true, - listeners:{ - show:function() - { - Ext.getCmp('wfs_service_form_layers_grid').getView().refresh(); - } - }, - items:[ - { - xtype:'panel', - region:'north', - layout:'form', - border:true, - height:80, - items:[ - { - xtype: 'textfield', - fieldLabel:_maptab_services_manager_service_address, - id:'maptab_services_manager_wfs_service_address', - width:300 - } - ], - bbar:['->', - { - xtype:'checkbox', - id:'maptab_services_manager_wfs_service_require_authentication', - boxLabel:_maptab_services_manager_required_authentication - }, - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_service, - handler:function() - { - Ext.getCmp('wfs_service_form_service_grid').setLoading(true); - - if (Ext.getCmp("maptab_services_manager_wfs_service_require_authentication").getValue()) - { - var _w=wfs_serviceCredentialsWindow(Ext.getCmp('maptab_services_manager_wfs_service_address').getValue()); - - _w.show(); - } - else - { - wfs_register_service(Ext.getCmp('maptab_services_manager_wfs_service_address').getValue()); - } - - Ext.getCmp('wfs_service_form_service_grid').setLoading(false); - } - } - ] - }, - { - xtype:'gridpanel', - region:'center', - border:true, - minHeight:180, - columnLines:true, - split: true, - id:'wfs_service_form_service_grid', - store:wfs_StoreColumnsService.store, - columns:wfs_StoreColumnsService.columns, - selModel: Ext.create('Ext.selection.CheckboxModel'), - plugins: [{ - ptype: 'rowexpander', - pluginId: 'rowexpanderwfsService', - rowBodyTpl : [ - '
    '+_maptab_services_manager_storecolumns_column_service_abstract+':
    {_serviceAbstract}
    ' - ] - }], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_unregister', - text:_maptab_services_manager_unregister_service, - handler:function() - { - var selected=Ext.getCmp('wfs_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=(overlayers.length-1);i>=0;i--) - { - if (overlayers[i]._serviceObject._serviceUrl==item.get("_serviceUrl")) - { - if(typeof overlayers[i]._layerObject!=="undefined") - { - maptab_west_layer_remove_node(maptab_west_layer_get_node_from_id(overlayers[i]._layerObject._layerId)); - } - } - } - - Ext.getCmp('wfs_service_form_service_grid').getStore().remove(item); - }); - - Ext.getCmp('wfs_service_form_layers_grid').getStore().removeAll(); - - } - }, - { - xtype:'button', - text:_maptab_services_manager_show_layers, - handler:function(){ - - var selected=Ext.getCmp('wfs_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.getCmp('wfs_service_form_layers_grid').setLoading(true); - - Ext.each(selected,function(item) - { - wfs_fetch_layers(item.get("_serviceObject")); - - }); - - Ext.getCmp('wfs_service_form_layers_grid').setLoading(false); - } - } - ] - }, - { - xtype:'gridpanel', - region:'south', - border:true, - height:200, - split: true, - columnLines:true, - viewConfig:{preserveScrollOnRefresh:true}, - id:'wfs_service_form_layers_grid', - store:wfs_StoreColumnsServiceLayers.store, - columns:wfs_StoreColumnsServiceLayers.columns, - plugins: [{ - ptype: 'rowexpander', - pluginId: 'rowexpanderwfsLayer', - rowBodyTpl : [ - '
    '+_maptab_services_manager_storecolumns_column_service_abstract+':
    {_layerAbstract}
    ' - ] - }], - selModel: Ext.create('Ext.selection.CheckboxModel'), - - tbar: [{ - xtype: 'textfield', - emptyText: _maptab_east_search_panel, - listeners: { - change: function (field) { - var val = field.getValue(), - store = wfs_StoreColumnsServiceLayers.store; - - if (val.length === 0) { - store.clearFilter(); - } else { - store.filterBy(function(record, id){ - if (record.get('_layerTitle').indexOf(val) > -1 || - record.get('_layerName').indexOf(val) > -1) - return record; - } - ) - } - } - } - }], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_unregister', - text:_maptab_services_manager_unregister_layer, - handler:function() - { - var selected=Ext.getCmp('wfs_service_form_layers_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - if (item.get("_layerObject")._loadedStatus>0) - { - var _message=_maptab_services_manager_unregister_layer_message; - - _message=_message.replace("{_layerTitle}",item.get("_layerTitle")); - - _message=_message.replace("{_layerName}",item.get("_layerName")); - - var mask=fn_loadingMask(maptab_services_manager,_message); - - mask.show(); - - maptab_west_layer_remove_node(maptab_west_layer_get_node_from_id(item.get("_layerObject")._layerId)); - - item.get("_layerObject")._loadedStatus=0; - - Ext.getCmp('wfs_service_form_layers_grid').getView().refresh(); - - mask.hide(); - } - }); - - } - }, - { - xtype:'button', - iconCls:'map_general_setting_btn', - text:_maptab_services_manager_settings_layer, - hidden:true, - handler:function() - { - wfs_layer_settings_window.show(); - } - }, - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_layer, - handler:function() - { - var selected=Ext.getCmp('wfs_service_form_layers_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var _message=_maptab_services_manager_loading_layer_message; - - _message=_message.replace("{_layerTitle}",item.get("_layerTitle")); - - _message=_message.replace("{_layerName}",item.get("_layerName")); - - var mask=fn_loadingMask(maptab_services_manager,_message); - - mask.show(); - - wfs_register_layer(item.get("_serviceObject"),item.get("_layerObject")); - - Ext.getCmp('wfs_service_form_layers_grid').getView().refresh(); - - mask.hide(); - }); - } - } - ] - } - ] -}); - -function wfs_map_layer(_serviceObject,_layerObject) -{ - - var style=new OpenLayers.StyleMap({ - "default":new OpenLayers.Style({ - pointRadius: 5, - fillColor: "#"+_layerObject._color, - fillOpacity: 0.6, - strokeColor: "#"+_layerObject._color, - strokeWidth: 1, - strokeOpacity:1 - }), - "select":{ - fillColor: '#a9a8a7', - strokeColor: '#5d7cc4', - strokeWidth: 1, - cursor: 'pointer', - graphicZIndex: 100 - } - }); - - var _refreshStrategy = new OpenLayers.Strategy.Refresh({force: true, active: true}); - - var _strategies=[]; - - _strategies.push(new OpenLayers.Strategy.BBOX({resFactor:1,ratio:0.8})); - - _strategies.push(_refreshStrategy); - - var _saveStrategy; - - if(_layerObject._isEditable) - { - _saveStrategy=new OpenLayers.Strategy.Save(); - - _strategies.push(_saveStrategy); - } - - var layer=new OpenLayers.Layer.Vector( - _layerObject._layerTitle, - { - strategies: _strategies, - styleMap:style, - projection:new OpenLayers.Projection(_layerObject._nativeSRS), - rendererOptions: { zIndexing: true }, - protocol:new OpenLayers.Protocol.WFS({ - // version: _serviceObject._version, - version: '1.1.0', - url:fn_surl(_serviceObject._serviceUrl,_serviceObject._username,_serviceObject._password,'getfeatures'), - srsName:mapGetProjectionCode(_layerObject._nativeSRS), - srsInBBOX:true, - featureType: _layerObject._featureType, - featureNS:_layerObject._featureNS, - geometryName: _layerObject._geometryField - }), - _layerObject:_layerObject, - _serviceObject:_serviceObject, - visibility:_layerObject._visibility - - }, - { - rendererOptions: { zIndexing: true }, - opacity:_layerObject._opacity, - visibility:_layerObject._visibility, - projection:new OpenLayers.Projection(_layerObject._nativeSRS) - } - ); - - layer.id=_layerObject._layerId; - - return layer; -} - -function wfs_create_ogc_filter_request(_layerId, _filter) -{ - - - -} - -function wfs_register_layer(_serviceObject,_layerObject) -{ - if (!mapFindLayerById(_layerObject._layerId)) - { - var r=new fn_get(); - - r._async=false; - - r._data.push({ - _serviceType:"WFS", - _serviceUrl:_serviceObject._serviceUrl, - _request:"registerLayer", - _username:_serviceObject._username, - _password:_serviceObject._password, - _layerName:_layerObject._layerName - }); - - - var record; - - record = config_findConfig(_layerObject,_serviceObject); - - if (!record) - { - var response=Ext.JSON.decode(r.get().responseText); - - record = response[0]._response; - - _layerObject._attributesFields=record._attributes; - - }else{ - - _layerObject._attributesFields=record._attributesFields; - - _layerObject._visibility = record._visibility; - - _layerObject._opacity = record._opacity; - - _layerObject._singleTile = record._singleTile; - } - - if (typeof record._isEditable!=="undefined") - { - _layerObject._isEditable = record._isEditable; - } - - _layerObject._nativeSRS=record._nativeSRS; - - _layerObject._geometryIsMulti=record._geometryIsMulti; - - _layerObject._geometryField=record._geometryField; - - _layerObject._featureType=record._featureType; - - _layerObject._featureNS=record._featureNS; - - _layerObject._xy=fn_determineAxisOrder(record._featureNS); - - mapBeforeAddLayer(_serviceObject,_layerObject); - - if ((_layerObject._nativeSRS) && (_layerObject._geometryField)) - { - _layerObject._isSearchable=true; - - _layerObject._loadedStatus=1; - - }else - { - _layerObject._loadedStatus=2; - } - - _layerObject._layer=wfs_map_layer(_serviceObject,_layerObject); - - mapAddLayer(_serviceObject,_layerObject); - - } - -} - -function wfs_register_service(_serviceUrl,_username,_password) -{ - var r=new fn_get(); - - r._async=false; - - r._data.push({ - _serviceType:"WFS", - _serviceUrl:_serviceUrl, - _request:"registerService", - _username:_username, - _password:_password - }); - - var response; - - try - { - response=Ext.JSON.decode(r.get().responseText); - } - catch(err){return;} - - - switch(response[0]._responseCode) - { - case "401": - - var _w=wfs_serviceCredentialsWindow(_serviceUrl); - - _w.show(); - - break; - - case "200": - - var records=response[0]._response; - - if ((records._version!="") || (records._version!=null)) - { - - wfs_StoreColumnsService.store.add({ - _isSecure:records._isSecure, - _serviceTitle:records._serviceTitle, - _serviceUrl:records._serviceUrl, - _serviceAbstract:records._serviceAbstract, - _version:records._version, - _serviceObject:records - }); - - return records; - } - - break; - - } - -} - -function wfs_serviceCredentialsWindow(_serviceUrl) -{ - var _w=new Ext.Window({ - width:250, - height:120, - modal:true, - shim:true, - title:_maptab_services_manager_service_credentials, - resizable:true, - closeAction:'destroy', - layout:'fit', - items:[{ - xtype:'panel', - layout:'form', - bbar:['->', - { - xtype:'button', - text:_maptab_services_manager_service_cancel, - iconCls:'map_general_cancel_btn', - tabIndex:3, - handler:function(btn,e) - { - btn.findParentByType("window").hide(); - } - }, - { - xtype:'button', - text:_maptab_services_manager_register_service, - iconCls:'maptab_services_issecure', - tabIndex:4, - handler:function(btn,e) - { - var _panel=btn.findParentByType("panel").items.items; - - var _username=fn_encrypt(_panel[0].getValue()); - - var _password=fn_encrypt(_panel[1].getValue()); - - if ((_username!="") && (_password!="")) - { - wfs_register_service(_serviceUrl,_username,_password); - } - - btn.findParentByType("window").hide(); - } - } - ], - items:[ - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_username, - tabIndex:1 - }, - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_password, - inputType:'password', - tabIndex:2 - } - ] - }] - }); - - return _w; -} - -function wfs_fetch_layers(_serviceObject) -{ - if (typeof _serviceObject!=="undefined") { - - wfs_StoreColumnsServiceLayers.store.removeAll(); - - var r = new fn_get(); - - r._async = false; - - r._data.push({ - _serviceType: "WFS", - _serviceUrl: _serviceObject._serviceUrl, - _request: "fetchLayers", - _username: _serviceObject._username, - _password: _serviceObject._password - }); - - var response = Ext.JSON.decode(r.get().responseText); - - var records = response[0]._response._layers; - - Ext.each(records, function (item) { - - item._layerTitle = config_getProperty(item, _serviceObject, "_layerTitle", item._layerTitle); - - item._layerAbstract = config_getProperty(item, _serviceObject, "_layerAbstract", item._layerAbstract); - - wfs_StoreColumnsServiceLayers.store.add({ - _layerId: item._layerId, - _layerName: item._layerName, - _layerTitle: item._layerTitle, - _layerAbstract: item._layerAbstract, - _layerLegend: item._layerLegend, - _loadedStatus: item._loadedStatus, - _layerObject: item, - _serviceObject: _serviceObject - }); - }); - } -} - -var wfs_layer_settings_window=new Ext.Window({ - width:420, - height:300, - modal:true, - shim:true, - title:_maptab_services_manager_layer_settings_window_title, - resizable:true, - closeAction:'hide', - layout:'fit', - items:[{ - xtype:'panel', - layout:'form', - items:[{ - xtype:'textfield' - }] - - }] -}); - - - diff --git a/public/js/trash/maptab/maptab_services_manager/wmc.js b/public/js/trash/maptab/maptab_services_manager/wmc.js deleted file mode 100644 index 95a5b65..0000000 --- a/public/js/trash/maptab/maptab_services_manager/wmc.js +++ /dev/null @@ -1,384 +0,0 @@ -var wmc_StoreColumnsService=new fn_storeColumnsService(); -var wmc_StoreColumnsServiceLayers=new fn_storeColumnsServiceLayers(); - -init_onload_fn.push(wmc_init); - -function wmc_init() -{ - maptab_services_manager_gridpanel_store.add({servicetype: 'WMC',serviceform:wmc_service_form}); - Ext.getCmp("maptab_services_manager_gridpanel_columns_service_type").add(wmc_service_form); -} - -var wmc_service_form=new Ext.Panel({ - xtype:'panel', - title:_maptab_services_manager_service_wmc_title_form, - id:'wmc_service_form', - layout:'border', - border:false, - hidden:true, - items:[ - { - xtype:'form', - region:'north', - border:true, - anchor:'100%', - fileUpload: true, - isUpload: true, - id:'maptab_services_manager_wmc_form', - method:'POST', - enctype:'multipart/form-data', - height:100, - items:[ - { - xtype: 'textfield', - fieldLabel:_maptab_services_manager_service_title, - id:'maptab_services_manager_wmc_service_title', - anchor:'100%' - }, - { - xtype: 'filefield', - fieldLabel:_maptab_services_manager_wmcfile, - name:'wmcfile', - id:'maptab_services_manager_wmcfile', - anchor:'100%', - } - ], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_service, - handler:function() - { - - - - Ext.getCmp('wmc_service_form_service_grid').setLoading(true); - - var _params = [{ - _serviceType:"WMC", - _serviceUrl:'', - _serviceTitle:Ext.getCmp('maptab_services_manager_wmc_service_title').getValue(), - _request:"registerService", - _username:'', - _password:'' - }] - - Ext.getCmp('maptab_services_manager_wmc_form').submit({ - url: _proxy_url, - params:{data:Ext.JSON.encode(_params)}, - success: function(result, response){ - - }, - failure: function(form, action){ - - var records = Ext.JSON.decode(action.response.responseText); - - var record = records[0]; - - if(record._errorStatus<0) - { - var _response = record._response; - - wmc_StoreColumnsService.store.add({ - _isSecure:_response._isSecure, - _serviceTitle:_response._serviceTitle, - _serviceUrl:_response._serviceUrl, - _serviceAbstract:_response._serviceAbstract, - _version:_response._version, - _serviceObject:_response - }); - - Ext.getCmp('wmc_service_form_service_grid').setLoading(false); - } - - } - }); - } - } - ] - }, - { - xtype:'gridpanel', - region:'center', - border:true, - minHeight:180, - columnLines:true, - split: true, - id:'wmc_service_form_service_grid', - store:wmc_StoreColumnsService.store, - columns:wmc_StoreColumnsService.columns, - selModel: Ext.create('Ext.selection.CheckboxModel'), - plugins: [{ - ptype: 'rowexpander', - pluginId: 'rowexpanderWMCService', - rowBodyTpl : [ - '
    '+_maptab_services_manager_storecolumns_column_service_abstract+':
    {_serviceAbstract}
    ' - ] - }], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_layer, - handler:function() - { - - var selected=Ext.getCmp('wmc_service_form_service_grid').getSelectionModel().getSelection(); - - if (selected.length>0) - { - wmc_OptionsWindow().show(); - } - - - } - } - ] - } - ] -}); - -function wmc_OptionsWindow() -{ - var _w=new Ext.Window({ - width:250, - height:120, - modal:true, - shim:true, - title:_maptab_services_manager_add_choices, - resizable:true, - closeAction:'destroy', - layout:'fit', - items:[{ - xtype:'panel', - layout:'form', - bbar:['->', - { - xtype:'button', - text:_maptab_services_manager_service_cancel, - iconCls:'map_general_cancel_btn', - tabIndex:3, - handler:function(btn,e) - { - btn.findParentByType("window").close(); - } - }, - { - xtype:'button', - text:_maptab_services_manager_register_layer, - iconCls:'maptab_services_manager_register', - tabIndex:4, - handler:function(btn,e) - { - var remove_layers = Ext.getCmp("maptab_services_manager_add_choices_remove_layers").getValue(); - - var remove_groups = Ext.getCmp("maptab_services_manager_add_choices_remove_groups").getValue(); - - if (remove_groups==true) - { - wmc_remove_groups(); - }else{ - if(remove_layers==true) - { - wmc_remove_layers(); - } - } - - btn.findParentByType("window").close(); - - wmc_add_layers(); - } - } - ], - items:[ - { - xtype:'checkbox', - labelSeparator: '', - hideLabel: true, - id:'maptab_services_manager_add_choices_remove_groups', - boxLabel: _maptab_services_manager_add_choices_remove_groups, - fieldLabel:_maptab_services_manager_add_choices_remove_groups, - tabIndex:1, - handler:function(obj) - { - if(obj.checked) - { - Ext.getCmp("maptab_services_manager_add_choices_remove_layers").setValue(true); - - Ext.getCmp("maptab_services_manager_add_choices_remove_layers").disable(); - - }else{ - - Ext.getCmp("maptab_services_manager_add_choices_remove_layers").enable(); - - } - } - }, - { - xtype:'checkbox', - labelSeparator: '', - hideLabel: true, - id:'maptab_services_manager_add_choices_remove_layers', - boxLabel: _maptab_services_manager_add_choices_remove_layers, - fieldLabel:_maptab_services_manager_add_choices_remove_layers, - tabIndex:2 - } - ] - }] - }); - - return _w; -} - -function wmc_add_layers() -{ - var selected=Ext.getCmp('wmc_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item){ - - var _obj = item.get("_serviceObject"); - - Ext.each(_obj._layers,function(_layer) - { - var _serviceUrl = _layer._serviceUrl; - - var _serviceType = _layer._serviceType; - - var _layerName = _layer._layerName; - - var _layerTitle = _layer._layerTitle; - - var _visibility = _layer._visibility; - - var _message=_maptab_services_manager_loading_layer_message; - - _message=_message.replace("{_layerTitle}",_layerTitle); - - _message=_message.replace("{_layerName}",_layerName); - - var mask=fn_loadingMask(maptab_services_manager,_message); - - mask.show(); - - switch(_serviceType) - { - case "wmts": - - try{ - - var _serviceObject - - _serviceObject = wmts_StoreColumnsService.store.findRecord('_serviceUrl', _serviceUrl,0,false,true,true); - - if(_serviceObject === null) - { - _serviceObject = wmts_register_service(_serviceUrl,"",""); - }else{ - _serviceObject = _serviceObject.get("_serviceObject"); - } - - wmts_fetch_layers(_serviceObject); - - var _layerObject; - - _layerObject = wmts_StoreColumnsServiceLayers.store.findRecord('_layerName', _layerName,0,false,true,true).get("_layerObject"); - - if (_layerObject) - { - wmts_register_layer(_serviceObject,_layerObject); - } - - }catch(err){} - - break; - - case "wms": - - try{ - - var _serviceObject - - _serviceObject = wms_StoreColumnsService.store.findRecord('_serviceUrl', _serviceUrl,0,false,true,true); - - if(_serviceObject === null) - { - _serviceObject = wms_register_service(_serviceUrl,"",""); - }else{ - _serviceObject = _serviceObject.get("_serviceObject"); - } - - wms_fetch_layers(_serviceObject); - - var _layerObject; - - _layerObject = wms_StoreColumnsServiceLayers.store.findRecord('_layerName', _layerName,0,false,true,true).get("_layerObject"); - - if (_layerObject) - { - wms_register_layer(_serviceObject,_layerObject); - } - - }catch(err){} - - break; - - case "wfs": - - try{ - - var _serviceObject - - _serviceObject = wfs_StoreColumnsService.store.findRecord('_serviceUrl', _serviceUrl,0,false,true,true); - - if(_serviceObject === null) - { - _serviceObject = wfs_register_service(_serviceUrl,"",""); - }else{ - _serviceObject = _serviceObject.get("_serviceObject"); - } - - wfs_fetch_layers(_serviceObject); - - var _layerObject; - - _layerObject = wfs_StoreColumnsServiceLayers.store.findRecord('_layerName', _layerName,0,false,true,true).get("_layerObject"); - - if (_layerObject) - { - wfs_register_layer(_serviceObject,_layerObject); - } - - }catch(err){} - - break; - } - - Ext.getCmp('wmc_service_form_service_grid').getView().refresh(); - - mask.hide(); - - }); - }); -} - -function wmc_remove_layers() -{ - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=(overlayers.length-1);i>=0;i--) - { - if (typeof overlayers[i]._layerObject!=="undefined") - { - maptab_west_layer_remove_node(maptab_west_layer_get_node_from_id(overlayers[i]._layerObject._layerId)); - } - } - -} - -function wmc_remove_groups() -{ - wmc_remove_layers(); - - maptab_west_layer_tree_panel_tree_json_store.getNodeById('maptab_west_layer_tree_panel_tabs_layers_layers_node').removeAll(); -} diff --git a/public/js/trash/maptab/maptab_services_manager/wms.js b/public/js/trash/maptab/maptab_services_manager/wms.js deleted file mode 100644 index bacfdc1..0000000 --- a/public/js/trash/maptab/maptab_services_manager/wms.js +++ /dev/null @@ -1,611 +0,0 @@ -var wms_StoreColumnsService=new fn_storeColumnsService(); -var wms_StoreColumnsServiceLayers=new fn_storeColumnsServiceLayers(); - -init_onload_fn.push(wms_init); - -function wms_init() -{ - maptab_services_manager_gridpanel_store.add({servicetype: 'WMS',serviceform:wms_service_form}); - Ext.getCmp("maptab_services_manager_gridpanel_columns_service_type").add(wms_service_form); -} - -var wms_service_form=new Ext.Panel({ - xtype:'panel', - title:_maptab_services_manager_service_wms_title_form, - id:'wms_service_form', - layout:'border', - border:false, - hidden:true, - listeners:{ - show:function() - { - Ext.getCmp('wms_service_form_layers_grid').getView().refresh(); - } - }, - items:[ - { - xtype:'panel', - region:'north', - layout:'form', - border:true, - height:80, - items:[ - { - xtype: 'textfield', - fieldLabel:_maptab_services_manager_service_address, - id:'maptab_services_manager_wms_service_address', - width:300 - } - ], - bbar:['->', - { - xtype:'checkbox', - id:'maptab_services_manager_wms_service_require_authentication', - boxLabel:_maptab_services_manager_required_authentication - }, - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_service, - handler:function() - { - Ext.getCmp('wms_service_form_service_grid').setLoading(true); - - if (Ext.getCmp("maptab_services_manager_wms_service_require_authentication").getValue()) - { - var _w=wms_serviceCredentialsWindow(Ext.getCmp('maptab_services_manager_wms_service_address').getValue()); - - _w.show(); - } - else - { - wms_register_service(Ext.getCmp('maptab_services_manager_wms_service_address').getValue(),"",""); - } - - Ext.getCmp('wms_service_form_service_grid').setLoading(false); - - } - } - ] - }, - { - xtype:'gridpanel', - region:'center', - border:true, - minHeight:180, - columnLines:true, - split: true, - id:'wms_service_form_service_grid', - store:wms_StoreColumnsService.store, - columns:wms_StoreColumnsService.columns, - selModel: Ext.create('Ext.selection.CheckboxModel'), - plugins: [{ - ptype: 'rowexpander', - pluginId: 'rowexpanderWMSService', - rowBodyTpl : [ - '
    '+_maptab_services_manager_storecolumns_column_service_abstract+':
    {_serviceAbstract}
    ' - ] - }], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_unregister', - text:_maptab_services_manager_unregister_service, - handler:function() - { - var selected=Ext.getCmp('wms_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=(overlayers.length-1);i>=0;i--) - { - if (overlayers[i]._serviceObject._serviceUrl==item.get("_serviceUrl")) - { - if(typeof overlayers[i]._layerObject!=="undefined") - { - maptab_west_layer_remove_node(maptab_west_layer_get_node_from_id(overlayers[i]._layerObject._layerId)); - } - } - } - - Ext.getCmp('wms_service_form_service_grid').getStore().remove(item); - }); - - Ext.getCmp('wms_service_form_layers_grid').getStore().removeAll(); - } - }, - { - xtype:'button', - text:_maptab_services_manager_show_layers, - handler:function(){ - - var selected=Ext.getCmp('wms_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.getCmp('wms_service_form_layers_grid').setLoading(true); - - Ext.each(selected,function(item) - { - wms_fetch_layers(item.get("_serviceObject")); - - }); - - Ext.getCmp('wms_service_form_layers_grid').setLoading(false); - } - } - ] - }, - { - xtype:'gridpanel', - region:'south', - border:true, - height:200, - split: true, - columnLines:true, - viewConfig:{preserveScrollOnRefresh:true}, - id:'wms_service_form_layers_grid', - store:wms_StoreColumnsServiceLayers.store, - columns:wms_StoreColumnsServiceLayers.columns, - plugins: [{ - ptype: 'rowexpander', - pluginId: 'rowexpanderWMSLayer', - rowBodyTpl : [ - '
    '+_maptab_services_manager_storecolumns_column_service_abstract+':
    {_layerAbstract}
    ' - ] - },{ - ptype: 'bufferedrenderer', - trailingBufferZone: 20, - leadingBufferZone: 20 - }], - selModel: Ext.create('Ext.selection.CheckboxModel'), - - tbar: [{ - xtype: 'textfield', - emptyText: _maptab_east_search_panel, - listeners: { - change: function (field) { - var val = field.getValue(), - store = wms_StoreColumnsServiceLayers.store; - - if (val.length === 0) { - store.clearFilter(); - } else { - store.filterBy(function(record, id){ - if (record.get('_layerTitle').indexOf(val) > -1 || - record.get('_layerName').indexOf(val) > -1) - return record; - } - ) - } - } - } - }], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_unregister', - text:_maptab_services_manager_unregister_layer, - handler:function() - { - var selected=Ext.getCmp('wms_service_form_layers_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - if (item.get("_layerObject")._loadedStatus>0) - { - var _message=_maptab_services_manager_unregister_layer_message; - - _message=_message.replace("{_layerTitle}",item.get("_layerTitle")); - - _message=_message.replace("{_layerName}",item.get("_layerName")); - - var mask=fn_loadingMask(maptab_services_manager,_message); - - mask.show(); - - maptab_west_layer_remove_node(maptab_west_layer_get_node_from_id(item.get("_layerObject")._layerId)); - - item.get("_layerObject")._loadedStatus=0; - - Ext.getCmp('wms_service_form_layers_grid').getView().refresh(); - - mask.hide(); - } - }); - - } - }, - { - xtype:'button', - iconCls:'map_general_setting_btn', - text:_maptab_services_manager_settings_layer, - hidden:true, - handler:function() - { - wms_layer_settings_window.show(); - } - }, - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_layer, - handler:function() - { - var selected=Ext.getCmp('wms_service_form_layers_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var _message=_maptab_services_manager_loading_layer_message; - - _message=_message.replace("{_layerTitle}",item.get("_layerTitle")); - - _message=_message.replace("{_layerName}",item.get("_layerName")); - - var mask=fn_loadingMask(maptab_services_manager,_message); - - mask.show(); - - wms_register_layer(item.get("_serviceObject"),item.get("_layerObject")); - - Ext.getCmp('wms_service_form_layers_grid').getView().refresh(); - - mask.hide(); - }); - } - } - ] - } - ] -}); - -function wms_map_layer(_serviceObject,_layerObject) -{ - - var service_url=_serviceObject._serviceUrl; - - if (_serviceObject._isSecure==true) - { - service_url=fn_surl(_serviceObject._serviceUrl,_serviceObject._username,_serviceObject._password,'proxy'); - } - - var transitionEffect = null; - - if (typeof _layerObject._dimensionDefault!=="undefined") - { - if ((_layerObject._dimensionDefault!=null) && (_layerObject._dimensionDefault!="")) - { - transitionEffect = 'resize'; - } - } - - var layer=new OpenLayers.Layer.WMS( - _layerObject._layerTitle, - service_url, - { - layers:_layerObject._layerName, - format:_layerObject._layerFormat, - tiled:_layerObject._tiled, - transparent:_layerObject._transparent, - version:_serviceObject._version, - }, - { - visibility:_layerObject._visibility, - isBaseLayer:_layerObject._isBaseLayer, - transitionEffect:transitionEffect, - opacity:_layerObject._opacity, - singleTile: _layerObject._singleTile, - singleTile: true, - ratio: 1, - yx:{'EPSG:4326':true}, - _layerObject:_layerObject, - _serviceObject:_serviceObject - } - ); - - - layer.id=_layerObject._layerId; - - if (typeof _layerObject._dimensionDefault!=="undefined") - { - if ((_layerObject._dimensionDefault!=null) && (_layerObject._dimensionDefault!="")) - { - var time=_layerObject._dimensionDefault; - - time = time.replace("+0000","Z"); - - layer.mergeNewParams({'time':time}); - } - - } - - if (typeof _layerObject._elevationDefault!=="undefined") - { - if ((_layerObject._elevationDefault!=null) && (_layerObject._elevationDefault!="")) - { - layer.mergeNewParams({'elevation':_layerObject._elevationDefault}); - } - - } - - return layer; -} - -function wms_register_layer(_serviceObject,_layerObject) -{ - if (!mapFindLayerById(_layerObject._layerId)) - { - var r=new fn_get(); - - r._async=false; - - r._data.push({ - _serviceType:"WMS", - _serviceUrl:_serviceObject._serviceUrl, - _request:"registerLayer", - _username:_serviceObject._username, - _password:_serviceObject._password, - _layerName:_layerObject._layerName, - _layerId:_layerObject._layerId - }); - - var record; - - record = config_findConfig(_layerObject,_serviceObject); - - if (!record) - { - var response=Ext.JSON.decode(r.get().responseText); - - record = response[0]._response; - - _layerObject._attributesFields=record._attributes; - - }else{ - - _layerObject._attributesFields=record._attributesFields; - - _layerObject._visibility = record._visibility; - - _layerObject._opacity = record._opacity; - - _layerObject._singleTile = record._singleTile; - } - - _layerObject._nativeSRS=record._nativeSRS; - - _layerObject._supportedEPSG=_serviceObject._supportedEPSG; - - var legend_url=_layerObject._layerLegend; - - if (_serviceObject._isSecure==true) - { - legend_url=fn_surl(_layerObject._layerLegend,_serviceObject._username,_serviceObject._password,"proxy&method=get"); - } - - _layerObject._layerLegend=legend_url; - - _layerObject._xy=fn_determineAxisOrder(record._nativeSRS); - - _layerObject._geometryField=record._geometryField; - - mapBeforeAddLayer(_serviceObject,_layerObject); - - if ((_layerObject._nativeSRS) && (_layerObject._geometryField)) - { - - _layerObject._isSearchable=true; - - _layerObject._loadedStatus=1; - - }else - { - _layerObject._loadedStatus=2; - } - - _layerObject._layer=wms_map_layer(_serviceObject,_layerObject); - - mapAddLayer(_serviceObject,_layerObject); - - - } -} - -function wms_register_service(_serviceUrl,_username,_password) -{ - var r=new fn_get(); - - r._async=false; - - r._data.push({ - _serviceType:"WMS", - _serviceUrl:_serviceUrl, - _request:"registerService", - _username:_username, - _password:_password, - // _projections:map_basemapProjections - }); - - var response; - - try - { - response=Ext.JSON.decode(r.get().responseText); - } - catch(err){return;} - - - switch(response[0]._responseCode) - { - case "401": - - var _w=wms_serviceCredentialsWindow(_serviceUrl); - - _w.show(); - - break; - - case "200": - - var records=response[0]._response; - - if ((records._version!="") || (records._version!=null)) - { - wms_StoreColumnsService.store.add({ - _isSecure:records._isSecure, - _serviceTitle:records._serviceTitle, - _serviceUrl:records._serviceUrl, - _serviceAbstract:records._serviceAbstract, - _version:records._version, - _serviceObject:records - }); - } - return records; - - break; - } -} - - -function wms_serviceCredentialsWindow(_serviceUrl) -{ - var _w=new Ext.Window({ - width:250, - height:120, - modal:true, - shim:true, - title:_maptab_services_manager_service_credentials, - resizable:true, - closeAction:'destroy', - layout:'fit', - items:[{ - xtype:'panel', - layout:'form', - bbar:['->', - { - xtype:'button', - text:_maptab_services_manager_service_cancel, - iconCls:'map_general_cancel_btn', - tabIndex:3, - handler:function(btn,e) - { - btn.findParentByType("window").hide(); - } - }, - { - xtype:'button', - text:_maptab_services_manager_register_service, - iconCls:'maptab_services_issecure', - tabIndex:4, - handler:function(btn,e) - { - var _panel=btn.findParentByType("panel").items.items; - - var _username=fn_encrypt(_panel[0].getValue()); - - var _password=fn_encrypt(_panel[1].getValue()); - - if ((_username!="") && (_password!="")) - { - wms_register_service(_serviceUrl,_username,_password); - } - - _username='portal'; //null; - _password='@dm!n322'; //null; - - btn.findParentByType("window").hide(); - } - } - ], - items:[ - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_username, - tabIndex:1 - }, - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_password, - inputType:'password', - tabIndex:2 - } - ] - }] - }); - - return _w; -} - -function wms_fetch_layers(_serviceObject) -{ - if (typeof _serviceObject!=="undefined") - { - wms_StoreColumnsServiceLayers.store.removeAll(); - - var r=new fn_get(); - - r._async=false; - - r._data.push({ - _serviceType:"WMS", - _serviceUrl:_serviceObject._serviceUrl, - _request:"fetchLayers", - _username:_serviceObject._username, - _password:_serviceObject._password - }); - - var response=Ext.JSON.decode(r.get().responseText); - - var records=response[0]._response._layers; - - - Ext.each(records,function(item) - { - item._layerTitle=config_getProperty(item,_serviceObject,"_layerTitle",item._layerTitle); - - item._layerAbstract=config_getProperty(item,_serviceObject,"_layerAbstract",item._layerAbstract); - - var legend_url=item._layerLegend; - - if (_serviceObject._isSecure==true) - { - legend_url=fn_surl(item._layerLegend,_serviceObject._username,_serviceObject._password,"proxy&method=get"); - } - - wms_StoreColumnsServiceLayers.store.add({ - _layerId:item._layerId, - _layerName:item._layerName, - _layerTitle:item._layerTitle, - _layerAbstract:item._layerAbstract, - _layerLegend:legend_url, - _layerSLDs:item._layerSLDs, - _loadedStatus:item._loadedStatus, - _layerObject:item, - _serviceObject:_serviceObject - }); - }); - } -} - -var wms_layer_settings_window=new Ext.Window({ - width:420, - height:300, - modal:true, - shim:true, - title:_maptab_services_manager_layer_settings_window_title, - resizable:true, - closeAction:'hide', - layout:'fit', - items:[{ - xtype:'panel', - layout:'form', - items:[{ - xtype:'textfield', - fieldLabel:_maptab_services_manager_wms_layer_settings_visibility - }] - - }] -}); - - - diff --git a/public/js/trash/maptab/maptab_services_manager/wmts.js b/public/js/trash/maptab/maptab_services_manager/wmts.js deleted file mode 100644 index 46ef3b2..0000000 --- a/public/js/trash/maptab/maptab_services_manager/wmts.js +++ /dev/null @@ -1,596 +0,0 @@ -var wmts_StoreColumnsService=new fn_storeColumnsService(); -var wmts_StoreColumnsServiceLayers=new fn_storeColumnsServiceLayers(); - -init_onload_fn.push(wmts_init); - -function wmts_init() -{ - maptab_services_manager_gridpanel_store.add({servicetype: 'WMTS',serviceform:wmts_service_form}); - Ext.getCmp("maptab_services_manager_gridpanel_columns_service_type").add(wmts_service_form); -} - -var wmts_service_form=new Ext.Panel({ - xtype:'panel', - id:'wmts_service_form', - layout:'border', - title:_maptab_services_manager_service_wmts_title_form, - border:false, - hidden:true, - listeners:{ - show:function() - { - Ext.getCmp('wmts_service_form_layers_grid').getView().refresh(); - } - }, - items:[ - { - xtype:'panel', - region:'north', - layout:'form', - border:true, - height:80, - items:[ - { - xtype: 'textfield', - fieldLabel:_maptab_services_manager_service_address, - id:'maptab_services_manager_wmts_service_address', - width:300 - } - ], - bbar:['->', - { - xtype:'checkbox', - id:'maptab_services_manager_wmts_service_require_authentication', - boxLabel:_maptab_services_manager_required_authentication - }, - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_service, - handler:function() - { - Ext.getCmp('wmts_service_form_service_grid').setLoading(true); - - if (Ext.getCmp("maptab_services_manager_wmts_service_require_authentication").getValue()) - { - var _w=wmts_serviceCredentialsWindow(Ext.getCmp('maptab_services_manager_wmts_service_address').getValue()); - - _w.show(); - } - else - { - wmts_register_service(Ext.getCmp('maptab_services_manager_wmts_service_address').getValue()); - } - - Ext.getCmp('wmts_service_form_service_grid').setLoading(false); - - } - } - ] - }, - { - xtype:'gridpanel', - region:'center', - border:true, - minHeight:180, - columnLines:true, - split: true, - id:'wmts_service_form_service_grid', - store:wmts_StoreColumnsService.store, - columns:wmts_StoreColumnsService.columns, - selModel: Ext.create('Ext.selection.CheckboxModel'), - plugins: [{ - ptype: 'rowexpander', - pluginId: 'rowexpanderWMTSService', - rowBodyTpl : [ - '
    '+_maptab_services_manager_storecolumns_column_service_abstract+':
    {_serviceAbstract}
    ' - ] - }], - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_unregister', - text:_maptab_services_manager_unregister_service, - handler:function() - { - var selected=Ext.getCmp('wmts_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=(overlayers.length-1);i>=0;i--) - { - if (overlayers[i]._serviceObject._serviceUrl==item.get("_serviceUrl")) - { - if(typeof overlayers[i]._layerObject!=="undefined") - { - maptab_west_layer_remove_node(maptab_west_layer_get_node_from_id(overlayers[i]._layerObject._layerId)); - } - } - } - - Ext.getCmp('wmts_service_form_service_grid').getStore().remove(item); - }); - - Ext.getCmp('wmts_service_form_layers_grid').getStore().removeAll(); - } - }, - { - xtype:'button', - text:_maptab_services_manager_show_layers, - handler:function(){ - - var selected=Ext.getCmp('wmts_service_form_service_grid').getSelectionModel().getSelection(); - - Ext.getCmp('wmts_service_form_layers_grid').setLoading(true); - - Ext.each(selected,function(item) - { - wmts_fetch_layers(item.get("_serviceObject")); - - }); - - Ext.getCmp('wmts_service_form_layers_grid').setLoading(false); - } - } - ] - }, - { - xtype:'gridpanel', - region:'south', - border:true, - height:200, - split: true, - columnLines:true, - viewConfig:{preserveScrollOnRefresh:true}, - id:'wmts_service_form_layers_grid', - store:wmts_StoreColumnsServiceLayers.store, - columns:wmts_StoreColumnsServiceLayers.columns, - plugins: [{ - ptype: 'rowexpander', - pluginId: 'rowexpanderWMTSLayer', - rowBodyTpl : [ - '
    '+_maptab_services_manager_storecolumns_column_service_abstract+':
    {_layerAbstract}
    ' - ] - }], - selModel: Ext.create('Ext.selection.CheckboxModel'), - bbar:['->', - { - xtype:'button', - iconCls:'maptab_services_manager_unregister', - text:_maptab_services_manager_unregister_layer, - handler:function() - { - var selected=Ext.getCmp('wmts_service_form_layers_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - if (item.get("_layerObject")._loadedStatus>0) - { - var _message=_maptab_services_manager_unregister_layer_message; - - _message=_message.replace("{_layerTitle}",item.get("_layerTitle")); - - _message=_message.replace("{_layerName}",item.get("_layerName")); - - var mask=fn_loadingMask(maptab_services_manager,_message); - - mask.show(); - - maptab_west_layer_remove_node(maptab_west_layer_get_node_from_id(item.get("_layerObject")._layerId)); - - item.get("_layerObject")._loadedStatus=0; - - Ext.getCmp('wmts_service_form_layers_grid').getView().refresh(); - - mask.hide(); - } - }); - - } - }, - { - xtype:'button', - iconCls:'map_general_setting_btn', - hidden:true, - text:_maptab_services_manager_settings_layer, - handler:function() - { - wmts_layer_settings_window.show(); - } - }, - { - xtype:'button', - iconCls:'maptab_services_manager_register', - text:_maptab_services_manager_register_layer, - handler:function() - { - var selected=Ext.getCmp('wmts_service_form_layers_grid').getSelectionModel().getSelection(); - - Ext.each(selected,function(item) - { - var _message=_maptab_services_manager_loading_layer_message; - - _message=_message.replace("{_layerTitle}",item.get("_layerTitle")); - - _message=_message.replace("{_layerName}",item.get("_layerName")); - - var mask=fn_loadingMask(maptab_services_manager,_message); - - mask.show(); - - wmts_register_layer(item.get("_serviceObject"),item.get("_layerObject")); - - Ext.getCmp('wmts_service_form_layers_grid').getView().refresh(); - - mask.hide(); - }); - } - } - ] - } - ] -}); - -function wmts_map_layer(_serviceObject,_layerObject) -{ - - var service_url=_serviceObject._serviceUrl; - - if (_serviceObject._isSecure==true) - { - service_url=fn_surl(_serviceObject._serviceUrl,_serviceObject._username,_serviceObject._password,'proxy'); - } - - - var _matrixSet=""; - var _matrixIds=""; - var _tileOrigin=""; - var _projection=""; - - if (_layerObject._extras._matrix[mapGetCurrentProjection()]) - { - _matrixSet = _layerObject._extras._matrix[mapGetCurrentProjection()]._matrixSet; - _matrixIds = _layerObject._extras._matrix[mapGetCurrentProjection()]._matrixIds; - _tileOrigin = new OpenLayers.LonLat(_layerObject._extras._matrix[mapGetCurrentProjection()]._tileOriginX,_layerObject._extras._matrix[mapGetCurrentProjection()]._tileOriginY); - _projection = new OpenLayers.Projection(_layerObject._extras._matrix[mapGetCurrentProjection()]._projection); - } - - var layer= new OpenLayers.Layer.WMTS({ - name: _layerObject._layerTitle, - url:service_url, - layer: _layerObject._layerName, - matrixSet: _matrixSet, - matrixIds: _matrixIds, - format: _layerObject._layerFormat, - transparent: _layerObject._transparent, - tileOrigin: _tileOrigin, - style: "", - isBaseLayer: false, - tileFullExtent:mapLayerBounds(_layerObject), - projection: _projection, - _layerObject:_layerObject, - _serviceObject:_serviceObject, - transitionEffect:null, - visibility:_layerObject._visibility - },{ - transitionEffect:null, - opacity:_layerObject._opacity - }); - - layer.id=_layerObject._layerId; - - - - return layer; -} - -function wmts_changeBasemap(_layer) -{ - - if (_layer._layerObject._extras._matrix[mapGetCurrentProjection()]) - { - _layer.matrixSet=_layer._layerObject._extras._matrix[mapGetCurrentProjection()]._matrixSet; - - var matrixIds = new Array(); - - for (var i=0; i<_layer._layerObject._extras._matrix[mapGetCurrentProjection()]._matrixIds.length; ++i) - { - matrixIds[i] = {identifier: _layer._layerObject._extras._matrix[mapGetCurrentProjection()]._matrixIds[i]}; - } - - _layer.matrixIds=matrixIds; - - _layer.tileOrigin=new OpenLayers.LonLat(_layer._layerObject._extras._matrix[mapGetCurrentProjection()]._tileOriginX,_layer._layerObject._extras._matrix[mapGetCurrentProjection()]._tileOriginY); - - _layer.tileFullExtent=mapLayerBounds(_layer._layerObject); - - _layer.projection=new OpenLayers.Projection(_layer._layerObject._extras._matrix[mapGetCurrentProjection()]._projection); - - _layer.redraw(); - } -} - - -function wmts_register_layer(_serviceObject,_layerObject) -{ - if (!mapFindLayerById(_layerObject._layerId)) - { - var r=new fn_get(); - - r._async=false; - - r._data.push({ - _serviceType:"WMTS", - _serviceUrl:_serviceObject._serviceUrl, - _request:"registerLayer", - _username:_serviceObject._username, - _password:_serviceObject._password, - _layerName:_layerObject._layerName - }); - - var response=Ext.JSON.decode(r.get().responseText); - - var record=response[0]._response; - - var _matrix=new Array(); - - var _supportedEPSG=new Array(); - - Ext.each(record,function(item) - { - if(item._matrixEPSG === 'urn:ogc:def:crs:EPSG::3857' || item._matrixEPSG === 'EPSG:3857' - || item._matrixEPSG === 'urn:ogc:def:crs:EPSG::4326' || item._matrixEPSG === 'EPSG:4326' - || item._matrixEPSG === 'urn:ogc:def:crs:EPSG::900913' || item._matrixEPSG === 'EPSG:900913'){ - - _matrix[mapGetProjectionCode(item._matrixEPSG)]={ - _matrixSet:item._matrixSet, - _matrixIds:item._matrixIds, - _tileOriginX:item._topLeftCornerX, - _tileOriginY:item._topLeftCornerY, - _projection:item._matrixEPSG - } - - _supportedEPSG.push(mapGetProjectionCode(item._matrixEPSG)); - } - - }); - - _layerObject._extras={ - _matrix:_matrix - }; - - - var _configRecord; - - _configRecord = config_findConfig(_layerObject,_serviceObject); - - if (!_configRecord){ - - }else{ - - _layerObject._visibility = _configRecord._visibility; - - _layerObject._opacity = _configRecord._opacity; - } - - _layerObject._loadedStatus=1; - - _layerObject._supportedEPSG=_supportedEPSG; - - mapBeforeAddLayer(_serviceObject,_layerObject); - - _layerObject._layer=wmts_map_layer(_serviceObject,_layerObject); - - mapAddLayer(_serviceObject,_layerObject); - } - -} - -function wmts_register_service(_serviceUrl,_username,_password) -{ - var r=new fn_get(); - - r._async=false; - - r._data.push({ - _serviceType:"WMTS", - _serviceUrl:_serviceUrl, - _request:"registerService", - _username:_username, - _password:_password - }); - - var response; - - try - { - response=Ext.JSON.decode(r.get().responseText); - } - catch(err){return;} - - - switch(response[0]._responseCode) - { - case "401": - - var _w=wmts_serviceCredentialsWindow(_serviceUrl); - - _w.show(); - - break; - - case "200": - - var records=response[0]._response; - - if ((records._version!="") || (records._version!=null)) - { - - wmts_StoreColumnsService.store.add({ - _isSecure:records._isSecure, - _serviceTitle:records._serviceTitle, - _serviceUrl:records._serviceUrl, - _serviceAbstract:records._serviceAbstract, - _version:records._version, - _serviceObject:records - }); - - return records; - } - break; - - } -} - - -function wmts_serviceCredentialsWindow(_serviceUrl) -{ - var _w=new Ext.Window({ - width:250, - height:120, - modal:true, - shim:true, - title:_maptab_services_manager_service_credentials, - resizable:true, - closeAction:'destroy', - layout:'fit', - items:[{ - xtype:'panel', - layout:'form', - bbar:['->', - { - xtype:'button', - text:_maptab_services_manager_service_cancel, - iconCls:'map_general_cancel_btn', - tabIndex:3, - handler:function(btn,e) - { - btn.findParentByType("window").hide(); - } - }, - { - xtype:'button', - text:_maptab_services_manager_register_service, - iconCls:'maptab_services_issecure', - tabIndex:4, - handler:function(btn,e) - { - var _panel=btn.findParentByType("panel").items.items; - - var _username=fn_encrypt(_panel[0].getValue()); - - var _password=fn_encrypt(_panel[1].getValue()); - - if ((_username!="") && (_password!="")) - { - wfs_register_service(_serviceUrl,_username,_password); - } - - btn.findParentByType("window").hide(); - } - } - ], - items:[ - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_username, - tabIndex:1 - }, - { - xtype:'textfield', - fieldLabel:_maptab_services_manager_service_password, - inputType:'password', - tabIndex:2 - } - ] - }] - }); - - return _w; -} - -function wmts_fetch_layers(_serviceObject) -{ - if(_serviceObject) - { - wmts_StoreColumnsServiceLayers.store.removeAll(); - - var r=new fn_get(); - - r._async=false; - - r._data.push({ - _serviceType:"WMTS", - _serviceUrl:_serviceObject._serviceUrl, - _request:"fetchLayers", - _username:_serviceObject._username, - _password:_serviceObject._password - }); - - var response=Ext.JSON.decode(r.get().responseText); - - var records=response[0]._response._layers; - - Ext.each(records,function(item) - { - item._layerTitle=config_getProperty(item,_serviceObject,"_layerTitle",item._layerTitle); - - item._layerAbstract=config_getProperty(item,_serviceObject,"_layerAbstract",item._layerAbstract); - - wmts_StoreColumnsServiceLayers.store.add({ - _layerId:item._layerId, - _layerName:item._layerName, - _layerTitle:item._layerTitle, - _layerAbstract:item._layerAbstract, - _layerLegend:item._layerLegend, - _loadedStatus:item._loadedStatus, - _layerObject:item, - _serviceObject:_serviceObject - }); - }); - } -} - -var wmts_layer_settings_window=new Ext.Window({ - width:420, - height:300, - modal:true, - shim:true, - title:_maptab_services_manager_layer_settings_window_title, - resizable:true, - closeAction:'hide', - layout:'fit', - items:[{ - xtype:'panel', - layout:'form', - items:[{ - xtype:'textfield' - }] - - }] -}); - -init_onload_fn.push(init_wmts_OnChangeBaseLayer); - -function init_wmts_OnChangeBaseLayer() -{ - mapOnChangeBaseLayer(wmts_OnChangeBaseLayer); -} - -function wmts_OnChangeBaseLayer(_previousProjection,_currentProjection) -{ - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=0;i=0) - { - var _projection=_config._mapProjections[_projectionIndex]._epsg; - - var _projectionTitle=_config._mapProjections[_projectionIndex]._title; - - _projectionStoreData.push({_epsg:_projection,_title:_projectionTitle}); - } - } - - var _setCoordinatesForm={ - xtype:'panel', - layout:'form', - border:false, - bbar:['->', - { - xtype:'button', - text:_maptab_toolbar_general_setCoordinates_goToBtn, - id:'maptab_toolbar_general_setCoordinates_goToBtn', - disabled:true, - handler:function() - { - var lon=Ext.getCmp("maptab_toolbar_general_setCoordinates_lon").getValue(); - - var lat=Ext.getCmp("maptab_toolbar_general_setCoordinates_lat").getValue(); - - var _choosen_projection=Ext.getCmp("maptab_toolbar_general_setCoordinates_combo").getValue(); - - maptab_toolbar_general_setCoordinates(lon,lat,_choosen_projection); - } - }, - { - xtype:'button', - text:_maptab_toolbar_general_setCoordinates_clearBtn, - id:'_maptab_toolbar_general_setCoordinates_clearBtn', - disabled:false, - handler:function() - { - if(maptab_toolbar_general_update_setCoordinates_marker_layer) - { - maptab_toolbar_general_update_setCoordinates_marker_layer.destroy(); - - maptab_toolbar_general_update_setCoordinates_marker_layer = null; - } - - } - - } - ], - items:[ - { - xtype:'numberfield', - id:'maptab_toolbar_general_setCoordinates_lon', - emptyText:_maptab_toolbar_general_setCoordinates_lon_label, - allowBlank:false, - hideTrigger: true, - decimalPrecision:10, - listeners:{ - "change":maptab_toolbar_general_update_setCoordinatesValidation - } - }, - { - xtype:'numberfield', - id:'maptab_toolbar_general_setCoordinates_lat', - emptyText:_maptab_toolbar_general_setCoordinates_lat_label, - allowBlank:false, - hideTrigger: true, - decimalPrecision:10, - listeners:{ - "change":maptab_toolbar_general_update_setCoordinatesValidation - } - }, - { - xtype:'combobox', - id:'maptab_toolbar_general_setCoordinates_combo', - store:new Ext.data.Store({ - fields: ['_epsg','_title'], - data:_projectionStoreData - }), - emptyText:_maptab_toolbar_general_setCoordinates_projection, - value:'', - displayField: '_title', - valueField: '_epsg', - forceSelection: true, - allowBlank:false, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - editable: false, - listeners:{ - "select":maptab_toolbar_general_update_setCoordinatesValidation - } - } - ] - }; - - Ext.getCmp("maptab_toolbar_general_setCoordinates_window").add(_setCoordinatesForm); -} - -function maptab_toolbar_general_update_setCoordinatesValidation() -{ - - - if ((Ext.getCmp("maptab_toolbar_general_setCoordinates_lon").getValue()!="") && (Ext.getCmp("maptab_toolbar_general_setCoordinates_combo").getValue()!=null) && (Ext.getCmp("maptab_toolbar_general_setCoordinates_lat").getValue()!="")) - { - Ext.getCmp("maptab_toolbar_general_setCoordinates_goToBtn").enable(); - }else - { - Ext.getCmp("maptab_toolbar_general_setCoordinates_goToBtn").disable(); - } -} - - -function fn_maptab_toolbar_general_handle_zoom_in_out() -{ - - if (mapGetZoom()<=0) - { - Ext.getCmp("maptab_toolbar_general_zoomIn").enable(); - Ext.getCmp("maptab_toolbar_general_zoomByArea").enable(); - Ext.getCmp("maptab_toolbar_general_zoomOut").disable(); - } - else if (mapGetZoom()==(mapZoomLevels()-1)) - { - Ext.getCmp("maptab_toolbar_general_zoomIn").disable(); - Ext.getCmp("maptab_toolbar_general_zoomByArea").disable(); - fn_toggleControl('zoomByArea',false); - Ext.getCmp("maptab_toolbar_general_zoomOut").enable(); - } - else - { - Ext.getCmp("maptab_toolbar_general_zoomIn").enable(); - Ext.getCmp("maptab_toolbar_general_zoomByArea").enable(); - Ext.getCmp("maptab_toolbar_general_zoomOut").enable(); - } - -} - -function fn_maptab_toolbar_general_setCoordinates(state) -{ - if (state) - { - maptab_toolbar_general_setCoordinates_win.show(); - - Ext.getCmp("maptab_toolbar_general_setCoordinates_window").removeAll(); - - maptab_toolbar_general_update_setCoordinates(); - } - else - { - if(maptab_toolbar_general_update_setCoordinates_marker_layer) - { - //maptab_toolbar_general_update_setCoordinates_marker_layer.destroy(); - } - - maptab_toolbar_general_setCoordinates_win.hide(); - } -} - -var maptab_toolbar_general_getCoordinates_win=new Ext.Window({ - width:230, - height:130, - maxWidth:230, - maxHeight:350, - minHeight:130, - shim:true, - title:_maptab_toolbar_general_getCoordinates, - iconCls:'maptab_toolbar_general_getCoordinates', - id:'maptab_toolbar_general_getCoordinates_id', - resizable:{ - listeners:{ - resize:function() - { - Ext.getCmp('maptab_mapPanel').getEl().unmask(); - }, - beforeresize:function() - { - Ext.getCmp('maptab_mapPanel').getEl().mask().dom.style.zIndex = Ext.getCmp("maptab_toolbar_general_getCoordinates_id").getEl().dom.style.zIndex; - } - } - }, - constrainTo:'maptab_map', - autoRender:false, - constrain:true, - x:10, - y:100, - closeAction:'hide', - layout:'fit', - items:[{ - xtype:'panel', - layout:'fit', - autoScroll:true, - id:'maptab_toolbar_general_getCoordinates_panel' - }], - listeners:{ - close:function() - { - Ext.getCmp('maptab_toolbar_general_getCoordinates').toggle(false); - - Ext.getCmp('maptab_mapPanel').getEl().unmask(); - } - } -}); - -function maptab_toolbar_general_update_getCoordinates(evt) -{ - if (evt) - { - var _config=new _config_init_map(); - - var _record=maptab_west_general_settings_store.findRecord("_generalSettingId", "maptab_west_general_settings_data_get_coordinates_projections"); - - var _projections=_record.get("_generalSettingValue").split(/,\s*/); - - var _showCoordinates=[]; - - for(var i=0;i<_projections.length;i++) - { - var _projectionIndex=fn_objIndexOf(_config._mapProjections,"_title",_projections[i]); - - if (_projectionIndex>=0) - { - var _projection=_config._mapProjections[_projectionIndex]._epsg; - - var _numDigits=_config._mapProjections[_projectionIndex]._numDigits; - - var _coordinates=mapCoordinatesFromPixels(evt.xy); - - if (_projection!=mapGetCurrentProjection()) - { - _coordinates.transform(new OpenLayers.Projection(mapGetCurrentProjection()), new OpenLayers.Projection(_projection)); - } - - var _projectionText=""+_projections[i]+":
    "+_coordinates.lon.toFixed(_numDigits)+", "+_coordinates.lat.toFixed(_numDigits); - - _showCoordinates.push(_projectionText); - - } - } - - Ext.getCmp("maptab_toolbar_general_getCoordinates_panel").update(_showCoordinates.join("

    ")); - } -} - -function fn_maptab_toolbar_general_getCoordinates(state) -{ - if (state) - { - Ext.getCmp("maptab_toolbar_general_getCoordinates_panel").update(_maptab_toolbar_general_getCoordinates_empty_text); - - maptab_toolbar_general_getCoordinates_win.show(); - - maptab_toolbar_general_update_getCoordinates(); - - mapOnClick(maptab_toolbar_general_update_getCoordinates); - - Ext.get('maptab_map').setStyle("cursor", "crosshair"); - } - else - { - maptab_toolbar_general_getCoordinates_win.hide(); - - mapUnregisterEvents("click",maptab_toolbar_general_update_getCoordinates); - - Ext.get('maptab_map').setStyle("cursor", "initial"); - } -} - -function maptab_toolbar_general_setCoordinates(lon,lat,projection) -{ - - - if (projection!="") - { - if((lon!="") && (lat!="")) - { - - var lonLat = new OpenLayers.LonLat(lon,lat); - - if (mapGetCurrentProjection()!=projection) - { - lonLat.transform(new OpenLayers.Projection(projection), new OpenLayers.Projection(mapGetCurrentProjection())); - } - - var _record=maptab_west_general_settings_store.findRecord("_generalSettingId", "maptab_west_general_settings_data_set_coordinates_zoom"); - - var zoom=_record.get("_generalSettingValue"); - - mapSetCenter(lonLat.lon,lonLat.lat,zoom); - - var _showMarker=maptab_west_general_settings_store.findRecord("_generalSettingId", "maptab_west_general_settings_data_set_coordinates_marker"); - - _showMarker=_showMarker.get("_generalSettingValue"); - - if(_showMarker=="true") - { - - if (maptab_toolbar_general_update_setCoordinates_marker_layer){}else{ - - maptab_toolbar_general_update_setCoordinates_marker_layer = new OpenLayers.Layer.Markers("maptab_toolbar_general_update_setCoordinates_marker_layer"); - - map.addLayer(maptab_toolbar_general_update_setCoordinates_marker_layer); - } - - var size = new OpenLayers.Size(24,32); - - var offset = new OpenLayers.Pixel(-(size.w/2), -size.h); - - var icon = new OpenLayers.Icon(host+'images/marker.png', size, offset); - - maptab_toolbar_general_update_setCoordinates_marker_layer.addMarker(new OpenLayers.Marker(lonLat,icon)); - } - - } - } -} diff --git a/public/js/trash/maptab/maptab_toolbar_general/map_controls_featureInfo.js b/public/js/trash/maptab/maptab_toolbar_general/map_controls_featureInfo.js deleted file mode 100644 index 64c9d39..0000000 --- a/public/js/trash/maptab/maptab_toolbar_general/map_controls_featureInfo.js +++ /dev/null @@ -1,519 +0,0 @@ -var map_controls_featureInfo_TimeOut; -var map_controls_featureInfo_moveEvent_oldX; -var map_controls_featureInfo_moveEvent_oldY; -var map_controls_featureInfo_moveEvent_eXY; -var map_controls_featureInfo_request; -var map_controls_featureInfo_request_type = 0; -var map_controls_featureInfo_html_ToolTip = ""; -var map_controls_freatureInfo_win_getInfo; -var map_contextMenu_deactivate_featureInfo = { - text: _map_contextMenu_deactivate_featureInfo, - id: '_map_contextMenu_deactivate_featureInfo', - handler: function () { - Ext.getCmp("maptab_toolbar_general_featureInfo").toggle(false); - } -}; - -// This function is called when feature info button is toggled active -function map_controls_featureInfo() { - console.debug('clicked feature info'); - mapUnregisterEvents("click", map_controls_featureInfo_clickEvent); - - var state = Ext.getCmp("maptab_toolbar_general_featureInfo").pressed; - map_contextMenu.remove("_map_contextMenu_deactivate_featureInfo"); - - document.onkeydown = null; - - if (state) { - map_controls_featureInfo_request_type = 1; - map_controls_featureInfo_request = new fn_get(); - - mapOnClick(map_controls_featureInfo_clickEvent); - mapUnregisterEvents("mousemove", map_controls_featureInfo_moveEvent); - - map_contextMenu.add(map_contextMenu_deactivate_featureInfo); - - //Ext.getCmp('maptab_east').expand(); - Ext.getCmp('maptab_east_feature_panel').expand(); - - document.onkeydown = function (evt) { - evt = evt || window.event; - if (evt.keyCode == 27) { - Ext.getCmp("maptab_toolbar_general_featureInfo").toggle(false); - } - } - } else { - map_controls_featureInfo_request_type = 0; - map_controls_featureInfo_request = new fn_get(); - - var _config = maptab_west_general_settings_store.findRecord("_generalSettingId", "maptab_west_general_settings_data_set_mousemouve_info").data._generalSettingRawValue; - - if(_config == 'true'){ - mapOnMouseMove(map_controls_featureInfo_moveEvent); - } - } -} - -var map_highlightLayerFeatureInfo; -init_onload_fn.push(init_map_controls_featureInfo); - -function init_map_controls_featureInfo() { - map_highlightLayerFeatureInfo = new OpenLayers.Layer.Vector("map_highlightLayerFeatureInfo", { - styleMap: new OpenLayers.StyleMap({ - "default": new OpenLayers.Style({ - pointRadius: 5, - fillColor: "#FFCB50", - fillOpacity: 0.4, - strokeColor: "#FF9428", - strokeWidth: 1, - strokeOpacity: 0.8 - }) - }) - }); - - map.addLayer(map_highlightLayerFeatureInfo); - - map_controls_featureInfo_request_type = 0; - map_controls_featureInfo_request = new fn_get(); - - var _config = maptab_west_general_settings_store.findRecord("_generalSettingId", "maptab_west_general_settings_data_set_mousemouve_info").data._generalSettingRawValue; - - if(_config == 'true'){ - mapOnMouseMove(map_controls_featureInfo_moveEvent); - } -} - -function map_controls_featureInfo_clickEvent(e) { - map_controls_featureInfo_moveEvent_eXY = e; - map_controls_featureInfo_query(); -} - - -function map_controls_featureInfo_moveEvent(e) { - if (e && ((e.xy.x != map_controls_featureInfo_moveEvent_oldX) || (e.xy.y != map_controls_featureInfo_moveEvent_oldY))) { - - try{ - Ext.getCmp('map_controls_freatureInfo_win_getInfo_id').destroy(); - }catch(err){} - - map_controls_featureInfo_moveEvent_oldX = e.xy.x; - map_controls_featureInfo_moveEvent_oldY = e.xy.y; - map_controls_featureInfo_moveEvent_eXY = e; - - clearTimeout(map_controls_featureInfo_TimeOut); - - map_controls_featureInfo_TimeOut = setTimeout(map_controls_featureInfo_query, 50); - } -} - -var map_controls_eastPanel_foundFeaturesGrid_mask; - -function map_controls_featureInfo_query() { - map_highlightLayerFeatureInfo.removeAllFeatures(); - - var _queryObject = map_controls_featureInfo_fetch_querable_layers(); - - if (_queryObject.length > 0) { - map_controls_featureInfo_request._async = true; - //var lonlat = map.getLonLatFromPixel(map_controls_featureInfo_moveEvent_eXY.xy); - lonlat = { lon: 2872509.9917484, lat: 4745758.809697 }; - var map_prj = mapGetCurrentProjection(); - - if(map_prj === 'EPSG:900913'){ - map_prj = 'EPSG:3857'; - } - - // HCMR code - let bounds = mapL.getBounds(); - let b = boundsToExtent(bounds._northEast, bounds._southWest, mapL.options.crs); - let btx = [b.left,b.bottom,b.right,b.top]; - - map_controls_featureInfo_request._query = fn_createGetQuery({ - _width: Math.round(mapL.getSize().x), //Math.round(mapGetSize().w), - _height: Math.round(mapL.getSize().y), //Math.round(mapGetSize().h), - _x: Math.round(67.26666259765625), //Math.round(map_controls_featureInfo_moveEvent_eXY.xy.x), - _y: Math.round(126.53334045410156), //Math.round(map_controls_featureInfo_moveEvent_eXY.xy.y), - _bbox: btx.toString(), // mapGetExtent().toString(), - _srs: map_prj, - _lon: lonlat.lon, - _lat: lonlat.lat - }); - - map_controls_featureInfo_request._data = _queryObject; - map_controls_featureInfo_request._timeout = 15000; - map_controls_featureInfo_request._success = map_controls_featureInfo_success; - map_controls_featureInfo_request._failure = map_controls_featureInfo_failure; - - if (map_controls_featureInfo_request_type == 1) { - map_controls_eastPanel_foundFeaturesGrid_mask.show(); - } - - debugger; - map_controls_featureInfo_request.get(); - } -} - -function map_controls_featureInfo_failure(_response, _opts) { - map_controls_eastPanel_foundFeaturesGrid_mask.hide(); -} - -// executes only when the proxy php returns a response after using a query -// calls the popup afterwards -function map_controls_featureInfo_success(_response, _opts) { - console.debug("current response to be used is: ", _response); - var _response = Ext.JSON.decode(_response.responseText); - var _data = new Array(); - - Ext.each(_response, function (item) { - Ext.each(item._response._attributes, function (record) { - try{ - var _attributesFields = new Array(); - - for (var k in mapGetFeatureByFid(record[0]._layerId, record[0]._featureId).attributes) { - _attributesFields.push({ - "_attributeName": k.toString(), - "_attributeType": "string", - "_attributeTranslation": null, - "_attributeValue": null, - "_attributeEditor": null, - "_attributeIsSortable": true, - "_attributeIsEditable": true, - "_attributeOrder": 0, - "_attributeIsVisible": true, - "_attributeIsSearchable": true, - "_attributeIsGeometry": false, - "_attributeVisible": true, - "_geometryIsMulti": false, - "_attributeShowOnSummary": false - }); - - record[0][k.toString()] = mapGetFeatureByFid(record[0]._layerId, record[0]._featureId).attributes[k]; - } - - var _record = fn_createAttributeSummary(record[0], _attributesFields); - - _data.push(_record); - } - catch (err){ - try { - - var _record = fn_createAttributeSummary(record[0], mapFindLayerById(item._response._layerId)._layerObject._attributesFields); - _data.push(_record); - } catch (err) { - console.log("no such layer"); - } - } - - }); - }); - - if (map_controls_featureInfo_request_type == 1) { - map_controls_foundFeaturesGrid.getStore().loadData(_data); - map_controls_eastPanel_foundFeaturesGrid_mask.hide(); - - var countRecords = map_controls_foundFeaturesGrid.getStore().getCount(); - - if (countRecords > 0) { - var _record = map_controls_foundFeaturesGrid.getStore().getAt(0); - var _feature = fn_featureObject(_record); - - map_controls_foundFeaturesGrid.getView().select(_record); - - if (mapFindLayerById(_feature._layerId)._layerObject._nativeSRS != "") { - fn_callFeatureFnFromGrid(_feature._featureId, _feature._layerId, _feature._srsName, _feature._featureUrl, _feature._featureGeomFormat, 'getInfo'); - } - } - - countRecords = " (" + countRecords + ")"; - - Ext.getCmp("maptab_east_hover_feature_panel").setTitle(_maptab_east_hover_feature_panel + countRecords); - } - - if (map_controls_featureInfo_request_type == 0) { - - try{ - var get_info_count_ToolTip = 0; - map_controls_featureInfo_html_ToolTip = ''; - - for (var k in _data[0]) { - if (get_info_count_ToolTip <= Object.keys(_data[0]).length) { - var b = k.toString(); - var f = b; - var c = _data[0][b].toString(); - if(f == '_summary'){ - map_controls_featureInfo_html_ToolTip = c; - } - } - else { - map_controls_featureInfo_html_ToolTip = map_controls_featureInfo_html_ToolTip.toString(); - break; - } - - get_info_count_ToolTip++; - } - - }catch(err) { - map_controls_featureInfo_html_ToolTip = ''; - } - - if (map_controls_featureInfo_html_ToolTip != "") { - - try{ - Ext.getCmp('map_controls_freatureInfo_win_getInfo_id').destroy(); - }catch(err){} - - map_controls_freatureInfo_win_getInfo = new Ext.Window({ - id: 'map_controls_freatureInfo_win_getInfo_id', - layout: 'fit', - renderTo: map.div.id, - border: false, - html: map_controls_featureInfo_html_ToolTip, - closable: false, - floating: true, - draggable: false, - width: 200, - resizable: false, - autoDestroy: true - }); - - map_controls_freatureInfo_win_getInfo.show(); - //map_controls_freatureInfo_win_getInfo.setPosition(map_controls_featureInfo_moveEvent_eXY.xy.x + 5, map_controls_featureInfo_moveEvent_eXY.xy.y + 5); - } - } - // toggle feature info button inactive - Ext.getCmp('maptab_toolbar_general_featureInfo').toggle(); -} - - -var map_controls_foundFeaturesGrid_Columns = [ - { - _attributeName: "_featureId", - _attributeSortable: true, - _attributeType: "string", - _attributeTranslation: "", - hidden: true, - hideable: false - }, - { - _attributeName: "_layerId", - _attributeSortable: true, - _attributeType: "string", - _attributeTranslation: "", - hidden: true, - hideable: false - }, - { - _attributeName: "_featureGeomFormat", - _attributeSortable: true, - _attributeType: "string", - _attributeTranslation: "", - hidden: true, - hideable: false - }, - { - _attributeName: "_summary", - _attributeSortable: true, - _attributeType: "string", - _attributeTranslation: _feature_Attributes_Translations_Summary, - flex: 3 - } -]; - -var map_controls_foundFeaturesGrid_Store = fn_createAttributesStore(fn_featureColumnModelForGrid(map_controls_foundFeaturesGrid_Columns)); - -map_controls_foundFeaturesGrid_Store.group("_layerId"); - -var map_controls_foundFeaturesGrid = Ext.create('Ext.grid.Panel', - { - border: false, - columnLines: true, - selModel: Ext.create('Ext.selection.CheckboxModel', {mode: 'SIMPLE', checkOnly: true}), - store: map_controls_foundFeaturesGrid_Store, - columns: fn_createAttributesColumnModel(fn_featureColumnModelForGrid(map_controls_foundFeaturesGrid_Columns)), - features: [{ - ftype: 'grouping', - groupHeaderTpl: [ - '{name:this.formatName}', - { - formatName: function (name) { - return mapFindLayerById(name)._layerObject._layerTitle + " (" + mapFindLayerById(name)._serviceObject._serviceType + ")"; - } - } - ] - }], - // tbar: fn_createFetureGridTopBar(), - listeners: { - select: function (row, record, index, eOpts) { - var _feature = fn_featureObject(record); - - fn_featureHighlightFeatureInfo(_feature); - - }, - deselect: function (row, record, index, eOpts) { - var _feature = fn_featureObject(record); - - fn_featureUnHiglightedFeatureInfo(_feature); - } - } - }); - -function fn_featureHighlightFeatureInfo(_feature) { - var _theFeature = fn_fetchGML(_feature); - - if (typeof _theFeature !== "undefined") { - var _f = _theFeature.clone(); - - _f.fid = _theFeature.fid; - - map_highlightLayerFeatureInfo.addFeatures(_f); - } -} - -function fn_featureUnHiglightedFeatureInfo(_feature) { - map_highlightLayerFeatureInfo.removeFeatures([mapGetFeatureByFid(map_highlightLayerFeatureInfo.id, _feature._featureId)]); -} - -// Regards panel pop up on the right side -function init_map_controls_eastPanel_foundFeaturesGrid() { - var featuresPanel = { - xtype: 'panel', - region: 'center', - layout: 'fit', - title: _maptab_east_hover_feature_panel, - id: 'maptab_east_feature_panel', - iconCls: 'maptab_accordion_icon', - items: [{ - xtype: 'panel', - layout: 'fit', - id: 'maptab_east_hover_feature_panel', - items: [ - map_controls_foundFeaturesGrid] - }] - } - - - Ext.getCmp('maptab_east_south').add(featuresPanel); - - fn_grid_results_ids_array.push(map_controls_foundFeaturesGrid.id); - - map_controls_eastPanel_foundFeaturesGrid_mask = fn_loadingMask(Ext.getCmp('maptab_east_hover_feature_panel'), _mask_loading_message_default); -} - -function map_controls_featureInfo_fetch_querable_layers() { - var overlayers = map.getLayersBy("isBaseLayer", false); - - var features = [], targets = [], layers = [], layer, target, feature, i, len, b = []; - - for (var i = overlayers.length - 1; i >= 0; i--) { - layer = overlayers[i]; - - features = [] - - if (layer.div.style.display !== "none") { - if ((layer instanceof OpenLayers.Layer.Vector) && (typeof layer._layerObject !== "undefined")) { - - if (layer._layerObject._isQueryable) { - target = document.elementFromPoint(map_controls_featureInfo_moveEvent_eXY.clientX, map_controls_featureInfo_moveEvent_eXY.clientY); - - while (target && target._featureId) { - feature = mapGetFeatureById(layer._layerObject._layerId, target._featureId); - - if (feature) { - var featureid = feature.fid; - - if (featureid != null) { - if ((layer._layerObject._featureType != null) && (typeof layer._layerObject._featureType !== "undefined")) { - if ((featureid.indexOf(layer._layerObject._featureType)) < 0) { - featureid = layer._layerObject._featureType + "." + featureid; - } - } - - } - - features.push(featureid); - - target.style.display = "none"; - - targets.push(target); - - target = document.elementFromPoint(map_controls_featureInfo_moveEvent_eXY.clientX, map_controls_featureInfo_moveEvent_eXY.clientY); - - } - else { - target = false; - } - } - } - } - - if (((layer instanceof OpenLayers.Layer.Vector) && (features.length > 0)) || (!(layer instanceof OpenLayers.Layer.Vector))) { - if (typeof layer._layerObject !== "undefined") { - if (layer._layerObject._isQueryable) { - - //var lonlat = map.getLonLatFromPixel(map_controls_featureInfo_moveEvent_eXY.xy); - - /* - if (layer._layerObject._nativeSRS != mapGetCurrentProjection()) { - lonlat.transform(new OpenLayers.Projection(mapGetCurrentProjection()), new OpenLayers.Projection(layer._layerObject._nativeSRS)); - }*/ - - var _servicePort = ""; - - if (typeof layer._serviceObject._servicePort !== "undefined") { - _servicePort = layer._serviceObject._servicePort; - } - - var _timeDimension = ""; - - var _serviceUrl = layer._serviceObject._serviceUrl; - - if (typeof layer.params !== "undefined") { - if (typeof layer.params["TIME"] !== "undefined") { - _timeDimension = layer.params["TIME"]; - - _serviceUrl = Ext.urlAppend(_serviceUrl, "TIME=" + _timeDimension); - } - } - - b.push({ - _layerId: layer._layerObject._layerId, - _serviceType: layer._serviceObject._serviceType, - _username: layer._serviceObject._username, - _serviceUrl: _serviceUrl, - _serviceName: layer._serviceObject._serviceName, - _servicePort: _servicePort, - _geometryField: layer._layerObject._geometryField, - _password: layer._serviceObject._password, - _layerName: layer._layerObject._layerName, - _version: layer._serviceObject._version, - _isService: layer._serviceObject._isService, - _featureType: layer._layerObject._featureType, - _cqlFilter: layer._layerObject._cqlFilter, - _infoLon: lonlat.lon, - _infoLat: lonlat.lat, - _nativeSRS: layer._layerObject._nativeSRS, - _featureInfoFormat: layer._serviceObject._featureInfoFormat, - _featureId: features.join(","), - _request: "getInfo" - }); - } - } - } - - layers.push(layer); - - layer.div.style.display = "none"; - } - } - - for (i = 0, len = targets.length; i < len; ++i) { - targets[i].style.display = ""; - } - - for (i = layers.length - 1; i >= 0; --i) { - layers[i].div.style.display = "block"; - } - - return b; -} - diff --git a/public/js/trash/maptab/maptab_toolbar_general/map_controls_measureArea.js b/public/js/trash/maptab/maptab_toolbar_general/map_controls_measureArea.js deleted file mode 100644 index c75d3e3..0000000 --- a/public/js/trash/maptab/maptab_toolbar_general/map_controls_measureArea.js +++ /dev/null @@ -1,294 +0,0 @@ -// var measurearea_units = 'm'; -// -// var measurearea_labels=new OpenLayers.Layer.Vector("measurearea_labels",{ -// rendererOptions :{ zIndexing: true }, -// styleMap: new OpenLayers.StyleMap({ -// 'default':{ -// fontColor: "${fontColor}", -// fillColor: "#FF5500", -// fontSize: "${fontSize}", -// fontFamily: "Tahoma", -// fillOpacity: 0, -// pointRadius: 1, -// pointerEvents: "visiblePainted", -// labelOutlineColor:"#FFFFFF", -// labelOutlineWidth:2, -// label : "${distance}" + "${units}" -// } -// }) -// }); -// -// var measurearea_cursor=new OpenLayers.Layer.Vector("measurearea_cursor",{ -// rendererOptions :{ zIndexing: true }, -// styleMap: new OpenLayers.StyleMap({ -// 'default':{ -// fontColor: "${fontColor}", -// fillColor: "#FF9900", -// fontSize: "${fontSize}", -// fontFamily: "Tahoma", -// fillOpacity: 0, -// pointRadius: 1, -// pointerEvents: "visiblePainted", -// labelOutlineColor:"#FFFFFF", -// labelOutlineWidth:2, -// label : "${distance}" + "${units}" -// } -// }) -// }); -// -// var measurearea_layer=new OpenLayers.Layer.Vector("measurearea_layer",{ -// styleMap: new OpenLayers.StyleMap({ -// 'default':{ -// fontColor: '${fontColor}', -// fontSize: "${fontSize}", -// strokeColor:"#FF7700", -// fillColor: "#FF9900", -// fontFamily: "Tahoma", -// fillOpacity: 0, -// pointRadius: 1, -// pointerEvents: "visiblePainted", -// labelOutlineColor:"#FFFFFF", -// labelOutlineWidth:2, -// strokeColor:"#FF7700", -// strokeWidth:2, -// strokeDashstyle:"dashdot", -// labelOutlineColor:"#FFFFFF", -// labelOutlineWidth:5, -// label : "${distance}" + "${units}" -// } -// }) -// }); -// -// var measurearea_layer_style = { -// strokeColor:"#FF7700", -// fillColor:"#FFB050", -// fillOpacity:0.5, -// strokeWidth:2, -// strokeDashstyle:"dashdot", -// labelOutlineColor:"#FFFFFF", -// labelOutlineWidth:5 -// }; -// -// var measurearea_distance_segment_total=0; -// -// function init_map_controls_measureArea() -// { -// map_controls.measurearea=new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon,{ -// persist: false, -// geodesic: map_isGeodesic, -// showDistances:true, -// handlerOptions: { -// layerOptions: -// { -// styleMap: new OpenLayers.StyleMap({ -// strokeColor:"#FF7700", -// fillColor:"#FFB050", -// fillOpacity:0.5, -// strokeWidth:2, -// strokeDashstyle:"dashdot", -// labelOutlineColor:"#FFFFFF", -// labelOutlineWidth:5 -// }) -// } -// }, -// callbacks:{ -// create:function() -// { -// try{ -// -// map.removeLayer(measurearea_labels); -// -// map.removeLayer(measurearea_cursor); -// -// }catch(err){}; -// -// if (map.getLayersByName("measurearea_layer")=="") -// { -// map.addLayer(measurearea_layer); -// } -// -// map.addLayer(measurearea_labels); -// -// map.addLayer(measurearea_cursor); -// -// measurearea_distance_segment_total = 0; -// }, -// modify:function(_cursorPoint,evt) -// { -// if (map_isGeodesic==true) -// { -// var _v=((evt.geometry.getGeodesicLength(new OpenLayers.Projection(map_currentProjection)))/2); -// }else{ -// var _v=((evt.geometry.getLength())/2); -// } -// -// measurearea_cursor.destroyFeatures(); -// -// var _cursor = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(_cursorPoint.x, _cursorPoint.y)); -// -// if(evt.geometry.getVertices().length==2) -// { -// measurearea_labels.destroyFeatures(); -// -// } -// -// if (_v>0) -// { -// -// _cursor.attributes={ -// distance: _v.toFixed(2), -// units:measurearea_units, -// fontColor: '#989898', -// align: "cm", -// fontSize:"14px" -// } -// -// //measurearea_cursor.addFeatures([_cursor]); -// } -// } -// }, -// eventListeners: { -// measure: function(evt) -// { -// var _v = evt.geometry.getVertices(); -// -// if (_v.length>2) -// { -// var _preLastVertex = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point((_v[_v.length-1].x + _v[_v.length-2].x)/2, (_v[_v.length-1].y + _v[_v.length-2].y)/2)); -// -// var _lastVertex = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(_v[_v.length-1].x, _v[_v.length-1].y)); -// -// var _segment = new OpenLayers.Geometry.LineString([new OpenLayers.Geometry.Point(_v[_v.length-2].x, _v[_v.length-2].y), new OpenLayers.Geometry.Point(_v[_v.length-1].x, _v[_v.length-1].y)]); -// -// if (map_isGeodesic==true) -// { -// var measurearea_distance_segment=_segment.getGeodesicLength(new OpenLayers.Projection(map_currentProjection)); -// }else{ -// var measurearea_distance_segment=_segment.getLength(); -// } -// -// measurearea_distance_segment_total=measurearea_distance_segment+measurearea_distance_segment_total; -// -// _preLastVertex.attributes={ -// distance: measurearea_distance_segment.toFixed(2), -// units:measurearea_units, -// fontColor: '#808080', -// align: "cm", -// fontSize:"12px" -// }; -// -// _lastVertex.attributes = { -// distance: measurearea_distance_segment_total.toFixed(2), -// units:measurearea_units, -// fontColor: '#FF6600', -// align: "cm", -// fontSize:"14px" -// }; -// -// var _firstVertex = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(_v[0].x, _v[0].y)); -// -// var _toFirstVertex = new OpenLayers.Geometry.LineString([new OpenLayers.Geometry.Point(_v[_v.length-1].x, _v[_v.length-1].y), new OpenLayers.Geometry.Point(_v[0].x, _v[0].y)]); -// -// if (map_isGeodesic==true) -// { -// measurearea_distance_segment_total=_toFirstVertex.getGeodesicLength(new OpenLayers.Projection(map_currentProjection))+measurearea_distance_segment_total; -// }else{ -// measurearea_distance_segment_total=_toFirstVertex.getLength()+measurearea_distance_segment_total; -// } -// -// _firstVertex.attributes = { -// distance: measurearea_distance_segment_total.toFixed(2), -// units:measurearea_units, -// fontColor: '#FF6600', -// align: "cm", -// fontSize:"14px" -// }; -// -// var _lastSegment = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point((_v[_v.length-1].x + _v[0].x)/2, (_v[_v.length-1].y + _v[0].y)/2)); -// -// -// if (map_isGeodesic==true) -// { -// var _toFirstVertexGetLength=_toFirstVertex.getGeodesicLength(new OpenLayers.Projection(map_currentProjection)); -// }else{ -// var _toFirstVertexGetLength=_toFirstVertex.getLength(); -// } -// -// _lastSegment.attributes={ -// distance: _toFirstVertexGetLength.toFixed(2), -// units:measurearea_units, -// fontColor: '#808080', -// align: "cm" -// } -// -// _lastSegment.attributes={ -// distance: _toFirstVertexGetLength.toFixed(2), -// units:measurearea_units, -// fontColor: '#808080', -// align: "cm" -// } -// -// var _areaPoint = new OpenLayers.Feature.Vector(evt.geometry.getCentroid()); -// -// _areaPoint.attributes={ -// distance:evt.measure.toFixed(2), -// units:evt.units +"^2", -// fontColor: '#FF6600', -// align: "cm" -// } -// -// //measurearea_labels.addFeatures([_preLastVertex,_lastVertex,_firstVertex,_lastSegment,_areaPoint]); -// measurearea_layer.addFeatures(new OpenLayers.Feature.Vector(evt.geometry,null,measurearea_layer_style)); -// -// measurearea_layer.addFeatures([_preLastVertex.clone(),_lastVertex.clone(),_firstVertex.clone(),_lastSegment.clone(),_areaPoint.clone()]); -// -// } -// -// }, -// measurepartial:function(evt) -// { -// var _v = evt.geometry.getVertices(); -// -// if (_v.length>2) -// { -// var _preLastVertex = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point((_v[_v.length-2].x + _v[_v.length-3].x)/2, (_v[_v.length-2].y + _v[_v.length-3].y)/2)); -// -// var _lastVertex = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(_v[_v.length-1].x, _v[_v.length-1].y)); -// -// var _segment = new OpenLayers.Geometry.LineString([new OpenLayers.Geometry.Point(_v[_v.length-3].x, _v[_v.length-3].y), new OpenLayers.Geometry.Point(_v[_v.length-2].x, _v[_v.length-2].y)]); -// -// if (map_isGeodesic==true) -// { -// var measurearea_distance_segment=_segment.getGeodesicLength(new OpenLayers.Projection(map_currentProjection)); -// }else{ -// var measurearea_distance_segment=_segment.getLength(); -// } -// -// _preLastVertex.attributes={ -// distance: measurearea_distance_segment.toFixed(2), -// units:measurearea_units, -// fontColor: '#808080', -// align: "cm", -// fontSize:"12px" -// }; -// -// measurearea_distance_segment_total=measurearea_distance_segment+measurearea_distance_segment_total; -// -// -// _lastVertex.attributes = { -// distance: measurearea_distance_segment_total.toFixed(2), -// units:measurearea_units, -// fontColor: '#FF6600', -// align: "cm", -// fontSize:"14px" -// }; -// -// //measurearea_labels.addFeatures([_preLastVertex,_lastVertex]); -// -// measurearea_layer.addFeatures([_preLastVertex.clone(),_lastVertex.clone()]); -// -// } -// } -// } -// }); -// } diff --git a/public/js/trash/maptab/maptab_toolbar_general/map_controls_measureDistance.js b/public/js/trash/maptab/maptab_toolbar_general/map_controls_measureDistance.js deleted file mode 100644 index 3165be3..0000000 --- a/public/js/trash/maptab/maptab_toolbar_general/map_controls_measureDistance.js +++ /dev/null @@ -1,230 +0,0 @@ -var measuredistance_units = 'm'; - -var measuredistance_labels=new OpenLayers.Layer.Vector("measuredistance_labels",{ - styleMap: new OpenLayers.StyleMap({ - 'default':{ - fontColor: "${fontColor}", - fillColor: "#FF5500", - fontSize: "${fontSize}", - fontFamily: "Tahoma", - fillOpacity: 0, - pointRadius: 1, - pointerEvents: "visiblePainted", - labelOutlineColor:"#FFFFFF", - labelOutlineWidth:2, - label : "${distance}" + "${units}" - } - }) - }); - -var measuredistance_cursor=new OpenLayers.Layer.Vector("measuredistance_cursor",{ - styleMap: new OpenLayers.StyleMap({ - 'default':{ - fontColor: "${fontColor}", - fillColor: "#FF9900", - fontSize: "${fontSize}", - fontFamily: "Tahoma", - fillOpacity: 0, - pointRadius: 1, - pointerEvents: "visiblePainted", - labelOutlineColor:"#FFFFFF", - labelOutlineWidth:2, - label : "${distance}" + "${units}" - } - }) - }); - -var measuredistance_layer=new OpenLayers.Layer.Vector("measuredistance_layer",{ - styleMap: new OpenLayers.StyleMap({ - 'default':{ - fontColor: '${fontColor}', - fontSize: "${fontSize}", - strokeColor:"#FF7700", - fillColor: "#FF9900", - fontFamily: "Tahoma", - fillOpacity: 0, - pointRadius: 1, - pointerEvents: "visiblePainted", - labelOutlineColor:"#FFFFFF", - labelOutlineWidth:2, - strokeColor:"#FF7700", - strokeWidth:2, - strokeDashstyle:"dashdot", - labelOutlineColor:"#FFFFFF", - labelOutlineWidth:5, - label : "${distance}" + "${units}" - } - }) - }); - -var measuredistance_layer_style = { - strokeColor:"#FF7700", - fillOpacity: 0, - pointRadius: 1, - pointerEvents: "visiblePainted", - strokeColor:"#FF7700", - strokeWidth:2, - strokeDashstyle:"dashdot", - }; - -var measuredistance_distance=0; - -function init_map_controls_measureDistance() -{ - - map_controls.measuredistance=new OpenLayers.Control.Measure(OpenLayers.Handler.Path,{ - persist: false, - geodesic: map_isGeodesic, - handlerOptions: { - layerOptions: - { - styleMap: new OpenLayers.StyleMap({ - strokeColor:"#FF7700", - strokeWidth:2, - strokeDashstyle:"dashdot", - labelOutlineColor:"#FFFFFF", - labelOutlineWidth:5 - }) - } - }, - callbacks:{ - create:function() - { - try{ - - map.removeLayer(measuredistance_labels); - - map.removeLayer(measuredistance_cursor); - - }catch(err){}; - - measuredistance_distance = 0; - - if (map.getLayersByName("measuredistance_layer")=="") - { - map.addLayer(measuredistance_layer); - } - - map.addLayer(measuredistance_labels); - - map.addLayer(measuredistance_cursor); - }, - modify:function(_cursorPoint,evt) - { - if (map_isGeodesic==true) - { - var _v=evt.geometry.getGeodesicLength(new OpenLayers.Projection(map_currentProjection)); - }else{ - var _v=evt.geometry.getLength(); - } - - measuredistance_cursor.destroyFeatures(); - - var _cursor = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(_cursorPoint.x, _cursorPoint.y)); - - if(evt.geometry.getVertices().length==2) - { - measuredistance_labels.destroyFeatures(); - } - - if (_v>0) - { - - - _cursor.attributes={ - distance: _v.toFixed(2), - units:measuredistance_units, - fontColor: '#989898', - align: "cm", - fontSize:"14px" - } - - measuredistance_cursor.addFeatures([_cursor]); - } - } - }, - eventListeners: { - measure: function(evt) - { - var _v = evt.geometry.getVertices(); - - if (_v.length>=2) - { - var _preLastVertex = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point((_v[_v.length-1].x + _v[_v.length-2].x)/2, (_v[_v.length-1].y + _v[_v.length-2].y)/2)); - - var _lastVertex = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(_v[_v.length-1].x, _v[_v.length-1].y)); - - var _segment = new OpenLayers.Geometry.LineString([new OpenLayers.Geometry.Point(_v[_v.length-2].x, _v[_v.length-2].y), new OpenLayers.Geometry.Point(_v[_v.length-1].x, _v[_v.length-1].y)]); - - if (map_isGeodesic==true) - { - var measuredistance_distance_segment=_segment.getGeodesicLength(new OpenLayers.Projection(map_currentProjection)); - }else{ - var measuredistance_distance_segment=_segment.getLength(); - } - - _preLastVertex.attributes={ - distance: measuredistance_distance_segment.toFixed(2), - units:measuredistance_units, - fontColor: '#808080', - align: "cm", - fontSize:"12px" - }; - - _lastVertex.attributes = { - distance: evt.measure.toFixed(2), - units:evt.units, - fontColor: '#FF6600', - align: "cm", - fontSize:"14px" - }; - - - measuredistance_layer.addFeatures(new OpenLayers.Feature.Vector(evt.geometry,null,measuredistance_layer_style)); - - measuredistance_layer.addFeatures([_preLastVertex.clone(),_lastVertex.clone()]); - } - - }, - measurepartial:function(evt) - { - - var _v = evt.geometry.getVertices(); - - if (_v.length>2) - { - var _preLastVertex = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point((_v[_v.length-2].x + _v[_v.length-3].x)/2, (_v[_v.length-2].y + _v[_v.length-3].y)/2)); - - var _lastVertex = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(_v[_v.length-1].x, _v[_v.length-1].y)); - - var _segment = new OpenLayers.Geometry.LineString([new OpenLayers.Geometry.Point(_v[_v.length-3].x, _v[_v.length-3].y), new OpenLayers.Geometry.Point(_v[_v.length-2].x, _v[_v.length-2].y)]); - - if (map_isGeodesic==true) - { - var measuredistance_distance_segment=_segment.getGeodesicLength(new OpenLayers.Projection(map_currentProjection)); - }else{ - var measuredistance_distance_segment=_segment.getLength(); - } - - _preLastVertex.attributes={ - distance: measuredistance_distance_segment.toFixed(2), - units:measuredistance_units, - fontColor: '#808080', - align: "cm", - fontSize:"12px" - }; - - _lastVertex.attributes = { - distance: evt.measure.toFixed(2), - units:evt.units, - fontColor: '#FF6600', - align: "cm", - fontSize:"14px" - }; - - measuredistance_layer.addFeatures([_preLastVertex.clone(),_lastVertex.clone()]); - } - } - } - }); -} diff --git a/public/js/trash/maptab/maptab_toolbar_search.js b/public/js/trash/maptab/maptab_toolbar_search.js deleted file mode 100644 index 5bb642b..0000000 --- a/public/js/trash/maptab/maptab_toolbar_search.js +++ /dev/null @@ -1,548 +0,0 @@ -var maptab_toolbar_search_controls; -var maptab_toolbar_search_draw_layer; -var maptab_toolbar_search_attribute_mode=false; - -var maptab_search_geometry_criteria_store=new Ext.data.SimpleStore({ - fields: ['value','name'], - data: [ - ["INTERSECTS",_maptab_search_geometry_criteria_intersects], - ["WITHIN",_maptab_search_geometry_criteria_within] - ], - autoLoad:true -}); - -function init_maptab_toolbar_search_controls() -{ - - maptab_toolbar_search_draw_layer=new OpenLayers.Layer.Vector("maptab_toolbar_search_vector"); - map.addLayer(maptab_toolbar_search_draw_layer); - maptab_toolbar_search_draw_layer.events.register('beforefeatureadded', ' ', function(){maptab_toolbar_search_draw_layer.removeAllFeatures();}); - maptab_toolbar_search_controls= - { - drawline: new OpenLayers.Control.DrawFeature( - maptab_toolbar_search_draw_layer, - OpenLayers.Handler.Path, - { - featureAdded:function(evt) - { - if (!maptab_toolbar_search_attribute_mode) - { - fn_toolbar_search_create_request(); - } - } - } - ), - drawpolygon: new OpenLayers.Control.DrawFeature( - maptab_toolbar_search_draw_layer, - OpenLayers.Handler.Polygon, - { - featureAdded:function(evt) - { - if (!maptab_toolbar_search_attribute_mode) - { - fn_toolbar_search_create_request(); - } - } - } - ), - drawcircle: new OpenLayers.Control.DrawFeature( - maptab_toolbar_search_draw_layer, - OpenLayers.Handler.RegularPolygon, - { - handlerOptions: - { - sides: 40, - irregular: false - }, - featureAdded:function(evt) - { - if (!maptab_toolbar_search_attribute_mode) - { - fn_toolbar_search_create_request(); - } - } - } - ), - drawrectangle: new OpenLayers.Control.DrawFeature( - maptab_toolbar_search_draw_layer, - OpenLayers.Handler.RegularPolygon, - { - handlerOptions: - { - sides: 4, - irregular: true - }, - featureAdded:function(evt) - { - if (!maptab_toolbar_search_attribute_mode) - { - fn_toolbar_search_create_request(); - } - } - } - ) - } - - for(var key in maptab_toolbar_search_controls) - { - mapRemoveControl(maptab_toolbar_search_controls[key]); - - mapAddControl(maptab_toolbar_search_controls[key]); - - } -} - -// creates the feature info button -var maptab_toolbar_search=[ - // Get feature info button - { - xtype:'button', - id:'maptab_toolbar_general_featureInfo', - iconCls:'maptab_toolbar_general_featureInfo', - toggleGroup:'map_control_one_btn_allowed_group', - tooltip:_maptab_toolbar_general_featureInfo, - text:_maptab_toolbar_general_featureInfo, - enableToggle: true, - toggleHandler:function(item,state){ - console.debug(state); - map_controls_featureInfo(state); - } - }, - {xtype: 'tbseparator', - hidden: true,}, - { - xtype:'button', - id:'maptab_toolbar_search_polygon', - iconCls:'maptab_toolbar_search_polygon', - enableToggle: true, - toggleGroup:'map_control_one_btn_allowed_group', - tooltip:_maptab_toolbar_search_polygon, - hidden: true, - toggleHandler:function(item,state){ - - if (state) - { - - maptab_toolbar_search_attribute_mode=false; - - Ext.getCmp("maptab_toolbar_search_geometry_criteria").getStore().removeAll(); - - var data=[ - ["INTERSECTS",_maptab_search_geometry_criteria_intersects], - ["WITHIN",_maptab_search_geometry_criteria_within] - ]; - - Ext.getCmp("maptab_toolbar_search_geometry_criteria").getStore().loadData(data); - - - Ext.getCmp("maptab_toolbar_search_geometry_criteria").setValue("INTERSECTS"); - - }else - { - fn_toolbar_search_clear_drawings(); - - Ext.getCmp("maptab_toolbar_search_geometry_criteria").getStore().removeAll(); - } - - fn_toggleControl('drawpolygon',state,maptab_toolbar_search_controls); - } - }, - { - xtype:'button', - id:'maptab_toolbar_search_line', - iconCls:'maptab_toolbar_search_line', - enableToggle: true, - toggleGroup:'map_control_one_btn_allowed_group', - tooltip:_maptab_toolbar_search_line, - hidden: true, - toggleHandler:function(item,state){ - - fn_toggleControl('drawline',state,maptab_toolbar_search_controls); - - if (state) - { - - maptab_toolbar_search_attribute_mode=false; - - maptab_search_geometry_criteria_store.removeAll(); - - var data=[ - ["CROSSES",_maptab_search_geometry_criteria_crosses], - ["INTERSECTS",_maptab_search_geometry_criteria_intersects] - ]; - - maptab_search_geometry_criteria_store.loadData(data); - - Ext.getCmp("maptab_toolbar_search_geometry_criteria").setValue("INTERSECTS"); - - }else - { - fn_toolbar_search_clear_drawings(); - - Ext.getCmp("maptab_toolbar_search_geometry_criteria").getStore().removeAll(); - - Ext.getCmp("maptab_toolbar_search_geometry_criteria").setValue("INTERSECTS"); - - } - - } - }, - { - xtype:'button', - id:'maptab_toolbar_search_rectangle', - iconCls:'maptab_toolbar_search_rectangle', - enableToggle: true, - toggleGroup:'map_control_one_btn_allowed_group', - tooltip:_maptab_toolbar_search_rectangle, - hidden: true, - toggleHandler:function(item,state){ - - if (state) - { - maptab_toolbar_search_attribute_mode=false; - - Ext.getCmp("maptab_toolbar_search_geometry_criteria").getStore().removeAll(); - - var data=[ - ["INTERSECTS",_maptab_search_geometry_criteria_intersects], - ["WITHIN",_maptab_search_geometry_criteria_within] - ]; - - Ext.getCmp("maptab_toolbar_search_geometry_criteria").getStore().loadData(data); - - Ext.getCmp("maptab_toolbar_search_geometry_criteria").setValue("INTERSECTS"); - - }else - { - Ext.getCmp("maptab_toolbar_search_geometry_criteria").getStore().removeAll(); - - fn_toolbar_search_clear_drawings(); - } - - fn_toggleControl('drawrectangle',state,maptab_toolbar_search_controls); - } - }, - { - xtype:'button', - id:'maptab_toolbar_search_circle', - iconCls:'maptab_toolbar_search_circle', - enableToggle: true, - toggleGroup:'map_control_one_btn_allowed_group', - tooltip:_maptab_toolbar_search_circle, - hidden: true, - toggleHandler:function(item,state){ - - if (state) - { - maptab_toolbar_search_attribute_mode=false; - - Ext.getCmp("maptab_toolbar_search_geometry_criteria").getStore().removeAll(); - - var data=[ - ["INTERSECTS",_maptab_search_geometry_criteria_intersects], - ["WITHIN",_maptab_search_geometry_criteria_within] - ]; - - Ext.getCmp("maptab_toolbar_search_geometry_criteria").getStore().loadData(data); - - Ext.getCmp("maptab_toolbar_search_geometry_criteria").setValue("INTERSECTS"); - - }else - { - Ext.getCmp("maptab_toolbar_search_geometry_criteria").getStore().removeAll(); - - fn_toolbar_search_clear_drawings(); - } - - fn_toggleControl('drawcircle',state,maptab_toolbar_search_controls); - } - }, - { - xtype:'combo', - loadMask:true, - width:120, - id:'maptab_toolbar_search_geometry_criteria', - hidden: true, - emptyText:_maptab_search_geometry_criteria_intersects, - value:"INTERSECTS", - store: maptab_search_geometry_criteria_store, - displayField: 'name', - valueField: 'value', - forceSelection: true, - selectOnFocus: false, - queryMode: 'local', - editable: false, - listeners: {render: function(e) {this.getStore().load();}} - }, - {xtype:'tbseparator', - hidden: true,}, - { - xtype:'button', - id:'maptab_toolbar_search_clear', - iconCls:'maptab_toolbar_search_clear', - tooltip:_maptab_toolbar_search_clear, - hidden: true, - handler:function(){ - fn_toolbar_search_clear_drawings(); - } - }, - { - xtype:'label', - id:'maptab_toolbar_search_label', - html:'', - hidden:true - } -]; - -function fn_toolbar_search_fetch_search_geometry(_layerId,_geometryCriteria) -{ - var _layer=mapFindLayerById(_layerId); - - var _lastFeatureCount=(maptab_toolbar_search_draw_layer.features.length-1); - - var _cloneFeature=maptab_toolbar_search_draw_layer.features[_lastFeatureCount].clone(); - - var _featureGeometry=_cloneFeature.geometry; - - if (mapGetCurrentProjection()!=mapGetProjectionCode(_layer._layerObject._nativeSRS)) - { - _featureGeometry=_featureGeometry.transform(new OpenLayers.Projection(mapGetCurrentProjection()), new OpenLayers.Projection(_layer._layerObject._nativeSRS)).toString(); - } - - if (_layer._layerObject._xy==false) - { - _featureGeometry=fn_reverseAxis(_featureGeometry); - } - - var _cqlFilter=_geometryCriteria+"("+_layer._layerObject._geometryField+","+_featureGeometry+")"; - - return _cqlFilter; -} - -function fn_toolbar_search_create_request() -{ - Ext.getCmp("maptab_toolbar_search_label").update(""); - - var overlayers=mapGetlayersBy("isBaseLayer",false); - - var _queryObject=new Array(); - - for(var i=overlayers.length-1;i>=0;i--) - { - var _layer=overlayers[i]; - - if ((_layer._layerObject._isSearchable==true) && (_layer._layerObject._visibility==true)) - { - var _cqlFilter=fn_toolbar_search_fetch_search_geometry(_layer._layerObject._layerId,Ext.getCmp("maptab_toolbar_search_geometry_criteria").getValue()); - - var _servicePort = ""; - - if (typeof _layer._serviceObject._servicePort!=="undefined") - { - _servicePort = _layer._serviceObject._servicePort; - } - - _queryObject.push({ - _layerId:_layer._layerObject._layerId, - _serviceType:_layer._serviceObject._serviceType, - _servicePort:_servicePort, - _serviceName:_layer._serviceObject._serviceName, - _username:_layer._serviceObject._username, - _serviceUrl:_layer._serviceObject._serviceUrl, - _password:_layer._serviceObject._password, - _layerName:_layer._layerObject._layerName, - _version:_layer._serviceObject._version, - _isService:_layer._serviceObject._isService, - _featureType:_layer._layerObject._featureType, - _geometryField:_layer._layerObject._geometryField, - _cqlFilter:_cqlFilter, - _geomFilter:_cqlFilter, - _nativeSRS:_layer._layerObject._nativeSRS, - _featureInfoFormat:_layer._serviceObject._featureInfoFormat, - _request:"search" - }); - } - } - - var p=new fn_get(); - - p._async=true; - - p._data=_queryObject; - - p._timeout=15000; - - p._success=function(_response, _opts) - { - - maptab_search_results_count++; - - var _response=Ext.JSON.decode(_response.responseText) - - Ext.each(_response,function(item) - { - var _data=new Array(); - - if ((item._errorStatus==-1) && (item._response._attributes.length>0)) - { - var r=new fn_toolbar_search_create_panel_results_grid(item._response._layerId, _cqlFilter); - - fn_grid_results_ids_array.push(r.id); - - r.setTitle(mapFindLayerById(item._response._layerId)._layerObject._layerTitle + " ("+mapFindLayerById(item._response._layerId)._serviceObject._serviceType+")"+" "+maptab_search_results_count); - - Ext.getCmp("maptab_south").expand(); - - Ext.getCmp("maptab_south_tabpanel").add(r); - - Ext.getCmp("maptab_south_tabpanel").setActiveTab(r); - - //var mask=fn_loadingMask(r,_mask_loading_message_default); - - //mask.show(); - - Ext.each(item._response._attributes,function(record) - { - _data.push(record[0]); - - }); - - r.getStore().loadData(_data); - - _data=null; - - var _f=r.getDockedItems('toolbar[dock="top"]')[0].items.items; - - _f[0].setText(mapFindLayerById(item._response._layerId)._layerObject._layerTitle + " ("+mapFindLayerById(item._response._layerId)._serviceObject._serviceType+")"); - - _f[2].setText(_maptab_east_search_results_count_text+r.getStore().getCount()); - - _f[4].setText(_maptab_east_search_results_selected_count_text+r.getSelectionModel().getSelection().length); - - //mask.hide(); - mapFindLayerById(_layer._layerObject._layerId).mergeNewParams({'CQL_FILTER': '1=1'}); - if(_queryObject[0]._cqlFilter !== ''){ - mapFindLayerById(_layer._layerObject._layerId).mergeNewParams({'CQL_FILTER':_queryObject[0]._cqlFilter}); - } - - } - }); - - Ext.getCmp("maptab_toolbar_search_label").update(""); - }; - - p._failure=function(_response, _opts) - { - Ext.getCmp("maptab_toolbar_search_label").update(""); - - } - - p.get(); -} - -function fn_toolbar_search_clear_drawings() -{ - Ext.getCmp("maptab_toolbar_search_label").update(""); - - maptab_toolbar_search_draw_layer.removeAllFeatures(); -} - - - -function fn_toolbar_search_create_panel_results_grid(_layerId, _cql_filter) -{ - var _attributesFields=mapFindLayerById(_layerId)._layerObject._attributesFields; - - var toolbar_search_create_panel_results_grid_tbar=fn_createFetureGridTopBar(); - - toolbar_search_create_panel_results_grid_tbar.unshift( - {xtype:'label'}, - {xtype:'tbseparator'}, - {xtype:'label'}, - {xtype:'tbseparator'}, - {xtype:'label'}); - - var g=Ext.create('Ext.grid.Panel', - { - border:false, - columnLines:true, - closable:true, - enableColumnMove:mapFindLayerById(_layerId)._layerObject._attributesReorder, - _layerId:_layerId, - title:_maptab_east_search_results, - selModel: Ext.create('Ext.selection.CheckboxModel',{mode:'SIMPLE',checkOnly:true}), - store:fn_createAttributesStore(fn_featureColumnModelForGrid(_attributesFields)), - columns:fn_createAttributesColumnModel(fn_featureColumnModelForGrid(_attributesFields)), - tbar:toolbar_search_create_panel_results_grid_tbar, - listeners:{ - show:function() - { - var _f=g.getDockedItems('toolbar[dock="top"]')[0].items.items; - - _f[4].setText(_maptab_east_search_results_selected_count_text+g.getSelectionModel().getSelection().length); - - mapFindLayerById(_layerId).mergeNewParams({'CQL_FILTER': _cql_filter}); - }, - hide:function() - { - mapFindLayerById(_layerId).mergeNewParams({'CQL_FILTER': '1=1'}); - }, - select:function(row, record, index, eOpts) - { - var _feature=fn_featureObject(record); - - fn_featureHighlight(_feature._featureId,_feature._layerId,_feature._srsName,_feature._featureUrl,_feature._featureGeomFormat,''); - - fn_toggleHightlightFromAllResultsGrids(_feature._featureId,_feature._layerId,g.id); - - var _f=g.getDockedItems('toolbar[dock="top"]')[0].items.items; - - _f[4].setText(_maptab_east_search_results_selected_count_text+g.getSelectionModel().getSelection().length); - }, - deselect:function(row, record, index, eOpts) - { - var _feature=fn_featureObject(record); - - fn_featureUnHiglighted(_feature._featureId,_feature._layerId); - - fn_toggleHightlightFromAllResultsGrids(_feature._featureId,_feature._layerId,g.id); - - var _f=g.getDockedItems('toolbar[dock="top"]')[0].items.items; - - _f[4].setText(_maptab_east_search_results_selected_count_text+g.getSelectionModel().getSelection().length); - - }, - beforeclose:function(grid, eOpts) - { - Ext.Array.remove(fn_grid_results_ids_array,g.id); - Ext.Array.clean(fn_grid_results_ids_array); - - grid.store.each(function(item){ - - if(fn_featureIsHiglighted(item.get("_featureId"),item.get("_layerId"))) - { - fn_featureUnHiglighted(item.get("_featureId"),item.get("_layerId")); - fn_toggleHightlightFromAllResultsGrids(item.get("_featureId"),item.get("_layerId"),g.id); - } - }); - - mapFindLayerById(_layerId).mergeNewParams({'CQL_FILTER': '1=1'}); - }, - viewready:function(grid, eOpts) - { - grid.store.each(function(item){ - - if(fn_featureIsHiglighted(item.get("_featureId"),item.get("_layerId"))) { - grid.getSelectionModel().select(item,true,true); - } - }); - - var _f=g.getDockedItems('toolbar[dock="top"]')[0].items.items; - - _f[4].setText(_maptab_east_search_results_selected_count_text+g.getSelectionModel().getSelection().length); - } - } - }); - - return g; -} diff --git a/public/js/trash/maptab/maptab_west_general_settings_panel.js b/public/js/trash/maptab/maptab_west_general_settings_panel.js deleted file mode 100644 index fbc722e..0000000 --- a/public/js/trash/maptab/maptab_west_general_settings_panel.js +++ /dev/null @@ -1,979 +0,0 @@ -var maptab_west_general_settings_store=new Ext.data.Store({ - fields: [ - {name:"_generalSettingId", type:"string"}, - {name:"_generalSettingTitle", type:"string"}, - {name:"_generalSettingRawValue", type:"string"}, - {name:"_generalSettingRenderer", type:"object"}, - {name:"_generalSettingValue", type:"string"}, - {name:"_generalSettingEditor", type:"object"}, - {name:"_generalSettingGroup", type:"string"} - ], - data: [], - groupField: "_generalSettingGroup" -}); - -function init_maptab_west_general_settings_store_load_data() -{ - var _config=new _config_init_map(); - var _defaultProjectionObjIndex=fn_objIndexOf(_config._mapProjections,"_epsg",_config._mapOptions.displayProjection.toString()); - var maptab_west_general_settings_store_data=[ - { - _generalSettingId:'maptab_west_general_settings_data_map_projection', - _generalSettingTitle:_maptab_west_general_settings_data_map_projection, - _generalSettingRawValue:_config._mapProjections[_defaultProjectionObjIndex]._title, - _generalSettingValue:_config._mapProjections[_defaultProjectionObjIndex]._epsg, - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - store:new Ext.data.Store({ - fields: ['_epsg','_title','_maxExtent','_numDigits'], - data: _config._mapProjections - }), - listeners:{ - select:function(combo,record) - { - var record=record[0]; - - mapSetDisplayProjection(record.data._epsg); - - fn_maptab_bbar_general_mouse_position(); - fn_maptab_bbar_general_map_center(); - } - }, - displayField: '_title', - valueField: '_epsg', - emptyText:_config._mapProjections[_defaultProjectionObjIndex]._title, - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - editable: false - }, - _generalSettingGroup:_maptab_west_general_settings_group_map_settings - }, - { - _generalSettingId:'maptab_west_general_settings_data_show_mouse_position', - _generalSettingTitle:_maptab_west_general_settings_data_show_mouse_position, - _generalSettingRawValue:"", - _generalSettingValue:true, - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - store:new Ext.data.SimpleStore({ - fields: ['name','value'], - data:[[_map_general_yes,true],[_map_general_no,false]] - }), - displayField: 'name', - listeners:{ - select:function(combo,record) - { - var record=record[0]; - - if (record.data.value) - { - Ext.getCmp("maptab_bbar_general_mouse_position_label").show(); - Ext.getCmp("maptab_bbar_general_mouse_position").show(); - }else{ - Ext.getCmp("maptab_bbar_general_mouse_position_label").hide(); - Ext.getCmp("maptab_bbar_general_mouse_position").hide(); - } - } - }, - valueField: 'value', - forceSelection: true, - triggerAction: 'all', - value:true, - selectOnFocus: false, - mode: 'local', - editable: false - }, - _generalSettingGroup:_maptab_west_general_settings_group_map_settings - }, - { - _generalSettingId:'maptab_west_general_settings_data_show_basemap_projection', - _generalSettingTitle:_maptab_west_general_settings_data_show_basemap_projection, - _generalSettingRawValue:"", - _generalSettingValue:false, - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - store:new Ext.data.SimpleStore({ - fields: ['name','value'], - data:[[_map_general_yes,true],[_map_general_no,false]] - }), - displayField: 'name', - listeners:{ - select:function(combo,record) - { - var record=record[0]; - - if (record.data.value) - { - Ext.getCmp("maptab_bbar_general_basemap_projection").show(); - }else{ - Ext.getCmp("maptab_bbar_general_basemap_projection").hide(); - } - } - }, - valueField: 'value', - forceSelection: true, - triggerAction: 'all', - value:false, - selectOnFocus: false, - mode: 'local', - editable: false - }, - _generalSettingGroup:_maptab_west_general_settings_group_map_settings - }, - { - _generalSettingId:'maptab_west_general_settings_data_show_current_scale', - _generalSettingTitle:_maptab_west_general_settings_data_show_current_scale, - _generalSettingRawValue:"", - _generalSettingValue:true, - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - store:new Ext.data.SimpleStore({ - fields: ['name','value'], - data:[[_map_general_yes,true],[_map_general_no,false]] - }), - displayField: 'name', - valueField: 'value', - listeners:{ - select:function(combo,record) - { - var record=record[0]; - - if (record.data.value) - { - Ext.getCmp("maptab_bbar_general_current_scale").show(); - }else{ - Ext.getCmp("maptab_bbar_general_current_scale").hide(); - } - } - }, - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - value:true, - editable: false - }, - _generalSettingGroup:_maptab_west_general_settings_group_map_settings - }, - { - _generalSettingId:'maptab_west_general_settings_data_get_coordinates_projections', - _generalSettingTitle:_maptab_west_general_settings_data_get_coordinates_projections, - _generalSettingRawValue:_config._getCoordinatesDefaultProjections.join(", "), - _generalSettingValue:_config._getCoordinatesDefaultProjections.join(", "), - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - displayField: '_title', - valueField: '_epsg', - store:new Ext.data.Store({ - fields: ['_epsg','_title','_maxExtent','_numDigits'], - data: _config._mapProjections - }), - listeners:{ - change:function(cmp,record) - { - if (!(cmp.getRawValue().length > 0)) - { - cmp.collapse(); - } - - }, - beforeselect: function(cmp, record, index, opts) { - - var terms = cmp.getRawValue().split(/,\s*/); - - terms.pop(); - - terms.push(record.data._title); - - terms.push(""); - - cmp.setValue(terms.join(", ")); - - cmp.collapse(); - - return false; - } - }, - hideTrigger: true, - selectOnFocus: true, - typeAhead: true, - minChars: 1, - hideTrigger: true, - mode: 'local' - }, - _generalSettingGroup:_maptab_west_general_settings_group_map_tools - }, - { - _generalSettingId:'maptab_west_general_settings_data_set_coordinates_projections', - _generalSettingTitle:_maptab_west_general_settings_data_set_coordinates_projections, - _generalSettingRawValue:_config._setCoordinatesDefaultProjections.join(", "), - _generalSettingValue:_config._setCoordinatesDefaultProjections.join(", "), - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - displayField: '_title', - valueField: '_epsg', - store:new Ext.data.Store({ - fields: ['_epsg','_title','_maxExtent','_numDigits'], - data: _config._mapProjections - }), - listeners:{ - change:function(cmp,record) - { - if (!(cmp.getRawValue().length > 0)) - { - cmp.collapse(); - } - }, - beforeselect: function(cmp, record, index, opts) { - - var terms = cmp.getRawValue().split(/,\s*/); - - terms.pop(); - - if (terms.indexOf(record.data._title)<0) - { - terms.push(record.data._title); - } - - terms.push(""); - - cmp.setValue(terms.join(", ")); - - cmp.collapse(); - - return false; - } - }, - hideTrigger: true, - selectOnFocus: true, - typeAhead: true, - minChars: 1, - hideTrigger: true, - mode: 'local' - }, - _generalSettingGroup:_maptab_west_general_settings_group_map_tools - }, - { - _generalSettingId:'maptab_west_general_settings_data_set_coordinates_zoom', - _generalSettingTitle:_maptab_west_general_settings_data_set_coordinates_zoom, - _generalSettingRawValue:_config._setCoordinatesZoomLevel, - _generalSettingValue:_config._setCoordinatesZoomLevel, - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - displayField: 'value', - valueField: 'value', - store:new Ext.data.SimpleStore({ - fields: ['value'], - data:[[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20]] - }), - listeners:{ - select:function(combo,record) - { - - } - }, - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - value: _config._setCoordinatesZoomLevel, - editable: false - }, - _generalSettingGroup:_maptab_west_general_settings_group_map_tools - }, - { - _generalSettingId:'maptab_west_general_settings_data_set_mousemouve_info', - _generalSettingTitle:_maptab_west_general_settings_data_set_mousemove_info, - _generalSettingRawValue:_config._setMousemoveInfo, - _generalSettingValue:_config._setMousemoveInfo, - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - store:new Ext.data.SimpleStore({ - fields: ['name','value'], - data:[[_map_general_yes,true],[_map_general_no,false]] - }), - listeners:{ - select:function(combo,record) - { - var record=record[0]; - - if (record.data.value) - { - _config._setMousemoveInfo = record.data.value; - - try{ - if(!Ext.getCmp("maptab_toolbar_general_featureInfo").pressed){ - mapOnMouseMove(map_controls_featureInfo_moveEvent); - } - }catch (err){} - - }else{ - _config._setMousemoveInfo = record.data.value; - mapUnregisterEvents("mousemove", map_controls_featureInfo_moveEvent); - - try{ - Ext.getCmp('map_controls_freatureInfo_win_getInfo_id').destroy(); - }catch(err){} - - } - } - }, - displayField: 'name', - valueField: 'value', - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - value: true, - editable: false - }, - _generalSettingGroup:_maptab_west_general_settings_group_map_tools - }, - { - _generalSettingId:'maptab_west_general_settings_data_set_coordinates_marker', - _generalSettingTitle:_maptab_west_general_settings_data_set_coordinates_marker, - _generalSettingRawValue:"", - _generalSettingValue:true, - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - store:new Ext.data.SimpleStore({ - fields: ['name','value'], - data:[[_map_general_yes,true],[_map_general_no,false]] - }), - listeners:{ - select:function(combo,record) - { - var record=record[0]; - - if (record.data.value) - { - Ext.getCmp("maptab_bbar_general_current_scale").show(); - }else{ - Ext.getCmp("maptab_bbar_general_current_scale").hide(); - } - } - }, - displayField: 'name', - valueField: 'value', - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - value: true, - editable: false - }, - _generalSettingGroup:_maptab_west_general_settings_group_map_tools - }, - { - _generalSettingId:'maptab_west_general_settings_data_scale_bar_showMinorMeasures', - _generalSettingTitle:_maptab_west_general_settings_data_scale_bar_showMinorMeasures, - _generalSettingRawValue:"", - _generalSettingValue:_config._mapControls.scaleBar.showMinorMeasures, - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - store:new Ext.data.SimpleStore({ - fields: ['name','value'], - data:[[_map_general_yes,true],[_map_general_no,false]] - }), - listeners:{ - select:function(cmp,record) - { - var record=record[0]; - - map_controls["scaleBar"].showMinorMeasures=record.data.value; - - map_controls["scaleBar"].update(); - } - }, - displayField: 'name', - valueField: 'value', - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - value:_config._mapControls.scaleBar.showMinorMeasures, - editable: false - }, - _generalSettingGroup:_maptab_west_general_settings_group_scale_bar - }, - { - _generalSettingId:'maptab_west_general_settings_data_scale_bar_singleLine', - _generalSettingTitle:_maptab_west_general_settings_data_scale_bar_singleLine, - _generalSettingRawValue:"", - _generalSettingValue:_config._mapControls.scaleBar.singleLine, - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - store:new Ext.data.SimpleStore({ - fields: ['name','value'], - data:[[_map_general_yes,true],[_map_general_no,false]] - }), - listeners:{ - select:function(cmp,record) - { - var record=record[0]; - - map_controls["scaleBar"].singleLine=record.data.value; - - map_controls["scaleBar"].update(); - } - }, - displayField: 'name', - valueField: 'value', - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - value:_config._mapControls.scaleBar.singleLine, - editable: false - }, - _generalSettingGroup:_maptab_west_general_settings_group_scale_bar - }, - { - _generalSettingId:'maptab_west_general_settings_data_scale_bar_abbreviateLabel', - _generalSettingTitle:_maptab_west_general_settings_data_scale_bar_abbreviateLabel, - _generalSettingRawValue:"", - _generalSettingValue:_config._mapControls.scaleBar.abbreviateLabel, - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - store:new Ext.data.SimpleStore({ - fields: ['name','value'], - data:[[_map_general_yes,true],[_map_general_no,false]] - }), - listeners:{ - select:function(cmp,record) - { - var record=record[0]; - - map_controls["scaleBar"].abbreviateLabel=record.data.value; - - map_controls["scaleBar"].update(); - } - }, - displayField: 'name', - valueField: 'value', - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - value:_config._mapControls.scaleBar.abbreviateLabel, - editable: false - }, - _generalSettingGroup:_maptab_west_general_settings_group_scale_bar - }, - { - _generalSettingId:'maptab_west_general_settings_data_scale_bar_divisions', - _generalSettingTitle:_maptab_west_general_settings_data_scale_bar_divisions, - _generalSettingRawValue:_config._mapControls.scaleBar.divisions, - _generalSettingValue:_config._mapControls.scaleBar.divisions, - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - store:new Ext.data.SimpleStore({ - fields: ['value'], - data:[[0],[1],[2],[3],[4],[5]] - }), - listeners:{ - select:function(cmp,record) - { - var record=record[0]; - - map_controls["scaleBar"].divisions=record.data.value; - - map_controls["scaleBar"].update(); - } - }, - displayField: 'value', - valueField: 'value', - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - emptyText:_config._mapControls.scaleBar.divisions, - value:_config._mapControls.scaleBar.divisions, - editable: false - }, - _generalSettingGroup:_maptab_west_general_settings_group_scale_bar - }, - { - _generalSettingId:'maptab_west_general_settings_data_scale_bar_subdivisions', - _generalSettingTitle:_maptab_west_general_settings_data_scale_bar_subdivisions, - _generalSettingRawValue:_config._mapControls.scaleBar.subdivisions, - _generalSettingValue:_config._mapControls.scaleBar.subdivisions, - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - store:new Ext.data.SimpleStore({ - fields: ['value'], - data:[[0],[1],[2],[3],[4],[5]] - }), - listeners:{ - select:function(cmp,record) - { - var record=record[0]; - - map_controls["scaleBar"].subdivisions =record.data.value; - - map_controls["scaleBar"].update(); - } - }, - displayField: 'value', - valueField: 'value', - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - emptyText:_config._mapControls.scaleBar.subdivisions, - value:_config._mapControls.scaleBar.subdivisions, - editable: false - }, - _generalSettingGroup:_maptab_west_general_settings_group_scale_bar - }, - { - _generalSettingId:'maptab_west_general_settings_group_toggle_banner', - _generalSettingTitle:_maptab_west_general_settings_group_toggle_banner, - _generalSettingRawValue:"", - _generalSettingValue:true, - _generalSettingEditor:{ - xtype:'combobox', - viewConfig: { - markDirty:false - }, - store:new Ext.data.SimpleStore({ - fields: ['name','value'], - data:[[_map_general_yes,true],[_map_general_no,false]] - }), - displayField: 'name', - valueField: 'value', - listeners:{ - select:function(combo,record) - { - var record=record[0]; - - if (record.data.value) - { - Ext.getCmp("viewport_north").show(); - }else{ - Ext.getCmp("viewport_north").hide(); - } - } - }, - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - value:true, - editable: false - }, - _generalSettingGroup:_maptab_west_general_settings_group_general - } - ]; - - maptab_west_general_settings_store.loadData(maptab_west_general_settings_store_data); - - init_maptab_general_default_state(); - -} - -var maptab_west_general_settings_grid_columns=[ - { - header: '', - dataIndex: '_generalSettingId', - hidden:true, - hideable:false - }, - { - header: '', - dataIndex: '_generalSettingTitle' - }, - { - header: '', - dataIndex: '_generalSettingRawValue', - renderer:maptab_west_general_settings_generalSettingRawValue_renderer, - flex:1, - field: { - allowBlank: false, - markDirty:false - } - }, - { - header: '', - dataIndex: '_generalSettingValue', - hidden:true, - hideable:false - }, - { - header: '', - dataIndex: '_generalSettingEditor', - hidden:true, - hideable:false - }, - { - header: '', - dataIndex: '_generalSettingGroup', - hidden:true, - hideable:false - } -] - -function maptab_west_general_settings_generalSettingRawValue_renderer(value, metaData, record, row, col, store, gridView) -{ - var _value=record.get("_generalSettingValue"); - - switch(_value) - { - case "true": - value=_map_general_yes; - break; - - case "false": - value=_map_general_no; - break; - - default: - switch(record.get("_generalSettingId")) - { - case "maptab_west_general_settings_data_map_projection": - - var _config=new _config_init_map(); - - var _defaultProjectionObjIndex=fn_objIndexOf(_config._mapProjections,"_epsg",_value); - - value = _config._mapProjections[_defaultProjectionObjIndex]._title; - - break; - - default: - value=_value; - break; - } - - break; - } - - return value; -} - -var maptab_west_general_settings_cellEditing = Ext.create('Ext.grid.plugin.CellEditing', { - clicksToEdit: 1, - listeners:{ - 'beforeedit': function(editor, e, eOpts ) - { - e.column.setEditor(e.record.get("_generalSettingEditor")); - }, - 'afteredit': function(editor, e, eOpts ) - { - if (e.value!=null) - { - e.record.set("_generalSettingValue",e.value); - - e.record.commit(); - } - - Ext.getCmp("maptab_west_general_settings_grid_id").getView().refresh(); - } - } - }); - -var maptab_west_general_settings_grid=new Ext.grid.Panel({ - border:true, - columnLines:true, - split: true, - id:'maptab_west_general_settings_grid_id', - viewConfig:{ - makeDirty:false - }, - store:maptab_west_general_settings_store, - columns:maptab_west_general_settings_grid_columns, - plugins:[maptab_west_general_settings_cellEditing], - selModel:{selType: 'cellmodel'}, - features: [{ - ftype: 'grouping' - }] - }); - - -var maptab_west_general_settings_panel ={ - xtype:'panel', - id:'maptab_west_general_settings_panel', - title:_maptab_west_general_settings_panel, - hidden: true, - region:'center', - autoScroll:true, - iconCls:'maptab_accordion_icon', - layout:'fit', - items:[maptab_west_general_settings_grid] -} - -function fn_maptab_bbar_general_map_center() -{ - var _config=new _config_init_map(); - var _numDigitsIndex=fn_objIndexOf(_config._mapProjections,"_epsg",mapGetCurrentDisplayProjection()); - - var _titleEPSG = _config._mapProjections[_numDigitsIndex]["_title"]; - var _numDigits=_config._mapProjections[_numDigitsIndex]._numDigits; - var _c=mapGetCenter(); - var _mapCenter=_c.lon.toFixed(_numDigits)+", "+ _c.lat.toFixed(_numDigits); - var _mapZoom=_c.zoom; - - Ext.getCmp("maptab_bbar_general_map_center").update(fn_replace(_maptab_bbar_general_map_center_zoom,['displayProjection','mapCenter','mapZoom'],[_titleEPSG,_mapCenter,_mapZoom])); -} - -function fn_maptab_bbar_general_current_scale() -{ - Ext.getCmp("maptab_bbar_general_current_scale").update(fn_replace(_maptab_bbar_general_current_scale,['mapScale'],["1:"+Math.round(mapGetCurrentScale())])); -} - - -function fn_maptab_bbar_general_basemap_projection() -{ - Ext.getCmp("maptab_bbar_general_basemap_projection").update(fn_replace(_maptab_bbar_general_basemap_projection,['mapProjection'],[mapGetCurrentProjection()])); -} - - -var mapMousePosition; - -function fn_maptab_bbar_general_mouse_position() -{ - if (mapMousePosition) - { - map.removeControl(mapMousePosition); - } - - var _config=new _config_init_map(); - var _numDigitsIndex=fn_objIndexOf(_config._mapProjections,"_epsg", mapGetCurrentDisplayProjection()); - - var _numDigits=_config._mapProjections[_numDigitsIndex]._numDigits; - var _titleEPSG = _config._mapProjections[_numDigitsIndex]["_title"]; - var positionText='
    '+_maptab_bbar_general_mouse_position_outside_of_map+'
    '; - - Ext.getCmp("maptab_bbar_general_mouse_position").update(positionText); - - mapMousePosition=new OpenLayers.Control.MousePosition({ - numDigits:Number(_numDigits), - element: document.getElementById("mapMouseCoordinatesDiv"), - emptyString:_maptab_bbar_general_mouse_position_outside_of_map - }); - - map.addControl(mapMousePosition); - - var maptab_bbar_general_mouse_position_label=fn_replace(_maptab_bbar_general_mouse_position,['displayProjection'],[_titleEPSG]); - - Ext.getCmp("maptab_bbar_general_mouse_position_label").update(maptab_bbar_general_mouse_position_label); - -} - -function init_maptab_general_default_state() -{ - - var maptab_west_general_settings_data_show_mouse_position_state = maptab_west_general_settings_store.findRecord("_generalSettingId", "maptab_west_general_settings_data_show_mouse_position"); - - maptab_west_general_settings_data_show_mouse_position_state = maptab_west_general_settings_data_show_mouse_position_state.get("_generalSettingValue"); - - if (maptab_west_general_settings_data_show_mouse_position_state=='true') - { - Ext.getCmp("maptab_bbar_general_mouse_position_label").show(); - Ext.getCmp("maptab_bbar_general_mouse_position").show(); - }else{ - Ext.getCmp("maptab_bbar_general_mouse_position_label").hide(); - Ext.getCmp("maptab_bbar_general_mouse_position").hide(); - } - - - var maptab_west_general_settings_data_show_basemap_projection_state= maptab_west_general_settings_store.findRecord("_generalSettingId", "maptab_west_general_settings_data_show_basemap_projection"); - - maptab_west_general_settings_data_show_basemap_projection_state = maptab_west_general_settings_data_show_basemap_projection_state.get("_generalSettingValue"); - - if (maptab_west_general_settings_data_show_basemap_projection_state=='true') - { - Ext.getCmp("maptab_bbar_general_basemap_projection").show(); - }else{ - Ext.getCmp("maptab_bbar_general_basemap_projection").hide(); - } - - - var maptab_west_general_settings_data_show_current_scale_state= maptab_west_general_settings_store.findRecord("_generalSettingId", "maptab_west_general_settings_data_show_current_scale"); - - maptab_west_general_settings_data_show_current_scale_state = maptab_west_general_settings_data_show_current_scale_state.get("_generalSettingValue"); - - if (maptab_west_general_settings_data_show_current_scale_state=='true') - { - Ext.getCmp("maptab_bbar_general_current_scale").show(); - }else{ - Ext.getCmp("maptab_bbar_general_current_scale").hide(); - } - - - var maptab_west_general_settings_data_set_coordinates_marker_state= maptab_west_general_settings_store.findRecord("_generalSettingId", "maptab_west_general_settings_data_set_coordinates_marker"); - - maptab_west_general_settings_data_set_coordinates_marker_state = maptab_west_general_settings_data_set_coordinates_marker_state.get("_generalSettingValue"); - - if (maptab_west_general_settings_data_set_coordinates_marker_state=='true') - { - Ext.getCmp("maptab_bbar_general_current_scale").show(); - }else{ - Ext.getCmp("maptab_bbar_general_current_scale").hide(); - } - - - - var maptab_west_general_settings_group_toggle_banner_state = maptab_west_general_settings_store.findRecord("_generalSettingId", "maptab_west_general_settings_group_toggle_banner"); - - maptab_west_general_settings_group_toggle_banner_state = maptab_west_general_settings_group_toggle_banner_state.get("_generalSettingValue"); - - if (maptab_west_general_settings_group_toggle_banner_state=='true') - { - Ext.getCmp("viewport_north").show(); - }else{ - - Ext.getCmp("viewport_north").hide(); - } -} - - -// TODO: GET RID OF IT. BE CAREFULT IT BREAKS THE LAYERS -function init_maptab_bbar_general_bbar() -{ - mapOnChangeBaseLayer(fn_maptab_bbar_general_basemap_projection); - mapOnZoomEnd(fn_maptab_bbar_general_current_scale); - mapOnMoveEnd(fn_maptab_bbar_general_map_center); - - var mapBbar=[ - { - xtype:'combobox', - displayField: 'name', - valueField: 'value', - emptyText:_maptab_bbar_general_zoom_to_scale, - id:'maptab_bbar_general_zoom_to_scale', - width:200, - store:new Ext.data.SimpleStore({ - fields: ['value','name'], - data:mapGetBasemapResolutions() - }), - listeners:{ - select:function(combo,record) - { - var record=record[0]; - - mapZoomToScale(record.get("value")); - } - }, - forceSelection: true, - triggerAction: 'all', - selectOnFocus: false, - mode: 'local', - editable: false, - hidden: true - }, - { - xtype:'textfield', - id:'maptab_bbar_general_zoom_to_x', - emptyText:_maptab_bbar_general_zoom_to_x, - width:60, - hidden: true - }, - { - xtype:'textfield', - id:'maptab_bbar_general_zoom_to_y', - emptyText:_maptab_bbar_general_zoom_to_y, - width:60, - hidden: true - }, - { - xtype:'button', - text:_maptab_bbar_general_zoom_to_go, - hidden: true, - handler:function() - { - var lon=Ext.getCmp("maptab_bbar_general_zoom_to_x").getValue(); - var lat=Ext.getCmp("maptab_bbar_general_zoom_to_y").getValue(); - - if(Ext.isNumeric(lon) && Ext.isNumeric(lat)) - { - maptab_toolbar_general_setCoordinates(lon,lat,mapGetCurrentDisplayProjection()); - } - } - },{ - xtype:'label', - id:'maptab_bbar_general_wait_label', - html:_map_general_please_wait - }, - '->', - { - xtype:'label', - id:'maptab_bbar_general_map_center' - }, - { - xtype:'label', - id:'maptab_bbar_general_current_scale' - }, - { - xtype:'label', - id:'maptab_bbar_general_basemap_projection' - }, - { - xtype:'label', - id:'maptab_bbar_general_mouse_position_label' - }, - { - xtype:'label', - width:150, - id:'maptab_bbar_general_mouse_position' - } - ] - - - Ext.getCmp("maptab_mapPanel").addDocked({ - id: 'maptab_mapPanel_toolbar_1', - xtype: 'toolbar', - dock: 'bottom', - flex:1, - items: mapBbar - }); - - fn_maptab_bbar_general_map_center(); - fn_maptab_bbar_general_current_scale(); - fn_maptab_bbar_general_basemap_projection(); - fn_maptab_bbar_general_mouse_position(); -} diff --git a/public/js/trash/maptab/maptab_west_layer_tree_panel.js b/public/js/trash/maptab/maptab_west_layer_tree_panel.js deleted file mode 100644 index 4d580b3..0000000 --- a/public/js/trash/maptab/maptab_west_layer_tree_panel.js +++ /dev/null @@ -1,830 +0,0 @@ -// var activeGeoJsons = {}; -Ext.override(Ext.data.Model, { - // fixes the issue where null newId doesn't use me.internalId to copy the record using its existing ID - copy: function (newId) { - var me = this; - return new me.self(me.raw, newId || me.internalId, null, Ext.apply({}, me[me.persistenceProperty])); - } -}); - -Ext.override(Ext.data.NodeInterface, { - statics: { - getPrototypeBody: function () { - var result = this.callParent(); - - result.filter = function (property, value, anyMatch, caseSensitive, matchParentNodes) { - var filters = []; - - //support for the simple case of filtering by property/value - if (Ext.isString(property)) { - filters.push(new Ext.util.Filter({ - property: property, - value: value, - anyMatch: anyMatch, - caseSensitive: caseSensitive - })); - } else if (Ext.isArray(property) || property instanceof Ext.util.Filter) { - filters = filters.concat(property); - } - - // At this point we have an array of zero or more Ext.util.Filter objects to filter with, - // so here we construct a function that combines these filters by ANDing them together - // and filter by that. - return this.filterBy(Ext.util.Filter.createFilterFn(filters), null, matchParentNodes); - }; - - result.filterBy = function (fn, scope, matchParentNodes) { - var me = this, - newNode = me.copy(null, true), - matchedNodes = [], - allNodes = [], - markMatch, i; - - markMatch = function (node) { - node.filterMatch = true; - if (node.parentNode) { - markMatch(node.parentNode); - } - }; - - newNode.cascadeBy(function (node) { - allNodes.push(node); - if (fn.call(scope || me, node)) { - if (node.isLeaf() || matchParentNodes === true) { - matchedNodes.push(node); - } - } - }); - - for (i = 0; i < matchedNodes.length; i++) { - markMatch(matchedNodes[i]) - }; - - for (i = 0; i < allNodes.length; i++) { - if (allNodes[i].filterMatch !== true) { - allNodes[i].remove(); - } - }; - - return newNode; - } - - return result; - } - } -}); - -Ext.define('Ext.override.data.TreeStore', { - override: 'Ext.data.TreeStore', - hasFilterListeners: false, - filter: function (filters, value, anyMatch, caseSensitive, matchParentNodes) { - - if (Ext.isString(filters)) { - filters = { - property: filters, - value: value, - root: 'data', - anyMatch: anyMatch, - caseSensitive: caseSensitive - }; - } - - var me = this, - decoded = me.decodeFilters(filters), - i, - doLocalSort = me.sorters.length && me.sortOnFilter && !me.remoteSort, - length = decoded.length, - filtered; - - for (i = 0; i < length; i++) { - me.filters.replace(decoded[i]); - } - - if (me.remoteFilter) { - // So that prefetchPage does not consider the store to be fully loaded if the local count is equal to the total count - delete me.totalCount; - - // Reset to the first page, the filter is likely to produce a smaller data set - me.currentPage = 1; - //the load function will pick up the new filters and request the filtered data from the proxy - me.load(); - } else { - if (me.filters.getCount()) { - me.snapshot = me.snapshot || me.getRootNode().copy(null, true); - - // Filter the unfiltered dataset using the filter set - filtered = me.setRootNode(me.snapshot.filter(me.filters.items, null, null, null, matchParentNodes)); - filtered.getOwnerTree().expandAll(); - - me.addFilterListeners(); - - if (doLocalSort) { - me.sort(); - } else { - // fire datachanged event if it hasn't already been fired by doSort - me.fireEvent('datachanged', me); - me.fireEvent('refresh', me); - } - } - } - me.fireEvent('filterchange', me, me.filters.items); - }, - addFilterListeners: function () { - var me = this; - - if (!me.hasFilterListeners) { - me.on(me.filterListeners); - me.hasFilterListeners = true; - } - }, - filterBy: function (fn, scope, matchParentNodes) { - var me = this; - - me.snapshot = me.snapshot || me.getRootNode().copy(null, true); - me.setRootNode(me.queryBy(fn, scope || me, matchParentNodes)); - me.addFilterListeners(); - me.fireEvent('datachanged', me); - me.fireEvent('refresh', me); - }, - queryBy: function (fn, scope, matchParentNodes) { - var me = this; - return (me.snapshot || me.getRootNode()).filterBy(fn, scope || me, matchParentNodes); - }, - clearFilter: function (suppressEvent) { - var me = this; - - me.filters.clear(); - - if (me.hasFilterListeners) { - me.un(me.filterListeners); - me.hasFilterListeners = false; - } - - if (me.remoteFilter) { - // In a buffered Store, the meaning of suppressEvent is to simply clear the filters collection - if (suppressEvent) { - return; - } - // So that prefetchPage does not consider the store to be fully loaded if the local count is equal to the total count - delete me.totalCount; - - // For a buffered Store, we have to clear the prefetch cache because the dataset will change upon filtering. - // Then we must prefetch the new page 1, and when that arrives, reload the visible part of the Store - // via the guaranteedrange event - if (me.buffered) { - me.data.clear(); - me.loadPage(1); - } else { - // Reset to the first page, clearing a filter will destroy the context of the current dataset - me.currentPage = 1; - me.load(); - } - } else if (me.isFiltered()) { - me.setRootNode(me.snapshot); - delete me.snapshot; - - if (suppressEvent !== true) { - me.fireEvent('datachanged', me); - me.fireEvent('refresh', me); - } - } - - if (me.sorters && me.sorters.items.length > 0) { - me.sort(); - } - - me.fireEvent('filterchange', me, me.filters.items); - }, -isFiltered: function () { - var snapshot = this.snapshot; - return !!(snapshot && snapshot !== this.getRootNode()); - }, - addFilter: function (filters, applyFilters) { - var me = this, - decoded, - i, - length; - - // Decode passed filters and replace/add into the filter set - decoded = me.decodeFilters(filters); - length = decoded.length; - for (i = 0; i < length; i++) { - me.filters.replace(decoded[i]); - } - - if (applyFilters !== false) { - me.filter(); - } - me.fireEvent('filterchange', me, me.filters.items); - }, - removeFilter: function (toRemove, applyFilters) { - var me = this; - - if (!me.remoteFilter && me.isFiltered()) { - if (toRemove instanceof Ext.util.Filter) { - me.filters.remove(toRemove); - } else { - me.filters.removeAtKey(toRemove); - } - - if (applyFilters !== false) { - - // Not gone down to zero filters - re-filter Store - if (me.filters.getCount()) { - me.filter(); - } - - // No filters left - let clearFilter do its thing. - else { - me.clearFilter(); - } - } - me.fireEvent('filterchange', me, me.filters.items); - } - }, - sortOnFilter: true, - remoteFilter: false -}); - -var maptab_west_layer_tree_panel_tree_json_store = Ext.create('Ext.data.TreeStore', { - fields: ['text', 'tools', '_groupId'], - root: { - text: 'root', - children: [ - { - text: _maptab_west_layer_tree_panel_tabs_layers_node_title_basemaps, - id: 'maptab_west_layer_tree_panel_tabs_layers_basemaps_node', - expanded: false - }, { - text: _maptab_west_layer_tree_panel_tabs_layers_node_title_layers, - id: 'maptab_west_layer_tree_panel_tabs_layers_layers_node', - _groupId: 'layers', - expanded: true, - checked: true - } - ] - } -}); - -var maptab_west_layer_tree_panel_tree = { - xtype: 'tree-grid', - rootVisible: false, - id: 'maptab_west_layer_tree_panel_tree', - border: false, - multiSelect: true, - plugins: [ - Ext.create('Ext.grid.plugin.CellEditing', { - clicksToEdit: 2 - }) - ], - viewConfig: { - markDirty: false, - plugins: { - ptype: 'treeviewdragdrop' - }, - listeners: { - drop: function () { - maptab_west_layer_reorder_layer(); - } - } - }, - listeners: { - checkchange: function (node, checked) { - maptab_west_layer_check_node(node, checked); - }, // console.log(node.internalId); - itemcontextmenu: function (view, node, item, index, event) { - if (node.isLeaf()) { - event.preventDefault(); - maptab_west_layer_layer_menu_show(view, node, item, index, event); - } - else { - event.preventDefault(); - maptab_west_layer_folder_menu_show(view, node, item, index, event); - } - } - }, - store: maptab_west_layer_tree_panel_tree_json_store, - columns: [ - { - dataIndex: 'tools', - width: 40 - }, - { - dataIndex: '_groupId', - width: 40, - hidden: true, - hideable: false - }, - { - xtype: 'treecolumn', - dataIndex: 'text', - autoSizeColumn: true, - flex: 2, - editor: { - xtype: "textfield", - allowBlank: false - } - }], - dockedItems: [{ - xtype: 'toolbar', - dock: 'top', - items: [{ - labelWidth: 120, - fieldLabel: _maptab_east_search_panel, - hidden: true, - xtype: 'trigger', - triggerCls: 'x-form-clear-trigger', - onTriggerClick: function () { - this.reset(); - this.focus(); - }, - listeners: { - change: function (field, newVal) { - var tree = field.up('treepanel'), - store = tree.getStore(); - - if (Ext.isEmpty(newVal)) { - store.clearFilter(); - map.layers.forEach(function (ly) { - var node = maptab_west_layer_get_node_from_id(ly.id); - try{ - node.set('checked', ly.visibility); - }catch(err){} - }); - return; - } - store.clearFilter(); - map.layers.forEach(function (ly) { - var node = maptab_west_layer_get_node_from_id(ly.id); - try{ - node.set('checked', ly.visibility); - }catch(err){} - }); - - store.filter('text', newVal, true, false); - }, - buffer: 250 - } - }] - }] -} - -var maptab_west_layer_tree_panel_tabs = { - xtype: 'tabpanel', - id: 'maptab_west_layer_tree_panel_tabs', -// region: 'center', - border: false, -// height: 'screen', - items: [ - { - xtype: 'panel', - border: false, - layout: 'fit', - hidden: !EDITABLE, - title: _maptab_west_layer_tree_panel_tabs_layers, - items: [maptab_west_layer_tree_panel_tree], - }] -} - -var maptab_west_layer_tree_panel = { - xtype: 'panel', - id: 'maptab_west_layer_tree_panel', - region: 'center', - layout: 'border', - items: [ - maptab_west_layer_tree_panel_tabs - ], - tbar: [ - { - xtype: 'button', - id: 'maptab_west_layer_tree_panel_add_btn', - text: _map_general_add_btn, - iconCls: 'map_general_add_btn', - tooltip: _map_general_add_btn, - hidden: true, - handler: function () { - maptab_services_manager.show(); - } - }, - { - xtype: 'button', - id: 'maptab_west_layer_tree_panel_remove_btn', - text: _map_general_remove_btn, - iconCls: 'map_general_remove_btn', - tooltip: _map_general_remove_btn, - hidden: true, - handler: function () { - var _selected_Nodes = Ext.getCmp('maptab_west_layer_tree_panel_tree').getSelectionModel().getSelection(); - - Ext.each(_selected_Nodes, function (item) { - maptab_west_layer_remove_node(item); - - }); - } - } - ] -} - - -function maptab_west_layer_add_BaseLayer(_layer, _node) { - _node.insertBefore({ - id: _layer.id, - text: _layer.name, - leaf: true, - icon: _layer.icon, - iconCls: 'maptab_services_manager_layer_legend_size', - checked: _layer.visibility, - tools: "" - }, _node.firstChild); -} - - -function maptab_west_layer_add_layer(_layer, _node) { - _node.insertBefore({ - id: _layer._layerObject._layerId, - text: _layer._layerObject._layerTitle, - leaf: true, - qtip: '', - icon: _layer._layerObject._layerLegend, - iconCls: 'maptab_services_manager_layer_legend_size', - checked: _layer.visibility, - realName: _layer._layerObject._layerName, - url: _layer._layerObject._layer.url, - tools: "" + _layer._layerObject._layerTitle + "
    " + _layer._layerObject._layerName + "
    " + _layer._layerObject._layerAbstract + "\"> " - }, _node.firstChild); - - return _node; -} - -function maptab_west_layer_get_layer_title(_layerId) { - var _node = maptab_west_layer_tree_panel_tree_json_store.getRootNode().findChild("id", _layerId, true); - - return _node.data.text; -} - -function maptab_west_layer_set_layer_icon(_layerId, _icon) { - var _node = maptab_west_layer_tree_panel_tree_json_store.getRootNode().findChild("id", _layerId, true); - - _node.set("icon", _icon); -} - -function maptab_west_layer_set_edit_layer(_layerId) { - var _node = maptab_west_layer_tree_panel_tree_json_store.getRootNode().findChild("id", _layerId, true); - var _layer = mapFindLayerById(_layerId); - - _node.data.tools = "" + _layer._layerObject._layerTitle + "
    " + _layer._serviceObject._serviceAbstract + "\">" -} - -function maptab_west_layer_remove_node(_node) { - if (typeof _node !== "undefined") { - if (_node.hasChildNodes()) { - while (_node.firstChild) { - maptab_west_layer_remove_node(_node.firstChild); - } - } - - if (_node.isLeaf()) { - mapRemoveLayer(mapFindLayerById(_node.data.id)); - } - - _node.remove(); - } -} - -function maptab_west_layer_check_node(_node, checked) { - console.debug(_node); - if (_node.hasChildNodes()) { - Ext.each(_node.childNodes, function (item) { - maptab_west_layer_check_node(item, checked); - }); - } - - if (_node.isLeaf() && (!mapLayerIsBaseLayer(_node.data.id))) { - mapChangeLayerVisibility(_node.data.id, checked); - - let layerName = maptab_west_layer_get_node_from_id(_node.data.id).raw.realName; - - console.debug("LAYER NAME: ", layerName); - if (!checked) { - console.debug("layer to remove: ", layerName); - // remove unchecked layer - mapL.removeLayer(activeLayerList[layerName]); - delete activeLayerList[layerName]; - activeLayerIds.splice(activeLayerIds.indexOf(_node.internalId),1); - if (layerName in activeGeoJsons) { - activeGeoJsons[layerName].clearLayers(); - delete activeGeoJsons[layerName]; - } - } else { - if (!(layerName in activeLayerList)) { - console.debug("LAYER NAME: ", layerName); - if (geoJsonLayers.includes(layerName)) { - activeLayer = L.tileLayer.wms(_node.raw.url, { - layers: _node.raw.realName, format: 'image/png', tiled: false, transparent: true}).addTo(mapL); - activeGeoJsons[layerName] = fetchGeoJson(layerName); - } else { - - - // activeLayer = L.tileLayer.betterWms(BASE_URL + '/backend/geoserver/wms.php', { layers: _node.raw.realName, transparent: true, format: "image/png"}).addTo(mapL); - - } - activeLayer["internalId"] = _node.internalId; - activeLayerList[layerName] = activeLayer; - activeLayerIds.push(_node.internalId); - - } - } - if (!_) - console.debug('added: ', activeLayer); - } - - if (_node.isLeaf() && (mapLayerIsBaseLayer(_node.data.id))) { - maptab_west_layer_set_BaseLayer(_node.data.id); - _node.set('checked', true); - - return; - } - _node.set('checked', checked); -} - -function maptab_west_layer_set_BaseLayer(_layerId) { - maptab_west_layer_tree_panel_tree_json_store.getNodeById('maptab_west_layer_tree_panel_tabs_layers_basemaps_node').eachChild(function (node) { - - if (node.isLeaf()) { - node.set('checked', false); - } - }); - - mapSetBaseMapLayer(_layerId); - -} - -function maptab_west_layer_reorder_layer() { - var _index = mapGetCountOfOverlayers(); - var _node = maptab_west_layer_tree_panel_tree_json_store.getNodeById('maptab_west_layer_tree_panel_tabs_layers_layers_node'); - - _node.cascadeBy(function (node) { - if (node.isLeaf()) { - mapReorderLayer(node.data.id, _index); - _index--; - } - }); -} - -function maptab_west_layer_folder_menu_show(view, node, item, index, event) { - var menu = new Ext.menu.Menu({ - items: [ - { - text: _maptab_west_layer_tree_panel_tabs_layers_node_create_subfolder_menu_title, - iconCls: 'map_general_add_btn', - handler: function () { - maptab_west_layer_folder_add_group(node, Ext.id(), _maptab_west_layer_tree_panel_tabs_layers_node_new_subfolder_title, true, true); - } - }, - { - text: _maptab_west_layer_tree_panel_tabs_layers_node_remove_subfolder_menu_title, - iconCls: 'map_general_remove_btn', - handler: function () { - maptab_west_layer_remove_node(node); - } - } - ] - }); - - menu.showAt(event.getXY()); -} - -function maptab_west_layer_folder_add_group(_node, _nodeId, _nodeTitle, _nodeExpanded, _nodeChecked) { - _node.insertBefore({ - text: _nodeTitle, - expanded: _nodeExpanded, - checked: _nodeChecked, - id: _nodeId, - tools: "" - }, _node.firstChild); -} - -var _maptab_west_layer_layer_menu_components = []; - -function maptab_west_layer_layer_menu_show(view, node, item, index, event) { - - if (!mapLayerIsBaseLayer(node.data.id)) { - var _current_opacity = Number(mapGetOpacity(node.data.id) * 100); - var _opacity = { - text: _maptab_west_layer_tree_panel_tabs_layers_node_opacity_layer_menu_title, - iconCls: 'maptab_layer_tree_opacity', - menu: [{ - xtype: 'slider', - width: 100, - hideLabel: true, - useTips: true, - increment: 10, - value: _current_opacity, - minValue: 0, - maxValue: 100, - listeners: { - change: function (slider, value, thumb) { - var opacity = (value * 0.01); - mapSetOpacity(node.data.id, Number(opacity)); - } - } - }] - }; - - var _maxExtent = { - text: _maptab_west_layer_tree_panel_tabs_layers_node_extent_layer_menu_title, - iconCls: 'maptab_toolbar_general_extent', - handler: function () { - mapExtentToLayer(node.data.id); - } - }; - - var _scales = ""; - - _scales = { - text: _maptab_west_layer_tree_panel_tabs_layers_node_scales_layer_menu_title, - iconCls: 'map_general_extent', - menu: maptab_west_layer_layer_menu_create_scales(mapFindLayerById(node.data.id)._layerObject._scales, node.data.id) - }; - - var _serviceObject = mapFindLayerById(node.data.id)._serviceObject; - var _layerObject = mapFindLayerById(node.data.id)._layerObject; - var _removeLayer = ""; - var _config = new _config_init_map(); - - if (typeof _config._canRemoveLayer !== "undefined") { - if (_config._canRemoveLayer) { - _removeLayer = { - text: _maptab_west_layer_tree_panel_tabs_layers_node_remove_layer_menu_title, - iconCls: 'map_general_remove_btn', - disabled: _layerObject._isEdited, - handler: function () { - maptab_west_layer_remove_node(node); - } - } - } - } - - var _refresh = ""; - var _information = ""; - - if (_serviceObject._isService) { - _refresh = { - text: _maptab_west_layer_tree_panel_tabs_layers_node_refresh_layer_menu_title, - iconCls: 'maptab_layer_tree_refresh', - disabled: _layerObject._isEdited, - handler: function () { - var _serviceObject = mapFindLayerById(node.data.id)._serviceObject; - var _layerObject = mapFindLayerById(node.data.id)._layerObject; - - if (_serviceObject._isService) { - if (_serviceObject._isVector) { - mapFindLayerById(node.data.id).refresh(); - } else { - mapFindLayerById(node.data.id).redraw(true); - } - } - } - }; - - var _layerInfoHTML = ""; - _layerInfoHTML += "" + _maptab_west_layer_tree_panel_tabs_layers_node_information_layer_responsible_party + " : " + _serviceObject._responsible_party + "
    "; - _layerInfoHTML += "" + _maptab_west_layer_tree_panel_tabs_layers_node_information_layer_responsible_person + " : " + _serviceObject._responsible_person + "
    "; - _layerInfoHTML += "" + _maptab_west_layer_tree_panel_tabs_layers_node_information_layer_responsible_position + " : " + _serviceObject._responsible_position + "
    "; - _layerInfoHTML += "" + _maptab_west_layer_tree_panel_tabs_layers_node_information_layer_responsible_email + " : " + _serviceObject._responsible_email + "
    "; - _layerInfoHTML += "" + _maptab_west_layer_tree_panel_tabs_layers_node_information_layer_responsible_fees + " : " + _serviceObject._responsible_fees + "
    "; - _layerInfoHTML += "" + _maptab_west_layer_tree_panel_tabs_layers_node_information_layer_responsible_access_constrains + " : " + _serviceObject._responsible_access_constrains - _information = { - text: _maptab_west_layer_tree_panel_tabs_layers_node_information_layer_menu_title, - iconCls: 'maptab_toolbar_general_featureInfo', - menu: [{ - xtype: 'panel', - html: _layerInfoHTML - }] - }; - } - - var _elevation = ""; - - if (typeof mapFindLayerById(node.data.id)._layerObject._elevationDefault !== "undefined") { - if ((mapFindLayerById(node.data.id)._layerObject._elevationDefault != null) && (mapFindLayerById(node.data.id)._layerObject._elevationDefault != "")) { - _elevation = { - text: _maptab_west_layer_tree_panel_tabs_layers_node_elevation_layer_menu_title, - menu: maptab_west_layer_layer_menu_create_elevation(mapFindLayerById(node.data.id)._layerObject._elevationDefault, node.data.id) - }; - } - } - - var menu = new Ext.menu.Menu({ - _nodeId: node.data.id, - closeAction: 'destroy', - items: [ - _information, - _maxExtent, - _refresh, - _opacity, - _scales, - _elevation, - _removeLayer - ] - }); - - menu.insert(6, _maptab_west_layer_layer_menu_components); - menu.showAt(event.getXY()); - } -} - - -function maptab_west_layer_get_node_from_id(_id) { - var _node = maptab_west_layer_tree_panel_tree_json_store.getNodeById(_id); - - return _node; -} - - -function maptab_west_layer_layer_menu_create_scales(_scales, _layerId) { - var _scalesMenu = []; - var _config = new _config_init_map(); - var _defaultScales = _config._defaultScales; - var _layerScales = mapFindLayerById(_layerId)._layerObject._scales; - - if (_layerScales != null) { - for (var i = 0; i < _defaultScales.length; i++) { - var _text = "1:" + _defaultScales[i] + " <1:" + _defaultScales[i + 1]; - var _min = _defaultScales[i]; - var _max; - - if (_defaultScales[i + 1]) { - _max = _defaultScales[i + 1]; - _text = "1:" + _defaultScales[i] + " <1:" + _defaultScales[i + 1]; - } else { - _text = ">" + _defaultScales[i]; - _max = -1; - } - - var _currentScale = [_min, _max]; - var _checked = false; - var _currentLayerScale = _layerScales[i]; - - if (_currentLayerScale[0] == _min) { - _checked = true; - } - - _scalesMenu.push({ - xtype: 'menucheckitem', - text: _text, - checked: _checked, - _currentScale: _currentScale, - _currentScaleIndex: i, - listeners: { - checkchange: function (item, _checked) { - _layerScales[item._currentScaleIndex] = 0; - - if (_checked) { - _layerScales[item._currentScaleIndex] = item._currentScale; - } - - mapFindLayerById(_layerId)._layerObject._scales = _layerScales; - mapSetVisibilityBaseOnScales(); - } - } - }); - } - } - - return _scalesMenu; -} - - -function maptab_west_layer_layer_menu_create_elevation(_elevation, _layerId) { - var _elevationMenu = []; - var _layerElevation = mapFindLayerById(_layerId)._layerObject._elevation; - - if (_layerElevation != null) { - for (var i = 0; i < _layerElevation.length; i++) { - var _checked = false; - var _currentLayerElavation = _layerElevation[i]; - - if (_currentLayerElavation == _elevation) { - _checked = true; - } - - var _text = _currentLayerElavation; - - _elevationMenu.push({ - xtype: 'menucheckitem', - text: _text, - checked: _checked, - listeners: { - checkchange: function (item, _checked) { - mapFindLayerById(_layerId)._layerObject._elevationDefault = item.text; - mapFindLayerById(_layerId).mergeNewParams({ 'elevation': item.text }); - } - } - }); - } - } - - return _elevationMenu; -} - diff --git a/public/js/trash/maptab/maptab_west_search_settings_panel.js b/public/js/trash/maptab/maptab_west_search_settings_panel.js deleted file mode 100644 index 8cf9794..0000000 --- a/public/js/trash/maptab/maptab_west_search_settings_panel.js +++ /dev/null @@ -1,168 +0,0 @@ -var maptab_west_search_settings_store=Ext.create('Ext.data.Store', { - fields: ['_layerId','_canChangeSearchSettings','_layerLegend','_layerTitle','_isSearchable','_isQueryable'], - data: [] -}); - - -var maptab_west_search_settings_panel ={ - xtype:'panel', - id:'maptab_west_search_settings_panel', - title:_maptab_west_search_settings_panel, - hidden: true, - region:'center', - autoScroll:true, - layout:'fit', - iconCls:'maptab_accordion_icon', - items:[{ - xtype:'gridpanel', - border:true, - columnLines:true, - split: true, - id:'maptab_west_search_settings_grid', - store:maptab_west_search_settings_store, - columns:[ - { - header: '', - dataIndex: "_layerId", - hidden:true, - hideable:false - }, - { - header: '', - dataIndex: "_canChangeSearchSettings", - hidden:true, - hideable:false - }, - { - header: '', - dataIndex: "_layerLegend", - hidden:false, - sortable: true, - width:35, - maxWidth:35, - minWidth:35, - hideable:false, - renderer:fn_gridLayerLegend - }, - { - header: _maptab_west_search_settings_grid_column_layerTitle, - dataIndex: "_layerTitle", - hidden:false, - hideable:false - }, - { - header: ""+_maptab_west_search_settings_grid_column_isSearchable, - dataIndex: "_isSearchable", - sortable:false, - hidden:false, - width:40, - flex:2, - hideable:false, - renderer:maptab_west_search_settings_panel_check_renderer - }, - { - header: ""+_maptab_west_search_settings_grid_column_isQueryable, - dataIndex: "_isQueryable", - sortable:false, - hidden:false, - flex:2, - width:40, - hideable:false, - renderer:maptab_west_search_settings_panel_check_renderer - } - ] - }] -} - -function maptab_west_search_settings_panel_checkall_queryable(item) -{ - - var _g = Ext.getCmp("maptab_west_search_settings_grid"); - - for (var i = 0; i < _g.getStore().data.length; i++) { - - var record = _g.getStore().getAt(i); - - record.data._isQueryable=item.checked; - - var _layerId = record.data._layerId; - - maptab_west_search_settings_panel_oncheck(item,"_isQueryable",_layerId); - - } - - _g.getView().refresh(); -} - -function maptab_west_search_settings_panel_checkall_searchable(item) -{ - var _g = Ext.getCmp("maptab_west_search_settings_grid"); - - for (var i = 0; i < _g.getStore().data.length; i++) { - - var record = _g.getStore().getAt(i); - - record.data._isSearchable=item.checked; - - var _layerId = record.data._layerId; - - maptab_west_search_settings_panel_oncheck(item,"_isSearchable",_layerId); - } - - _g.getView().refresh(); -} - -function maptab_west_search_settings_panel_check_renderer(value, metaData, record, row, col, store, gridView) -{ - var disabled=""; - - var column = gridView.getHeaderAtIndex(col); - - var dataIndex = column.dataIndex; - - if (value) - return ""; - else - return ""; -} - -function maptab_west_search_settings_panel_oncheck(item,_canDoField,_layerId) -{ - - var _layer=mapFindLayerById(_layerId); - - _layer._layerObject[_canDoField]=item.checked; - -} - -function init_maptab_west_search_settings_grid_store_populate() -{ - mapOnRemoveLayer(maptab_west_search_settings_grid_on_add_remove_layer); - - mapOnAddLayer(maptab_west_search_settings_grid_on_add_remove_layer); -} - -function maptab_west_search_settings_grid_on_add_remove_layer() -{ - maptab_west_search_settings_store.removeAll(); - - var overlayers=mapGetlayersBy("isBaseLayer",false); - - for(var i=(overlayers.length-1);i>=0;i--) - { - if (typeof overlayers[i]._layerObject!=="undefined") - { - if (overlayers[i]._layerObject._canChangeSearchSettings) - { - maptab_west_search_settings_store.add({ - _layerId:overlayers[i]._layerObject._layerId, - _canChangeSearchSettings:overlayers[i]._layerObject._canChangeSearchSettings, - _layerLegend:overlayers[i]._layerObject._layerLegend, - _layerTitle:overlayers[i]._layerObject._layerTitle, - _isSearchable:overlayers[i]._layerObject._isSearchable, - _isQueryable:overlayers[i]._layerObject._isQueryable - }); - } - } - } -} diff --git a/public/js/trash/maptab/maptab_west_selection_panel.js b/public/js/trash/maptab/maptab_west_selection_panel.js deleted file mode 100644 index 6e040d9..0000000 --- a/public/js/trash/maptab/maptab_west_selection_panel.js +++ /dev/null @@ -1,96 +0,0 @@ -var maptab_west_selection_panel_grid_columns=[ - {_attributeName:"_featureId",_attributeSortable:false,_attributeType:"string",_attributeTranslation:"", width:28,hideable:false,renderer:fn_featureShowOnMapRenderer}, - {_attributeName:"_featureId",_attributeSortable:false,_attributeType:"string",_attributeTranslation:"", width:28,hideable:false,renderer:fn_featureInfoWindowRenderer}, - {_attributeName:"_featureId",_attributeSortable:false,_attributeType:"string",_attributeTranslation:"", width:28,hideable:false,renderer:fn_featureDownloadRenderer}, - {_attributeName:"_featureUrl",_attributeSortable:false,_attributeType:"string",_attributeTranslation:"",hideable:false,hidden:true}, - {_attributeName:"_srsName", _attributeSortable:false,_attributeType:"string",_attributeTranslation:"",hideable:false,hidden:true}, - {_attributeName:"_featureId",_attributeSortable:true,_attributeType:"string",_attributeTranslation:"",hidden:true,hideable:false}, - {_attributeName:"_feature",_attributeSortable:true,_attributeType:"object",_attributeTranslation:"",hidden:true,hideable:false}, - {_attributeName:"_layerId",_attributeSortable:true,_attributeType:"string",_attributeTranslation:"",hidden:true,hideable:false}, - {_attributeName:"_featureGeomFormat",_attributeSortable:true,_attributeType:"string",_attributeTranslation:"",hidden:true,hideable:false}, - {_attributeName:"_summary",_attributeSortable:true,_attributeType:"string",_attributeTranslation:_feature_Attributes_Translations_Summary,flex:3} -]; - - - -var maptab_west_selection_panel_grid_store=fn_createAttributesStore(maptab_west_selection_panel_grid_columns); - -maptab_west_selection_panel_grid_store.group("_layerId"); - -var maptab_west_selection_panel_grid=new Ext.grid.Panel({ - border:true, - columnLines:true, - split: true, - selModel: Ext.create('Ext.selection.CheckboxModel',{mode:'SIMPLE',checkOnly:true}), - store:maptab_west_selection_panel_grid_store, - columns:fn_createAttributesColumnModel(maptab_west_selection_panel_grid_columns), - features: [{ - ftype: 'grouping', - groupHeaderTpl: [ - '{name:this.formatName}', - { - formatName: function(name) { - return mapFindLayerById(name)._layerObject._layerTitle + " ("+mapFindLayerById(name)._serviceObject._serviceType+")"; - } - } - ] - }] -}); - -var maptab_west_selection_panel ={ - xtype:'panel', - hidden: true, - id:'maptab_west_selection_panel', - title:_maptab_west_selection_panel, - region:'center', - autoScroll:true, - iconCls:'maptab_accordion_icon', - layout:'fit', - items:[maptab_west_selection_panel_grid], - tbar:['->', - { - xtype:'button', - tooltip:_maptab_west_selection_panel_remove_btn, - iconCls:'map_general_remove_btn', - handler:function() - { - var _selected=maptab_west_selection_panel_grid.getSelectionModel().getSelection(); - maptab_west_selection_panel_grid.getStore().remove(_selected); - var _count=maptab_west_selection_panel_grid.getStore().getCount(); - - Ext.getCmp("maptab_west_selection_panel").setTitle(_maptab_west_selection_panel+"("+_count+")"); - } - }] -} - - -function maptab_west_selection_panel_grid_add_record(_featureId,_layerId,_featureUrl,_srsName,_featureGeomFormat) -{ - var _data=new Array(); - var _feature={ - _featureId:_featureId, - _layerId:_layerId, - _srsName:_srsName, - _featureUrl:_featureUrl, - _featureGeomFormat:_featureGeomFormat, - _featureAttributes:"" - }; - - var feature=fn_fetchGML(_feature); - var _att=clone(feature.attributes); - - _att._layerId=_layerId; - _att._featureId=_featureId; - _att._srsName=mapFindLayerById(_layerId)._layerObject._nativeSRS; - _att._featureUrl=_featureUrl; - _att._feature=feature.clone(); - _att._featureGeomFormat=_featureGeomFormat; - - var _record=fn_createAttributeSummary(_att,mapFindLayerById(_layerId)._layerObject._attributesFields); - - _data.push(_record); - maptab_west_selection_panel_grid.getStore().loadData(_data,true); - var _count=maptab_west_selection_panel_grid.getStore().getCount(); - - Ext.getCmp("maptab_west_selection_panel").setTitle(_maptab_west_selection_panel+"("+_count+")"); -}