Commit bc40f8ea45a495518b90a1687e1b85b911338ab0

Authored by Edmar Moretti
1 parent 2a5011f3

Correção na obtenção dos nomes das classes e do outline

pacotes/gvsig/gvsig2mapfile/class.gvsig2mapfile.php
... ... @@ -115,7 +115,8 @@ class gvsig2mapfile{
115 115 $coluna = (string) $this->getValue($path."/tag:xml-tag","fieldNames");
116 116 $valores = (string) $this->getValue($path."/tag:xml-tag","values");
117 117 $tipocoluna = (string) $this->getValue($path."/tag:xml-tag","fieldTypes");
118   - $classes = $this->VectorialUniqueValueLegend($result,$path1,$coluna,$tipocoluna,$valores);
  118 + $nomes = (string) $this->getValue($path."/tag:xml-tag","keys");
  119 + $classes = $this->VectorialUniqueValueLegend($result,$path1,$coluna,$tipocoluna,$valores,$nomes);
119 120 }
120 121  
121 122 $path1 = $path."/tag:xml-tag/tag:property[@value='".$render.".SingleSymbolLegend']/parent::*/tag:xml-tag";
... ... @@ -159,9 +160,11 @@ class gvsig2mapfile{
159 160 )
160 161 );
161 162 }
162   - function VectorialUniqueValueLegend($result,$path1,$coluna,$tipocoluna,$valores){
  163 + function VectorialUniqueValueLegend($result,$path1,$coluna,$tipocoluna,$valores,$nomes){
163 164 $valores = ",".str_replace(" ,",",",$valores);
164 165 $valores = explode(",",$valores);
  166 + $nomes = ",".str_replace(" ,",",",$nomes);
  167 + $nomes = explode(",",$nomes);
165 168 $classes = array();
166 169 $c = 0;
167 170 while(list( , $node) = each($result)) {
... ... @@ -171,16 +174,22 @@ class gvsig2mapfile{
171 174 else
172 175 {$classe["exp"] = "([".$coluna."] = ".$valores[$c]." )";}
173 176 $classe["className"] = (string) $this->getValue($path1,"className",$c);
  177 + $classe["nome"] = $nomes[$c];
174 178 $classe["desc"] = (string) $this->getValue($path1,"desc",$c);
175 179 $classe["color"] = (string) $this->getValue($path1,"color",$c);
176 180 $classe["rotation"] = (string) $this->getValue($path1,"rotation",$c);
177 181 $classe["offsetX"] = (string) $this->getValue($path1,"offsetX",$c);
178 182 $classe["offsetY"] = (string) $this->getValue($path1,"offsetY",$c);
179 183 $classe["size"] = (string) $this->getValue($path1,"size",$c);
180   - $classe["outline"] = (string) $this->getValue($path1,"outline",$c);
181 184 $classe["markerStyle"] = (string) $this->getValue($path1,"markerStyle",$c);
182 185 $classe["hasFill"] = (string) $this->getValue($path1,"hasFill",$c);
183 186 $classe["hasOutline"] = (string) $this->getValue($path1,"hasOutline",$c);
  187 + if($classe["hasOutline"] == "true"){
  188 + $classe["outline"] = (string) $this->getValue($path1."/tag:xml-tag","color",0);
  189 + }
  190 + else{
  191 + $classe["outline"] = (string) $this->getValue($path1,"color",$c);
  192 + }
184 193 if($classe["desc"] != "")
185 194 {$classes[] = $classe;}
186 195 $c = $c + 1;
... ... @@ -200,13 +209,16 @@ class gvsig2mapfile{
200 209 $classe["offsetX"] = (string) $this->getValue($path,"offsetX",$c);
201 210 $classe["offsetY"] = (string) $this->getValue($path,"offsetY",$c);
202 211 $classe["size"] = (string) $this->getValue($path,"size",$c);
203   - $classe["outline"] = (string) $this->getValue($path,"outline",$c);
204 212 $classe["markerStyle"] = (string) $this->getValue($path,"markerStyle",$c);
205 213 $classe["hasFill"] = (string) $this->getValue($path,"hasFill",$c);
206 214 $classe["hasOutline"] = (string) $this->getValue($path,"hasOutline",$c);
207 215 $classe["exp"] = false;
  216 + $classe["nome"] = " ";
208 217 if($classe["hasOutline"] == "true"){
209   - $classe["outline"] = $this->getValue($path."/tag:xml-tag","color");
  218 + $classe["outline"] = (string) $this->getValue($path."/tag:xml-tag","color");
  219 + }
  220 + else{
  221 + $classe["outline"] = (string) $this->getValue($path,"color",$c);
210 222 }
211 223 $classes[] = $classe;
212 224 $c = $c + 1;
... ... @@ -225,12 +237,14 @@ class gvsig2mapfile{
225 237 $dataLayer = $this->getLayerData($gvsigview,$lname);
226 238 $oLayer = ms_newLayerObj($objMap);
227 239 $oLayer->setmetadata("TEMA",$lname);
  240 + $oLayer->set("template","none.htm");
228 241 $oLayer = $this->data2layer($oLayer,$dataLayer);
229 242 }
230 243 return $objMap;
231 244 }
232 245 function data2layer($oLayer,$dataLayer){
233   - $oLayer->set("name",$this->nomeRandomico());
  246 + //TODO corrigir acentuação
  247 + $oLayer->set("name",basename($this->arquivoGvp)."_".$oLayer->index); //$this->nomeRandomico());
234 248 $this->nomesLayersAdicionados[] = $oLayer->name;
235 249 $oLayer->set("data",$dataLayer["data"]);
236 250 if($dataLayer["connectiontype"] != "")
... ... @@ -254,17 +268,23 @@ class gvsig2mapfile{
254 268 if($tipo == "com.iver.cit.gvsig.fmap.core.symbols.SimpleFillSymbol")
255 269 {$oLayer->set("type",2);}
256 270 foreach($dataLayer["legenda"]["classes"] as $data){
  271 + //var_dump($data);
257 272 $classe = ms_newClassObj($oLayer);
  273 + $classe->set("name",$data["nome"]);
258 274 $estilo = ms_newStyleObj($classe);
259 275 if($oLayer->type == 0){
260 276 $estilo->set("symbolname","ponto");
261 277 }
262   - $ncor = explode(",",$data["color"]);
263   - if($data["hasFill"] == "true")
264   - {$cor = $estilo->color;}
265   - else
266   - {$cor = $estilo->outlinecolor;}
267   - $cor->setrgb($ncor[0],$ncor[1],$ncor[2]);
  278 + if($data["hasFill"] == "true"){
  279 + $ncor = explode(",",$data["color"]);
  280 + $cor = $estilo->color;
  281 + $cor->setrgb($ncor[0],$ncor[1],$ncor[2]);
  282 + }
  283 + if($data["hasOutline"] == "true" && $data["outline"] != ""){
  284 + $ncor = explode(",",$data["outline"]);
  285 + $cor = $estilo->outlinecolor;
  286 + $cor->setrgb($ncor[0],$ncor[1],$ncor[2]);
  287 + }
268 288 if($data["size"] != false)
269 289 {$estilo->set("size",$data["size"]);}
270 290 if($data["exp"] != false)
... ...