From a21dbcef7f37b741ac9269472c34b76a615741a1 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Tue, 7 Aug 2012 15:47:35 +0000 Subject: [PATCH] Inclusão de opções de geração de kml no sistema de metadados estatísticos --- .project | 17 ++++------------- admin/admin.db | Bin 122880 -> 0 bytes admin/js/estat_tipo_regiao.js | 10 ++++++---- admin/js/estat_variavel.js | 39 ++++++++++++++++++++++++++++++++------- admin/php/classe_metaestat.php | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------- admin/php/conexaomma.php | 2 +- admin/php/metaestat.php | 27 ++++++++++++++++++++++++--- admin/sql/metaestat.sql | 78 +++++++++++++++++++++++++++++++++++++++++++++++------------------------------- admin/sql/metaestat_basededados.sql | 14 ++++++++++++-- aplicmap/geral1debianv6.map | 12 ++++++------ documentacao/diagramas/metaestat.erm | 2272 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- pacotes/kmlmapserver/classes/layerserver.class.php | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------- pacotes/tme/TME_i3geo.php | 10 ++++------ pacotes/tme/TME_i3geo_DataConnector.php | 12 ++++++------ 14 files changed, 1849 insertions(+), 852 deletions(-) diff --git a/.project b/.project index b866515..0465c3a 100644 --- a/.project +++ b/.project @@ -27,16 +27,7 @@ - 1342548175463 - - 26 - - org.eclipse.ui.ide.multiFilter - 1.0-name-matches-false-false-pacotes - - - - 1342548175466 + 1344291026531 14 @@ -45,7 +36,7 @@ - 1342548175468 + 1344291026539 26 @@ -54,7 +45,7 @@ - 1342548175470 + 1344291026546 30 @@ -63,7 +54,7 @@ - 1342548175494 + 1344291026548 22 diff --git a/admin/admin.db b/admin/admin.db index 8b669de..ef2c138 100644 Binary files a/admin/admin.db and b/admin/admin.db differ diff --git a/admin/js/estat_tipo_regiao.js b/admin/js/estat_tipo_regiao.js index 8c30f79..6423b8c 100755 --- a/admin/js/estat_tipo_regiao.js +++ b/admin/js/estat_tipo_regiao.js @@ -30,7 +30,8 @@ function montaTabela(dados){ {label:"Descrição",resizeable:true,key:"descricao_tipo_regiao", formatter:formatTexto}, {label:"Esquema",key:"esquemadb",formatter:formatTexto}, {label:"Tabela",key:"tabela",formatter:formatTexto}, - {label:"Coluna",key:"colunageo",formatter:formatTexto}, + {label:"Coluna geo",key:"colunageo",formatter:formatTexto}, + {label:"Centróide",key:"colunacentroide",formatter:formatTexto}, {label:"Data",key:"data",formatter:formatTexto}, {label:"Código",key:"identificador",formatter:formatTexto}, {label:"Coluna com os nomes de cada região",key:"colunanomeregiao",formatter:formatTexto}, @@ -41,7 +42,7 @@ function montaTabela(dados){ myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY; myDataSource.responseSchema = { - fields: ["codigo_tipo_regiao","nome_tipo_regiao","descricao_tipo_regiao","esquemadb","tabela","colunageo","data","identificador","colunanomeregiao","srid"] + fields: ["codigo_tipo_regiao","nome_tipo_regiao","descricao_tipo_regiao","esquemadb","tabela","colunageo","colunacentroide","data","identificador","colunanomeregiao","srid"] }; myDataTable.subscribe( 'cellClickEvent', @@ -119,7 +120,8 @@ function montaDiv(i){ {titulo:"Descrição:",id:"Edescricao_tipo_regiao",size:"50",value:i.descricao_tipo_regiao,tipo:"text",div:""}, {titulo:"Esquema no banco de dados:",id:"Eesquemadb",size:"50",value:i.esquemadb,tipo:"text",div:""}, {titulo:"Tabela:",id:"Etabela",size:"50",value:i.tabela,tipo:"text",div:""}, - {titulo:"Coluna com a geometria:",id:"Ecolunageo",size:"50",value:i.colunageo,tipo:"text",div:""}, + {titulo:"Coluna com a geometria principal (normalmente poligonal):",id:"Ecolunageo",size:"50",value:i.colunageo,tipo:"text",div:""}, + {titulo:"Coluna com pontos (pode ser a mesmo que a anterior):",id:"Ecolunacentroide",size:"50",value:i.colunacentroide,tipo:"text",div:""}, {titulo:"Data a qual se referem os dados:",id:"Edata",size:"50",value:i.data,tipo:"text",div:""}, {titulo:"Coluna com o código de cada registro:",id:"Eidentificador",size:"50",value:i.identificador,tipo:"text",div:""}, {titulo:"Coluna com o nome da região:",id:"Ecolunanomeregiao",size:"50",value:i.colunanomeregiao,tipo:"text",div:""}, @@ -133,7 +135,7 @@ function montaDiv(i){ } function gravaDados(id,recordid){ - var campos = new Array("nome_tipo_regiao","descricao_tipo_regiao","esquemadb","tabela","colunageo","data","identificador","colunanomeregiao","srid"), + var campos = new Array("nome_tipo_regiao","descricao_tipo_regiao","esquemadb","tabela","colunageo","colunacentroide","data","identificador","colunanomeregiao","srid"), par = "", i = 0, sUrl,callback; diff --git a/admin/js/estat_variavel.js b/admin/js/estat_variavel.js index 386e7d1..3deadbc 100755 --- a/admin/js/estat_variavel.js +++ b/admin/js/estat_variavel.js @@ -300,7 +300,7 @@ function adicionaNosClassificacao(no,dados,redesenha){ conteudo = " "; conteudo += " "; if(dados[i].nomedimensao != "") - {conteudo += " "+dados[i].nome+" id: "+dados[i].id_classificacao+"";} + {conteudo += " "+dados[i].nome+" Obs.: "+dados[i].nome+" id: "+dados[i].id_classificacao+"";} else {conteudo += " Edite para definir a nova classificação!!!";} d = {html:conteudo,id_classificacao:dados[i].id_classificacao,tipo:"classificacao"}; @@ -442,7 +442,8 @@ function montaDivClassificacaoMedida(i){ var ins = "", param = { "linhas":[ - {titulo:"Nome:",id:"Enome",size:"50",value:i.nome,tipo:"text",div:""} + {titulo:"Nome:",id:"Enome",size:"50",value:i.nome,tipo:"text",div:""}, + {titulo:"Observação:",id:"Eobservacao",size:"50",value:i.observacao,tipo:"text",div:""} ] }; ins += core_geraLinhas(param); @@ -455,9 +456,15 @@ function montaDivClasseClassificacao(i){ "linhas":[ {titulo:"Título:",id:"Etitulo",size:"50",value:i.titulo,tipo:"text",div:""}, {titulo:"Expressão (no estilo Mapserver)
exemplo (([nu_farm_funcionando] > 0) and ([nu_farm_funcionando] < 5)):",id:"Eexpressao",size:"50",value:i.expressao,tipo:"text",div:""}, + {titulo:"Símbolo:",id:"Esimbolo",size:"10",value:i.simbolo,tipo:"text",div:""}, + {titulo:"Tamanho do símbolo:",id:"Etamanho",size:"10",value:i.tamanho,tipo:"text",div:""}, {titulo:"Vermelho:",id:"Evermelho",size:"10",value:i.vermelho,tipo:"text",div:""}, {titulo:"Verde:",id:"Everde",size:"10",value:i.verde,tipo:"text",div:""}, - {titulo:"Azul:",id:"Eazul",size:"10",value:i.azul,tipo:"text",div:""} + {titulo:"Azul:",id:"Eazul",size:"10",value:i.azul,tipo:"text",div:""}, + {titulo:"Contorno - tamanho do símbolo:",id:"Eotamanho",size:"10",value:i.otamanho,tipo:"text",div:""}, + {titulo:"Contorno - Vermelho:",id:"Eovermelho",size:"10",value:i.overmelho,tipo:"text",div:""}, + {titulo:"Contorno - Verde:",id:"Eoverde",size:"10",value:i.overde,tipo:"text",div:""}, + {titulo:"Contorno - Azul:",id:"Eoazul",size:"10",value:i.oazul,tipo:"text",div:""} ] }; ins += core_geraLinhas(param); @@ -645,7 +652,9 @@ function sql(tipo,id) { ins += ' '; ins += ' '; ins += ' '; - ins += ' '; + ins += '

'; + ins += ' '; + ins += ' '; $i("editor_bd").innerHTML = ins; new YAHOO.widget.Button("sqljson"); @@ -668,6 +677,22 @@ function sql(tipo,id) { } window.open('../php/metaestat.php?funcao=mapfileMedidaVariavel&formato=json&id_medida_variavel='+id+"&filtro="+$i("filtrosql").value+"&todasascolunas="+colunas+"&tipolayer="+$i("tipolayer").value+"&id_classificacao="+$i("classificacao").value+"&agruparpor="+$i("agruparsql").value); }; + new YAHOO.widget.Button("kmzestat"); + $i("kmzestat-button").onclick = function(){ + var colunas = 0; + if($i("incluirtodascolunas").checked === true){ + colunas = 1; + } + window.open('../php/metaestat.php?funcao=kmlmedidavariavel&id_medida_variavel='+id+"&filtro="+$i("filtrosql").value+"&todasascolunas="+colunas+"&tipolayer="+$i("tipolayer").value+"&id_classificacao="+$i("classificacao").value+"&agruparpor="+$i("agruparsql").value+"&formato=kmz"); + }; + new YAHOO.widget.Button("kmlestat"); + $i("kmlestat-button").onclick = function(){ + var colunas = 0; + if($i("incluirtodascolunas").checked === true){ + colunas = 1; + } + window.open('../php/metaestat.php?funcao=kmlmedidavariavel&id_medida_variavel='+id+"&filtro="+$i("filtrosql").value+"&todasascolunas="+colunas+"&tipolayer="+$i("tipolayer").value+"&id_classificacao="+$i("classificacao").value+"&agruparpor="+$i("agruparsql").value+"&formato=kml"); + }; new YAHOO.widget.Button("i3geoestat"); $i("i3geoestat-button").onclick = function(){ var sUrl,callback = { @@ -847,12 +872,12 @@ function gravaDados(tipo,id){ prog = "../php/metaestat.php?funcao=alteraDimensaoMedida"; } if(tipo == "classificacaoMedida"){ - campos = new Array("nome"); + campos = new Array("nome","observacao"); par = "&id_classificacao="+id; prog = "../php/metaestat.php?funcao=alteraClassificacaoMedida"; } if(tipo == "classeClassificacao"){ - campos = new Array("titulo","expressao","azul","verde","vermelho"); + campos = new Array("titulo","expressao","azul","verde","vermelho","tamanho","simbolo","otamanho","overde","oazul","overmelho"); par = "&id_classe="+id; prog = "../php/metaestat.php?funcao=alteraClasseClassificacao"; } @@ -889,7 +914,7 @@ function gravaDados(tipo,id){ } if(tipo == "classificacaoMedida"){ no = tree.getNodeByProperty("id_classificacao",id); - no.getContentEl().getElementsByTagName("span")[0].innerHTML = ""+document.getElementById("Enome").value+" id: "+id+""; + no.getContentEl().getElementsByTagName("span")[0].innerHTML = ""+document.getElementById("Enome").value+" Obs.: "+document.getElementById("Eobservacao").value+" id: "+id+""; no.getContentEl().getElementsByTagName("span")[0].style.color = ""; no.html = no.getContentEl().innerHTML; } diff --git a/admin/php/classe_metaestat.php b/admin/php/classe_metaestat.php index 2f42ffa..0e007c0 100755 --- a/admin/php/classe_metaestat.php +++ b/admin/php/classe_metaestat.php @@ -52,6 +52,7 @@ class Metaestat{ //vem do include $this->dir_tmp = $dir_tmp; $this->locaplic = $locaplic; + $this->base = $base; if(!isset($convUTF)){ $convUTF = true; } @@ -202,20 +203,27 @@ class Metaestat{ $todasascolunas - opcional */ - function sqlMedidaVariavel($id_medida_variavel,$todasascolunas,$agruparpor=""){ + function sqlMedidaVariavel($id_medida_variavel,$todasascolunas,$agruparpor="",$tipolayer="polygon"){ $filtro = false; $dados = $this->listaMedidaVariavel("",$id_medida_variavel); $dadosgeo = $this->listaTipoRegiao($dados["codigo_tipo_regiao"]); + if($tipolayer != "point"){ + $colunageo = $dadosgeo["colunageo"]; + } + else{ + $colunageo = $dadosgeo["colunacentroide"]; + } + if($todasascolunas == 0){ $sql = " SELECT d.".$dados["colunavalor"].",d.".$dados["colunaidgeo"]; if(!empty($agruparpor)){ $sql .= ",d.".$agruparpor; } - $sqlgeo = $sql.",g.".$dadosgeo["colunageo"]; + $sqlgeo = $sql.",g.".$colunageo; } else{ $sql = " SELECT d.* "; - $sqlgeo = $sql.",g.".$dadosgeo["colunageo"]; + $sqlgeo = $sql.",g.".$colunageo; } if(empty($agruparpor)){ $sql .= " FROM ".$dados["esquemadb"].".".$dados["tabela"]." as d "; @@ -239,7 +247,7 @@ class Metaestat{ $sqlgeo .= " WHERE ".$j; } //atencao: cuidado ao alterar essa string pois ') as foo' pode ser usado para replace em outras funcoes - $sqlgeo = $dadosgeo["colunageo"]." from ($sqlgeo) as foo using unique ".$dados["colunaidgeo"]." using srid=".$dadosgeo["srid"]; + $sqlgeo = $colunageo." from ($sqlgeo) as foo using unique ".$dados["colunaidgeo"]." using srid=".$dadosgeo["srid"]; $colunas = $this->colunasTabela($dados["codigo_estat_conexao"],$dados["esquemadb"],$dados["tabela"]); return array("sql"=>$sql,"sqlmapserver"=>$sqlgeo,"filtro"=>$filtro,"colunas"=>$colunas); } @@ -255,7 +263,7 @@ class Metaestat{ $conexao = $this->listaConexao($meta["codigo_estat_conexao"],true); $conexao = "user=".$conexao["usuario"]." password=".$conexao["senha"]." dbname=".$conexao["bancodedados"]." host=".$conexao["host"]." port=".$conexao["porta"].""; //echo $conexao;exit; - $sql = $this->sqlMedidaVariavel($id_medida_variavel,$todasascolunas,$agruparpor); + $sql = $this->sqlMedidaVariavel($id_medida_variavel,$todasascolunas,$agruparpor,$tipolayer); $sqlf = $sql["sqlmapserver"]; if(!empty($filtro)){ $sqlf = str_replace(") as foo"," AND ".$filtro." ) as foo",$sqlf); @@ -290,11 +298,24 @@ class Metaestat{ } else{ foreach($classes as $classe){ + //var_dump($classe);exit; $dados[] = ' CLASS'; $dados[] = ' NAME "'.mb_convert_encoding($classe["titulo"],"ISO-8859-1",mb_detect_encoding($titulolayer)).'"'; $dados[] = ' EXPRESSION '.$classe["expressao"]; $dados[] = ' STYLE'; $dados[] = ' COLOR '.$classe["vermelho"].' '.$classe["verde"].' '.$classe["azul"]; + if(!empty($classe["tamanho"])){ + $dados[] = ' SIZE '.$classe["tamanho"]; + } + if(!empty($classe["simbolo"])){ + $dados[] = ' SYMBOL '.$classe["simbolo"]; + } + if(!empty($classe["otamanho"])){ + $dados[] = ' OUTLINEWIDTH '.$classe["otamanho"]; + } + if(!empty($classe["overmelho"]) || $classe["overmelho"] == "0"){ + $dados[] = ' OUTLINECOLOR '.$classe["overmelho"].' '.$classe["overde"].' '.$classe["oazul"]; + } $dados[] = ' END'; $dados[] = ' END'; } @@ -307,6 +328,50 @@ class Metaestat{ } return array("mapfile"=>$arq,"layer"=>$rand,"titulolayer"=>$titulolayer); } + function mapfileCompleto($mapfile){ + $f = $this->base; + if($f == ""){ + include_once($this->locaplic."/classesphp/funcoes_gerais.php"); + $versao = versao(); + $versao = $versao["principal"]; + $f = ""; + if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')){ + $f = $locaplic."/aplicmap/geral1windowsv".$versao.".map"; + } + else{ + if($f == "" && file_exists('/var/www/i3geo/aplicmap/geral1debianv'.$versao.'.map')){ + $f = "/var/www/i3geo/aplicmap/geral1debianv".$versao.".map"; + } + if($f == "" && file_exists('/var/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){ + $f = "/var/www/html/i3geo/aplicmap/geral1fedorav".$versao.".map"; + } + if($f == "" && file_exists('/opt/www/html/i3geo/aplicmap/geral1fedorav'.$versao.'.map')){ + $f = "/opt/www/html/i3geo/aplicmap/geral1v".$versao.".map"; + } + if($f == "") { + $f = $this->locaplic."/aplicmap/geral1v".$versao.".map"; + } + } + } + $mapa = ms_newMapObj($f); + $n = $mapa->numlayers; + for($i=0;$i<$n;$i++){ + $l = $mapa->getlayer($i); + $l->set("status",MS_DELETE); + } + $mapatemp = ms_newMapObj($mapfile); + $l = $mapatemp->getlayer(0); + + $l->set("status",MS_DEFAULT); + $novonome = str_replace(".map","completo.map",$mapfile); + //necessario para o kml + $mapa->setmetadata("ows_enable_request","*"); + $listaepsg = "EPSG:4618 EPSG:4291 EPSG:4326 EPSG:22521 EPSG:22522 EPSG:22523 EPSG:22524 EPSG:22525 EPSG:29101 EPSG:29119 EPSG:29120 EPSG:29121 EPSG:29122 EPSG:29177 EPSG:29178 EPSG:29179 EPSG:29180 EPSG:29181 EPSG:29182 EPSG:29183 EPSG:29184 EPSG:29185"; + $l->setmetadata("ows_srs",$listaepsg); + $temp = ms_newLayerObj($mapa,$l); + $mapa->save($novonome); + return $novonome; + } function dadosMedidaVariavel($id_medida_variavel,$filtro="",$todasascolunas = 0,$agruparpor = ""){ $sql = $this->sqlMedidaVariavel($id_medida_variavel,$todasascolunas,$agruparpor); $sqlf = $sql["sql"]; @@ -332,10 +397,12 @@ class Metaestat{ return false; } function sumarioMedidaVariavel($id_medida_variavel,$filtro="",$agruparpor=""){ - $dados = $this->dadosMedidaVariavel($id_medida_variavel,$filtro,0); if(!empty($agruparpor)){ $dados = $this->dadosMedidaVariavel($id_medida_variavel,$filtro,1); } + else{ + $dados = $this->dadosMedidaVariavel($id_medida_variavel,$filtro,0); + } if($dados){ $metaVariavel = $this->listaMedidaVariavel("",$id_medida_variavel); $un = $this->listaUnidadeMedida($metaVariavel["codigo_unidade_medida"]); @@ -513,14 +580,14 @@ class Metaestat{ Altera uma regiao */ - function alteraTipoRegiao($codigo_tipo_regiao,$nome_tipo_regiao,$descricao_tipo_regiao,$esquemadb,$tabela,$colunageo,$data,$identificador,$colunanomeregiao,$srid){ + function alteraTipoRegiao($codigo_tipo_regiao,$nome_tipo_regiao,$descricao_tipo_regiao,$esquemadb,$tabela,$colunageo,$colunacentroide,$data,$identificador,$colunanomeregiao,$srid){ try { if($codigo_tipo_regiao != ""){ if($this->convUTF){ $nome_tipo_regiao = utf8_encode($nome_tipo_regiao); $descricao_tipo_regiao = utf8_encode($descricao_tipo_regiao); } - $this->dbhw->query("UPDATE ".$this->esquemaadmin."i3geoestat_tipo_regiao SET nome_tipo_regiao = '$nome_tipo_regiao',descricao_tipo_regiao = '$descricao_tipo_regiao',esquemadb = '$esquemadb',tabela = '$tabela',colunageo = '$colunageo',data = '$data',identificador = '$identificador',colunanomeregiao = '$colunanomeregiao', srid = '$srid' WHERE codigo_tipo_regiao = $codigo_tipo_regiao"); + $this->dbhw->query("UPDATE ".$this->esquemaadmin."i3geoestat_tipo_regiao SET colunacentroide = '$colunacentroide',nome_tipo_regiao = '$nome_tipo_regiao',descricao_tipo_regiao = '$descricao_tipo_regiao',esquemadb = '$esquemadb',tabela = '$tabela',colunageo = '$colunageo',data = '$data',identificador = '$identificador',colunanomeregiao = '$colunanomeregiao', srid = '$srid' WHERE codigo_tipo_regiao = $codigo_tipo_regiao"); $retorna = $codigo_tipo_regiao; } else{ @@ -565,13 +632,14 @@ class Metaestat{ Altera uma dimensao de uma medida ou cria uma nova */ - function alteraClassificacaoMedida($id_medida_variavel,$id_classificacao="",$nome){ + function alteraClassificacaoMedida($id_medida_variavel,$id_classificacao="",$nome="",$observacao=""){ try { if($id_classificacao != ""){ if($this->convUTF){ $nome = utf8_encode($nome); + $observacao = utf8_encode($observacao); } - $this->dbhw->query("UPDATE ".$this->esquemaadmin."i3geoestat_classificacao SET nome = '$nome' WHERE id_classificacao = $id_classificacao"); + $this->dbhw->query("UPDATE ".$this->esquemaadmin."i3geoestat_classificacao SET observacao = '$observacao',nome = '$nome' WHERE id_classificacao = $id_classificacao"); $retorna = $id_dimensao_medida; } else{ @@ -591,14 +659,14 @@ class Metaestat{ Altera uma classe de uma classificacao */ - function alteraClasseClassificacao($id_classificacao,$id_classe="",$titulo="",$expressao="",$vermelho="",$verde="",$azul=""){ + function alteraClasseClassificacao($id_classificacao,$id_classe="",$titulo="",$expressao="",$vermelho="",$verde="",$azul="",$tamanho="",$simbolo="",$overmelho="",$overde="",$oazul="",$otamanho=""){ try { if($id_classe != ""){ if($this->convUTF){ - $nome = utf8_encode($nome); + $titulo = utf8_encode($titulo); } //echo "UPDATE ".$this->esquemaadmin."i3geoestat_classe SET azul = '$azul', verde = '$verde', vermelho = '$vermelho',expressao = '$expressao', titulo = '$titulo' WHERE id_classe = $id_classe";exit; - $this->dbhw->query("UPDATE ".$this->esquemaadmin."i3geoestat_classes SET azul = '$azul', verde = '$verde', vermelho = '$vermelho',expressao = '$expressao', titulo = '$titulo' WHERE id_classe = $id_classe"); + $this->dbhw->query("UPDATE ".$this->esquemaadmin."i3geoestat_classes SET tamanho='$tamanho',simbolo='$simbolo',overmelho='$overmelho',overde='$overde',oazul='$oazul',otamanho='$otamanho',azul = '$azul', verde = '$verde', vermelho = '$vermelho',expressao = '$expressao', titulo = '$titulo' WHERE id_classe = $id_classe"); $retorna = $id_classe; } else{ diff --git a/admin/php/conexaomma.php b/admin/php/conexaomma.php index 56f7018..9231609 100644 --- a/admin/php/conexaomma.php +++ b/admin/php/conexaomma.php @@ -36,7 +36,7 @@ Arquivo: i3geo/admin/php/conexaomma.php try { $dbh = new PDO('pgsql:dbname=geodados;user=geodados;password=geodados;host=pgsql1.mma.gov.br'); - $dbhw = new PDO('pgsql:dbname=geodados;user=pgsql;password=pgsql;host=pgsql1.mma.gov.br'); + $dbhw = new PDO(''); } catch (PDOException $e) { diff --git a/admin/php/metaestat.php b/admin/php/metaestat.php index 478924b..f7f0266 100644 --- a/admin/php/metaestat.php +++ b/admin/php/metaestat.php @@ -263,7 +263,7 @@ switch (strtoupper($funcao)) $id_classificacao = $m->alteraClassificacaoMedida($id_medida_variavel); } else{ - $m->alteraClassificacaoMedida("",$id_classificacao,$nome); + $m->alteraClassificacaoMedida("",$id_classificacao,$nome,$observacao); } retornaJSON($m->listaClassificacaoMedida($id_medida_variavel,$id_classificacao)); exit; @@ -283,7 +283,7 @@ switch (strtoupper($funcao)) $id_classe = $m->alteraClasseClassificacao($id_classificacao); } else{ - $m->alteraClasseClassificacao("",$id_classe,$titulo,$expressao,$vermelho,$verde,$azul); + $m->alteraClasseClassificacao("",$id_classe,$titulo,$expressao,$vermelho,$verde,$azul,$tamanho,$simbolo,$overmelho,$overde,$oazul,$otamanho); } retornaJSON($m->listaClasseClassificacao($id_classificacao,$id_classe)); exit; @@ -343,7 +343,7 @@ switch (strtoupper($funcao)) $codigo_tipo_regiao = $m->alteraTipoRegiao(); } else{ - $codigo_tipo_regiao = $m->alteraTipoRegiao($codigo_tipo_regiao,$nome_tipo_regiao,$descricao_tipo_regiao,$esquemadb,$tabela,$colunageo,$data,$identificador,$colunanomeregiao,$srid); + $codigo_tipo_regiao = $m->alteraTipoRegiao($codigo_tipo_regiao,$nome_tipo_regiao,$descricao_tipo_regiao,$esquemadb,$tabela,$colunageo,$colunacentroide,$data,$identificador,$colunanomeregiao,$srid); } retornaJSON($m->listaTipoRegiao($codigo_tipo_regiao)); exit; @@ -654,6 +654,27 @@ switch (strtoupper($funcao)) exit; break; /* + Valor: KMLMEDIDAVARIAVEL + + Gera um arquivo kml que pode ser aberto no googleearth + + */ + case "KMLMEDIDAVARIAVEL": + $m = new Metaestat(); + $r = $m->mapfileMedidaVariavel($id_medida_variavel,$filtro,$todasascolunas,$tipolayer,$titulolayer,$id_classificacao,$agruparpor); + //cria um mapfile completo, que inclui a camada no mapfile de inicializacao do i3geo + $mapfile = $m->mapfileCompleto($r["mapfile"]); + //define as variaveis necessarias ao pacote kmlserver + set_time_limit(0); + $_REQUEST["map"] = $mapfile; + $_REQUEST["typename"] = $r["layer"]; + $_REQUEST["request"] = $formato; + //$_REQUEST["service"] = "icon"; + include (__DIR__."/../../pacotes/kmlmapserver/classes/kmlserver.class.php"); + $server = new KmlServer(); + exit; + break; + /* Valor: SUMARIOMEDIDAVARIAVEL Sumario estatistico media de uma variavel diff --git a/admin/sql/metaestat.sql b/admin/sql/metaestat.sql index 7eebfc0..7d3fa80 100644 --- a/admin/sql/metaestat.sql +++ b/admin/sql/metaestat.sql @@ -16,10 +16,10 @@ drop table i3geoestat_variavel; /* create tables */ --- lista controlada de tipos de período de tempo -create table i3geoestat_tipo_periodo +-- tabela com o nome e descrição de uma variável variável +create table i3geoestat_variavel ( - codigo_tipo_periodo integer not null unique primary key autoincrement, + codigo_variavel integer not null unique primary key autoincrement, nome text, descricao text ); @@ -42,6 +42,27 @@ create table i3geoestat_conexao ); +create table i3geoestat_unidade_medida +( + codigo_unidade_medida integer not null unique primary key autoincrement, + nome text, + sigla text, + -- o tipo de unidade permite que os valores sejam somados? (0 ou 1) + permitesoma integer default 0, + -- o tipo de unidade permite o cálculo de média aritmética? (0 ou 1) + permitemedia integer default 0 +); + + +-- lista controlada de tipos de período de tempo +create table i3geoestat_tipo_periodo +( + codigo_tipo_periodo integer not null unique primary key autoincrement, + nome text, + descricao text +); + + -- identifica as tabelas que possuem colunas com geometrias de determinado local ou região create table i3geoestat_tipo_regiao ( @@ -63,32 +84,13 @@ create table i3geoestat_tipo_regiao colunanomeregiao text, -- código srid correspondente à projeção cartográfica da coluna com a geometria srid text default '4326', + -- coluna que contém um ponto que representa cada local. pode ser o mesmo que colunageo + colunacentroide text, foreign key (codigo_estat_conexao) references i3geoestat_conexao (codigo_estat_conexao) ); --- tabela com o nome e descrição de uma variável variável -create table i3geoestat_variavel -( - codigo_variavel integer not null unique primary key autoincrement, - nome text, - descricao text -); - - -create table i3geoestat_unidade_medida -( - codigo_unidade_medida integer not null unique primary key autoincrement, - nome text, - sigla text, - -- o tipo de unidade permite que os valores sejam somados? (0 ou 1) - permitesoma integer default 0, - -- o tipo de unidade permite o cálculo de média aritmética? (0 ou 1) - permitemedia integer default 0 -); - - -- descreve as colunas que contém valores de algum tipo de medida, por exemplo população residente create table i3geoestat_medida_variavel ( @@ -110,16 +112,16 @@ create table i3geoestat_medida_variavel filtro text, -- titulo da medida nomemedida text, - foreign key (codigo_tipo_periodo) - references i3geoestat_tipo_periodo (codigo_tipo_periodo), - foreign key (codigo_tipo_regiao) - references i3geoestat_tipo_regiao (codigo_tipo_regiao), - foreign key (codigo_estat_conexao) - references i3geoestat_conexao (codigo_estat_conexao), foreign key (codigo_variavel) references i3geoestat_variavel (codigo_variavel), + foreign key (codigo_estat_conexao) + references i3geoestat_conexao (codigo_estat_conexao), foreign key (codigo_unidade_medida) - references i3geoestat_unidade_medida (codigo_unidade_medida) + references i3geoestat_unidade_medida (codigo_unidade_medida), + foreign key (codigo_tipo_periodo) + references i3geoestat_tipo_periodo (codigo_tipo_periodo), + foreign key (codigo_tipo_regiao) + references i3geoestat_tipo_regiao (codigo_tipo_regiao) ); @@ -129,6 +131,8 @@ create table i3geoestat_classificacao id_classificacao integer not null unique primary key autoincrement, nome text, id_medida_variavel integer, + -- observacao sobre a classificação + observacao text, foreign key (id_medida_variavel) references i3geoestat_medida_variavel (id_medida_variavel) ); @@ -149,6 +153,18 @@ create table i3geoestat_classes -- componente b da cor utilizada para representar a classe azul text, id_classificacao integer, + -- tamanho do símbolo (item size do mapfile) + tamanho text, + -- symbol name + simbolo text, + -- componente vermelho da cor do outline + overmelho text, + -- componente verde da cor do outline + overde text, + -- componente azul da cor do outline + oazul text, + -- largura da linha do outline + otamanho text, foreign key (id_classificacao) references i3geoestat_classificacao (id_classificacao) ); diff --git a/admin/sql/metaestat_basededados.sql b/admin/sql/metaestat_basededados.sql index 9831478..08e75af 100644 --- a/admin/sql/metaestat_basededados.sql +++ b/admin/sql/metaestat_basededados.sql @@ -8,11 +8,11 @@ INSERT INTO i3geoestat_tipo_periodo (codigo_tipo_periodo, nome, descricao) VALUE -- i3geoestat_tipo_regiao -INSERT INTO i3geoestat_tipo_regiao (codigo_tipo_regiao, nome_tipo_regiao, descricao_tipo_regiao, codigo_estat_conexao, esquemadb, tabela, colunageo, data, identificador, colunanomeregiao, srid) VALUES ('1', 'Município', 'Limites municipais', '1', 'public', 'tb_ibge', 'the_geom', '', 'ibge', 'no_cidade', '4326'); +INSERT INTO i3geoestat_tipo_regiao (codigo_tipo_regiao, nome_tipo_regiao, descricao_tipo_regiao, codigo_estat_conexao, esquemadb, tabela, colunageo, data, identificador, colunanomeregiao, srid, colunacentroide) VALUES ('1', 'Município', 'Limites municipais', '1', 'public', 'tb_ibge', 'the_geom', '', 'ibge', 'no_cidade', '4326', 'the_geom2'); -- i3geoestat_unidade_medida -INSERT INTO i3geoestat_unidade_medida (codigo_unidade_medida, nome, sigla, permitesoma, permitemedia) VALUES ('1', 'Unidade', 'Un', '', ''); +INSERT INTO i3geoestat_unidade_medida (codigo_unidade_medida, nome, sigla, permitesoma, permitemedia) VALUES ('1', 'Unidade', 'Un', '1', '1'); -- i3geoestat_medida_variavel @@ -28,3 +28,13 @@ INSERT INTO i3geoestat_dimensao_medida (id_dimensao_medida, coluna, nomedimensao INSERT INTO i3geoestat_variavel (codigo_variavel, nome, descricao) VALUES ('1', 'Farmácias populares existentes', 'Quantidade de farmácias populares existentes'); +-- i3geoestat_classificacao +INSERT INTO i3geoestat_classificacao (id_classificacao, nome, id_medida_variavel, observacao) VALUES ('1', 'Pela média', '1', ''); + + +-- i3geoestat_classes +INSERT INTO i3geoestat_classes (id_classe, expressao, titulo, vermelho, verde, azul, id_classificacao, tamanho, simbolo, overmelho, overde, oazul, otamanho) VALUES ('1', '([nu_farm_funcionando] < 1)', 'Nenhuma', '255', '0', '0', '1', '', '', '0', '0', '0', ''); +INSERT INTO i3geoestat_classes (id_classe, expressao, titulo, vermelho, verde, azul, id_classificacao, tamanho, simbolo, overmelho, overde, oazul, otamanho) VALUES ('2', '([nu_farm_funcionando] = 1)', 'Uma', '0', '255', '0', '1', '', '', '', '', '', ''); +INSERT INTO i3geoestat_classes (id_classe, expressao, titulo, vermelho, verde, azul, id_classificacao, tamanho, simbolo, overmelho, overde, oazul, otamanho) VALUES ('3', '([nu_farm_funcionando] > 1)', 'Mais de uma', '0', '0', '255', '1', '', '', '', '', '', ''); + + diff --git a/aplicmap/geral1debianv6.map b/aplicmap/geral1debianv6.map index bd84933..1298cb0 100644 --- a/aplicmap/geral1debianv6.map +++ b/aplicmap/geral1debianv6.map @@ -48,7 +48,7 @@ MAP FORMATOPTION "QUANTIZE_COLORS=256" FORMATOPTION "INTERLACE=OFF" END - + #OUTPUTFORMAT # NAME svg # MIMETYPE "image/svg+xml" @@ -56,7 +56,7 @@ MAP ##FORMATOPTION "COMPRESSED_OUTPUT=TRUE" ##FORMATOPTION "FULL_RESOLUTION=TRUE" #END - + OUTPUTFORMAT NAME jpeg DRIVER "AGG/JPEG" @@ -75,7 +75,7 @@ MAP TRANSPARENT FALSE FORMATOPTION "INTERLACE=OFF" END - + OUTPUTFORMAT NAME png2 MIMETYPE image/png @@ -85,7 +85,7 @@ MAP TRANSPARENT TRUE FORMATOPTION "INTERLACE=OFF" END - + PROJECTION "+proj=longlat +ellps=GRS67 +no_defs" @@ -121,7 +121,7 @@ MAP REFERENCE COLOR -1 -1 -1 EXTENT -75.5728 -37.4751 -30.525 7.57273 - #-79.8713331401 -41.7736536401 -26.2264448599 11.8712346401 + #-79.8713331401 -41.7736536401 -26.2264448599 11.8712346401 #edite o caminho se a aplicacao for movida de lugar IMAGE "/var/www/i3geo/imagens/referencia1.png" OUTLINECOLOR -1 -1 -1 @@ -249,7 +249,7 @@ MAP # END # CLASS #END # LAYER - + LAYER METADATA #"TEMA" "NAO" diff --git a/documentacao/diagramas/metaestat.erm b/documentacao/diagramas/metaestat.erm index fd89c25..0c52dc0 100644 --- a/documentacao/diagramas/metaestat.erm +++ b/documentacao/diagramas/metaestat.erm @@ -11,8 +11,8 @@ 0 1.0 - 0 - -2 + -343 + 3 230 230 @@ -110,7 +110,7 @@ false 2012-07-17 15:03:53 - 2012-08-02 11:58:33 + 2012-08-07 00:45:40 Project Name @@ -268,13 +268,26 @@ null false + Coluna que contém um ponto que representa cada local. Pode ser o mesmo que colunageo + colunacentroide + colunacentroide + text + + + 10 + null + null + false + null + false + Coluna com a geometria da região colunageo colunageo text - 10 + 11 null null false @@ -287,7 +300,7 @@ text - 11 + 12 null null false @@ -300,7 +313,7 @@ text - 12 + 13 null null false @@ -313,7 +326,7 @@ text - 13 + 14 null null false @@ -326,7 +339,7 @@ text - 14 + 15 null null false @@ -339,7 +352,7 @@ text - 15 + 16 null null false @@ -352,7 +365,7 @@ text - 16 + 17 null null false @@ -365,7 +378,7 @@ text - 17 + 18 null null false @@ -378,7 +391,7 @@ text - 18 + 19 null null false @@ -391,7 +404,7 @@ text - 19 + 20 null null false @@ -404,7 +417,7 @@ text - 20 + 21 null null false @@ -417,7 +430,7 @@ text - 21 + 22 null null false @@ -430,7 +443,7 @@ text - 22 + 23 null null false @@ -443,7 +456,7 @@ text - 23 + 24 null null false @@ -456,7 +469,7 @@ integer - 24 + 25 null null false @@ -469,7 +482,7 @@ integer - 25 + 26 null null false @@ -482,7 +495,7 @@ integer - 26 + 27 null null false @@ -495,7 +508,7 @@ integer - 27 + 28 null null false @@ -508,7 +521,7 @@ integer - 28 + 29 null null false @@ -521,7 +534,7 @@ text - 29 + 30 null null false @@ -534,7 +547,7 @@ text - 30 + 31 null null false @@ -547,7 +560,7 @@ text - 31 + 32 null null false @@ -560,7 +573,7 @@ text - 32 + 33 null null false @@ -573,7 +586,7 @@ text - 33 + 34 null null false @@ -586,7 +599,7 @@ text - 34 + 35 null null false @@ -599,7 +612,72 @@ text - 35 + 36 + null + null + false + null + false + + Componente azul da cor do outline + oazul + oazul + text + + + 37 + null + null + false + null + false + + Observacao sobre a classificação + observacao + observacao + text + + + 38 + null + null + false + null + false + + Largura da linha do outline + otamanho + otamanho + text + + + 39 + null + null + false + null + false + + Componente verde da cor do outline + overde + overde + text + + + 40 + null + null + false + null + false + + Componente vermelho da cor do outline + overmelho + overmelho + text + + + 41 null null false @@ -612,7 +690,7 @@ integer - 36 + 42 null null false @@ -625,7 +703,7 @@ integer - 37 + 43 null null false @@ -638,7 +716,7 @@ text - 38 + 44 null null false @@ -651,7 +729,7 @@ text - 39 + 45 null null false @@ -664,7 +742,20 @@ text - 40 + 46 + null + null + false + null + false + + Symbol name + simbolo + simbolo + text + + + 47 null null false @@ -677,7 +768,7 @@ text - 41 + 48 null null false @@ -690,7 +781,7 @@ text - 42 + 49 null null false @@ -703,7 +794,20 @@ text - 43 + 50 + null + null + false + null + false + + Tamanho do símbolo (item size do mapfile) + tamanho + tamanho + text + + + 51 null null false @@ -716,7 +820,7 @@ text - 44 + 52 null null false @@ -729,7 +833,7 @@ text - 45 + 53 null null false @@ -742,7 +846,7 @@ text - 46 + 54 null null false @@ -896,7 +1000,7 @@ - 39 + 45 2 @@ -928,7 +1032,7 @@ - 36 + 42 3 @@ -960,7 +1064,7 @@ - 35 + 41 4 @@ -1002,50 +1106,28 @@ 4 - 275 - 292 + 107 + 280Ubuntu9 - -336 - 236 + 1 + 188 255 165 0 - - 0 - 0 - 4 - - - 1 - 6 - 4 - 1..n - 1 - true - - RESTRICT - RESTRICT - -1 - -1 - -1 - -1 - null - null - - i3geoestat_tipo_regiao - i3geoestat_tipo_regiao - Identifica as tabelas que possuem colunas com geometrias de determinado local ou região + i3geoestat_tipo_periodo + i3geoestat_tipo_periodo + Lista controlada de tipos de período de tempo - 5 + 4 5 @@ -1077,7 +1159,7 @@ - 34 + 32 6 @@ -1109,7 +1191,7 @@ - 17 + 16 7 @@ -1140,10 +1222,40 @@ 0 + + + + + + + + +
+ + 5 + 107 + 250 + Ubuntu + 9 + 373 + -2 + + 160 + 32 + 240 + + + + i3geoestat_variavel + i3geoestat_variavel + Tabela com o nome e descrição de uma variável variável + + + + + 7 8 - 19 - 1 @@ -1151,11 +1263,11 @@ integer - false - true - false - false - false + true + false + true + true + true @@ -1174,7 +1286,7 @@ - 19 + 30 9 @@ -1206,7 +1318,7 @@ - 42 + 17 10 @@ -1237,23 +1349,139 @@ 0 - - 9 - 11 - - - - - text - - - false - false - false - false - false - - + + + + + + + + +
+ + 6 + 339 + 292 + Ubuntu + 9 + 353 + 155 + + 160 + 32 + 240 + + + + 0 + 5 + 6 + 1..n + 1 + true + + RESTRICT + RESTRICT + -1 + -1 + -1 + -1 + null + null + + + 1 + 12 + 6 + 1..n + 1 + true + + RESTRICT + RESTRICT + -1 + -1 + -1 + -1 + null + null + + + 2 + 3 + 6 + 1..n + 1 + true + + RESTRICT + RESTRICT + -1 + -1 + -1 + -1 + null + null + + + 3 + 4 + 6 + 1..n + 1 + true + + RESTRICT + RESTRICT + -1 + -1 + -1 + -1 + null + null + + + 4 + 11 + 6 + 1..n + 1 + true + + RESTRICT + RESTRICT + -1 + -1 + -1 + -1 + null + null + + + i3geoestat_medida_variavel + i3geoestat_medida_variavel + Descreve as colunas que contém valores de algum tipo de medida, por exemplo população residente + + + + + + 28 + 11 + + + + + integer + + + true + false + true + true + true + + @@ -1270,17 +1498,18 @@ - 13 12 + 0 + 2 - text + integer false - false + true false false false @@ -1302,8 +1531,9 @@ - 23 13 + 5 + 3 @@ -1312,7 +1542,7 @@ false - false + true false false false @@ -1334,17 +1564,18 @@ - 11 14 + 8 + 0 - text + integer false - false + true false false false @@ -1366,17 +1597,18 @@ - 40 15 + 46 + 4 - text + integer - 4326 + false - false + true false false false @@ -1397,40 +1629,10 @@ 0 - - - - - - - - -
- - 5 - 107 - 280 - Ubuntu - 9 - 1 - 188 - - 255 - 165 - 0 - - - - i3geoestat_tipo_periodo - i3geoestat_tipo_periodo - Lista controlada de tipos de período de tempo - - - - - 4 16 + 58 + 1 @@ -1438,11 +1640,11 @@ integer - true - false - true - true - true + false + true + false + false + false @@ -1461,7 +1663,7 @@ - 28 + 19 17 @@ -1493,7 +1695,7 @@ - 16 + 48 18 @@ -1524,52 +1726,21 @@ 0 - - - - - - - - -
- - 6 - 170 - 292 - Ubuntu - 9 - 7 - 453 - - 255 - 165 - 0 - - - - i3geoestat_conexao - i3geoestat_conexao - Lista controlada dos parâmetros de conexão com o banco de dados onde residem dados - - - - - 3 + 13 19 - integer + text - true + false false - true - true - true + false + false + false @@ -1588,7 +1759,7 @@ - 2 + 11 20 @@ -1652,7 +1823,7 @@ - 37 + 34 22 @@ -1683,70 +1854,6 @@ 0 - - 44 - 23 - - - - - text - - - false - false - false - false - false - - - - - - - - - - - false - false - - - 0 - - - - 38 - 24 - - - - - text - - - false - false - false - false - false - - - - - - - - - - - false - false - - - 0 - - @@ -1758,29 +1865,51 @@
7 - 107 - 250 + 170 + 292Ubuntu9 - 373 - -2 + 387 + 533 160 32 240 + + 5 + 6 + 7 + 1..n + 1 + true + + RESTRICT + RESTRICT + -1 + -1 + -1 + -1 + null + null + + + 6 + 8 + 7 + - i3geoestat_variavel - i3geoestat_variavel - Tabela com o nome e descrição de uma variável variável + i3geoestat_dimensao_medida + i3geoestat_dimensao_medida + - 7 - 25 + 27 + 23 @@ -1811,8 +1940,8 @@ - 30 - 26 + 8 + 24 @@ -1843,8 +1972,8 @@ - 15 - 27 + 33 + 25 @@ -1874,137 +2003,21 @@ 0 - - - - - - - - -
- - 8 - 339 - 292 - Ubuntu - 9 - 353 - 155 - - 160 - 32 - 240 - - - - 2 - 5 - 8 - 1..n - 1 - true - - RESTRICT - RESTRICT - -1 - -1 - -1 - -1 - null - null - - - 3 - 4 - 8 - 1..n - 1 - true - - RESTRICT - RESTRICT - -1 - -1 - -1 - -1 - null - null - - - 4 - 6 - 8 - 1..n - 1 - true - - RESTRICT - RESTRICT - -1 - -1 - -1 - -1 - null - null - - - 5 - 7 - 8 - 1..n - 1 - true - - RESTRICT - RESTRICT - -1 - -1 - -1 - -1 - null - null - - - 6 - 3 - 8 - 1..n - 1 - true - - RESTRICT - RESTRICT - -1 - -1 - -1 - -1 - null - null - - - i3geoestat_medida_variavel - i3geoestat_medida_variavel - Descreve as colunas que contém valores de algum tipo de medida, por exemplo população residente - - - - - 27 - 28 + 15 + 26 - integer + text - true + false false - true - true - true + false + false + false @@ -2023,18 +2036,17 @@ - 29 - 0 - 6 + 0 + 27 integer - + 0 false - true + false false false false @@ -2056,9 +2068,9 @@ - 30 - 16 - 2 + 28 + 11 + 5 @@ -2088,29 +2100,93 @@ 0 - - 31 - 25 - 5 - - - - - integer - - - false - true - false - false - false - - - - - - - + + + + + + + + +
+ + 8 + 111 + 188 + Ubuntu + 9 + 748 + 594 + + 255 + 255 + 255 + + + + As colunas obtidas da junção de medida_variavel com tipo_regiao podem ser utilizadas para definir uma dimensão + + + 9 + 107 + 247 + Ubuntu + 9 + 719 + 68 + + 230 + 230 + 250 + + + + 7 + 6 + 9 + 1..n + 1 + true + + RESTRICT + RESTRICT + -1 + -1 + -1 + -1 + null + null + + + i3geoestat_classificacao + i3geoestat_classificacao + Lista de classificacoes de uma medida de variável + + + + + + 26 + 29 + + + + + integer + + + true + false + true + true + true + + + + + + + @@ -2122,18 +2198,17 @@ - 32 - 5 - 3 + 31 + 30 - integer + text false - true + false false false false @@ -2155,9 +2230,9 @@ - 33 - 19 - 4 + 31 + 11 + 7 @@ -2188,8 +2263,8 @@ - 18 - 34 + 37 + 32 @@ -2219,21 +2294,69 @@ 0 + + + + + + + + +
+ + 10 + 317 + 210 + Ubuntu + 9 + 799 + 246 + + 230 + 230 + 250 + + + + 8 + 9 + 10 + 1..n + 1 + true + + RESTRICT + RESTRICT + -1 + -1 + -1 + -1 + null + null + + + i3geoestat_classes + i3geoestat_classes + Classes pertencentes a uma classificação + + + + - 41 - 35 + 25 + 33 - text + integer - false + true false - false - false - false + true + true + true @@ -2252,8 +2375,8 @@ - 12 - 36 + 21 + 34 @@ -2284,8 +2407,8 @@ - 10 - 37 + 51 + 35 @@ -2316,8 +2439,8 @@ - 21 - 38 + 54 + 36 @@ -2348,8 +2471,8 @@ - 33 - 39 + 53 + 37 @@ -2379,74 +2502,21 @@ 0 - - - - - - - - -
- - 9 - 170 - 292 - Ubuntu - 9 - 387 - 533 - - 160 - 32 - 240 - - - - 7 - 10 - 9 - - - 8 - 8 - 9 - 1..n - 1 - true - - RESTRICT - RESTRICT - -1 - -1 - -1 - -1 - null - null - - - i3geoestat_dimensao_medida - i3geoestat_dimensao_medida - - - - - - 26 - 40 + 1 + 38 - integer + text - true + false false - true - true - true + false + false + false @@ -2465,17 +2535,18 @@ - 8 - 41 + 39 + 29 + 8 - text + integer false - false + true false false false @@ -2497,8 +2568,8 @@ - 32 - 42 + 50 + 40 @@ -2529,8 +2600,8 @@ - 14 - 43 + 46 + 41 @@ -2561,15 +2632,79 @@ - 0 - 44 + 40 + 42 - integer + text - 0 + + false + false + false + false + false + + + + + + + + + + + false + false + + + 0 + + + + 39 + 43 + + + + + text + + + false + false + false + false + false + + + + + + + + + + + false + false + + + 0 + + + + 36 + 44 + + + + + text + + false false false @@ -2593,18 +2728,17 @@ + 38 45 - 28 - 8 - integer + text false - true + false false false false @@ -2634,40 +2768,23 @@
- - 10 - 111 - 188 - Ubuntu - 9 - 748 - 594 - - 255 - 255 - 255 - - - - As colunas obtidas da junção de medida_variavel com tipo_regiao podem ser utilizadas para definir uma dimensão - 11 - 75 - 120 + 275 + 292Ubuntu9 - 746 - 144 + -336 + 236 - 230 - 230 - 250 + 255 + 165 + 0 9 - 8 + 12 11 1..n 1 @@ -2682,16 +2799,21 @@ null null + + 10 + 0 + 11 + - i3geoestat_classificacao - i3geoestat_classificacao - Lista de classificacoes de uma medida de variável + i3geoestat_tipo_regiao + i3geoestat_tipo_regiao + Identifica as tabelas que possuem colunas com geometrias de determinado local ou região - 25 + 5 46 @@ -2723,7 +2845,7 @@ - 31 + 35 47 @@ -2755,18 +2877,17 @@ + 18 48 - 28 - 9 - integer + text false - true + false false false false @@ -2787,57 +2908,10 @@ 0 - - - - - - - - -
- - 12 - 75 - 120 - Ubuntu - 9 - 771 - 314 - - 230 - 230 - 250 - - - - 10 - 11 - 12 - 1..n - 1 - true - - RESTRICT - RESTRICT - -1 - -1 - -1 - -1 - null - null - - - i3geoestat_classes - i3geoestat_classes - Classes pertencentes a uma classificação - - - - - 24 49 + 58 + 9 @@ -2845,11 +2919,11 @@ integer - true - false - true - true - true + false + true + false + false + false @@ -2900,7 +2974,7 @@ - 43 + 49 51 @@ -2932,7 +3006,7 @@ - 46 + 10 52 @@ -2964,7 +3038,7 @@ - 45 + 14 53 @@ -2996,13 +3070,13 @@ - 1 + 24 54 - text + integer false @@ -3028,18 +3102,304 @@ + 12 55 - 46 - 10 - integer + text false - true + false + false + false + false + + + + + + + + + + + false + false + + + 0 + + + + 47 + 56 + + + + + text + + 4326 + false + false + false + false + false + + + + + + + + + + + false + false + + + 0 + + + + 9 + 57 + + + + + text + + + false + false + false + false + false + + + + + + + + + + + false + false + + + 0 + + + + + + + + + + +
+ + 12 + 170 + 292 + Ubuntu + 9 + 8 + 499 + + 255 + 165 + 0 + + + + i3geoestat_conexao + i3geoestat_conexao + Lista controlada dos parâmetros de conexão com o banco de dados onde residem dados + + + + + + 3 + 58 + + + + + integer + + + true + false + true + true + true + + + + + + + + + + + false + false + + + 0 + + + + 2 + 59 + + + + + text + + + false + false + false + false + false + + + + + + + + + + + false + false + + + 0 + + + + 23 + 60 + + + + + text + + + false + false + false + false + false + + + + + + + + + + + false + false + + + 0 + + + + 43 + 61 + + + + + text + + + false + false + false + false + false + + + + + + + + + + + false + false + + + 0 + + + + 52 + 62 + + + + + text + + + false + false + false + false + false + + + + + + + + + + + false + false + + + 0 + + + + 44 + 63 + + + + + text + + + false + false false false false @@ -3077,31 +3437,31 @@ metaestat_basededados 0 - 6 + 12 - 19 + 58 1 - 20 + 59 dbspo - 21 + 60 localhost - 22 + 61 5432 - 23 + 62 postgres - 24 + 63 postgres @@ -3110,7 +3470,7 @@ 0 - 19 + 58 Format 1 @@ -3125,7 +3485,7 @@ - 20 + 59 Format 1 @@ -3140,7 +3500,7 @@ - 21 + 60 Format 1 @@ -3155,7 +3515,7 @@ - 22 + 61 Format 1 @@ -3170,7 +3530,7 @@ - 23 + 62 Format 1 @@ -3185,7 +3545,7 @@ - 24 + 63 Format 1 @@ -3203,33 +3563,33 @@ - 5 + 4 - 16 + 5 1 - 17 + 6 Anual - 18 + 7 - 16 + 5 2 - 17 + 6 Mensal - 18 + 7 @@ -3238,7 +3598,7 @@ 0 - 16 + 5 Format 1 @@ -3253,7 +3613,7 @@ - 17 + 6 Format 1 @@ -3268,7 +3628,7 @@ - 18 + 7 Format 1 @@ -3286,60 +3646,64 @@ - 4 + 11 - 5 + 46 1 - 6 + 47 Município - 7 + 48 Limites municipais - 8 + 49 1 - 9 + 50 public - 10 + 51 tb_ibge - 11 + 52 the_geom - 12 + 53 - 13 + 54 ibge - 14 + 55 no_cidade - 15 + 56 4326 + + 57 + the_geom2 + 0 - 5 + 46 Format 1 @@ -3354,7 +3718,7 @@ - 6 + 47 Format 1 @@ -3369,7 +3733,7 @@ - 7 + 48 Format 1 @@ -3384,7 +3748,7 @@ - 8 + 49 Foreign Key 1 @@ -3399,7 +3763,7 @@ - 9 + 50 Format 1 @@ -3414,7 +3778,7 @@ - 10 + 51 Format 1 @@ -3429,7 +3793,7 @@ - 11 + 52 Format 1 @@ -3444,7 +3808,7 @@ - 12 + 53 Format 1 @@ -3459,7 +3823,7 @@ - 13 + 54 Format 1 @@ -3474,7 +3838,7 @@ - 14 + 55 Format 1 @@ -3489,7 +3853,7 @@ - 15 + 56 Format 1 @@ -3503,6 +3867,21 @@ + + 57 + Format + 1 + + 1 + 100 + 1 + + + + + + + @@ -3524,11 +3903,11 @@ 3 - + 1 4 - + 1 @@ -3614,55 +3993,55 @@ - 8 + 6 - 28 + 11 1 - 29 + 12 1 - 30 + 13 2 - 31 + 14 1 - 32 + 15 1 - 33 + 16 1 - 34 + 17 dbacoes_saude - 35 + 18 tb_farmacia_pop - 36 + 19 nu_farm_funcionando - 37 + 20 co_ibge - 38 + 21 - 39 + 22 Número de farmácias em funcionamento por mês e ano @@ -3671,7 +4050,7 @@ 0 - 28 + 11 Format 1 @@ -3686,7 +4065,7 @@ - 29 + 12 Foreign Key 1 @@ -3701,7 +4080,7 @@ - 30 + 13 Foreign Key 1 @@ -3716,7 +4095,7 @@ - 31 + 14 Foreign Key 1 @@ -3731,7 +4110,7 @@ - 32 + 15 Foreign Key 1 @@ -3746,7 +4125,7 @@ - 33 + 16 Foreign Key 1 @@ -3761,7 +4140,7 @@ - 34 + 17 Format 1 @@ -3776,7 +4155,7 @@ - 35 + 18 Format 1 @@ -3791,7 +4170,7 @@ - 36 + 19 Format 1 @@ -3806,7 +4185,7 @@ - 37 + 20 Format 1 @@ -3821,7 +4200,7 @@ - 38 + 21 Format 1 @@ -3836,7 +4215,7 @@ - 39 + 22 Format 1 @@ -3854,57 +4233,57 @@ - 9 + 7 - 40 + 23 1 - 41 + 24 to_date(mes_farm_pop||' '||ano_farm,'MM YYYY') as mes - 42 + 25 mês e ano - 43 + 26 - 44 + 27 0 - 45 + 28 1 - 40 + 23 2 - 41 + 24 ano_farm - 42 + 25 ano - 43 + 26 - 44 + 27 1 - 45 + 28 1 @@ -3913,7 +4292,7 @@ 0 - 40 + 23 Format 1 @@ -3928,7 +4307,7 @@ - 41 + 24 Format 1 @@ -3943,7 +4322,7 @@ - 42 + 25 Format 1 @@ -3958,7 +4337,7 @@ - 43 + 26 Format 1 @@ -3973,7 +4352,7 @@ - 44 + 27 Format 1 @@ -3988,7 +4367,7 @@ - 45 + 28 Foreign Key 1 @@ -4006,19 +4385,19 @@ - 7 + 5 - 25 + 8 1 - 26 + 9 Farmácias populares existentes - 27 + 10 Quantidade de farmácias populares existentes @@ -4027,7 +4406,7 @@ 0 - 25 + 8 Format 1 @@ -4042,7 +4421,7 @@ - 26 + 9 Format 1 @@ -4057,7 +4436,7 @@ - 27 + 10 Format 1 @@ -4074,6 +4453,461 @@ + + 9 + + + + 29 + 1 + + + 30 + Pela média + + + 31 + 1 + + + 32 + + + + + + 0 + + + 29 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + 30 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + 31 + Foreign Key + 1 + + 1 + 100 + 1 + + + + + + + + + 32 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + + + + 10 + + + + 33 + 1 + + + 34 + ([nu_farm_funcionando] < 1) + + + 35 + Nenhuma + + + 36 + 255 + + + 37 + 0 + + + 38 + 0 + + + 39 + 1 + + + 40 + + + + 41 + + + + 42 + 0 + + + 43 + 0 + + + 44 + 0 + + + 45 + + + + + + 33 + 2 + + + 34 + ([nu_farm_funcionando] = 1) + + + 35 + Uma + + + 36 + 0 + + + 37 + 255 + + + 38 + 0 + + + 39 + 1 + + + 40 + + + + 41 + + + + 42 + + + + 43 + + + + 44 + + + + 45 + + + + + + 33 + 3 + + + 34 + ([nu_farm_funcionando] > 1) + + + 35 + Mais de uma + + + 36 + 0 + + + 37 + 0 + + + 38 + 255 + + + 39 + 1 + + + 40 + + + + 41 + + + + 42 + + + + 43 + + + + 44 + + + + 45 + + + + + + 0 + + + 33 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + 34 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + 35 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + 36 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + 37 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + 38 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + 39 + Foreign Key + 1 + + 1 + 100 + 1 + + + + + + + + + 40 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + 41 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + 42 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + 43 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + 44 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + 45 + Format + 1 + + 1 + 100 + 1 + + + + + + + + + + diff --git a/pacotes/kmlmapserver/classes/layerserver.class.php b/pacotes/kmlmapserver/classes/layerserver.class.php index 5ad391d..a4e43ce 100644 --- a/pacotes/kmlmapserver/classes/layerserver.class.php +++ b/pacotes/kmlmapserver/classes/layerserver.class.php @@ -123,7 +123,7 @@ class LayerServer { * */ function LayerServer(){ - $this->errors = array(); + $this->errors = array(); // Load request parameters $this->get_request(); @@ -131,7 +131,7 @@ class LayerServer { // Load map if(!$this->has_error()) { - $this->load_map(); + $this->load_map(); } } @@ -157,7 +157,23 @@ class LayerServer { } else { $this->_networklink = false; } - $this->_xml = new SimpleXMLElement(''); + + $imageObj = $this->map_object->drawlegend(); + $url = $imageObj->saveWebImage(); + $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); + $url = strtolower($protocolo[0]."://".$_SERVER['HTTP_HOST']).$url; + + $legenda = " " . PHP_EOL + . " Legenda" . PHP_EOL + . " " . PHP_EOL + . " ".$url."" . PHP_EOL + . " " . PHP_EOL + . " " . PHP_EOL + . " " . PHP_EOL + . " " . PHP_EOL + . " " . PHP_EOL; + + $this->_xml = new SimpleXMLElement(''.$legenda.''); // Prepare projection $this->in_proj = ms_newProjectionObj($this->map_object->getProjection()); // Set projection to GOOGLE earth's projection @@ -174,6 +190,7 @@ class LayerServer { if($this->has_error()){ $this->add_errors(); } + return $this->send_stream($this->get_kml()); } @@ -239,7 +256,8 @@ class LayerServer { } } else { foreach($layers as $layer){ - $this->process_layer_request($layer); + //echo "Oi";exit; + $this->process_layer_request($layer); } } } @@ -264,12 +282,10 @@ class LayerServer { */ function process_layer_request(&$layer_name){ error_reporting(0); - $v = "5.0.0"; $vs = explode(" ",ms_GetVersion()); $cvs = count($vs); - for ($i=0;$i<$cvs;++$i) - { + for ($i=0;$i<$cvs;++$i) { if(trim(strtolower($vs[$i])) == "version") {$v = $vs[$i+1];} } @@ -283,16 +299,12 @@ class LayerServer { $this->set_error('Nenhum layer com esse nome foi encontrado no mapfile ' . $layer_name, $layer_name); return false; } - // Add to layer list $this->layers[$layer_name] =& $layer; - // Get custom template if any $description_template = $layer->getMetadata('DESCRIPTION_TEMPLATE'); - // Set on $layer->set( 'status', MS_DEFAULT ); - // Set kml title from layer description (default to layer name) $layer_desc = $this->get_layer_description($layer); @@ -318,10 +330,10 @@ class LayerServer { //simplexml_addChild($parent, $name, $value='') //$folder->addChild('description', $this->get_layer_description($layer)); $this->simplexml_addChild($folder,'name',$layer_desc); + //$folder->addChild('name', $layer_desc); $this->add_wms_link($folder, $layer, $wms_link); } else { - // Apply filter if($this->filter){ // Try loading as XML @@ -389,12 +401,15 @@ class LayerServer { { // get next shape row if($versao == 6) - {$shape = $layer->getShape($layer->getResult($j));} + { + $result = $layer->getResult($j); + $shape = $layer->getShape($result); + } else{ $result = $layer->getResult($j); $shape = $layer->getFeature($result->shapeindex,$result->tileindex); } - $shape->classindex = $result->classindex; + $shape->classindex = $result->classindex; $this->process_shape($layer, $shape, $class_list, $folder, $namecol); } if($n == 0) { @@ -422,7 +437,7 @@ class LayerServer { $shape->project($this->in_proj, $this->out_proj); // Assign style if($layer->classitem){ - $style_id = $this->get_shape_class($layer->classitem, $shape->values, $class_list); + //$style_id = $this->get_shape_class($layer->classitem, $shape->values, $class_list); } if(!isset($style_id)){ // Get first class @@ -572,7 +587,7 @@ class LayerServer { /** * Add a multipolygon - * FIXME: untested, should take holes into account + * fixme: untested, should take holes into account */ function add_multipolygon(&$wkt, &$element, $featurename){ $ml = $element->addChild('MultiGeometry'); @@ -664,7 +679,7 @@ class LayerServer { /** * Return a CSV list of all layer names in the mapfile - * FIXME: filter out ANNOTATIONS and other "strange" layers + * fixme: filter out ANNOTATIONS and other "strange" layers */ function get_layer_list(){ $layer_list = array(); @@ -700,13 +715,13 @@ class LayerServer { */ function add_style(&$layer, &$folder, $style_id, &$style_data){ // Calculare style URL - + if($style_data['description_template']){ $this->style_counter++; $style_id .= '_'.$this->style_counter; $balloon_data = $this->get_feature_description($attributes[$namecol], $attributes, $style_data['description_template']); } - + // Check if the style already exists $expr = '//*[@id=\''.$style_id.'\']'; if($folder->xpath($expr)) { @@ -759,13 +774,20 @@ class LayerServer { if($style_data['icon']){ $st =& $new_style->addChild('IconStyle'); if($style_data['width'] && $style_data['icon_width'] != 32){ - $st->addChild('scale', $style_data['icon_width'] / 32); + /** + * TODO + */ + //$st->addChild('scale', $style_data['icon_width'] / 32); + $st->addChild('scale', 1); } else {$st->addChild('scale', 1);} $icon =& $st->addChild('Icon'); $icon->addChild('href', htmlentities($style_data['icon'])); + } + $ls =& $new_style->addChild('LabelStyle'); + $ls->addChild('scale', $style_data['label_size'] / 32); // Add the balloon style if description_template is set /* if($style_data['description_template']){ @@ -837,12 +859,18 @@ class LayerServer { $classe = $layer->getclass($classindex); $estilo = $classe->getstyle(0); $url = ""; - $imageObj = $classe->createLegendIcon($estilo->size, $estilo->size); + $imageObj = $classe->createLegendIcon(30,30); if($imageObj) { $url = $imageObj->saveWebImage(); $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); $url = strtolower($protocolo[0]."://".$_SERVER['HTTP_HOST']).$url; + $nome = $imageObj->imagepath . basename($url); + + $img = imagecreatefrompng($nome); + $index = imagecolorexact($img, 255, 255, 255); + imagecolortransparent($img, $index); + imagepng($img, $nome); } return $url; //$this->endpoint . '?service=icon&map=' . $this->map . '&typename=' . urlencode($layer->name) . '&classname=' . urlencode($classname); } @@ -867,6 +895,7 @@ class LayerServer { if(!$description){ $description = $layer->name; } + $description = mb_convert_encoding($description,"UTF-8",mb_detect_encoding($description,"UTF-8,ISO-8859-1")); return $description; } @@ -917,14 +946,14 @@ class LayerServer { $protocolo = explode("/",$_SERVER['SERVER_PROTOCOL']); $servidor = strtolower($protocolo[0])."://".$_SERVER['HTTP_HOST']; $temp = $this->map; - if(!file_exists($this->map)) - { - if(file_exists("ms_configura.php")) - {include("ms_configura.php");} - else - {include("../../ms_configura.php");} + if(file_exists(__DIR__."/ms_configura.php")){ + include(__DIR__."/ms_configura.php"); + } + else{ + include("../../ms_configura.php"); + } + if(!file_exists($this->map)){ $maptemp = ms_newMapObj($locaplic."/temas/".$this->map.".map"); - //if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) //{$this->map = $locaplic."/aplicmap/geral1windows.map";} //else @@ -952,10 +981,12 @@ class LayerServer { } } $this->map = $base; - + $this->map_object = ms_newMapObj($this->map); - if(!$this->_zipped) - $this->map_object->setmetadata('wms_onlineresource',$servidor.":80/i3geo/ogc.php?tema=".$temp."&width=1500&height=1500&"); + if(!$this->_zipped){ + $this->map_object->setmetadata('wms_onlineresource',$servidor.":80/i3geo/ogc.php?tema=".$temp."&width=1500&height=1500&"); + $this->map_object->setmetadata("ows_enable_request","*"); + } $n = $this->map_object->numlayers; for ($i=0;$i < $n;$i++) { @@ -971,19 +1002,17 @@ class LayerServer { { $l->set("type",MS_LAYER_RASTER); $l->setmetadata('wms_onlineresource',"../../ogc.php?tema=".$temp."&width=500&height=500&"); + $l->setmetadata("ows_enable_request","*"); } ms_newLayerObj($this->map_object, $l); } } - else - { + else{ $this->map_object = ms_newMapObj($this->map); - if(file_exists("ms_configura.php")) - {include("ms_configura.php");} - else - {include("../../ms_configura.php");} - if(!$this->_zipped) - $this->map_object->setmetadata('wms_onlineresource',$servidor.":80".$locmapserv."?map=".$temp."&width=1500&height=1500&"); + if(!$this->_zipped){ + $this->map_object->setmetadata('wms_onlineresource',$servidor.":80".$locmapserv."?map=".$temp."&width=1500&height=1500&"); + $this->map_object->setmetadata("ows_enable_request","*"); + } $n = $this->map_object->numlayers; for ($i=0;$i < $n;$i++) { @@ -1037,7 +1066,8 @@ class LayerServer { * Send header */ function send_header(){ - header('Content-type: application/vnd.google-earth.km'.($this->_zipped ? 'z' : 'l').'+XML'); + header('Content-Disposition: attachment; filename=kml.km'.($this->_zipped ? 'z' : 'l')); + header('Content-type: application/vnd.google-earth.km'.($this->_zipped ? 'z' : 'l').'+XML'); } /** @@ -1052,7 +1082,7 @@ class LayerServer { if($k != ""){ return $k; } - include("../../ms_configura.php"); + include(__DIR__."/../../ms_configura.php"); return $dir_tmp.'/'. md5($_SERVER['QUERY_STRING']) . ($this->_zipped ? '.kmz' : '.kml'); } @@ -1062,12 +1092,14 @@ class LayerServer { function send_stream($data){ $this->send_header(); // Compress data + if($this->_zipped){ include("zip.class.php"); $ziper = new zipfile(); $ziper->addFile($data, 'doc.kml'); $data = $ziper->file(); } + // Create cache if needed if(ENABLE_CACHE && count($this->layers) == 1) { //error_log( 'creating cache ' . $this->get_cache_file_name() ); diff --git a/pacotes/tme/TME_i3geo.php b/pacotes/tme/TME_i3geo.php index 4c769fa..8a30650 100644 --- a/pacotes/tme/TME_i3geo.php +++ b/pacotes/tme/TME_i3geo.php @@ -24,10 +24,9 @@ // Can be changed to another data connector class -require_once ('TME_i3geo_DataConnector.php'); - +require_once (__DIR__.'/TME_i3geo_DataConnector.php'); // Include engine class -require_once ('TME_Engine.php'); +require_once (__DIR__.'/TME_Engine.php'); if(!isset($_GET["sid"])) {echo "Erro. Acesso não permitido";exit;} $dataConnector = new DataConnector($_GET["sid"]); @@ -42,7 +41,7 @@ if(count($colunas) == 1){ $tipo = "year"; } if(!isset($dir_tmp)){ - include("../../ms_configura.php"); + include(__DIR__."/../../ms_configura.php"); } $parameters = array( 'mapType' => 'bar', 'indicator' => 'valores', @@ -57,9 +56,8 @@ $parameters = array( 'mapType' => 'bar', $map = new ThematicMap($dataStore, $parameters); $file = $map->getKML($dataConnector->url); if(!function_exists("cpjson")) -{require("../../classesphp/funcoes_gerais.php");} +{require(__DIR__."/../../classesphp/funcoes_gerais.php");} cpjson(array('url' => $file)); //echo "

$file"; - ?> \ No newline at end of file diff --git a/pacotes/tme/TME_i3geo_DataConnector.php b/pacotes/tme/TME_i3geo_DataConnector.php index d6ed1d4..f93cf7c 100644 --- a/pacotes/tme/TME_i3geo_DataConnector.php +++ b/pacotes/tme/TME_i3geo_DataConnector.php @@ -51,7 +51,7 @@ class DataConnector else {dl('php_mapscript.so');} } - include("../../classesphp/carrega_ext.php"); + //include("../../classesphp/carrega_ext.php"); //verificação de segurança $_SESSION = array(); session_name("i3GeoPHP"); @@ -110,9 +110,9 @@ class DataConnector // Make data store function getDataStore($nomelayer,$colunasvalor,$colunanomeregiao,$titulo,$descricao,$ext=""){ //$indicatorID, $year, $region){ - include("../../classesphp/funcoes_gerais.php"); + include(__DIR__."/../../classesphp/funcoes_gerais.php"); $versao = versao(); - $versao = $versao["principal"]; + $versao = $versao["principal"]; $mapa = ms_newMapObj($this->map_file); if($ext == "") {$mapa = extPadrao($mapa);} @@ -120,7 +120,7 @@ class DataConnector $e = str_replace(","," ",$ext); $e = explode(" ",$ext); $extatual = $mapa->extent; - $extatual->setextent((min($e[0],$e[2])),(min($e[1],$e[3])),(max($e[0],$e[2])),(max($e[1],$e[3]))); + $extatual->setextent((min($e[0],$e[2])),(min($e[1],$e[3])),(max($e[0],$e[2])),(max($e[1],$e[3]))); } $layer = $mapa->getlayerbyname($nomelayer); $layer->set("template","none.html"); @@ -160,7 +160,7 @@ class DataConnector $valitem = array(); if($versao == 6) {$shape = $layer->getShape($layer->getResult($i));} - else{$shape = $layer->getFeature($layer->getResult($i)->shapeindex);} + else{$shape = $layer->getFeature($layer->getResult($i)->shapeindex);} $pt = $shape->getCentroid(); $dataStore['features'][$i] = array( "featureID"=>$i, @@ -172,7 +172,7 @@ class DataConnector //[0] é o ano foreach($colunasvalor as $colunavalor){ $valor = $shape->values[$colunavalor]; - + settype($valor,"float"); //echo $valor; if(is_numeric($valor)){ -- libgit2 0.21.2