<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 
  "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
  <!ENTITY % cartoweb SYSTEM "../../cartoweb.ent" >
  %cartoweb;
  ]>
<sect2 id="dev.soapcalls.getmap.query">
  <title>Query</title>
  <para>The Query plugin allows to search objects, hilight them on map and 
    return text results. Search can be executed from a rectangle selection 
    and/or using a list of object IDs.</para>
  <para>Query request object is not mandatory. For more information about Query 
    plugin, see <xref linkend="user.query" />. </para>
  <sect3 id="dev.soapcalls.getmap.query.request">
    <title>Query Request</title>
    <para>
      <programlisting><![CDATA[
<simpleType name="QuerySelectionPolicy">
  <restriction base="xsd:string">
    <enumeration value="POLICY_XOR"/>
    <enumeration value="POLICY_UNION"/>
    <enumeration value="POLICY_INTERSECTION"/>
  </restriction>
</simpleType>]]></programlisting>
      <itemizedlist>
        <listitem>
          <para>POLICY_XOR - XOR selection: when selecting a group of objects, 
            already selected ones are unselected and not yet selected ones are 
            selected (default type)</para>
        </listitem>
        <listitem>
          <para>POLICY_UNION - union selection: when selecting a group of 
            objects, already selected ones are kept selected and not yet 
            selected ones are selected</para>
        </listitem>
        <listitem>
          <para>POLICY_INTERSECTION - intersection selection: when selecting a 
            group of objects, only already selected ones are kept 
            selected</para>
        </listitem>
      </itemizedlist>
      <programlisting><![CDATA[
<complexType name="QuerySelection">
  <all>
    <element name="layerId" type="xsd:string"/>
    <element name="idAttribute" type="xsd:string"/>
    <element name="idType" type="xsd:string"/>
    <element name="selectedIds" type="types:ArrayOfString"/>
    <element name="useInQuery" type="xsd:boolean"/>
    <element name="policy" type="types:QuerySelectionPolicy"/>
    <element name="maskMode" type="xsd:boolean"/>
    <element name="hilight" type="xsd:boolean"/>
    <element name="tableFlags" type="types:TableFlags"/>
  </all>
</complexType>]]></programlisting>
      <itemizedlist>
        <listitem>
          <para>layerId - layer ID on which query will be executed</para>
        </listitem>
        <listitem>
          <para>idAttribute - name of ID attribute</para>
        </listitem>
        <listitem>
          <para>idType - type of ID attribute ("string" or "int")</para>
        </listitem>
        <listitem>
          <para>selectedIds - list of IDs</para>
        </listitem>
        <listitem>
          <para>useInQuery - if true, will force query to use this layer</para>
        </listitem>
        <listitem>
          <para>policy - type of selection</para>
        </listitem>
        <listitem>
          <para>maskMode - if true, will apply a mask instead of a simple 
            selection. This won't work when using MapServer's hilighting 
            feature (see <xref linkend="user.query" />) </para>
        </listitem>
        <listitem>
          <para>hilight - if false, selection won't be hilighted on map</para>
        </listitem>
        <listitem>
          <para>tableFlags - table flags (see <xref 
            linkend="dev.soapcalls.structures.tables" /> for a description of 
            type TableFlags)</para>
        </listitem>
      </itemizedlist>
      <programlisting><![CDATA[
<complexType name="ArrayOfQuerySelection">
  <complexContent>
    <restriction base="enc11:Array">
      <attribute ref="enc11:arrayType"
                 wsdl:arrayType="types:QuerySelection[]"/>
    </restriction>
  </complexContent>
</complexType>]]></programlisting>
      <itemizedlist>
        <listitem>
          <para>array - list of query selections</para>
        </listitem>
      </itemizedlist>
      <programlisting><![CDATA[
<complexType name="QueryRequest">
  <all>
    <element name="className" type="xsd:string"/>
    <element name="shape" type="types:Shape"/>
    <element name="queryAllLayers" type="xsd:boolean"/>
    <element name="defaultMaskMode" type="xsd:boolean"/>
    <element name="defaultHilight" type="xsd:boolean"/>
    <element name="defaultTableFlags" type="types:TableFlags"/>
    <element name="querySelections" type="types:ArrayOfQuerySelection"/>
  </all>
</complexType>]]></programlisting>
      <itemizedlist>
        <listitem>
          <para>className - "QueryRequest" or extended class name if project 
            implements an extension</para>
        </listitem>
        <listitem>
          <para>shape - type of query object dependant. It can be a bounding box, 
            a polygon, a circle or a point (see <xref 
            linkend="dev.soapcalls.structures.shapes" /> for a description of 
            differents types)</para>
        </listitem>
        <listitem>
          <para>queryAllLayers - if true, will execute query on all selected 
            layers, ie. layers sent through Layers request (see <xref 
            linkend="dev.soapcalls.getmap.layers.request" />). Unused when 
            bounding box is not specified </para>
        </listitem>
        <listitem>
          <para>defaultMaskMode - mask mode for new layers (returned by query 
            and but not yet in array querySelections). Unused when 
            queryAllLayers = false</para>
        </listitem>
        <listitem>
          <para>defaultHilight - highlight for new layers (returned by query 
            and but not yet in array querySelections). Unused when 
            queryAllLayers = false</para>
        </listitem>
        <listitem>
          <para>defaultTableFlags - table flags for new layers (returned by 
            query and but not yet in array querySelections, see <xref 
            linkend="dev.soapcalls.structures.tables" /> for a description of 
            type TableFlags). Unused when queryAllLayers = false</para>
        </listitem>
        <listitem>
          <para>querySelections - list if query selections. It contains all 
            objects that must be hilighted and can be used to maintain 
            persistence of a selection</para>
        </listitem>
      </itemizedlist>
    </para>
  </sect3>
  <sect3 id="dev.soapcalls.getmap.query.result">
    <title>Query Result</title>
    <para>
      <programlisting><![CDATA[
<complexType name="QueryResult">
  <all>
    <element name="className" type="xsd:string"/>
    <element name="tableGroup" type="types:TableGroup"/>
  </all>
</complexType>]]></programlisting>
      <itemizedlist>
        <listitem>
          <para>className - "QueryResult" or extended class name if project 
            implements an extension</para>
        </listitem>
        <listitem>
          <para>tableGroup - group of tables which contains query results (one 
            table per layer)</para>
        </listitem>
      </itemizedlist>
    </para>
  </sect3>
</sect2>
