Heron

Table Of Contents

Previous topic

Heron.widgets.SearchCenterPanel

Next topic

Heron.widgets.ToolbarBuilder

Heron.widgets.SpatialSearchPanel

Extends
xtype
hr_spatialsearchpanel
class Heron.widgets.SpatialSearchPanel(config)

A Panel to hold a spatial search either by drawing geometries and/or selecting features from another layer. Also can be initialized with features found through external search (see MultiSearchCenterPanel). Combines: https://code.google.com/p/geoext-viewer/issues/detail?id=177 and https://code.google.com/p/geoext-viewer/issues/detail?id=178 (like ArcGIS Search by Location).

The SpatialSearchPanel supports:

Search by Feature Selection: select from one or more source layers, add last result (geometries) to current selection, replace selection with last result (geoms), clear selection, use selection from drawn sketch (sketchOnly option in search by draw).

Search by Draw:
draw features on map, option: sketchOnly: do not search but add to selection layer (switch to select by feature to use).

Example Use

See examples. Sample code showing how to configure a Heron SpatialSearchPanel.

Heron.examples.searchPanelConfig = {
   xtype: 'hr_searchcenterpanel',
   hropts: {
       searchPanel: {
       xtype: 'hr_spatialsearchpanel',
           id: 'hr-spatialsearchpanel',
           header: false,
            border: false,
           style: {
               fontFamily: 'Verdana, Arial, Helvetica, sans-serif',
               fontSize: '12px'
           },
            searchByFeature: {
                active: true
            },
            searchByDraw: {
                active: false,
                sketchOnly: false,
                cumulative: false
            }
       },
       resultPanel: {
           xtype: 'hr_featuregridpanel',
           id: 'hr-featuregridpanel',
           header: false,
            border: false,
           autoConfig: true,
           hropts: {
               zoomOnRowDoubleClick: true,
               zoomOnFeatureSelect: false,
               zoomLevelPointSelect: 8,
               zoomToDataExtent: false
           }
       }
   }
};

nd then enable the SpatialSearchPanel as a MapPanel toolbar item (type: ‘searchcenter’, icon: binoculars).

Heron.options.map.toolbar = [
{type: "featureinfo", options: {max_features: 20}},
{type: "-"} ,
{type: "pan"},
{type: "zoomin"},
{type: "zoomout"},
{type: "zoomvisible"},
{type: "-"} ,
{type: "zoomprevious"},
{type: "zoomnext"},
{type: "-"},
{
    type: "searchcenter",
    // Options for SearchPanel window
    options: {
        show: true,

        searchWindow: {
            title: __('Spatial Search'),
            x: 100,
            y: undefined,
            width: 360,
            height: 400,
            items: [
                Heron.examples.searchPanelConfig
            ]
        }
    }
}

Config Options

Configuration properties in addition to those listed for Ext.Panel.

description

String Default description in status area.

filterFeatures

Array Features from last external Search. Default null

lastSearchName

String Name of last Search (UNUSED). Default null

layerFilter

Function Filter for OpenLayer getLayersBy(), to filter out WFS-enabled Layers from Layer array.

Default: only Layers that have metadata.wfs (see OpenLayers Layer spec and examples) set.
layerSortOrder

String How should the layer names be sorted in the selector, ‘ASC’, ‘DESC’ or null (as Map order)? default value is ‘ASC’ (Alphabetically Ascending).

maxFilterGeometries

Integer Max features to use for Search selection. Default 24

name

String Name, e.g. for multiple searches combo.

searchByDraw

Object Search by draw options. Default reddish

searchByFeature

Object Search by selected features options. Default reddish

selectLayerStyle

Object OpenLayers Style config to use for features Selection Layer. Default reddish

Public Methods

Public methods in addition to those listed for Ext.Panel.

SpatialSearchPanel.onBeforeDestroy()

Called just before Panel is destroyed.

SpatialSearchPanel.onDrawingComplete()

Called when feature drawn selected.

SpatialSearchPanel.onLayerSelect()

Called when Layer selected.

SpatialSearchPanel.onPanelRendered()

Called when Panel has been rendered.

SpatialSearchPanel.onParentHide()

Called when parent Panel is hidden in Container.

SpatialSearchPanel.onParentShow()

Called when parent Panel is shown in Container.

SpatialSearchPanel.onSearchComplete()

Function to call when search is complete. Default is to show “Search completed” with feature count on progress label.

SpatialSearchPanel.onSearchIssued()

Called when remote search (WFS) query has started.

SpatialSearchPanel.search()

Issue spatial search via WFS.

SpatialSearchPanel.searchFromFeatures()

Issue spatial search via WFS.