From 1145194e791d8a6dc7dd752b75f7c59e74871091 Mon Sep 17 00:00:00 2001 From: Edmar Moretti Date: Tue, 20 Feb 2018 12:25:58 -0300 Subject: [PATCH] i3geo/i3geo#57 conclusão da implementação de UTFGRID --- classesphp/classe_toponimia.php | 764 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ferramentas/etiqueta/exec.php | 3 ++- ferramentas/etiqueta/index.js | 593 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ferramentas/etiqueta/templateLista_mst.html | 28 +++++++++++++++++++--------- temas/_lbiomashp.map | 10 +--------- 5 files changed, 726 insertions(+), 672 deletions(-) diff --git a/classesphp/classe_toponimia.php b/classesphp/classe_toponimia.php index 1a41b96..a0ffbac 100755 --- a/classesphp/classe_toponimia.php +++ b/classesphp/classe_toponimia.php @@ -1,371 +1,409 @@ postgis_mapa = $postgis_mapa; - - if(file_exists($locaplic."/funcoes_gerais.php")) - include_once($locaplic."/funcoes_gerais.php"); - else - include_once("funcoes_gerais.php"); - - $this->v = versao(); - $this->vi = $this->v["inteiro"]; - $this->v = $this->v["principal"]; - - $this->mapa = ms_newMapObj($map_file); - substituiConObj($this->mapa,$postgis_mapa); - - $this->arquivo = str_replace(".map","",$map_file).".map"; - if($tema != "" && @$this->mapa->getlayerbyname($tema)) - $this->layer = $this->mapa->getlayerbyname($tema); - $this->nome = $tema; - } -/* -function: salva - -Salva o mapfile atual -*/ - function salva() - { - restauraConObj($this->mapa,$this->postgis_mapa); - $this->mapa->save($this->arquivo); - } -/* -function: criaToponimia - -Cria a toponímia de um tema - -parameter: - -$item Item que será utilizado. -$position Posição da âncora do texto. - -$partials Corta texto nas bordas do mapa. - -$offsetx Deslocamento em X. - -$offsety Deslocamento em Y. - -$minfeaturesize Tamanho mínimo que o texto deve ter. - -$mindistance Distância mínima entre os textos. - -$force Força colisão. - -$shadowcolor Cor da sombra. - -$shadowsizex Tamanho em X da sombra. - -$shadowsizey Tamanho em Y da sombra. - -$outlinecolor Cor do contorno. - -$cor Cor do texto. - -$sombray Deslocamento Y da sombra. - -$sombrax Deslocamento X da sombra. - -$sombra string Inclui sombra. - -$fundo Cor do fundo. - -$angulo Ângulo do texto. - -$tamanho Tamanho do texto. - -$fonte Fonte. - -$tipo Tipo teste| - -$wrap - -$novotema sim|nao Cria um novo tema ou não, nesse último caso, a toponímia é inserida em todas as classes - -Retorno: - -{string} - codigo do layer criado -*/ - function criaToponimia($item,$position,$partials,$offsetx,$offsety,$minfeaturesize,$mindistance,$force,$shadowcolor,$shadowsizex,$shadowsizey,$outlinecolor,$cor,$sombray,$sombrax,$sombra,$fundo,$angulo,$tamanho,$fonte,$tipo,$wrap,$novotema="sim") - { - //error_reporting(0); - if(!$this->layer){return "erro";} - $this->removeToponimia(); - - if (!isset($tipo)){$tipo = "";} - if ($item != "") //o layer nao tem tabela mas tem toponimia - { - if($novotema == "sim"){ - $nome = pegaNome($this->layer); - $novolayer = ms_newLayerObj($this->mapa, $this->layer); - $nomer = nomeRandomico(); - $novolayer->set("name",$nomer); - $novolayer->set("group",""); - $novolayer->set("type",$this->layer->type); - $nclasses = $novolayer->numclasses; - for ($i=0; $i < $nclasses; ++$i){ - $c = $novolayer->getclass($i); - $c->set("status",MS_DELETE); - } - $novac = ms_newClassObj($novolayer); - $novolayer->set("status",MS_DEFAULT); - $novolayer->setmetadata("tema","texto de ".$nome); - $novolayer->setmetadata("tip",""); - $novolayer->setmetadata("tiles","nao"); - $novolayer->setmetadata("identifica","nao"); - $novolayer->set("labelitem",$item); - } - else{ - $nomer = $this->layer->name; - $novolayer = $this->mapa->getlayerbyname($nomer); - } - $novolayer->setmetadata("cache",""); - $this->layer = $novolayer; - } - else - { - $nomer = $this->layer->name; - } - if(!($this->vi >= 60200)){ - $this->layer->set("labelitem",$item); - } - $nclasses = $this->layer->numclasses; - for ($i=0; $i < $nclasses; ++$i){ - $novac = $this->layer->getclass($i); - if($this->vi >= 60200){ - $s = "CLASS LABEL TEXT '[".$item."]' END END"; - $novac->updateFromString($s); - $label = $novac->getLabel($indiceLabel); - } - else{ - $label = $novac->label; - } - if($wrap != "") - { - $label->set("maxlength",1); - $s = $novac->getTextString; - $s = "CLASS LABEL WRAP '$wrap' END END"; - $novac->updateFromString($s); - } - if($this->vi >= 60200){ - $label = $novac->getLabel($indiceLabel); - } - else{ - $label = $novac->label; - } - if ($fonte != "bitmap") - { - //$label->set("type",MS_TRUETYPE); - $label->updatefromstring("LABEL TYPE TRUETYPE END"); - $label->set("font",$fonte); - $label->set("size",$tamanho); - } - else - { - //$label->set("type",MS_BITMAP); - $label->updatefromstring("LABEL TYPE BITMAP END"); - //$label->set("font",$fonte); - $t = MS_TINY; - if ($tamanho > 5 ){$t = MS_TINY;} - if ($tamanho >= 7 ){$t = MS_SMALL;} - if ($tamanho >= 10 ){$t = MS_MEDIUM;} - if ($tamanho >= 12 ){$t = MS_LARGE;} - if ($tamanho >= 14 ){$t = MS_GIANT;} - $label->set("size",$t); - } - if($angulo > 0){ - $label->set("angle",$angulo); - } - if($angulo == "AUTO"){ - $label->updatefromstring("LABEL ANGLE AUTO END"); - } - if (strtoupper($angulo) == "CURVO" || strtoupper($angulo) == "FOLLOW"){ - $label->updatefromstring("LABEL ANGLE FOLLOW END"); - } - corE($label,$cor,"color"); - corE($label,$fundo,"backgroundcolor"); - corE($label,$sombra,"backgroundshadowcolor",$sombrax,$sombray); - corE($label,$outlinecolor,"outlinecolor"); - corE($label,$shadowcolor,"shadowcolor"); - $label->set("shadowsizex",$shadowsizex); - $label->set("shadowsizey",$shadowsizey); - $label->set("force",$force); - $label->set("mindistance",$mindistance); - $label->set("minfeaturesize",$minfeaturesize); - $label->set("offsetx",$offsetx); - $label->set("offsety",$offsety); - $label->set("partials",$partials); - $p = array("MS_AUTO"=>MS_AUTO,"MS_UL"=>MS_UL,"MS_LR"=>MS_LR,"MS_UR"=>MS_UR,"MS_LL"=>MS_LL,"MS_CR"=>MS_CR,"MS_CL"=>MS_CL,"MS_UC"=>MS_UC,"MS_LC"=>MS_LC,"MS_CC"=>MS_CC); - $label->set("position",$p[$position]); - } - if ($tipo == "teste"){ - $i = gravaImagemMapa($this->mapa); - return ($i["url"]); - } - else - {return($nomer);} - } - function removeToponimia(){ - $nclasses = $this->layer->numclasses; - if($this->vi >= 60200){ - for ($i=0; $i < $nclasses; ++$i){ - $classe = $this->layer->getclass($i); - while($classe->numlabels > 0){ - $classe->removeLabel(0); - } - } - } - if ($this->layer){ - $this->layer->setMetaData("cache",""); - } - } - /* -function: ativaEtiquetas - -ativa a inclusão de etiquetas em um tema - -parameter: -$item Lista de Itens separados por vírgula que serão utilizados. -*/ - function ativaEtiquetas($item) - { - if(!$this->layer){return "erro";} - $this->layer->setmetadata("IDENTIFICA",""); - $this->layer->setmetadata("TIP",$item); - return("ok"); - } - /* - function: pegaDadosEtiquetas - - ativa a inclusão de etiquetas em um tema - - parameter: - $item Lista de Itens separados por vírgula que serão utilizados. - */ - function pegaDadosEtiquetas() - { - if(!$this->layer){return "erro";} - $itens = $this->layer->getmetadata("ITENS"); - $itens = explode(",",$itens); - $itensdesc = mb_convert_encoding($this->layer->getmetadata("ITENSDESC"),"UTF-8","ISO-8859-1"); - $itensdesc = explode(",",$itensdesc); - $itenslink = $this->layer->getmetadata("ITENSLINK"); - $itenslink = explode(",",$itenslink); - - $tips = $this->layer->getmetadata("TIP"); - - $res = array( - "itens"=>$itens, - "itensdesc"=>array_combine($itens,$itensdesc), - "itenslink"=>array_combine($itens,$itenslink), - "tips"=>explode(",",$tips), - "itembuscarapida"=>$this->layer->getmetadata("itembuscarapida") - ); - return($res); - } -/* -function: removeEtiquetas - -remove a inclusão de etiquetas em um tema. - -*/ - function removeEtiquetas() - { - if(!$this->layer){return "erro";} - $this->layer->setmetadata("TIP",""); - return("ok"); - } + /* + * Variavel: $mapa + * + * Objeto mapa + */ + protected $mapa; + + /* + * Variavel: $map_file + * + * Arquivo map file + */ + protected $map_file; + + /* + * Variavel: $layer + * + * Objeto layer + */ + public $layer; + + /* + * Variavel: $nome + * + * Nome do layer + */ + protected $nome; + + /* + * Variavel: $v + * + * Versão atual do Mapserver (primeiro dígito) + */ + public $v; + + /* + * Variavel: $vi + * + * Versão atual do Mapserver (valor inteiro) + * + * Returns the MapServer version number (x.y.z) as an integer (x*10000 + y*100 + z). (New in v5.0) e.g. V5.4.3 would return 50403 + */ + public $vi; + + /* + * function __construct + * + * Cria um objeto map e seta a variavel tema + * + * parameters: + * $map_file - Endereço do mapfile no servidor. + * + * $tema - nome do tema que será processado + */ + function __construct($map_file, $tema = "", $locaplic = "") + { + include (dirname(__FILE__) . "/../ms_configura.php"); + $this->postgis_mapa = $postgis_mapa; + + if (file_exists($locaplic . "/funcoes_gerais.php")) + include_once ($locaplic . "/funcoes_gerais.php"); + else + include_once ("funcoes_gerais.php"); + + $this->v = versao(); + $this->vi = $this->v["inteiro"]; + $this->v = $this->v["principal"]; + + $this->mapa = ms_newMapObj($map_file); + substituiConObj($this->mapa, $postgis_mapa); + + $this->arquivo = str_replace(".map", "", $map_file) . ".map"; + if ($tema != "" && @$this->mapa->getlayerbyname($tema)) + $this->layer = $this->mapa->getlayerbyname($tema); + $this->nome = $tema; + } + + /* + * function: salva + * + * Salva o mapfile atual + */ + function salva() + { + restauraConObj($this->mapa, $this->postgis_mapa); + $this->mapa->save($this->arquivo); + } + + /* + * function: criaToponimia + * + * Cria a toponímia de um tema + * + * parameter: + * + * $item Item que será utilizado. + * + * $position Posição da âncora do texto. + * + * $partials Corta texto nas bordas do mapa. + * + * $offsetx Deslocamento em X. + * + * $offsety Deslocamento em Y. + * + * $minfeaturesize Tamanho mínimo que o texto deve ter. + * + * $mindistance Distância mínima entre os textos. + * + * $force Força colisão. + * + * $shadowcolor Cor da sombra. + * + * $shadowsizex Tamanho em X da sombra. + * + * $shadowsizey Tamanho em Y da sombra. + * + * $outlinecolor Cor do contorno. + * + * $cor Cor do texto. + * + * $sombray Deslocamento Y da sombra. + * + * $sombrax Deslocamento X da sombra. + * + * $sombra string Inclui sombra. + * + * $fundo Cor do fundo. + * + * $angulo Ângulo do texto. + * + * $tamanho Tamanho do texto. + * + * $fonte Fonte. + * + * $tipo Tipo teste| + * + * $wrap + * + * $novotema sim|nao Cria um novo tema ou não, nesse último caso, a toponímia é inserida em todas as classes + * + * Retorno: + * + * {string} - codigo do layer criado + */ + function criaToponimia($item, $position, $partials, $offsetx, $offsety, $minfeaturesize, $mindistance, $force, $shadowcolor, $shadowsizex, $shadowsizey, $outlinecolor, $cor, $sombray, $sombrax, $sombra, $fundo, $angulo, $tamanho, $fonte, $tipo, $wrap, $novotema = "sim") + { + // error_reporting(0); + if (! $this->layer) { + return "erro"; + } + $this->removeToponimia(); + + if (! isset($tipo)) { + $tipo = ""; + } + if ($item != "") // o layer nao tem tabela mas tem toponimia +{ + if ($novotema == "sim") { + $nome = pegaNome($this->layer); + $novolayer = ms_newLayerObj($this->mapa, $this->layer); + $nomer = nomeRandomico(); + $novolayer->set("name", $nomer); + $novolayer->set("group", ""); + $novolayer->set("type", $this->layer->type); + $nclasses = $novolayer->numclasses; + for ($i = 0; $i < $nclasses; ++ $i) { + $c = $novolayer->getclass($i); + $c->set("status", MS_DELETE); + } + $novac = ms_newClassObj($novolayer); + $novolayer->set("status", MS_DEFAULT); + $novolayer->setmetadata("tema", "texto de " . $nome); + $novolayer->setmetadata("tip", ""); + $novolayer->setmetadata("tiles", "nao"); + $novolayer->setmetadata("identifica", "nao"); + $novolayer->set("labelitem", $item); + } else { + $nomer = $this->layer->name; + $novolayer = $this->mapa->getlayerbyname($nomer); + } + $novolayer->setmetadata("cache", ""); + $this->layer = $novolayer; + } else { + $nomer = $this->layer->name; + } + if (! ($this->vi >= 60200)) { + $this->layer->set("labelitem", $item); + } + $nclasses = $this->layer->numclasses; + for ($i = 0; $i < $nclasses; ++ $i) { + $novac = $this->layer->getclass($i); + if ($this->vi >= 60200) { + $s = "CLASS LABEL TEXT '[" . $item . "]' END END"; + $novac->updateFromString($s); + $label = $novac->getLabel($indiceLabel); + } else { + $label = $novac->label; + } + if ($wrap != "") { + $label->set("maxlength", 1); + $s = $novac->getTextString; + $s = "CLASS LABEL WRAP '$wrap' END END"; + $novac->updateFromString($s); + } + if ($this->vi >= 60200) { + $label = $novac->getLabel($indiceLabel); + } else { + $label = $novac->label; + } + if ($fonte != "bitmap") { + // $label->set("type",MS_TRUETYPE); + $label->updatefromstring("LABEL TYPE TRUETYPE END"); + $label->set("font", $fonte); + $label->set("size", $tamanho); + } else { + // $label->set("type",MS_BITMAP); + $label->updatefromstring("LABEL TYPE BITMAP END"); + // $label->set("font",$fonte); + $t = MS_TINY; + if ($tamanho > 5) { + $t = MS_TINY; + } + if ($tamanho >= 7) { + $t = MS_SMALL; + } + if ($tamanho >= 10) { + $t = MS_MEDIUM; + } + if ($tamanho >= 12) { + $t = MS_LARGE; + } + if ($tamanho >= 14) { + $t = MS_GIANT; + } + $label->set("size", $t); + } + if ($angulo > 0) { + $label->set("angle", $angulo); + } + if ($angulo == "AUTO") { + $label->updatefromstring("LABEL ANGLE AUTO END"); + } + if (strtoupper($angulo) == "CURVO" || strtoupper($angulo) == "FOLLOW") { + $label->updatefromstring("LABEL ANGLE FOLLOW END"); + } + corE($label, $cor, "color"); + corE($label, $fundo, "backgroundcolor"); + corE($label, $sombra, "backgroundshadowcolor", $sombrax, $sombray); + corE($label, $outlinecolor, "outlinecolor"); + corE($label, $shadowcolor, "shadowcolor"); + $label->set("shadowsizex", $shadowsizex); + $label->set("shadowsizey", $shadowsizey); + $label->set("force", $force); + $label->set("mindistance", $mindistance); + $label->set("minfeaturesize", $minfeaturesize); + $label->set("offsetx", $offsetx); + $label->set("offsety", $offsety); + $label->set("partials", $partials); + $p = array( + "MS_AUTO" => MS_AUTO, + "MS_UL" => MS_UL, + "MS_LR" => MS_LR, + "MS_UR" => MS_UR, + "MS_LL" => MS_LL, + "MS_CR" => MS_CR, + "MS_CL" => MS_CL, + "MS_UC" => MS_UC, + "MS_LC" => MS_LC, + "MS_CC" => MS_CC + ); + $label->set("position", $p[$position]); + } + if ($tipo == "teste") { + $i = gravaImagemMapa($this->mapa); + return ($i["url"]); + } else { + return ($nomer); + } + } + + function removeToponimia() + { + $nclasses = $this->layer->numclasses; + if ($this->vi >= 60200) { + for ($i = 0; $i < $nclasses; ++ $i) { + $classe = $this->layer->getclass($i); + while ($classe->numlabels > 0) { + $classe->removeLabel(0); + } + } + } + if ($this->layer) { + $this->layer->setMetaData("cache", ""); + } + } + + /* + * function: ativaEtiquetas + * + * ativa a inclusão de etiquetas em um tema + * + * parameter: + * $item Lista de Itens separados por vírgula que serão utilizados. + */ + function ativaEtiquetas($item) + { + if (! $this->layer) { + return "erro"; + } + $this->layer->setmetadata("IDENTIFICA", ""); + $this->layer->setmetadata("TIP", $item); + return ("ok"); + } + + /* + * function: pegaDadosEtiquetas + * + * ativa a inclusão de etiquetas em um tema + * + * parameter: + * $item Lista de Itens separados por vírgula que serão utilizados. + */ + function pegaDadosEtiquetas() + { + if (! $this->layer) { + return "erro"; + } + $itens = $this->layer->getmetadata("ITENS"); + $itens = explode(",", $itens); + $itensdesc = mb_convert_encoding($this->layer->getmetadata("ITENSDESC"), "UTF-8", "ISO-8859-1"); + $itensdesc = explode(",", $itensdesc); + $itenslink = $this->layer->getmetadata("ITENSLINK"); + $itenslink = explode(",", $itenslink); + + $tips = $this->layer->getmetadata("TIP"); + + $res = array( + "itens" => $itens, + "itensdesc" => array_combine($itens, $itensdesc), + "itenslink" => array_combine($itens, $itenslink), + "tips" => explode(",", $tips), + "itembuscarapida" => $this->layer->getmetadata("itembuscarapida"), + "utfdata" => $this->layer->getmetadata("UTFDATA") + ); + return ($res); + } + + /* + * function: removeEtiquetas + * + * remove a inclusão de etiquetas em um tema. + * + */ + function removeEtiquetas() + { + if (! $this->layer) { + return "erro"; + } + $this->layer->setmetadata("TIP", ""); + $this->layer->setmetadata("UTFDATA", ""); + return ("ok"); + } } ?> diff --git a/ferramentas/etiqueta/exec.php b/ferramentas/etiqueta/exec.php index 843683e..5358fae 100755 --- a/ferramentas/etiqueta/exec.php +++ b/ferramentas/etiqueta/exec.php @@ -23,6 +23,7 @@ Ativa as etiquetas de um tema. $m->layer->setmetadata("ITENS",$_GET["itens"]); $m->layer->setmetadata("ITENSDESC",$_GET["itensdesc"]); $m->layer->setmetadata("ITENSLINK",$_GET["itenslink"]); + $m->layer->setmetadata("UTFDATA",$_GET["utfdata"]); $m->layer->setmetadata("itembuscarapida",$_GET["itembuscarapida"]); $m->salva(); $_SESSION["contadorsalva"]++; @@ -46,7 +47,7 @@ Desativa as etiquetas de um tema. /* Valor: PEGADADOSETIQUETAS -Obtém os dados sobre itens, itensdesc, etc +Obt�m os dados sobre itens, itensdesc, etc pegaDadosEtiquetas> */ diff --git a/ferramentas/etiqueta/index.js b/ferramentas/etiqueta/index.js index cb41328..351943c 100755 --- a/ferramentas/etiqueta/index.js +++ b/ferramentas/etiqueta/index.js @@ -30,36 +30,36 @@ Você deve ter recebido uma cópia da Licença Pública G GNU junto com este programa; se não, escreva para a Free Software Foundation, Inc., no endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. -*/ + */ if(typeof(i3GEOF) === 'undefined'){ - var i3GEOF = {}; + var i3GEOF = {}; } /* Classe: i3GEOF.etiqueta -*/ + */ i3GEOF.etiqueta = { - tema : i3GEO.temaAtivo, - /* + tema : i3GEO.temaAtivo, + /* Variavel: aguarde Estilo do objeto DOM com a imagem de aguarde existente no cabeçalho da janela. - */ - aguarde: "", - /** - * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php - */ - MUSTACHE : "", - MUSTACHELISTA : "", - /** - * Susbtitutos para o template - */ - mustacheHash : function() { - var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.etiqueta.dicionario); - dicionario["aplica"] = $trad("p14"); - return dicionario; - }, - /* + */ + aguarde: "", + /** + * Template no formato mustache. E preenchido na carga do javascript com o programa dependencias.php + */ + MUSTACHE : "", + MUSTACHELISTA : "", + /** + * Susbtitutos para o template + */ + mustacheHash : function() { + var dicionario = i3GEO.idioma.objetoIdioma(i3GEOF.etiqueta.dicionario); + dicionario["aplica"] = $trad("p14"); + return dicionario; + }, + /* Function: inicia Inicia a ferramenta. É chamado por criaJanelaFlutuante @@ -67,50 +67,50 @@ i3GEOF.etiqueta = { Parametro: iddiv {String} - id do div que receberá o conteudo HTML da ferramenta - */ - inicia: function(iddiv){ - if(i3GEOF.etiqueta.MUSTACHE == ""){ - var t1 = i3GEO.configura.locaplic + "/ferramentas/etiqueta/template_mst.html", - t2 = i3GEO.configura.locaplic + "/ferramentas/etiqueta/templateLista_mst.html"; - - $.when( $.get(t1),$.get(t2) ).done(function(r1,r2) { - i3GEOF.etiqueta.MUSTACHE = r1[0]; - i3GEOF.etiqueta.MUSTACHELISTA = r2[0]; - i3GEOF.etiqueta.inicia(iddiv); - }).fail(function() { - i3GEO.janela.closeMsg($trad("erroTpl")); - return; - }); - return; - } - - if(i3GEOF.etiqueta.tema === ""){ - $i(iddiv).innerHTML = ""; - return; - } - try{ - $i(iddiv).innerHTML = i3GEOF.etiqueta.html(); - - if (!$i("i3GEOFetiquetaComboCabecaSel")) { - i3GEO.janela.comboCabecalhoTemasBs("i3GEOFetiquetaComboCabeca","i3GEOFetiquetaComboCabecaSel","etiqueta","ligadosComTabela",function(evt){ - var botao = evt.target; - if (botao) { - if (botao.value != "") { - i3GEO.mapa.ativaTema(botao.value); - i3GEOF.etiqueta.tema = botao.value; - $i(iddiv).innerHTML = ""; - i3GEOF.etiqueta.inicia(iddiv); - } else { - //$i(iddiv).innerHTML = ""; - } - } - }); - } - i3GEOF.etiqueta.ativaFoco(); - } - catch(erro){i3GEO.janela.tempoMsg(erro);} - }, - /* + */ + inicia: function(iddiv){ + if(i3GEOF.etiqueta.MUSTACHE == ""){ + var t1 = i3GEO.configura.locaplic + "/ferramentas/etiqueta/template_mst.html", + t2 = i3GEO.configura.locaplic + "/ferramentas/etiqueta/templateLista_mst.html"; + + $.when( $.get(t1),$.get(t2) ).done(function(r1,r2) { + i3GEOF.etiqueta.MUSTACHE = r1[0]; + i3GEOF.etiqueta.MUSTACHELISTA = r2[0]; + i3GEOF.etiqueta.inicia(iddiv); + }).fail(function() { + i3GEO.janela.closeMsg($trad("erroTpl")); + return; + }); + return; + } + + if(i3GEOF.etiqueta.tema === ""){ + $i(iddiv).innerHTML = ""; + return; + } + try{ + $i(iddiv).innerHTML = i3GEOF.etiqueta.html(); + + if (!$i("i3GEOFetiquetaComboCabecaSel")) { + i3GEO.janela.comboCabecalhoTemasBs("i3GEOFetiquetaComboCabeca","i3GEOFetiquetaComboCabecaSel","etiqueta","ligadosComTabela",function(evt){ + var botao = evt.target; + if (botao) { + if (botao.value != "") { + i3GEO.mapa.ativaTema(botao.value); + i3GEOF.etiqueta.tema = botao.value; + $i(iddiv).innerHTML = ""; + i3GEOF.etiqueta.inicia(iddiv); + } else { + //$i(iddiv).innerHTML = ""; + } + } + }); + } + i3GEOF.etiqueta.ativaFoco(); + } + catch(erro){i3GEO.janela.tempoMsg(erro);} + }, + /* Function: html Gera o código html para apresentação das opções da ferramenta @@ -118,73 +118,73 @@ i3GEOF.etiqueta = { Retorno: String com o código html - */ - html:function() { - var ins = Mustache.render(i3GEOF.etiqueta.MUSTACHE, i3GEOF.etiqueta.mustacheHash()); - return ins; - }, - /* + */ + html:function() { + var ins = Mustache.render(i3GEOF.etiqueta.MUSTACHE, i3GEOF.etiqueta.mustacheHash()); + return ins; + }, + /* Function: iniciaJanelaFlutuante Cria a janela flutuante para controle da ferramenta. - */ - iniciaJanelaFlutuante: function(){ - var minimiza,cabecalho,janela,divid,temp,titulo; - if($i("i3GEOF.etiqueta")){ - i3GEOF.etiqueta.inicia("i3GEOF.etiqueta_corpo"); - return; - } - cabecalho = function(){ - i3GEOF.etiqueta.ativaFoco(); - }; - minimiza = function(){ - i3GEO.janela.minimiza("i3GEOF.etiqueta"); - }; - //cria a janela flutuante - titulo = ""+$trad("d7at")+""; - janela = i3GEO.janela.cria( - "510px", - "300px", - "", - "", - "", - titulo, - "i3GEOF.etiqueta", - false, - "hd", - cabecalho, - minimiza, - "", - true, - "", - "", - "", - "", - "37" - ); - divid = janela[2].id; - i3GEOF.etiqueta.aguarde = $i("i3GEOF.etiqueta_imagemCabecalho").style; - $i("i3GEOF.etiqueta_corpo").style.backgroundColor = "white"; - i3GEOF.etiqueta.inicia(divid); - }, - /* + */ + iniciaJanelaFlutuante: function(){ + var minimiza,cabecalho,janela,divid,temp,titulo; + if($i("i3GEOF.etiqueta")){ + i3GEOF.etiqueta.inicia("i3GEOF.etiqueta_corpo"); + return; + } + cabecalho = function(){ + i3GEOF.etiqueta.ativaFoco(); + }; + minimiza = function(){ + i3GEO.janela.minimiza("i3GEOF.etiqueta"); + }; + //cria a janela flutuante + titulo = ""+$trad("d7at")+""; + janela = i3GEO.janela.cria( + "600px", + "380px", + "", + "", + "", + titulo, + "i3GEOF.etiqueta", + false, + "hd", + cabecalho, + minimiza, + "", + true, + "", + "", + "", + "", + "37" + ); + divid = janela[2].id; + i3GEOF.etiqueta.aguarde = $i("i3GEOF.etiqueta_imagemCabecalho").style; + $i("i3GEOF.etiqueta_corpo").style.backgroundColor = "white"; + i3GEOF.etiqueta.inicia(divid); + }, + /* Function: ativaFoco Refaz a interface da ferramenta quando a janela flutuante tem seu foco ativado - */ - ativaFoco: function(){ - if(i3GEO.temaAtivo != ""){ - i3GEO.php.listaItensTema(i3GEOF.etiqueta.montaListaItens,i3GEOF.etiqueta.tema); - } - }, - pegaDadosEtiquetas: function(funcao){ - var cp = new cpaint(), - p; - p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=pegaDadosEtiquetas&tema="+i3GEOF.etiqueta.tema; - cp.set_response_type("JSON"); - cp.call(p,"etiqueta",funcao); - }, - /* + */ + ativaFoco: function(){ + if(i3GEO.temaAtivo != ""){ + i3GEO.php.listaItensTema(i3GEOF.etiqueta.montaListaItens,i3GEOF.etiqueta.tema); + } + }, + pegaDadosEtiquetas: function(funcao){ + var cp = new cpaint(), + p; + p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=pegaDadosEtiquetas&tema="+i3GEOF.etiqueta.tema; + cp.set_response_type("JSON"); + cp.call(p,"etiqueta",funcao); + }, + /* Function: montaListaItens Monta a lista de itens que poderão ser escolhidos para compor o mapa. @@ -192,122 +192,134 @@ i3GEOF.etiqueta = { A lista é inserida no elemento html com id "i3GEOetiquetalistai" @TODO verificar quando um item ja esta na lista e marca-lo no checkbox - */ - montaListaItens: function(retorno){ - var funcao = function(dadosItens){ - var mustache = [], ins,i,n,itensatuais,item, ck = '',lista, temp; - lista = dadosItens.data; - try{ - itensatuais = i3GEO.arvoreDeCamadas.pegaTema(i3GEO.temaAtivo); - itensatuais = itensatuais.etiquetas.split(","); - n = retorno.data.valores.length; - for (i=0;i - */ - ativa: function(){ - try{ - if(i3GEOF.etiqueta.aguarde.visibility === "visible") - {return;} - var lista = i3GEOF.etiqueta.pegaItensMarcados(), - cp = new cpaint(), - temp, - p; - - i3GEOF.etiqueta.aguarde.visibility = "visible"; - temp = function(retorno){ - i3GEOF.etiqueta.aguarde.visibility = "hidden"; - i3GEO.atualiza(retorno); - i3GEO.php.listaItensTema(i3GEOF.etiqueta.montaListaItens,i3GEO.temaAtivo); - }; - p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid=" - + i3GEO.configura.sid - + "&funcao=ativaEtiquetas&tema=" - + i3GEOF.etiqueta.tema - + "&tips="+lista[0].toString(",") - + "&itens="+lista[1].toString(",") - //+ "&itensdesc="+i3GEO.util.base64encode(lista[2].toString(",")) - //+ "&itenslink="+i3GEO.util.base64encode(lista[3].toString(",")) - + "&itensdesc="+lista[2].toString(",") - + "&itenslink="+lista[3].toString(",") - + "&itembuscarapida="+lista[4]; - cp.set_response_type("JSON"); - cp.set_transfer_mode('POST'); - cp.call(p,"etiqueta",temp); - }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.etiqueta.aguarde.visibility = "hidden";} - }, - /* + */ + ativa: function(){ + try{ + if(i3GEOF.etiqueta.aguarde.visibility === "visible") + {return;} + var lista = i3GEOF.etiqueta.pegaItensMarcados(), + cp = new cpaint(), + temp, + p; + + i3GEOF.etiqueta.aguarde.visibility = "visible"; + temp = function(retorno){ + i3GEOF.etiqueta.aguarde.visibility = "hidden"; + i3GEO.atualiza(retorno); + i3GEO.php.listaItensTema(i3GEOF.etiqueta.montaListaItens,i3GEO.temaAtivo); + }; + p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid=" + + i3GEO.configura.sid + + "&funcao=ativaEtiquetas&tema=" + + i3GEOF.etiqueta.tema + + "&tips="+lista[0].toString(",") + + "&itens="+lista[1].toString(",") + //+ "&itensdesc="+i3GEO.util.base64encode(lista[2].toString(",")) + //+ "&itenslink="+i3GEO.util.base64encode(lista[3].toString(",")) + + "&itensdesc="+lista[2].toString(",") + + "&itenslink="+lista[3].toString(",") + + "&itembuscarapida="+lista[4] + + "&utfdata="+lista[5]; + cp.set_response_type("JSON"); + cp.set_transfer_mode('POST'); + cp.call(p,"etiqueta",temp); + }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.etiqueta.aguarde.visibility = "hidden";} + }, + /* Function: desativa Desativa as etiqueta do tema ativo @@ -355,22 +368,22 @@ i3GEOF.etiqueta = { Veja: - */ - desativa: function(){ - try{ - if(i3GEOF.etiqueta.aguarde.visibility === "visible") - {return;} - var cp = new cpaint(), - temp, - p; - i3GEOF.etiqueta.aguarde.visibility = "visible"; - temp = function(retorno){ - i3GEOF.etiqueta.aguarde.visibility = "hidden"; - i3GEO.atualiza(retorno); - }; - p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=removeEtiquetas&tema="+i3GEOF.etiqueta.tema; - cp.set_response_type("JSON"); - cp.call(p,"etiqueta",temp); - }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.etiqueta.aguarde.visibility = "hidden";} - } + */ + desativa: function(){ + try{ + if(i3GEOF.etiqueta.aguarde.visibility === "visible") + {return;} + var cp = new cpaint(), + temp, + p; + i3GEOF.etiqueta.aguarde.visibility = "visible"; + temp = function(retorno){ + i3GEOF.etiqueta.aguarde.visibility = "hidden"; + i3GEO.atualiza(retorno); + }; + p = i3GEO.configura.locaplic+"/ferramentas/etiqueta/exec.php?g_sid="+i3GEO.configura.sid+"&funcao=removeEtiquetas&tema="+i3GEOF.etiqueta.tema; + cp.set_response_type("JSON"); + cp.call(p,"etiqueta",temp); + }catch(e){i3GEO.janela.tempoMsg("Erro: "+e);i3GEOF.etiqueta.aguarde.visibility = "hidden";} + } }; \ No newline at end of file diff --git a/ferramentas/etiqueta/templateLista_mst.html b/ferramentas/etiqueta/templateLista_mst.html index 3a08bc1..6d39a0b 100755 --- a/ferramentas/etiqueta/templateLista_mst.html +++ b/ferramentas/etiqueta/templateLista_mst.html @@ -2,16 +2,17 @@ - - - - - + + + + + + {{#linhas}} +
ColunaIdentificaTipBuscaAliasLinkIdentificaTip (quando clicar)Tip (dinâmico)BuscaAliasLink
{{{item}}} -
+
-
+
+
+ +
+
-
+
diff --git a/temas/_lbiomashp.map b/temas/_lbiomashp.map index 8efd12b..a89bdc1 100755 --- a/temas/_lbiomashp.map +++ b/temas/_lbiomashp.map @@ -9,29 +9,21 @@ MAP DATA "/var/www/i3geo/aplicmap/dados/biomas.shp" METADATA "cache" "nao" - "TIP" "CD_LEGENDA" "CLASSE" "SIM" - "olopacity" "" "animagif" "" "permitekmz" "SIM" - "gmopacity" "" - "gmstatus" "" "ITENSDESC" "Teste de acentuação" "editavel" "" "ESCALA" "250000" "TILES" "SIM" - "arquivotemaoriginal" "" "extensao" "-73.990940816816 -33.74827031115 -34.822855820777 5.272224303909" - "nomeoriginal" "" - "olstatus" "" "FUNCOESJS" '[{"titulo":"teste fake"},{"titulo":"teste de nome de uma função","script":"../aplicmap/dados/testefuncaojs.js","funcao":"funcao1","parametros":["CD_LEGENDA"]}]' "permitedownload" "SIM" - "FILTROORIGINAL" "" "permitecomentario" "NAO" - "DATAORIGINAL" "" "escondido" "NAO" "esquematabelaeditavel" "" "download" "SIM" + "UTFDATA" "" "itembuscarapida" "CD_LEGENDA" "tme" "" "ITENS" "CD_LEGENDA" -- libgit2 0.21.2