Commit 1040a35f2e2a5b8bc1b42c5214562ebb8abcd7da

Authored by Edmar Moretti
1 parent 0176ee87

--no commit message

classesjs/classe_util.js
@@ -1446,7 +1446,9 @@ i3GEO.util = { @@ -1446,7 +1446,9 @@ i3GEO.util = {
1446 {String} 1446 {String}
1447 */ 1447 */
1448 rgb2hex: function(str) { 1448 rgb2hex: function(str) {
1449 - var rgb = str.split(","); 1449 + var re = new RegExp(" ", "g"),
  1450 + s = str.replace(re,','),
  1451 + rgb = s.split(",");
1450 function hex(x) { 1452 function hex(x) {
1451 var hexDigits = ["0", "1", "2", "3", "4", "5", "6", "7", "8","9", "A", "B", "C", "D", "E", "F"]; 1453 var hexDigits = ["0", "1", "2", "3", "4", "5", "6", "7", "8","9", "A", "B", "C", "D", "E", "F"];
1452 return hexDigits[(x - x % 16) / 16] + hexDigits[x% 16]; 1454 return hexDigits[(x - x % 16) / 16] + hexDigits[x% 16];
classesphp/funcoes_gerais.php
@@ -1178,6 +1178,7 @@ function pegaValoresM($mapa,$layer,$itens,$exclui="nulo",$selecionados="nao",$ch @@ -1178,6 +1178,7 @@ function pegaValoresM($mapa,$layer,$itens,$exclui="nulo",$selecionados="nao",$ch
1178 $prjTema = $layer->getProjection(); 1178 $prjTema = $layer->getProjection();
1179 $layer->set("template","none.htm"); 1179 $layer->set("template","none.htm");
1180 $layer->setfilter(""); 1180 $layer->setfilter("");
  1181 +
1181 $indicesel = array(); 1182 $indicesel = array();
1182 //pega os valores dos indices dos elementos selecionados para comparacao posterior 1183 //pega os valores dos indices dos elementos selecionados para comparacao posterior
1183 if ($selecionados == "sim") 1184 if ($selecionados == "sim")
@@ -1193,11 +1194,14 @@ function pegaValoresM($mapa,$layer,$itens,$exclui="nulo",$selecionados="nao",$ch @@ -1193,11 +1194,14 @@ function pegaValoresM($mapa,$layer,$itens,$exclui="nulo",$selecionados="nao",$ch
1193 $layer->close(); 1194 $layer->close();
1194 } 1195 }
1195 $valores = array(); 1196 $valores = array();
  1197 + $nclasses = $layer->numclasses;
1196 if (@$layer->queryByrect($mapa->extent) == MS_SUCCESS) 1198 if (@$layer->queryByrect($mapa->extent) == MS_SUCCESS)
1197 { 1199 {
  1200 + $layer->draw();
1198 $sopen = $layer->open(); 1201 $sopen = $layer->open();
1199 if($sopen == MS_FAILURE){return "erro";} 1202 if($sopen == MS_FAILURE){return "erro";}
1200 $res_count = $layer->getNumresults(); 1203 $res_count = $layer->getNumresults();
  1204 +
1201 for ($i=0;$i<$res_count;++$i) 1205 for ($i=0;$i<$res_count;++$i)
1202 { 1206 {
1203 $result = $layer->getResult($i); 1207 $result = $layer->getResult($i);
@@ -1221,16 +1225,21 @@ function pegaValoresM($mapa,$layer,$itens,$exclui=&quot;nulo&quot;,$selecionados=&quot;nao&quot;,$ch @@ -1221,16 +1225,21 @@ function pegaValoresM($mapa,$layer,$itens,$exclui=&quot;nulo&quot;,$selecionados=&quot;nao&quot;,$ch
1221 {$v[] = $shape->values[$item];} 1225 {$v[] = $shape->values[$item];}
1222 else 1226 else
1223 {$v[$item] = $shape->values[$item];} 1227 {$v[$item] = $shape->values[$item];}
1224 - if($centroide == true){  
1225 - $c = $shape->getCentroid();  
1226 - if (($prjTema != "") && ($prjMapa != $prjTema))  
1227 - {  
1228 - $projOutObj = ms_newprojectionobj($prjTema);  
1229 - $projInObj = ms_newprojectionobj($prjMapa);  
1230 - $c->project($projInObj, $projOutObj);  
1231 - }  
1232 - $v["centroide"] = "POINT(".$c->x." ".$c->y.")"; 1228 + }
  1229 + if($centroide == true){
  1230 + $c = $shape->getCentroid();
  1231 + if (($prjTema != "") && ($prjMapa != $prjTema))
  1232 + {
  1233 + $projOutObj = ms_newprojectionobj($prjTema);
  1234 + $projInObj = ms_newprojectionobj($prjMapa);
  1235 + $c->project($projInObj, $projOutObj);
1233 } 1236 }
  1237 + $v["centroide"] = "POINT(".$c->x." ".$c->y.")";
  1238 + }
  1239 + if($nclasses > 0){
  1240 + $classe = $layer->getclass($shape->classindex);
  1241 + $cor = $classe->getstyle(0)->color;
  1242 + $v["cores"] = $cor->red." ".$cor->green." ".$cor->blue;
1234 } 1243 }
1235 if (count($v) == 1) 1244 if (count($v) == 1)
1236 {$valores[] = $v[0];} 1245 {$valores[] = $v[0];}
classesphp/graficos.php
@@ -391,6 +391,9 @@ function iniciaDadosGrafico($map_file,$tema,$exclui,$itemclasses,$itemvalores,$t @@ -391,6 +391,9 @@ function iniciaDadosGrafico($map_file,$tema,$exclui,$itemclasses,$itemvalores,$t
391 if ($exclui == ""){$exclui = "nulo";} 391 if ($exclui == ""){$exclui = "nulo";}
392 $valores = pegaValoresM($map,$layer,array($itemclasses,$itemvalores),$exclui,$selecionados); 392 $valores = pegaValoresM($map,$layer,array($itemclasses,$itemvalores),$exclui,$selecionados);
393 $dados = agrupaValores($valores,0,1,$tipo); 393 $dados = agrupaValores($valores,0,1,$tipo);
  394 + foreach($valores as $valor){
  395 + $cores[$valor[0]] = $valor["cores"];
  396 + }
394 //calcula os parametros para o grafico 397 //calcula os parametros para o grafico
395 $nval = count($dados); 398 $nval = count($dados);
396 $max = max($dados); 399 $max = max($dados);
@@ -405,9 +408,9 @@ function iniciaDadosGrafico($map_file,$tema,$exclui,$itemclasses,$itemvalores,$t @@ -405,9 +408,9 @@ function iniciaDadosGrafico($map_file,$tema,$exclui,$itemclasses,$itemvalores,$t
405 { 408 {
406 $pp = ($dados[$tempm[$i]] * 100) / $soma; 409 $pp = ($dados[$tempm[$i]] * 100) / $soma;
407 if ($percentual == "TRUE") 410 if ($percentual == "TRUE")
408 - {$nnval[] = "'".$tempm[$i]." (".round($pp,0)."%)';".$dados[$tempm[$i]];} 411 + {$nnval[] = "'".$tempm[$i]." (".round($pp,0)."%)';".$dados[$tempm[$i]].";".$cores[$tempm[$i]];}
409 else 412 else
410 - {$nnval[] = "'".$tempm[$i]."';".$dados[$tempm[$i]];} 413 + {$nnval[] = "'".$tempm[$i]."';".$dados[$tempm[$i]].";".$cores[$tempm[$i]];}
411 } 414 }
412 } 415 }
413 } 416 }
@@ -416,7 +419,7 @@ function iniciaDadosGrafico($map_file,$tema,$exclui,$itemclasses,$itemvalores,$t @@ -416,7 +419,7 @@ function iniciaDadosGrafico($map_file,$tema,$exclui,$itemclasses,$itemvalores,$t
416 $nnval[] = "x;y"; 419 $nnval[] = "x;y";
417 foreach ($valores as $v) 420 foreach ($valores as $v)
418 { 421 {
419 - $nnval[] = $v[0].";".$v[1]; 422 + $nnval[] = $v[0].";".$v[1].";".$cores[$v[0]];
420 } 423 }
421 } 424 }
422 return array("dados"=>$nnval,"ndados"=>$nval,"max"=>$max); 425 return array("dados"=>$nnval,"ndados"=>$nval,"max"=>$max);
ferramentas/graficointerativo/index.js.php
@@ -259,11 +259,12 @@ i3GEOF.graficointerativo = { @@ -259,11 +259,12 @@ i3GEOF.graficointerativo = {
259 ' </div>' + 259 ' </div>' +
260 ' <p class=paragrafo >Excluir o seguinte valor: ' + 260 ' <p class=paragrafo >Excluir o seguinte valor: ' +
261 $inputText("","","i3GEOgraficointerativoexcluir","",3,"") + 261 $inputText("","","i3GEOgraficointerativoexcluir","",3,"") +
262 - ' <p class=paragrafo ><input type=checkbox style=cursor:pointer id=i3GEOgraficointerativoCoresA /> gera cores aleatórias</p>' + 262 + ' <p class=paragrafo ><input type=checkbox style="cursor:pointer;top:3px;position:relative;" id=i3GEOgraficointerativoCoresA /> gera cores aleatórias</p>' +
263 ' <p class=paragrafo ><input id=i3GEOgraficointerativobotao1 type="buttom" value="Obter dados" /></p>'+ 263 ' <p class=paragrafo ><input id=i3GEOgraficointerativobotao1 type="buttom" value="Obter dados" /></p>'+
264 ' <div id=i3GEOgraficointerativoDados ></div>'+ 264 ' <div id=i3GEOgraficointerativoDados ></div>'+
265 '</div>' + 265 '</div>' +
266 '<div class=guiaobj id="i3GEOgraficointerativoguia3obj" style="left:1px;display:none;top:-5px">' + 266 '<div class=guiaobj id="i3GEOgraficointerativoguia3obj" style="left:1px;display:none;top:-5px">' +
  267 + ' <p class=paragrafo ><input style=cursor:pointer type=checkbox id=i3GEOgraficointerativoAdLinhas checked /> Adiciona as linhas em gráficos de barras</p>' +
267 ' <p class=paragrafo ><input style=cursor:pointer type=checkbox id=i3GEOgraficointerativoAcumula /> Utiliza valores acumulados</p>' + 268 ' <p class=paragrafo ><input style=cursor:pointer type=checkbox id=i3GEOgraficointerativoAcumula /> Utiliza valores acumulados</p>' +
268 ' <p class=paragrafo ><input style=cursor:pointer type=checkbox id=i3GEOgraficointerativoRelativa /> Utiliza valores relativos (%)</p>' + 269 ' <p class=paragrafo ><input style=cursor:pointer type=checkbox id=i3GEOgraficointerativoRelativa /> Utiliza valores relativos (%)</p>' +
269 ' <p class=paragrafo ><input style=cursor:pointer type=checkbox id=i3GEOgraficointerativoDadosPuros /> Não processa os valores ao obter os dados (mantém os dados como estão na tabela de atributos) - essa opção é útil nos gráficos de distribuição de pontos</p>' + 270 ' <p class=paragrafo ><input style=cursor:pointer type=checkbox id=i3GEOgraficointerativoDadosPuros /> Não processa os valores ao obter os dados (mantém os dados como estão na tabela de atributos) - essa opção é útil nos gráficos de distribuição de pontos</p>' +
@@ -295,7 +296,7 @@ i3GEOF.graficointerativo = { @@ -295,7 +296,7 @@ i3GEOF.graficointerativo = {
295 titulo = "Gráficos interativos <a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=3&idajuda=84' >&nbsp;&nbsp;&nbsp;</a>"; 296 titulo = "Gráficos interativos <a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=3&idajuda=84' >&nbsp;&nbsp;&nbsp;</a>";
296 janela = i3GEO.janela.cria( 297 janela = i3GEO.janela.cria(
297 "380px", 298 "380px",
298 - "240px", 299 + "260px",
299 "", 300 "",
300 "", 301 "",
301 "", 302 "",
@@ -523,7 +524,7 @@ i3GEOF.graficointerativo = { @@ -523,7 +524,7 @@ i3GEOF.graficointerativo = {
523 } 524 }
524 //verifica se no objeto com os dados existe um terceiro valor com as cores 525 //verifica se no objeto com os dados existe um terceiro valor com as cores
525 if(v[2]){ 526 if(v[2]){
526 - cor = v[2]; 527 + cor = i3GEO.util.rgb2hex(v[2]);
527 } 528 }
528 ins.push($inputText("","",id+"_cor","",12,cor,"cor")); 529 ins.push($inputText("","",id+"_cor","",12,cor,"cor"));
529 ins.push("</td><td>"); 530 ins.push("</td><td>");
@@ -549,12 +550,15 @@ i3GEOF.graficointerativo = { @@ -549,12 +550,15 @@ i3GEOF.graficointerativo = {
549 valores = [], 550 valores = [],
550 valoresS = [], 551 valoresS = [],
551 acumulado = [], 552 acumulado = [],
  553 + acum,
552 nomes = [], 554 nomes = [],
553 cores = [], 555 cores = [],
554 indice = $i("i3GEOgraficointerativoComboTemasId").options.selectedIndex, 556 indice = $i("i3GEOgraficointerativoComboTemasId").options.selectedIndex,
555 titulo = $i("i3GEOgraficointerativoComboTemasId").options[indice].text, 557 titulo = $i("i3GEOgraficointerativoComboTemasId").options[indice].text,
556 par = [], 558 par = [],
  559 + parcor = [],
557 soma = 0, 560 soma = 0,
  561 + total = 0,
558 menor = inputs[1].value * 1, 562 menor = inputs[1].value * 1,
559 maior = 0, 563 maior = 0,
560 menorNome = inputs[0].value * 1, 564 menorNome = inputs[0].value * 1,
@@ -573,7 +577,7 @@ i3GEOF.graficointerativo = { @@ -573,7 +577,7 @@ i3GEOF.graficointerativo = {
573 legendaX = "", 577 legendaX = "",
574 legendaY = "", 578 legendaY = "",
575 fill = "#C4B86A", 579 fill = "#C4B86A",
576 - pointSize = 2; 580 + pointSize = 4;
577 if(i3GEOF.graficointerativo.titulo != "") 581 if(i3GEOF.graficointerativo.titulo != "")
578 {titulo = i3GEOF.graficointerativo.titulo} 582 {titulo = i3GEOF.graficointerativo.titulo}
579 if($i("i3GEOgraficointerativoComboXid")) 583 if($i("i3GEOgraficointerativoComboXid"))
@@ -581,12 +585,17 @@ i3GEOF.graficointerativo = { @@ -581,12 +585,17 @@ i3GEOF.graficointerativo = {
581 if($i("i3GEOgraficointerativoComboYid")) 585 if($i("i3GEOgraficointerativoComboYid"))
582 {legendaY = $i("i3GEOgraficointerativoComboYid").value;} 586 {legendaY = $i("i3GEOgraficointerativoComboYid").value;}
583 for(i=0;i<ninputs;i = i + 3){ 587 for(i=0;i<ninputs;i = i + 3){
  588 + temp = inputs[i+1].value * 1;
  589 + total += temp;
  590 + }
  591 + for(i=0;i<ninputs;i = i + 3){
584 nomes.push(inputs[i].value+" "); 592 nomes.push(inputs[i].value+" ");
585 cores.push(inputs[i+2].value); 593 cores.push(inputs[i+2].value);
586 temp = inputs[i+1].value * 1; 594 temp = inputs[i+1].value * 1;
587 valores.push(temp); 595 valores.push(temp);
588 valoresS.push(temp+" "); 596 valoresS.push(temp+" ");
589 - acumulado.push(ultimo + temp); 597 + acum = ultimo + temp;
  598 + acumulado.push(acum);
590 ultimo = ultimo + temp; 599 ultimo = ultimo + temp;
591 soma += temp; 600 soma += temp;
592 if(temp > maior) 601 if(temp > maior)
@@ -599,6 +608,13 @@ i3GEOF.graficointerativo = { @@ -599,6 +608,13 @@ i3GEOF.graficointerativo = {
599 if(temp < menorNome) 608 if(temp < menorNome)
600 {menorNome = temp;} 609 {menorNome = temp;}
601 par.push({"value":inputs[i+1].value * 1,"label":inputs[i].value+" "}); 610 par.push({"value":inputs[i+1].value * 1,"label":inputs[i].value+" "});
  611 +
  612 + temp = inputs[i+1].value * 1;
  613 + if($i("i3GEOgraficointerativoAcumula").checked)
  614 + {temp = acum;}
  615 + if($i("i3GEOgraficointerativoRelativa").checked)
  616 + {temp = (temp * 100) / total;}
  617 + parcor.push({"colour":inputs[i+2].value,"value":temp,"label":inputs[i].value+" "});
602 } 618 }
603 if($i("i3GEOgraficointerativoAcumula").checked){ 619 if($i("i3GEOgraficointerativoAcumula").checked){
604 valores = acumulado; 620 valores = acumulado;
@@ -637,8 +653,12 @@ i3GEOF.graficointerativo = { @@ -637,8 +653,12 @@ i3GEOF.graficointerativo = {
637 }; 653 };
638 } 654 }
639 if(i3GEOF.graficointerativo.tipo === "line" || i3GEOF.graficointerativo.tipo === "scatter" || i3GEOF.graficointerativo.tipo === "hbar" || i3GEOF.graficointerativo.tipo === "area" || i3GEOF.graficointerativo.tipo === "bar_round" || i3GEOF.graficointerativo.tipo === "bar_round_glass" || i3GEOF.graficointerativo.tipo === "bar_filled" || i3GEOF.graficointerativo.tipo === "bar_glass" || i3GEOF.graficointerativo.tipo === "bar_3d" || i3GEOF.graficointerativo.tipo === "bar_sketch" || i3GEOF.graficointerativo.tipo === "bar_cylinder" || i3GEOF.graficointerativo.tipo === "bar_cylinder_outline"){ 655 if(i3GEOF.graficointerativo.tipo === "line" || i3GEOF.graficointerativo.tipo === "scatter" || i3GEOF.graficointerativo.tipo === "hbar" || i3GEOF.graficointerativo.tipo === "area" || i3GEOF.graficointerativo.tipo === "bar_round" || i3GEOF.graficointerativo.tipo === "bar_round_glass" || i3GEOF.graficointerativo.tipo === "bar_filled" || i3GEOF.graficointerativo.tipo === "bar_glass" || i3GEOF.graficointerativo.tipo === "bar_3d" || i3GEOF.graficointerativo.tipo === "bar_sketch" || i3GEOF.graficointerativo.tipo === "bar_cylinder" || i3GEOF.graficointerativo.tipo === "bar_cylinder_outline"){
  656 + temp = valores;
  657 + if(i3GEOF.graficointerativo.tipo === "line" || i3GEOF.graficointerativo.tipo === "scatter" || i3GEOF.graficointerativo.tipo === "area")
  658 + {temp = parcor;}
640 parametros = { 659 parametros = {
641 - "elements":[{ 660 + "elements":[
  661 + {
642 "type": i3GEOF.graficointerativo.tipo, 662 "type": i3GEOF.graficointerativo.tipo,
643 "start-angle": 180, 663 "start-angle": 180,
644 "colour": corunica, 664 "colour": corunica,
@@ -646,13 +666,14 @@ i3GEOF.graficointerativo = { @@ -646,13 +666,14 @@ i3GEOF.graficointerativo = {
646 "alpha": alpha, 666 "alpha": alpha,
647 "stroke": stroke, 667 "stroke": stroke,
648 "animate": 1, 668 "animate": 1,
649 - "values" : valores, 669 + "values" : temp,
650 "tip": "#val#", 670 "tip": "#val#",
651 "gradient-fill": gradient, 671 "gradient-fill": gradient,
652 "fill": fill, 672 "fill": fill,
653 "fill-alpha": alpha, 673 "fill-alpha": alpha,
654 - "dot-style": { "type": "anchor", "colour": "#9C0E57", "dot-size": pointSize }  
655 - }], 674 + "dot-style": { "type": "solid-dot", "colour": "#9C0E57", "dot-size": pointSize }
  675 + }
  676 + ],
656 "x_axis": { 677 "x_axis": {
657 "colour": "#A2ACBA", 678 "colour": "#A2ACBA",
658 "grid-colour": corGrid, 679 "grid-colour": corGrid,
@@ -683,6 +704,19 @@ i3GEOF.graficointerativo = { @@ -683,6 +704,19 @@ i3GEOF.graficointerativo = {
683 "style": "{font-size: "+tituloSize+"; color:"+tituloCor+"; text-align: "+tituloAlinhamento+";}" 704 "style": "{font-size: "+tituloSize+"; color:"+tituloCor+"; text-align: "+tituloAlinhamento+";}"
684 } 705 }
685 }; 706 };
  707 + if($i("i3GEOgraficointerativoAdLinhas").checked){
  708 + parametros.elements.push({
  709 + "type": "line",
  710 + "colour": "#FFFFFF",
  711 + "start-angle": 180,
  712 + "alpha": 0,
  713 + "stroke": 0,
  714 + "width": 0,
  715 + "animate": 1,
  716 + "values" : parcor,
  717 + "dot-style": { "type": "solid-dot", "colour": "#9C0E57", "dot-size": pointSize }
  718 + });
  719 + }
686 if(i3GEOF.graficointerativo.tipo === "hbar"){ 720 if(i3GEOF.graficointerativo.tipo === "hbar"){
687 n = valores.length; 721 n = valores.length;
688 temp = []; 722 temp = [];
@@ -733,7 +767,7 @@ i3GEOF.graficointerativo = { @@ -733,7 +767,7 @@ i3GEOF.graficointerativo = {
733 "fill": "#45909F", 767 "fill": "#45909F",
734 "fill-alpha": 0.4, 768 "fill-alpha": 0.4,
735 "loop": true, 769 "loop": true,
736 - "values": valores 770 + "values": parcor
737 }], 771 }],
738 "radar_axis": { 772 "radar_axis": {
739 "max": maior, 773 "max": maior,