make spatial filter configurable for OpenLayers.Control.GetFeature, p=rdewit, r=me (closes #2325)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9770 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
* Class: OpenLayers.Control.GetFeature
|
* Class: OpenLayers.Control.GetFeature
|
||||||
* Gets vector features for locations underneath the mouse cursor. Can be
|
* Gets vector features for locations underneath the mouse cursor. Can be
|
||||||
* configured to act on click, hover or dragged boxes. Uses an
|
* configured to act on click, hover or dragged boxes. Uses an
|
||||||
* <OpenLayers.Protocol> that supports spatial filters (BBOX) to retrieve
|
* <OpenLayers.Protocol> that supports spatial filters to retrieve
|
||||||
* features from a server and fires events that notify applications of the
|
* features from a server and fires events that notify applications of the
|
||||||
* selected features.
|
* selected features.
|
||||||
*
|
*
|
||||||
@@ -80,10 +80,10 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: clickTolerance
|
* APIProperty: clickTolerance
|
||||||
* {Integer} Tolerance for the BBOX query in pixels. This has the
|
* {Integer} Tolerance for the filter query in pixels. This has the
|
||||||
* same effect as the tolerance parameter on WMS GetFeatureInfo
|
* same effect as the tolerance parameter on WMS GetFeatureInfo
|
||||||
* requests. Will be ignored for box selections. Applies only if
|
* requests. Will be ignored for box selections. Applies only if
|
||||||
* <click> of <hover> is true. Default is 5. Note that this not
|
* <click> or <hover> is true. Default is 5. Note that this not
|
||||||
* only affects requests on click, but also on hover.
|
* only affects requests on click, but also on hover.
|
||||||
*/
|
*/
|
||||||
clickTolerance: 5,
|
clickTolerance: 5,
|
||||||
@@ -142,6 +142,15 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
*/
|
*/
|
||||||
hoverResponse: null,
|
hoverResponse: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property: filterType
|
||||||
|
* {<String>} The type of filter to use when sending off a request.
|
||||||
|
* Possible values:
|
||||||
|
* OpenLayers.Filter.Spatial.<BBOX|INTERSECTS|WITHIN|CONTAINS>
|
||||||
|
* Defaults to: OpenLayers.Filter.Spatial.BBOX
|
||||||
|
*/
|
||||||
|
filterType: OpenLayers.Filter.Spatial.BBOX,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constant: EVENT_TYPES
|
* Constant: EVENT_TYPES
|
||||||
*
|
*
|
||||||
@@ -332,7 +341,7 @@ OpenLayers.Control.GetFeature = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
request: function(bounds, options) {
|
request: function(bounds, options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var filter = new OpenLayers.Filter.Spatial({
|
var filter = new OpenLayers.Filter.Spatial({
|
||||||
type: OpenLayers.Filter.Spatial.BBOX,
|
type: this.filterType,
|
||||||
value: bounds
|
value: bounds
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<script src="../../lib/OpenLayers.js"></script>
|
<script src="../../lib/OpenLayers.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function test_Control_GetFeature_constructor(t) {
|
function test_Control_GetFeature_constructor(t) {
|
||||||
t.plan(2);
|
t.plan(3);
|
||||||
var protocol = "foo";
|
var protocol = "foo";
|
||||||
var control = new OpenLayers.Control.GetFeature({
|
var control = new OpenLayers.Control.GetFeature({
|
||||||
protocol: protocol
|
protocol: protocol
|
||||||
@@ -12,6 +12,13 @@
|
|||||||
"new OpenLayers.Control.SelectFeature returns an instance");
|
"new OpenLayers.Control.SelectFeature returns an instance");
|
||||||
t.eq(control.protocol, "foo",
|
t.eq(control.protocol, "foo",
|
||||||
"constructor sets protocol correctly");
|
"constructor sets protocol correctly");
|
||||||
|
|
||||||
|
control = new OpenLayers.Control.GetFeature({
|
||||||
|
filterType: OpenLayers.Filter.Spatial.INTERSECTS
|
||||||
|
});
|
||||||
|
t.eq(control.filterType, OpenLayers.Filter.Spatial.INTERSECTS,
|
||||||
|
"constructor sets filterType correctly");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_Control_GetFeature_select(t) {
|
function test_Control_GetFeature_select(t) {
|
||||||
|
|||||||
Reference in New Issue
Block a user