1 |
<?php |
---|
2 |
|
---|
3 |
|
---|
4 |
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 |
|
---|
11 |
|
---|
12 |
|
---|
13 |
|
---|
14 |
|
---|
15 |
|
---|
16 |
|
---|
17 |
|
---|
18 |
|
---|
19 |
|
---|
20 |
|
---|
21 |
|
---|
22 |
|
---|
23 |
|
---|
24 |
|
---|
25 |
|
---|
26 |
|
---|
27 |
|
---|
28 |
|
---|
29 |
|
---|
30 |
include_once(dirname(__FILE__)."/../Widget.php"); |
---|
31 |
include_once(dirname(__FILE__)."/../Button.php"); |
---|
32 |
include_once(dirname(__FILE__)."/../NavTool.php"); |
---|
33 |
|
---|
34 |
|
---|
35 |
|
---|
36 |
|
---|
37 |
|
---|
38 |
|
---|
39 |
class ZoomAllLayers extends NavTool |
---|
40 |
{ |
---|
41 |
|
---|
42 |
|
---|
43 |
|
---|
44 |
|
---|
45 |
|
---|
46 |
function ZoomAllLayers() |
---|
47 |
{ |
---|
48 |
|
---|
49 |
parent::NavTool(); |
---|
50 |
|
---|
51 |
$this->SetNavCommand("ZOOM_FULL"); |
---|
52 |
$this->mbSubmitOnClick = 1; |
---|
53 |
|
---|
54 |
|
---|
55 |
$this->szWidgetDescription = <<<EOT |
---|
56 |
The ZoomAllLayers widget is a navigation tool that allows the user to zoom to |
---|
57 |
the full extents of the original context. |
---|
58 |
EOT; |
---|
59 |
|
---|
60 |
$this->mnMaturityLevel = MATURITY_TECHNICALRELEASE; |
---|
61 |
|
---|
62 |
} |
---|
63 |
|
---|
64 |
function InitDefaults() |
---|
65 |
{ |
---|
66 |
$this->maParams["TOOLSET"] = ""; |
---|
67 |
parent::InitDefaults(); |
---|
68 |
} |
---|
69 |
|
---|
70 |
|
---|
71 |
|
---|
72 |
|
---|
73 |
|
---|
74 |
|
---|
75 |
|
---|
76 |
function ParseURL() |
---|
77 |
{ |
---|
78 |
parent::ParseURL(); |
---|
79 |
|
---|
80 |
$oMap = $this->moMapObject->oMap; |
---|
81 |
|
---|
82 |
$szOriginalExtents = trim($oMap->getMetaData( "original_extents" )); |
---|
83 |
if ($szOriginalExtents == "") |
---|
84 |
{ |
---|
85 |
$szOriginalExtents = $oMap->extent->minx; |
---|
86 |
$szOriginalExtents .= ",".$oMap->extent->miny; |
---|
87 |
$szOriginalExtents .= ",".$oMap->extent->maxx; |
---|
88 |
$szOriginalExtents .= ",".$oMap->extent->maxy; |
---|
89 |
$oMap->setMetaData( "original_extents", $szOriginalExtents ); |
---|
90 |
} |
---|
91 |
|
---|
92 |
$szOriginalProjection = trim( $oMap->getMetaData( "original_projection" )); |
---|
93 |
if ($szOriginalProjection == "" && $oMap->getprojection() != "") |
---|
94 |
{ |
---|
95 |
$oMap->setMetaData( "original_projection", $oMap->getprojection() ); |
---|
96 |
} |
---|
97 |
|
---|
98 |
$szCmd = ""; |
---|
99 |
if ($this->isVarSet( "NAV_CMD" )) |
---|
100 |
$szCmd = trim($this->getVar( "NAV_CMD" )); |
---|
101 |
|
---|
102 |
if ($szCmd == "ZOOM_FULL") |
---|
103 |
{ |
---|
104 |
|
---|
105 |
|
---|
106 |
if (strlen($szOriginalExtents) > 0) |
---|
107 |
{ |
---|
108 |
$aszExtents = explode(",", $szOriginalExtents); |
---|
109 |
if (count($aszExtents) == 4) |
---|
110 |
{ |
---|
111 |
if ($szOriginalProjection != "" && $szOriginalProjection != $oMap->getprojection()) |
---|
112 |
{ |
---|
113 |
$aszExtents = $this->moMapNavigator->reprojectExtentFromCenter($aszExtents, $oMap->width, $oMap->height, $szOriginalProjection,$oMap->getProjection()); |
---|
114 |
} |
---|
115 |
$oMap->setMetadata("full_extents", $aszExtents[0].",".$aszExtents[1].",".$aszExtents[2].",".$aszExtents[3]); |
---|
116 |
|
---|
117 |
|
---|
118 |
|
---|
119 |
|
---|
120 |
|
---|
121 |
|
---|
122 |
$this->ReprojectAuto(); |
---|
123 |
} |
---|
124 |
else |
---|
125 |
{ |
---|
126 |
$_SESSION['gErrorManager']->setError(ERR_WARNING, |
---|
127 |
trim($this->moMLT->get("5", "ERROR: Invalid extent specified in"))." ZoomAllLayers.widget.php on line".__LINE__."."); |
---|
128 |
|
---|
129 |
} |
---|
130 |
} |
---|
131 |
else |
---|
132 |
{ |
---|
133 |
$_SESSION['gErrorManager']->setError(ERR_WARNING, |
---|
134 |
trim($this->moMLT->get("5", "ERROR: Invalid extent specified in"))." ZoomAllLayers.widget.php on line".__LINE__."."); |
---|
135 |
} |
---|
136 |
|
---|
137 |
$szExtents=""; |
---|
138 |
$szExtents = $oMap->getMetaData("full_extents"); |
---|
139 |
|
---|
140 |
if (strlen($szExtents) > 0) |
---|
141 |
{ |
---|
142 |
$aExtents = explode(",", $szExtents); |
---|
143 |
if (count($aExtents) == 4) |
---|
144 |
{ |
---|
145 |
$oMap->setextent($aExtents[0], $aExtents[1], |
---|
146 |
$aExtents[2], $aExtents[3]); |
---|
147 |
} |
---|
148 |
else |
---|
149 |
{ |
---|
150 |
$_SESSION['gErrorManager']->setError(ERR_WARNING, |
---|
151 |
trim($this->moMLT->get("5", "ERROR: Invalid extent specified in"))." ZoomAllLayers.widget.php on line".__LINE__."."); |
---|
152 |
} |
---|
153 |
} |
---|
154 |
else |
---|
155 |
{ |
---|
156 |
$_SESSION['gErrorManager']->setError(ERR_WARNING, |
---|
157 |
trim($this->moMLT->get("5", "ERROR: Invalid extent specified in"))." ZoomAllLayers.widget.php on line".__LINE__."."); |
---|
158 |
} |
---|
159 |
} |
---|
160 |
|
---|
161 |
|
---|
162 |
return true; |
---|
163 |
} |
---|
164 |
} |
---|
165 |
?> |
---|
166 |
|
---|