1 |
<?php |
---|
2 |
/** |
---|
3 |
* ZoomVisibleLayers Widget class |
---|
4 |
* |
---|
5 |
* @project CWC2 |
---|
6 |
* @revision $Id: ZoomVisibleLayers.widget.php,v 1.4 2004/10/14 18:19:25 pspencer Exp $ |
---|
7 |
* @purpose Zoom Selected Layers Widget class |
---|
8 |
* @author DM Solutions Group (spencer@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 |
include_once(dirname(__FILE__)."/../Widget.php"); |
---|
31 |
include_once(dirname(__FILE__)."/../Button.php"); |
---|
32 |
|
---|
33 |
|
---|
34 |
/** |
---|
35 |
* ZoomVisibleLayersWidget |
---|
36 |
* |
---|
37 |
* @desc ZoomVisibleLayers widget. |
---|
38 |
*/ |
---|
39 |
class ZoomVisibleLayers extends CWCWidget |
---|
40 |
{ |
---|
41 |
var $moButton; |
---|
42 |
var $moMapNavigator; |
---|
43 |
|
---|
44 |
/** |
---|
45 |
* ZoomVisibleLayersWidget |
---|
46 |
* Constructor. Set the default values. |
---|
47 |
*/ |
---|
48 |
function ZoomVisibleLayers() |
---|
49 |
{ |
---|
50 |
// invoke constructor of parent |
---|
51 |
parent::CWCWidget(); |
---|
52 |
|
---|
53 |
// set the description for this widget |
---|
54 |
$this->szWidgetDescription = "No description available. Please set ". |
---|
55 |
"this description in the constructor of this class."; |
---|
56 |
|
---|
57 |
$this->moButton = new CWCButton( $this ); |
---|
58 |
$this->mnMaturityLevel = MATURITY_BETA; |
---|
59 |
} |
---|
60 |
|
---|
61 |
function InitDefaults() |
---|
62 |
{ |
---|
63 |
parent::InitDefaults(); |
---|
64 |
$this->moButton->InitDefaults(); |
---|
65 |
$this->moButton->SetOnClick( "clickZoomVisibleLayers()" ); |
---|
66 |
} |
---|
67 |
|
---|
68 |
/** |
---|
69 |
* SetMap |
---|
70 |
* |
---|
71 |
* Set the map session and create a navigation tool |
---|
72 |
* |
---|
73 |
* @param oMapSession |
---|
74 |
*/ |
---|
75 |
function SetMap($oMapSession) |
---|
76 |
{ |
---|
77 |
$this->moMapObject = $oMapSession; |
---|
78 |
|
---|
79 |
$this->moMapNavigator = new MapNavigator( $oMapSession ); |
---|
80 |
} |
---|
81 |
|
---|
82 |
/** |
---|
83 |
* GetHTMLHiddenVariables |
---|
84 |
* |
---|
85 |
* Return the NAV_CMD varaiable. |
---|
86 |
* |
---|
87 |
* @return the NAV_CMD varaiable. |
---|
88 |
*/ |
---|
89 |
function GetHTMLHiddenVariables() |
---|
90 |
{ |
---|
91 |
$szCmd=""; |
---|
92 |
if ($this->isVarSet( "NAV_ZOOM" )) |
---|
93 |
$szCmd = $this->getVar( "NAV_ZOOM" ); |
---|
94 |
|
---|
95 |
$szVariable = "NAV_ZOOM"; |
---|
96 |
$szValue = " <INPUT TYPE=HIDDEN NAME=$szVariable VALUE=\"\">\n"; |
---|
97 |
$aReturn[$szVariable] = $szValue; |
---|
98 |
|
---|
99 |
return $aReturn; |
---|
100 |
} |
---|
101 |
|
---|
102 |
/** |
---|
103 |
* GetJavascriptFunctions |
---|
104 |
* |
---|
105 |
* Return the Javacriptfunctions needed by the widget. |
---|
106 |
* |
---|
107 |
* @return Javacriptfunctions needed by the widget. |
---|
108 |
*/ |
---|
109 |
function GetJavascriptFunctions() |
---|
110 |
{ |
---|
111 |
$aReturn = $this->moButton->GetJavascriptFunctions(); |
---|
112 |
$szJsFunctionName = "clickZoomVisibleLayers"; |
---|
113 |
$szFunction = <<<EOT |
---|
114 |
/** |
---|
115 |
* {$szJsFunctionName} |
---|
116 |
* called when the user clicks a pan arrow |
---|
117 |
*/ |
---|
118 |
function {$szJsFunctionName}(sTool) |
---|
119 |
{ |
---|
120 |
{$this->mszHTMLForm}.NAV_ZOOM.value=sTool; |
---|
121 |
{$this->mszHTMLForm}.submit(); |
---|
122 |
return; |
---|
123 |
} |
---|
124 |
EOT; |
---|
125 |
$aReturn[$szJsFunctionName] = $szFunction; |
---|
126 |
|
---|
127 |
return $aReturn; |
---|
128 |
} |
---|
129 |
|
---|
130 |
function GetJavascriptVariables() |
---|
131 |
{ |
---|
132 |
return $this->moButton->GetJavascriptVariables(); |
---|
133 |
} |
---|
134 |
|
---|
135 |
function GetJavascriptOnLoadFunctions() |
---|
136 |
{ |
---|
137 |
return $this->moButton->GetJavascriptOnLoadFunctions(); |
---|
138 |
} |
---|
139 |
|
---|
140 |
/** |
---|
141 |
* ParseURL |
---|
142 |
* |
---|
143 |
* Look for the ZOOM_IN command and if found do the zooming |
---|
144 |
* according to the other NAV paramaters. |
---|
145 |
*/ |
---|
146 |
function ParseURL() |
---|
147 |
{ |
---|
148 |
$szCmd = ""; |
---|
149 |
if ($this->isVarSet( "NAV_ZOOM" )) |
---|
150 |
$szCmd = trim($this->getVar( "NAV_ZOOM" )); |
---|
151 |
|
---|
152 |
if ($szCmd == "ZOOMVISIBLE") |
---|
153 |
{ |
---|
154 |
//handle ZoomVisibleLayers here. |
---|
155 |
|
---|
156 |
} |
---|
157 |
|
---|
158 |
// return success |
---|
159 |
return true; |
---|
160 |
} |
---|
161 |
|
---|
162 |
/** |
---|
163 |
* DrawPublish |
---|
164 |
* |
---|
165 |
* Return the HTML code using the name in the map file and the |
---|
166 |
* parameters of the CWC tag. |
---|
167 |
* |
---|
168 |
* @return HTML code |
---|
169 |
*/ |
---|
170 |
function DrawPublish() |
---|
171 |
{ |
---|
172 |
return $this->moButton->DrawPublish(); |
---|
173 |
} |
---|
174 |
|
---|
175 |
} |
---|
176 |
|
---|
177 |
if ((function_exists( "RegisterWidget" ))) |
---|
178 |
RegisterWidget( "ZoomVisibleLayers", "ZoomVisibleLayers" ); |
---|
179 |
?> |
---|