Commit d0559edf2bae04bbbf14566ceb1996abf23f0217

Authored by Edmar Moretti
1 parent 68336200

Novas funcionalidades no menu de definição de tipos de representação do METAESTAT

classesjs/classe_configura.js
... ... @@ -695,7 +695,7 @@ i3GEO.configura = {
695 695 funcaoonclick:function(){
696 696 if(i3GEO.Interface.ATUAL === "googlemaps"){
697 697 //alert("Pressione a tecla CTRL junto com o botão esquerdo do mouse");
698   - i3GEO.janela.mensagemSimples("Pressione a tecla CTRL junto com o botão esquerdo do mouse e arraste para definir a área de zoom","?");
  698 + i3GEO.janela.tempoMsg("Pressione a tecla CTRL junto com o botão esquerdo do mouse e arraste para definir a área de zoom");
699 699 g_tipoacao='pan';
700 700 g_operacao='navega';
701 701 i3GEO.barraDeBotoes.ativaIcone("pan");
... ...
classesphp/classe_alteraclasse.php
... ... @@ -55,7 +55,7 @@ class Alteraclasse
55 55  
56 56 Objeto layer
57 57 */
58   - protected $layer;
  58 + public $layer;
59 59 /*
60 60 Variavel: $nome
61 61  
... ... @@ -81,8 +81,9 @@ $tema - nome do tema
81 81 $this->mapa = ms_newMapObj($map_file);
82 82 $this->arquivo = $map_file;
83 83 $this->layer = "";
84   - if($tema != "" && @$this->mapa->getlayerbyname($tema))
85   - $this->layer = $this->mapa->getlayerbyname($tema);
  84 + if($tema != "" && @$this->mapa->getlayerbyname($tema)){
  85 + $this->layer = $this->mapa->getlayerbyname($tema);
  86 + }
86 87 $this->nome = $tema;
87 88 if($ext && $ext != ""){
88 89 $e = explode(" ",$ext);
... ...
ferramentas/metaestat/alterarep.js
... ... @@ -70,6 +70,11 @@ i3GEOF.alterarep = {
70 70 {onclick:{fn: function(){i3GEOF.alterarep.circulos("variacor");}}}
71 71 );
72 72 $i("i3geoalterarepCirculos1-button").style.width = 230 + "px";
  73 + new YAHOO.widget.Button(
  74 + "i3geoalterarepCirculos2",
  75 + {onclick:{fn: function(){i3GEOF.alterarep.circulos("continuo");}}}
  76 + );
  77 + $i("i3geoalterarepCirculos2-button").style.width = 230 + "px";
73 78 },
74 79 //utiliza o dicionario compartilhado
75 80 iniciaDicionario: function(){
... ... @@ -118,8 +123,9 @@ i3GEOF.alterarep = {
118 123 var ins = "" +
119 124 ' <fieldset style="padding:5px;margin:2px;">'+
120 125 ' <legend>C&iacute;rculos representando os valores</legend>'+
121   - ' <input id=i3geoalterarepCirculos type="button" value="Mant&ecirc;m as cores e varia o tamanho" /><br><br>'+
122   - ' <input id=i3geoalterarepCirculos1 type="button" value="Mant&ecirc;m as cores" />'+
  126 + ' <input id=i3geoalterarepCirculos type="button" value="Mant&ecirc;m as classes e varia o tamanho" /><br><br>'+
  127 + ' <input id=i3geoalterarepCirculos1 type="button" value="Tamanho &uacute;nico" /><br><br>'+
  128 + ' <input id=i3geoalterarepCirculos2 type="button" value="Tamanho cont&iacute;nuo" />'+
123 129 ' </fieldset><br>';
124 130 return ins;
125 131 },
... ... @@ -132,11 +138,15 @@ i3GEOF.alterarep = {
132 138 var p = i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?g_sid="+i3GEO.configura.sid +
133 139 "&tema="+$i("i3geoCartoAnaliseCamadasCombo").value,
134 140 temp = function(retorno){
135   - i3GEO.janela.fechaAguarde("alterarep1");
136   - var atualiza = function(){
  141 + i3GEO.janela.fechaAguarde("alterarep1");
  142 + if(retorno.data == ""){
  143 + i3GEO.janela.tempoMsg("A camada escolhida n&atilde;o permite essa opera&ccedil;&atilde;o");
  144 + return;
  145 + }
  146 + var atualiza = function(){
137 147 i3GEO.atualiza();
138   - i3GEOF.metaestat.CAMADAS.push(retorno.layer);
139   - i3GEO.mapa.ativaTema(retorno.layer);
  148 + i3GEOF.metaestat.CAMADAS.push(retorno.data);
  149 + //i3GEO.mapa.ativaTema(retorno.data);
140 150 i3GEOF.metaestat.analise.comboCamadas();
141 151 };
142 152 i3GEO.php.adtema(atualiza,retorno.mapfile);
... ... @@ -148,6 +158,9 @@ i3GEOF.alterarep = {
148 158 if(tipo == "variacor"){
149 159 p += "&funcao=classes2circulos1";
150 160 }
  161 + if(tipo == "continuo"){
  162 + p += "&funcao=classes2circulos2";
  163 + }
151 164 i3GEO.util.ajaxGet(p,temp);
152 165 },
153 166 corj: function(obj){
... ...
ferramentas/metaestat/analise.php
... ... @@ -86,6 +86,9 @@ switch (strtoupper($funcao)){
86 86 break;
87 87 case "CLASSES2CIRCULOS1":
88 88 $retorno = classes2circulos($map_file,$tema,"variacor");
  89 + break;
  90 + case "CLASSES2CIRCULOS2":
  91 + $retorno = classes2circulos($map_file,$tema,"continuo");
89 92 break;
90 93 }
91 94 if (!connection_aborted()){
... ... @@ -94,18 +97,26 @@ if (!connection_aborted()){
94 97 else
95 98 {exit();}
96 99 function classes2circulos($map_file,$tema,$tipo){
  100 + $nome = basename($map_file).$tema.$tipo;
97 101 $mapa = ms_newMapObj($map_file);
  102 + $teste = $mapa->getlayerbyname($nome);
  103 + if($teste != ""){
  104 + return "";
  105 + }
98 106 $l = $mapa->getlayerbyname($tema);
  107 + if($l->getmetadata("METAESTAT_DERIVADO") == "sim"){
  108 + return "";
  109 + }
99 110 $layer = ms_newLayerObj($mapa,$l);
100 111 $l->set("status",MS_OFF);
101 112 $layer->set("status",MS_DEFAULT);
102 113 $layer->set("opacity",50);
103   - $nome = $layer->name.nomeRandomico(4);
  114 +
104 115 $layer->set("name",$nome);
  116 + $meta = new Metaestat();
105 117 if($layer->type != MS_LAYER_POINT){
106 118 $layer->set("type",0);
107   - $m = new Metaestat();
108   - $regiao = $m->listaTipoRegiao($layer->getmetadata("METAESTAT_CODIGO_TIPO_REGIAO"));
  119 + $regiao = $meta->listaTipoRegiao($layer->getmetadata("METAESTAT_CODIGO_TIPO_REGIAO"));
109 120 //repare que existe uma virgula apos o nome da coluna com a geometria, isso e necessario para substituir a string correta
110 121 if($regiao["colunacentroide"] != ""){
111 122 $stringgeo = "g.".$regiao["colunageo"].",";
... ... @@ -117,9 +128,14 @@ function classes2circulos($map_file,$tema,$tipo){
117 128 }
118 129 $layer->set("data",$data);
119 130 }
120   - $layer->setmetadata("tema",$layer->getmetadata("tema")." - circ");
121 131 $numclasses = $layer->numclasses;
122 132 if($tipo == "variatamanho" || $tipo == "variacor"){
  133 + if($tipo == "variatamanho"){
  134 + $layer->setmetadata("tema",$layer->getmetadata("tema")." - circ");
  135 + }
  136 + if($tipo == "variacor"){
  137 + $layer->setmetadata("tema",$layer->getmetadata("tema")." - ponto");
  138 + }
123 139 if ($numclasses > 0){
124 140 for ($i=0; $i < $numclasses; ++$i) {
125 141 $classe = $layer->getClass($i);
... ... @@ -134,6 +150,47 @@ function classes2circulos($map_file,$tema,$tipo){
134 150 }
135 151 }
136 152 }
  153 + if($tipo == "continuo"){
  154 + $nometemp = str_replace(basename($map_file),nomeRandomico(5).basename($map_file),$map_file);
  155 + $mapa->save($nometemp);
  156 + //$mapatemp = ms_newMapObj($nometemp);
  157 + $medidavariavel = $meta->listaMedidaVariavel("",$layer->getmetadata("ID_MEDIDA_VARIAVEL"));
  158 + include_once("../../classesphp/classe_alteraclasse.php");
  159 + $m = new Alteraclasse($nometemp,$layer->name,"","");
  160 + $valores = $m->pegaValores($m->mapa,$m->layer,$medidavariavel["colunavalor"],true,0);
  161 + $min = min($valores);
  162 + $max = max($valores);
  163 + $layer->setmetadata("tema",$layer->getmetadata("tema")." - cont");
  164 + $layer->set("type",MS_LAYER_CHART);
  165 + $layer->set("opacity",60);
  166 + $layer->setprocessing("CHART_TYPE=pie");
  167 + $layer->setprocessing("CHART_SIZE_RANGE=".$medidavariavel["colunavalor"]." 10 150 ".$min." ".$max);
  168 + if ($numclasses > 0){
  169 + for ($i=0; $i < $numclasses; ++$i) {
  170 + $classe = $layer->getClass($i);
  171 + $classe->set("status",MS_DELETE);
  172 + }
  173 + }
  174 + $classe = ms_newClassObj($layer);
  175 + $novoestilo = ms_newStyleObj($classe);
  176 + //$novoestilo->set("symbolname","ponto");
  177 + $novoestilo->set("size","6");
  178 + $ncor = $novoestilo->color;
  179 + $ncor->setrgb(247,145,29);
  180 + $ncor = $novoestilo->outlinecolor;
  181 + $ncor->setrgb(255,255,255);
  182 + //$novoestilo->setbinding(MS_STYLE_BINDING_SIZE, $medidavariavel["colunavalor"]);
  183 + //
  184 + $classe = ms_newClassObj($layer);
  185 + $novoestilo = ms_newStyleObj($classe);
  186 + //$novoestilo->set("symbolname","ponto");
  187 + $novoestilo->set("size","6");
  188 + $ncor = $novoestilo->color;
  189 + $ncor->setrgb(247,145,29);
  190 + $ncor = $novoestilo->outlinecolor;
  191 + $ncor->setrgb(255,255,255);;
  192 + }
  193 + $layer->setmetadata("METAESTAT_DERIVADO","sim");
137 194 $mapa->save($map_file);
138 195 return $nome;
139 196 }
... ...