NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/Chameleon/trunk/Chameleon/ZoomOut/ZoomOut.widget.php

Revision 13 (checked in by jcleary, 17 years ago)

Latest Chameleon code checkout from previous repository

Line 
1 <?php
2 /**
3  * ZoomOut Widget class
4  *
5  * @project     CWC2
6  * @revision    $Id: ZoomOut.widget.php,v 1.8 2005/03/23 03:29:24 wbronsema Exp $
7  * @purpose     Zoom out Widget class
8  * @author      DM Solutions Group (assefa@dmsolutions.ca)
9  * @copyright
10  * <b>Copyright (c) 2002, DM Solutions Group Inc.</b>
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included
19  * in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  */
29
30
31 include_once(dirname(__FILE__)."/../NavTool.php");
32
33 /**
34  * ZoomOut
35  *
36  * @desc ZoomOut widget.
37  */
38 class ZoomOut extends NavTool
39 {
40     var $mszImagePath = "images/tool_zoomout_off.gif";
41     var $mszSelectedImagePath = "images/tool_zoomout_on.gif";
42     var $mszHoverImagePath = "/images/tool_zoomout_over.gif";
43     var $mszImageTip = "Zoom Out";
44
45
46     /**
47      * ZoomOut
48      *
49      * Constructor. Set the default values.
50      */
51     function ZoomOut()
52     {
53         // invoke constructor of parent
54         parent::NavTool();
55
56         $this->SetNavCommand("ZOOM_OUT");
57
58         // set the description for this widget
59         $this->szWidgetDescription = <<<EOT
60 The ZoomOut widget allows the user to zoom out of the map from a given point
61 using the current zoom factor.
62 EOT;
63         $this->mnMaturityLevel = MATURITY_TECHNICALRELEASE;
64
65     }
66
67     /**
68      * ParseURL
69      *
70      * Look for the ZOOM_IN command and if founddo the zooming
71      * according to the other NAV paramaters.
72      */
73     function  ParseURL()
74     {
75         parent::ParseURL();
76
77         $szCmd = "";
78         if ($this->isVarSet( "NAV_CMD" ))
79           $szCmd = trim($this->getVar( "NAV_CMD" ));
80
81         if ($szCmd == "ZOOM_OUT")
82         {
83
84             $szInputCoords = "";
85             $szInputCoords = $this->getVar( "NAV_INPUT_COORDINATES" );
86             $szInputType = $this->getVar( "NAV_INPUT_TYPE" );
87
88             if(strlen($szInputCoords) <= 0)
89             {
90                 $szInputCoords = ($this->moMapObject->oMap->width/2).','.($this->moMapObject->oMap->height/2);
91                 $szInputType = 'POINT';
92                 //return true;
93             }
94             if(strlen($szInputType) <= 0)
95             {
96                 $_SESSION['gErrorManager']->setError(ERR_WARNING,
97                    trim($this->moMLT->get("0", "ERROR: No input type specified in "))."ZoomOut.php.");
98                 return false;
99             }
100             //widget can have a default
101             $nZoomFactor = $this->GetValue( "DefaultFactor", 2 );
102
103             //a zoomfactor widget could also set it?
104             if ($this->isVarSet( "ZOOMFACTOR" ))
105                 $nZoomFactor = $this->getVar( "ZOOMFACTOR" );
106
107             //final sanity check on Zoom Factor
108             if ($nZoomFactor <= 0)
109               $nZoomFactor = 2;
110
111             if ($szInputType == "POINT")
112             {
113                 $aPixPos = explode(",", $szInputCoords);
114                 $this->moMapNavigator->zoomOut($nZoomFactor, $aPixPos[0], $aPixPos[1]);
115           /**
116              Call the reporjectauto function in case the map projection
117              is set to AUTO:XXX. If it is not, the function will do
118              nothing.
119           */
120                 $this->ReprojectAuto();
121             }
122         else
123         {
124                 $_SESSION['gErrorManager']->setError(ERR_WARNING,
125                    trim($this->moMLT->get("1", "ERROR: Invalid input type specified in "))."ZoomOut.php.");
126                 return false;
127         }
128         }
129        
130         // return success
131         return true;
132     }
133 }
134 ?>
Note: See TracBrowser for help on using the browser.