Commit 9d8ec701b6556fb118fada4b1d5278d36b1f1049

Authored by Edmar Moretti
1 parent 43030d74

Inclusão de variável para definir se haverá ou não registro no banco de dados qu…

…ando uma camada é adicionada ao mapa
Showing 69 changed files with 480 additions and 529 deletions   Show diff stats
admin/php/admin.php
... ... @@ -194,7 +194,7 @@ function pegaDados($sql,$dbh="",$close=true)
194 194 $resultado = array();
195 195 //is_string para efeitos de compatibilidade
196 196 if($dbh == "" || is_string($dbh)){
197   - include(dirname(__FILE__)."/conexao.php");
  197 + include(dirname(__FILE__)."/../adin1/php/conexao.php");
198 198 }
199 199 error_reporting(0);
200 200 //$dbh deve ser definido com somente leitura, mas por prevencao:
... ...
admin/php/webservices.php 0 → 100755
... ... @@ -0,0 +1,166 @@
  1 +<?php
  2 +/*
  3 + Title: webservices.php
  4 +
  5 +Fun&ccedil;&otilde;es utilizadas pelo editor do cadastro de Web Services
  6 +
  7 +&Eacute; utilizado nas fun&ccedil;&otilde;es em AJAX da interface de edi&ccedil;&atilde;o
  8 +
  9 +Licenca:
  10 +
  11 +GPL2
  12 +
  13 +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  14 +
  15 +Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente Brasil
  16 +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
  17 +
  18 +Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo
  19 +e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral
  20 +GNU conforme publicada pela Free Software Foundation;
  21 +
  22 +Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til,
  23 +por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita
  24 +de COMERCIABILIDADE OU ADEQUA&Ccedil;&Atilde;O A UMA FINALIDADE ESPEC&Iacute;FICA.
  25 +Consulte a Licen&ccedil;a P&uacute;blica Geral do GNU para mais detalhes.
  26 +Voc&ecirc; deve ter recebido uma cópia da Licen&ccedil;a P&uacute;blica Geral do
  27 + GNU junto com este programa; se n&atilde;o, escreva para a
  28 +Free Software Foundation, Inc., no endere&ccedil;o
  29 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  30 +
  31 +Arquivo:
  32 +
  33 +i3geo/admin/php/webservices.php
  34 +
  35 +Parametros:
  36 +
  37 +O par&acirc;metro principal &eacute; "funcao", que define qual opera&ccedil;&atilde;o ser&aacute; executada, por exemplo, webservices.php?funcao=pegaws
  38 +
  39 +Cada opera&ccedil;&atilde;o possu&iacute; seus próprios par&acirc;metros, que devem ser enviados tamb&eacute;m na requisi&ccedil;&atilde;o da opera&ccedil;&atilde;o.
  40 +
  41 +*/
  42 +error_reporting(0);
  43 +//
  44 +//n&atilde;o sei pq mas ob_start e clean s&atilde;o necess&aacute;rios no Linux para n&atilde;o gerar erro indesejado
  45 +//
  46 +include_once(dirname(__FILE__)."/login.php");
  47 +
  48 +$id_ws = $_GET["id_ws"];
  49 +$id = $_GET["id"];
  50 +
  51 +testaSafeNumerico([$id,$id_ws]);
  52 +
  53 +$funcoesEdicao = array(
  54 + "ALTERARWS",
  55 + "EXCLUIR"
  56 +);
  57 +if(in_array(strtoupper($funcao),$funcoesEdicao)){
  58 + if(verificaOperacaoSessao("admin/html/webservices") == false){
  59 + retornaJSON("Vc nao pode realizar essa operacao.");exit;
  60 + }
  61 +}
  62 +//faz a busca da fun&ccedil;&atilde;o que deve ser executada
  63 +switch (strtoupper($funcao))
  64 +{
  65 + /*
  66 + Note:
  67 +
  68 + Valores que o par&acirc;metro &funcao pode receber. Os par&acirc;metros devem ser enviados na requisi&ccedil;&atilde;o em AJAX.
  69 + */
  70 + /*
  71 + Valor: PEGAWS
  72 +
  73 + Lista de servi&ccedil;os cadastrados
  74 +
  75 + Retorno:
  76 +
  77 + {JSON}
  78 + */
  79 + case "PEGAWS":
  80 + if(isset($tipows) && $tipows != "") {
  81 + $sql = "SELECT id_ws,nome_ws,tipo_ws from ".$esquemaadmin."i3geoadmin_ws where tipo_ws = '".strtoupper($_GET["tipows"])."' order by tipo_ws,nome_ws ";
  82 + }
  83 + else{
  84 + $sql = "SELECT id_ws,nome_ws,tipo_ws from ".$esquemaadmin."i3geoadmin_ws order by tipo_ws,nome_ws";
  85 + }
  86 + retornaJSON(pegaDados($sql));
  87 + exit;
  88 + break;
  89 + /*
  90 + Valor: PEGADADOS
  91 +
  92 + Dados de um servico
  93 +
  94 + Parametro:
  95 +
  96 + id_ws {string}
  97 +
  98 + Retorno:
  99 +
  100 + {JSON}
  101 + */
  102 + case "PEGADADOS":
  103 + retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_ws where id_ws='$id_ws'"));
  104 + exit;
  105 + break;
  106 + /*
  107 + Valor: ALTERARWS
  108 +
  109 + Altera um registro
  110 +
  111 + Parametros:
  112 +
  113 + id_ws
  114 +
  115 + desc_ws
  116 +
  117 + nome_ws
  118 +
  119 + link_ws
  120 +
  121 + autor_ws
  122 +
  123 + tipo_ws
  124 +
  125 + Retorno:
  126 +
  127 + {JSON}
  128 + */
  129 + case "ALTERARWS":
  130 + $novo = alterarWS();
  131 + $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_ws WHERE id_ws = '".$novo."'";
  132 + retornaJSON(pegaDados($sql));
  133 + exit;
  134 + break;
  135 + /*
  136 + Valor: EXCLUIR
  137 +
  138 + Exclui um registro
  139 +
  140 + Parametro:
  141 +
  142 + id {string}
  143 +
  144 + Retorno:
  145 +
  146 + {JSON}
  147 + */
  148 + case "EXCLUIR":
  149 + retornaJSON(excluirWS());
  150 + exit;
  151 + break;
  152 +
  153 +}
  154 +/*
  155 + Altera o registro de um WS
  156 +*/
  157 +function alterarWS(){
  158 + return;
  159 +}
  160 +function excluirWS(){
  161 + return;
  162 +}
  163 +function adicionaAcesso($id_ws,$sucesso){
  164 + return;
  165 +}
  166 +?>
0 167 \ No newline at end of file
... ...
classesphp/classe_mapa.php
... ... @@ -73,6 +73,7 @@ class Mapa
73 73 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
74 74 */
75 75 public $vi;
  76 + public $i3GeoRegistraAcesso;
76 77 /*
77 78 Function: __construct
78 79  
... ... @@ -85,7 +86,9 @@ class Mapa
85 86 function __construct($map_file,$locaplic="")
86 87 {
87 88 include(dirname(__FILE__)."/../ms_configura.php");
88   - $this->postgis_mapa = $postgis_mapa;
  89 +
  90 + $this->postgis_mapa = $postgis_mapa;
  91 + $this->i3GeoRegistraAcesso = $i3GeoRegistraAcesso;
89 92  
90 93 if (!function_exists('ms_newMapObj')) {
91 94 return false;
... ... @@ -1103,7 +1106,7 @@ class Mapa
1103 1106 }
1104 1107 if($incluitexto == "sim"){
1105 1108 if($this->vi >= 60300){
1106   - $classe->addLabel(new labelObj());
  1109 + $classe->addLabel(new labelObj());
1107 1110 $label = $classe->getLabel(0);
1108 1111 $s = "CLASS LABEL END END";
1109 1112 $classe->updateFromString($s);
... ... @@ -1190,7 +1193,7 @@ class Mapa
1190 1193 $temas = explode(",",$temas);
1191 1194 $zoomlayer = "";
1192 1195 foreach ($temas as $nome){
1193   - $this->adicionaAcesso($nome,$locaplic);
  1196 + $this->adicionaAcesso($nome,$locaplic,$this->i3GeoRegistraAcesso);
1194 1197 $nomemap = "";
1195 1198 //
1196 1199 //verifica se o tema &eacute; um arquivo php
... ... @@ -1209,53 +1212,7 @@ class Mapa
1209 1212 }
1210 1213 }
1211 1214 if($extensao == ".gvp"){
1212   - if (file_exists($locaplic."/temas/".$nome.".gvp")){
1213   - $nomemap = $locaplic."/temas/".$nome.".gvp";
1214   - }
1215   - if (file_exists($nome)){
1216   - $nomemap = $nome;
1217   - }
1218   - if (file_exists($nome.".gvp")){
1219   - $nomemap = $nome.".gvp";
1220   - }
1221   - if ($nomemap != ""){
1222   - include_once($locaplic."/pacotes/gvsig/gvsig2mapfile/class.gvsig2mapfile.php");
1223   - $gm = new gvsig2mapfile($nomemap);
1224   - $gvsigview = $gm->getViewsNames();
1225   - foreach($gvsigview as $gv){
1226   - $dataView = $gm->getViewData($gv);
1227   - $adicionar = array();
1228   - foreach($dataView["layerNames"] as $t){
1229   - if(!in_array($t,$this->nomes)){
1230   - $adicionar[] = $t;
1231   - }
1232   - }
1233   - $this->mapa = $gm->addLayers($this->mapa,$gv,$adicionar);
1234   - }
1235   - foreach($adicionar as $nome){
1236   - $l = $this->mapa->getlayerbyname($nome);
1237   - //reposiciona o layer se for o caso
1238   - if ($l->group == ""){
1239   - $ltipo = $l->type;
1240   - if (($ltipo == 2) || ($ltipo == 3)){//poligono = 2
1241   - $indicel = $l->index;
1242   - $numlayers = $this->mapa->numlayers;
1243   - $nummove = 0;
1244   - for ($i = $numlayers-1;$i > 0;$i--){
1245   - $layerAbaixo = $this->mapa->getlayer($i);
1246   - $tipo = $layerAbaixo->type;
1247   - if (($tipo != 2) && ($tipo != 3)){
1248   - $nummove++;
1249   - }
1250   - }
1251   - for ($i=0;$i<($nummove);++$i){
1252   - $indicel = $l->index;
1253   - $this->mapa->movelayerup($indicel);
1254   - }
1255   - }
1256   - }
1257   - }
1258   - }
  1215 + return;
1259 1216 }
1260 1217 if($extensao == ".map"){
1261 1218 if (file_exists($locaplic."/temas/".$nome.".map")){
... ... @@ -1538,10 +1495,12 @@ class Mapa
1538 1495 if($versao == ""){
1539 1496 $versao = "1.1.1";
1540 1497 }
1541   - if(file_exists($this->locaplic."/classesphp/wmswfs.php"))
  1498 + if(file_exists($this->locaplic."/classesphp/wmswfs.php")){
1542 1499 include_once($this->locaplic."/classesphp/wmswfs.php");
1543   - else
  1500 + }
  1501 + else {
1544 1502 include_once("wmswfs.php");
  1503 + }
1545 1504 //limpa selecao
1546 1505 if (file_exists($this->qyfile))
1547 1506 {
... ... @@ -2080,10 +2039,13 @@ class Mapa
2080 2039 }
2081 2040 return("ok");
2082 2041 }
2083   - function adicionaAcesso($codigo_tema,$locaplic)
  2042 + function adicionaAcesso($codigo_tema,$locaplic,$i3GeoRegistraAcesso=false)
2084 2043 {
2085   - $resultado = array();
2086   - include("$locaplic/admin/php/conexao.php");
  2044 + if($i3GeoRegistraAcesso == false){
  2045 + return;
  2046 + }
  2047 + $resultado = array();
  2048 + include("$locaplic/classesphp/conexao.php");
2087 2049 if(!empty($esquemaadmin)){
2088 2050 $esquemaadmin = str_replace(".","",$esquemaadmin).".";
2089 2051 }
... ...
classesphp/classe_metaestatinfo.php
... ... @@ -35,7 +35,7 @@ class MetaestatInfo{
35 35 * Faz o include de conexao.php que por sua vez faz o include de i3geo/ms_configura.php
36 36 */
37 37 function __construct(){
38   - include(dirname(__FILE__)."/../admin/php/conexao.php");
  38 + include(dirname(__FILE__)."/conexao.php");
39 39 //vem do include
40 40 $this->dir_tmp = $dir_tmp;
41 41 $this->logTransacoes = $logTransacoes;
... ...
classesphp/conexao.php 0 → 100755
... ... @@ -0,0 +1,74 @@
  1 +<?php
  2 +//
  3 +//Em admin existe tambem um conexao.php, mas ele nao faz a critica a variavel $i3GeoRegistraAcesso
  4 +//
  5 +//classesphp/conexao.php e utilizado preferencialmente para acesso de apenas leitura ao sistema de administracao
  6 +//
  7 +include(dirname(__FILE__)."/../ms_configura.php");
  8 +if(!isset($i3GeoRegistraAcesso)){
  9 + $i3GeoRegistraAcesso = false;
  10 +}
  11 +if(!isset($conexaoadmin)){
  12 + $conexaoadmin = "";
  13 +}
  14 +if(!isset($esquemaadmin)){
  15 + $esquemaadmin = "";
  16 +}
  17 +if($esquemaadmin != ""){
  18 + $esquemaadmin = str_replace(".","",$esquemaadmin).".";
  19 +}
  20 +if(!isset($logTransacoes)){
  21 + $logTransacoes = false;
  22 +}
  23 +//
  24 +//indica se deve ser feita a convers&atilde;o para UTF8 ao gravar os dados
  25 +//
  26 +$convUTF = true;
  27 +if($conexaoadmin == ""){
  28 + $arquivosqlite = $locaplic."/admin/admin.db";
  29 + //chmod($arquivosqlite,0774);
  30 + //echo $arquivosqlite;exit;
  31 + if(!file_exists($arquivosqlite)){
  32 + echo "O arquivo admin.db n&atilde;o existe. Utilize i3geo/admin/criabanco.php para criar o banco de dados SQLITE.";
  33 + exit;
  34 + }
  35 + $conAdmin = "sqlite:$arquivosqlite";
  36 + $conAdminw = "sqlite:$arquivosqlite";
  37 + if(!extension_loaded("PDO")){
  38 + echo "<span style=color:red >A extensao do PHP 'PDO' nao esta instalada.";
  39 + exit;
  40 + }
  41 + if (!extension_loaded( "pdo_sqlite")){
  42 + echo "<span style=color:red >Problema: n&atilde;o est&aacute; instalado a pdo_sqlite<br></span>";
  43 + exit;
  44 + }
  45 + if (!extension_loaded( "SQLite") && !extension_loaded( "sqlite3")){
  46 + echo "<span style=color:red >Problema: n&atilde;o est&aacute; instalado a SQLite<br></span>";
  47 + exit;
  48 + }
  49 + try {
  50 + //para escrita
  51 + $dbhw = new PDO($conAdminw);
  52 + //para leitura
  53 + $dbh = new PDO($conAdmin);
  54 + if($i3GeoRegistraAcesso == false){
  55 + $dbhw = $dbh;
  56 + }
  57 + }
  58 + catch (PDOException $e) {
  59 + print "Erro ao criar o objeto PDO!: <br/> Talvez exista alguma incompatibilidade entre o PHP e o banco admin.db. Vc pode apagar o arquivo menutemas/admin.db e recria-lo com admin/php/criasqlite.php";
  60 + die();
  61 + }
  62 +}
  63 +else {
  64 + if(file_exists($conexaoadmin)){
  65 + include($conexaoadmin);
  66 + if($i3GeoRegistraAcesso == false){
  67 + $dbhw = $dbh;
  68 + }
  69 + } else {
  70 + echo "Arquivo de conexao nao existe";
  71 + exit;
  72 + }
  73 +}
  74 +?>
0 75 \ No newline at end of file
... ...
classesphp/funcoes_gerais.php
... ... @@ -3034,7 +3034,7 @@ function restauraMapaAdmin($id_mapa,$dir_tmp){
3034 3034 if (filter_var($id_mapa, FILTER_VALIDATE_INT) === false){
3035 3035 exit;
3036 3036 }
3037   - include(dirname(__FILE__)."/../admin/php/conexao.php");
  3037 + include(dirname(__FILE__)."/classesphp/conexao.php");
3038 3038 if(!empty($esquemaadmin)){
3039 3039 $esquemaadmin = str_replace(".","",$esquemaadmin).".";
3040 3040 }
... ... @@ -3120,7 +3120,7 @@ Array originada de fetchAll
3120 3120 function pegaDadosAdminKey($sql,$subsEsquema){
3121 3121 //pegaDadosAdminKey("select codigo_tema,link_tema from __esq__i3geoadmin_temas","__esq__");
3122 3122 $resultado = array();
3123   - include(dirname(__FILE__)."/../admin/php/conexao.php");
  3123 + include(dirname(__FILE__)."/classesphp/conexao.php");
3124 3124 $sql = str_replace($subsEsquema,$esquemaadmin,$sql);
3125 3125 //error_reporting(0);
3126 3126 $q = $dbh->query($sql,PDO::FETCH_ASSOC);
... ...
classesphp/wmswfs.php
... ... @@ -359,6 +359,7 @@ function temaswms() {
359 359 // Test that the capabilites file has successfully downloaded.
360 360 //
361 361 // $wms_service_request = "c://temp//teste.xml";
  362 +
362 363 if (file_exists ( dirname ( __FILE__ ) . "/../admin1/cadastros/servicos/exec.php" )) {
363 364 include_once (dirname ( __FILE__ ) . "/../admin1/cadastros/servicos/exec.php");
364 365 } else {
... ... @@ -369,15 +370,8 @@ function temaswms() {
369 370 // error_reporting(0);
370 371 if ($wms_service_request == "erro") {
371 372 // Cannot download the capabilities file.
372   - // registra a tentativa de acesso
373   - if (isset ( $id_ws )) {
374   - adicionaAcesso ( $id_ws, false );
375   - }
376 373 $cp->set_data ( "Erro de acesso" );
377 374 return;
378   - } elseif (isset ( $id_ws )) {
379   - if ($id_ws != "")
380   - adicionaAcesso ( $id_ws, true );
381 375 }
382 376 $handle = fopen ( $wms_service_request, "r" );
383 377 $wms_capabilities = fread ( $handle, filesize ( $wms_service_request ) );
... ... @@ -508,22 +502,12 @@ function listaLayersWMS() {
508 502 }
509 503 // para o caso do sistema de metadados estatisticos
510 504 $wms_service_request = gravaCacheWMS ( $servico );
511   - include_once (dirname ( __FILE__ ) . "/../admin/php/admin.php");
512   - include_once (dirname ( __FILE__ ) . "/../admin/php/webservices.php");
513   -
514 505 if ($tipo_ws != "WMSMETAESTAT" && $nivel < 2) {
515 506 if ($wms_service_request == "erro") {
516   - // registra a tentativa de acesso
517   - if (isset ( $id_ws )) {
518   - adicionaAcesso ( $id_ws, false );
519   - }
520 507 $cp->set_data ( "Erro de acesso" );
521 508 return;
522   - } elseif (isset ( $id_ws )) {
523   - adicionaAcesso ( $id_ws, true );
524 509 }
525 510 }
526   -
527 511 $handle = fopen ( $wms_service_request, "r" );
528 512 $wms_capabilities = fread ( $handle, filesize ( $wms_service_request ) );
529 513 fclose ( $handle );
... ...
css/i3geo7.css.php 100755 → 100644
ferramentas/abrefontemapfile.php
... ... @@ -57,7 +57,7 @@ body {
57 57 echo "Nenhum tema definido.";exit;
58 58 }
59 59 $dbh = "";
60   - include($locaplic."/admin/php/conexao.php");
  60 + include($locaplic."/classesphp/conexao.php");
61 61 $r = pegaDados("select link_tema from ".$esquemaadmin."i3geoadmin_temas where codigo_tema = '$tema'");
62 62 error_reporting(0);
63 63 $link = $r[0]["link_tema"];
... ...
ferramentas/editorgm/editorgm_compacto.js 100755 → 100644
ferramentas/editorol/editorol.js
... ... @@ -55,8 +55,8 @@ if (!i3GEO || typeof (i3GEO) === &#39;undefined&#39;) {
55 55 navm = true;
56 56 }
57 57 }
58   -i3GEO.editorOL =
59   -{
  58 +i3GEO.editorOL = {
  59 + interacoes: "",
60 60 MUSTACHESALVAGEOMETRIAS: "",
61 61 MUSTACHEFERRAMENTAS: "",
62 62 MUSTACHEPROPRIEDADES: "",
... ... @@ -84,150 +84,13 @@ i3GEO.editorOL =
84 84 //map : i3geoOL,
85 85 visible : false
86 86 }),
87   - e_oce : new ol.layer.Tile({
88   - title : "ESRI Ocean Basemap",
89   - visible : false,
90   - isBaseLayer : true,
91   - name : "oce",
92   - source : new ol.source.TileArcGISRest({
93   - url : "http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer",
94   - attributions: [
95   - new ol.Attribution({
96   - html: 'Tiles &copy; <a href="http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer">ArcGIS</a>'
97   - })
98   - ]
99   - })
100   - }),
101   - e_ims : new ol.layer.Tile({
102   - title : "ESRI Imagery World 2D",
103   - visible : false,
104   - isBaseLayer : true,
105   - name : "ims",
106   - source : new ol.source.TileArcGISRest({
107   - url : "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer",
108   - attributions: [
109   - new ol.Attribution({
110   - html: 'Tiles &copy; <a href="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer">ArcGIS</a>'
111   - })
112   - ]
113   - })
114   - }),
115   - e_wsm : new ol.layer.Tile({
116   - title : "ESRI World Street Map",
117   - visible : false,
118   - isBaseLayer : true,
119   - name : "wsm",
120   - source : new ol.source.TileArcGISRest({
121   - url : "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer",
122   - attributions: [
123   - new ol.Attribution({
124   - html: 'Tiles &copy; <a href="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer">ArcGIS</a>'
125   - })
126   - ]
127   - })
128   - }),
129   - ol_mma : new ol.layer.Tile({
130   - title : "Base carto MMA",
131   - visible : false,
132   - isBaseLayer : true,
133   - name : "bra",
134   - source : new ol.source.TileWMS({
135   - url : "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",
136   - params : {
137   - 'layers' : "baseraster",
138   - 'srs' : "EPSG:4326",
139   - 'format' : "image/png"
140   - }
141   - })
142   - }),
143   - e_tms : new ol.layer.Tile({
144   - title : "OSGEO",
145   - visible : false,
146   - isBaseLayer : true,
147   - name : "tms",
148   - source : new ol.source.TileWMS({
149   - url : "http://tilecache.osgeo.org/wms-c/Basic.py/",
150   - params : {
151   - 'layers' : "basic",
152   - 'type' : "png",
153   - 'srs' : "EPSG:4326",
154   - 'format' : "image/png",
155   - 'VERSION' : '1.1.1'
156   - },
157   - attributions: [
158   - new ol.Attribution({
159   - html: '&copy; <a href="http://www.tilecache.org/">2006-2010, TileCache Contributors</a>'
160   - })
161   - ]
162   - })
163   - }),
164   - top_wms : new ol.layer.Tile({
165   - title : "Topon&iacute;mia MMA",
166   - visible : false,
167   - isBaseLayer : true,
168   - name : "bra",
169   - source : new ol.source.TileWMS({
170   - url : "http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&",
171   - params : {
172   - 'layers' : "base",
173   - 'srs' : "EPSG:4326",
174   - 'format' : "image/png"
175   - }
176   - })
177   - }),
178   - est_wms : new ol.layer.Tile({
179   - title : "Estados do Brasil",
180   - visible : false,
181   - isBaseLayer : true,
182   - name : "bra",
183   - source : new ol.source.TileWMS({
184   - url : "http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&",
185   - params : {
186   - 'layers' : "estadosl",
187   - 'srs' : "EPSG:4326",
188   - 'format' : "image/png"
189   - }
190   - })
191   - }),
192   - fundo: "e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms,e_oce",
  87 + fundo: "",
193 88 nomeFuncaoSalvar : "i3GEO.editorOL.salvaGeo()",
194 89 kml : [],
195 90 layersIniciais : [],
196 91 //essa configuracao dos botoes afeta apenas o mashup
197 92 //para a configuração do editor dentro de um mapa normal, veja i3GEO.editor.ativaPainel()
198   - botoes : {
199   - 'imprimir': false,
200   - 'grid': false,
201   - 'pan' : false,
202   - 'zoombox' : false,
203   - 'zoomtot' : false,
204   - 'zoomin' : false,
205   - 'zoomout' : false,
206   - 'distancia' : false,
207   - 'area' : false,
208   - 'identifica' : false,
209   - 'linha' : true,
210   - 'ponto' : true,
211   - 'poligono' : true,
212   - 'texto' : true,
213   - 'edita' : true,
214   - 'listag' : true,
215   - 'corta' : true,
216   - 'apaga' : true,
217   - 'procura' : false,
218   - 'selecao' : true,
219   - 'selecaotudo' : true,
220   - 'salva' : true,
221   - 'ajuda' : true,
222   - 'propriedades' : true,
223   - 'fecha' : false,
224   - 'tools' : true,
225   - 'undo' : false,
226   - 'frente' : false,
227   - 'legenda' : false,
228   - 'rodadomouse' : true,
229   - 'novaaba' : false
230   - },
  93 + botoes : {},
231 94 pontos : [],
232 95 marca : "../pacotes/openlayers/img/marker-gold.png",
233 96 controles : [],
... ... @@ -281,136 +144,6 @@ i3GEO.editorOL =
281 144  
282 145 i3GEO.Interface.openlayers.cria();
283 146 i3GEO.editorOL.mapa = i3geoOL;
284   -
285   - // ativabotoes e boolean
286   - if(i3GEO.editorOL.controles.length === 0){
287   - i3GEO.editorOL.controles = [
288   - new ol.interaction.DoubleClickZoom(),
289   - new ol.interaction.KeyboardPan(),
290   - new ol.interaction.KeyboardZoom(),
291   - new ol.interaction.MouseWheelZoom(),
292   - new ol.interaction.PinchRotate(),
293   - new ol.interaction.PinchZoom(),
294   - new ol.interaction.DragZoom(),
295   - new ol.interaction.DragPan(),
296   - new ol.control.Zoom(),
297   - new ol.control.ZoomSlider(),
298   - new ol.control.ScaleLine()
299   - ];
300   - }
301   - var alayers = [], fundo = (i3GEO.editorOL.fundo).split(","), nfundo = fundo.length, ncontroles =
302   - i3GEO.editorOL.controles.length, i, n, temp;
303   -
304   - if (i3GEO.editorOL.ativarodadomouse === "false") {
305   - i3GEO.editorOL.ativarodadomouse = false;
306   - }
307   - if (i3GEO.editorOL.ativarodadomouse === "true") {
308   - i3GEO.editorOL.ativarodadomouse = true;
309   - }
310   - if (i3GEO.editorOL.legendahtml === "false") {
311   - i3GEO.editorOL.legendahtml = false;
312   - }
313   - if (i3GEO.editorOL.legendahtml === "true") {
314   - i3GEO.editorOL.legendahtml = true;
315   - }
316   -
317   - if (i3GEO.editorOL.incluilayergrafico === "false") {
318   - i3GEO.editorOL.incluilayergrafico = false;
319   - }
320   - if (i3GEO.editorOL.incluilayergrafico === "true") {
321   - i3GEO.editorOL.incluilayergrafico = true;
322   - }
323   - if (i3GEO.editorOL.incluilayergrafico === true) {
324   - if (!i3GEO.desenho.layergrafico) {
325   - i3GEO.editorOL.criaLayerGrafico();
326   - }
327   - } else {
328   - i3GEO.desenho.layergrafico = "";
329   - i3GEO.editorOL.botoes.linha = false;
330   - i3GEO.editorOL.botoes.ponto = false;
331   - i3GEO.editorOL.botoes.poligono = false;
332   - i3GEO.editorOL.botoes.texto = false;
333   - i3GEO.editorOL.botoes.edita = false;
334   - i3GEO.editorOL.botoes.listag = false;
335   - i3GEO.editorOL.botoes.corta = false;
336   - i3GEO.editorOL.botoes.apaga = false;
337   - i3GEO.editorOL.botoes.selecao = false;
338   - i3GEO.editorOL.botoes.selecaotudo = false;
339   - i3GEO.editorOL.botoes.salva = false;
340   - i3GEO.editorOL.botoes.propriedades = false;
341   - i3GEO.editorOL.botoes.fecha = false;
342   - i3GEO.editorOL.botoes.tools = false;
343   - i3GEO.editorOL.botoes.undo = false;
344   - i3GEO.editorOL.botoes.frente = false;
345   - i3GEO.editorOL.botoes.novaaba = false;
346   - }
347   - for (i = 0; i < ncontroles; i++) {
348   - i3GEO.editorOL.mapa.addControl(i3GEO.editorOL.controles[i]);
349   - }
350   - if (i3GEO.editorOL.fundo != "") {
351   - for (i = nfundo - 1; i >= 0; i--) {
352   - if (fundo[i] != "" && i3GEO.editorOL[fundo[i]]) {
353   - alayers.push(i3GEO.editorOL[fundo[i]]);
354   - i3GEO.editorOL[fundo[i]].setVisibility(true);
355   - }
356   - }
357   - }
358   - i3GEO.editorOL.mapa.addLayers(alayers);
359   - if (i3GEO.editorOL.layersIniciais !== "") {
360   - n = i3GEO.editorOL.layersIniciais.length;
361   - for (i = 0; i < n; i++) {
362   - // singleTile deve ser definido em cada layer
363   - // i3GEO.editorOL.layersIniciais[i].singleTile = single;
364   - i3GEO.editorOL.mapa.addLayer(i3GEO.editorOL.layersIniciais[i]);
365   - }
366   - }
367   - if (!i3GEO.desenho.layergrafico && i3GEO.editorOL.incluilayergrafico === true) {
368   - i3GEO.editorOL.mapa.addLayers([
369   - i3GEO.desenho.layergrafico
370   - ]);
371   - }
372   - i3GEO.editorOL.adicionaKml();
373   - i3GEO.editorOL.adicionaMarcas();
374   -
375   - i3GEO.editorOL.coordenadas();
376   - //i3GEO.editorOL.criaJanelaBusca();
377   - i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);
378   - if (i3GEO.editorOL.ativalayerswitcher === true) {
379   - //i3GEO.editorOL.ativaLayerSwitcher();
380   - }
381   - if (i3GEO.editorOL.ativarodadomouse === false) {
382   - i3GEO.editorOL.desativaRodaDoMouse();
383   - }
384   - //TODO testar numzoom
385   - /*
386   - if (i3GEO.editorOL.numzoom !== "") {
387   - i3GEO.editorOL.mapa.getView().setOptions({
388   - minResolution : i3GEO.editorOL.minresolution,
389   - maxResolution :
390   - });
391   - }
392   - */
393   - if (i3GEO.editorOL.maxext !== "") {
394   - i3GEO.editorOL.mapa.getView().setProperties({
395   - extent : i3GEO.editorOL.maxext
396   - });
397   - }
398   - if (i3GEO.editorOL.mapext != "") {
399   - var m = i3GEO.util.extGeo2OSM(i3GEO.editorOL.mapext);
400   - i3GEO.editorOL.mapa.zoomToExtent(m);
401   - }
402   - //i3GEO.editorOL.sobeLayersGraficos();
403   - // evita que botoes de opcoes propaguem
404   - // o mashup utiliza esse tipo de botao junto ao nome do layer
405   - temp = i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");
406   - if (temp) {
407   - temp = temp.dataLayersDiv.getElementsByTagName("label");
408   - n = temp.length;
409   - for (i = 0; i < n; i++) {
410   - // YAHOO.util.Event.addListener(temp[i], "click", YAHOO.util.Event.stopEvent);
411   - temp[i].onclick = "";
412   - }
413   - }
414 147 },
415 148 criaLayerGrafico : function() {
416 149 i3GEO.desenho.openlayers.criaLayerGrafico();
... ... @@ -1065,16 +798,9 @@ i3GEO.editorOL =
1065 798 }
1066 799 i3GEO.editorOL.removeInteracoes();
1067 800 },
1068   - //interacoes criadas ao ativar algum botao
1069   - //usado para remover as interacoes
1070   - interacoes : [],
1071 801 removeInteracoes: function(){
1072   - var i, n;
1073   - n = i3GEO.editorOL.interacoes.length;
1074   - for(i = 0; i < n; i++){
1075   - i3geoOL.removeInteraction(i3GEO.editorOL.interacoes[i]);
1076   - }
1077   - i3GEO.editorOL.interacoes = [];
  802 + i3geoOL.removeInteraction(i3GEO.editorOL.interacoes);
  803 + i3GEO.editorOL.interacoes = "";
1078 804 },
1079 805 botaoProcura : function(){
1080 806 var temp = document.createElement("div");
... ... @@ -1164,6 +890,40 @@ i3GEO.editorOL =
1164 890 };
1165 891 return temp;
1166 892 },
  893 + desenhaLinha: function(drawendcallback){
  894 + i3GEO.editorOL.removeInteracoes();
  895 + var draw = new ol.interaction.Draw({
  896 + type : "LineString"
  897 + });
  898 + //adiciona a interacao para poder ser removida
  899 + i3GEO.editorOL.interacoes = draw;
  900 + //desativa ol.interaction.DoubleClickZoom
  901 + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);
  902 + draw.on("drawend", function(evt) {
  903 + evt.feature.setStyle(
  904 + new ol.style.Style({
  905 + stroke: new ol.style.Stroke({
  906 + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',
  907 + width: i3GEO.editorOL.simbologia.strokeWidth
  908 + }),
  909 + fill: new ol.style.Fill({
  910 + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'
  911 + })
  912 + })
  913 + );
  914 + evt.feature.setId(i3GEO.util.uid());
  915 + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
  916 + draw.setActive(false);
  917 + draw.setActive(true);
  918 + if (document.getElementById("panellistagEditor")) {
  919 + i3GEO.editorOL.listaGeometrias();
  920 + }
  921 + });
  922 + if(drawendcallback){
  923 + draw.on("drawend",drawendcallback);
  924 + }
  925 + i3geoOL.addInteraction(draw);
  926 + },
1167 927 botaoLinha: function(){
1168 928 var temp = document.createElement("div");
1169 929 temp.className = "editorOLlinhaItemInactive olButton";
... ... @@ -1171,88 +931,100 @@ i3GEO.editorOL =
1171 931 temp.onclick = function(){
1172 932 i3GEO.eventos.cliquePerm.desativa();
1173 933 i3GEO.editorOL.marcaBotao("editorOLlinha");
1174   - var draw = new ol.interaction.Draw({
1175   - type : "LineString"
1176   - });
1177   - //adiciona a interacao para poder ser removida
1178   - i3GEO.editorOL.interacoes.push(draw);
1179   - //desativa ol.interaction.DoubleClickZoom
1180   - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);
1181   - draw.on("drawend", function(evt) {
1182   - evt.feature.setStyle(
1183   - new ol.style.Style({
1184   - stroke: new ol.style.Stroke({
1185   - color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',
1186   - width: i3GEO.editorOL.simbologia.strokeWidth
1187   - }),
1188   - fill: new ol.style.Fill({
1189   - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'
1190   - })
1191   - })
1192   - );
1193   - evt.feature.setId(i3GEO.util.uid());
1194   - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
1195   - draw.setActive(false);
1196   - draw.setActive(true);
1197   - if (document.getElementById("panellistagEditor")) {
1198   - i3GEO.editorOL.listaGeometrias();
1199   - }
1200   - });
1201   - i3geoOL.addInteraction(draw);
  934 + i3GEO.editorOL.desenhaLinha();
1202 935 };
1203 936 return temp;
1204 937 },
  938 + desenhaPonto: function(drawendcallback){
  939 + i3GEO.editorOL.removeInteracoes();
  940 + var draw = new ol.interaction.Draw({
  941 + type : "Point"
  942 + });
  943 + //adiciona a interacao para poder ser removida
  944 + i3GEO.editorOL.interacoes = draw;
  945 + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);
  946 + draw.on("drawend", function(evt) {
  947 + var simbolo, url;
  948 + url = i3GEO.editorOL.simbologia.externalGraphic;
  949 + if(url === ""){
  950 + simbolo = new ol.style.Circle({
  951 + radius: i3GEO.editorOL.simbologia.pointRadius,
  952 + fill: new ol.style.Fill({
  953 + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'
  954 + }),
  955 + stroke: new ol.style.Stroke({
  956 + color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',
  957 + width: i3GEO.editorOL.simbologia.pointRadius / 3
  958 + })
  959 + });
  960 + }
  961 + else{
  962 + simbolo = new ol.style.Icon({
  963 + src : url,
  964 + size : [i3GEO.editorOL.simbologia.graphicWidth,i3GEO.editorOL.simbologia.graphicHeight]
  965 + });
  966 + }
  967 + evt.feature.setStyle(
  968 + new ol.style.Style({
  969 + image: simbolo
  970 + })
  971 + );
  972 + evt.feature.setId(i3GEO.util.uid());
  973 + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
  974 + draw.setActive(false);
  975 + draw.setActive(true);
  976 + if (document.getElementById("panellistagEditor")) {
  977 + i3GEO.editorOL.listaGeometrias();
  978 + }
  979 + });
  980 + if(drawendcallback){
  981 + draw.on("drawend",drawendcallback);
  982 + }
  983 + i3geoOL.addInteraction(draw);
  984 + },
1205 985 botaoPonto: function(){
1206 986 i3GEO.eventos.cliquePerm.desativa();
1207 987 var temp = document.createElement("div");
1208 988 temp.className = "editorOLpontoItemInactive olButton";
1209 989 temp.title = $trad("dponto");
1210 990 temp.onclick = function(){
1211   - i3GEO.eventos.cliquePerm.desativa();
1212 991 i3GEO.editorOL.marcaBotao("editorOLponto");
1213   - var draw = new ol.interaction.Draw({
1214   - type : "Point"
1215   - });
1216   - //adiciona a interacao para poder ser removida
1217   - i3GEO.editorOL.interacoes.push(draw);
1218   - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);
1219   - draw.on("drawend", function(evt) {
1220   - var simbolo, url;
1221   - url = i3GEO.editorOL.simbologia.externalGraphic;
1222   - if(url === ""){
1223   - simbolo = new ol.style.Circle({
1224   - radius: i3GEO.editorOL.simbologia.pointRadius,
1225   - fill: new ol.style.Fill({
1226   - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'
1227   - }),
  992 + i3GEO.editorOL.desenhaPonto();
  993 + };
  994 + return temp;
  995 + },
  996 + desenhaPoligono: function(drawendcallback){
  997 + i3GEO.editorOL.removeInteracoes();
  998 + var draw = new ol.interaction.Draw({
  999 + type : "Polygon"
  1000 + });
  1001 + //adiciona a interacao para poder ser removida
  1002 + i3GEO.editorOL.interacoes = draw;
  1003 + i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);
  1004 + draw.on("drawend", function(evt) {
  1005 + evt.feature.setStyle(
  1006 + new ol.style.Style({
1228 1007 stroke: new ol.style.Stroke({
1229 1008 color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',
1230   - width: i3GEO.editorOL.simbologia.pointRadius / 3
1231   - })
1232   - });
1233   - }
1234   - else{
1235   - simbolo = new ol.style.Icon({
1236   - src : url,
1237   - size : [i3GEO.editorOL.simbologia.graphicWidth,i3GEO.editorOL.simbologia.graphicHeight]
1238   - });
1239   - }
1240   - evt.feature.setStyle(
1241   - new ol.style.Style({
1242   - image: simbolo
  1009 + width: i3GEO.editorOL.simbologia.strokeWidth
  1010 + }),
  1011 + fill: new ol.style.Fill({
  1012 + color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'
1243 1013 })
1244   - );
1245   - evt.feature.setId(i3GEO.util.uid());
1246   - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
1247   - draw.setActive(false);
1248   - draw.setActive(true);
1249   - if (document.getElementById("panellistagEditor")) {
1250   - i3GEO.editorOL.listaGeometrias();
1251   - }
1252   - });
1253   - i3geoOL.addInteraction(draw);
1254   - };
1255   - return temp;
  1014 + })
  1015 + );
  1016 + evt.feature.setId(i3GEO.util.uid());
  1017 + i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
  1018 + draw.setActive(false);
  1019 + draw.setActive(true);
  1020 + if (document.getElementById("panellistagEditor")) {
  1021 + i3GEO.editorOL.listaGeometrias();
  1022 + }
  1023 + });
  1024 + if(drawendcallback){
  1025 + draw.on("drawend",drawendcallback);
  1026 + }
  1027 + i3geoOL.addInteraction(draw);
1256 1028 },
1257 1029 botaoPoligono: function(){
1258 1030 i3GEO.eventos.cliquePerm.desativa();
... ... @@ -1261,39 +1033,7 @@ i3GEO.editorOL =
1261 1033 temp.title = $trad("dpol");
1262 1034 temp.onclick = function(){
1263 1035 i3GEO.editorOL.marcaBotao("editorOLpoligono");
1264   - var draw = new ol.interaction.Draw({
1265   - type : "Polygon"
1266   - });
1267   - /*
1268   - snap = new ol.interaction.Snap({
1269   - source: i3GEO.desenho.layergrafico.getSource()
1270   - });
1271   - i3GEO.editorOL.interacoes.push(snap);
1272   - */
1273   - //adiciona a interacao para poder ser removida
1274   - i3GEO.editorOL.interacoes.push(draw);
1275   - i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);
1276   - draw.on("drawend", function(evt) {
1277   - evt.feature.setStyle(
1278   - new ol.style.Style({
1279   - stroke: new ol.style.Stroke({
1280   - color: 'rgba(' + i3GEO.editorOL.simbologia.strokeColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')',
1281   - width: i3GEO.editorOL.simbologia.strokeWidth
1282   - }),
1283   - fill: new ol.style.Fill({
1284   - color: 'rgba(' + i3GEO.editorOL.simbologia.fillColor + ',' + i3GEO.editorOL.simbologia.opacidade + ')'
1285   - })
1286   - })
1287   - );
1288   - evt.feature.setId(i3GEO.util.uid());
1289   - i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);
1290   - draw.setActive(false);
1291   - draw.setActive(true);
1292   - if (document.getElementById("panellistagEditor")) {
1293   - i3GEO.editorOL.listaGeometrias();
1294   - }
1295   - });
1296   - i3geoOL.addInteraction(draw);
  1036 + i3GEO.editorOL.desenhaPoligono();
1297 1037 };
1298 1038 return temp;
1299 1039 },
... ... @@ -1304,12 +1044,13 @@ i3GEO.editorOL =
1304 1044 temp.title = $trad("dtexto");
1305 1045 temp.onclick = function(){
1306 1046 i3GEO.eventos.cliquePerm.desativa();
  1047 + i3GEO.editorOL.removeInteracoes();
1307 1048 i3GEO.editorOL.marcaBotao("editorOLtexto");
1308 1049 var draw = new ol.interaction.Draw({
1309 1050 type : "Point"
1310 1051 });
1311 1052 //adiciona a interacao para poder ser removida
1312   - i3GEO.editorOL.interacoes.push(draw);
  1053 + i3GEO.editorOL.interacoes = draw;
1313 1054 i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);
1314 1055 draw.on("drawend", function(evt) {
1315 1056 var texto = window.prompt("Texto", "");
... ... @@ -1347,9 +1088,10 @@ i3GEO.editorOL =
1347 1088 temp.title = $trad("d24t");
1348 1089 temp.onclick = function(){
1349 1090 i3GEO.editorOL.marcaBotao("editorOLselecao");
  1091 + i3GEO.editorOL.removeInteracoes();
1350 1092 var sel = new ol.interaction.Select();
1351 1093 //adiciona a interacao para poder ser removida
1352   - i3GEO.editorOL.interacoes.push(sel);
  1094 + i3GEO.editorOL.interacoes = sel;
1353 1095 i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);
1354 1096 sel.on("select", function(evt) {
1355 1097 var s,i, n, id, f;
... ... @@ -1479,6 +1221,7 @@ i3GEO.editorOL =
1479 1221 var draw, nsel, f, c;
1480 1222 nsel = i3GEO.editorOL.idsSelecionados.length;
1481 1223 if(nsel == 1){
  1224 + i3GEO.editorOL.removeInteracoes();
1482 1225 i3GEO.editorOL.marcaBotao("editorOLedita");
1483 1226 f = i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel - 1]);
1484 1227 i3GEO.editorOL.featuresBackup.push(f.clone());
... ... @@ -1488,7 +1231,7 @@ i3GEO.editorOL =
1488 1231 features: c
1489 1232 });
1490 1233 //adiciona a interacao para poder ser removida
1491   - i3GEO.editorOL.interacoes.push(draw);
  1234 + i3GEO.editorOL.interacoes = draw;
1492 1235 i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);
1493 1236 i3geoOL.addInteraction(draw);
1494 1237 }
... ... @@ -1508,13 +1251,14 @@ i3GEO.editorOL =
1508 1251 if (nsel != 1) {
1509 1252 alert("Selecione primeiro um elemento para ser cortado");
1510 1253 } else {
  1254 + i3GEO.editorOL.removeInteracoes();
1511 1255 i3GEO.janela.tempoMsg("Desenhe um pol&iacute;gono");
1512 1256 i3GEO.editorOL.marcaBotao("editorOLcorta");
1513 1257 var draw = new ol.interaction.Draw({
1514 1258 type : "Polygon"
1515 1259 });
1516 1260 //adiciona a interacao para poder ser removida
1517   - i3GEO.editorOL.interacoes.push(draw);
  1261 + i3GEO.editorOL.interacoes = draw;
1518 1262 i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);
1519 1263 draw.on("drawend", function(evt) {
1520 1264 var temp, f, c, format, fwkt, cwkt;
... ... @@ -1648,16 +1392,18 @@ i3GEO.editorOL =
1648 1392 temp.className = "editorOLidentificaItemInactive olButton";
1649 1393 temp.title = $trad("d7t");
1650 1394 temp.onclick = function(){
  1395 +
1651 1396 if(i3GEO.editorOL.layerDefault == ""){
1652 1397 i3GEO.editorOL.criaJanelaAtivaTema();
1653 1398 }
1654 1399 i3GEO.eventos.cliquePerm.desativa();
  1400 + i3GEO.editorOL.removeInteracoes();
1655 1401 i3GEO.editorOL.marcaBotao("editorOLidentifica");
1656 1402 var draw = new ol.interaction.Draw({
1657 1403 type : "Point"
1658 1404 });
1659 1405 //adiciona a interacao para poder ser removida
1660   - i3GEO.editorOL.interacoes.push(draw);
  1406 + i3GEO.editorOL.interacoes = draw;
1661 1407 i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);
1662 1408 draw.on("drawend", function(evt) {
1663 1409 var xy, p, retorno, url, layer, tema = $i("i3GEOOLlistaTemasAtivos");
... ...
ferramentas/editorol/editorol_compacto.js 100755 → 100644
1   -if(!i3GEO||typeof(i3GEO)==='undefined'){var i3GEO={};i3GEO.Interface={};navn=false;navm=false;$i=function(id){return document.getElementById(id)};app=navigator.appName.substring(0,1);if(app==='N'){navn=true}else{navm=true}}i3GEO.editorOL={MUSTACHESALVAGEOMETRIAS:"",MUSTACHEFERRAMENTAS:"",MUSTACHEPROPRIEDADES:"",layerDefault:"",simbologia:{opacidade:0.8,texto:"",fillColor:"250,180,15",strokeWidth:5,strokeColor:"250,150,0",pointRadius:4,graphicName:"square",fontSize:"12px",fontColor:"0,0,0",externalGraphic:"",graphicHeight:25,graphicWidth:25},backup:new ol.layer.Vector({source:new ol.source.Vector({features:new ol.Collection(),useSpatialIndex:false,name:"Backup"}),visible:false}),e_oce:new ol.layer.Tile({title:"ESRI Ocean Basemap",visible:false,isBaseLayer:true,name:"oce",source:new ol.source.TileArcGISRest({url:"http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer",attributions:[new ol.Attribution({html:'Tiles &copy; <a href="http://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer">ArcGIS</a>'})]})}),e_ims:new ol.layer.Tile({title:"ESRI Imagery World 2D",visible:false,isBaseLayer:true,name:"ims",source:new ol.source.TileArcGISRest({url:"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer",attributions:[new ol.Attribution({html:'Tiles &copy; <a href="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer">ArcGIS</a>'})]})}),e_wsm:new ol.layer.Tile({title:"ESRI World Street Map",visible:false,isBaseLayer:true,name:"wsm",source:new ol.source.TileArcGISRest({url:"http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer",attributions:[new ol.Attribution({html:'Tiles &copy; <a href="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer">ArcGIS</a>'})]})}),ol_mma:new ol.layer.Tile({title:"Base carto MMA",visible:false,isBaseLayer:true,name:"bra",source:new ol.source.TileWMS({url:"http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseraster.map&",params:{'layers':"baseraster",'srs':"EPSG:4326",'format':"image/png"}})}),e_tms:new ol.layer.Tile({title:"OSGEO",visible:false,isBaseLayer:true,name:"tms",source:new ol.source.TileWMS({url:"http://tilecache.osgeo.org/wms-c/Basic.py/",params:{'layers':"basic",'type':"png",'srs':"EPSG:4326",'format':"image/png",'VERSION':'1.1.1'},attributions:[new ol.Attribution({html:'&copy; <a href="http://www.tilecache.org/">2006-2010, TileCache Contributors</a>'})]})}),top_wms:new ol.layer.Tile({title:"Topon&iacute;mia MMA",visible:false,isBaseLayer:true,name:"bra",source:new ol.source.TileWMS({url:"http://mapas.mma.gov.br/cgi-bin/mapserv?map=/opt/www/html/webservices/baseref.map&",params:{'layers':"base",'srs':"EPSG:4326",'format':"image/png"}})}),est_wms:new ol.layer.Tile({title:"Estados do Brasil",visible:false,isBaseLayer:true,name:"bra",source:new ol.source.TileWMS({url:"http://mapas.mma.gov.br/i3geo/ogc.php?tema=estadosl&",params:{'layers':"estadosl",'srs':"EPSG:4326",'format':"image/png"}})}),fundo:"e_ims,e_wsm,ol_mma,ol_wms,top_wms,est_wms,e_oce",nomeFuncaoSalvar:"i3GEO.editorOL.salvaGeo()",kml:[],layersIniciais:[],botoes:{'imprimir':false,'grid':false,'pan':false,'zoombox':false,'zoomtot':false,'zoomin':false,'zoomout':false,'distancia':false,'area':false,'identifica':false,'linha':true,'ponto':true,'poligono':true,'texto':true,'edita':true,'listag':true,'corta':true,'apaga':true,'procura':false,'selecao':true,'selecaotudo':true,'salva':true,'ajuda':true,'propriedades':true,'fecha':false,'tools':true,'undo':false,'frente':false,'legenda':false,'rodadomouse':true,'novaaba':false},pontos:[],marca:"../pacotes/openlayers/img/marker-gold.png",controles:[],tiles:true,incluilayergrafico:true,ativalayerswitcher:false,ativarodadomouse:true,legendahtml:false,numzoom:12,minresolution:0.703125,maxext:"",mapext:[-76.5125927,-39.3925675209,-29.5851853,9.49014852081],mapa:"",idsSelecionados:[],featuresBackup:[],resolutions:[],matrixIds:[],inicia:function(){var projectionExtent,size,resolutions,matrixIds,z;if(i3GEO.Interface.openlayers.googleLike===true){projectionExtent=ol.proj.get('EPSG:3857').getExtent()}else{projectionExtent=ol.proj.get('EPSG:4326').getExtent()}size=ol.extent.getWidth(projectionExtent)/256;resolutions=new Array(40);matrixIds=new Array(40);for(z=0;z<40;++z){resolutions[z]=size/Math.pow(2,z);matrixIds[z]=z}i3GEO.editorOL.resolutions=resolutions;i3GEO.editorOL.matrixIds=matrixIds;i3GEO.editorOL.incluilayergrafico=true;i3GEO.Interface.openlayers.parametrosView={projection:"EPSG:4326",resolutions:resolutions,minResolution:i3GEO.editorOL.minresolution,maxResolution:resolutions[i3GEO.editorOL.numzoom]};i3GEO.Interface.openlayers.parametrosMap={target:"i3geoMapa",layers:[],controls:[]};i3GEO.Interface.openlayers.cria();i3GEO.editorOL.mapa=i3geoOL;if(i3GEO.editorOL.controles.length===0){i3GEO.editorOL.controles=[new ol.interaction.DoubleClickZoom(),new ol.interaction.KeyboardPan(),new ol.interaction.KeyboardZoom(),new ol.interaction.MouseWheelZoom(),new ol.interaction.PinchRotate(),new ol.interaction.PinchZoom(),new ol.interaction.DragZoom(),new ol.interaction.DragPan(),new ol.control.Zoom(),new ol.control.ZoomSlider(),new ol.control.ScaleLine()]}var alayers=[],fundo=(i3GEO.editorOL.fundo).split(","),nfundo=fundo.length,ncontroles=i3GEO.editorOL.controles.length,i,n,temp;if(i3GEO.editorOL.ativarodadomouse==="false"){i3GEO.editorOL.ativarodadomouse=false}if(i3GEO.editorOL.ativarodadomouse==="true"){i3GEO.editorOL.ativarodadomouse=true}if(i3GEO.editorOL.legendahtml==="false"){i3GEO.editorOL.legendahtml=false}if(i3GEO.editorOL.legendahtml==="true"){i3GEO.editorOL.legendahtml=true}if(i3GEO.editorOL.incluilayergrafico==="false"){i3GEO.editorOL.incluilayergrafico=false}if(i3GEO.editorOL.incluilayergrafico==="true"){i3GEO.editorOL.incluilayergrafico=true}if(i3GEO.editorOL.incluilayergrafico===true){if(!i3GEO.desenho.layergrafico){i3GEO.editorOL.criaLayerGrafico()}}else{i3GEO.desenho.layergrafico="";i3GEO.editorOL.botoes.linha=false;i3GEO.editorOL.botoes.ponto=false;i3GEO.editorOL.botoes.poligono=false;i3GEO.editorOL.botoes.texto=false;i3GEO.editorOL.botoes.edita=false;i3GEO.editorOL.botoes.listag=false;i3GEO.editorOL.botoes.corta=false;i3GEO.editorOL.botoes.apaga=false;i3GEO.editorOL.botoes.selecao=false;i3GEO.editorOL.botoes.selecaotudo=false;i3GEO.editorOL.botoes.salva=false;i3GEO.editorOL.botoes.propriedades=false;i3GEO.editorOL.botoes.fecha=false;i3GEO.editorOL.botoes.tools=false;i3GEO.editorOL.botoes.undo=false;i3GEO.editorOL.botoes.frente=false;i3GEO.editorOL.botoes.novaaba=false}for(i=0;i<ncontroles;i++){i3GEO.editorOL.mapa.addControl(i3GEO.editorOL.controles[i])}if(i3GEO.editorOL.fundo!=""){for(i=nfundo-1;i>=0;i--){if(fundo[i]!=""&&i3GEO.editorOL[fundo[i]]){alayers.push(i3GEO.editorOL[fundo[i]]);i3GEO.editorOL[fundo[i]].setVisibility(true)}}}i3GEO.editorOL.mapa.addLayers(alayers);if(i3GEO.editorOL.layersIniciais!==""){n=i3GEO.editorOL.layersIniciais.length;for(i=0;i<n;i++){i3GEO.editorOL.mapa.addLayer(i3GEO.editorOL.layersIniciais[i])}}if(!i3GEO.desenho.layergrafico&&i3GEO.editorOL.incluilayergrafico===true){i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}i3GEO.editorOL.adicionaKml();i3GEO.editorOL.adicionaMarcas();i3GEO.editorOL.coordenadas();i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes);if(i3GEO.editorOL.ativalayerswitcher===true){}if(i3GEO.editorOL.ativarodadomouse===false){i3GEO.editorOL.desativaRodaDoMouse()}if(i3GEO.editorOL.maxext!==""){i3GEO.editorOL.mapa.getView().setProperties({extent:i3GEO.editorOL.maxext})}if(i3GEO.editorOL.mapext!=""){var m=i3GEO.util.extGeo2OSM(i3GEO.editorOL.mapext);i3GEO.editorOL.mapa.zoomToExtent(m)}temp=i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");if(temp){temp=temp.dataLayersDiv.getElementsByTagName("label");n=temp.length;for(i=0;i<n;i++){temp[i].onclick=""}}},criaLayerGrafico:function(){i3GEO.desenho.openlayers.criaLayerGrafico()},layersLigados:function(){var l,layers=i3GEO.editorOL.mapa.getLayers(),nlayers=layers.getLength(),ins=[],i;for(i=0;i<nlayers;i++){l=layers.item(i);if(l.getVisible()===true){ins.push(l)}}return ins},layerPorParametro:function(parametro,valor){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,ins=[],i;for(i=0;i<nlayers;i++){if(layers[i][parametro]||layers[i][parametro.toLowerCase()]){if(layers[i][parametro]===valor||layers[i][parametro.toLowerCase()]===valor){ins.push(layers[i])}}else{if(layers[i].params&&layers[i].params[parametro]&&layers[i].params[parametro]===valor){ins.push(layers[i])}}}return ins},layersClonados:function(paramsLayers){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,i;for(i=0;i<nlayers;i++){if(layers[i].params&&layers[i].params.CLONETMS===paramsLayers){return(layers[i])}}return false},layertms2wms:function(tms){var layer,url;url=tms.url.replace("&cache=sim","&DESLIGACACHE=sim");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");url=url.replace("Z=${z}&X=${x}&Y=${y}","");layer=new OpenLayers.Layer.WMS(tms.layername+"_clone",url,{layers:tms.name,transparent:true},{gutter:0,isBaseLayer:false,displayInLayerSwitcher:false,opacity:1,visibility:true,singleTile:true});return layer},removeClone:function(){var nome=i3GEO.editorOL.layerAtivo().layername+"_clone",busca=i3GEO.editorOL.mapa.getLayersByName(nome);if(busca.length>0){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0],false)}},coordenadas:function(){var idcoord=i3GEO.editorOL.mapa.getControlsBy("separator"," ");if(idcoord[0]){i3GEO.editorOL.mapa.events.register("mousemove",i3GEO.editorOL.mapa,function(e){var p,lonlat,d;if(navm){p=new OpenLayers.Pixel(e.x,e.y)}else{p=e.xy}lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(p);lonlat=i3GEO.util.projOSM2Geo(lonlat);d=i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat);try{$i(idcoord[0].id).innerHTML="Long: "+d[0]+"<br>Lat: "+d[1]}catch(e){}}})}},criaJanelaBusca:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,ins,combo="<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>";for(i=0;i<nlayers;i++){combo+="<option value='"+i+"' >"+layers[i].getProperties().name+"</option>"}combo+="</select>";ins="<div class=paragrafo >"+$trad("a7")+":<br>"+combo;ins+="<br>"+$trad("x64")+":<br><span id=i3GEOOLcomboitens ></span>";ins+="<br>"+$trad("t23")+":<br><input type=text size=20 id=i3GEOOLpalavraBusca >";ins+="<br><br><input type=button value='"+$trad("t23")+"' id='i3GEOOLbotaoBusca' ></div>";ins+="<br>'"+$trad("result")+"':<br><span id=i3GEOOLcomboresultado ></span>";YAHOO.namespace("procura.container");YAHOO.procura.container.panel=new YAHOO.widget.Panel("panelprocura",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true,strings:{close:"<span class='material-icons'>cancel</span>"}});YAHOO.procura.container.panel.setHeader("Encontre no mapa");YAHOO.procura.container.panel.setBody(ins);YAHOO.procura.container.panel.setFooter("");YAHOO.procura.container.panel.render(document.body);YAHOO.procura.container.panel.center();document.getElementById("i3GEOOLbotaoBusca").onclick=function(){var layer=i3GEO.editorOL.layerAtivo(),item=document.getElementById("i3GEOOLbuscaItem").value,palavra=document.getElementById("i3GEOOLpalavraBusca").value;if(item===""||palavra===""){alert("Escolha o item e o texto de busca");return}i3GEO.editorOL.busca(layer,item,palavra,"i3GEOOLcomboresultado")};document.getElementById("i3GEOOLlistaTemasBusca").onchange=function(){i3GEO.editorOL.ativaTema(this.value);document.getElementById("i3GEOOLcomboitens").innerHTML="...";i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(),"i3GEOOLcomboitens","i3GEOOLbuscaItem")}},criaComboTemas:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,nometema="",combo="<select id=i3GEOOLlistaTemasAtivos style=width:235px; >";for(i=0;i<nlayers;i++){nometema=layers[i].getProperties().title;combo+="<option value='"+layers[i].getProperties().name+"' >"+nometema+"</option>"}combo+="</select>";return combo},atualizaJanelaAtivaTema:function(){var combo=i3GEO.editorOL.criaComboTemas();YAHOO.temaativo.container.panel.setBody(combo)},criaJanelaAtivaTema:function(){var temp;if(!document.getElementById("paneltemaativo")){YAHOO.namespace("temaativo.container");YAHOO.temaativo.container.panel=new YAHOO.widget.Panel("paneltemaativo",{zIndex:20000,iframe:true,width:"250px",visible:false,draggable:true,close:true,strings:{close:"<span class='material-icons'>cancel</span>"}});YAHOO.temaativo.container.panel.setBody("");if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.temaativo.container.panel.setHeader("Tema ativo<div id='paneltemaativo_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.temaativo.container.panel.setHeader($trad("tativo"))}YAHOO.temaativo.container.panel.setFooter("");YAHOO.temaativo.container.panel.render(document.body);YAHOO.temaativo.container.panel.show();YAHOO.temaativo.container.panel.center();i3GEO.editorOL.atualizaJanelaAtivaTema();YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close,"click",function(){i3GEO.editorOL.marcaBotao();if(i3GEO.eventos){i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS",["i3GEO.editorOL.atualizaJanelaAtivaTema()"])}});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){if(i3GEO.eventos){i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS",["i3GEO.editorOL.atualizaJanelaAtivaTema()"])}}temp=$i("paneltemaativo_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("paneltemaativo")}}}else{YAHOO.temaativo.container.panel.show();i3GEO.editorOL.atualizaJanelaAtivaTema()}},ativaTema:function(id){document.getElementById("i3GEOOLlistaTemasAtivos").value=id},layerAtivo:function(){if(i3GEO.editorOL.layerDefault&&i3GEO.editorOL.layerDefault!=""){return i3GEO.editorOL.layerPorParametro("LAYERS",i3GEO.editorOL.layerDefault)}else{var id=document.getElementById("i3GEOOLlistaTemasAtivos");if(id){id=id.value}else{id=i3GEO.temaAtivo}if(id==""){return[]}else{return i3GEO.editorOL.layersLigados()[id]}}},listaItens:function(layer,idonde,idobj){if(!layer){return}if(!layer.params){return}var u=layer.url+"&request=describefeaturetype&service=wfs&version=1.0.0";u+="&typename="+layer.params.LAYERS;document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.WFSDescribeFeatureType({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),prop=gml.featureTypes[0].properties,nprop=prop.length,i,combo="<select id="+idobj+" ><option value=''>----</option>";for(i=0;i<nprop;i++){combo+="<option value="+prop[i].name+" >"+prop[i].name+"</option>"}combo+="</select>";document.getElementById(idonde).innerHTML=combo},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},busca:function(layer,item,palavra,onde){document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";var u=layer.url+"&request=getfeature&service=wfs&version=1.0.0";u=u.replace("Z=${z}&X=${x}&Y=${y}","");u+="&OUTPUTFORMAT=gml2&typename="+layer.params.LAYERS;u+="&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>"+item+"</PropertyName><Literal>*"+palavra+"*</Literal></PropertyIsLike></Filter>";document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";document.getElementById(onde).innerHTML="...";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),ngml=gml.length,i,ins="<select onchange='i3GEO.editorOL.zoomPara(this.value)'>";ins+="<option value=''>---</option>";for(i=0;i<ngml;i++){eval("var valor = gml[i].data."+item);var bounds=gml[i].geometry.getBounds();bounds=bounds.toBBOX();ins+="<option value='"+bounds+"'>"+valor+"</option>"}ins+="</select>";document.getElementById(onde).innerHTML=ins},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},zoomPara:function(bbox){var b=new OpenLayers.Bounds.fromString(bbox);i3GEO.editorOL.mapa.zoomToExtent(b)},mostraLegenda:function(){var prop,layer,layers=i3GEO.editorOL.mapa.getLayers(),nlayers=layers.getLength(),ins="",i,icone="",url,f="",fonte="";for(i=0;i<nlayers;i++){layer=layers.item(i);prop=layer.getProperties();if(prop.source.getUrls){url=prop.source.getUrls()[0];url=url.replace("&cache=sim","&DESLIGACACHE=sim");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");url=url.replace("Z=${z}&X=${x}&Y=${y}","");url+="&REQUEST=getlegendgraphic&service=wms&version=1.0.0";if(i3GEO.Interface.openlayers.googleLike===true){url+="&SRS=EPSG:3857"}icone="";if(i3GEO.editorOL.legendahtml===true){url=url.replace("image%2Fpng","text/html")+"&FORMAT=text/html&SERVICE=WMS";fonte="";if(prop.link_tema!=""){fonte="&nbsp;<a class='i3GeoLinkFonte' href='"+prop.link_tema+"' target='_blank' >link</a>"}ins+=icone+prop.name+fonte+"<br><div id=legendaL_"+i+" ></div><br>";eval("var f = function(retorno){document.getElementById('legendaL_"+i+"').innerHTML = retorno.responseText;};");url=url.replace("LAYERS","LAYER");var config={method:"GET",url:url,callback:f}}else if(prop.isBaseLayer===false&&prop.visible===true){url=url.replace("LAYERS","LAYER");url+="&FORMAT=image/png";ins+=prop.title+"<br><img src='"+url+"' /><br>"}}}if(!document.getElementById("panellegendaeditorOL")){YAHOO.namespace("legendaeditorOL.container");YAHOO.legendaeditorOL.container.panel=new YAHOO.widget.Panel("panellegendaeditorOL",{zIndex:20000,iframe:true,width:"auto",visible:false,draggable:true,close:true,strings:{close:"<span class='material-icons'>cancel</span>"}});YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.setHeader($trad("p3"));YAHOO.legendaeditorOL.container.panel.setFooter("");YAHOO.legendaeditorOL.container.panel.render(document.body);YAHOO.legendaeditorOL.container.panel.show();YAHOO.legendaeditorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close,"click",function(){YAHOO.legendaeditorOL.container.panel.destroy()})}else{YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.show()}},captura:function(x,y,tema,idunico){var d=0.001,layer=i3geoOL.getLayersByName(tema)[0],xy=[x,y],u=layer.getSource().getUrls()[0],poligono,retorno;u+="&REQUEST=getfeature&service=wfs&version=1.0.0";u+="&OUTPUTFORMAT=gml2&typename=undefined";if(i3GEO.Interface.openlayers.googleLike===true){u+="&SRS=EPSG:3857"}u=u.replace("&cache=sim","&DESLIGACACHE=sim");u=u.replace("&Z=${z}&X=${x}&Y=${y}","");u=u.replace("Z=${z}&X=${x}&Y=${y}","");xy[0]=xy[0]*1;xy[1]=xy[1]*1;poligono=(xy[0]-d)+","+(xy[1]+d)+" "+(xy[0]+d)+","+(xy[1]+d)+" "+(xy[0]+d)+","+(xy[1]-d)+" "+(xy[0]-d)+","+(xy[1]-d)+" "+(xy[0]-d)+","+(xy[1]+d);u+="&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>"+poligono+"</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>";retorno=function(r){var fs,c,format,f,n,i,idunico;format=new ol.format.WKT();fs=format.readFeatures(r[0]);n=fs.length;c=i3GEO.desenho.layergrafico.getSource();for(i=0;i<n;i++){f=fs[i];f.setStyle(new ol.style.Style({stroke:new ol.style.Stroke({color:'rgba('+i3GEO.editorOL.simbologia.strokeColor+','+i3GEO.editorOL.simbologia.opacidade+')',width:i3GEO.editorOL.simbologia.strokeWidth}),fill:new ol.style.Fill({color:'rgba('+i3GEO.editorOL.simbologia.fillColor+','+i3GEO.editorOL.simbologia.opacidade+')'})}));idunico=i3GEO.util.uid();f.setId(idunico);f.setProperties({idUnico:idunico});c.addFeature(f)}};u=i3GEO.configura.locaplic+"/classesphp/proxy.php?"+u+"&tipoRetornoProxy=gml2wkt";cpJSON.call(u,"foo",retorno,"")},salvaGeometrias:function(){if(i3GEO.editorOL.MUSTACHESALVAGEOMETRIAS==""){$.get(i3GEO.configura.locaplic+"/ferramentas/editorol/templateSalvaGeometrias_mst.html",function(template){i3GEO.editorOL.MUSTACHESALVAGEOMETRIAS=template;i3GEO.editorOL.salvaGeometrias()});return}var n=i3GEO.editorOL.idsSelecionados.length,ins="";if(n>0){if($i("panelsalvageometrias")){if(YAHOO.i3GEO){YAHOO.salvaGeometrias.container.panel=YAHOO.i3GEO.janela.manager.find("panelsalvageometrias")}YAHOO.salvaGeometrias.container.panel.show();YAHOO.salvaGeometrias.container.panel.bringToTop()}else{try{YAHOO.namespace("salvaGeometrias.container");YAHOO.salvaGeometrias.container.panel=new YAHOO.widget.Panel("panelsalvageometrias",{zIndex:2000,iframe:false,width:"350px",visible:false,draggable:true,close:true,strings:{close:"<span class='material-icons'>cancel</span>"}});YAHOO.salvaGeometrias.container.panel.setHeader("<span class='i3GeoTituloJanelaBsNolink' >"+$trad("u6")+"</span>");YAHOO.salvaGeometrias.container.panel.setBody("");YAHOO.salvaGeometrias.container.panel.setFooter("");YAHOO.salvaGeometrias.container.panel.render(document.body);YAHOO.salvaGeometrias.container.panel.center();if(YAHOO.i3GEO&&YAHOO.i3GEO.janela){YAHOO.i3GEO.janela.manager.register(YAHOO.salvaGeometrias.container.panel)}YAHOO.salvaGeometrias.container.panel.show()}catch(e){}}var hash={"n":n,"geosel":$trad("geosel"),"listar":$trad("listar"),"nomeFuncaoSalvarHidden":"hidden","incorpoHidden":"hidden"};if(i3GEO.editorOL.nomeFuncaoSalvar&&i3GEO.editorOL.nomeFuncaoSalvar!=""){hash.nomeFuncaoSalvar=i3GEO.editorOL.nomeFuncaoSalvar;hash.sdados=$trad("sdados");hash.nomeFuncaoSalvarHidden=""}if(typeof i3geoOL!=="undefined"){hash.incorpo=$trad("incorpo");hash.ajudaEditorOlSalva=$trad("ajudaEditorOlSalva");hash.incorpoHidden=""}ins=Mustache.render(i3GEO.editorOL.MUSTACHESALVAGEOMETRIAS,hash);YAHOO.salvaGeometrias.container.panel.setBody(ins)}else{i3GEO.janela.tempoMsg($trad("selum"))}},exportarSHP:function(){i3GEO.editorOL.processageo("converteSHP")},incorporar:function(){i3GEO.editorOL.processageo("incorporar")},listaGeometriasSel:function(){var n=i3GEO.editorOL.idsSelecionados.length,ins="",s=i3GEO.desenho.layergrafico.getSource(),i,w,g;for(i=0;i<n;i++){g=s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);ins+="<b>"+$trad("u6")+": #"+i+"</b><br>"+i3GEO.editorOL.google2wgs(g.getGeometry().getCoordinates())+"<br><br>"}w=window.open();w.document.write(ins);w.document.close()},testeSalvar:function(){alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar ")},salvaGeo:function(){if(i3GEO.parametros.editor=="nao"){i3GEO.janela.tempoMsg($trad("meneditor3"));return}var s=i3GEO.desenho.layergrafico.getSource(),n=i3GEO.editorOL.idsSelecionados.length,funcaoOK=function(){var f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[0]),g=f.getGeometry(),tema=$i("editorOLcomboTemaEditavel").value,redesenha,p,format;g=i3GEO.editorOL.google2wgs(g);format=new ol.format.WKT();f.setGeometry(g);if(tema==""){return}redesenha=function(retorno){i3GEO.janela.fechaAguarde("aguardeSalvaPonto");i3GEO.editorOL.removeFeaturesSel();i3GEO.Interface.atualizaTema("",tema)};i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaPonto",$trad("adic")+"...");i3GEO.janela.AGUARDEMODAL=false;if(!f.getProperties().idUnico||f.getProperties().idUnico==""){p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&tema="+tema+"&wkt="+format.writeFeatures([f]))}else{p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&idunico="+f.getProperties().idUnico+"&tema="+tema+"&wkt="+format.writeFeatures([f]))}},funcaoCombo=function(obj){$i("editorOLondeComboTemaEditavel").innerHTML=obj.dados},texto=$trad("stema")+"<div style='width: 100%;' class='form-group label-fixed condensed'><label class='control-label' for=''>"+$trad("salvaDadosEditor")+"</label><div style='width: 100%;' class='input-group'><div id='editorOLondeComboTemaEditavel'></div></div></div>";if(n!=1){i3GEO.janela.tempoMsg($trad("seluma"))}else{i3GEO.janela.confirma(texto,300,$trad("salva"),"",funcaoOK);i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel"," ",false,true,"form-control comboTema")}},marcaBotao:function(classeBotao){if($i("i3GEObarraEdicao")){var i,n,botoes=$i("i3GEObarraEdicao").getElementsByTagName("div");n=botoes.length;for(i=0;i<n;i++){botoes[i].className=botoes[i].className.replace("ItemActive","ItemInactive");if(classeBotao){botoes[i].className=botoes[i].className.replace(classeBotao+"ItemInactive",classeBotao+"ItemActive")}}}i3GEO.editorOL.removeInteracoes()},interacoes:[],removeInteracoes:function(){var i,n;n=i3GEO.editorOL.interacoes.length;for(i=0;i<n;i++){i3geoOL.removeInteraction(i3GEO.editorOL.interacoes[i])}i3GEO.editorOL.interacoes=[]},botaoProcura:function(){var temp=document.createElement("div");temp.className="editorOLprocuraItemInactive olButton";temp.title=$trad("t23");temp.onclick=function(){i3GEO.editorOL.criaJanelaBusca();YAHOO.procura.container.panel.show()};return temp},botaoPan:function(){var temp=document.createElement("div");temp.className="editorOLpanItemInactive olButton";temp.title="pan";temp.onclick=function(){i3GEO.editorOL.marcaBotao("editorOLpan")};return temp},botaoZoomBox:function(){var temp=document.createElement("div");temp.className="editorOLzoomboxItemInactive olButton";temp.title="zoombox";temp.onclick=function(){i3GEO.navega.zoomli()};return temp},botaoZoomTot:function(){var temp=document.createElement("div");temp.className="editorOLzoomtotItemInactive olButton";temp.title=$trad("d2t");temp.onclick=function(){if(i3GEO.editorOL.mapext&&i3GEO.editorOL.mapext!=""){i3GEO.Interface.openlayers.zoom2ext(i3GEO.editorOL.mapext.join(" "))}else{i3GEO.Interface.openlayers.zoom2ext(i3GEO.parametros.extentTotal)}};return temp},botaoZoomIn:function(){var temp=document.createElement("div");temp.className="editorOLzoominItemInactive olButton";temp.title=$trad("d5t");temp.onclick=function(){var v=i3GEO.editorOL.mapa.getView();v.setZoom(v.getZoom()+1)};return temp},botaoZoomOut:function(){var temp=document.createElement("div");temp.className="editorOLzoomoutItemInactive olButton";temp.title=$trad("d5t");temp.onclick=function(){var v=i3GEO.editorOL.mapa.getView();v.setZoom(v.getZoom()-1)};return temp},botaoLegenda:function(){var temp=document.createElement("div");temp.className="editorOLlegendaItemInactive olButton";temp.title=$trad("p3");temp.onclick=function(){i3GEO.editorOL.mostraLegenda()};return temp},botaoDistancia:function(){var temp=document.createElement("div");temp.className="editorOLdistanciaItemInactive olButton";temp.onclick=function(){i3GEO.editorOL.marcaBotao("editorOLdistancia");i3GEO.analise.medeDistancia.inicia()};return temp},botaoArea:function(){var temp=document.createElement("div");temp.className="editorOLareaItemInactive olButton";temp.onclick=function(){i3GEO.editorOL.marcaBotao("editorOLarea");i3GEO.analise.medeArea.inicia()};return temp},botaoLinha:function(){var temp=document.createElement("div");temp.className="editorOLlinhaItemInactive olButton";temp.title=$trad("dlinha");temp.onclick=function(){i3GEO.eventos.cliquePerm.desativa();i3GEO.editorOL.marcaBotao("editorOLlinha");var draw=new ol.interaction.Draw({type:"LineString"});i3GEO.editorOL.interacoes.push(draw);i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){evt.feature.setStyle(new ol.style.Style({stroke:new ol.style.Stroke({color:'rgba('+i3GEO.editorOL.simbologia.strokeColor+','+i3GEO.editorOL.simbologia.opacidade+')',width:i3GEO.editorOL.simbologia.strokeWidth}),fill:new ol.style.Fill({color:'rgba('+i3GEO.editorOL.simbologia.fillColor+','+i3GEO.editorOL.simbologia.opacidade+')'})}));evt.feature.setId(i3GEO.util.uid());i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);draw.setActive(false);draw.setActive(true);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}});i3geoOL.addInteraction(draw)};return temp},botaoPonto:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLpontoItemInactive olButton";temp.title=$trad("dponto");temp.onclick=function(){i3GEO.eventos.cliquePerm.desativa();i3GEO.editorOL.marcaBotao("editorOLponto");var draw=new ol.interaction.Draw({type:"Point"});i3GEO.editorOL.interacoes.push(draw);i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){var simbolo,url;url=i3GEO.editorOL.simbologia.externalGraphic;if(url===""){simbolo=new ol.style.Circle({radius:i3GEO.editorOL.simbologia.pointRadius,fill:new ol.style.Fill({color:'rgba('+i3GEO.editorOL.simbologia.fillColor+','+i3GEO.editorOL.simbologia.opacidade+')'}),stroke:new ol.style.Stroke({color:'rgba('+i3GEO.editorOL.simbologia.strokeColor+','+i3GEO.editorOL.simbologia.opacidade+')',width:i3GEO.editorOL.simbologia.pointRadius/3})})}else{simbolo=new ol.style.Icon({src:url,size:[i3GEO.editorOL.simbologia.graphicWidth,i3GEO.editorOL.simbologia.graphicHeight]})}evt.feature.setStyle(new ol.style.Style({image:simbolo}));evt.feature.setId(i3GEO.util.uid());i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);draw.setActive(false);draw.setActive(true);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}});i3geoOL.addInteraction(draw)};return temp},botaoPoligono:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLpoligonoItemInactive olButton";temp.title=$trad("dpol");temp.onclick=function(){i3GEO.editorOL.marcaBotao("editorOLpoligono");var draw=new ol.interaction.Draw({type:"Polygon"});i3GEO.editorOL.interacoes.push(draw);i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){evt.feature.setStyle(new ol.style.Style({stroke:new ol.style.Stroke({color:'rgba('+i3GEO.editorOL.simbologia.strokeColor+','+i3GEO.editorOL.simbologia.opacidade+')',width:i3GEO.editorOL.simbologia.strokeWidth}),fill:new ol.style.Fill({color:'rgba('+i3GEO.editorOL.simbologia.fillColor+','+i3GEO.editorOL.simbologia.opacidade+')'})}));evt.feature.setId(i3GEO.util.uid());i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);draw.setActive(false);draw.setActive(true);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}});i3geoOL.addInteraction(draw)};return temp},botaoTexto:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLtextoItemInactive olButton";temp.title=$trad("dtexto");temp.onclick=function(){i3GEO.eventos.cliquePerm.desativa();i3GEO.editorOL.marcaBotao("editorOLtexto");var draw=new ol.interaction.Draw({type:"Point"});i3GEO.editorOL.interacoes.push(draw);i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){var texto=window.prompt("Texto","");evt.feature.setStyle(new ol.style.Style({text:new ol.style.Text({text:texto,font:'Bold '+parseInt(i3GEO.editorOL.simbologia.fontSize,10)+'px Arial',textAlign:'left',stroke:new ol.style.Stroke({color:'white',width:i3GEO.editorOL.simbologia.strokeWidth}),fill:new ol.style.Fill({color:i3GEO.editorOL.simbologia.fontColor}),zIndex:2000})}));evt.feature.setId(i3GEO.util.uid());i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);draw.setActive(false);draw.setActive(true);i3GEO.editorOL.marcaBotao()});i3geoOL.addInteraction(draw)};return temp},botaoSelecao:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLselecaoItemInactive olButton";temp.title=$trad("d24t");temp.onclick=function(){i3GEO.editorOL.marcaBotao("editorOLselecao");var sel=new ol.interaction.Select();i3GEO.editorOL.interacoes.push(sel);i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);sel.on("select",function(evt){var s,i,n,id,f;n=evt.selected.length;for(i=0;i<n;i++){f=evt.selected[i];id=f.getId();if(id&&i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){i3GEO.editorOL.unselFeature(id)}else{id=i3GEO.util.uid();i3GEO.editorOL.idsSelecionados.push(id);f.setId(id);s=f.getStyle();if(s.getImage()){f.setStyle(new ol.style.Style({image:new ol.style.Circle({radius:i3GEO.editorOL.simbologia.pointRadius,fill:new ol.style.Fill({color:'rgba(255, 255, 255, 0.5)'}),stroke:new ol.style.Stroke({color:'blue',width:i3GEO.editorOL.simbologia.pointRadius/3})})}));if(!s.getImage().getSrc){f.setProperties({fillColor:s.getImage().getFill().getColor(),strokeColor:s.getImage().getStroke().getColor(),externalGraphic:"",graphicHeight:25,graphicWidth:25})}else{f.setProperties({fillColor:"",strokeColor:"",externalGraphic:s.getImage().getSrc(),graphicHeight:s.getImage().getSize()[1],graphicWidth:s.getImage().getSize()[0]})}}else{f.setProperties({fillColor:s.getFill().getColor(),strokeColor:s.getStroke().getColor(),externalGraphic:"",graphicHeight:25,graphicWidth:25});s.getFill().setColor('rgba(255, 255, 255, 0.5)');s.getStroke().setColor('blue')}}}if(n===0){i3GEO.editorOL.unselTodos()}});i3geoOL.addInteraction(sel)};return temp},botaoSelecaoTudo:function(){var temp=document.createElement("div");temp.className="editorOLselecaoTudoItemInactive olButton";temp.title=$trad("studo");temp.onclick=function(){i3GEO.editorOL.marcaBotao();i3GEO.editorOL.selTodos()};return temp},botaoApaga:function(){var temp=document.createElement("div");temp.className="editorOLapagaItemInactive olButton";temp.title=$trad("excsel");temp.onclick=function(){var x,nsel=i3GEO.editorOL.idsSelecionados.length;i3GEO.editorOL.featuresBackup=[];i3GEO.editorOL.marcaBotao();if(nsel>0){x=window.confirm($trad("excsel")+"?");if(x){i3GEO.editorOL.removeFeaturesSel();i3GEO.desenho.layergrafico.getSource().changed()}}else{i3GEO.janela.tempoMsg($trad("selum"))}};return temp},botaoFrente:function(){var temp=document.createElement("div");temp.className="editorOLfrenteItemInactive olButton";temp.title=$trad("frente");temp.onclick=function(){var nsel=i3GEO.editorOL.idsSelecionados.length;if(nsel>0){i3GEO.editorOL.marcaBotao();i3GEO.editorOL.trazParaFrente()}else{i3GEO.janela.tempoMsg($trad("selum"))}};return temp},botaoEdita:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLeditaItemInactive olButton";temp.title=$trad("modf");temp.onclick=function(){i3GEO.editorOL.featuresBackup=[];var draw,nsel,f,c;nsel=i3GEO.editorOL.idsSelecionados.length;if(nsel==1){i3GEO.editorOL.marcaBotao("editorOLedita");f=i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel-1]);i3GEO.editorOL.featuresBackup.push(f.clone());c=new ol.Collection();c.push(f);draw=new ol.interaction.Modify({features:c});i3GEO.editorOL.interacoes.push(draw);i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);i3geoOL.addInteraction(draw)}else{i3GEO.janela.tempoMsg($trad("seluma"))}};return temp},botaoCorta:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLcortaItemInactive olButton";temp.title=$trad("cortaf");temp.onclick=function(){var nsel=i3GEO.editorOL.idsSelecionados.length;if(nsel!=1){alert("Selecione primeiro um elemento para ser cortado")}else{i3GEO.janela.tempoMsg("Desenhe um pol&iacute;gono");i3GEO.editorOL.marcaBotao("editorOLcorta");var draw=new ol.interaction.Draw({type:"Polygon"});i3GEO.editorOL.interacoes.push(draw);i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){var temp,f,c,format,fwkt,cwkt;f=evt.feature;c=i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel-1]);i3GEO.editorOL.featuresBackup.push(c.clone());i3GEO.editorOL.marcaBotao();format=new ol.format.WKT();if(f&&c){fwkt=format.writeFeatures([f]);cwkt=format.writeFeatures([c]);if(fwkt&&cwkt){temp=function(retorno){i3GEO.janela.fechaAguarde("i3GEO.cortador");if(retorno!=""&&retorno.data&&retorno.data!=""){i3GEO.janela.fechaAguarde("i3GEO.cortador");c.setGeometry(format.readGeometry(retorno.data));if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}};i3GEO.janela.abreAguarde("i3GEO.cortador","Cortando");i3GEO.php.funcoesGeometriasWkt(temp,cwkt+"|"+fwkt,"difference")}}});i3geoOL.addInteraction(draw)}};return temp},botaoListaGeometrias:function(){var temp=document.createElement("div");temp.className="editorOLlistagItemInactive olButton";temp.title=$trad("listag");temp.onclick=function(){i3GEO.editorOL.listaGeometrias()};return temp},botaoNovaaba:function(){var temp=document.createElement("div");temp.className="editorOLnovaabaItemInactive olButton";temp.title=$trad("novaaba");temp.onclick=function(){window.open(window.location,'_blank')};return temp},botaoAjuda:function(){var temp=document.createElement("div");temp.className="editorOLajudaItemInactive olButton";temp.title=$trad("s1");temp.onclick=function(){if(i3GEO.configura&&i3GEO.configura.locaplic){i3GEO.janela.cria("400px","200px",i3GEO.configura.locaplic+"/ferramentas/editorol/openlayers_ajuda.php?completo=none","","","<span class='i3GeoTituloJanelaBsNolink' >"+$trad("s1")+"</span></div>","editorOlAjuda")}else{window.open("openlayers_ajuda.php")}};return temp},botaoFecha:function(){var temp=document.createElement("div");temp.className="editorOLfechaItemInactive olButton";temp.title=$trad("x74");temp.onclick=function(){i3GEO.editorOL.unselTodos();i3GEO.editorOL.featuresBackup=[];i3GEO.editorOL.marcaBotao();i3GEO.eventos.cliquePerm.ativa();$i("i3GEObarraEdicao").style.display="none"};return temp},botaoTools:function(){var temp=document.createElement("div");temp.className="editorOLtoolsItemInactive olButton";temp.title=$trad("u15a");temp.onclick=function(){if(i3GEO.php){i3GEO.editorOL.ferramentas()}else{i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()")}};return temp},botaoPropriedades:function(){var temp=document.createElement("div");temp.className="editorOLpropriedadesItemInactive olButton";temp.title=$trad("p13");temp.onclick=function(){i3GEO.editorOL.propriedades()};return temp},botaoImprimir:function(){var temp=document.createElement("div");temp.className="editorOLimprimirItemInactive olButton";temp.onclick=function(){window.print()};return temp},botaoGrid:function(){var temp=document.createElement("div");temp.className="editorOLgridItemInactive olButton";temp.onclick=function(){var p={"map":i3GEO.editorOL.mapa,"targetSize":200};if(!i3GEO.editorOL.grid){i3GEO.editorOL.grid=new ol.Graticule(p)}else{if(i3GEO.editorOL.grid.getMap()==null){i3GEO.editorOL.grid.setMap(i3GEO.editorOL.mapa)}else{i3GEO.editorOL.grid.setMap(null)}}};return temp},botaoIdentifica:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLidentificaItemInactive olButton";temp.title=$trad("d7t");temp.onclick=function(){if(i3GEO.editorOL.layerDefault==""){i3GEO.editorOL.criaJanelaAtivaTema()}i3GEO.eventos.cliquePerm.desativa();i3GEO.editorOL.marcaBotao("editorOLidentifica");var draw=new ol.interaction.Draw({type:"Point"});i3GEO.editorOL.interacoes.push(draw);i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){var xy,p,retorno,url,layer,tema=$i("i3GEOOLlistaTemasAtivos");if(tema){layer=i3geoOL.getLayersByName(tema.value)[0];if(layer.getSource().getUrls){url=layer.getSource().getUrls()[0]}else{url=layer.getSource().getUrl()}xy=evt.feature.getGeometry().getFirstCoordinate();retorno=function(r){var valorunico="",camada=null,texto="",lonlattexto,xy,temp,temp1,n,i,f=[],textoN=r.split(":");if(i3GEO.arvoreDeCamadas){camada=i3GEO.arvoreDeCamadas.pegaTema(tema.value,"","name")}xy=evt.feature.getGeometry().getFirstCoordinate();i3GEO.eventos.cliquePerm.ativo=true;try{if(textoN.length>1){textoN.shift();textoN.shift();temp=textoN.join(":");temp=temp.replace(/'/g,"");temp=temp.replace(/\n/g,"|");temp=temp.replace(/_/g," ");temp=temp.split("|");n=temp.length;for(i=0;i<n;i++){temp1=temp[i].replace(/^\s+/,"");temp1=temp1.replace(/\s+$/,"");if(temp1!=""){if(camada&&camada.colunaidunico!=""&&temp1.split("=")[0].trim()==camada.colunaidunico){valorunico=temp1.split("=")[1].trim();temp1="(*) "+temp1}f.push(temp1)}}texto="<pre>"+f.join("<br>")+"</pre>"}}catch(e){}lonlattexto="<span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura("+xy[0]+","+xy[1]+",\""+tema.value+"\""+",\""+valorunico+"\")'>edita geometria</span><br>";i3GEO.Interface.openlayers.balao("<div style='text-align:left' >"+lonlattexto+texto+"</div>","",xy[0],xy[1],false,false);i3GEO.eventos.cliquePerm.ativo=false};p=i3GEO.configura.locaplic+"/classesphp/proxy.php?"+url+"&tipoRetornoProxy=string&REQUEST=GetFeatureInfo&TIPOIMAGEM=nenhum&DESLIGACACHE=sim&STYLES=&SERVICE=WMS&VERSION=1.1.1&FEATURE_COUNT=1"+"&FORMAT=image/png&INFO_FORMAT=text/plain&SRS=EPSG:4326"+"&LAYERS="+tema.value+"&layer="+tema.value+"&QUERY_LAYERS="+tema.value+"&HEIGHT="+i3geoOL.getSize()[1]+"&WIDTH="+i3geoOL.getSize()[0]+"&BBOX="+i3geoOL.getExtent().toBBOX().split(",").join(" ")+"&X="+xy[0]+"&Y="+xy[1];cpJSON.call(p,"foo",retorno,"")}});i3geoOL.addInteraction(draw)};return temp},botaoSalva:function(){var temp=document.createElement("div");temp.className="editorOLsalvaItemInactive olButton";temp.title=$trad("salva");temp.onclick=function(){i3GEO.editorOL.salvaGeometrias()};return temp},criaBotoes:function(botoes,onde){if(onde){i3GEOpanelEditor=$i(onde)}else{if($i("i3GEObarraEdicao")){$i("i3GEObarraEdicao").style.display="block";return}i3GEOpanelEditor=document.createElement("div");i3GEOpanelEditor.id="i3GEObarraEdicao";i3GEOpanelEditor.className="olControlEditingToolbar1 noprint"}if(botoes.imprimir===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoImprimir())}if(botoes.grid===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoGrid())}if(botoes.novaaba===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoNovaaba())}if(botoes.procura===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoProcura())}if(botoes.pan===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPan())}if(botoes.zoombox===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomBox())}if(botoes.zoomtot===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomTot())}if(botoes.zoomin===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomIn())}if(botoes.zoomout===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomOut())}if(botoes.legenda===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLegenda())}if(botoes.distancia===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoDistancia())}if(botoes.area===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoArea())}if(botoes.identifica===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoIdentifica())}if(botoes.linha===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLinha())}if(botoes.ponto===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPonto())}if(botoes.poligono===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPoligono())}if(botoes.texto===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTexto())}if(botoes.edita===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoEdita())}if(botoes.selecao===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecao())}if(botoes.selecaotudo===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecaoTudo())}if(botoes.apaga===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoApaga())}if(botoes.frente===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFrente())}if(botoes.edita===true&&botoes.corta===true&&i3GEO.php){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoCorta())}if(botoes.edita===true&&botoes.listag===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoListaGeometrias())}if(botoes.tools===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTools())}if(botoes.propriedades===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPropriedades())}if(botoes.salva===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSalva())}if(botoes.ajuda===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoAjuda())}if(botoes.fecha===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFecha())}if(!onde){i3GEOpanelEditor.style.width=i3GEOpanelEditor.getElementsByTagName("div").length*33+"px";i3GEO.editorOL.mapa.getViewport().getElementsByClassName("ol-overlaycontainer-stopevent")[0].appendChild(i3GEOpanelEditor)}},removeFeaturesSel:function(){var s,i,nsel,f;nsel=i3GEO.editorOL.idsSelecionados.length;s=i3GEO.desenho.layergrafico.getSource();for(i=0;i<nsel;i++){f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);if(f){i3GEO.editorOL.featuresBackup.push(f.clone());s.removeFeature(f)}}i3GEO.editorOL.idsSelecionados=[]},mudaSimbolo:function(estilo,obj){var s,i,nsel,f;i3GEO.editorOL.simbologia[estilo]=obj.value;nsel=i3GEO.editorOL.idsSelecionados.length;s=i3GEO.desenho.layergrafico.getSource();for(i=0;i<nsel;i++){f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);if(f){if(estilo==="externalGraphic"||estilo==="graphicWidth"||estilo==="graphicHeight"){f.setProperties({src:i3GEO.editorOL.simbologia.externalGraphic,size:[i3GEO.editorOL.simbologia.graphicWidth,i3GEO.editorOL.simbologia.graphicHeight]})}else{f.setProperties({fillColor:'rgba('+i3GEO.editorOL.simbologia.fillColor+','+i3GEO.editorOL.simbologia.opacidade+')',strokeColor:'rgba('+i3GEO.editorOL.simbologia.strokeColor+','+i3GEO.editorOL.simbologia.opacidade+')',width:i3GEO.editorOL.simbologia.strokeWidth,fontSize:i3GEO.editorOL.simbologia.fontSize,fontColor:i3GEO.editorOL.simbologia.fontColor,})}}}},adicionaMarcas:function(){if(i3GEO.editorOL.pontos.length===0){return}var x,y,index=0;for(index=0;index<i3GEO.editorOL.pontos.length;index=index+2){x=i3GEO.editorOL.pontos[index];y=i3GEO.editorOL.pontos[index+1];i3GEO.desenho.addPin(x,y,27,27,i3GEO.editorOL.marca)}},adicionaKml:function(){var temp,n,i,id,url;n=i3GEO.editorOL.kml.length;for(i=0;i<n;i++){id="kml"+i;url=i3GEO.editorOL.kml[i];var layerkml=new ol.layer.Vector({name:id,isBaseLayer:false,source:new ol.source.Vector({url:url,format:new ol.format.KML(),tipoServico:"kml"})});i3geoOL.addLayer(layerkml)}},propriedades:function(){if(i3GEO.editorOL.MUSTACHEPROPRIEDADES==""){$.get(i3GEO.configura.locaplic+"/ferramentas/editorol/templatePropriedades_mst.html",function(template){i3GEO.editorOL.MUSTACHEPROPRIEDADES=template;i3GEO.editorOL.propriedades()});return}if(!document.getElementById("panelpropriedadesEditor")){YAHOO.namespace("editorOL.container");YAHOO.editorOL.container.panel=new YAHOO.widget.Panel("panelpropriedadesEditor",{iframe:true,width:"350px",height:"300px",overflow:"auto",visible:false,draggable:true,close:true,strings:{close:"<span class='material-icons'>cancel</span>"}});var ins=Mustache.render(i3GEO.editorOL.MUSTACHEPROPRIEDADES,i3GEO.editorOL.simbologia);YAHOO.editorOL.container.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.container.panel.setHeader("<span class='i3GeoTituloJanelaBsNolink'>Propriedades</span>")}else{YAHOO.editorOL.container.panel.setHeader("Propriedades")}YAHOO.editorOL.container.panel.setFooter("");YAHOO.editorOL.container.panel.render(document.body);YAHOO.editorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close,"click",function(){});i3GEO.util.aplicaAquarela("panelpropriedadesEditor")}YAHOO.editorOL.container.panel.show();temp=$i("panelpropriedadesEditor").getElementsByTagName("div");if(temp&&temp[2]){temp[2].style.overflow="auto"}},listaGeometrias:function(){if(!document.getElementById("panellistagEditor")){YAHOO.namespace("editorOL.listaGeometrias");YAHOO.editorOL.listaGeometrias.panel=new YAHOO.widget.Panel("panellistagEditor",{iframe:true,width:"380px",height:"300px",overflow:"auto",visible:false,draggable:true,close:true,strings:{close:"<span class='material-icons'>cancel</span>"}});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.listaGeometrias.panel.setHeader("<span class='i3GeoTituloJanelaBsNolink' >"+$trad("u6")+"</span>")}else{YAHOO.editorOL.listaGeometrias.panel.setHeader($trad("u6"))}YAHOO.editorOL.listaGeometrias.panel.setFooter("");YAHOO.editorOL.listaGeometrias.panel.render(document.body);YAHOO.editorOL.listaGeometrias.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.listaGeometrias.panel.close,"click",function(){YAHOO.editorOL.listaGeometrias.panel.destroy()})}else{YAHOO.editorOL.listaGeometrias.panel.render(document.body)}var id,temp,geos=i3GEO.desenho.layergrafico.getSource().getFeatures(),n=geos.length,ins="";ins+='<div class="container-fluid" style="height:210px;overflow:auto">';while(n>0){n-=1;id=geos[n].getId();if(id){ins+='<h5>'+'<button title="Unsel" onclick="i3GEO.editorOL.unselFeature(\''+id+'\')" class="btn btn-xs" style="margin:2px;padding:2px;"><span class="material-icons">clear</span></button>'+'<a title="Sel" onclick="i3GEO.editorOL.selFeature(\''+id+'\')" href="javascript:void(0)">'+id+"</a></h5>"}}ins+="</div>";if(geos.length===0){ins='<div class="container-fluid" >'+$trad("meneditor2")+"</div>"}YAHOO.editorOL.listaGeometrias.panel.setBody(ins);YAHOO.editorOL.listaGeometrias.panel.show()},ferramentas:function(){if(i3GEO.editorOL.MUSTACHEFERRAMENTAS==""){$.get(i3GEO.configura.locaplic+"/ferramentas/editorol/templateFerramentas_mst.html",function(template){i3GEO.editorOL.MUSTACHEFERRAMENTAS=template;i3GEO.editorOL.ferramentas()});return}var b,ins;if(!document.getElementById("panelferramentasEditor")){YAHOO.namespace("editorOL.ferramentas");YAHOO.editorOL.ferramentas.panel=new YAHOO.widget.Panel("panelferramentasEditor",{zIndex:20000,iframe:true,width:"300px",visible:false,draggable:true,close:true,strings:{close:"<span class='material-icons'>cancel</span>"}});var hash={"opsel":$trad("opsel"),"p14":$trad("p14"),"hidden":"hidden"};if(i3GEO.php){hash.hidden=""}ins=Mustache.render(i3GEO.editorOL.MUSTACHEFERRAMENTAS,hash);YAHOO.editorOL.ferramentas.panel.setBody(ins);YAHOO.editorOL.ferramentas.panel.setHeader("<span class='i3GeoTituloJanelaBsNolink' >Ferramentas</span>");YAHOO.editorOL.ferramentas.panel.setFooter("");YAHOO.editorOL.ferramentas.panel.render(document.body);YAHOO.editorOL.ferramentas.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close,"click",function(){})}else{YAHOO.editorOL.ferramentas.panel.render(document.body)}YAHOO.editorOL.ferramentas.panel.show()},snap:function(){var target=i3GEOOLsnap.targets[0],tipos=["node","vertex","edge"],ntipos=tipos.length,i,temp,ativa=false;i3GEOOLsnap.deactivate();for(i=0;i<ntipos;i++){temp=$i("target_"+tipos[i]);target[tipos[i]]=temp.checked;if(temp.checked===true){ativa=true}temp=$i("target_"+tipos[i]+"Tolerance");target[tipos[i]+"Tolerance"]=temp.value}if(ativa===true){i3GEOOLsnap.activate()}},split:function(){i3GEOOLsplit.deactivate();var temp=$i("edge_split_toggle");if(temp.checked===true){i3GEOOLsplit.activate()}},processageo:function(operacao){if(operacao===""){return}var polis,linhas,pontos,temp,nsel=i3GEO.editorOL.idsSelecionados.length;if(nsel>0){temp=function(retorno){if(i3GEO.janela){i3GEO.janela.fechaAguarde("i3GEO.editorPoli");i3GEO.janela.fechaAguarde("i3GEO.editorLinhas");i3GEO.janela.fechaAguarde("i3GEO.editorPontos")}if(retorno!=""&&retorno.data&&retorno.data!=""&&operacao!="converteSHP"){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}if(operacao==="converteSHP"){i3GEO.atualiza();i3GEO.janela.minimiza("paneltemaativo")}};if(operacao==="incorporar"){polis=i3GEO.editorOL.retornaFeaturesTipo("Polygon");linhas=i3GEO.editorOL.retornaFeaturesTipo("LineString");pontos=i3GEO.editorOL.retornaFeaturesTipo("Point");if(polis.length>0){temp=i3GEO.editorOL.merge(polis)}if(linhas.length>0){temp=i3GEO.editorOL.merge(linhas)}if(pontos.length>0){temp=i3GEO.editorOL.desagrupa(pontos)}if(i3GEO.mapa){i3GEO.mapa.dialogo.wkt2layer(temp)}return}if(operacao==="union"&&!i3GEO.php){polis=i3GEO.editorOL.retornaFeaturesTipo("Polygon");linhas=i3GEO.editorOL.retornaFeaturesTipo("LineString");pontos=i3GEO.editorOL.retornaFeaturesTipo("Point");if(polis.length>0){temp=i3GEO.editorOL.uniaojts(polis);i3GEO.editorOL.substituiFeaturesSel(temp)}if(linhas.length>0){temp=i3GEO.editorOL.uniaojts(linhas);i3GEO.editorOL.substituiFeaturesSel(temp)}if(pontos.length>0){temp=i3GEO.editorOL.uniaojts(pontos);i3GEO.editorOL.substituiFeaturesSel(temp)}}else{polis=i3GEO.editorOL.retornaGeometriasTipo("Polygon");linhas=i3GEO.editorOL.retornaGeometriasTipo("LineString");pontos=i3GEO.editorOL.retornaGeometriasTipo("Point");if(polis.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPoli","Poligonos");i3GEO.php.funcoesGeometriasWkt(temp,polis.join("|"),operacao)}if(linhas.length>0){i3GEO.janela.abreAguarde("i3GEO.editorLinhas","Linhas");i3GEO.php.funcoesGeometriasWkt(temp,linhas.join("|"),operacao)}if(pontos.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPontos","Pontos");i3GEO.php.funcoesGeometriasWkt(temp,pontos.join("|"),operacao)}}i3GEO.desenho.layergrafico.getSource().changed();return}else{i3GEO.janela.tempoMsg("Selecione pelo menos dois elementos")}},desagrupa:function(geoms){var n=geoms.length,w=[],g,m,i,format=new ol.format.WKT();for(i=0;i<n;i++){g=format.writeFeatures([geoms[i]]);m=new Wkt.Wkt();m.read(g);w.push(m)}return w.join("\n")},merge:function(geoms){var n=geoms.length,w=new Wkt.Wkt(),g,m,i,f,format=new ol.format.WKT();f=format.writeFeatures([geoms[0]]);w.read(f);if(n>1){for(i=1;i<n;i++){g=format.writeFeatures([geoms[i]]);m=new Wkt.Wkt();m.read(g);w.merge(m)}}return w.write()},uniaojts:function(geoms){var n=geoms.length,fwkt=new ol.format.WKT(),rwkt=new jsts.io.WKTReader(),wwkt=new jsts.io.WKTWriter(),g,i,uniao;if(n>1){uniao=fwkt.writeFeatures([geoms[0]]);uniao=rwkt.read(uniao);for(i=1;i<=n;i++){g=fwkt.writeFeatures([geoms[i]]);uniao=uniao.union(rwkt.read(g))}uniao=wwkt.write(uniao);return[fwkt.readFeatures(uniao)]}else{return false}},retornaGeometriasTipo:function(tipo){var n=i3GEO.editorOL.idsSelecionados.length,lista=[],i,s=i3GEO.desenho.layergrafico.getSource(),fwkt=new ol.format.WKT();for(i=0;i<n;i++){f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);if(f.getGeometry().getType()==tipo){lista.push(fwkt.writeFeatures([f]))}}return lista},retornaFeaturesTipo:function(tipo){var n=i3GEO.editorOL.idsSelecionados.length,lista=[],i,s=i3GEO.desenho.layergrafico.getSource();for(i=0;i<n;i++){f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);if(f.getGeometry().getType()==tipo){lista.push(f)}}return lista},guardaBackup:function(){return},selTodos:function(){i3GEO.editorOL.unselTodos();var features,n,f,i,id,st;features=i3GEO.desenho.layergrafico.getSource().getFeatures();n=features.length;for(i=0;i<n;i++){f=features[i];id=f.getId();if(!id){id=i3GEO.util.uid();f.setId(id)}i3GEO.editorOL.idsSelecionados.push(id);st=f.getStyle();if(st&&st.getImage()){f.setStyle(new ol.style.Style({image:new ol.style.Circle({radius:i3GEO.editorOL.simbologia.pointRadius,fill:new ol.style.Fill({color:'rgba(255, 255, 255, 0.5)'}),stroke:new ol.style.Stroke({color:'blue',width:i3GEO.editorOL.simbologia.pointRadius/3})})}));if(st.getImage().getSrc){f.setProperties({fillColor:"",strokeColor:"",externalGraphic:st.getImage().getSrc(),graphicHeight:st.getImage().getSize()[1],graphicWidth:st.getImage().getSize()[0]})}else{f.setProperties({fillColor:st.getImage().getFill().getColor(),strokeColor:st.getImage().getStroke().getColor(),externalGraphic:"",graphicHeight:"",graphicWidth:""})}}else if(st){f.setProperties({fillColor:st.getFill().getColor(),strokeColor:st.getStroke().getColor()});st.getFill().setColor('rgba(255, 255, 255, 0.5)');st.getStroke().setColor('blue')}}i3GEO.desenho.layergrafico.getSource().changed()},unselTodos:function(){var i,n,f,s,st;s=i3GEO.desenho.layergrafico.getSource();n=i3GEO.editorOL.idsSelecionados.length;for(i=0;i<n;i++){f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);if(f){st=f.getStyle();if(st&&st.getImage()){if(st.getImage().getSrc||f.getProperties().externalGraphic!=""){f.setStyle(new ol.style.Style({image:new ol.style.Icon({src:f.getProperties().externalGraphic,size:[f.getProperties().graphicWidth,f.getProperties().graphicHeight]})}))}else{f.setStyle(new ol.style.Style({image:new ol.style.Circle({radius:i3GEO.editorOL.simbologia.pointRadius,fill:new ol.style.Fill({color:f.getProperties().fillColor}),stroke:new ol.style.Stroke({color:f.getProperties().strokeColor,width:i3GEO.editorOL.simbologia.pointRadius/3})})}))}}else if(st){st.getFill().setColor(f.getProperties().fillColor);st.getStroke().setColor(f.getProperties().strokeColor)}}}i3GEO.editorOL.idsSelecionados=[];i3GEO.desenho.layergrafico.getSource().changed()},unselTodosBackup:function(){var n,i;n=i3GEO.editorOL.backup.features.length;for(i=0;i<n;i++){i3GEO.editorOL.backup.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i])}},unselFeature:function(id){var f,s;s=i3GEO.desenho.layergrafico.getSource();f=s.getFeatureById(id);if(f){if(f.getStyle()&&f.getStyle().getSrc){f.getStyle().setSrc(f.getProperties().externalGraphic);f.getStyle().setSize([f.getProperties().graphicWidth,f.getProperties().graphicHeight])}else{f.getStyle().getFill().setColor(f.getProperties().fillColor);f.getStyle().getStroke().setColor(f.getProperties().strokeColor)}}i3GEO.editorOL.idsSelecionados.remove(id);i3GEO.desenho.layergrafico.getSource().changed()},restauraBackup:function(){if(i3GEO.editorOL.backup.features.length>0){i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features)}if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},substituiFeaturesSel:function(f){i3GEO.editorOL.removeFeaturesSel();var fwkt=new ol.format.WKT();f=fwkt.readFeatures(f)[0];f.setStyle(new ol.style.Style({stroke:new ol.style.Stroke({color:'rgba('+i3GEO.editorOL.simbologia.strokeColor+','+i3GEO.editorOL.simbologia.opacidade+')',width:i3GEO.editorOL.simbologia.strokeWidth}),fill:new ol.style.Fill({color:'rgba('+i3GEO.editorOL.simbologia.fillColor+','+i3GEO.editorOL.simbologia.opacidade+')'})}));f.setId(i3GEO.util.uid());i3GEO.desenho.layergrafico.getSource().addFeature(f)},adicionaFeatureWkt:function(wkt,atributos){var f,fwkt=new OpenLayers.Format.WKT();if(atributos.externalGraphic&&atributos.externalGraphic!=""){var style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=atributos.externalGraphic;style_mark.graphicWidth=atributos.graphicWidth;style_mark.graphicHeight=atributos.graphicHeight;style_mark.fillOpacity=atributos.opacidade;f=fwkt.read(wkt);f["attributes"]=atributos;f["style"]=style_mark}else{f=fwkt.read(wkt);f["attributes"]=atributos}i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},flashFeaturesI:function(index){i3GEO.editorOL.flashFeatures([i3GEO.desenho.layergrafico.features[index]],0)},flashFeatures:function(features,index){if(!index){index=0}var current=features[index];if(current&&current.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(features[index],"select")}var prev=features[index-1];if(prev&&prev.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(prev,"default")}++index;if(index<=features.length){window.setTimeout(function(){i3GEO.editorOL.flashFeatures(features,index)},75)}},selFeature:function(id){var s,f;s=i3GEO.desenho.layergrafico.getSource();f=s.getFeatureById(id);if(!i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){i3GEO.editorOL.idsSelecionados.push(id);f.setProperties({fillColor:f.getStyle().getFill().getColor(),strokeColor:f.getStyle().getStroke().getColor(),externalGraphic:""});f.getStyle().getFill().setColor('rgba(255, 255, 255, 0.5)');f.getStyle().getStroke().setColor('blue');s.changed()}},carregajts:function(funcao){if(i3GEO.configura){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}else{i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}},trazParaFrente:function(){var s,i,nsel,id,clone;s=i3GEO.desenho.layergrafico.getSource();nsel=i3GEO.editorOL.idsSelecionados.length;for(i=0;i<nsel;i++){f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);if(f){clone=f.clone();id=f.getId();s.removeFeature(f);clone.setId(id);s.addFeature(clone)}}s.changed()},pegaControle:function(classe){var n=i3GEO.editorOL.controles.length,i;for(i=0;i<n;i++){if(i3GEO.editorOL.controles[i].CLASS_NAME===classe){return i3GEO.editorOL.controles[i]}}return false},ativaLayerSwitcher:function(){var ls=i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");if(ls){ls.maximizeDiv.click()}},desativaRodaDoMouse:function(){var controls=i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');for(var i=0;i<controls.length;++i){controls[i].disableZoomWheel()}},google2wgs:function(obj){if(i3GEO.Interface.openlayers.googleLike===true){return obj.transform("EPSG:900913","EPSG:4326")}else{return obj}},sobeLayersGraficos:function(){}};i3GEO.editorOL.backup.getFeatures=function(){return i3GEO.editorOL.backup.getSource().getFeatures()};
2 1 \ No newline at end of file
  2 +if(!i3GEO||typeof(i3GEO)==='undefined'){var i3GEO={};i3GEO.Interface={};navn=false;navm=false;$i=function(id){return document.getElementById(id)};app=navigator.appName.substring(0,1);if(app==='N'){navn=true}else{navm=true}}i3GEO.editorOL={interacoes:"",MUSTACHESALVAGEOMETRIAS:"",MUSTACHEFERRAMENTAS:"",MUSTACHEPROPRIEDADES:"",layerDefault:"",simbologia:{opacidade:0.8,texto:"",fillColor:"250,180,15",strokeWidth:5,strokeColor:"250,150,0",pointRadius:4,graphicName:"square",fontSize:"12px",fontColor:"0,0,0",externalGraphic:"",graphicHeight:25,graphicWidth:25},backup:new ol.layer.Vector({source:new ol.source.Vector({features:new ol.Collection(),useSpatialIndex:false,name:"Backup"}),visible:false}),fundo:"",nomeFuncaoSalvar:"i3GEO.editorOL.salvaGeo()",kml:[],layersIniciais:[],botoes:{},pontos:[],marca:"../pacotes/openlayers/img/marker-gold.png",controles:[],tiles:true,incluilayergrafico:true,ativalayerswitcher:false,ativarodadomouse:true,legendahtml:false,numzoom:12,minresolution:0.703125,maxext:"",mapext:[-76.5125927,-39.3925675209,-29.5851853,9.49014852081],mapa:"",idsSelecionados:[],featuresBackup:[],resolutions:[],matrixIds:[],inicia:function(){var projectionExtent,size,resolutions,matrixIds,z;if(i3GEO.Interface.openlayers.googleLike===true){projectionExtent=ol.proj.get('EPSG:3857').getExtent()}else{projectionExtent=ol.proj.get('EPSG:4326').getExtent()}size=ol.extent.getWidth(projectionExtent)/256;resolutions=new Array(40);matrixIds=new Array(40);for(z=0;z<40;++z){resolutions[z]=size/Math.pow(2,z);matrixIds[z]=z}i3GEO.editorOL.resolutions=resolutions;i3GEO.editorOL.matrixIds=matrixIds;i3GEO.editorOL.incluilayergrafico=true;i3GEO.Interface.openlayers.parametrosView={projection:"EPSG:4326",resolutions:resolutions,minResolution:i3GEO.editorOL.minresolution,maxResolution:resolutions[i3GEO.editorOL.numzoom]};i3GEO.Interface.openlayers.parametrosMap={target:"i3geoMapa",layers:[],controls:[]};i3GEO.Interface.openlayers.cria();i3GEO.editorOL.mapa=i3geoOL},criaLayerGrafico:function(){i3GEO.desenho.openlayers.criaLayerGrafico()},layersLigados:function(){var l,layers=i3GEO.editorOL.mapa.getLayers(),nlayers=layers.getLength(),ins=[],i;for(i=0;i<nlayers;i++){l=layers.item(i);if(l.getVisible()===true){ins.push(l)}}return ins},layerPorParametro:function(parametro,valor){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,ins=[],i;for(i=0;i<nlayers;i++){if(layers[i][parametro]||layers[i][parametro.toLowerCase()]){if(layers[i][parametro]===valor||layers[i][parametro.toLowerCase()]===valor){ins.push(layers[i])}}else{if(layers[i].params&&layers[i].params[parametro]&&layers[i].params[parametro]===valor){ins.push(layers[i])}}}return ins},layersClonados:function(paramsLayers){var layers=i3GEO.editorOL.mapa.layers,nlayers=layers.length,i;for(i=0;i<nlayers;i++){if(layers[i].params&&layers[i].params.CLONETMS===paramsLayers){return(layers[i])}}return false},layertms2wms:function(tms){var layer,url;url=tms.url.replace("&cache=sim","&DESLIGACACHE=sim");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");url=url.replace("Z=${z}&X=${x}&Y=${y}","");layer=new OpenLayers.Layer.WMS(tms.layername+"_clone",url,{layers:tms.name,transparent:true},{gutter:0,isBaseLayer:false,displayInLayerSwitcher:false,opacity:1,visibility:true,singleTile:true});return layer},removeClone:function(){var nome=i3GEO.editorOL.layerAtivo().layername+"_clone",busca=i3GEO.editorOL.mapa.getLayersByName(nome);if(busca.length>0){i3GEO.editorOL.mapa.removeLayer(i3GEO.editorOL.mapa.getLayersByName(camada.name)[0],false)}},coordenadas:function(){var idcoord=i3GEO.editorOL.mapa.getControlsBy("separator"," ");if(idcoord[0]){i3GEO.editorOL.mapa.events.register("mousemove",i3GEO.editorOL.mapa,function(e){var p,lonlat,d;if(navm){p=new OpenLayers.Pixel(e.x,e.y)}else{p=e.xy}lonlat=i3GEO.editorOL.mapa.getLonLatFromPixel(p);lonlat=i3GEO.util.projOSM2Geo(lonlat);d=i3GEO.calculo.dd2dms(lonlat.lon,lonlat.lat);try{$i(idcoord[0].id).innerHTML="Long: "+d[0]+"<br>Lat: "+d[1]}catch(e){}}})}},criaJanelaBusca:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,ins,combo="<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>";for(i=0;i<nlayers;i++){combo+="<option value='"+i+"' >"+layers[i].getProperties().name+"</option>"}combo+="</select>";ins="<div class=paragrafo >"+$trad("a7")+":<br>"+combo;ins+="<br>"+$trad("x64")+":<br><span id=i3GEOOLcomboitens ></span>";ins+="<br>"+$trad("t23")+":<br><input type=text size=20 id=i3GEOOLpalavraBusca >";ins+="<br><br><input type=button value='"+$trad("t23")+"' id='i3GEOOLbotaoBusca' ></div>";ins+="<br>'"+$trad("result")+"':<br><span id=i3GEOOLcomboresultado ></span>";YAHOO.namespace("procura.container");YAHOO.procura.container.panel=new YAHOO.widget.Panel("panelprocura",{zIndex:2000,iframe:false,width:"250px",visible:false,draggable:true,close:true,strings:{close:"<span class='material-icons'>cancel</span>"}});YAHOO.procura.container.panel.setHeader("Encontre no mapa");YAHOO.procura.container.panel.setBody(ins);YAHOO.procura.container.panel.setFooter("");YAHOO.procura.container.panel.render(document.body);YAHOO.procura.container.panel.center();document.getElementById("i3GEOOLbotaoBusca").onclick=function(){var layer=i3GEO.editorOL.layerAtivo(),item=document.getElementById("i3GEOOLbuscaItem").value,palavra=document.getElementById("i3GEOOLpalavraBusca").value;if(item===""||palavra===""){alert("Escolha o item e o texto de busca");return}i3GEO.editorOL.busca(layer,item,palavra,"i3GEOOLcomboresultado")};document.getElementById("i3GEOOLlistaTemasBusca").onchange=function(){i3GEO.editorOL.ativaTema(this.value);document.getElementById("i3GEOOLcomboitens").innerHTML="...";i3GEO.editorOL.listaItens(i3GEO.editorOL.layerAtivo(),"i3GEOOLcomboitens","i3GEOOLbuscaItem")}},criaComboTemas:function(){var layers=i3GEO.editorOL.layersLigados(),nlayers=layers.length,i,nometema="",combo="<select id=i3GEOOLlistaTemasAtivos style=width:235px; >";for(i=0;i<nlayers;i++){nometema=layers[i].getProperties().title;combo+="<option value='"+layers[i].getProperties().name+"' >"+nometema+"</option>"}combo+="</select>";return combo},atualizaJanelaAtivaTema:function(){var combo=i3GEO.editorOL.criaComboTemas();YAHOO.temaativo.container.panel.setBody(combo)},criaJanelaAtivaTema:function(){var temp;if(!document.getElementById("paneltemaativo")){YAHOO.namespace("temaativo.container");YAHOO.temaativo.container.panel=new YAHOO.widget.Panel("paneltemaativo",{zIndex:20000,iframe:true,width:"250px",visible:false,draggable:true,close:true,strings:{close:"<span class='material-icons'>cancel</span>"}});YAHOO.temaativo.container.panel.setBody("");if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.temaativo.container.panel.setHeader("Tema ativo<div id='paneltemaativo_minimizaCabecalho' class='container-minimiza'></div>")}else{YAHOO.temaativo.container.panel.setHeader($trad("tativo"))}YAHOO.temaativo.container.panel.setFooter("");YAHOO.temaativo.container.panel.render(document.body);YAHOO.temaativo.container.panel.show();YAHOO.temaativo.container.panel.center();i3GEO.editorOL.atualizaJanelaAtivaTema();YAHOO.util.Event.addListener(YAHOO.temaativo.container.panel.close,"click",function(){i3GEO.editorOL.marcaBotao();if(i3GEO.eventos){i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS",["i3GEO.editorOL.atualizaJanelaAtivaTema()"])}});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){if(i3GEO.eventos){i3GEO.eventos.adicionaEventos("ATUALIZAARVORECAMADAS",["i3GEO.editorOL.atualizaJanelaAtivaTema()"])}}temp=$i("paneltemaativo_minimizaCabecalho");if(temp){temp.onclick=function(){i3GEO.janela.minimiza("paneltemaativo")}}}else{YAHOO.temaativo.container.panel.show();i3GEO.editorOL.atualizaJanelaAtivaTema()}},ativaTema:function(id){document.getElementById("i3GEOOLlistaTemasAtivos").value=id},layerAtivo:function(){if(i3GEO.editorOL.layerDefault&&i3GEO.editorOL.layerDefault!=""){return i3GEO.editorOL.layerPorParametro("LAYERS",i3GEO.editorOL.layerDefault)}else{var id=document.getElementById("i3GEOOLlistaTemasAtivos");if(id){id=id.value}else{id=i3GEO.temaAtivo}if(id==""){return[]}else{return i3GEO.editorOL.layersLigados()[id]}}},listaItens:function(layer,idonde,idobj){if(!layer){return}if(!layer.params){return}var u=layer.url+"&request=describefeaturetype&service=wfs&version=1.0.0";u+="&typename="+layer.params.LAYERS;document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.WFSDescribeFeatureType({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),prop=gml.featureTypes[0].properties,nprop=prop.length,i,combo="<select id="+idobj+" ><option value=''>----</option>";for(i=0;i<nprop;i++){combo+="<option value="+prop[i].name+" >"+prop[i].name+"</option>"}combo+="</select>";document.getElementById(idonde).innerHTML=combo},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},busca:function(layer,item,palavra,onde){document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";var u=layer.url+"&request=getfeature&service=wfs&version=1.0.0";u=u.replace("Z=${z}&X=${x}&Y=${y}","");u+="&OUTPUTFORMAT=gml2&typename="+layer.params.LAYERS;u+="&filter=<Filter><PropertyIsLike wildcard=* singleChar=. escape=! ><PropertyName>"+item+"</PropertyName><Literal>*"+palavra+"*</Literal></PropertyIsLike></Filter>";document.body.style.cursor="wait";document.getElementById("i3geoMapa").style.cursor="wait";document.getElementById(onde).innerHTML="...";OpenLayers.Request.issue({method:"GET",url:u,callback:function(retorno){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";var fromgml=new OpenLayers.Format.GML({geometryName:"msGeometry"}),gml=fromgml.read(retorno.responseText),ngml=gml.length,i,ins="<select onchange='i3GEO.editorOL.zoomPara(this.value)'>";ins+="<option value=''>---</option>";for(i=0;i<ngml;i++){eval("var valor = gml[i].data."+item);var bounds=gml[i].geometry.getBounds();bounds=bounds.toBBOX();ins+="<option value='"+bounds+"'>"+valor+"</option>"}ins+="</select>";document.getElementById(onde).innerHTML=ins},failure:function(){document.body.style.cursor="default";document.getElementById("i3geoMapa").style.cursor="default";alert("Erro")}})},zoomPara:function(bbox){var b=new OpenLayers.Bounds.fromString(bbox);i3GEO.editorOL.mapa.zoomToExtent(b)},mostraLegenda:function(){var prop,layer,layers=i3GEO.editorOL.mapa.getLayers(),nlayers=layers.getLength(),ins="",i,icone="",url,f="",fonte="";for(i=0;i<nlayers;i++){layer=layers.item(i);prop=layer.getProperties();if(prop.source.getUrls){url=prop.source.getUrls()[0];url=url.replace("&cache=sim","&DESLIGACACHE=sim");url=url.replace("&Z=${z}&X=${x}&Y=${y}","");url=url.replace("Z=${z}&X=${x}&Y=${y}","");url+="&REQUEST=getlegendgraphic&service=wms&version=1.0.0";if(i3GEO.Interface.openlayers.googleLike===true){url+="&SRS=EPSG:3857"}icone="";if(i3GEO.editorOL.legendahtml===true){url=url.replace("image%2Fpng","text/html")+"&FORMAT=text/html&SERVICE=WMS";fonte="";if(prop.link_tema!=""){fonte="&nbsp;<a class='i3GeoLinkFonte' href='"+prop.link_tema+"' target='_blank' >link</a>"}ins+=icone+prop.name+fonte+"<br><div id=legendaL_"+i+" ></div><br>";eval("var f = function(retorno){document.getElementById('legendaL_"+i+"').innerHTML = retorno.responseText;};");url=url.replace("LAYERS","LAYER");var config={method:"GET",url:url,callback:f}}else if(prop.isBaseLayer===false&&prop.visible===true){url=url.replace("LAYERS","LAYER");url+="&FORMAT=image/png";ins+=prop.title+"<br><img src='"+url+"' /><br>"}}}if(!document.getElementById("panellegendaeditorOL")){YAHOO.namespace("legendaeditorOL.container");YAHOO.legendaeditorOL.container.panel=new YAHOO.widget.Panel("panellegendaeditorOL",{zIndex:20000,iframe:true,width:"auto",visible:false,draggable:true,close:true,strings:{close:"<span class='material-icons'>cancel</span>"}});YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.setHeader($trad("p3"));YAHOO.legendaeditorOL.container.panel.setFooter("");YAHOO.legendaeditorOL.container.panel.render(document.body);YAHOO.legendaeditorOL.container.panel.show();YAHOO.legendaeditorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.legendaeditorOL.container.panel.close,"click",function(){YAHOO.legendaeditorOL.container.panel.destroy()})}else{YAHOO.legendaeditorOL.container.panel.setBody(ins);YAHOO.legendaeditorOL.container.panel.show()}},captura:function(x,y,tema,idunico){var d=0.001,layer=i3geoOL.getLayersByName(tema)[0],xy=[x,y],u=layer.getSource().getUrls()[0],poligono,retorno;u+="&REQUEST=getfeature&service=wfs&version=1.0.0";u+="&OUTPUTFORMAT=gml2&typename=undefined";if(i3GEO.Interface.openlayers.googleLike===true){u+="&SRS=EPSG:3857"}u=u.replace("&cache=sim","&DESLIGACACHE=sim");u=u.replace("&Z=${z}&X=${x}&Y=${y}","");u=u.replace("Z=${z}&X=${x}&Y=${y}","");xy[0]=xy[0]*1;xy[1]=xy[1]*1;poligono=(xy[0]-d)+","+(xy[1]+d)+" "+(xy[0]+d)+","+(xy[1]+d)+" "+(xy[0]+d)+","+(xy[1]-d)+" "+(xy[0]-d)+","+(xy[1]-d)+" "+(xy[0]-d)+","+(xy[1]+d);u+="&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>"+poligono+"</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>";retorno=function(r){var fs,c,format,f,n,i,idunico;format=new ol.format.WKT();fs=format.readFeatures(r[0]);n=fs.length;c=i3GEO.desenho.layergrafico.getSource();for(i=0;i<n;i++){f=fs[i];f.setStyle(new ol.style.Style({stroke:new ol.style.Stroke({color:'rgba('+i3GEO.editorOL.simbologia.strokeColor+','+i3GEO.editorOL.simbologia.opacidade+')',width:i3GEO.editorOL.simbologia.strokeWidth}),fill:new ol.style.Fill({color:'rgba('+i3GEO.editorOL.simbologia.fillColor+','+i3GEO.editorOL.simbologia.opacidade+')'})}));idunico=i3GEO.util.uid();f.setId(idunico);f.setProperties({idUnico:idunico});c.addFeature(f)}};u=i3GEO.configura.locaplic+"/classesphp/proxy.php?"+u+"&tipoRetornoProxy=gml2wkt";cpJSON.call(u,"foo",retorno,"")},salvaGeometrias:function(){if(i3GEO.editorOL.MUSTACHESALVAGEOMETRIAS==""){$.get(i3GEO.configura.locaplic+"/ferramentas/editorol/templateSalvaGeometrias_mst.html",function(template){i3GEO.editorOL.MUSTACHESALVAGEOMETRIAS=template;i3GEO.editorOL.salvaGeometrias()});return}var n=i3GEO.editorOL.idsSelecionados.length,ins="";if(n>0){if($i("panelsalvageometrias")){if(YAHOO.i3GEO){YAHOO.salvaGeometrias.container.panel=YAHOO.i3GEO.janela.manager.find("panelsalvageometrias")}YAHOO.salvaGeometrias.container.panel.show();YAHOO.salvaGeometrias.container.panel.bringToTop()}else{try{YAHOO.namespace("salvaGeometrias.container");YAHOO.salvaGeometrias.container.panel=new YAHOO.widget.Panel("panelsalvageometrias",{zIndex:2000,iframe:false,width:"350px",visible:false,draggable:true,close:true,strings:{close:"<span class='material-icons'>cancel</span>"}});YAHOO.salvaGeometrias.container.panel.setHeader("<span class='i3GeoTituloJanelaBsNolink' >"+$trad("u6")+"</span>");YAHOO.salvaGeometrias.container.panel.setBody("");YAHOO.salvaGeometrias.container.panel.setFooter("");YAHOO.salvaGeometrias.container.panel.render(document.body);YAHOO.salvaGeometrias.container.panel.center();if(YAHOO.i3GEO&&YAHOO.i3GEO.janela){YAHOO.i3GEO.janela.manager.register(YAHOO.salvaGeometrias.container.panel)}YAHOO.salvaGeometrias.container.panel.show()}catch(e){}}var hash={"n":n,"geosel":$trad("geosel"),"listar":$trad("listar"),"nomeFuncaoSalvarHidden":"hidden","incorpoHidden":"hidden"};if(i3GEO.editorOL.nomeFuncaoSalvar&&i3GEO.editorOL.nomeFuncaoSalvar!=""){hash.nomeFuncaoSalvar=i3GEO.editorOL.nomeFuncaoSalvar;hash.sdados=$trad("sdados");hash.nomeFuncaoSalvarHidden=""}if(typeof i3geoOL!=="undefined"){hash.incorpo=$trad("incorpo");hash.ajudaEditorOlSalva=$trad("ajudaEditorOlSalva");hash.incorpoHidden=""}ins=Mustache.render(i3GEO.editorOL.MUSTACHESALVAGEOMETRIAS,hash);YAHOO.salvaGeometrias.container.panel.setBody(ins)}else{i3GEO.janela.tempoMsg($trad("selum"))}},exportarSHP:function(){i3GEO.editorOL.processageo("converteSHP")},incorporar:function(){i3GEO.editorOL.processageo("incorporar")},listaGeometriasSel:function(){var n=i3GEO.editorOL.idsSelecionados.length,ins="",s=i3GEO.desenho.layergrafico.getSource(),i,w,g;for(i=0;i<n;i++){g=s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);ins+="<b>"+$trad("u6")+": #"+i+"</b><br>"+i3GEO.editorOL.google2wgs(g.getGeometry().getCoordinates())+"<br><br>"}w=window.open();w.document.write(ins);w.document.close()},testeSalvar:function(){alert("Funcao nao disponivel. Defina o nome da funcao em i3GEO.editorOL.nomeFuncaoSalvar ")},salvaGeo:function(){if(i3GEO.parametros.editor=="nao"){i3GEO.janela.tempoMsg($trad("meneditor3"));return}var s=i3GEO.desenho.layergrafico.getSource(),n=i3GEO.editorOL.idsSelecionados.length,funcaoOK=function(){var f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[0]),g=f.getGeometry(),tema=$i("editorOLcomboTemaEditavel").value,redesenha,p,format;g=i3GEO.editorOL.google2wgs(g);format=new ol.format.WKT();f.setGeometry(g);if(tema==""){return}redesenha=function(retorno){i3GEO.janela.fechaAguarde("aguardeSalvaPonto");i3GEO.editorOL.removeFeaturesSel();i3GEO.Interface.atualizaTema("",tema)};i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaPonto",$trad("adic")+"...");i3GEO.janela.AGUARDEMODAL=false;if(!f.getProperties().idUnico||f.getProperties().idUnico==""){p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&tema="+tema+"&wkt="+format.writeFeatures([f]))}else{p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",redesenha,"&idunico="+f.getProperties().idUnico+"&tema="+tema+"&wkt="+format.writeFeatures([f]))}},funcaoCombo=function(obj){$i("editorOLondeComboTemaEditavel").innerHTML=obj.dados},texto=$trad("stema")+"<div style='width: 100%;' class='form-group label-fixed condensed'><label class='control-label' for=''>"+$trad("salvaDadosEditor")+"</label><div style='width: 100%;' class='input-group'><div id='editorOLondeComboTemaEditavel'></div></div></div>";if(n!=1){i3GEO.janela.tempoMsg($trad("seluma"))}else{i3GEO.janela.confirma(texto,300,$trad("salva"),"",funcaoOK);i3GEO.util.comboTemas("editorOLcomboTemaEditavel",funcaoCombo,"editorOLondeComboTemaEditavel","",false,"editavel"," ",false,true,"form-control comboTema")}},marcaBotao:function(classeBotao){if($i("i3GEObarraEdicao")){var i,n,botoes=$i("i3GEObarraEdicao").getElementsByTagName("div");n=botoes.length;for(i=0;i<n;i++){botoes[i].className=botoes[i].className.replace("ItemActive","ItemInactive");if(classeBotao){botoes[i].className=botoes[i].className.replace(classeBotao+"ItemInactive",classeBotao+"ItemActive")}}}i3GEO.editorOL.removeInteracoes()},removeInteracoes:function(){i3geoOL.removeInteraction(i3GEO.editorOL.interacoes);i3GEO.editorOL.interacoes=""},botaoProcura:function(){var temp=document.createElement("div");temp.className="editorOLprocuraItemInactive olButton";temp.title=$trad("t23");temp.onclick=function(){i3GEO.editorOL.criaJanelaBusca();YAHOO.procura.container.panel.show()};return temp},botaoPan:function(){var temp=document.createElement("div");temp.className="editorOLpanItemInactive olButton";temp.title="pan";temp.onclick=function(){i3GEO.editorOL.marcaBotao("editorOLpan")};return temp},botaoZoomBox:function(){var temp=document.createElement("div");temp.className="editorOLzoomboxItemInactive olButton";temp.title="zoombox";temp.onclick=function(){i3GEO.navega.zoomli()};return temp},botaoZoomTot:function(){var temp=document.createElement("div");temp.className="editorOLzoomtotItemInactive olButton";temp.title=$trad("d2t");temp.onclick=function(){if(i3GEO.editorOL.mapext&&i3GEO.editorOL.mapext!=""){i3GEO.Interface.openlayers.zoom2ext(i3GEO.editorOL.mapext.join(" "))}else{i3GEO.Interface.openlayers.zoom2ext(i3GEO.parametros.extentTotal)}};return temp},botaoZoomIn:function(){var temp=document.createElement("div");temp.className="editorOLzoominItemInactive olButton";temp.title=$trad("d5t");temp.onclick=function(){var v=i3GEO.editorOL.mapa.getView();v.setZoom(v.getZoom()+1)};return temp},botaoZoomOut:function(){var temp=document.createElement("div");temp.className="editorOLzoomoutItemInactive olButton";temp.title=$trad("d5t");temp.onclick=function(){var v=i3GEO.editorOL.mapa.getView();v.setZoom(v.getZoom()-1)};return temp},botaoLegenda:function(){var temp=document.createElement("div");temp.className="editorOLlegendaItemInactive olButton";temp.title=$trad("p3");temp.onclick=function(){i3GEO.editorOL.mostraLegenda()};return temp},botaoDistancia:function(){var temp=document.createElement("div");temp.className="editorOLdistanciaItemInactive olButton";temp.onclick=function(){i3GEO.editorOL.marcaBotao("editorOLdistancia");i3GEO.analise.medeDistancia.inicia()};return temp},botaoArea:function(){var temp=document.createElement("div");temp.className="editorOLareaItemInactive olButton";temp.onclick=function(){i3GEO.editorOL.marcaBotao("editorOLarea");i3GEO.analise.medeArea.inicia()};return temp},desenhaLinha:function(drawendcallback){i3GEO.editorOL.removeInteracoes();var draw=new ol.interaction.Draw({type:"LineString"});i3GEO.editorOL.interacoes=draw;i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){evt.feature.setStyle(new ol.style.Style({stroke:new ol.style.Stroke({color:'rgba('+i3GEO.editorOL.simbologia.strokeColor+','+i3GEO.editorOL.simbologia.opacidade+')',width:i3GEO.editorOL.simbologia.strokeWidth}),fill:new ol.style.Fill({color:'rgba('+i3GEO.editorOL.simbologia.fillColor+','+i3GEO.editorOL.simbologia.opacidade+')'})}));evt.feature.setId(i3GEO.util.uid());i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);draw.setActive(false);draw.setActive(true);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}});if(drawendcallback){draw.on("drawend",drawendcallback)}i3geoOL.addInteraction(draw)},botaoLinha:function(){var temp=document.createElement("div");temp.className="editorOLlinhaItemInactive olButton";temp.title=$trad("dlinha");temp.onclick=function(){i3GEO.eventos.cliquePerm.desativa();i3GEO.editorOL.marcaBotao("editorOLlinha");i3GEO.editorOL.desenhaLinha()};return temp},desenhaPonto:function(drawendcallback){i3GEO.editorOL.removeInteracoes();var draw=new ol.interaction.Draw({type:"Point"});i3GEO.editorOL.interacoes=draw;i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){var simbolo,url;url=i3GEO.editorOL.simbologia.externalGraphic;if(url===""){simbolo=new ol.style.Circle({radius:i3GEO.editorOL.simbologia.pointRadius,fill:new ol.style.Fill({color:'rgba('+i3GEO.editorOL.simbologia.fillColor+','+i3GEO.editorOL.simbologia.opacidade+')'}),stroke:new ol.style.Stroke({color:'rgba('+i3GEO.editorOL.simbologia.strokeColor+','+i3GEO.editorOL.simbologia.opacidade+')',width:i3GEO.editorOL.simbologia.pointRadius/3})})}else{simbolo=new ol.style.Icon({src:url,size:[i3GEO.editorOL.simbologia.graphicWidth,i3GEO.editorOL.simbologia.graphicHeight]})}evt.feature.setStyle(new ol.style.Style({image:simbolo}));evt.feature.setId(i3GEO.util.uid());i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);draw.setActive(false);draw.setActive(true);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}});if(drawendcallback){draw.on("drawend",drawendcallback)}i3geoOL.addInteraction(draw)},botaoPonto:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLpontoItemInactive olButton";temp.title=$trad("dponto");temp.onclick=function(){i3GEO.editorOL.marcaBotao("editorOLponto");i3GEO.editorOL.desenhaPonto()};return temp},desenhaPoligono:function(drawendcallback){i3GEO.editorOL.removeInteracoes();var draw=new ol.interaction.Draw({type:"Polygon"});i3GEO.editorOL.interacoes=draw;i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){evt.feature.setStyle(new ol.style.Style({stroke:new ol.style.Stroke({color:'rgba('+i3GEO.editorOL.simbologia.strokeColor+','+i3GEO.editorOL.simbologia.opacidade+')',width:i3GEO.editorOL.simbologia.strokeWidth}),fill:new ol.style.Fill({color:'rgba('+i3GEO.editorOL.simbologia.fillColor+','+i3GEO.editorOL.simbologia.opacidade+')'})}));evt.feature.setId(i3GEO.util.uid());i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);draw.setActive(false);draw.setActive(true);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}});if(drawendcallback){draw.on("drawend",drawendcallback)}i3geoOL.addInteraction(draw)},botaoPoligono:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLpoligonoItemInactive olButton";temp.title=$trad("dpol");temp.onclick=function(){i3GEO.editorOL.marcaBotao("editorOLpoligono");i3GEO.editorOL.desenhaPoligono()};return temp},botaoTexto:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLtextoItemInactive olButton";temp.title=$trad("dtexto");temp.onclick=function(){i3GEO.eventos.cliquePerm.desativa();i3GEO.editorOL.removeInteracoes();i3GEO.editorOL.marcaBotao("editorOLtexto");var draw=new ol.interaction.Draw({type:"Point"});i3GEO.editorOL.interacoes=draw;i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){var texto=window.prompt("Texto","");evt.feature.setStyle(new ol.style.Style({text:new ol.style.Text({text:texto,font:'Bold '+parseInt(i3GEO.editorOL.simbologia.fontSize,10)+'px Arial',textAlign:'left',stroke:new ol.style.Stroke({color:'white',width:i3GEO.editorOL.simbologia.strokeWidth}),fill:new ol.style.Fill({color:i3GEO.editorOL.simbologia.fontColor}),zIndex:2000})}));evt.feature.setId(i3GEO.util.uid());i3GEO.desenho.layergrafico.getSource().addFeature(evt.feature);draw.setActive(false);draw.setActive(true);i3GEO.editorOL.marcaBotao()});i3geoOL.addInteraction(draw)};return temp},botaoSelecao:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLselecaoItemInactive olButton";temp.title=$trad("d24t");temp.onclick=function(){i3GEO.editorOL.marcaBotao("editorOLselecao");i3GEO.editorOL.removeInteracoes();var sel=new ol.interaction.Select();i3GEO.editorOL.interacoes=sel;i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);sel.on("select",function(evt){var s,i,n,id,f;n=evt.selected.length;for(i=0;i<n;i++){f=evt.selected[i];id=f.getId();if(id&&i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){i3GEO.editorOL.unselFeature(id)}else{id=i3GEO.util.uid();i3GEO.editorOL.idsSelecionados.push(id);f.setId(id);s=f.getStyle();if(s.getImage()){f.setStyle(new ol.style.Style({image:new ol.style.Circle({radius:i3GEO.editorOL.simbologia.pointRadius,fill:new ol.style.Fill({color:'rgba(255, 255, 255, 0.5)'}),stroke:new ol.style.Stroke({color:'blue',width:i3GEO.editorOL.simbologia.pointRadius/3})})}));if(!s.getImage().getSrc){f.setProperties({fillColor:s.getImage().getFill().getColor(),strokeColor:s.getImage().getStroke().getColor(),externalGraphic:"",graphicHeight:25,graphicWidth:25})}else{f.setProperties({fillColor:"",strokeColor:"",externalGraphic:s.getImage().getSrc(),graphicHeight:s.getImage().getSize()[1],graphicWidth:s.getImage().getSize()[0]})}}else{f.setProperties({fillColor:s.getFill().getColor(),strokeColor:s.getStroke().getColor(),externalGraphic:"",graphicHeight:25,graphicWidth:25});s.getFill().setColor('rgba(255, 255, 255, 0.5)');s.getStroke().setColor('blue')}}}if(n===0){i3GEO.editorOL.unselTodos()}});i3geoOL.addInteraction(sel)};return temp},botaoSelecaoTudo:function(){var temp=document.createElement("div");temp.className="editorOLselecaoTudoItemInactive olButton";temp.title=$trad("studo");temp.onclick=function(){i3GEO.editorOL.marcaBotao();i3GEO.editorOL.selTodos()};return temp},botaoApaga:function(){var temp=document.createElement("div");temp.className="editorOLapagaItemInactive olButton";temp.title=$trad("excsel");temp.onclick=function(){var x,nsel=i3GEO.editorOL.idsSelecionados.length;i3GEO.editorOL.featuresBackup=[];i3GEO.editorOL.marcaBotao();if(nsel>0){x=window.confirm($trad("excsel")+"?");if(x){i3GEO.editorOL.removeFeaturesSel();i3GEO.desenho.layergrafico.getSource().changed()}}else{i3GEO.janela.tempoMsg($trad("selum"))}};return temp},botaoFrente:function(){var temp=document.createElement("div");temp.className="editorOLfrenteItemInactive olButton";temp.title=$trad("frente");temp.onclick=function(){var nsel=i3GEO.editorOL.idsSelecionados.length;if(nsel>0){i3GEO.editorOL.marcaBotao();i3GEO.editorOL.trazParaFrente()}else{i3GEO.janela.tempoMsg($trad("selum"))}};return temp},botaoEdita:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLeditaItemInactive olButton";temp.title=$trad("modf");temp.onclick=function(){i3GEO.editorOL.featuresBackup=[];var draw,nsel,f,c;nsel=i3GEO.editorOL.idsSelecionados.length;if(nsel==1){i3GEO.editorOL.removeInteracoes();i3GEO.editorOL.marcaBotao("editorOLedita");f=i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel-1]);i3GEO.editorOL.featuresBackup.push(f.clone());c=new ol.Collection();c.push(f);draw=new ol.interaction.Modify({features:c});i3GEO.editorOL.interacoes=draw;i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);i3geoOL.addInteraction(draw)}else{i3GEO.janela.tempoMsg($trad("seluma"))}};return temp},botaoCorta:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLcortaItemInactive olButton";temp.title=$trad("cortaf");temp.onclick=function(){var nsel=i3GEO.editorOL.idsSelecionados.length;if(nsel!=1){alert("Selecione primeiro um elemento para ser cortado")}else{i3GEO.editorOL.removeInteracoes();i3GEO.janela.tempoMsg("Desenhe um pol&iacute;gono");i3GEO.editorOL.marcaBotao("editorOLcorta");var draw=new ol.interaction.Draw({type:"Polygon"});i3GEO.editorOL.interacoes=draw;i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){var temp,f,c,format,fwkt,cwkt;f=evt.feature;c=i3GEO.desenho.layergrafico.getSource().getFeatureById(i3GEO.editorOL.idsSelecionados[nsel-1]);i3GEO.editorOL.featuresBackup.push(c.clone());i3GEO.editorOL.marcaBotao();format=new ol.format.WKT();if(f&&c){fwkt=format.writeFeatures([f]);cwkt=format.writeFeatures([c]);if(fwkt&&cwkt){temp=function(retorno){i3GEO.janela.fechaAguarde("i3GEO.cortador");if(retorno!=""&&retorno.data&&retorno.data!=""){i3GEO.janela.fechaAguarde("i3GEO.cortador");c.setGeometry(format.readGeometry(retorno.data));if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}}};i3GEO.janela.abreAguarde("i3GEO.cortador","Cortando");i3GEO.php.funcoesGeometriasWkt(temp,cwkt+"|"+fwkt,"difference")}}});i3geoOL.addInteraction(draw)}};return temp},botaoListaGeometrias:function(){var temp=document.createElement("div");temp.className="editorOLlistagItemInactive olButton";temp.title=$trad("listag");temp.onclick=function(){i3GEO.editorOL.listaGeometrias()};return temp},botaoNovaaba:function(){var temp=document.createElement("div");temp.className="editorOLnovaabaItemInactive olButton";temp.title=$trad("novaaba");temp.onclick=function(){window.open(window.location,'_blank')};return temp},botaoAjuda:function(){var temp=document.createElement("div");temp.className="editorOLajudaItemInactive olButton";temp.title=$trad("s1");temp.onclick=function(){if(i3GEO.configura&&i3GEO.configura.locaplic){i3GEO.janela.cria("400px","200px",i3GEO.configura.locaplic+"/ferramentas/editorol/openlayers_ajuda.php?completo=none","","","<span class='i3GeoTituloJanelaBsNolink' >"+$trad("s1")+"</span></div>","editorOlAjuda")}else{window.open("openlayers_ajuda.php")}};return temp},botaoFecha:function(){var temp=document.createElement("div");temp.className="editorOLfechaItemInactive olButton";temp.title=$trad("x74");temp.onclick=function(){i3GEO.editorOL.unselTodos();i3GEO.editorOL.featuresBackup=[];i3GEO.editorOL.marcaBotao();i3GEO.eventos.cliquePerm.ativa();$i("i3GEObarraEdicao").style.display="none"};return temp},botaoTools:function(){var temp=document.createElement("div");temp.className="editorOLtoolsItemInactive olButton";temp.title=$trad("u15a");temp.onclick=function(){if(i3GEO.php){i3GEO.editorOL.ferramentas()}else{i3GEO.editorOL.carregajts("i3GEO.editorOL.ferramentas()")}};return temp},botaoPropriedades:function(){var temp=document.createElement("div");temp.className="editorOLpropriedadesItemInactive olButton";temp.title=$trad("p13");temp.onclick=function(){i3GEO.editorOL.propriedades()};return temp},botaoImprimir:function(){var temp=document.createElement("div");temp.className="editorOLimprimirItemInactive olButton";temp.onclick=function(){window.print()};return temp},botaoGrid:function(){var temp=document.createElement("div");temp.className="editorOLgridItemInactive olButton";temp.onclick=function(){var p={"map":i3GEO.editorOL.mapa,"targetSize":200};if(!i3GEO.editorOL.grid){i3GEO.editorOL.grid=new ol.Graticule(p)}else{if(i3GEO.editorOL.grid.getMap()==null){i3GEO.editorOL.grid.setMap(i3GEO.editorOL.mapa)}else{i3GEO.editorOL.grid.setMap(null)}}};return temp},botaoIdentifica:function(){i3GEO.eventos.cliquePerm.desativa();var temp=document.createElement("div");temp.className="editorOLidentificaItemInactive olButton";temp.title=$trad("d7t");temp.onclick=function(){if(i3GEO.editorOL.layerDefault==""){i3GEO.editorOL.criaJanelaAtivaTema()}i3GEO.eventos.cliquePerm.desativa();i3GEO.editorOL.removeInteracoes();i3GEO.editorOL.marcaBotao("editorOLidentifica");var draw=new ol.interaction.Draw({type:"Point"});i3GEO.editorOL.interacoes=draw;i3GEO.Interface.openlayers.parametrosMap.interactions[0].setActive(false);draw.on("drawend",function(evt){var xy,p,retorno,url,layer,tema=$i("i3GEOOLlistaTemasAtivos");if(tema){layer=i3geoOL.getLayersByName(tema.value)[0];if(layer.getSource().getUrls){url=layer.getSource().getUrls()[0]}else{url=layer.getSource().getUrl()}xy=evt.feature.getGeometry().getFirstCoordinate();retorno=function(r){var valorunico="",camada=null,texto="",lonlattexto,xy,temp,temp1,n,i,f=[],textoN=r.split(":");if(i3GEO.arvoreDeCamadas){camada=i3GEO.arvoreDeCamadas.pegaTema(tema.value,"","name")}xy=evt.feature.getGeometry().getFirstCoordinate();i3GEO.eventos.cliquePerm.ativo=true;try{if(textoN.length>1){textoN.shift();textoN.shift();temp=textoN.join(":");temp=temp.replace(/'/g,"");temp=temp.replace(/\n/g,"|");temp=temp.replace(/_/g," ");temp=temp.split("|");n=temp.length;for(i=0;i<n;i++){temp1=temp[i].replace(/^\s+/,"");temp1=temp1.replace(/\s+$/,"");if(temp1!=""){if(camada&&camada.colunaidunico!=""&&temp1.split("=")[0].trim()==camada.colunaidunico){valorunico=temp1.split("=")[1].trim();temp1="(*) "+temp1}f.push(temp1)}}texto="<pre>"+f.join("<br>")+"</pre>"}}catch(e){}lonlattexto="<span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura("+xy[0]+","+xy[1]+",\""+tema.value+"\""+",\""+valorunico+"\")'>edita geometria</span><br>";i3GEO.Interface.openlayers.balao("<div style='text-align:left' >"+lonlattexto+texto+"</div>","",xy[0],xy[1],false,false);i3GEO.eventos.cliquePerm.ativo=false};p=i3GEO.configura.locaplic+"/classesphp/proxy.php?"+url+"&tipoRetornoProxy=string&REQUEST=GetFeatureInfo&TIPOIMAGEM=nenhum&DESLIGACACHE=sim&STYLES=&SERVICE=WMS&VERSION=1.1.1&FEATURE_COUNT=1"+"&FORMAT=image/png&INFO_FORMAT=text/plain&SRS=EPSG:4326"+"&LAYERS="+tema.value+"&layer="+tema.value+"&QUERY_LAYERS="+tema.value+"&HEIGHT="+i3geoOL.getSize()[1]+"&WIDTH="+i3geoOL.getSize()[0]+"&BBOX="+i3geoOL.getExtent().toBBOX().split(",").join(" ")+"&X="+xy[0]+"&Y="+xy[1];cpJSON.call(p,"foo",retorno,"")}});i3geoOL.addInteraction(draw)};return temp},botaoSalva:function(){var temp=document.createElement("div");temp.className="editorOLsalvaItemInactive olButton";temp.title=$trad("salva");temp.onclick=function(){i3GEO.editorOL.salvaGeometrias()};return temp},criaBotoes:function(botoes,onde){if(onde){i3GEOpanelEditor=$i(onde)}else{if($i("i3GEObarraEdicao")){$i("i3GEObarraEdicao").style.display="block";return}i3GEOpanelEditor=document.createElement("div");i3GEOpanelEditor.id="i3GEObarraEdicao";i3GEOpanelEditor.className="olControlEditingToolbar1 noprint"}if(botoes.imprimir===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoImprimir())}if(botoes.grid===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoGrid())}if(botoes.novaaba===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoNovaaba())}if(botoes.procura===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoProcura())}if(botoes.pan===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPan())}if(botoes.zoombox===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomBox())}if(botoes.zoomtot===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomTot())}if(botoes.zoomin===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomIn())}if(botoes.zoomout===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoZoomOut())}if(botoes.legenda===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLegenda())}if(botoes.distancia===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoDistancia())}if(botoes.area===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoArea())}if(botoes.identifica===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoIdentifica())}if(botoes.linha===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoLinha())}if(botoes.ponto===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPonto())}if(botoes.poligono===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPoligono())}if(botoes.texto===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTexto())}if(botoes.edita===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoEdita())}if(botoes.selecao===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecao())}if(botoes.selecaotudo===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSelecaoTudo())}if(botoes.apaga===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoApaga())}if(botoes.frente===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFrente())}if(botoes.edita===true&&botoes.corta===true&&i3GEO.php){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoCorta())}if(botoes.edita===true&&botoes.listag===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoListaGeometrias())}if(botoes.tools===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoTools())}if(botoes.propriedades===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoPropriedades())}if(botoes.salva===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoSalva())}if(botoes.ajuda===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoAjuda())}if(botoes.fecha===true){i3GEOpanelEditor.appendChild(i3GEO.editorOL.botaoFecha())}if(!onde){i3GEOpanelEditor.style.width=i3GEOpanelEditor.getElementsByTagName("div").length*33+"px";i3GEO.editorOL.mapa.getViewport().getElementsByClassName("ol-overlaycontainer-stopevent")[0].appendChild(i3GEOpanelEditor)}},removeFeaturesSel:function(){var s,i,nsel,f;nsel=i3GEO.editorOL.idsSelecionados.length;s=i3GEO.desenho.layergrafico.getSource();for(i=0;i<nsel;i++){f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);if(f){i3GEO.editorOL.featuresBackup.push(f.clone());s.removeFeature(f)}}i3GEO.editorOL.idsSelecionados=[]},mudaSimbolo:function(estilo,obj){var s,i,nsel,f;i3GEO.editorOL.simbologia[estilo]=obj.value;nsel=i3GEO.editorOL.idsSelecionados.length;s=i3GEO.desenho.layergrafico.getSource();for(i=0;i<nsel;i++){f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);if(f){if(estilo==="externalGraphic"||estilo==="graphicWidth"||estilo==="graphicHeight"){f.setProperties({src:i3GEO.editorOL.simbologia.externalGraphic,size:[i3GEO.editorOL.simbologia.graphicWidth,i3GEO.editorOL.simbologia.graphicHeight]})}else{f.setProperties({fillColor:'rgba('+i3GEO.editorOL.simbologia.fillColor+','+i3GEO.editorOL.simbologia.opacidade+')',strokeColor:'rgba('+i3GEO.editorOL.simbologia.strokeColor+','+i3GEO.editorOL.simbologia.opacidade+')',width:i3GEO.editorOL.simbologia.strokeWidth,fontSize:i3GEO.editorOL.simbologia.fontSize,fontColor:i3GEO.editorOL.simbologia.fontColor,})}}}},adicionaMarcas:function(){if(i3GEO.editorOL.pontos.length===0){return}var x,y,index=0;for(index=0;index<i3GEO.editorOL.pontos.length;index=index+2){x=i3GEO.editorOL.pontos[index];y=i3GEO.editorOL.pontos[index+1];i3GEO.desenho.addPin(x,y,27,27,i3GEO.editorOL.marca)}},adicionaKml:function(){var temp,n,i,id,url;n=i3GEO.editorOL.kml.length;for(i=0;i<n;i++){id="kml"+i;url=i3GEO.editorOL.kml[i];var layerkml=new ol.layer.Vector({name:id,isBaseLayer:false,source:new ol.source.Vector({url:url,format:new ol.format.KML(),tipoServico:"kml"})});i3geoOL.addLayer(layerkml)}},propriedades:function(){if(i3GEO.editorOL.MUSTACHEPROPRIEDADES==""){$.get(i3GEO.configura.locaplic+"/ferramentas/editorol/templatePropriedades_mst.html",function(template){i3GEO.editorOL.MUSTACHEPROPRIEDADES=template;i3GEO.editorOL.propriedades()});return}if(!document.getElementById("panelpropriedadesEditor")){YAHOO.namespace("editorOL.container");YAHOO.editorOL.container.panel=new YAHOO.widget.Panel("panelpropriedadesEditor",{iframe:true,width:"350px",height:"300px",overflow:"auto",visible:false,draggable:true,close:true,strings:{close:"<span class='material-icons'>cancel</span>"}});var ins=Mustache.render(i3GEO.editorOL.MUSTACHEPROPRIEDADES,i3GEO.editorOL.simbologia);YAHOO.editorOL.container.panel.setBody(ins);if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.container.panel.setHeader("<span class='i3GeoTituloJanelaBsNolink'>Propriedades</span>")}else{YAHOO.editorOL.container.panel.setHeader("Propriedades")}YAHOO.editorOL.container.panel.setFooter("");YAHOO.editorOL.container.panel.render(document.body);YAHOO.editorOL.container.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.container.panel.close,"click",function(){});i3GEO.util.aplicaAquarela("panelpropriedadesEditor")}YAHOO.editorOL.container.panel.show();temp=$i("panelpropriedadesEditor").getElementsByTagName("div");if(temp&&temp[2]){temp[2].style.overflow="auto"}},listaGeometrias:function(){if(!document.getElementById("panellistagEditor")){YAHOO.namespace("editorOL.listaGeometrias");YAHOO.editorOL.listaGeometrias.panel=new YAHOO.widget.Panel("panellistagEditor",{iframe:true,width:"380px",height:"300px",overflow:"auto",visible:false,draggable:true,close:true,strings:{close:"<span class='material-icons'>cancel</span>"}});if(i3GEO&&typeof i3GEO!=undefined&&i3GEO!=""){YAHOO.editorOL.listaGeometrias.panel.setHeader("<span class='i3GeoTituloJanelaBsNolink' >"+$trad("u6")+"</span>")}else{YAHOO.editorOL.listaGeometrias.panel.setHeader($trad("u6"))}YAHOO.editorOL.listaGeometrias.panel.setFooter("");YAHOO.editorOL.listaGeometrias.panel.render(document.body);YAHOO.editorOL.listaGeometrias.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.listaGeometrias.panel.close,"click",function(){YAHOO.editorOL.listaGeometrias.panel.destroy()})}else{YAHOO.editorOL.listaGeometrias.panel.render(document.body)}var id,temp,geos=i3GEO.desenho.layergrafico.getSource().getFeatures(),n=geos.length,ins="";ins+='<div class="container-fluid" style="height:210px;overflow:auto">';while(n>0){n-=1;id=geos[n].getId();if(id){ins+='<h5>'+'<button title="Unsel" onclick="i3GEO.editorOL.unselFeature(\''+id+'\')" class="btn btn-xs" style="margin:2px;padding:2px;"><span class="material-icons">clear</span></button>'+'<a title="Sel" onclick="i3GEO.editorOL.selFeature(\''+id+'\')" href="javascript:void(0)">'+id+"</a></h5>"}}ins+="</div>";if(geos.length===0){ins='<div class="container-fluid" >'+$trad("meneditor2")+"</div>"}YAHOO.editorOL.listaGeometrias.panel.setBody(ins);YAHOO.editorOL.listaGeometrias.panel.show()},ferramentas:function(){if(i3GEO.editorOL.MUSTACHEFERRAMENTAS==""){$.get(i3GEO.configura.locaplic+"/ferramentas/editorol/templateFerramentas_mst.html",function(template){i3GEO.editorOL.MUSTACHEFERRAMENTAS=template;i3GEO.editorOL.ferramentas()});return}var b,ins;if(!document.getElementById("panelferramentasEditor")){YAHOO.namespace("editorOL.ferramentas");YAHOO.editorOL.ferramentas.panel=new YAHOO.widget.Panel("panelferramentasEditor",{zIndex:20000,iframe:true,width:"300px",visible:false,draggable:true,close:true,strings:{close:"<span class='material-icons'>cancel</span>"}});var hash={"opsel":$trad("opsel"),"p14":$trad("p14"),"hidden":"hidden"};if(i3GEO.php){hash.hidden=""}ins=Mustache.render(i3GEO.editorOL.MUSTACHEFERRAMENTAS,hash);YAHOO.editorOL.ferramentas.panel.setBody(ins);YAHOO.editorOL.ferramentas.panel.setHeader("<span class='i3GeoTituloJanelaBsNolink' >Ferramentas</span>");YAHOO.editorOL.ferramentas.panel.setFooter("");YAHOO.editorOL.ferramentas.panel.render(document.body);YAHOO.editorOL.ferramentas.panel.center();YAHOO.util.Event.addListener(YAHOO.editorOL.ferramentas.panel.close,"click",function(){})}else{YAHOO.editorOL.ferramentas.panel.render(document.body)}YAHOO.editorOL.ferramentas.panel.show()},snap:function(){var target=i3GEOOLsnap.targets[0],tipos=["node","vertex","edge"],ntipos=tipos.length,i,temp,ativa=false;i3GEOOLsnap.deactivate();for(i=0;i<ntipos;i++){temp=$i("target_"+tipos[i]);target[tipos[i]]=temp.checked;if(temp.checked===true){ativa=true}temp=$i("target_"+tipos[i]+"Tolerance");target[tipos[i]+"Tolerance"]=temp.value}if(ativa===true){i3GEOOLsnap.activate()}},split:function(){i3GEOOLsplit.deactivate();var temp=$i("edge_split_toggle");if(temp.checked===true){i3GEOOLsplit.activate()}},processageo:function(operacao){if(operacao===""){return}var polis,linhas,pontos,temp,nsel=i3GEO.editorOL.idsSelecionados.length;if(nsel>0){temp=function(retorno){if(i3GEO.janela){i3GEO.janela.fechaAguarde("i3GEO.editorPoli");i3GEO.janela.fechaAguarde("i3GEO.editorLinhas");i3GEO.janela.fechaAguarde("i3GEO.editorPontos")}if(retorno!=""&&retorno.data&&retorno.data!=""&&operacao!="converteSHP"){i3GEO.editorOL.substituiFeaturesSel(retorno.data)}if(operacao==="converteSHP"){i3GEO.atualiza();i3GEO.janela.minimiza("paneltemaativo")}};if(operacao==="incorporar"){polis=i3GEO.editorOL.retornaFeaturesTipo("Polygon");linhas=i3GEO.editorOL.retornaFeaturesTipo("LineString");pontos=i3GEO.editorOL.retornaFeaturesTipo("Point");if(polis.length>0){temp=i3GEO.editorOL.merge(polis)}if(linhas.length>0){temp=i3GEO.editorOL.merge(linhas)}if(pontos.length>0){temp=i3GEO.editorOL.desagrupa(pontos)}if(i3GEO.mapa){i3GEO.mapa.dialogo.wkt2layer(temp)}return}if(operacao==="union"&&!i3GEO.php){polis=i3GEO.editorOL.retornaFeaturesTipo("Polygon");linhas=i3GEO.editorOL.retornaFeaturesTipo("LineString");pontos=i3GEO.editorOL.retornaFeaturesTipo("Point");if(polis.length>0){temp=i3GEO.editorOL.uniaojts(polis);i3GEO.editorOL.substituiFeaturesSel(temp)}if(linhas.length>0){temp=i3GEO.editorOL.uniaojts(linhas);i3GEO.editorOL.substituiFeaturesSel(temp)}if(pontos.length>0){temp=i3GEO.editorOL.uniaojts(pontos);i3GEO.editorOL.substituiFeaturesSel(temp)}}else{polis=i3GEO.editorOL.retornaGeometriasTipo("Polygon");linhas=i3GEO.editorOL.retornaGeometriasTipo("LineString");pontos=i3GEO.editorOL.retornaGeometriasTipo("Point");if(polis.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPoli","Poligonos");i3GEO.php.funcoesGeometriasWkt(temp,polis.join("|"),operacao)}if(linhas.length>0){i3GEO.janela.abreAguarde("i3GEO.editorLinhas","Linhas");i3GEO.php.funcoesGeometriasWkt(temp,linhas.join("|"),operacao)}if(pontos.length>0){i3GEO.janela.abreAguarde("i3GEO.editorPontos","Pontos");i3GEO.php.funcoesGeometriasWkt(temp,pontos.join("|"),operacao)}}i3GEO.desenho.layergrafico.getSource().changed();return}else{i3GEO.janela.tempoMsg("Selecione pelo menos dois elementos")}},desagrupa:function(geoms){var n=geoms.length,w=[],g,m,i,format=new ol.format.WKT();for(i=0;i<n;i++){g=format.writeFeatures([geoms[i]]);m=new Wkt.Wkt();m.read(g);w.push(m)}return w.join("\n")},merge:function(geoms){var n=geoms.length,w=new Wkt.Wkt(),g,m,i,f,format=new ol.format.WKT();f=format.writeFeatures([geoms[0]]);w.read(f);if(n>1){for(i=1;i<n;i++){g=format.writeFeatures([geoms[i]]);m=new Wkt.Wkt();m.read(g);w.merge(m)}}return w.write()},uniaojts:function(geoms){var n=geoms.length,fwkt=new ol.format.WKT(),rwkt=new jsts.io.WKTReader(),wwkt=new jsts.io.WKTWriter(),g,i,uniao;if(n>1){uniao=fwkt.writeFeatures([geoms[0]]);uniao=rwkt.read(uniao);for(i=1;i<=n;i++){g=fwkt.writeFeatures([geoms[i]]);uniao=uniao.union(rwkt.read(g))}uniao=wwkt.write(uniao);return[fwkt.readFeatures(uniao)]}else{return false}},retornaGeometriasTipo:function(tipo){var n=i3GEO.editorOL.idsSelecionados.length,lista=[],i,s=i3GEO.desenho.layergrafico.getSource(),fwkt=new ol.format.WKT();for(i=0;i<n;i++){f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);if(f.getGeometry().getType()==tipo){lista.push(fwkt.writeFeatures([f]))}}return lista},retornaFeaturesTipo:function(tipo){var n=i3GEO.editorOL.idsSelecionados.length,lista=[],i,s=i3GEO.desenho.layergrafico.getSource();for(i=0;i<n;i++){f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);if(f.getGeometry().getType()==tipo){lista.push(f)}}return lista},guardaBackup:function(){return},selTodos:function(){i3GEO.editorOL.unselTodos();var features,n,f,i,id,st;features=i3GEO.desenho.layergrafico.getSource().getFeatures();n=features.length;for(i=0;i<n;i++){f=features[i];id=f.getId();if(!id){id=i3GEO.util.uid();f.setId(id)}i3GEO.editorOL.idsSelecionados.push(id);st=f.getStyle();if(st&&st.getImage()){f.setStyle(new ol.style.Style({image:new ol.style.Circle({radius:i3GEO.editorOL.simbologia.pointRadius,fill:new ol.style.Fill({color:'rgba(255, 255, 255, 0.5)'}),stroke:new ol.style.Stroke({color:'blue',width:i3GEO.editorOL.simbologia.pointRadius/3})})}));if(st.getImage().getSrc){f.setProperties({fillColor:"",strokeColor:"",externalGraphic:st.getImage().getSrc(),graphicHeight:st.getImage().getSize()[1],graphicWidth:st.getImage().getSize()[0]})}else{f.setProperties({fillColor:st.getImage().getFill().getColor(),strokeColor:st.getImage().getStroke().getColor(),externalGraphic:"",graphicHeight:"",graphicWidth:""})}}else if(st){f.setProperties({fillColor:st.getFill().getColor(),strokeColor:st.getStroke().getColor()});st.getFill().setColor('rgba(255, 255, 255, 0.5)');st.getStroke().setColor('blue')}}i3GEO.desenho.layergrafico.getSource().changed()},unselTodos:function(){var i,n,f,s,st;s=i3GEO.desenho.layergrafico.getSource();n=i3GEO.editorOL.idsSelecionados.length;for(i=0;i<n;i++){f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);if(f){st=f.getStyle();if(st&&st.getImage()){if(st.getImage().getSrc||f.getProperties().externalGraphic!=""){f.setStyle(new ol.style.Style({image:new ol.style.Icon({src:f.getProperties().externalGraphic,size:[f.getProperties().graphicWidth,f.getProperties().graphicHeight]})}))}else{f.setStyle(new ol.style.Style({image:new ol.style.Circle({radius:i3GEO.editorOL.simbologia.pointRadius,fill:new ol.style.Fill({color:f.getProperties().fillColor}),stroke:new ol.style.Stroke({color:f.getProperties().strokeColor,width:i3GEO.editorOL.simbologia.pointRadius/3})})}))}}else if(st){st.getFill().setColor(f.getProperties().fillColor);st.getStroke().setColor(f.getProperties().strokeColor)}}}i3GEO.editorOL.idsSelecionados=[];i3GEO.desenho.layergrafico.getSource().changed()},unselTodosBackup:function(){var n,i;n=i3GEO.editorOL.backup.features.length;for(i=0;i<n;i++){i3GEO.editorOL.backup.features[i].renderIntent="default";i3GEO.editorOL.selbutton.unselect(i3GEO.editorOL.backup.features[i])}},unselFeature:function(id){var f,s;s=i3GEO.desenho.layergrafico.getSource();f=s.getFeatureById(id);if(f){if(f.getStyle()&&f.getStyle().getSrc){f.getStyle().setSrc(f.getProperties().externalGraphic);f.getStyle().setSize([f.getProperties().graphicWidth,f.getProperties().graphicHeight])}else{f.getStyle().getFill().setColor(f.getProperties().fillColor);f.getStyle().getStroke().setColor(f.getProperties().strokeColor)}}i3GEO.editorOL.idsSelecionados.remove(id);i3GEO.desenho.layergrafico.getSource().changed()},restauraBackup:function(){if(i3GEO.editorOL.backup.features.length>0){i3GEO.desenho.layergrafico.removeFeatures(i3GEO.desenho.layergrafico.features);i3GEO.desenho.layergrafico.addFeatures(i3GEO.editorOL.backup.features)}if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},substituiFeaturesSel:function(f){i3GEO.editorOL.removeFeaturesSel();var fwkt=new ol.format.WKT();f=fwkt.readFeatures(f)[0];f.setStyle(new ol.style.Style({stroke:new ol.style.Stroke({color:'rgba('+i3GEO.editorOL.simbologia.strokeColor+','+i3GEO.editorOL.simbologia.opacidade+')',width:i3GEO.editorOL.simbologia.strokeWidth}),fill:new ol.style.Fill({color:'rgba('+i3GEO.editorOL.simbologia.fillColor+','+i3GEO.editorOL.simbologia.opacidade+')'})}));f.setId(i3GEO.util.uid());i3GEO.desenho.layergrafico.getSource().addFeature(f)},adicionaFeatureWkt:function(wkt,atributos){var f,fwkt=new OpenLayers.Format.WKT();if(atributos.externalGraphic&&atributos.externalGraphic!=""){var style_mark=OpenLayers.Util.extend({},OpenLayers.Feature.Vector.style['default']);style_mark.externalGraphic=atributos.externalGraphic;style_mark.graphicWidth=atributos.graphicWidth;style_mark.graphicHeight=atributos.graphicHeight;style_mark.fillOpacity=atributos.opacidade;f=fwkt.read(wkt);f["attributes"]=atributos;f["style"]=style_mark}else{f=fwkt.read(wkt);f["attributes"]=atributos}i3GEO.desenho.layergrafico.addFeatures([f]);if(document.getElementById("panellistagEditor")){i3GEO.editorOL.listaGeometrias()}},flashFeaturesI:function(index){i3GEO.editorOL.flashFeatures([i3GEO.desenho.layergrafico.features[index]],0)},flashFeatures:function(features,index){if(!index){index=0}var current=features[index];if(current&&current.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(features[index],"select")}var prev=features[index-1];if(prev&&prev.layer===i3GEO.desenho.layergrafico){i3GEO.desenho.layergrafico.drawFeature(prev,"default")}++index;if(index<=features.length){window.setTimeout(function(){i3GEO.editorOL.flashFeatures(features,index)},75)}},selFeature:function(id){var s,f;s=i3GEO.desenho.layergrafico.getSource();f=s.getFeatureById(id);if(!i3GEO.util.in_array(id,i3GEO.editorOL.idsSelecionados)){i3GEO.editorOL.idsSelecionados.push(id);f.setProperties({fillColor:f.getStyle().getFill().getColor(),strokeColor:f.getStyle().getStroke().getColor(),externalGraphic:""});f.getStyle().getFill().setColor('rgba(255, 255, 255, 0.5)');f.getStyle().getStroke().setColor('blue');s.changed()}},carregajts:function(funcao){if(i3GEO.configura){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}else{i3GEO.util.scriptTag("../pacotes/jsts/lib/jsts.js",funcao,"i3GEOjts",true)}},trazParaFrente:function(){var s,i,nsel,id,clone;s=i3GEO.desenho.layergrafico.getSource();nsel=i3GEO.editorOL.idsSelecionados.length;for(i=0;i<nsel;i++){f=s.getFeatureById(i3GEO.editorOL.idsSelecionados[i]);if(f){clone=f.clone();id=f.getId();s.removeFeature(f);clone.setId(id);s.addFeature(clone)}}s.changed()},pegaControle:function(classe){var n=i3GEO.editorOL.controles.length,i;for(i=0;i<n;i++){if(i3GEO.editorOL.controles[i].CLASS_NAME===classe){return i3GEO.editorOL.controles[i]}}return false},ativaLayerSwitcher:function(){var ls=i3GEO.editorOL.pegaControle("OpenLayers.Control.LayerSwitcher");if(ls){ls.maximizeDiv.click()}},desativaRodaDoMouse:function(){var controls=i3GEO.editorOL.mapa.getControlsByClass('OpenLayers.Control.Navigation');for(var i=0;i<controls.length;++i){controls[i].disableZoomWheel()}},google2wgs:function(obj){if(i3GEO.Interface.openlayers.googleLike===true){return obj.transform("EPSG:900913","EPSG:4326")}else{return obj}},sobeLayersGraficos:function(){}};i3GEO.editorOL.backup.getFeatures=function(){return i3GEO.editorOL.backup.getSource().getFeatures()};
3 3 \ No newline at end of file
... ...
init/remover.php
... ... @@ -1,46 +0,0 @@
1   -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2   -<html>
3   -<head>
4   -<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
5   -<link rel="stylesheet" type="text/css" href="../admin/html/admin.css">
6   -</head>
7   -
8   -<body class="yui-skin-sam fundoPonto" >
9   -<div class="bordaSuperior" >&nbsp;</div>
10   -<div class="mascaraPrincipal" id="divGeral" style=text-align:left >
11   -Remove a tela inicial de apresenta&ccedil;&atilde;o do i3Geo substituindo-a pela inicialliza&ccedil;&atilde;o direta do mapa.
12   -Ap&oacute;s remover, a tela inicial pode ser vista utilizando-se o endere&ccedil;o i3geo/init. Para definir qual a interface que
13   -ser&aacute; utilizada como default ao abrir o i3Geo edite o arquivo i3geo/ms_configura.php.<br><br>
14   -<?php
15   -exit;
16   -$locaplic = dirname(__FILE__)."/..";
17   -include_once(dirname(__FILE__)."/../admin/php/admin.php");
18   -include_once(dirname(__FILE__)."/../admin/php/conexao.php");
19   -
20   -if(empty($_POST["senha"]) || empty($_POST["usuario"])){
21   - formularioLoginMaster("remover.php");
22   - exit;
23   -}
24   -else{
25   - $continua = verificaMaster($_POST["usuario"],$_POST["senha"],$i3geomaster);
26   - if($continua == false){
27   - echo "<span style=color:red; >Usu&aacute;rio n&atilde;o registrado em i3geo/ms_configura.php na vari&aacute;vel i3geomaster";
28   - exit;
29   - }
30   -}
31   -//error_reporting(0);
32   -unlink("../index.htm");
33   -unlink("../index.html");
34   -if(file_exists("../index.htm") || file_exists("../index.html")){
35   - echo "<span style=color:red; > Sem permissao do sistema opercaional para excluir arquivo";
36   - exit;
37   -}
38   -copy("_index.htm","../index.htm");
39   -copy("_index.html","../index.html");
40   -chmod("../index.htm",0777);
41   -chmod("../index.html",0777);
42   -echo "<br><b>OK. Removido. Voce pode utilizar o init digitando i3geo/init no navegador";
43   -?>
44   -</div>
45   -</body>
46   -</html>
js/compactados/ajuda_compacto.js 100755 → 100644
js/compactados/analise_compacto.js 100755 → 100644
js/compactados/arvoredecamadas_compacto.js 100755 → 100644
js/compactados/arvoredetemas_compacto.js 100755 → 100644
js/compactados/base64_compacto.js 100755 → 100644
js/compactados/busca_compacto.js 100755 → 100644
js/compactados/caixaDeFerramentas_compacto.js 100755 → 100644
js/compactados/calculo_compacto.js 100755 → 100644
js/compactados/catalogoDir_compacto.js 100755 → 100644
js/compactados/catalogoEstrelas_compacto.js 100755 → 100644
js/compactados/catalogoInde_compacto.js 100755 → 100644
js/compactados/catalogoMapas_compacto.js 100755 → 100644
js/compactados/catalogoMenus_compacto.js 100755 → 100644
js/compactados/catalogoMetaestat_compacto.js 100755 → 100644
js/compactados/catalogoOgc_compacto.js 100755 → 100644
js/compactados/catalogoRegioes_compacto.js 100755 → 100644
js/compactados/catalogoSistemas_compacto.js 100755 → 100644
js/compactados/configura_compacto.js 100755 → 100644
js/compactados/coordenadas_compacto.js 100755 → 100644
js/compactados/desenho_compacto.js 100755 → 100644
js/compactados/dicionario_ajuda_compacto.js 100755 → 100644
js/compactados/dicionario_compacto.js 100755 → 100644
js/compactados/editor_compacto.js 100755 → 100644
js/compactados/eventos_compacto.js 100755 → 100644
js/compactados/guias_compacto.js 100755 → 100644
js/compactados/idioma_compacto.js 100755 → 100644
js/compactados/ini_i3geo_compacto.js 100755 → 100644
js/compactados/interface_compacto.js 100755 → 100644
js/compactados/janela_compacto.js 100755 → 100644
js/compactados/legenda_compacto.js 100755 → 100644
js/compactados/login_compacto.js 100755 → 100644
js/compactados/mapa_compacto.js 100755 → 100644
js/compactados/maparef_compacto.js 100755 → 100644
js/compactados/marcador_compacto.js 100755 → 100644
js/compactados/mustache.js 100755 → 100644
js/compactados/navega_compacto.js 100755 → 100644
js/compactados/php_compacto.js 100755 → 100644
js/compactados/plugini3geo_compacto.js 100755 → 100644
js/compactados/proj4js.js 100755 → 100644
js/compactados/social_compacto.js 100755 → 100644
js/compactados/tema_compacto.js 100755 → 100644
js/compactados/util_compacto.js 100755 → 100644
js/compactados/wicket.js 100755 → 100644
js/i3geo_tudo_compacto7.js.php 100755 → 100644
kml.php
... ... @@ -42,7 +42,7 @@ idioma - pt|en|es
42 42 include_once ("classesphp/carrega_ext.php");
43 43 include_once ("classesphp/classe_menutemas.php");
44 44 include_once ("ms_configura.php");
45   -include_once ("admin/php/conexao.php");
  45 +include_once ("classesphp/conexao.php");
46 46 $encoding = "ISO-8859-1";
47 47 if($convUTF == true){
48 48 $encoding = "UTF-8";
... ... @@ -94,7 +94,7 @@ foreach($menus as $menu){
94 94 else{
95 95 $coluna = $idioma;
96 96 }
97   -
  97 +
98 98 $sql = "select id_raiz,i3geoadmin_raiz.id_tema,$coluna as nome_tema,tipoa_tema,codigo_tema,kmz_tema FROM ".$esquemaadmin."i3geoadmin_raiz LEFT JOIN ".$esquemaadmin."i3geoadmin_temas ON i3geoadmin_temas.id_tema = i3geoadmin_raiz.id_tema where (lower(i3geoadmin_temas.tipoa_tema) != 'wms' or i3geoadmin_temas.tipoa_tema is null) and (lower(i3geoadmin_temas.kml_tema) != 'nao' or i3geoadmin_temas.kml_tema isnull) and i3geoadmin_temas.tipoa_tema != 'WMS' and i3geoadmin_temas.kml_tema != 'nao' and i3geoadmin_raiz.id_menu='$id_menu' and i3geoadmin_raiz.nivel = 0 and i3geoadmin_raiz.id_nivel = 0 order by ordem";
99 99 $temas = pegaDados($sql);
100 100 if(count($temas) > 0){
... ... @@ -102,14 +102,14 @@ foreach($menus as $menu){
102 102 $xml .= kml_tema_bd($tema);
103 103 }
104 104 }
105   -
  105 +
106 106 if($idioma == "pt"){
107 107 $coluna = "nome_grupo";
108 108 }
109 109 else{
110 110 $coluna = $idioma;
111 111 }
112   -
  112 +
113 113 $grupos = pegaDados("SELECT $coluna as nome_grupo,n1.id_n1,n1.id_grupo,gr.desc_grupo from ".$esquemaadmin."i3geoadmin_n1 as n1,".$esquemaadmin."i3geoadmin_grupos as gr where (lower(n1.publicado) != 'nao' or n1.publicado is null) and n1.id_menu = '$id_menu' and n1.id_grupo = gr.id_grupo order by gr.nome_grupo");
114 114 foreach($grupos as $grupo){
115 115 $xml .= kml_cabecalho($grupo["nome_grupo"],$grupo["desc_grupo"]);
... ... @@ -203,7 +203,7 @@ function kml_tema_bd($tema){
203 203 $legenda = "<a href='$urli3geo/ogc.php?tema=$id&layer=$id&request=getlegendgraphic&service=wms&format=image/jpeg' >Legenda </a>";
204 204 $urlLegenda = $urli3geo."/ogc.php?tema=$id&layer=$id&request=getlegendgraphic&service=wms&format=image/jpeg";
205 205 $href = "$urli3geo/ogc.php?tema=$id&amp;width=800&amp;height=800&amp;VERSION=1.1.1&amp;REQUEST=GetMap&amp;SRS=EPSG:4326&amp;STYLES=&amp;BGCOLOR=0xFFFFFF&amp;FORMAT=image/png&amp;TRANSPARENT=TRUE&amp;layers=$id";
206   -
  206 +
207 207 $xml .= kml_servico($nome,$fonte,$legenda,$desc,$href,$urlLegenda);
208 208  
209 209 if(strtolower($tema["kmz_tema"]) == "sim"){
... ...
mashups/openlayersdebug.php
... ... @@ -11,6 +11,11 @@ include_once (dirname(__FILE__) . &quot;/../classesphp/funcoes_gerais.php&quot;);
11 11 // error_reporting(0);
12 12 // variaveis utilizadas
13 13 $parurl = array_merge($_GET, $_POST);
  14 +if(count($parurl) == 0){
  15 + ajuda();
  16 + exit;
  17 +}
  18 +
14 19 if (isset($parurl["opacidade"])) {
15 20 $opacidade = $parurl["opacidade"] * 1;
16 21 } else {
... ... @@ -36,6 +41,18 @@ if(!isset($parurl[&quot;visiveis&quot;])){
36 41 }
37 42 $visiveis = explode(",", str_replace(" ", ",", $parurl["visiveis"]));
38 43 $off = array_diff($temas, $visiveis);
  44 +//filtros
  45 +$filtros = array();
  46 +foreach($temas as $tema){
  47 + if(isset($parurl["map_layer_".$tema."_filter"])){
  48 + $filtros[] = array(
  49 + "layer"=>$tema,
  50 + "expression"=>$parurl["map_layer_".$tema."_filter"]
  51 + );
  52 + }
  53 +}
  54 +$filtros = json_encode($filtros);
  55 +
39 56 $estilo = "";
40 57 if (isset($parurl["altura"])) {
41 58 $estilo .= ";height:" . $parurl["altura"] . "px";
... ... @@ -69,6 +86,11 @@ if (isset($controles)) {
69 86 if (in_array("overviewmap", $controles)) {
70 87 $objControles[] = "new ol.control.OverviewMap()";
71 88 }
  89 +} else {
  90 + $objControles[] = "new ol.control.Zoom()";
  91 + $objControles[] = "new ol.control.ZoomSlider()";
  92 + $objControles[] = "new ol.control.ScaleLine()";
  93 + $objControles[] = "new ol.control.MousePosition({coordinateFormat : function(c){return ol.coordinate.toStringHDMS(c);}})";
72 94 }
73 95 $botoes = $parurl["botoes"];
74 96 //
... ... @@ -214,7 +236,36 @@ if (isset($botoes)) {
214 236 }
215 237 $botoes = "{" . implode(",", $objBotoes) . "}";
216 238 } else {
217   - $botoes = "{}";
  239 + $objBotoes[] = "'imprimir':true";
  240 + $objBotoesHtml["zoombox"] = "";
  241 + $objBotoesHtml["analise"] = "";
  242 + $objBotoesHtml["camadas"] = "";
  243 + $objBotoesHtml["catalogo"] = "";
  244 + $objBotoesHtml["legenda"] = "";
  245 + $objBotoesHtml["procura"] = "";
  246 + $objBotoesHtml["identifica"] = "";
  247 + $objBotoesHtml["zoomtot"] = "";
  248 + $objBotoesHtml["zoomanterior"] = "";
  249 + $objBotoesHtml["zoomproximo"] = "";
  250 + $objBotoesHtml["grid"] = "";
  251 + $objBotoesHtml["marcador"] = "";
  252 + $objBotoes[] = "'distancia':true";
  253 + $objBotoes[] = "'area':true";
  254 + $objBotoes[] = "'linha':true";
  255 + $objBotoes[] = "'ponto':true";
  256 + $objBotoes[] = "'poligono':true";
  257 + $objBotoes[] = "'edita':true";
  258 + $objBotoes[] = "'listag':true";
  259 + $objBotoes[] = "'corta':true";
  260 + $objBotoes[] = "'apaga':true";
  261 + $objBotoes[] = "'salva':true";
  262 + $objBotoes[] = "'tools':true";
  263 + $objBotoes[] = "'undo':true";
  264 + $objBotoes[] = "'propriedades':true";
  265 + $objBotoes[] = "'frente':true";
  266 +
  267 + $botoes = "{" . implode(",", $objBotoes) . "}";
  268 +
218 269 }
219 270 if (isset($parurl["kml"])) {
220 271 $kml = $parurl["kml"];
... ... @@ -255,11 +306,11 @@ if(isset($parurl[&quot;tiles&quot;])){
255 306 else{
256 307 $tiles = "true";
257 308 }
258   -if(isset($parurl["ativarodadomouse"]) && $parurl["ativarodadomouse"] == "true"){
259   - $ativarodadomouse = "new ol.interaction.MouseWheelZoom(),";
  309 +if(isset($parurl["ativarodadomouse"]) && $parurl["ativarodadomouse"] == "false"){
  310 + $ativarodadomouse = "";
260 311 }
261 312 else{
262   - $ativarodadomouse = "";
  313 + $ativarodadomouse = "new ol.interaction.MouseWheelZoom(),";
263 314 }
264 315 $legendahtml = $parurl["legendahtml"];
265 316 $layerDefault = $parurl["layerDefault"];
... ... @@ -435,6 +486,13 @@ function ajuda()
435 486 width: auto;
436 487 max-width: 70px;
437 488 }
  489 +
  490 +.ol-mouse-position {
  491 + left: 10px;
  492 + position: absolute;
  493 + bottom: 5px;
  494 + top: auto;
  495 +}
438 496 </style>
439 497 </head>
440 498 <!-- As palavras entre {{{}}} sao utilizadas para a traducao. Veja i3geo/js/dicionario.js
... ... @@ -1034,10 +1092,7 @@ function ajuda()
1034 1092 //filtros que serao aplicados aos layers. Utilize a expressaso conforme definido na documentacao
1035 1093 //do mapserver, exemplo
1036 1094 //{layer: "_lbiomashp",expression: "(('[CD_LEGENDA]'='CAATINGA'))"} ou {layer: "_lbiomashp",expression: "cd_legenda='CAATINGA'"}
1037   - filters: [{
1038   - layer: "",
1039   - expression: ""
1040   - }],
  1095 + filters: <?php echo $filtros;?>,
1041 1096 //id de um mapa salvo e que sera recuperado
1042 1097 restoreMapId : <?php echo $restauramapa;?>,
1043 1098 cacheOff : '<?php echo $DESLIGACACHE;?>'
... ... @@ -1068,6 +1123,7 @@ function ajuda()
1068 1123 //$('.iconeGuiaMovel').tooltip('show');
1069 1124 $("#i3GEOguiaMovelConteudo").mCustomScrollbar({scrollbarPosition: "outside",theme:"inset-2-dark"});
1070 1125 adicionaBotoesEditor();
  1126 + $i("openlayers").style.backgroundColor = "rgb(245,245,245)";
1071 1127 },
1072 1128 //parametros de configuracao de diferentes componentes do mapa, como o catalogo de temas, balao de info, etc
1073 1129 components : {
... ...
ms_configura.php
... ... @@ -258,6 +258,16 @@ $statusFerramentas = array(
258 258 "melhorcaminho"=>false
259 259 );
260 260 /*
  261 +Variable: $i3GeoRegistraAcesso
  262 +
  263 +Permite ou nao registrar no banco de dados quando uma camada e adicionada ao mapa, possibilitando a geracao de estatisticas.
  264 +
  265 +Quando true, e necessario que exista um usuario com permissao de escrita no banco de dados de administracao, o que pode nao ser desejado em ambientes de producao.
  266 +
  267 +Afeta apenas as estatisticas de acesso.
  268 + */
  269 +$i3GeoRegistraAcesso = false;
  270 +/*
261 271 Variable: $i3geoBlFerramentas
262 272  
263 273 Lista de ferramentas que sao bloqueadas, impedindo sua execucao.
... ... @@ -514,7 +524,6 @@ Tipo:
514 524 {string}
515 525 */
516 526 $metaestatTemplates = "/ferramentas/metaestat/templates";
517   -
518 527 /*
519 528 Variable: navegadoresLocais
520 529  
... ... @@ -690,7 +699,7 @@ Variable: conexaoadmin
690 699  
691 700 Arquivo PHP que define a string de conexao (PDO) com o banco de dados administrativo.
692 701  
693   -Esse arquivo e incluido no programa i3geo/admin/conexao.php
  702 +Esse arquivo e incluido no programa conexao.php
694 703  
695 704 O banco de dados administrativo e utilizado para definir coisas como a arvore de temas, arvore de mapas, etc.
696 705  
... ... @@ -698,7 +707,7 @@ O banco de dados, originalmente, e montado em SQLITE, porem, em ambientes corpor
698 707  
699 708 Se voce quiser utilizar a conexao default, baseado no SQLITE, mantenha essa variavel vazia.
700 709  
701   -O programa PHP que estabelece a conexao deve retornar objetos com nomes padronizados. Veja o arquivo i3geo/admin/conexao.php e i3geo/admin/php/conexaopostgresql.php para maiores detalhes.
  710 +O programa PHP que estabelece a conexao deve retornar objetos com nomes padronizados. Veja o arquivo classesphp/conexao.php, admin1/php/conexao.php e i3geo/admin1/php/conexaopostgresql.php para maiores detalhes.
702 711  
703 712 Para criar o banco de dados de administracao utilize http://nome_do_host/i3geo/admin1/ferramentas/criabanco/index.php
704 713  
... ...
pacotes/cpaint/cpaint2_compacto.inc.js 100755 → 100644
pacotes/mobileesp/mdetect_compacto.js 100755 → 100644
pacotes/yui290/build/carousel/carousel_compacto.js 100755 → 100644
pacotes/yui290/build/container/container_compacto.js 100755 → 100644
pacotes/yui290/build/container/container_core_compacto.js 100755 → 100644
pacotes/yui290/build/resize/resize_compacto.js 100755 → 100644
pacotes/yui290/build/treeview/treeview_compacto.js 100755 → 100644
pacotes/yui290/build/utilities/utilities_compacto.js 100755 → 100644
testainstal/index.php
... ... @@ -335,7 +335,7 @@ HTML;
335 335 echo permissoesarquivo($locaplic."/admin/admin.db");
336 336 echo "</span></div>";
337 337 }
338   - include_once("../admin/php/conexao.php");
  338 + include_once("../classesphp/conexao.php");
339 339 echo "<h4>Verificando banco de dados de administra&ccedil;&atilde;o</h4>";
340 340 echo "<pre>";
341 341 //TODO Verificar ao fechar versao - verificar tabelas
... ... @@ -383,7 +383,7 @@ HTML;
383 383 "i3geoestat_medida_variavel_link" => "link,id_medida_variavel,nome,id_link",
384 384 "i3geoestat_parametro_medida" => "id_parametro_medida,coluna,nome,descricao,id_pai,id_medida_variavel,tipo"
385 385 );
386   - include_once("../admin/php/conexao.php");
  386 + include_once("../classesphp/conexao.php");
387 387 if(!empty($esquemaadmin)){
388 388 $esquemaadmin = str_replace(".","",$esquemaadmin).".";
389 389 }
... ...