o.moresis
2 years ago
31 changed files with 214 additions and 14159 deletions
@ -0,0 +1,126 @@
@@ -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' |
||||
} |
||||
} |
||||
}, |
||||
}; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,84 @@
@@ -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); |
||||
} |
||||
}; |
||||
} |
@ -1,643 +0,0 @@
@@ -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("<b>"+_trans+"</b> : "+_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("<b>"+_trans+"</b> : "+_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("<b>"+_k+"</b> : "+_record[_k]); |
||||
} |
||||
} |
||||
|
||||
if(typeof _record!=="undefined") |
||||
{ |
||||
mapFindLayerById(_record._layerId)._layerObject._attributesFields=_attributesFields; |
||||
} |
||||
|
||||
} |
||||
|
||||
_record._summary=_summary.join("<br>"); |
||||
|
||||
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('<tpl for=".">' + '<li style="height:22px;" class="x-boundlist-item" role="option">' + '{_attributeTranslation}' + '</li></tpl>'), |
||||
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('<tpl for=".">' + '<li style="height:22px;" class="x-boundlist-item" role="option">' + '{name}' + '</li></tpl>') |
||||
}); |
||||
|
||||
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('<tpl for=".">' + '<li style="height:22px;" class="x-boundlist-item" role="option">' + '{name}' + '</li></tpl>') |
||||
}); |
||||
|
||||
return c; |
||||
} |
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,127 +0,0 @@
@@ -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 "<img src=\""+value+"\" width=\"20px\" height=\"20px\" data-qtip=\"<img src='"+value+"'>\">"; |
||||
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="<img src=\""+host+"images/layer_loaded_ok.png\" width=\"16px\" height=\"16px\" data-qtip=\""+_maptab_services_manager_loaded_layer_success_tooltip+"\">"; |
||||
break; |
||||
|
||||
case 2: |
||||
output="<img src=\""+host+"images/layer_loaded_attention.png\" width=\"16px\" height=\"16px\" data-qtip=\""+_maptab_services_manager_loaded_layer_attention_tooltip+"\">"; |
||||
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; |
||||
} |
||||
|
@ -1,65 +0,0 @@
@@ -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 "<img src=\""+host+"images/isSecure.png\" width=\"20px\" height=\"20px\">"; |
||||
else |
||||
return ""; |
||||
} |
||||
|
@ -1,801 +0,0 @@
@@ -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<map_highlightLayer.features.length;i++) { |
||||
map_highlightLayer.features[i].geometry.transform(new OpenLayers.Projection(b), new OpenLayers.Projection(a)); |
||||
} |
||||
map_highlightLayer.refresh(); |
||||
|
||||
for(var i=0;i<map_highlightLayerFeatureInfo.features.length;i++) { |
||||
map_highlightLayerFeatureInfo.features[i].geometry.transform(new OpenLayers.Projection(b), new OpenLayers.Projection(a)); |
||||
} |
||||
|
||||
map_highlightLayerFeatureInfo.refresh(); |
||||
map.setCenter(new OpenLayers.LonLat(Number(map.getCenter().lon),Number(map.getCenter().lat)).transform(new OpenLayers.Projection(b), new OpenLayers.Projection(a)),map.getZoom()); |
||||
map.setOptions({projection:new OpenLayers.Projection(a)}); |
||||
map_currentProjection=map.getProjectionObject().toString(); |
||||
|
||||
var overlayers=mapGetlayersBy("isBaseLayer",false); |
||||
|
||||
for(var i=overlayers.length-1;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<layer._layerObject._scales.length;l++) |
||||
{ |
||||
var item=layer._layerObject._scales[l]; |
||||
|
||||
if (item!=0) |
||||
{ |
||||
var _min=Number(item[0]); |
||||
var _max=Number(item[1]); |
||||
var _currentMapScale=Number(mapGetCurrentScale()); |
||||
|
||||
if (_max<0) { |
||||
_max=_currentMapScale+1000; |
||||
} |
||||
|
||||
if((_currentMapScale>=_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<basemaps.length;i++) |
||||
{ |
||||
if(_supportedEPSG.indexOf(basemaps[i].projection.toString())==-1) { |
||||
_supportedEPSG.push(basemaps[i].projection.toString()); |
||||
} |
||||
} |
||||
|
||||
return _supportedEPSG; |
||||
} |
||||
|
||||
function mapGetCurrentProjection() |
||||
{ |
||||
var p=map.getProjectionObject().toString(); |
||||
|
||||
return p; |
||||
} |
||||
|
||||
function mapGetCurrentDisplayProjection() |
||||
{ |
||||
var p=map.displayProjection.toString(); |
||||
|
||||
return p; |
||||
} |
||||
|
||||
function mapGetCurrentScale() |
||||
{ |
||||
var p=map.getScale().toString(); |
||||
|
||||
return p; |
||||
} |
||||
|
||||
function mapGetBasemapResolutions() |
||||
{ |
||||
var resolutions = map.baseLayer.resolutions; |
||||
var units = map.baseLayer.units; |
||||
var mapScales=new Array(); |
||||
|
||||
for (var i=resolutions.length-1; 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;i<p;i++) |
||||
{ |
||||
mapFindLayerById(_layerId).addFeatures(_features[i]); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
mapFindLayerById(_layerId).addFeatures(_features); |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
function mapEraseFeatures(_layerId,_features) |
||||
{ |
||||
if (_features!="") |
||||
{ |
||||
if(_features.length>0) |
||||
{ |
||||
var p=_features.length; |
||||
|
||||
for(var i=0;i<p;i++) |
||||
{ |
||||
var _f=mapGetFeatureByFid(_layerId,_features[i].fid); |
||||
|
||||
_f.state=OpenLayers.State.DELETE; |
||||
|
||||
mapFindLayerById(_layerId).eraseFeatures(_f); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
_features.state=OpenLayers.State.DELETE; |
||||
|
||||
mapFindLayerById(_layerId).eraseFeatures(_features); |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
function mapRemoveFeatures(_layerId,_features) |
||||
{ |
||||
if (_features!="") |
||||
{ |
||||
if(_features.length>0) |
||||
{ |
||||
var p=_features.length; |
||||
|
||||
for(var i=0;i<p;i++) |
||||
{ |
||||
var _f=mapGetFeatureByFid(_layerId,_features[i].fid); |
||||
|
||||
mapFindLayerById(_layerId).removeFeatures(_f); |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
|
||||
mapFindLayerById(_layerId).removeFeatures(_features); |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
function mapSelectedFeatures(_layerId) |
||||
{ |
||||
return mapFindLayerById(_layerId).selectedFeatures; |
||||
} |
||||
|
||||
function formatXML(_filter) |
||||
{ |
||||
var _node = new OpenLayers.Format.Filter({version: '1.1.0'}).write(_filter); |
||||
|
||||
var xml = new OpenLayers.Format.XML().write(_node); |
||||
|
||||
return xml; |
||||
} |
||||
|
||||
function createSpatialFilter(_geometryCriteria, _featureGeometry) |
||||
{ |
||||
switch(_geometryCriteria) |
||||
{ |
||||
case "BBOX": |
||||
_geometryCriteria = OpenLayers.Filter.Spatial.BBOX; |
||||
break; |
||||
|
||||
case "INTERSECTS": |
||||
_geometryCriteria = OpenLayers.Filter.Spatial.INTERSECTS; |
||||
break; |
||||
|
||||
case "DWITHIN": |
||||
_geometryCriteria = OpenLayers.Filter.Spatial.DWITHIN; |
||||
break; |
||||
|
||||
case "WITHIN": |
||||
_geometryCriteria = OpenLayers.Filter.Spatial.WITHIN; |
||||
break; |
||||
|
||||
case "CONTAINS": |
||||
_geometryCriteria = OpenLayers.Filter.Spatial.CONTAINS; |
||||
break; |
||||
|
||||
} |
||||
|
||||
var _filter = new OpenLayers.Filter.Spatial({ |
||||
type: _geometryCriteria, |
||||
value: _featureGeometry |
||||
}); |
||||
|
||||
return _filter; |
||||
|
||||
} |
||||
|
||||
function createAttributeFilter(_propertyName, _comparison, _propertyValue) |
||||
{ |
||||
switch(_comparison) |
||||
{ |
||||
case "=": |
||||
_comparison = OpenLayers.Filter.Comparison.EQUAL_TO; |
||||
break; |
||||
|
||||
case "!=": |
||||
_comparison = OpenLayers.Filter.Comparison.NOT_EQUAL_TO; |
||||
break; |
||||
|
||||
case "<": |
||||
_comparison = OpenLayers.Filter.Comparison.LESS_THAN; |
||||
break; |
||||
|
||||
case ">": |
||||
_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; |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -1,76 +0,0 @@
@@ -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:[]
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
// });
|
@ -1,566 +0,0 @@
@@ -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: [ |
||||
'<div style=\"margin-left:50px;width:100%;\"><b>' + _maptab_services_manager_storecolumns_column_service_abstract + ':</b><br> {_serviceAbstract}</div>' |
||||
] |
||||
}], |
||||
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: [ |
||||
'<div style=\"margin-left:50px;width:100%;\"><b>' + _maptab_services_manager_storecolumns_column_service_abstract + ':</b><br> {_layerAbstract}</div>' |
||||
] |
||||
}, { |
||||
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: '<img src=\"' + 'data:image/png;base64,' + legend.imageData + '\">', |
||||
icon: 'data:image/png;base64,' + legend.imageData, |
||||
iconCls: 'maptab_services_manager_layer_legend_size', |
||||
checked: true, |
||||
tools: "<img src=\"" + host + "images/layer_info.png\" width=\"12px\" data-qtip=\"<div style='width:260px;'><b>" + legend.label + "</b><br>" + legend.label + "</b><br>" + legend.label + "</div>\"> <img src=\"" + host + "images/reorder.png\" width=\"12px\" style='cursor:move;'>" |
||||
}, _node.firstChild); |
||||
|
||||
return _node; |
||||
} |
||||
|
||||
|
@ -1,328 +0,0 @@
@@ -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 : [ |
||||
'<div style=\"margin-left:50px;width:100%;\"><b>'+_maptab_services_manager_storecolumns_column_service_abstract+':</b><br> {_serviceAbstract}</div>' |
||||
] |
||||
}], |
||||
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<features.length;i++) |
||||
{ |
||||
features[i].fid="atom."+i; |
||||
|
||||
} |
||||
|
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
rendererOptions: { zIndexing: true }, |
||||
opacity:_layerObject._opacity, |
||||
visibility:_layerObject._visibility, |
||||
projection:new OpenLayers.Projection("EPSG:4326") |
||||
} |
||||
); |
||||
|
||||
layer.id=_layerObject._layerId; |
||||
|
||||
return layer; |
||||
|
||||
} |
||||
|
||||
function atom_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!="")) |
||||
{ |
||||
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; |
||||
} |
||||
|
||||
|
@ -1,214 +0,0 @@
@@ -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 : [ |
||||
'<div style=\"margin-left:50px;width:100%;\"><b>'+_maptab_services_manager_storecolumns_column_service_abstract+':</b><br> {_serviceAbstract}</div>' |
||||
] |
||||
}], |
||||
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; |
||||
} |
||||
|
||||
|
@ -1,369 +0,0 @@
@@ -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 "<img src='" + host + "images/zoomExtent.png' width='20px' height='20px' onClick=\"fn_dxf_zoomto('" + record.get("_layerExtent") + "');\">"; |
||||
} |
||||
|
||||
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); |
||||
|
||||
} |
||||
} |
@ -1,328 +0,0 @@
@@ -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 : [ |
||||
'<div style=\"margin-left:50px;width:100%;\"><b>'+_maptab_services_manager_storecolumns_column_service_abstract+':</b><br> {_serviceAbstract}</div>' |
||||
] |
||||
}], |
||||
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<features.length;i++) |
||||
{ |
||||
features[i].fid="georss."+i; |
||||
|
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
}, |
||||
{ |
||||
rendererOptions: { zIndexing: true }, |
||||
opacity:_layerObject._opacity, |
||||
visibility:_layerObject._visibility, |
||||
projection:new OpenLayers.Projection("EPSG:4326") |
||||
} |
||||
); |
||||
|
||||
layer.id=_layerObject._layerId; |
||||
|
||||
return layer; |
||||
|
||||
} |
||||
|
||||
function georss_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!="")) |
||||
{ |
||||
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; |
||||
} |
||||
|
||||
|
@ -1,312 +0,0 @@
@@ -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 : [ |
||||
'<div style=\"margin-left:50px;width:100%;\"><b>'+_maptab_services_manager_storecolumns_column_service_abstract+':</b><br> {_serviceAbstract}</div>' |
||||
] |
||||
}], |
||||
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<features.length;i++) |
||||
{ |
||||
features[i].fid="kml."+i; |
||||
|
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
}, |
||||
{ |
||||
rendererOptions: { zIndexing: true }, |
||||
opacity:_layerObject._opacity, |
||||
visibility:_layerObject._visibility, |
||||
projection:new OpenLayers.Projection("EPSG:4326") |
||||
} |
||||
); |
||||
|
||||
layer.id=_layerObject._layerId; |
||||
|
||||
return layer; |
||||
|
||||
} |
||||
|
||||
function kml_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!="")) |
||||
{ |
||||
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; |
||||
} |
||||
|
||||
|
@ -1,459 +0,0 @@
@@ -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 : [ |
||||
'<div style=\"margin-left:50px;width:100%;\"><b>'+_maptab_services_manager_storecolumns_column_service_abstract+':</b><br> {_serviceAbstract}</div>' |
||||
] |
||||
}], |
||||
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<features.length;i++) |
||||
{ |
||||
features[i].fid="shapefile."+i; |
||||
|
||||
features[i].attributes = _serviceObject._serviceDbf[i]; |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
rendererOptions: { zIndexing: true }, |
||||
opacity:_layerObject._opacity, |
||||
visibility:_layerObject._visibility, |
||||
projection:new OpenLayers.Projection(_layerObject._nativeSRS) |
||||
} |
||||
); |
||||
|
||||
var parser = new OpenLayers.Format.GeoJSON({ |
||||
'internalProjection': new OpenLayers.Projection(mapGetCurrentProjection()), |
||||
'externalProjection': new OpenLayers.Projection(_layerObject._nativeSRS) |
||||
}), shpFeatures; |
||||
|
||||
var shapefile = new Shapefile({ |
||||
shp: host+"uploads/"+_serviceObject._serviceShp, |
||||
}, function (data) { |
||||
shpFeatures = parser.read(data.geojson); |
||||
layer.addFeatures(shpFeatures); |
||||
}); |
||||
|
||||
layer.id=_layerObject._layerId; |
||||
|
||||
return layer; |
||||
|
||||
} |
||||
|
||||
function shapefile_changeBasemap(_layer) |
||||
{ |
||||
if (_layer._currentProjection.toString()!=mapGetCurrentProjection()) |
||||
{ |
||||
for(var i=0;i<_layer.features.length;i++) |
||||
{ |
||||
_layer.features[i].geometry.transform(new OpenLayers.Projection(_layer._currentProjection.toString()),new OpenLayers.Projection(mapGetCurrentProjection())); |
||||
} |
||||
|
||||
_layer._currentProjection=mapGetCurrentProjection() |
||||
} |
||||
} |
||||
|
||||
init_onload_fn.push(init_shapefile_OnChangeBaseLayer); |
||||
|
||||
function init_shapefile_OnChangeBaseLayer() |
||||
{ |
||||
mapOnChangeBaseLayer(shapefile_OnChangeBaseLayer); |
||||
} |
||||
|
||||
function shapefile_OnChangeBaseLayer(_previousProjection,_currentProjection) |
||||
{ |
||||
var overlayers=mapGetlayersBy("isBaseLayer",false); |
||||
|
||||
for(var i=0;i<overlayers.length;i++) |
||||
{ |
||||
var _serviceType=overlayers[i]._serviceObject._serviceType; |
||||
|
||||
if(_serviceType=="SHAPEFILE") |
||||
{ |
||||
shapefile_changeBasemap(overlayers[i]); |
||||
} |
||||
} |
||||
} |
||||
|
||||
function shapefile_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!="")) |
||||
{ |
||||
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; |
||||
} |
@ -1,603 +0,0 @@
@@ -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 : [ |
||||
'<div style=\"margin-left:50px;width:100%;\"><b>'+_maptab_services_manager_storecolumns_column_service_abstract+':</b><br> {_serviceAbstract}</div>' |
||||
] |
||||
}], |
||||
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 : [ |
||||
'<div style=\"margin-left:50px;width:100%;\"><b>'+_maptab_services_manager_storecolumns_column_service_abstract+':</b><br> {_layerAbstract}</div>' |
||||
] |
||||
}], |
||||
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' |
||||
}] |
||||
|
||||
}] |
||||
}); |
||||
|
||||
|
||||
|
@ -1,384 +0,0 @@
@@ -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 : [ |
||||
'<div style=\"margin-left:50px;width:100%;\"><b>'+_maptab_services_manager_storecolumns_column_service_abstract+':</b><br> {_serviceAbstract}</div>' |
||||
] |
||||
}], |
||||
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(); |
||||
} |
@ -1,611 +0,0 @@
@@ -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 : [ |
||||
'<div style=\"margin-left:50px;width:100%;\"><b>'+_maptab_services_manager_storecolumns_column_service_abstract+':</b><br> {_serviceAbstract}</div>' |
||||
] |
||||
}], |
||||
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 : [ |
||||
'<div style=\"margin-left:50px;width:100%;\"><b>'+_maptab_services_manager_storecolumns_column_service_abstract+':</b><br> {_layerAbstract}</div>' |
||||
] |
||||
},{ |
||||
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 |
||||
}] |
||||
|
||||
}] |
||||
}); |
||||
|
||||
|
||||
|
@ -1,596 +0,0 @@
@@ -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 : [ |
||||
'<div style=\"margin-left:50px;width:100%;\"><b>'+_maptab_services_manager_storecolumns_column_service_abstract+':</b><br> {_serviceAbstract}</div>' |
||||
] |
||||
}], |
||||
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 : [ |
||||
'<div style=\"margin-left:50px;width:100%;\"><b>'+_maptab_services_manager_storecolumns_column_service_abstract+':</b><br> {_layerAbstract}</div>' |
||||
] |
||||
}], |
||||
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<overlayers.length;i++) |
||||
{ |
||||
var _serviceType=overlayers[i]._serviceObject._serviceType; |
||||
|
||||
if(_serviceType=="WMTS") |
||||
{ |
||||
wmts_changeBasemap(overlayers[i]); |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,571 +0,0 @@
@@ -1,571 +0,0 @@
|
||||
var maptab_toolbar_general_measurement_tools = [ |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_measureDistance', |
||||
iconCls:'maptab_toolbar_general_measureDistance', |
||||
enableToggle: true, |
||||
toggleGroup:'map_control_one_btn_allowed_group', |
||||
tooltip:_maptab_toolbar_general_measureDistance, |
||||
text:_maptab_toolbar_general_measureDistance, |
||||
toggleHandler :function(item,state){ |
||||
|
||||
if(!state) |
||||
{ |
||||
measuredistance_labels.destroyFeatures(); |
||||
measuredistance_cursor.destroyFeatures(); |
||||
} |
||||
|
||||
fn_toggleControl('measuredistance',state); |
||||
|
||||
} |
||||
}, |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_measureArea', |
||||
iconCls:'maptab_toolbar_general_measureArea', |
||||
enableToggle: true, |
||||
toggleGroup:'map_control_one_btn_allowed_group', |
||||
tooltip:_maptab_toolbar_general_measureArea, |
||||
text:_maptab_toolbar_general_measureArea, |
||||
toggleHandler :function(item,state){ |
||||
if(!state) |
||||
{ |
||||
measurearea_labels.destroyFeatures(); |
||||
measurearea_cursor.destroyFeatures(); |
||||
} |
||||
|
||||
fn_toggleControl('measurearea',state); |
||||
} |
||||
}, |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_measureClear', |
||||
iconCls:'maptab_toolbar_general_measureClear', |
||||
enableToggle: false, |
||||
toggleGroup:'map_control_one_btn_allowed_group', |
||||
tooltip:_maptab_toolbar_general_measureClear, |
||||
text:_maptab_toolbar_general_measureClear, |
||||
handler :function(item,state){ |
||||
|
||||
measurearea_layer.destroyFeatures(); |
||||
measuredistance_layer.destroyFeatures(); |
||||
|
||||
} |
||||
}] |
||||
|
||||
var maptab_toolbar_navigation=[ |
||||
languageBtn, |
||||
{xtype: 'tbseparator'}, |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_pan_Left', |
||||
iconCls:'maptab_toolbar_general_pan_left', |
||||
tooltip:_maptab_toolbar_general_pan_Left, |
||||
handler:function(){ |
||||
|
||||
map_controls.pan.direction="West"; |
||||
map_controls.pan.trigger(); |
||||
} |
||||
}, |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_pan_Up', |
||||
iconCls:'maptab_toolbar_general_pan_up', |
||||
tooltip:_maptab_toolbar_general_pan_Up, |
||||
handler:function(){ |
||||
|
||||
map_controls.pan.direction="North"; |
||||
map_controls.pan.trigger(); |
||||
} |
||||
}, |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_pan_Down', |
||||
iconCls:'maptab_toolbar_general_pan_down', |
||||
tooltip:_maptab_toolbar_general_pan_Down, |
||||
handler:function(){ |
||||
|
||||
map_controls.pan.direction="South"; |
||||
map_controls.pan.trigger(); |
||||
} |
||||
}, |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_pan_right', |
||||
iconCls:'maptab_toolbar_general_pan_right', |
||||
tooltip:_maptab_toolbar_general_pan_Right, |
||||
handler:function(){ |
||||
|
||||
map_controls.pan.direction="East"; |
||||
map_controls.pan.trigger(); |
||||
} |
||||
}, |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_pan', |
||||
iconCls:'maptab_toolbar_general_pan', |
||||
enableToggle: true, |
||||
pressed:true, |
||||
hidden:true, |
||||
tooltip:_maptab_toolbar_general_pan, |
||||
toggleHandler:function(item,state){ |
||||
|
||||
|
||||
fn_toggleControl('navigation',state); |
||||
} |
||||
}, |
||||
{xtype: 'tbseparator'}, |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_zoomIn', |
||||
iconCls:'maptab_toolbar_general_zoomIn', |
||||
tooltip:_maptab_toolbar_general_zoomIn, |
||||
handler:function(){ |
||||
|
||||
map.zoomIn(); |
||||
} |
||||
}, |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_zoomOut', |
||||
iconCls:'maptab_toolbar_general_zoomOut', |
||||
tooltip:_maptab_toolbar_general_zoomOut, |
||||
handler:function(){ |
||||
|
||||
map.zoomOut(); |
||||
} |
||||
}, |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_zoomByArea', |
||||
iconCls:'maptab_toolbar_general_zoomByArea', |
||||
enableToggle: true, |
||||
toggleGroup:'map_control_one_btn_allowed_group', |
||||
tooltip:_maptab_toolbar_general_zoomByArea, |
||||
toggleHandler :function(item,state){ |
||||
fn_toggleControl('zoomByArea',state); |
||||
} |
||||
}, |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_extent', |
||||
iconCls:'maptab_toolbar_general_extent', |
||||
tooltip:_maptab_toolbar_general_extent, |
||||
handler:function(){ |
||||
map.zoomToMaxExtent(); |
||||
} |
||||
}, |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_zoomPrevious', |
||||
iconCls:'maptab_toolbar_general_zoomPrevious', |
||||
tooltip:_maptab_toolbar_general_zoomPrevious, |
||||
handler:function(){ |
||||
|
||||
map_controls.navigationHistory.previousTrigger(); |
||||
} |
||||
}, |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_zoomNext', |
||||
iconCls:'maptab_toolbar_general_zoomNext', |
||||
tooltip:_maptab_toolbar_general_zoomNext, |
||||
handler:function(){ |
||||
|
||||
map_controls.navigationHistory.nextTrigger(); |
||||
} |
||||
}, |
||||
{xtype: 'tbseparator'}, |
||||
{ |
||||
xtype:'button', |
||||
id: 'maptab_toolbar_general_setCoordinates', |
||||
iconCls:'maptab_toolbar_general_setCoordinates', |
||||
toggleGroup:'map_control_one_btn_allowed_group', |
||||
enableToggle: true, |
||||
tooltip:_maptab_toolbar_general_setCoordinates, |
||||
toggleHandler:function(item,state){ |
||||
fn_maptab_toolbar_general_setCoordinates(state) |
||||
} |
||||
}, |
||||
{ |
||||
xtype:'button', |
||||
id:'maptab_toolbar_general_getCoordinates', |
||||
iconCls:'maptab_toolbar_general_getCoordinates', |
||||
tooltip:_maptab_toolbar_general_getCoordinates, |
||||
enableToggle: true, |
||||
toggleHandler:function(item,state){ |
||||
fn_maptab_toolbar_general_getCoordinates(state); |
||||
} |
||||
}] |
||||
|
||||
|
||||
var maptab_toolbar_general_setCoordinates_win=new Ext.Window({ |
||||
width:200, |
||||
height:150, |
||||
maxWidth:200, |
||||
maxHeight:150, |
||||
shim:true, |
||||
x:10, |
||||
y:270, |
||||
title:_maptab_toolbar_general_setCoordinates, |
||||
iconCls:'maptab_toolbar_general_setCoordinates', |
||||
id:'maptab_toolbar_general_setCoordinates_window', |
||||
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_setCoordinates_window").getEl().dom.style.zIndex; |
||||
} |
||||
} |
||||
}, |
||||
closeAction:'hide', |
||||
constrainTo:'maptab_map', |
||||
autoRender:false, |
||||
constrain:true, |
||||
layout:'fit', |
||||
listeners:{ |
||||
close:function() |
||||
{ |
||||
Ext.getCmp('maptab_toolbar_general_setCoordinates').toggle(false); |
||||
|
||||
Ext.getCmp('maptab_mapPanel').getEl().unmask(); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
var maptab_toolbar_general_update_setCoordinates_marker_layer; |
||||
|
||||
function maptab_toolbar_general_update_setCoordinates() |
||||
{ |
||||
var _config=new _config_init_map(); |
||||
|
||||
var _record=maptab_west_general_settings_store.findRecord("_generalSettingId", "maptab_west_general_settings_data_set_coordinates_projections"); |
||||
|
||||
var _projections=_record.get("_generalSettingValue").split(/,\s*/); |
||||
|
||||
var _projectionStoreData=[]; |
||||
|
||||
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 _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="<b>"+_projections[i]+"</b>:<br>"+_coordinates.lon.toFixed(_numDigits)+", "+_coordinates.lat.toFixed(_numDigits); |
||||
|
||||
_showCoordinates.push(_projectionText); |
||||
|
||||
} |
||||
} |
||||
|
||||
Ext.getCmp("maptab_toolbar_general_getCoordinates_panel").update(_showCoordinates.join("<br><br>")); |
||||
} |
||||
} |
||||
|
||||
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)); |
||||
} |
||||
|
||||
} |
||||
} |
||||
} |
@ -1,519 +0,0 @@
@@ -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; |
||||
} |
||||
|
@ -1,294 +0,0 @@
@@ -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()]);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
@ -1,230 +0,0 @@
@@ -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()]); |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
} |
@ -1,548 +0,0 @@
@@ -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("<img src=\""+host+"/images/loading.gif\" align=\"middle\">"); |
||||
|
||||
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; |
||||
} |
@ -1,979 +0,0 @@
@@ -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='<div id=\"mapMouseCoordinatesDiv\" style=\"white-space: nowrap;\">'+_maptab_bbar_general_mouse_position_outside_of_map+'</div>'; |
||||
|
||||
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(); |
||||
} |
@ -1,830 +0,0 @@
@@ -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: '<img src=\"' + _layer._layerObject._layerLegend + '\">', |
||||
icon: _layer._layerObject._layerLegend, |
||||
iconCls: 'maptab_services_manager_layer_legend_size', |
||||
checked: _layer.visibility, |
||||
realName: _layer._layerObject._layerName, |
||||
url: _layer._layerObject._layer.url, |
||||
tools: "<img src=\"" + host + "images/layer_info.png\" width=\"12px\" data-qtip=\"<div style='width:260px;'><b>" + _layer._layerObject._layerTitle + "</b><br>" + _layer._layerObject._layerName + "</b><br>" + _layer._layerObject._layerAbstract + "</div>\"> <img src=\"" + host + "images/reorder.png\" width=\"12px\" style='cursor:move;'>" |
||||
}, _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 = "<img src=\"images/edit.png\" width=\"12px\" data-qtip=\"<div style='width:260px;'><b>" + _layer._layerObject._layerTitle + "</b><br>" + _layer._serviceObject._serviceAbstract + "</div>\">" |
||||
} |
||||
|
||||
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: "<img src=\"" + host + "images/reorder.png\" width=\"12px\" style='cursor:move;'>" |
||||
}, _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 += "<b>" + _maptab_west_layer_tree_panel_tabs_layers_node_information_layer_responsible_party + "</b> : " + _serviceObject._responsible_party + " <br>"; |
||||
_layerInfoHTML += "<b>" + _maptab_west_layer_tree_panel_tabs_layers_node_information_layer_responsible_person + "</b> : " + _serviceObject._responsible_person + " <br>"; |
||||
_layerInfoHTML += "<b>" + _maptab_west_layer_tree_panel_tabs_layers_node_information_layer_responsible_position + "</b> : " + _serviceObject._responsible_position + " <br>"; |
||||
_layerInfoHTML += "<b>" + _maptab_west_layer_tree_panel_tabs_layers_node_information_layer_responsible_email + "</b> : " + _serviceObject._responsible_email + " <br>"; |
||||
_layerInfoHTML += "<b>" + _maptab_west_layer_tree_panel_tabs_layers_node_information_layer_responsible_fees + "</b> : " + _serviceObject._responsible_fees + " <br>"; |
||||
_layerInfoHTML += "<b>" + _maptab_west_layer_tree_panel_tabs_layers_node_information_layer_responsible_access_constrains + "</b> : " + _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; |
||||
} |
||||
|
@ -1,168 +0,0 @@
@@ -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: "<input type=\"checkbox\" onclick=\"maptab_west_search_settings_panel_checkall_searchable(this);\" checked></input>"+_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: "<input type=\"checkbox\" onclick=\"maptab_west_search_settings_panel_checkall_queryable(this);\" checked ></input>"+_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 "<input type=\"checkbox\" checked value=\""+value+"\" onclick=\"maptab_west_search_settings_panel_oncheck(this,'"+dataIndex+"','"+record.get("_layerId")+"');\"></input>"; |
||||
else |
||||
return "<input type=\"checkbox\" value=\""+value+"\" onclick=\"maptab_west_search_settings_panel_oncheck(this,'"+dataIndex+"','"+record.get("_layerId")+"');\"></input>"; |
||||
} |
||||
|
||||
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 |
||||
}); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,96 +0,0 @@
@@ -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+")"); |
||||
} |
Loading…
Reference in new issue