Commit 6df7b18fbd762db83584f6c082dc5558ccbd53a1
1 parent
f7901853
Exists in
master
and in
7 other branches
Inclusão das telas da interface do mapa interativo que usa o sistema de metadados estatísticos
Showing
6 changed files
with
332 additions
and
88 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin/php/classe_metaestat.php
| ... | ... | @@ -41,6 +41,7 @@ class Metaestat{ |
| 41 | 41 | protected $dbhw; |
| 42 | 42 | protected $convUTF; |
| 43 | 43 | public $dir_tmp; |
| 44 | + public $nomecache; | |
| 44 | 45 | /* |
| 45 | 46 | Function: __construct |
| 46 | 47 | |
| ... | ... | @@ -63,10 +64,14 @@ class Metaestat{ |
| 63 | 64 | if(!empty($esquemaadmin)){ |
| 64 | 65 | $this->esquemaadmin = $esquemaadmin."."; |
| 65 | 66 | } |
| 67 | + $this->nomecache = $this->nomeCache(); | |
| 66 | 68 | } |
| 67 | 69 | function __destruct(){ |
| 68 | 70 | $this->fechaConexao; |
| 69 | 71 | } |
| 72 | + function nomeCache(){ | |
| 73 | + return md5(implode("x",$_REQUEST)); | |
| 74 | + } | |
| 70 | 75 | function nomeRandomico($n=10){ |
| 71 | 76 | $nomes = ""; |
| 72 | 77 | $a = 'azertyuiopqsdfghjklmwxcvbnABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
| ... | ... | @@ -262,81 +267,83 @@ class Metaestat{ |
| 262 | 267 | return array("sqlagrupamento"=>$sqlagrupamento,"sql"=>$sql,"sqlmapserver"=>$sqlgeo,"filtro"=>$filtro,"colunas"=>$colunas); |
| 263 | 268 | } |
| 264 | 269 | function mapfileMedidaVariavel($id_medida_variavel,$filtro="",$todasascolunas = 0,$tipolayer="polygon",$titulolayer="",$id_classificacao="",$agruparpor=""){ |
| 265 | - if(empty($tipolayer)){ | |
| 266 | - $tipolayer = "polygon"; | |
| 267 | - } | |
| 268 | - $meta = $this->listaMedidaVariavel("",$id_medida_variavel); | |
| 269 | - if($titulolayer == ""){ | |
| 270 | - $titulolayer = $meta["nomemedida"]; | |
| 271 | - } | |
| 272 | - $titulolayer = mb_convert_encoding($titulolayer,"ISO-8859-1",mb_detect_encoding($titulolayer)); | |
| 273 | - $conexao = $this->listaConexao($meta["codigo_estat_conexao"],true); | |
| 274 | - $conexao = "user=".$conexao["usuario"]." password=".$conexao["senha"]." dbname=".$conexao["bancodedados"]." host=".$conexao["host"]." port=".$conexao["porta"].""; | |
| 275 | - //echo $conexao;exit; | |
| 276 | - $sql = $this->sqlMedidaVariavel($id_medida_variavel,$todasascolunas,$agruparpor,$tipolayer); | |
| 277 | - $sqlf = $sql["sqlmapserver"]; | |
| 278 | - if(!empty($filtro)){ | |
| 279 | - $sqlf = str_replace(") as foo"," AND ".$filtro." ) as foo",$sqlf); | |
| 280 | - } | |
| 281 | - $classes = ""; | |
| 282 | - if(!empty($id_classificacao)){ | |
| 283 | - $classes = $this->listaClasseClassificacao($id_classificacao); | |
| 284 | - } | |
| 285 | - $rand = $this->nomeRandomico(); | |
| 286 | - $arq = $this->dir_tmp."/".$rand.".map"; | |
| 287 | - $dados[] = "MAP"; | |
| 288 | - $dados[] = 'SYMBOLSET "'.$this->locaplic.'/symbols/simbolosv6.sym"'; | |
| 289 | - $dados[] = 'FONTSET "'.$this->locaplic.'/symbols/fontes.txt"'; | |
| 290 | - $dados[] = "LAYER"; | |
| 291 | - $dados[] = ' NAME "'.$rand.'"'; | |
| 292 | - $dados[] = " TYPE $tipolayer"; | |
| 293 | - $dados[] = ' DATA "'.$sqlf.'"'; | |
| 294 | - $dados[] = ' CONNECTION "'.$conexao.'"'; | |
| 295 | - $dados[] = ' CONNECTIONTYPE POSTGIS'; | |
| 296 | - $dados[] = ' STATUS OFF'; | |
| 297 | - $dados[] = ' METADATA'; | |
| 298 | - $dados[] = ' TEMA "'.$titulolayer.'"'; | |
| 299 | - $dados[] = ' CLASSE "SIM"'; | |
| 300 | - $dados[] = ' END'; | |
| 301 | - if($classes == ""){ | |
| 302 | - $dados[] = ' CLASS'; | |
| 303 | - $dados[] = ' NAME ""'; | |
| 304 | - $dados[] = ' STYLE'; | |
| 305 | - $dados[] = ' COLOR 200 0 0'; | |
| 306 | - $dados[] = ' END'; | |
| 307 | - $dados[] = ' END'; | |
| 308 | - } | |
| 309 | - else{ | |
| 310 | - foreach($classes as $classe){ | |
| 311 | - //var_dump($classe);exit; | |
| 270 | + //$rand = $this->nomeRandomico(); | |
| 271 | + $arq = $this->dir_tmp."/".$this->nomecache.".map"; | |
| 272 | + if(!file_exists($arq)){ | |
| 273 | + if(empty($tipolayer)){ | |
| 274 | + $tipolayer = "polygon"; | |
| 275 | + } | |
| 276 | + $meta = $this->listaMedidaVariavel("",$id_medida_variavel); | |
| 277 | + if($titulolayer == ""){ | |
| 278 | + $titulolayer = $meta["nomemedida"]; | |
| 279 | + } | |
| 280 | + $titulolayer = mb_convert_encoding($titulolayer,"ISO-8859-1",mb_detect_encoding($titulolayer)); | |
| 281 | + $conexao = $this->listaConexao($meta["codigo_estat_conexao"],true); | |
| 282 | + $conexao = "user=".$conexao["usuario"]." password=".$conexao["senha"]." dbname=".$conexao["bancodedados"]." host=".$conexao["host"]." port=".$conexao["porta"].""; | |
| 283 | + //echo $conexao;exit; | |
| 284 | + $sql = $this->sqlMedidaVariavel($id_medida_variavel,$todasascolunas,$agruparpor,$tipolayer); | |
| 285 | + $sqlf = $sql["sqlmapserver"]; | |
| 286 | + if(!empty($filtro)){ | |
| 287 | + $sqlf = str_replace(") as foo"," AND ".$filtro." ) as foo",$sqlf); | |
| 288 | + } | |
| 289 | + $classes = ""; | |
| 290 | + if(!empty($id_classificacao)){ | |
| 291 | + $classes = $this->listaClasseClassificacao($id_classificacao); | |
| 292 | + } | |
| 293 | + $dados[] = "MAP"; | |
| 294 | + $dados[] = 'SYMBOLSET "'.$this->locaplic.'/symbols/simbolosv6.sym"'; | |
| 295 | + $dados[] = 'FONTSET "'.$this->locaplic.'/symbols/fontes.txt"'; | |
| 296 | + $dados[] = "LAYER"; | |
| 297 | + $dados[] = ' NAME "'.$this->nomecache.'"'; | |
| 298 | + $dados[] = " TYPE $tipolayer"; | |
| 299 | + $dados[] = ' DATA "'.$sqlf.'"'; | |
| 300 | + $dados[] = ' CONNECTION "'.$conexao.'"'; | |
| 301 | + $dados[] = ' CONNECTIONTYPE POSTGIS'; | |
| 302 | + $dados[] = ' STATUS OFF'; | |
| 303 | + $dados[] = ' METADATA'; | |
| 304 | + $dados[] = ' TEMA "'.$titulolayer.'"'; | |
| 305 | + $dados[] = ' CLASSE "SIM"'; | |
| 306 | + $dados[] = ' END'; | |
| 307 | + if($classes == ""){ | |
| 312 | 308 | $dados[] = ' CLASS'; |
| 313 | - $dados[] = ' NAME "'.mb_convert_encoding($classe["titulo"],"ISO-8859-1",mb_detect_encoding($titulolayer)).'"'; | |
| 314 | - $dados[] = ' EXPRESSION '.$classe["expressao"]; | |
| 309 | + $dados[] = ' NAME ""'; | |
| 315 | 310 | $dados[] = ' STYLE'; |
| 316 | - $dados[] = ' COLOR '.$classe["vermelho"].' '.$classe["verde"].' '.$classe["azul"]; | |
| 317 | - if(!empty($classe["tamanho"])){ | |
| 318 | - $dados[] = ' SIZE '.$classe["tamanho"]; | |
| 319 | - } | |
| 320 | - if(!empty($classe["simbolo"])){ | |
| 321 | - $dados[] = ' SYMBOL '.$classe["simbolo"]; | |
| 322 | - } | |
| 323 | - if(!empty($classe["otamanho"])){ | |
| 324 | - $dados[] = ' OUTLINEWIDTH '.$classe["otamanho"]; | |
| 325 | - } | |
| 326 | - if(!empty($classe["overmelho"]) || $classe["overmelho"] == "0"){ | |
| 327 | - $dados[] = ' OUTLINECOLOR '.$classe["overmelho"].' '.$classe["overde"].' '.$classe["oazul"]; | |
| 328 | - } | |
| 311 | + $dados[] = ' COLOR 200 0 0'; | |
| 329 | 312 | $dados[] = ' END'; |
| 330 | 313 | $dados[] = ' END'; |
| 331 | 314 | } |
| 315 | + else{ | |
| 316 | + foreach($classes as $classe){ | |
| 317 | + //var_dump($classe);exit; | |
| 318 | + $dados[] = ' CLASS'; | |
| 319 | + $dados[] = ' NAME "'.mb_convert_encoding($classe["titulo"],"ISO-8859-1",mb_detect_encoding($titulolayer)).'"'; | |
| 320 | + $dados[] = ' EXPRESSION '.$classe["expressao"]; | |
| 321 | + $dados[] = ' STYLE'; | |
| 322 | + $dados[] = ' COLOR '.$classe["vermelho"].' '.$classe["verde"].' '.$classe["azul"]; | |
| 323 | + if(!empty($classe["tamanho"])){ | |
| 324 | + $dados[] = ' SIZE '.$classe["tamanho"]; | |
| 325 | + } | |
| 326 | + if(!empty($classe["simbolo"])){ | |
| 327 | + $dados[] = ' SYMBOL '.$classe["simbolo"]; | |
| 328 | + } | |
| 329 | + if(!empty($classe["otamanho"])){ | |
| 330 | + $dados[] = ' OUTLINEWIDTH '.$classe["otamanho"]; | |
| 331 | + } | |
| 332 | + if(!empty($classe["overmelho"]) || $classe["overmelho"] == "0"){ | |
| 333 | + $dados[] = ' OUTLINECOLOR '.$classe["overmelho"].' '.$classe["overde"].' '.$classe["oazul"]; | |
| 334 | + } | |
| 335 | + $dados[] = ' END'; | |
| 336 | + $dados[] = ' END'; | |
| 337 | + } | |
| 338 | + } | |
| 339 | + $dados[] = "END"; | |
| 340 | + $dados[] = "END"; | |
| 341 | + $fp = fopen($arq,"w"); | |
| 342 | + foreach ($dados as $dado){ | |
| 343 | + fwrite($fp,$dado."\n"); | |
| 344 | + } | |
| 332 | 345 | } |
| 333 | - $dados[] = "END"; | |
| 334 | - $dados[] = "END"; | |
| 335 | - $fp = fopen($arq,"w"); | |
| 336 | - foreach ($dados as $dado){ | |
| 337 | - fwrite($fp,$dado."\n"); | |
| 338 | - } | |
| 339 | - return array("mapfile"=>$arq,"layer"=>$rand,"titulolayer"=>$titulolayer); | |
| 346 | + return array("mapfile"=>$arq,"layer"=>$this->nomecache,"titulolayer"=>$titulolayer); | |
| 340 | 347 | } |
| 341 | 348 | function mapfileCompleto($mapfile){ |
| 342 | 349 | $f = $this->base; | ... | ... |
classesjs/classe_arvoredecamadas.js
| ... | ... | @@ -745,11 +745,14 @@ i3GEO.arvoreDeCamadas = { |
| 745 | 745 | n = lista.length; |
| 746 | 746 | for(i=0;i<n;i+=1){ |
| 747 | 747 | c = i3GEO.arvoreDeCamadas.capturaCheckBox(lista[i]); |
| 748 | - if(c.checked !== status) | |
| 749 | - {aplica = true;} | |
| 750 | - c.checked = status; | |
| 751 | - if(aplica === true) | |
| 752 | - {c.onclick.call();} | |
| 748 | + if(c){ | |
| 749 | + if(c.checked !== status) | |
| 750 | + {aplica = true;} | |
| 751 | + c.checked = status; | |
| 752 | + //TODO isso funciona no IE? | |
| 753 | + if(aplica === true) | |
| 754 | + {c.onclick();} | |
| 755 | + } | |
| 753 | 756 | } |
| 754 | 757 | }, |
| 755 | 758 | /* | ... | ... |
classesjs/classe_cartograma.js
| ... | ... | @@ -41,15 +41,128 @@ i3GEO.cartograma = { |
| 41 | 41 | LEFT: 100, |
| 42 | 42 | LARGURA: 260, |
| 43 | 43 | ALTURA: 300, |
| 44 | + //lista das camadas que foram adicionadas ao mapa | |
| 45 | + CAMADAS: [], | |
| 44 | 46 | inicia: function(iddiv){ |
| 45 | - if(!iddiv){ | |
| 46 | - iddiv = "i3geoCartoParametros_corpo"; | |
| 47 | + i3GEO.cartograma.principal.inicia(iddiv); | |
| 48 | + }, | |
| 49 | + desligaCamadas: function(){ | |
| 50 | + if(i3GEO.cartograma.CAMADAS.length > 0){ | |
| 51 | + i3GEO.arvoreDeCamadas.ligaDesligaTemas(i3GEO.cartograma.CAMADAS.join(","),false); | |
| 52 | + } | |
| 53 | + }, | |
| 54 | + adicionaCamada: function(){ | |
| 55 | + //function mapfileMedidaVariavel($id_medida_variavel,$filtro="",$todasascolunas = 0,$tipolayer="polygon",$titulolayer="",$id_classificacao="",$agruparpor=""){ | |
| 56 | + var v = i3GEO.cartograma.verificaParametros(), | |
| 57 | + temp = function(retorno){ | |
| 58 | + if(i3GEO.arvoreDeCamadas.pegaTema(retorno.layer) == ""){ | |
| 59 | + i3GEO.cartograma.desligaCamadas(); | |
| 60 | + i3GEO.php.adtema(i3GEO.atualiza,retorno.mapfile); | |
| 61 | + i3GEO.cartograma.CAMADAS.push(retorno.layer); | |
| 62 | + } | |
| 63 | + }; | |
| 64 | + if(v != true){ | |
| 65 | + alert("erro: "+v); | |
| 66 | + } | |
| 67 | + i3GEO.php.mapfileMedidaVariavel( | |
| 68 | + temp, | |
| 69 | + $i("i3geoCartoComboMedidasVariavel").value, | |
| 70 | + i3GEO.cartograma.defineFiltro(), | |
| 71 | + 0, | |
| 72 | + $i("i3geoCartoComboTipoRep").value, | |
| 73 | + i3GEO.cartograma.defineTitulo(), | |
| 74 | + $i("i3geoCartoComboTipoClassificacao").value, | |
| 75 | + i3GEO.cartograma.defineAgruparPor() | |
| 76 | + ); | |
| 77 | + }, | |
| 78 | + defineTitulo: function(){ | |
| 79 | + //se nao tiver parametros, filtro e vazio | |
| 80 | + if(i3GEO.cartograma.parametros.dados.length == 0){ | |
| 81 | + return ""; | |
| 82 | + } | |
| 83 | + //se tiver parametro e todos estiverem vazios, aborta | |
| 84 | + var i,n,c,titulo, | |
| 85 | + t=[], | |
| 86 | + dados = i3GEO.cartograma.parametros.dados; | |
| 87 | + titulo = $i("i3geoCartoComboVariavel").options[$i("i3geoCartoComboVariavel").selectedIndex].label +" - "+ | |
| 88 | + $i("i3geoCartoComboMedidasVariavel").options[$i("i3geoCartoComboMedidasVariavel").selectedIndex].label +" - "+ | |
| 89 | + $i("i3geoCartoComboTipoRep").options[$i("i3geoCartoComboTipoRep").selectedIndex].label +" - "+ | |
| 90 | + $i("i3geoCartoComboTipoClassificacao").options[$i("i3geoCartoComboTipoClassificacao").selectedIndex].label; | |
| 91 | + n = dados.length; | |
| 92 | + for(i=0;i<n;i++){ | |
| 93 | + c = $i("comboparametro_"+dados[i].id_parametro_medida+"_"+dados[i].id_pai); | |
| 94 | + if(c && c.value != ""){ | |
| 95 | + t.push(dados[i].nome+" = "+c.value); | |
| 96 | + } | |
| 97 | + } | |
| 98 | + if(t.length > 0){ | |
| 99 | + return titulo+" - "+t.join(", "); | |
| 100 | + } | |
| 101 | + else{ | |
| 102 | + return titulo; | |
| 103 | + } | |
| 104 | + }, | |
| 105 | + defineFiltro: function(){ | |
| 106 | + //se nao tiver parametros, filtro e vazio | |
| 107 | + if(i3GEO.cartograma.parametros.dados.length == 0){ | |
| 108 | + return ""; | |
| 109 | + } | |
| 110 | + //se tiver parametro e todos estiverem vazios, aborta | |
| 111 | + var i,n,c, | |
| 112 | + t=[], | |
| 113 | + dados = i3GEO.cartograma.parametros.dados; | |
| 114 | + n = dados.length; | |
| 115 | + for(i=0;i<n;i++){ | |
| 116 | + c = $i("comboparametro_"+dados[i].id_parametro_medida+"_"+dados[i].id_pai); | |
| 117 | + if(c && c.value != ""){ | |
| 118 | + t.push(dados[i].coluna+"="+c.value); | |
| 119 | + } | |
| 120 | + } | |
| 121 | + if(t.length > 0){ | |
| 122 | + return t.join(" and "); | |
| 47 | 123 | } |
| 48 | - if(i3GEO.cartograma.INTERFACE == "flutuante"){ | |
| 49 | - i3GEO.cartograma.principal.abreJanela(); | |
| 124 | + else{ | |
| 125 | + return ""; | |
| 50 | 126 | } |
| 51 | - $i(iddiv).innerHTML = i3GEO.cartograma.principal.html(); | |
| 52 | - i3GEO.cartograma.principal.comboVariaveis(); | |
| 127 | + }, | |
| 128 | + defineAgruparPor: function(){ | |
| 129 | + //se nao tiver parametros, filtro e vazio | |
| 130 | + if(i3GEO.cartograma.parametros.dados.length == 0){ | |
| 131 | + return ""; | |
| 132 | + } | |
| 133 | + //se tiver parametro e todos estiverem vazios, aborta | |
| 134 | + var i,n,c, | |
| 135 | + t=[], | |
| 136 | + dados = i3GEO.cartograma.parametros.dados; | |
| 137 | + n = dados.length; | |
| 138 | + for(i=0;i<n;i++){ | |
| 139 | + c = $i("comboparametro_"+dados[i].id_parametro_medida+"_"+dados[i].id_pai); | |
| 140 | + if(c && c.value != ""){ | |
| 141 | + t.push(dados[i].coluna); | |
| 142 | + } | |
| 143 | + } | |
| 144 | + if(t.length > 0){ | |
| 145 | + return t.join(","); | |
| 146 | + } | |
| 147 | + else{ | |
| 148 | + return ""; | |
| 149 | + } | |
| 150 | + }, | |
| 151 | + verificaParametros: function(){ | |
| 152 | + var ok = true, | |
| 153 | + combos = ["i3geoCartoComboVariavel","i3geoCartoComboMedidasVariavel","i3geoCartoComboTipoRep","i3geoCartoComboTipoClassificacao"], | |
| 154 | + n = combos.length, | |
| 155 | + i,temp; | |
| 156 | + for(i=0;i<n;i++){ | |
| 157 | + temp = $i(combos[i]); | |
| 158 | + if(!temp){ | |
| 159 | + return combos[i]; | |
| 160 | + } | |
| 161 | + if(temp.value == ""){ | |
| 162 | + return combos[i]; | |
| 163 | + } | |
| 164 | + } | |
| 165 | + return ok; | |
| 53 | 166 | }, |
| 54 | 167 | aguarde: function(obj){ |
| 55 | 168 | if(!obj){ |
| ... | ... | @@ -69,6 +182,16 @@ i3GEO.cartograma = { |
| 69 | 182 | } |
| 70 | 183 | }, |
| 71 | 184 | principal: { |
| 185 | + inicia: function(iddiv){ | |
| 186 | + if(!iddiv){ | |
| 187 | + iddiv = "i3geoCartoParametros_corpo"; | |
| 188 | + } | |
| 189 | + if(i3GEO.cartograma.INTERFACE == "flutuante"){ | |
| 190 | + i3GEO.cartograma.principal.abreJanela(); | |
| 191 | + } | |
| 192 | + $i(iddiv).innerHTML = i3GEO.cartograma.principal.html(); | |
| 193 | + i3GEO.cartograma.principal.comboVariaveis(); | |
| 194 | + }, | |
| 72 | 195 | abreJanela: function(){ |
| 73 | 196 | var cabecalho,minimiza,imagemxy,janela; |
| 74 | 197 | if (!$i("i3geoCartoParametros")){ |
| ... | ... | @@ -161,7 +284,7 @@ i3GEO.cartograma = { |
| 161 | 284 | var onde = $i("i3geoCartoVariaveis"), |
| 162 | 285 | temp = function(dados){ |
| 163 | 286 | var n = dados.length, |
| 164 | - ins = '<p><input type="button" id="i3GEOcartoBotaoInfo" onclick="i3GEO.cartograma.principal.maisInfo()" value="'+$trad("x60")+'"class="paragrafo" style="cursor:pointer;color:blue" /></p><br><p class="paragrafo" >'+$trad("x58")+'</p>', | |
| 287 | + ins = '<p style="text-align:left;"><input type="button" id="i3GEOcartoBotaoInfo" onclick="i3GEO.cartograma.principal.maisInfo()" value="'+$trad("x60")+'"class="paragrafo" style="width:200px;cursor:pointer;color:blue" /></p><br><p class="paragrafo" >'+$trad("x58")+'</p>', | |
| 165 | 288 | i; |
| 166 | 289 | ins += "<select id='i3geoCartoComboVariavel' style='box-shadow:0 1px 5px gray;width:"+(i3GEO.cartograma.LARGURA - 20)+"px' onchange='i3GEO.cartograma.principal.comboVariaveisOnchange(this)'><option value=''>---</option>"; |
| 167 | 290 | for(i=0;i<n;i++){ |
| ... | ... | @@ -174,6 +297,7 @@ i3GEO.cartograma = { |
| 174 | 297 | "i3GEOcartoBotaoInfo", |
| 175 | 298 | {onclick:{fn: i3GEO.cartograma.principal.maisInfo}} |
| 176 | 299 | ); |
| 300 | + $i("i3GEOcartoBotaoInfo-button").style.width = i3GEO.cartograma.LARGURA - 25 + "px"; | |
| 177 | 301 | } |
| 178 | 302 | return ins; |
| 179 | 303 | }; |
| ... | ... | @@ -195,7 +319,7 @@ i3GEO.cartograma = { |
| 195 | 319 | var n = dados.length, |
| 196 | 320 | ins = '<p class="paragrafo" >'+$trad("x59")+'</p>', |
| 197 | 321 | i; |
| 198 | - ins += "<select style='width:"+(i3GEO.cartograma.LARGURA - 20)+"px' onchange='i3GEO.cartograma.principal.comboMedidaVariavelOnchange(this)'><option value=''>---</option>"; | |
| 322 | + ins += "<select id='i3geoCartoComboMedidasVariavel' style='width:"+(i3GEO.cartograma.LARGURA - 20)+"px' onchange='i3GEO.cartograma.principal.comboMedidaVariavelOnchange(this)'><option value=''>---</option>"; | |
| 199 | 323 | for(i=0;i<n;i++){ |
| 200 | 324 | ins += "<option value='"+dados[i].id_medida_variavel+"'>"+dados[i].nomemedida+"</option>"; |
| 201 | 325 | } |
| ... | ... | @@ -209,7 +333,7 @@ i3GEO.cartograma = { |
| 209 | 333 | i3GEO.php.listaMedidaVariavel(codigo_variavel,temp); |
| 210 | 334 | }, |
| 211 | 335 | comboMedidaVariavelOnchange: function(combo){ |
| 212 | - i3GEO.cartograma.classes.abreJanela(); | |
| 336 | + i3GEO.cartograma.classes.inicia(); | |
| 213 | 337 | if(combo.value != ""){ |
| 214 | 338 | i3GEO.cartograma.parametros.lista(combo.value); |
| 215 | 339 | } |
| ... | ... | @@ -261,23 +385,23 @@ i3GEO.cartograma = { |
| 261 | 385 | novoel.id = idcombo; |
| 262 | 386 | novoel.className = "paragrafo"; |
| 263 | 387 | onde.appendChild(novoel); |
| 264 | - i3GEO.cartograma.parametros.valoresCombo(dados[i].id_parametro_medida,dados[i].nome,nivel,onde); | |
| 388 | + i3GEO.cartograma.parametros.valoresCombo(dados[i].id_parametro_medida,dados[i].nome,nivel,onde,idcombo); | |
| 265 | 389 | } |
| 266 | 390 | } |
| 267 | 391 | } |
| 268 | 392 | }, |
| 269 | - valoresCombo: function(id_parametro_medida,titulo,nivel,onde){ | |
| 393 | + valoresCombo: function(id_parametro_medida,titulo,nivel,onde,idcombo){ | |
| 270 | 394 | var temp = function(dados){ |
| 271 | 395 | var n = dados.length, |
| 272 | 396 | ins = "", |
| 273 | - oc = "'i3GEO.cartograma.parametros.combos(\""+id_parametro_medida+"\")'", | |
| 397 | + oc = "'i3GEO.cartograma.parametros.antesCombo();i3GEO.cartograma.parametros.combos(\""+id_parametro_medida+"\")'", | |
| 274 | 398 | filho = i3GEO.cartograma.parametros.retornaIdFilho(id_parametro_medida), |
| 275 | 399 | i,novoel; |
| 276 | 400 | if(filho == false){ |
| 277 | 401 | oc = ""; |
| 278 | 402 | } |
| 279 | 403 | ins = "<p class=paragrafo >"+titulo+"</p>"; |
| 280 | - ins += "<select style='background:beige;width:"+(i3GEO.cartograma.LARGURA - 20)+"px' onchange="+oc+" ><option value=''>---</option>"; | |
| 404 | + ins += "<select id='combo"+idcombo+"' style='background:beige;width:"+(i3GEO.cartograma.LARGURA - 20)+"px' onchange="+oc+" ><option value=''>---</option>"; | |
| 281 | 405 | for(i=0;i<n;i++){ |
| 282 | 406 | ins += "<option value='"+dados[i]+"'>"+dados[i]+"</option>"; |
| 283 | 407 | } |
| ... | ... | @@ -290,6 +414,11 @@ i3GEO.cartograma = { |
| 290 | 414 | }; |
| 291 | 415 | i3GEO.php.listaValoresParametroMedidaVariavel(id_parametro_medida,temp); |
| 292 | 416 | }, |
| 417 | + antesCombo: function(){ | |
| 418 | + if(!$i("i3geoCartoClasses_corpo")){ | |
| 419 | + i3GEO.cartograma.classes.inicia(); | |
| 420 | + } | |
| 421 | + }, | |
| 293 | 422 | //retorna o id do parametro que e filho de um outro parametro |
| 294 | 423 | retornaIdFilho:function(pai){ |
| 295 | 424 | var dados = i3GEO.cartograma.parametros.dados, |
| ... | ... | @@ -316,6 +445,21 @@ i3GEO.cartograma = { |
| 316 | 445 | } |
| 317 | 446 | }, |
| 318 | 447 | classes:{ |
| 448 | + inicia: function(iddiv){ | |
| 449 | + if(!$i("i3geoCartoComboMedidasVariavel")){ | |
| 450 | + alert("erro: i3geoCartoComboMedidasVariavel???"); | |
| 451 | + return; | |
| 452 | + } | |
| 453 | + if(!iddiv){ | |
| 454 | + iddiv = "i3geoCartoClasses_corpo"; | |
| 455 | + } | |
| 456 | + if(i3GEO.cartograma.INTERFACE == "flutuante"){ | |
| 457 | + i3GEO.cartograma.classes.abreJanela(); | |
| 458 | + } | |
| 459 | + $i(iddiv).innerHTML = i3GEO.cartograma.classes.html(); | |
| 460 | + i3GEO.cartograma.classes.comboTipoRep(); | |
| 461 | + i3GEO.cartograma.classes.comboTipoClassificacao(); | |
| 462 | + }, | |
| 319 | 463 | abreJanela: function(){ |
| 320 | 464 | var cabecalho,minimiza,imagemxy,janela; |
| 321 | 465 | if (!$i("i3geoCartoClasses")){ |
| ... | ... | @@ -350,10 +494,61 @@ i3GEO.cartograma = { |
| 350 | 494 | }, |
| 351 | 495 | html: function(){ |
| 352 | 496 | var ins = '<div id="i3geoCartoClassesContainer" style="margin-left:5px;">' + |
| 353 | - '<div class="paragrafo" id="i3geoCartoClasses" >' + | |
| 497 | + '<div class="paragrafo" id="i3geoCartoTipoRep" >' + | |
| 498 | + '</div>' + | |
| 499 | + '<div class="paragrafo" id="i3geoCartoTipoClassificacao" >' + | |
| 354 | 500 | '</div>' + |
| 355 | 501 | '</div>'; |
| 356 | 502 | return ins; |
| 503 | + }, | |
| 504 | + comboTipoRep: function(){ | |
| 505 | + var onde = $i("i3geoCartoTipoRep"), | |
| 506 | + ins,i, | |
| 507 | + dados = [ | |
| 508 | + {"codigo":"polygon","nome":"polígonos"}, | |
| 509 | + {"codigo":"point","nome":"pontos"} | |
| 510 | + ], | |
| 511 | + n = dados.length; | |
| 512 | + ins = '<p style="text-align:left;"><input type="button" id="i3GEOcartoBotaoAdicionarCamada" onclick="i3GEO.cartograma.principal.maisInfo()" value="'+$trad("x64")+'"class="paragrafo" style="cursor:pointer;color:blue" /></p>' + | |
| 513 | + '<br><p class="paragrafo" >'+$trad("x65")+'</p>' + | |
| 514 | + "<select id='i3geoCartoComboTipoRep' style='box-shadow:0 1px 5px gray;width:"+(i3GEO.cartograma.LARGURA - 20)+"px' onchange=''>"; | |
| 515 | + for(i=0;i<n;i++){ | |
| 516 | + ins += "<option value='"+dados[i].codigo+"'>"+dados[i].nome+"</option>"; | |
| 517 | + } | |
| 518 | + ins += "</select>"; | |
| 519 | + if(onde){ | |
| 520 | + onde.innerHTML = ins; | |
| 521 | + new YAHOO.widget.Button( | |
| 522 | + "i3GEOcartoBotaoAdicionarCamada", | |
| 523 | + {onclick:{fn: i3GEO.cartograma.adicionaCamada}} | |
| 524 | + ); | |
| 525 | + $i("i3GEOcartoBotaoAdicionarCamada-button").style.width = i3GEO.cartograma.LARGURA - 25 + "px"; | |
| 526 | + } | |
| 527 | + return ins; | |
| 528 | + }, | |
| 529 | + comboTipoClassificacao: function(){ | |
| 530 | + var onde = $i("i3geoCartoTipoClassificacao"), | |
| 531 | + combo = $i("i3geoCartoComboMedidasVariavel"), | |
| 532 | + temp = function(dados){ | |
| 533 | + var n = dados.length, | |
| 534 | + ins = '<p class="paragrafo" >'+$trad("x66")+'</p>', | |
| 535 | + i; | |
| 536 | + ins += "<select id='i3geoCartoComboTipoClassificacao' style='width:"+(i3GEO.cartograma.LARGURA - 20)+"px' onchange='i3GEO.cartograma.classes.comboTipoClassificacaoOnchange(this)'><option value=''>---</option>"; | |
| 537 | + for(i=0;i<n;i++){ | |
| 538 | + ins += "<option title='"+dados[i].observacao+"' value='"+dados[i].id_classificacao+"'>"+dados[i].nome+"</option>"; | |
| 539 | + } | |
| 540 | + ins += "</select>"; | |
| 541 | + //{"id_classificacao":"1","nome":"Pela media","id_medida_variavel":"1","observacao":""} | |
| 542 | + if(onde){ | |
| 543 | + onde.innerHTML = ins; | |
| 544 | + } | |
| 545 | + return ins; | |
| 546 | + }; | |
| 547 | + i3GEO.cartograma.aguarde(onde); | |
| 548 | + i3GEO.php.listaClassificacaoMedida(combo.value,temp); | |
| 549 | + }, | |
| 550 | + comboTipoClassificacaoOnchange: function(){ | |
| 551 | + | |
| 357 | 552 | } |
| 358 | 553 | } |
| 359 | 554 | ... | ... |
classesjs/classe_php.js
| ... | ... | @@ -1464,5 +1464,23 @@ i3GEO.php = { |
| 1464 | 1464 | relatorioVariavel: function(codigo_variavel,funcao){ |
| 1465 | 1465 | var p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=relatorioCompleto&codigo_variavel="+codigo_variavel+"&g_sid="+i3GEO.configura.sid; |
| 1466 | 1466 | i3GEO.util.ajaxGet(p,funcao); |
| 1467 | + }, | |
| 1468 | + /* | |
| 1469 | + Function: listaClassificacaoMedida | |
| 1470 | + | |
| 1471 | + Lista as classificacoes de uma medida de variavel do sistema de metadados estatísticos | |
| 1472 | + */ | |
| 1473 | + listaClassificacaoMedida: function(id_medida_variavel,funcao){ | |
| 1474 | + var p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=listaClassificacaoMedida&id_medida_variavel="+id_medida_variavel+"&g_sid="+i3GEO.configura.sid; | |
| 1475 | + i3GEO.util.ajaxGet(p,funcao); | |
| 1476 | + }, | |
| 1477 | + /* | |
| 1478 | + Function: mapfileMedidaVariavel | |
| 1479 | + | |
| 1480 | + Adiciona uma camada ao mapa baseado no sistema de metadados estatísticos | |
| 1481 | + */ | |
| 1482 | + mapfileMedidaVariavel: function(funcao,id_medida_variavel,filtro,todasascolunas,tipolayer,titulolayer,id_classificacao,agruparpor){ | |
| 1483 | + var p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=mapfileMedidaVariavel&formato=json&id_medida_variavel="+id_medida_variavel+"&filtro="+filtro+"&todasascolunas="+todasascolunas+"&tipolayer="+tipolayer+"&titulolayer="+titulolayer+"&id_classificacao="+id_classificacao+"&agruparpor="+agruparpor+"&g_sid="+i3GEO.configura.sid; | |
| 1484 | + i3GEO.util.ajaxGet(p,funcao); | |
| 1467 | 1485 | } |
| 1468 | 1486 | }; |
| 1469 | 1487 | \ No newline at end of file | ... | ... |
classesjs/dicionario.js
| ... | ... | @@ -1978,6 +1978,27 @@ it:"" |
| 1978 | 1978 | }], |
| 1979 | 1979 | "x64":[ |
| 1980 | 1980 | { |
| 1981 | +pt:"Adicionar camada ao mapa", | |
| 1982 | +en:"", | |
| 1983 | +es:"", | |
| 1984 | +it:"" | |
| 1985 | +}], | |
| 1986 | +"x65":[ | |
| 1987 | +{ | |
| 1988 | +pt:"Como os dados serão representados", | |
| 1989 | +en:"", | |
| 1990 | +es:"", | |
| 1991 | +it:"" | |
| 1992 | +}], | |
| 1993 | +"x66":[ | |
| 1994 | +{ | |
| 1995 | +pt:"Escolha um tipo de classificação", | |
| 1996 | +en:"", | |
| 1997 | +es:"", | |
| 1998 | +it:"" | |
| 1999 | +}], | |
| 2000 | +"x67":[ | |
| 2001 | +{ | |
| 1981 | 2002 | pt:"", |
| 1982 | 2003 | en:"", |
| 1983 | 2004 | es:"", | ... | ... |