en-ca 1999-12-31 $id:$ Doc_Builder DM Solutions Group Inc. chameleon@lists.maptools.org Paul Spencer DM Solutions Group Inc. chameleon@lists.maptools.org Christopher R. Thorne DM Solutions Group Inc. chameleon@lists.maptools.org ZoomAllLayers TBD Navigation Widgets 2.0 2005-01-10 TECHRELEASE Paul Spencer DM Solutions Group Inc. chameleon@lists.maptools.org The ZoomAllLayers widget allows the user to zoom to the full extents of the currently loaded map. This extent information is located in either the MapServer map file (*.map) or the OGC Context (*.xml) file. By default, Chameleon reads the initial extents of the application from the map file or Context file and preserves them for use by this widget. Technically, these extents are stored as metadata inside the Chameleon MAP object. (Even if a Context is used, Chameleon works with a MAP file internally). It is possible to manually set this metadata in the map file so that Chameleon uses a (possibly) different set of extents as the "full extents" rather than the starting extents of the application. To do this, add the following to the metadata of the WEB object in the map file: "original_projection" "init=epsg:42304" "original_extents" "-2594561,-712631,3467361,3840000" Make sure to use the appropriate projection and extents for the application. Now, when starting the application, the initial view of the map is defined by the MAP EXTENTS, but when the user clicks the ZoomAllLayers widget, they are zoomed to these "original_extents" instead of the initial extents. Note that this widget is somewhat misnamed. Remote WMS layers often do not provide their full extent information (or it is incorrect), so when working with WMS layers, it is not possible to automatically determine the full extents of all layers. Even when working with local data, this is difficult due to differing projections. A conscious decision was made to allow the application designer to determine what the "full extents" of the application would be. See http://mapserver.gis.umn.edu for more information on map file structure, metadata, and extents. The full extents that are shown when the application is first loaded are defined in the map file. This full extents value can be modified to equal any map view. When changing the projection of a map, the extents must also change to the correct units and new spatial reference value. A map widget must be present in the interface for the ZoomAllLayers widget to function. This does not mean that without a map no button shows up, only that the button would be inactive. The ZoomAllLayers tag has attributes from the Button Attributes Group. This means the ZoomAllLayers widget has access to the Style Shared Resource. To learn about this Shared Resource, please refer to the Button Attribute Group section for details. This widget provides the capability to zoom the map view to the original extents defined by the application. To use it, simply click the Zoom To Full Extents button. Even though the ZoomAllLayers widget is a navigational widget and a button, it should not (and in fact cannot) be added to a toolset. The <CWC2 TYPE="ZoomAllLayers" ENABLED="[TRUE|FALSE]" FORMINDEX="[0 < integer]" VISIBLE="[TRUE|FALSE]" <!-- Navigation Attributes --> CURSORTYPE="[string]" DEFAULT="[TRUE|FALSE]" MAPID="[string]" WIDGETSTYLE="[string]" <!-- Button Attribute Group--> BACKGROUNDIMAGE="[path]" DEFAULT="[TRUE|FALSE]" IMAGE="[path]" IMAGEHEIGHT="[integer]" IMAGETIP="[string]" IMAGEWIDTH="[integer]" LABELALIGN="[LEFT|CENTER|RIGHT]" LABELANTIALIAS="[TRUE|FALSE]" LABELCOLOR="[#RRGGBB]" LABELFONT="[string]" LABELFONTSIZE="[0 < integer]" ONCLICK="[string]" STYLERESOURCE="[string]" TEXTBUTTONBORDER="[path]" TEXTBUTTONBORDER_BOTTOM_IMAGE="[path]" TEXTBUTTONBORDER_BOTTOMLEFT_IMAGE="[path]" TEXTBUTTONBORDER_BOTTOMRIGHT_IMAGE="[path]" TEXTBUTTONBORDER_LEFT_IMAGE="[path]" TEXTBUTTONBORDER_RIGHT_IMAGE="[path]" TEXTBUTTONBORDER_TOP_IMAGE="[path]" TEXTBUTTONBORDER_TOPLEFT_IMAGE="[path]" TEXTBUTTONBORDER_TOPRIGHT_IMAGE="[path]" TEXTBUTTONCOLOR="[#RRGGBB]" TEXTBUTTONNUDGE="[integer]" TEXTBUTTONPADDING="[0 < integer]" TOOLSET="[string]" USETEXTBUTTONCACHE="[TRUE|FALSE]"> <!-- Button Subtag Group --> <IMAGE STATE="[NORMAL|SELECTED|HOVER|DISABLED]" IMAGE="[path]"/> </CWC2> The following example demonstrates a typical minimal use of the the ZoomAllLayers button. <cwc2 type="ZoomAllLayers" visible="true" image="buttons/button_zoomfull_1.png"/> The following example shows how the ZoomAllLayers widget uses a Style Shared Resource called "NavigationButtons". <cwc2 type="ZoomAllLayers" visible="true" imagetip="Zoom to Full Extents" image="icons/pan_zoomfull.png" styleresource="NavigationButtons"> <image state="normal" /> <image state="hover" /> <image state="selected" /> </cwc2> The following ZoomAllLayers example shows how the widget could be defined without using a Shared Resource. Note that this tool is linked to a group of button-based navigation widgets using the toolset attribute. This means that if ZoomAllLayers is selected, it remains active until another tool is selected within that tool group. <cwc2 type="ZoomAllLayers" visible="true" imagetip="Zoom to Full Extents" toolset="Navigation" imagewidth="24" imageheight="24"> <image state="normal" image="buttons/button_zoomfull_1.png"/> <image state="hover" image="buttons/button_zoomfull_2.png"/> <image state="selected" image="buttons/button_zoomfull_3.png"/> </cwc2> Hawaii Demo www.mapsherpa.com/hawaii2/ The Hawaii Demo uses the latest 1.99 Chameleon version. Base Button NavTool NAV_CMD string The last command that was used to interact with the map. This is set to ZOOM_ALL for this widget. NAV_ALLOW_RECTANGLE boolean Tracks whether the current navigation tool uses a rubber-banding box or not. NavSetActiveTool Private Set the active navigation tool for a particular group of tools. oButton object true This is the JavaScript button object. aVals array true Array of parameters that define the navigation tool. The first element is the tool number. The second element is the tool name. The third element is boolean and determines if rectangle mode is enabled or not. The fourth element controls automatic submission of the page after navigation. The fifth element is a string that define the cursor type.