Commit 42a5685f035ae49a527707838eaf1fa1dec6ea72
1 parent
ede5e30b
Exists in
master
and in
7 other branches
v6 - inclusão do link para o conversor de GVP para Mapfile na página de abertura
Showing
4 changed files
with
396 additions
and
42 deletions
Show diff stats
4.67 KB
init/dicionario.js
@@ -148,5 +148,11 @@ es:"" | @@ -148,5 +148,11 @@ es:"" | ||
148 | pt:"SAIKU - análise de dados estatísticos", | 148 | pt:"SAIKU - análise de dados estatísticos", |
149 | en:"", | 149 | en:"", |
150 | es:"" | 150 | es:"" |
151 | +}], | ||
152 | +26: [ | ||
153 | +{ | ||
154 | +pt:"Teste do conversor de projeto GVP para Mapfile", | ||
155 | +en:"", | ||
156 | +es:"" | ||
151 | }] | 157 | }] |
152 | }; | 158 | }; |
init/index.php
@@ -41,16 +41,18 @@ body { | @@ -41,16 +41,18 @@ body { | ||
41 | vertical-align: middle; | 41 | vertical-align: middle; |
42 | font-size: 0.4cm; | 42 | font-size: 0.4cm; |
43 | position: relative; | 43 | position: relative; |
44 | - display:block; | ||
45 | - text-align:center; | 44 | + display: block; |
45 | + text-align: center; | ||
46 | z-index: 2; | 46 | z-index: 2; |
47 | } | 47 | } |
48 | -table{ | 48 | + |
49 | +table { | ||
49 | width: 100%; | 50 | width: 100%; |
50 | } | 51 | } |
52 | + | ||
51 | td { | 53 | td { |
52 | font-size: 0.4cm; | 54 | font-size: 0.4cm; |
53 | - text-align:center; | 55 | + text-align: center; |
54 | height: 150px; | 56 | height: 150px; |
55 | } | 57 | } |
56 | 58 | ||
@@ -59,57 +61,61 @@ h1 { | @@ -59,57 +61,61 @@ h1 { | ||
59 | text-align: left; | 61 | text-align: left; |
60 | margin: 25px; | 62 | margin: 25px; |
61 | } | 63 | } |
64 | + | ||
62 | #bandeiras { | 65 | #bandeiras { |
63 | width: 80px; | 66 | width: 80px; |
64 | text-align: left; | 67 | text-align: left; |
65 | - position:absolute; | 68 | + position: absolute; |
66 | left: 0.2cm; | 69 | left: 0.2cm; |
67 | - z-index:10; | 70 | + z-index: 10; |
68 | } | 71 | } |
72 | + | ||
69 | a { | 73 | a { |
70 | margin: 0px auto; | 74 | margin: 0px auto; |
71 | - text-decoration:none; | 75 | + text-decoration: none; |
72 | } | 76 | } |
73 | </style> | 77 | </style> |
74 | </head> | 78 | </head> |
75 | -<body class=" yui-skin-sam " > | 79 | +<body class=" yui-skin-sam "> |
76 | 80 | ||
77 | -<center> | ||
78 | -<div id="bandeiras"></div> | ||
79 | -<div class="bordaSuperior" style="z-index:1;"> </div> | 81 | + <center> |
82 | + <div id="bandeiras"></div> | ||
83 | + <div class="bordaSuperior" style="z-index: 1;"> </div> | ||
80 | 84 | ||
81 | -<div class="mascaraPrincipal" style="max-width:718pt"> | ||
82 | -<div id="conteudo" style="position:relative;top:-10px;margin: 0 0 0.2cm 0.2cm;"> | ||
83 | - <div style="margin-top:0px;"> | ||
84 | - <?php | ||
85 | - if($i3geomaster[0]["usuario"] == "admin" && $i3geomaster[0]["senha"] == "admin" ){ | ||
86 | - echo "<p style='font-size:14px;color:red;margin-top:20px;'><script>document.write($"."trad(19,g_traducao_init));</script>"; | ||
87 | - } | ||
88 | - ?> | ||
89 | - <div id="botoes" ></div> | ||
90 | - </div> | ||
91 | - <div style="float:left" > | ||
92 | - <a href="#" class="r" style="width: 230px; height: 380px"><table> | ||
93 | - <tr> | ||
94 | - <td> | ||
95 | - <a class="twitter-timeline" href="https://twitter.com/i3geo" data-widget-id="288061915689787392" width="220" height="350">Tweets @i3Geo</a> | ||
96 | -<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> | ||
97 | - </td> | ||
98 | - </tr> | ||
99 | - </table> </a> | ||
100 | - <a href="#" class="r" style="width: 230px; height: 380px"><table> | ||
101 | - <tr> | ||
102 | - <td><a class="twitter-timeline" | ||
103 | - href="https://twitter.com/search?q=@i3geo" | ||
104 | - data-widget-id="288053202174222336" width="220" height="350">Tweets #i3Geo</a> | ||
105 | - <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> | ||
106 | - </td> | ||
107 | - </tr> | ||
108 | - </table> </a> | ||
109 | - </div> | ||
110 | -</div> | 85 | + <div class="mascaraPrincipal" style="max-width: 718pt"> |
86 | + <div id="conteudo" | ||
87 | + style="position: relative; top: -10px; margin: 0 0 0.2cm 0.2cm;"> | ||
88 | + <div style="margin-top: 0px;"> | ||
89 | + <?php | ||
90 | + if($i3geomaster[0]["usuario"] == "admin" && $i3geomaster[0]["senha"] == "admin" ){ | ||
91 | + echo "<p style='font-size:14px;color:red;margin-top:20px;'><script>document.write($"."trad(19,g_traducao_init));</script>"; | ||
92 | + } | ||
93 | + ?> | ||
94 | + <div id="botoes"></div> | ||
95 | + </div> | ||
96 | + <div style="float: left"> | ||
97 | + <a href="#" class="r" style="width: 230px; height: 380px"><table> | ||
98 | + <tr> | ||
99 | + <td><a class="twitter-timeline" href="https://twitter.com/i3geo" | ||
100 | + data-widget-id="288061915689787392" width="220" height="350">Tweets | ||
101 | + @i3Geo</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> | ||
102 | + </td> | ||
103 | + </tr> | ||
104 | + </table> </a> <a href="#" class="r" | ||
105 | + style="width: 230px; height: 380px"><table> | ||
106 | + <tr> | ||
107 | + <td><a class="twitter-timeline" | ||
108 | + href="https://twitter.com/search?q=@i3geo" | ||
109 | + data-widget-id="288053202174222336" width="220" height="350">Tweets | ||
110 | + #i3Geo</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> | ||
111 | + </td> | ||
112 | + </tr> | ||
113 | + </table> </a> | ||
114 | + </div> | ||
115 | + </div> | ||
116 | + | ||
117 | + </div> | ||
111 | 118 | ||
112 | -</div> | ||
113 | </body> | 119 | </body> |
114 | <script> | 120 | <script> |
115 | botoesIni = []; | 121 | botoesIni = []; |
@@ -174,6 +180,10 @@ botoesIni.push({ | @@ -174,6 +180,10 @@ botoesIni.push({ | ||
174 | "href":"../ferramentas/saiku/esquemaxml.php", | 180 | "href":"../ferramentas/saiku/esquemaxml.php", |
175 | "titulo":$trad(25,g_traducao_init) | 181 | "titulo":$trad(25,g_traducao_init) |
176 | },{ | 182 | },{ |
183 | + "img":"../imagens/gvsig.jpg", | ||
184 | + "href":"../pacotes/gvsig/gvsig2mapfile/upload.htm", | ||
185 | + "titulo":$trad(26,g_traducao_init) | ||
186 | + },{ | ||
177 | "img":"insert-link.png", | 187 | "img":"insert-link.png", |
178 | "href":"../geradordelinks.htm", | 188 | "href":"../geradordelinks.htm", |
179 | "titulo":$trad(13,g_traducao_init) | 189 | "titulo":$trad(13,g_traducao_init) |
@@ -0,0 +1,338 @@ | @@ -0,0 +1,338 @@ | ||
1 | +<?php | ||
2 | +/** | ||
3 | + * Manipula um arquivo GVP (projeto gvSIG) para construção de layers Mapserver | ||
4 | + * @author Edmar Moretti | ||
5 | + * @license GPL2 | ||
6 | + */ | ||
7 | +class gvsig2mapfile{ | ||
8 | + var $arquivoGvp; | ||
9 | + var $xml; | ||
10 | + var $nomesLayersAdicionados = array(); | ||
11 | + /** | ||
12 | + * Construtor da classe | ||
13 | + * @param string $gvp arquivo de projeto gvsig | ||
14 | + * @example $gm = new gvsig2mapfile($gvsiggvp); | ||
15 | + * @throws Exception | ||
16 | + */ | ||
17 | + function __construct($gvp) | ||
18 | + { | ||
19 | + if(!file_exists($gvp)) | ||
20 | + {throw new Exception("Arquivo $gvp não existe");} | ||
21 | + else{ | ||
22 | + $this->arquivoGvp = $gvp; | ||
23 | + if(function_exists("dl")){ | ||
24 | + if (!function_exists('simplexml_load_file')) | ||
25 | + {dl( 'php_simplexml.'.PHP_SHLIB_SUFFIX );} | ||
26 | + } | ||
27 | + if (!function_exists('simplexml_load_file')) | ||
28 | + {throw new Exception("Função PHP simplexml_load_file não existe");} | ||
29 | + $this->xml = simplexml_load_file($gvp); | ||
30 | + } | ||
31 | + } | ||
32 | + /** | ||
33 | + * Lista de vistas existentes no projeto gvsig | ||
34 | + * @return array | ||
35 | + **/ | ||
36 | + function getViewsNames(){ | ||
37 | + $names = array(); | ||
38 | + $this->xml->registerXPathNamespace("tag", "http://www.gvsig.gva.es"); | ||
39 | + $results = $this->xml->xpath("/tag:xml-tag/tag:xml-tag/tag:property[@value='ProjectView']/parent::*/tag:property[@key='name']"); | ||
40 | + foreach($results as $result){ | ||
41 | + $names[] = $this->findAttribute($result,"value"); | ||
42 | + } | ||
43 | + return $names; | ||
44 | + } | ||
45 | + | ||
46 | + /** | ||
47 | + * Retorna uma vista | ||
48 | + * @param string $nome | ||
49 | + * @return $xml | ||
50 | + */ | ||
51 | + function getViewByName($nome){ | ||
52 | + $this->xml->registerXPathNamespace("tag", "http://www.gvsig.gva.es"); | ||
53 | + $result = $this->xml->xpath("/tag:xml-tag/tag:xml-tag/tag:property[@value='ProjectView']/parent::*/tag:property[@value='".$nome."']/parent::*"); | ||
54 | + return $result; | ||
55 | + } | ||
56 | + | ||
57 | + /** | ||
58 | + * Obtem os dados descritivos de uma visao | ||
59 | + * @param string $nome Nome da vista | ||
60 | + * @return array ( | ||
61 | + "extent"=>array(xmin,ymin,xmax,ymax), | ||
62 | + "proj"=>string projecao, | ||
63 | + "layerNames"=>string lista de layers separados por virgula | ||
64 | + ) | ||
65 | + */ | ||
66 | + function getViewData($nome){ | ||
67 | + $this->xml->registerXPathNamespace("tag", "http://www.gvsig.gva.es"); | ||
68 | + $path = "/tag:xml-tag/tag:xml-tag/tag:property[@value='ProjectView']/parent::*/tag:property[@value='".$nome."']/parent::*/tag:xml-tag/tag:xml-tag"; | ||
69 | + | ||
70 | + $xmin = (float) $this->getValue($path,"adjustedExtentX"); | ||
71 | + $ymin = (float) $this->getValue($path,"adjustedExtentY"); | ||
72 | + $xmax = $xmin + (float) $this->getValue($path,"adjustedExtentW"); | ||
73 | + $ymax = $ymin + (float) $this->getValue($path,"adjustedExtentH"); | ||
74 | + | ||
75 | + $proj = $this->getValue($path,"proj"); | ||
76 | + $nomes = $this->getValue($path,"LayerNames"); | ||
77 | + return array( | ||
78 | + "extent"=>array($xmin,$ymin,$xmax,$ymax), | ||
79 | + "proj"=>(string) $proj, | ||
80 | + "layerNames"=>explode(",",str_replace(" ,",",",$nomes)) | ||
81 | + ); | ||
82 | + } | ||
83 | + /** | ||
84 | + * Obtem os dados de um layer | ||
85 | + * @param string $viewNome | ||
86 | + * @param string $layerNome | ||
87 | + * @return array( | ||
88 | + "minScale"=> string, | ||
89 | + "maxScale"=>string, | ||
90 | + "visible"=>string, | ||
91 | + "proj"=>string, | ||
92 | + "transparency"=>string, | ||
93 | + "type"=>string, | ||
94 | + "data"=>string, | ||
95 | + "connection"=>string, | ||
96 | + "connectiontype"=>string, | ||
97 | + "driverName"=>string, | ||
98 | + "isLabeled"=>string, | ||
99 | + "legenda"=>array( | ||
100 | + "tipoLegenda"=>string, | ||
101 | + "classes"=>string | ||
102 | + ) | ||
103 | + ) | ||
104 | + * | ||
105 | + */ | ||
106 | + function getLayerData($viewNome,$layerNome){ | ||
107 | + $this->xml->registerXPathNamespace("tag", "http://www.gvsig.gva.es"); | ||
108 | + $path = "/tag:xml-tag/tag:xml-tag/tag:property[@value='ProjectView']/parent::*/tag:property[@value='".$viewNome."']/parent::*/tag:xml-tag/tag:xml-tag/tag:xml-tag/tag:xml-tag/parent::*/tag:property[@value='".$layerNome."']/parent::*"; | ||
109 | + $classes = array(); | ||
110 | + $render = 'com.iver.cit.gvsig.fmap.rendering'; | ||
111 | + | ||
112 | + $path1 = $path."/tag:xml-tag/tag:property[@value='".$render.".VectorialUniqueValueLegend']/parent::*/tag:xml-tag"; | ||
113 | + $result = $this->xml->xpath($path1); | ||
114 | + if($result != FALSE){ | ||
115 | + $coluna = (string) $this->getValue($path."/tag:xml-tag","fieldNames"); | ||
116 | + $valores = (string) $this->getValue($path."/tag:xml-tag","values"); | ||
117 | + $tipocoluna = (string) $this->getValue($path."/tag:xml-tag","fieldTypes"); | ||
118 | + $nomes = (string) $this->getValue($path."/tag:xml-tag","keys"); | ||
119 | + | ||
120 | + $classes = $this->VectorialUniqueValueLegend($result,$path1,$coluna,$tipocoluna,$valores,$nomes); | ||
121 | + } | ||
122 | + | ||
123 | + $path1 = $path."/tag:xml-tag/tag:property[@value='".$render.".SingleSymbolLegend']/parent::*/tag:xml-tag"; | ||
124 | + $result = $this->xml->xpath($path1); | ||
125 | + if($result != FALSE) | ||
126 | + {$classes = $this->SingleSymbolLegend($result,$path1);} | ||
127 | + | ||
128 | + // | ||
129 | + //obtem a conexão | ||
130 | + //a senha não pode ser obtida, então, é usado o mesmo nome de usuário em seu lugar. No i3Geo deve-se prever isso na variável de substituição de string. | ||
131 | + $driverName = $this->getValue($path,"driverName"); | ||
132 | + if($driverName == "gvSIG shp driver"){ | ||
133 | + $data = (string) $this->getValue($path,"file"); | ||
134 | + $connection = ""; | ||
135 | + $connectiontype = ""; | ||
136 | + } | ||
137 | + if($driverName == "PostGIS JDBC Driver"){ | ||
138 | + $path1 = $path."/tag:xml-tag/tag:property[@value='org.postgresql.Driver']/parent::*"; | ||
139 | + $tabela = ""; | ||
140 | + if($this->getValue($path1,"schema") != "") | ||
141 | + {$tabela = (string) $this->getValue($path1,"schema").".";} | ||
142 | + $tabela .= (string) $this->getValue($path1,"tablename"); | ||
143 | + $data = (string) $this->getValue($path1,"THE_GEOM")." FROM (select ".(string) $this->getValue($path1,"THE_GEOM").",".(string) $this->getValue($path1,"fields")." FROM ".$tabela.") as foo USING UNIQUE ".(string) $this->getValue($path1,"FID")." USING SRID=".(string) $this->getValue($path1,"SRID"); | ||
144 | + $connection = "user=".(string) $this->getValue($path1,"username")." password=".(string) $this->getValue($path1,"username")." dbname=".(string) $this->getValue($path1,"dbName")." host=".(string) $this->getValue($path1,"host")." port=".(string) $this->getValue($path1,"port"); | ||
145 | + $connectiontype = MS_POSTGIS; | ||
146 | + } | ||
147 | + return array( | ||
148 | + "minScale"=>(string) $this->getValue($path,"minScale"), | ||
149 | + "maxScale"=>(string) $this->getValue($path,"maxScale"), | ||
150 | + "visible"=>(string) $this->getValue($path,"visible"), | ||
151 | + "proj"=>(string) $this->getValue($path,"proj"), | ||
152 | + "transparency"=>(string) $this->getValue($path,"transparency"), | ||
153 | + "type"=>(string) $this->getValue($path,"type"), | ||
154 | + "data"=>$data, | ||
155 | + "connection"=>$connection, | ||
156 | + "connectiontype"=>$connectiontype, | ||
157 | + "driverName"=>(string) $this->getValue($path,"driverName"), | ||
158 | + "isLabeled"=>(string) $this->getValue($path,"isLabeled"), | ||
159 | + "legenda"=>array( | ||
160 | + "tipoLegenda"=>(string) $this->getValue($path."/tag:xml-tag","className"), | ||
161 | + "classes"=>$classes | ||
162 | + ) | ||
163 | + ); | ||
164 | + } | ||
165 | + function VectorialUniqueValueLegend($result,$path1,$coluna,$tipocoluna,$valores,$nomes){ | ||
166 | + $valores = ",".str_replace(" ,",",",$valores); | ||
167 | + $valores = explode(",",$valores); | ||
168 | + $nomes = ",".str_replace(" ,",",",$nomes); | ||
169 | + $nomes = explode(",",$nomes); | ||
170 | + $classes = array(); | ||
171 | + $c = 0; | ||
172 | + | ||
173 | + while(list( , $node) = each($result)) { | ||
174 | + $classe = array(); | ||
175 | + if($tipocoluna == 12) | ||
176 | + {$classe["exp"] = "('[".$coluna."]'eq'".$valores[$c]."')";} | ||
177 | + else | ||
178 | + {$classe["exp"] = "([".$coluna."] = ".$valores[$c]." )";} | ||
179 | + $classe["className"] = (string) $this->getValue($path1,"className",$c); | ||
180 | + $classe["nome"] = $nomes[$c]; | ||
181 | + $classe["desc"] = (string) $this->getValue($path1,"desc",$c); | ||
182 | + $classe["color"] = (string) $this->getValue($path1,"color",$c); | ||
183 | + $classe["rotation"] = (string) $this->getValue($path1,"rotation",$c); | ||
184 | + $classe["offsetX"] = (string) $this->getValue($path1,"offsetX",$c); | ||
185 | + $classe["offsetY"] = (string) $this->getValue($path1,"offsetY",$c); | ||
186 | + $classe["size"] = (string) $this->getValue($path1,"size",$c); | ||
187 | + $classe["markerStyle"] = (string) $this->getValue($path1,"markerStyle",$c); | ||
188 | + $classe["hasFill"] = (string) $this->getValue($path1,"hasFill",$c); | ||
189 | + $classe["hasOutline"] = (string) $this->getValue($path1,"hasOutline",$c); | ||
190 | + if($classe["hasOutline"] == "true"){ | ||
191 | + $classe["outline"] = (string) $this->getValue($path1."/tag:xml-tag","color",0); | ||
192 | + } | ||
193 | + else{ | ||
194 | + $classe["outline"] = (string) $this->getValue($path1,"color",$c); | ||
195 | + } | ||
196 | + if($classe["desc"] != "") | ||
197 | + {$classes[] = $classe;} | ||
198 | + $c = $c + 1; | ||
199 | + } | ||
200 | + | ||
201 | + //com.iver.cit.gvsig.fmap.rendering.ZSort | ||
202 | + return $classes; | ||
203 | + } | ||
204 | + function SingleSymbolLegend($result,$path){ | ||
205 | + $classes = array(); | ||
206 | + $c = 0; | ||
207 | + | ||
208 | + while(list( , $node) = each($result)) { | ||
209 | + $classe = array(); | ||
210 | + $classe["className"] = (string) $this->getValue($path,"className",$c); | ||
211 | + if($classe["className"] != "com.iver.cit.gvsig.fmap.rendering.ZSort"){ | ||
212 | + $classe["desc"] = (string) $this->getValue($path,"desc",$c); | ||
213 | + $classe["color"] = (string) $this->getValue($path,"color",$c); | ||
214 | + $classe["rotation"] = (string) $this->getValue($path,"rotation",$c); | ||
215 | + $classe["offsetX"] = (string) $this->getValue($path,"offsetX",$c); | ||
216 | + $classe["offsetY"] = (string) $this->getValue($path,"offsetY",$c); | ||
217 | + $classe["size"] = (string) $this->getValue($path,"size",$c); | ||
218 | + $classe["markerStyle"] = (string) $this->getValue($path,"markerStyle",$c); | ||
219 | + $classe["hasFill"] = (string) $this->getValue($path,"hasFill",$c); | ||
220 | + $classe["hasOutline"] = (string) $this->getValue($path,"hasOutline",$c); | ||
221 | + $classe["exp"] = false; | ||
222 | + $classe["nome"] = " "; | ||
223 | + if($classe["hasOutline"] == "true"){ | ||
224 | + $classe["outline"] = (string) $this->getValue($path."/tag:xml-tag","color"); | ||
225 | + } | ||
226 | + else{ | ||
227 | + $classe["outline"] = (string) $this->getValue($path,"color",$c); | ||
228 | + } | ||
229 | + $classes[] = $classe; | ||
230 | + $c = $c + 1; | ||
231 | + } | ||
232 | + } | ||
233 | + | ||
234 | + return $classes; | ||
235 | + } | ||
236 | + function getValue($path,$key,$i=0){ | ||
237 | + $result = $this->xml->xpath($path."/tag:property[@key='".$key."']"); | ||
238 | + if($result) | ||
239 | + {return $this->findAttribute($result[$i],"value");} | ||
240 | + else | ||
241 | + {return false;} | ||
242 | + } | ||
243 | + function addLayers($objMap,$gvsigview,$layerNames){ | ||
244 | + foreach($layerNames as $lname){ | ||
245 | + $dataLayer = $this->getLayerData($gvsigview,$lname); | ||
246 | + $oLayer = ms_newLayerObj($objMap); | ||
247 | + $oLayer->setmetadata("TEMA",$lname); | ||
248 | + $oLayer->set("template","none.htm"); | ||
249 | + $oLayer = $this->data2layer($oLayer,$dataLayer); | ||
250 | + //evita problemas no modo tile | ||
251 | + $oLayer->setprocessing("LABEL_NO_CLIP=True"); | ||
252 | + $oLayer->setprocessing("POLYLINE_NO_CLIP=True"); | ||
253 | + } | ||
254 | + return $objMap; | ||
255 | + } | ||
256 | + function data2layer($oLayer,$dataLayer){ | ||
257 | + $oLayer->set("name",basename($this->arquivoGvp)."_".$oLayer->index); //$this->nomeRandomico()); | ||
258 | + $this->nomesLayersAdicionados[] = $oLayer->name; | ||
259 | + $oLayer->set("data",$dataLayer["data"]); | ||
260 | + if($dataLayer["connectiontype"] != "") | ||
261 | + {$oLayer->setConnectionType($dataLayer["connectiontype"]);} | ||
262 | + if($dataLayer["connection"] != "") | ||
263 | + {$oLayer->set("connection",$dataLayer["connection"]);} | ||
264 | + $oLayer->set("status",MS_DEFAULT); | ||
265 | + if($dataLayer["visible"] == "false") | ||
266 | + {$oLayer->set("status",MS_OFF);} | ||
267 | + if(!empty($dataLayer["transparency"])){ | ||
268 | + $opacidade = ($dataLayer["transparency"] * 100) / 255; | ||
269 | + $oLayer->set("opacity",$opacidade); | ||
270 | + } | ||
271 | + if($dataLayer["minScale"] > 0) | ||
272 | + {$oLayer->set("minscaledenom",$dataLayer["minScale"]);} | ||
273 | + if($dataLayer["maxScale"] > 0) | ||
274 | + {$oLayer->set("maxscaledenom",$dataLayer["maxScale"]);} | ||
275 | + | ||
276 | + $tipo = $dataLayer["legenda"]["classes"][0]["className"]; | ||
277 | + $oLayer->set("type",1); | ||
278 | + if($tipo == "com.iver.cit.gvsig.fmap.core.symbols.SimpleMarkerSymbol") | ||
279 | + {$oLayer->set("type",0);} | ||
280 | + if($tipo == "com.iver.cit.gvsig.fmap.core.symbols.SimpleFillSymbol") | ||
281 | + {$oLayer->set("type",2);} | ||
282 | + | ||
283 | + foreach($dataLayer["legenda"]["classes"] as $data){ | ||
284 | + //var_dump($data); | ||
285 | + $classe = ms_newClassObj($oLayer); | ||
286 | + $classe->set("name",$data["nome"]); | ||
287 | + $estilo = ms_newStyleObj($classe); | ||
288 | + if($oLayer->type == 0){ | ||
289 | + $estilo->set("symbolname","ponto"); | ||
290 | + } | ||
291 | + if(!empty($data["color"])){ | ||
292 | + if($data["hasFill"] == "true"){ | ||
293 | + $ncor = explode(",",$data["color"]); | ||
294 | + $cor = $estilo->color; | ||
295 | + $cor->setrgb($ncor[0],$ncor[1],$ncor[2]); | ||
296 | + } | ||
297 | + if($data["hasOutline"] == "true" && $data["outline"] != ""){ | ||
298 | + $ncor = explode(",",$data["outline"]); | ||
299 | + $cor = $estilo->outlinecolor; | ||
300 | + $cor->setrgb($ncor[0],$ncor[1],$ncor[2]); | ||
301 | + } | ||
302 | + | ||
303 | +if($data["hasFill"] == "" && $data["hasOutline"] == ""){ | ||
304 | + $ncor = explode(",",$data["color"]); | ||
305 | + $cor = $estilo->color; | ||
306 | + $cor->setrgb($ncor[0],$ncor[1],$ncor[2]); | ||
307 | +} | ||
308 | + } | ||
309 | + if($data["size"] != false) | ||
310 | + {$estilo->set("size",$data["size"]);} | ||
311 | + if($data["exp"] != false) | ||
312 | + {$classe->setExpression($data["exp"]);} | ||
313 | + } | ||
314 | + | ||
315 | + return $oLayer; | ||
316 | + } | ||
317 | + function findAttribute($object, $attribute) { | ||
318 | + $return = false; | ||
319 | + if(@$object->attributes()){ | ||
320 | + foreach($object->attributes() as $a => $b) { | ||
321 | + if ($a == $attribute) { | ||
322 | + $return = $b; | ||
323 | + } | ||
324 | + } | ||
325 | + } | ||
326 | + return $return; | ||
327 | + } | ||
328 | + function nomeRandomico($n=10) | ||
329 | + { | ||
330 | + $nomes = ""; | ||
331 | + $a = 'azertyuiopqsdfghjklmwxcvbnABCDEFGHIJKLMNOPQRSTUVWXYZ'; | ||
332 | + $max = 51; | ||
333 | + for($i=0; $i < $n; ++$i) | ||
334 | + {$nomes .= $a{mt_rand(0, $max)};} | ||
335 | + return $nomes; | ||
336 | + } | ||
337 | +} | ||
338 | +?> |