|
|
@@ -33,6 +33,8 @@ class TableAjaxMap {
|
|
|
.TableAjaxMap { width:100%; height:<?php echo $this->_height; ?>px; }
|
|
|
.olControlEditingToolbar .olControlModifyFeatureItemInactive { background-image:url(stuff/open-layers/theme/default/img/draw_point_off.png); }
|
|
|
.olControlEditingToolbar .olControlModifyFeatureItemActive { background-image:url(stuff/open-layers/theme/default/img/draw_point_on.png); }
|
|
|
+.olControlEditingToolbar .olControlSelectFeatureItemInactive { background-image:url(stuff/open-layers/theme/default/img/move_feature_off.png); }
|
|
|
+.olControlEditingToolbar .olControlSelectFeatureItemActive { background-image:url(stuff/open-layers/theme/default/img/move_feature_on.png); }
|
|
|
.olControlEditingToolbar .olControlRefreshItemInactive { background-image: url(stuff/open-layers/theme/default/img/refresh_feature_off.png); }
|
|
|
.olControlEditingToolbar .olControlRefreshItemActive { background-image: url(stuff/open-layers/theme/default/img/refresh_feature_on.png); }
|
|
|
.olControlEditingToolbar .olControlSaveItemInactive { background-image: url(stuff/open-layers/theme/default/img/save_features_off.png); }
|
|
|
@@ -228,18 +230,80 @@ OpenLayers.ProxyHost = "index-ajax.php?_zasobID=<?php echo $this->_zasobID; ?>&_
|
|
|
, mode: OpenLayers.Control.ModifyFeature.DRAG | OpenLayers.Control.ModifyFeature.RESHAPE
|
|
|
})
|
|
|
]);
|
|
|
- toolbar.addControls([
|
|
|
- new OpenLayers.Control.SelectFeature(_layer, {
|
|
|
- title: "Select Test",
|
|
|
- clickout: false,
|
|
|
- toggle: false,
|
|
|
- multiple: false,
|
|
|
- hover: false,
|
|
|
- toggleKey: "ctrlKey", // ctrl key removes from selection
|
|
|
- multipleKey: "shiftKey", // shift key adds to selection
|
|
|
- box: true
|
|
|
- })
|
|
|
- ]);
|
|
|
+ var btnSelectFeature = new OpenLayers.Control.SelectFeature(_layer, {
|
|
|
+ title: "Select Test",
|
|
|
+ clickout: false,
|
|
|
+ toggle: false,
|
|
|
+ multiple: false,
|
|
|
+ hover: false,
|
|
|
+ toggleKey: "ctrlKey", // ctrl key removes from selection
|
|
|
+ multipleKey: "shiftKey", // shift key adds to selection
|
|
|
+ box: true
|
|
|
+ /* copy from OpenLayers source lib/OpenLayers/Control/SelectFeature.js
|
|
|
+ * add bounds to trigger "boxselectionend" event
|
|
|
+ */
|
|
|
+ , selectBox: function(position) {
|
|
|
+ if (position instanceof OpenLayers.Bounds) {
|
|
|
+ var minXY = this.map.getLonLatFromPixel({
|
|
|
+ x: position.left,
|
|
|
+ y: position.bottom
|
|
|
+ });
|
|
|
+ var maxXY = this.map.getLonLatFromPixel({
|
|
|
+ x: position.right,
|
|
|
+ y: position.top
|
|
|
+ });
|
|
|
+ var bounds = new OpenLayers.Bounds(
|
|
|
+ minXY.lon, minXY.lat, maxXY.lon, maxXY.lat
|
|
|
+ );
|
|
|
+
|
|
|
+ // if multiple is false, first deselect currently selected features
|
|
|
+ if (!this.multipleSelect()) {
|
|
|
+ this.unselectAll();
|
|
|
+ }
|
|
|
+
|
|
|
+ // because we're using a box, we consider we want multiple selection
|
|
|
+ var prevMultiple = this.multiple;
|
|
|
+ this.multiple = true;
|
|
|
+ var layers = this.layers || [this.layer];
|
|
|
+ this.events.triggerEvent("boxselectionstart", {layers: layers});
|
|
|
+ var layer;
|
|
|
+ for(var l=0; l<layers.length; ++l) {
|
|
|
+ layer = layers[l];
|
|
|
+ for(var i=0, len = layer.features.length; i<len; ++i) {
|
|
|
+ var feature = layer.features[i];
|
|
|
+ // check if the feature is displayed
|
|
|
+ if (!feature.getVisibility()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.geometryTypes == null || OpenLayers.Util.indexOf(
|
|
|
+ this.geometryTypes, feature.geometry.CLASS_NAME) > -1) {
|
|
|
+ if (bounds.toGeometry().intersects(feature.geometry)) {
|
|
|
+ if (OpenLayers.Util.indexOf(layer.selectedFeatures, feature) == -1) {
|
|
|
+ this.select(feature);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.multiple = prevMultiple;
|
|
|
+ this.events.triggerEvent("boxselectionend", {layers: layers, bounds: bounds});
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ btnSelectFeature.events.on({
|
|
|
+ "boxselectionend": function(e) {
|
|
|
+ console.log('SelectFeature boxselectionend event', e, e.bounds);
|
|
|
+ if (typeof priv.options.onSelectBox == "function") {
|
|
|
+ var layerProj = _map.getProjectionObject();
|
|
|
+ var targetProj = new OpenLayers.Projection("EPSG:4326");
|
|
|
+ var bounds = e.bounds.transform(layerProj, targetProj);
|
|
|
+ console.log('SelectFeature boxselectionend event bounds', bounds);
|
|
|
+ priv.options.onSelectBox.call(this, bounds);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ toolbar.addControls([btnSelectFeature]);
|
|
|
toolbar.addControls([
|
|
|
new OpenLayers.Control.Button({
|
|
|
title: "Refresh",
|
|
|
@@ -875,6 +939,9 @@ class TableAjaxMapWfsAction {
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
+ ?>
|
|
|
+ <!-- UNKNOWN WKT:<?php echo $wkt; ?> -->
|
|
|
+ <?php
|
|
|
}
|
|
|
$gml = ob_get_contents();
|
|
|
ob_clean();
|