|
@@ -61,8 +61,6 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
|
|
|
wpsUrl: '',
|
|
wpsUrl: '',
|
|
|
wfsUrl: '',
|
|
wfsUrl: '',
|
|
|
layerName: 'Warstwa rysowania',
|
|
layerName: 'Warstwa rysowania',
|
|
|
- onfeatureselect: null,
|
|
|
|
|
- onfeatureunselect: null,
|
|
|
|
|
debug: false
|
|
debug: false
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -81,8 +79,6 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
|
|
|
initialize the plugin.
|
|
initialize the plugin.
|
|
|
*/
|
|
*/
|
|
|
priv.init = function() {
|
|
priv.init = function() {
|
|
|
- console.log('test jQuery plugin init...', priv);
|
|
|
|
|
- // create dom:
|
|
|
|
|
/*
|
|
/*
|
|
|
<div id="map" class="TableAjaxMap"></div>
|
|
<div id="map" class="TableAjaxMap"></div>
|
|
|
|
|
|
|
@@ -202,25 +198,10 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
|
|
|
})
|
|
})
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- _layer.events.on({
|
|
|
|
|
- 'featureselected': function(feature) {
|
|
|
|
|
- console.log('_layer onfeatureselect (',this.selectedFeatures.length,'): ', this);
|
|
|
|
|
- //document.getElementById('counter').innerHTML = this.selectedFeatures.length;
|
|
|
|
|
- if (typeof priv.options.onfeatureselect == "function") {
|
|
|
|
|
- priv.options.onfeatureselect.apply(this);
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- 'featureunselected': function(feature) {
|
|
|
|
|
- console.log('_layer onfeatureselect (',this.selectedFeatures.length,'): ', this);
|
|
|
|
|
- if (typeof priv.options.onfeatureunselect == "function") {
|
|
|
|
|
- priv.options.onfeatureunselect.apply(this);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
_layer.events.on({
|
|
_layer.events.on({
|
|
|
'beforefeaturemodified': function(e) {
|
|
'beforefeaturemodified': function(e) {
|
|
|
console.log('Event: beforefeaturemodified modified(', e.feature.attributes._modified, ')', e.feature.attributes, ' selAttras', (_selectedFeature)? _selectedFeature.attributes : 'null');// TODO: DBG
|
|
console.log('Event: beforefeaturemodified modified(', e.feature.attributes._modified, ')', e.feature.attributes, ' selAttras', (_selectedFeature)? _selectedFeature.attributes : 'null');// TODO: DBG
|
|
|
- // NOTE: beforefeaturemodified from new node is fired before afterfeaturemodified from old node when click from one shape to enother
|
|
|
|
|
|
|
+ // NOTE: beforefeaturemodified from new node is fired before afterfeaturemodified from old node when click from one node to enother
|
|
|
priv.checkSelectedFeatureModifications('before');
|
|
priv.checkSelectedFeatureModifications('before');
|
|
|
priv.setSelectedFeature(e.feature);
|
|
priv.setSelectedFeature(e.feature);
|
|
|
},
|
|
},
|
|
@@ -270,20 +251,20 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
|
|
|
]);
|
|
]);
|
|
|
toolbar.addControls([
|
|
toolbar.addControls([
|
|
|
new OpenLayers.Control.Button({
|
|
new OpenLayers.Control.Button({
|
|
|
- title: "Test mark as recordId 999",
|
|
|
|
|
|
|
+ title: "Zapisz zmiany",
|
|
|
displayClass: "olControlSave",
|
|
displayClass: "olControlSave",
|
|
|
trigger: function() {
|
|
trigger: function() {
|
|
|
if (_selectedFeature) {
|
|
if (_selectedFeature) {
|
|
|
if (!_selectedRecordId) {
|
|
if (!_selectedRecordId) {
|
|
|
- alert('Select Record from table');
|
|
|
|
|
|
|
+ alert('Wybierz rekord tabeli');
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- _selectedFeature.attributes['tblId'] = <?php echo $this->_zasobID; ?>;
|
|
|
|
|
- _selectedFeature.attributes['recordId'] = _selectedRecordId;
|
|
|
|
|
|
|
+ priv.saveSelectedFeature();
|
|
|
|
|
+ priv.cancelSelectedFeatureModifications();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- alert('Select feature')
|
|
|
|
|
|
|
+ alert('Wybierz element na mapie');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -360,7 +341,8 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
priv.isSelectedFeature = function() {
|
|
priv.isSelectedFeature = function() {
|
|
|
- return !!_selectedFeature;
|
|
|
|
|
|
|
+ console.log('_selectedFeature:', _selectedFeature);
|
|
|
|
|
+ return (_selectedFeature)? true : false;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
priv.cancelSelectedFeatureModifications = function() {
|
|
priv.cancelSelectedFeatureModifications = function() {
|
|
@@ -385,14 +367,25 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ priv.saveSelectedFeature = function() {
|
|
|
|
|
+ if (priv.isSelectedFeatureModified()) {
|
|
|
|
|
+ if (typeof priv.options.onSaveFeature == "function") {
|
|
|
|
|
+ var selFeatureExtent = new OpenLayers.Format.WKT().write(_selectedFeature);
|
|
|
|
|
+ priv.options.onSaveFeature.call(this, _selectedRecordId, selFeatureExtent);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
priv.checkSelectedFeatureModifications = function(when) {
|
|
priv.checkSelectedFeatureModifications = function(when) {
|
|
|
if (priv.isSelectedFeatureModified()) {
|
|
if (priv.isSelectedFeatureModified()) {
|
|
|
- if (confirm('Anulować zmiany wprowadzone dla zaznaczonego elementu?' + when)) {
|
|
|
|
|
|
|
+ if (confirm('Czy zapisać zmiany wprowadzone dla zaznaczonego elementu?')) {
|
|
|
|
|
+ // _layer.refresh();
|
|
|
|
|
+ priv.saveSelectedFeature();
|
|
|
priv.cancelSelectedFeatureModifications();
|
|
priv.cancelSelectedFeatureModifications();
|
|
|
- _layer.refresh({force:true});
|
|
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- // _layer.refresh();
|
|
|
|
|
|
|
+ priv.cancelSelectedFeatureModifications();
|
|
|
|
|
+ _layer.refresh({force:true});
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -703,6 +696,7 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
publ.zoomToExtent = function(extent) {
|
|
publ.zoomToExtent = function(extent) {
|
|
|
|
|
+ if (!extent) return;
|
|
|
var extentBounds = OpenLayers.Geometry.fromWKT(extent).getBounds();
|
|
var extentBounds = OpenLayers.Geometry.fromWKT(extent).getBounds();
|
|
|
_map.zoomToExtent(extentBounds);
|
|
_map.zoomToExtent(extentBounds);
|
|
|
};
|
|
};
|