From 1040a35f2e2a5b8bc1b42c5214562ebb8abcd7da Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Wed, 22 Jun 2011 20:37:37 +0000 Subject: [PATCH] --- classesjs/classe_util.js | 4 +++- classesphp/funcoes_gerais.php | 27 ++++++++++++++++++--------- classesphp/graficos.php | 9 ++++++--- ferramentas/graficointerativo/index.js.php | 54 ++++++++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 71 insertions(+), 23 deletions(-) diff --git a/classesjs/classe_util.js b/classesjs/classe_util.js index b574841..412b51a 100644 --- a/classesjs/classe_util.js +++ b/classesjs/classe_util.js @@ -1446,7 +1446,9 @@ i3GEO.util = { {String} */ rgb2hex: function(str) { - var rgb = str.split(","); + var re = new RegExp(" ", "g"), + s = str.replace(re,','), + rgb = s.split(","); function hex(x) { var hexDigits = ["0", "1", "2", "3", "4", "5", "6", "7", "8","9", "A", "B", "C", "D", "E", "F"]; return hexDigits[(x - x % 16) / 16] + hexDigits[x% 16]; diff --git a/classesphp/funcoes_gerais.php b/classesphp/funcoes_gerais.php index 71e54ae..a29253b 100644 --- a/classesphp/funcoes_gerais.php +++ b/classesphp/funcoes_gerais.php @@ -1178,6 +1178,7 @@ function pegaValoresM($mapa,$layer,$itens,$exclui="nulo",$selecionados="nao",$ch $prjTema = $layer->getProjection(); $layer->set("template","none.htm"); $layer->setfilter(""); + $indicesel = array(); //pega os valores dos indices dos elementos selecionados para comparacao posterior if ($selecionados == "sim") @@ -1193,11 +1194,14 @@ function pegaValoresM($mapa,$layer,$itens,$exclui="nulo",$selecionados="nao",$ch $layer->close(); } $valores = array(); + $nclasses = $layer->numclasses; if (@$layer->queryByrect($mapa->extent) == MS_SUCCESS) { + $layer->draw(); $sopen = $layer->open(); if($sopen == MS_FAILURE){return "erro";} $res_count = $layer->getNumresults(); + for ($i=0;$i<$res_count;++$i) { $result = $layer->getResult($i); @@ -1221,16 +1225,21 @@ function pegaValoresM($mapa,$layer,$itens,$exclui="nulo",$selecionados="nao",$ch {$v[] = $shape->values[$item];} else {$v[$item] = $shape->values[$item];} - if($centroide == true){ - $c = $shape->getCentroid(); - if (($prjTema != "") && ($prjMapa != $prjTema)) - { - $projOutObj = ms_newprojectionobj($prjTema); - $projInObj = ms_newprojectionobj($prjMapa); - $c->project($projInObj, $projOutObj); - } - $v["centroide"] = "POINT(".$c->x." ".$c->y.")"; + } + if($centroide == true){ + $c = $shape->getCentroid(); + if (($prjTema != "") && ($prjMapa != $prjTema)) + { + $projOutObj = ms_newprojectionobj($prjTema); + $projInObj = ms_newprojectionobj($prjMapa); + $c->project($projInObj, $projOutObj); } + $v["centroide"] = "POINT(".$c->x." ".$c->y.")"; + } + if($nclasses > 0){ + $classe = $layer->getclass($shape->classindex); + $cor = $classe->getstyle(0)->color; + $v["cores"] = $cor->red." ".$cor->green." ".$cor->blue; } if (count($v) == 1) {$valores[] = $v[0];} diff --git a/classesphp/graficos.php b/classesphp/graficos.php index b41ae53..52e98f3 100644 --- a/classesphp/graficos.php +++ b/classesphp/graficos.php @@ -391,6 +391,9 @@ function iniciaDadosGrafico($map_file,$tema,$exclui,$itemclasses,$itemvalores,$t if ($exclui == ""){$exclui = "nulo";} $valores = pegaValoresM($map,$layer,array($itemclasses,$itemvalores),$exclui,$selecionados); $dados = agrupaValores($valores,0,1,$tipo); + foreach($valores as $valor){ + $cores[$valor[0]] = $valor["cores"]; + } //calcula os parametros para o grafico $nval = count($dados); $max = max($dados); @@ -405,9 +408,9 @@ function iniciaDadosGrafico($map_file,$tema,$exclui,$itemclasses,$itemvalores,$t { $pp = ($dados[$tempm[$i]] * 100) / $soma; if ($percentual == "TRUE") - {$nnval[] = "'".$tempm[$i]." (".round($pp,0)."%)';".$dados[$tempm[$i]];} + {$nnval[] = "'".$tempm[$i]." (".round($pp,0)."%)';".$dados[$tempm[$i]].";".$cores[$tempm[$i]];} else - {$nnval[] = "'".$tempm[$i]."';".$dados[$tempm[$i]];} + {$nnval[] = "'".$tempm[$i]."';".$dados[$tempm[$i]].";".$cores[$tempm[$i]];} } } } @@ -416,7 +419,7 @@ function iniciaDadosGrafico($map_file,$tema,$exclui,$itemclasses,$itemvalores,$t $nnval[] = "x;y"; foreach ($valores as $v) { - $nnval[] = $v[0].";".$v[1]; + $nnval[] = $v[0].";".$v[1].";".$cores[$v[0]]; } } return array("dados"=>$nnval,"ndados"=>$nval,"max"=>$max); diff --git a/ferramentas/graficointerativo/index.js.php b/ferramentas/graficointerativo/index.js.php index 50e0d03..03f7152 100644 --- a/ferramentas/graficointerativo/index.js.php +++ b/ferramentas/graficointerativo/index.js.php @@ -259,11 +259,12 @@ i3GEOF.graficointerativo = { ' ' + '

Excluir o seguinte valor: ' + $inputText("","","i3GEOgraficointerativoexcluir","",3,"") + - '

gera cores aleatórias

' + + '

gera cores aleatórias

' + '

'+ '
'+ '' + '