Commit db3d8e126306fb1530265cefff2cb27beab2a3a9
1 parent
3165a2e6
Exists in
master
and in
7 other branches
Remoção de programas não utilizados da pasta i3geo/admin. Remoção da funcionalid…
…ade de edição vetorial na interface Google Maps
Showing
71 changed files
with
2234 additions
and
4316 deletions
Show diff stats
admin/php/admin.php
| ... | ... | @@ -354,7 +354,6 @@ function i3GeoAdminOrdena($pdo,$ordem,$tabela,$colunaid){ |
| 354 | 354 | return true; |
| 355 | 355 | } |
| 356 | 356 | //$logTransacoes vem do ms_configura.php |
| 357 | -//ver tambem classe_metaestat.php | |
| 358 | 357 | function i3GeoAdminInsertLog($pdo,$sql,$data=array()){ |
| 359 | 358 | global $esquemaadmin, $logTransacoes; |
| 360 | 359 | if($logTransacoes == "" || $logTransacoes !== true){ | ... | ... |
admin/php/metaestat.php
| ... | ... | @@ -1,1727 +0,0 @@ |
| 1 | -<?php | |
| 2 | -/* | |
| 3 | -Title: metaestat.php | |
| 4 | - | |
| 5 | -Funções utilizadas pelo sistema de metadados estatísticos | |
| 6 | - | |
| 7 | -Licenca: | |
| 8 | - | |
| 9 | -GPL2 | |
| 10 | - | |
| 11 | -i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 12 | - | |
| 13 | -Direitos Autorais Reservados (c) 2012 Edmar Moretti | |
| 14 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.gov.br | |
| 15 | - | |
| 16 | -Este programa é software livre; você pode redistribuí-lo | |
| 17 | -e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 18 | -GNU conforme publicada pela Free Software Foundation; | |
| 19 | - | |
| 20 | -Este programa é distribuído na expectativa de que seja útil, | |
| 21 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 22 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 23 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 24 | -Você deve ter recebido uma copia da Licença Pública Geral do | |
| 25 | -GNU junto com este programa; se não, escreva para a | |
| 26 | -Free Software Foundation, Inc., no endereço | |
| 27 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 28 | - | |
| 29 | -Arquivo: | |
| 30 | - | |
| 31 | -i3geo/admin/php/metaestat.php | |
| 32 | - | |
| 33 | -Parametros: | |
| 34 | - | |
| 35 | -O parâmetro principal é "funcao", que define qual operação será executada, por exemplo, sistemas.php?funcao=pegasistemas. | |
| 36 | - | |
| 37 | -Cada operação possuí seus proprios parâmetros, que devem ser enviados também na requisição da operação. | |
| 38 | -*/ | |
| 39 | -include_once(dirname(__FILE__)."/login.php"); | |
| 40 | - | |
| 41 | -$codigo_estat_conexao = $_GET["codigo_estat_conexao"];//pode ser string ou numerico | |
| 42 | -$codigo_variavel = (int) $_GET["codigo_variavel"]; | |
| 43 | -$codigo_tipo_periodo = (int) $_GET["codigo_tipo_periodo"]; | |
| 44 | -$codigo_tipo_regiao = (int) $_GET["codigo_tipo_regiao"]; | |
| 45 | -$codigo_unidade_medida = (int) $_GET["codigo_unidade_medida"]; | |
| 46 | -$codigo_tipo_regiao_pai = (int) $_GET["codigo_tipo_regiao_pai"]; | |
| 47 | -$id_medida_variavel = (int) $_GET["id_medida_variavel"]; | |
| 48 | -$id_classificacao = (int) $_GET["id_classificacao"]; | |
| 49 | -$id_link = (int) $_GET["id_link"]; | |
| 50 | -$id_classe = (int) $_GET["id_classe"]; | |
| 51 | -$id_parametro_medida = (int) $_GET["id_parametro_medida"]; | |
| 52 | -$id_fonteinfo = (int) $_GET["id_fonteinfo"]; | |
| 53 | -$id_agregaregiao = (int) $_GET["id_agregaregiao"]; | |
| 54 | -$id_mapa = (int) $_GET["id_mapa"]; | |
| 55 | -$id_mapa_grupo = (int) $_GET["id_mapa_grupo"]; | |
| 56 | -$id_mapa_tema = (int) $_GET["id_mapa_tema"]; | |
| 57 | -$id_pai = (int) $_GET["id_pai"]; | |
| 58 | - | |
| 59 | -//lista de funcoes que passam pela validacao de login | |
| 60 | -$funcoesEdicao = array( | |
| 61 | - "ALTERAMAPAGRUPO", | |
| 62 | - "ALTERAMAPATEMA", | |
| 63 | - "ALTERAMAPA", | |
| 64 | - "ALTERAVARIAVEL", | |
| 65 | - "ALTERAMEDIDAVARIAVEL", | |
| 66 | - "ALTERAPARAMETROMEDIDA", | |
| 67 | - "ALTERACLASSIFICACAOMEDIDA", | |
| 68 | - "CALCULACLASSIFICACAO", | |
| 69 | - "ALTERACLASSECLASSIFICACAO", | |
| 70 | - "ALTERALINKMEDIDA", | |
| 71 | - "ALTERAFONTEINFO", | |
| 72 | - "ADICIONAFONTEINFOMEDIDA", | |
| 73 | - "ALTERARUNIDADEMEDIDA", | |
| 74 | - "ALTERARCONEXAO", | |
| 75 | - "ALTERARTIPOREGIAO", | |
| 76 | - "ALTERAAGREGAREGIAO", | |
| 77 | - "ALTERARTIPOPERIODO", | |
| 78 | - "EXCLUIRMAPA", | |
| 79 | - "EXCLUIRMAPAGRUPO", | |
| 80 | - "EXCLUIRMAPATEMA", | |
| 81 | - "EXCLUIRVARIAVEL", | |
| 82 | - "EXCLUIRTIPOPERIODO", | |
| 83 | - "EXCLUIRUNIDADEMEDIDA", | |
| 84 | - "EXCLUIRFONTEINFO", | |
| 85 | - "EXCLUIRFONTEINFOMEDIDA", | |
| 86 | - "EXCLUIRCONEXAO", | |
| 87 | - "EXCLUIRTIPOREGIAO", | |
| 88 | - "EXCLUIRAGREGAREGIAO", | |
| 89 | - "EXCLUIRMEDIDAVARIAVEL", | |
| 90 | - "EXCLUIRPARAMETROMEDIDA", | |
| 91 | - "EXCLUIRCLASSIFICACAOMEDIDA", | |
| 92 | - "EXCLUIRCLASSECLASSIFICACAO", | |
| 93 | - "EXCLUIRLINKMEDIDA", | |
| 94 | - "OBTEMDADOSTABELADB", | |
| 95 | - "INSERIRDADOS", | |
| 96 | - "MANTEMDADOSREGIAO", | |
| 97 | - "SALVAATRIBUTOSTIPOREGIAO", | |
| 98 | - "SALVAATRIBUTOSMEDIDAVARIAVEL", | |
| 99 | - "EXCLUIATRIBUTOSMEDIDAVARIAVEL", | |
| 100 | - "REGIAO2SHP", | |
| 101 | - "ESQUEMASCONEXAO", | |
| 102 | - "TABELASESQUEMA", | |
| 103 | - "ALTERAESTILOSCLASSIFICACAO", | |
| 104 | - "INFOTABELA" | |
| 105 | -); | |
| 106 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | |
| 107 | - //se a funcao esta no array eh feita a verificacao se o usuario esta logado e se ele esta em um grupo que | |
| 108 | - //permite o uso da operacao admin/metaestat/geral | |
| 109 | - if(verificaOperacaoSessao("admin/metaestat/geral") == false){ | |
| 110 | - //algumas funcoes possuem tratamento especial sem login | |
| 111 | - if(strtoupper($funcao) == "ESQUEMASCONEXAO"){ | |
| 112 | - $esquema = array(array("oid"=>0,"esquema"=>"public")); | |
| 113 | - retornaJSON($esquema);exit; | |
| 114 | - } | |
| 115 | - if(strtoupper($funcao) == "TABELASESQUEMA"){ | |
| 116 | - if($_GET["nome_esquema"] != "public"){ | |
| 117 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | |
| 118 | - } | |
| 119 | - } | |
| 120 | - if(strtoupper($funcao) != "ESQUEMASCONEXAO" && strtoupper($funcao) != "TABELASESQUEMA"){ | |
| 121 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | |
| 122 | - } | |
| 123 | - } | |
| 124 | -} | |
| 125 | -//verifica as funcoes que manipulam o banco de dados | |
| 126 | -$funcoesEdicao = array( | |
| 127 | - "CRIATABELADB", | |
| 128 | - "CRIAESQUEMADB", | |
| 129 | - "ALTERANOMETABELADB", | |
| 130 | - "ALTERANOMEESQUEMADB", | |
| 131 | - "COPIATABELADB", | |
| 132 | - "CRIACOLUNADB", | |
| 133 | - "ALTERANOMECOLUNADB", | |
| 134 | -); | |
| 135 | -if(in_array(strtoupper($funcao),$funcoesEdicao)){ | |
| 136 | - if(verificaOperacaoSessao("admin/metaestat/editorbanco") == false){ | |
| 137 | - retornaJSON("Vc nao pode realizar essa operacao.");exit; | |
| 138 | - } | |
| 139 | -} | |
| 140 | - | |
| 141 | -include(dirname(__FILE__)."/classe_metaestat.php"); | |
| 142 | -//error_reporting(0); | |
| 143 | -//faz a busca da função que deve ser executada | |
| 144 | -switch (strtoupper($funcao)) | |
| 145 | -{ | |
| 146 | - /* | |
| 147 | - Note: | |
| 148 | - | |
| 149 | - Valores que o parâmetro &funcao pode receber. Os parâmetros devem ser enviados na requisição em AJAX. | |
| 150 | - */ | |
| 151 | - /* | |
| 152 | - Valor: LISTACONEXAO | |
| 153 | - | |
| 154 | - Lista de conexoes | |
| 155 | - | |
| 156 | - Retorno: | |
| 157 | - | |
| 158 | - {JSON} | |
| 159 | - */ | |
| 160 | - case "LISTACONEXAO": | |
| 161 | - $m = new Metaestat(); | |
| 162 | - retornaJSON($m->listaConexao($codigo_estat_conexao)); | |
| 163 | - exit; | |
| 164 | - break; | |
| 165 | - /* | |
| 166 | - Valor: LISTAVARIAVEL | |
| 167 | - | |
| 168 | - Lista de variaveis | |
| 169 | - | |
| 170 | - Retorno: | |
| 171 | - | |
| 172 | - {JSON} | |
| 173 | - */ | |
| 174 | - case "LISTAVARIAVEL": | |
| 175 | - $m = new Metaestat(); | |
| 176 | - if(empty($_GET["filtro_esquema"])){ | |
| 177 | - $_GET["filtro_esquema"] = ""; | |
| 178 | - } | |
| 179 | - retornaJSON($m->listaVariavel($codigo_variavel,$_GET["filtro_esquema"])); | |
| 180 | - exit; | |
| 181 | - break; | |
| 182 | - /* | |
| 183 | - Valor: LISTACLASSIFICACAOMEDIDA | |
| 184 | - | |
| 185 | - Lista as classificacoes de uma medida de uma variavel | |
| 186 | - | |
| 187 | - Retorno: | |
| 188 | - | |
| 189 | - {JSON} | |
| 190 | - */ | |
| 191 | - case "LISTACLASSIFICACAOMEDIDA": | |
| 192 | - $m = new Metaestat(); | |
| 193 | - retornaJSON($m->listaClassificacaoMedida($id_medida_variavel,$id_classificacao)); | |
| 194 | - exit; | |
| 195 | - break; | |
| 196 | - case "LISTALINKMEDIDA": | |
| 197 | - $m = new Metaestat(); | |
| 198 | - retornaJSON($m->listaLinkMedida($id_medida_variavel,$id_link)); | |
| 199 | - exit; | |
| 200 | - break; | |
| 201 | - /* | |
| 202 | - Valor: LISTACLASSECLASSIFICACAO | |
| 203 | - | |
| 204 | - Lista as classes de uma classificacoes | |
| 205 | - | |
| 206 | - Retorno: | |
| 207 | - | |
| 208 | - {JSON} | |
| 209 | - */ | |
| 210 | - case "LISTACLASSECLASSIFICACAO": | |
| 211 | - $m = new Metaestat(); | |
| 212 | - retornaJSON($m->listaClasseClassificacao($id_classificacao,$id_classe)); | |
| 213 | - exit; | |
| 214 | - break; | |
| 215 | - /* | |
| 216 | - Valor: LISTAMEDIDAVARIAVEL | |
| 217 | - | |
| 218 | - Lista das medidas de uma variavel | |
| 219 | - | |
| 220 | - Retorno: | |
| 221 | - | |
| 222 | - {JSON} | |
| 223 | - */ | |
| 224 | - case "LISTAMEDIDAVARIAVEL": | |
| 225 | - $m = new Metaestat(); | |
| 226 | - retornaJSON($m->listaMedidaVariavel($codigo_variavel,$id_medida_variavel)); | |
| 227 | - exit; | |
| 228 | - break; | |
| 229 | - /* | |
| 230 | - Valor: LISTAPARAMETRO | |
| 231 | - | |
| 232 | - Lista de parametros | |
| 233 | - | |
| 234 | - Retorno: | |
| 235 | - | |
| 236 | - {JSON} | |
| 237 | - */ | |
| 238 | - case "LISTAPARAMETRO": | |
| 239 | - $m = new Metaestat(); | |
| 240 | - retornaJSON($m->listaParametro($id_medida_variavel,$id_parametro_medida)); | |
| 241 | - exit; | |
| 242 | - break; | |
| 243 | - case "LISTAVALORESPARAMETRO": | |
| 244 | - $m = new Metaestat(); | |
| 245 | - retornaJSON($m->listaValoresParametro($id_parametro_medida)); | |
| 246 | - exit; | |
| 247 | - break; | |
| 248 | - /* | |
| 249 | - Valor: LISTAUNIDADEMEDIDA | |
| 250 | - | |
| 251 | - Lista de unidades de medida | |
| 252 | - | |
| 253 | - Retorno: | |
| 254 | - | |
| 255 | - {JSON} | |
| 256 | - */ | |
| 257 | - case "LISTAUNIDADEMEDIDA": | |
| 258 | - $m = new Metaestat(); | |
| 259 | - retornaJSON($m->listaUnidadeMedida($codigo_unidade_medida)); | |
| 260 | - exit; | |
| 261 | - break; | |
| 262 | - case "LISTAFONTEINFO": | |
| 263 | - $m = new Metaestat(); | |
| 264 | - retornaJSON($m->listaFonteinfo($id_fonteinfo)); | |
| 265 | - exit; | |
| 266 | - break; | |
| 267 | - case "LISTAFONTEINFOMEDIDA": | |
| 268 | - $m = new Metaestat(); | |
| 269 | - retornaJSON($m->listaFonteinfoMedida($id_medida_variavel)); | |
| 270 | - exit; | |
| 271 | - break; | |
| 272 | - /* | |
| 273 | - Valor: LISTATIPOPERIODO | |
| 274 | - | |
| 275 | - Lista de unidades de medida | |
| 276 | - | |
| 277 | - Retorno: | |
| 278 | - | |
| 279 | - {JSON} | |
| 280 | - */ | |
| 281 | - case "LISTATIPOPERIODO": | |
| 282 | - $m = new Metaestat(); | |
| 283 | - retornaJSON($m->listaTipoPeriodo($codigo_tipo_periodo)); | |
| 284 | - exit; | |
| 285 | - break; | |
| 286 | - /* | |
| 287 | - Valor: LISTATIPOREGIAO | |
| 288 | - | |
| 289 | - Lista de tipos de regiao | |
| 290 | - | |
| 291 | - Retorno: | |
| 292 | - | |
| 293 | - {JSON} | |
| 294 | - */ | |
| 295 | - case "LISTATIPOREGIAO": | |
| 296 | - $m = new Metaestat(); | |
| 297 | - retornaJSON($m->listaTipoRegiao($codigo_tipo_regiao)); | |
| 298 | - exit; | |
| 299 | - break; | |
| 300 | - case "LISTAHIERARQUIAREGIOES": | |
| 301 | - $m = new Metaestat(); | |
| 302 | - $regioes = $m->listaHierarquiaRegioes($codigo_tipo_regiao); | |
| 303 | - $valores = ""; | |
| 304 | - //se achou apenas uma regiao, pega os valores | |
| 305 | - if(count($regioes) < 2 && $codigo_tipo_regiao != ""){ | |
| 306 | - $valores = $m->listaDadosRegiao($codigo_tipo_regiao,$_GET["codigoregiaopai"],$_GET["valorregiaopai"]); | |
| 307 | - } | |
| 308 | - retornaJSON(array("regiaopai"=>$codigo_tipo_regiao,"regioes"=>$regioes,"valores"=>$valores)); | |
| 309 | - exit; | |
| 310 | - break; | |
| 311 | - case "LISTAREGIOESMEDIDA": | |
| 312 | - $m = new Metaestat(); | |
| 313 | - retornaJSON($m->listaRegioesMedida($id_medida_variavel)); | |
| 314 | - exit; | |
| 315 | - break; | |
| 316 | - case "LISTAAGREGAREGIAO": | |
| 317 | - $m = new Metaestat(); | |
| 318 | - if(empty($codigo_tipo_regiao)){ | |
| 319 | - $codigo_tipo_regiao = ""; | |
| 320 | - } | |
| 321 | - retornaJSON($m->listaAgregaRegiao($codigo_tipo_regiao,$id_agregaregiao)); | |
| 322 | - exit; | |
| 323 | - case "LISTAMAPAS": | |
| 324 | - $m = new Metaestat(); | |
| 325 | - if(empty($id_mapa)){ | |
| 326 | - $id_mapa = ""; | |
| 327 | - } | |
| 328 | - retornaJSON($m->listaMapas($id_mapa)); | |
| 329 | - exit; | |
| 330 | - break; | |
| 331 | - case "LISTAGRUPOSMAPA": | |
| 332 | - $m = new Metaestat(); | |
| 333 | - retornaJSON($m->listaGruposMapa($id_mapa,$id_mapa_grupo)); | |
| 334 | - exit; | |
| 335 | - break; | |
| 336 | - case "LISTATEMASMAPA": | |
| 337 | - $m = new Metaestat(); | |
| 338 | - retornaJSON($m->listaTemasMapa($id_mapa_grupo,$id_mapa_tema)); | |
| 339 | - exit; | |
| 340 | - break; | |
| 341 | - //lista os templates que o usuario pode escolher para publicar mapas | |
| 342 | - //a pasta com alista e definida na variavel $metaestatTemplates localizada no ms_configura.php | |
| 343 | - case "LISTATEMPLATESMAPA": | |
| 344 | - if(empty($metaestatTemplates)){ | |
| 345 | - $d = dirname(__FILE__)."/../../ferramentas/metaestat/templates"; | |
| 346 | - } | |
| 347 | - else{ | |
| 348 | - $d = $locaplic.$metaestatTemplates; | |
| 349 | - } | |
| 350 | - $arq = listaArquivos($d); | |
| 351 | - $arq["metaestatTemplates"] = $metaestatTemplates; | |
| 352 | - retornaJSON($arq); | |
| 353 | - exit; | |
| 354 | - break; | |
| 355 | - //lista os logos que o usuario pode escolher para publicar mapas | |
| 356 | - //a pasta com alista e definida na variavel $metaestatTemplates/logos localizada no ms_configura.php | |
| 357 | - case "LISTALOGOSMAPA": | |
| 358 | - if(empty($metaestatTemplates)){ | |
| 359 | - $metaestatTemplates = dirname(__FILE__)."/../../ferramentas/metaestat/templates"; | |
| 360 | - } | |
| 361 | - else{ | |
| 362 | - $metaestatTemplates = $locaplic.$metaestatTemplates; | |
| 363 | - } | |
| 364 | - retornaJSON(listaArquivos($metaestatTemplates."/logos")); | |
| 365 | - exit; | |
| 366 | - break; | |
| 367 | - /* | |
| 368 | - Valor: ALTERARVARIAVEL | |
| 369 | - | |
| 370 | - Altera os dados de uma variavel | |
| 371 | - */ | |
| 372 | - case "ALTERAVARIAVEL": | |
| 373 | - $m = new Metaestat(); | |
| 374 | - if(empty($codigo_variavel)){ | |
| 375 | - //isso ira criar um novo registro | |
| 376 | - $codigo_variavel = $m->alteraVariavel(); | |
| 377 | - if(!empty($nome)){ | |
| 378 | - $m->alteraVariavel($codigo_variavel,$nome,$descricao); | |
| 379 | - } | |
| 380 | - } | |
| 381 | - else{ | |
| 382 | - $codigo_variavel = $m->alteraVariavel($codigo_variavel,$_GET["nome"],$_GET["descricao"]); | |
| 383 | - } | |
| 384 | - retornaJSON($m->listaVariavel($codigo_variavel)); | |
| 385 | - exit; | |
| 386 | - break; | |
| 387 | - /* | |
| 388 | - Valor: ALTERAMEDIDAVARIAVEL | |
| 389 | - | |
| 390 | - Altera os dados de uma medida de uma variavel | |
| 391 | - | |
| 392 | - Retorno: | |
| 393 | - | |
| 394 | - {JSON} | |
| 395 | - */ | |
| 396 | - case "ALTERAMEDIDAVARIAVEL": | |
| 397 | - $filtro = $_GET["filtro"]; | |
| 398 | - $filtro = str_replace("'",'"',$filtro); | |
| 399 | - $m = new Metaestat(); | |
| 400 | - $default = false; | |
| 401 | - //verifica se a criacao da medida esta sendo feita na tabela default | |
| 402 | - if($codigo_tipo_periodo < 5 && $esquemadb == "i3geo_metaestat" && $_GET["colunaidgeo"] == "codigoregiao" && $_GET["tabela"] = "dados_medidas"){ | |
| 403 | - $default = true; | |
| 404 | - } | |
| 405 | - if(empty($id_medida_variavel)){ | |
| 406 | - //isso ira criar um novo registro | |
| 407 | - $id_medida_variavel = $m->alteraMedidaVariavel($codigo_variavel); | |
| 408 | - //o filtro e necessario para permitir a selecao dos registros apenas do que pertence a medida da variavel escolhida | |
| 409 | - //se a tabela nao for a default, o filtro nao se aplica | |
| 410 | - if($default == true && $filtro == ""){ | |
| 411 | - $filtro = " id_medida_variavel = $id_medida_variavel "; | |
| 412 | - } | |
| 413 | - if(!empty($nomemedida)){ | |
| 414 | - $m->alteraMedidaVariavel("",$id_medida_variavel,$codigo_unidade_medida,$codigo_tipo_periodo,$codigo_tipo_regiao,$codigo_estat_conexao,$_GET["esquemadb"],$_GET["tabela"],$_GET["colunavalor"],$_GET["colunaidgeo"],$_GET["colunaidunico"],$filtro,$_GET["nomemedida"]); | |
| 415 | - } | |
| 416 | - } | |
| 417 | - else{ | |
| 418 | - //o filtro e necessario para permitir a selecao dos registros apenas do que pertence a medida da variavel escolhida | |
| 419 | - if($default == true && $filtro == ""){ | |
| 420 | - $filtro = " id_medida_variavel = $id_medida_variavel "; | |
| 421 | - } | |
| 422 | - $m->alteraMedidaVariavel("",$id_medida_variavel,$codigo_unidade_medida,$codigo_tipo_periodo,$codigo_tipo_regiao,$codigo_estat_conexao,$_GET["esquemadb"],$_GET["tabela"],$_GET["colunavalor"],$_GET["colunaidgeo"],$_GET["colunaidunico"],$filtro,$_GET["nomemedida"]); | |
| 423 | - } | |
| 424 | - if(!empty($_GET["colunaAno"]) || !empty($_GET["colunaMes"]) || !empty($_GET["colunaDia"]) || !empty($_GET["colunaHora"])){ | |
| 425 | - $default = true; | |
| 426 | - } | |
| 427 | - //adiciona os parametros de tempo conforme o tipo de periodo escolhido | |
| 428 | - // | |
| 429 | - //se os nomes das colunas com os parametros de tempo forem definidas | |
| 430 | - //os parametros sao criados | |
| 431 | - //isso acontece se a criacao da medida estiver sendo feita em uma tabela que nao e a default | |
| 432 | - // | |
| 433 | - if($default == true){ | |
| 434 | - $m->excluirRegistro("i3geoestat_parametro_medida","id_medida_variavel",$id_medida_variavel); | |
| 435 | - $id_pai = 0; | |
| 436 | - //anual | |
| 437 | - if($codigo_tipo_periodo >= 1){ | |
| 438 | - if(empty($_GET["colunaAno"])){ | |
| 439 | - $_GET["colunaAno"] = "ano"; | |
| 440 | - } | |
| 441 | - $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel,"","","","","",""); | |
| 442 | - $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Ano","",$_GET["colunaAno"],$id_pai,1); | |
| 443 | - $id_pai = $id_parametro_medida; | |
| 444 | - } | |
| 445 | - //mensal | |
| 446 | - if($codigo_tipo_periodo >= 2){ | |
| 447 | - $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel,"","","","","",""); | |
| 448 | - if(empty($_GET["colunaMes"])){ | |
| 449 | - $_GET["colunaMes"] = "mes"; | |
| 450 | - } | |
| 451 | - $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Mes","",$_GET["colunaMes"],$id_pai,2); | |
| 452 | - $id_pai = $id_parametro_medida; | |
| 453 | - } | |
| 454 | - //diario | |
| 455 | - if($codigo_tipo_periodo >= 3){ | |
| 456 | - $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel,"","","","","",""); | |
| 457 | - if(empty($colunaDia)){ | |
| 458 | - $colunaDia = "dia"; | |
| 459 | - } | |
| 460 | - $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Dia","",$_GET["colunaDia"],$id_pai,3); | |
| 461 | - $id_pai = $id_parametro_medida; | |
| 462 | - } | |
| 463 | - //horario | |
| 464 | - if($codigo_tipo_periodo == 4){ | |
| 465 | - $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel,"","","","","",""); | |
| 466 | - if(empty($_GET["colunaHora"])){ | |
| 467 | - $_GET["colunaHora"] = "hora"; | |
| 468 | - } | |
| 469 | - $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Hora","",$_GET["colunaHora"],$id_pai,4); | |
| 470 | - } | |
| 471 | - } | |
| 472 | - retornaJSON($m->listaMedidaVariavel("",$id_medida_variavel)); | |
| 473 | - exit; | |
| 474 | - break; | |
| 475 | - /* | |
| 476 | - Valor: ALTERAPARAMETROMEDIDA | |
| 477 | - | |
| 478 | - Altera os dados de uma parametro de uma medida | |
| 479 | - | |
| 480 | - Retorno: | |
| 481 | - | |
| 482 | - {JSON} | |
| 483 | - */ | |
| 484 | - case "ALTERAPARAMETROMEDIDA": | |
| 485 | - $m = new Metaestat(); | |
| 486 | - if(empty($id_parametro_medida)){ | |
| 487 | - //isso ira criar um novo registro | |
| 488 | - $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel); | |
| 489 | - } | |
| 490 | - else{ | |
| 491 | - $m->alteraParametroMedida("",$id_parametro_medida,$_GET["nome"],$_GET["descricao"],$_GET["coluna"],$id_pai,$_GET["tipo"]); | |
| 492 | - } | |
| 493 | - retornaJSON($m->listaParametro($id_medida_variavel,$id_parametro_medida)); | |
| 494 | - exit; | |
| 495 | - break; | |
| 496 | - /* | |
| 497 | - Valor: ALTERACLASSIFICACAOMEDIDA | |
| 498 | - | |
| 499 | - Altera os dados de uma classificacao de uma medida | |
| 500 | - | |
| 501 | - Retorno: | |
| 502 | - | |
| 503 | - {JSON} | |
| 504 | - */ | |
| 505 | - case "ALTERACLASSIFICACAOMEDIDA": | |
| 506 | - $m = new Metaestat(); | |
| 507 | - if(empty($id_classificacao)){ | |
| 508 | - //isso ira criar um novo registro | |
| 509 | - $id_classificacao = $m->alteraClassificacaoMedida($id_medida_variavel); | |
| 510 | - if(!empty($nome)){ | |
| 511 | - $m->alteraClassificacaoMedida($id_classificacao,$id_classificacao,$_GET["nome"],$_GET["observacao"]); | |
| 512 | - } | |
| 513 | - } | |
| 514 | - else{ | |
| 515 | - $m->alteraClassificacaoMedida("",$id_classificacao,$_GET["nome"],$_GET["observacao"]); | |
| 516 | - } | |
| 517 | - retornaJSON($m->listaClassificacaoMedida($id_medida_variavel,$id_classificacao)); | |
| 518 | - exit; | |
| 519 | - break; | |
| 520 | - case "CALCULACLASSIFICACAO": | |
| 521 | - $cores = $_GET["cores"]; | |
| 522 | - $limite = $_GET["limite"]; | |
| 523 | - $numintervalos = $_GET["numintervalos"]; | |
| 524 | - $tipo = $_GET["tipo"]; | |
| 525 | - //as cores vem no formato rgb(0,0,0); | |
| 526 | - if(!empty($cores)){ | |
| 527 | - $cores = str_replace("rgb(","",$cores); | |
| 528 | - $cores = str_replace(")","",$cores); | |
| 529 | - $cores = explode("|",$cores); | |
| 530 | - } | |
| 531 | - if(empty($limite)){ | |
| 532 | - $limite = ""; | |
| 533 | - } | |
| 534 | - | |
| 535 | - if($tipo == "quebrasnaturais"){ | |
| 536 | - $m = new Metaestat(); | |
| 537 | - $dados = $m->dadosMedidaVariavel($id_medida_variavel,"",0,"",$limite,true); | |
| 538 | - $metaVariavel = $m->listaMedidaVariavel("",$id_medida_variavel); | |
| 539 | - $colunavalor = $metaVariavel["colunavalor"]; | |
| 540 | - $valores = array(); | |
| 541 | - | |
| 542 | - foreach($dados as $d){ | |
| 543 | - if($d[$colunavalor]){ | |
| 544 | - $valores[] = $d[$colunavalor]; | |
| 545 | - } | |
| 546 | - } | |
| 547 | - include(dirname(__FILE__)."/../../pacotes/jenks-master/jenks.php"); | |
| 548 | - $intervalos = getJenksClasses($numintervalos, $valores); | |
| 549 | - $m->excluirRegistro("i3geoestat_classes","id_classificacao",$id_classificacao); | |
| 550 | - for ($i=0; $i < $numintervalos; ++$i){ | |
| 551 | - if ($i == $numintervalos - 1){ | |
| 552 | - $expressao = "(([".$colunavalor."]>=".$intervalos[$i]."))"; | |
| 553 | - $titulo = ">= ".$intervalos[$i]; | |
| 554 | - } | |
| 555 | - else{ | |
| 556 | - $expressao = "(([".$colunavalor."]>=".$intervalos[$i].")and([".$colunavalor."]<".$intervalos[$i+1]."))"; | |
| 557 | - $titulo = ">= ".$intervalos[$i]." e < que ".($intervalos[$i+1]); | |
| 558 | - } | |
| 559 | - $id_classe = $m->alteraClasseClassificacao($id_classificacao); | |
| 560 | - if(!empty($cores)){ | |
| 561 | - $cor = explode(",",$cores[$i]); | |
| 562 | - $vermelho = $cor[0]; | |
| 563 | - $verde = $cor[1]; | |
| 564 | - $azul = $cor[2]; | |
| 565 | - } | |
| 566 | - $m->alteraClasseClassificacao("",$id_classe,$titulo,$expressao,$vermelho,$verde,$azul,"","","255","255","255","2"); | |
| 567 | - } | |
| 568 | - retornaJSON("ok"); | |
| 569 | - exit; | |
| 570 | - } | |
| 571 | - if($tipo == "quartil"){ | |
| 572 | - $m = new Metaestat(); | |
| 573 | - $dados = $m->sumarioMedidaVariavel($id_medida_variavel,"","",$limite,true); | |
| 574 | - if($dados == false){ | |
| 575 | - retornaJSON("erro"); | |
| 576 | - exit; | |
| 577 | - } | |
| 578 | - $dados = $dados["quartis"]; | |
| 579 | - $n = count($dados["expressoes"]); | |
| 580 | - $m->excluirRegistro("i3geoestat_classes","id_classificacao",$id_classificacao); | |
| 581 | - for($i=0;$i<$n;++$i){ | |
| 582 | - $id_classe = $m->alteraClasseClassificacao($id_classificacao); | |
| 583 | - $expressao = $dados["expressoes"][$i]; | |
| 584 | - $titulo = $dados["nomes"][$i]; | |
| 585 | - if(!empty($cores)){ | |
| 586 | - $cor = explode(",",$cores[$i]); | |
| 587 | - $vermelho = $cor[0]; | |
| 588 | - $verde = $cor[1]; | |
| 589 | - $azul = $cor[2]; | |
| 590 | - } | |
| 591 | - $m->alteraClasseClassificacao("",$id_classe,$titulo,$expressao,$vermelho,$verde,$azul,"","","255","255","255","2"); | |
| 592 | - } | |
| 593 | - exit; | |
| 594 | - retornaJSON("ok"); | |
| 595 | - exit; | |
| 596 | - } | |
| 597 | - //para efeitos de compatibilidade com o nome de $tipo | |
| 598 | - if(empty($numintervalos) || $tipo == "intiguais5"){ | |
| 599 | - $numintervalos = 5; | |
| 600 | - } | |
| 601 | - if($tipo == "intiguais5" || $tipo == "intiguais"){ | |
| 602 | - $m = new Metaestat(); | |
| 603 | - $dados = $m->sumarioMedidaVariavel($id_medida_variavel,"","",$limite,true); | |
| 604 | - if($dados == false){ | |
| 605 | - retornaJSON("erro"); | |
| 606 | - exit; | |
| 607 | - } | |
| 608 | - $min = $dados["menor"]; | |
| 609 | - $max = $dados["maior"]; | |
| 610 | - $item = $dados["colunavalor"]; | |
| 611 | - $intervalo = ($max - $min) / $numintervalos; | |
| 612 | - //adiciona as classes novas | |
| 613 | - $intatual = $min; | |
| 614 | - $m->excluirRegistro("i3geoestat_classes","id_classificacao",$id_classificacao); | |
| 615 | - for ($i=0; $i < $numintervalos; ++$i){ | |
| 616 | - if ($i == $numintervalos - 1){ | |
| 617 | - $expressao = "(([".$item."]>=".$intatual.")and([".$item."]<=".($intatual+$intervalo)."))"; | |
| 618 | - } | |
| 619 | - else{ | |
| 620 | - $expressao = "(([".$item."]>=".$intatual.")and([".$item."]<".($intatual+$intervalo)."))"; | |
| 621 | - } | |
| 622 | - $titulo = ">= ".$intatual." e < que ".($intatual+$intervalo); | |
| 623 | - $intatual = $intatual + $intervalo; | |
| 624 | - $id_classe = $m->alteraClasseClassificacao($id_classificacao); | |
| 625 | - if(!empty($cores)){ | |
| 626 | - $cor = explode(",",$cores[$i]); | |
| 627 | - $vermelho = $cor[0]; | |
| 628 | - $verde = $cor[1]; | |
| 629 | - $azul = $cor[2]; | |
| 630 | - } | |
| 631 | - $m->alteraClasseClassificacao("",$id_classe,$titulo,$expressao,$vermelho,$verde,$azul,"","","255","255","255","2"); | |
| 632 | - } | |
| 633 | - retornaJSON("ok"); | |
| 634 | - exit; | |
| 635 | - } | |
| 636 | - //o menor e o maior valor sao enviados como parametro ($min e $max) | |
| 637 | - //para efeitos de compatibilidade com o nome de $tipo | |
| 638 | - if(empty($numintervalos) || $tipo == "intiguais5mm"){ | |
| 639 | - $numintervalos = 5; | |
| 640 | - } | |
| 641 | - if($tipo == "intiguais5mm" || $tipo == "intiguaismm"){ | |
| 642 | - $m = new Metaestat(); | |
| 643 | - $metaVariavel = $m->listaMedidaVariavel("",$id_medida_variavel); | |
| 644 | - $item = $metaVariavel["colunavalor"]; | |
| 645 | - $intervalo = ($max - $min) / $numintervalos; | |
| 646 | - //adiciona as classes novas | |
| 647 | - $intatual = $min; | |
| 648 | - $m->excluirRegistro("i3geoestat_classes","id_classificacao",$id_classificacao); | |
| 649 | - for ($i=0; $i < $numintervalos; ++$i){ | |
| 650 | - if ($i == $numintervalos - 1){ | |
| 651 | - $expressao = "(([".$item."]>=".$intatual.")and([".$item."]<=".($intatual+$intervalo)."))"; | |
| 652 | - } | |
| 653 | - else{ | |
| 654 | - $expressao = "(([".$item."]>=".$intatual.")and([".$item."]<".($intatual+$intervalo)."))"; | |
| 655 | - } | |
| 656 | - $titulo = ">= ".$intatual." e < que ".($intatual+$intervalo); | |
| 657 | - $intatual = $intatual + $intervalo; | |
| 658 | - $id_classe = $m->alteraClasseClassificacao($id_classificacao); | |
| 659 | - if(!empty($cores)){ | |
| 660 | - $cor = explode(",",$cores[$i]); | |
| 661 | - $vermelho = $cor[0]; | |
| 662 | - $verde = $cor[1]; | |
| 663 | - $azul = $cor[2]; | |
| 664 | - } | |
| 665 | - $m->alteraClasseClassificacao("",$id_classe,$titulo,$expressao,$vermelho,$verde,$azul,"","","255","255","255","2"); | |
| 666 | - } | |
| 667 | - retornaJSON("ok"); | |
| 668 | - exit; | |
| 669 | - } | |
| 670 | - retornaJSON("ok"); | |
| 671 | - exit; | |
| 672 | - break; | |
| 673 | - case "ALTERAESTILOSCLASSIFICACAO": | |
| 674 | - $tipo = $_GET["tipo"]; | |
| 675 | - $aumentar = $_GET["aumentar"]; | |
| 676 | - if($tipo == "tamanho"){ | |
| 677 | - $m = new Metaestat(); | |
| 678 | - $classes = $m->listaClasseClassificacao($id_classificacao); | |
| 679 | - $nclasses = count($classes); | |
| 680 | - $tamanhoini -= $aumentar; | |
| 681 | - for($i=0;$i<$nclasses;$i++){ | |
| 682 | - $c = $classes[$i]; | |
| 683 | - $m->alteraClasseClassificacao( | |
| 684 | - $id_classificacao, | |
| 685 | - $c["id_classe"], | |
| 686 | - $c["titulo"], | |
| 687 | - $c["expressao"], | |
| 688 | - $c["vermelho"], | |
| 689 | - $c["verde"], | |
| 690 | - $c["azul"], | |
| 691 | - $tamanhoini + $aumentar, | |
| 692 | - $c["simbolo"], | |
| 693 | - $c["overmelho"], | |
| 694 | - $c["overde"], | |
| 695 | - $c["oazul"], | |
| 696 | - $tamanhoini + $aumentar | |
| 697 | - ); | |
| 698 | - $tamanhoini += $aumentar; | |
| 699 | - } | |
| 700 | - retornaJSON("ok"); | |
| 701 | - exit; | |
| 702 | - } | |
| 703 | - retornaJSON("ok"); | |
| 704 | - exit; | |
| 705 | - break; | |
| 706 | - | |
| 707 | - /* | |
| 708 | - Valor: ALTERACLASSECLASSIFICACAO | |
| 709 | - | |
| 710 | - Altera os dados de uma classe de uma classificacao | |
| 711 | - | |
| 712 | - Retorno: | |
| 713 | - | |
| 714 | - {JSON} | |
| 715 | - */ | |
| 716 | - case "ALTERACLASSECLASSIFICACAO": | |
| 717 | - $m = new Metaestat(); | |
| 718 | - if(empty($id_classe)){ | |
| 719 | - //isso ira criar um novo registro | |
| 720 | - $id_classe = $m->alteraClasseClassificacao($id_classificacao); | |
| 721 | - } | |
| 722 | - else{ | |
| 723 | - $titulo = $_GET["titulo"]; | |
| 724 | - $expressao = $_GET["expressao"]; | |
| 725 | - $m->alteraClasseClassificacao("",$id_classe,$titulo,$expressao,$_GET["vermelho"],$_GET["verde"],$_GET["azul"],$_GET["tamanho"],$_GET["simbolo"],$_GET["overmelho"],$_GET["overde"],$_GET["oazul"],$_GET["otamanho"]); | |
| 726 | - } | |
| 727 | - retornaJSON($m->listaClasseClassificacao($id_classificacao,$id_classe)); | |
| 728 | - exit; | |
| 729 | - break; | |
| 730 | - case "ALTERALINKMEDIDA": | |
| 731 | - $m = new Metaestat(); | |
| 732 | - if(empty($id_link)){ | |
| 733 | - //isso ira criar um novo registro | |
| 734 | - $id_link = $m->alteraLinkMedida($id_medida_variavel); | |
| 735 | - } | |
| 736 | - else{ | |
| 737 | - $m->alteraLinkMedida("",$id_link,$_GET["nome"],$_GET["link"]); | |
| 738 | - } | |
| 739 | - retornaJSON($m->listaLinkMedida($id_medida_variavel,$id_link)); | |
| 740 | - exit; | |
| 741 | - break; | |
| 742 | - case "ALTERAFONTEINFO": | |
| 743 | - $m = new Metaestat(); | |
| 744 | - if(empty($id_fonteinfo)){ | |
| 745 | - //isso ira criar um novo registro | |
| 746 | - $id_fonteinfo = $m->alteraFonteinfo(); | |
| 747 | - } | |
| 748 | - else{ | |
| 749 | - $m->alteraFonteinfo($id_fonteinfo,$_GET["titulo"],$_GET["link"]); | |
| 750 | - } | |
| 751 | - retornaJSON($m->listaFonteinfo($id_fonteinfo)); | |
| 752 | - exit; | |
| 753 | - break; | |
| 754 | - case "ADICIONAFONTEINFOMEDIDA": | |
| 755 | - $m = new Metaestat(); | |
| 756 | - //echo $id_medida_variavel;exit; | |
| 757 | - $m->adicinaFonteinfoMedida($id_medida_variavel,$id_fonteinfo); | |
| 758 | - retornaJSON($m->listaFonteInfo($id_fonteinfo)); | |
| 759 | - exit; | |
| 760 | - break; | |
| 761 | - /* | |
| 762 | - Valor: ALTERARUNIDADEMEDIDA | |
| 763 | - | |
| 764 | - Altera a tabela de unidades de medida | |
| 765 | - | |
| 766 | - Retorno: | |
| 767 | - | |
| 768 | - {JSON} | |
| 769 | - */ | |
| 770 | - case "ALTERARUNIDADEMEDIDA": | |
| 771 | - $m = new Metaestat(); | |
| 772 | - if(empty($codigo_unidade_medida)){ | |
| 773 | - $codigo_unidade_medida = $m->alteraUnidadeMedida(); | |
| 774 | - } | |
| 775 | - else{ | |
| 776 | - $codigo_unidade_medida = $m->alteraUnidadeMedida($codigo_unidade_medida,$_GET["nome"],$_GET["sigla"],$_GET["permitesoma"],$_GET["permitemedia"]); | |
| 777 | - } | |
| 778 | - retornaJSON($m->listaUnidadeMedida($codigo_unidade_medida)); | |
| 779 | - exit; | |
| 780 | - break; | |
| 781 | - /* | |
| 782 | - Valor: ALTERARCONEXAO | |
| 783 | - | |
| 784 | - Altera a tabela de conexoes | |
| 785 | - | |
| 786 | - Retorno: | |
| 787 | - | |
| 788 | - {JSON} | |
| 789 | - */ | |
| 790 | - case "ALTERARCONEXAO": | |
| 791 | - $m = new Metaestat(); | |
| 792 | - if(empty($codigo_estat_conexao)){ | |
| 793 | - $codigo_estat_conexao = $m->alteraConexao(); | |
| 794 | - } | |
| 795 | - else{ | |
| 796 | - $codigo_estat_conexao = $m->alteraConexao($codigo_estat_conexao,$_GET["bancodedados"],$_GET["host"],$_GET["porta"],$_GET["usuario"]); | |
| 797 | - } | |
| 798 | - retornaJSON($m->listaConexao($codigo_estat_conexao)); | |
| 799 | - exit; | |
| 800 | - break; | |
| 801 | - /* | |
| 802 | - Valor: ALTERARTIPOREGIAO | |
| 803 | - | |
| 804 | - Altera a tabela de regioes | |
| 805 | - | |
| 806 | - Retorno: | |
| 807 | - | |
| 808 | - {JSON} | |
| 809 | - */ | |
| 810 | - case "ALTERARTIPOREGIAO": | |
| 811 | - $m = new Metaestat(); | |
| 812 | - if(empty($codigo_tipo_regiao)){ | |
| 813 | - $codigo_tipo_regiao = $m->alteraTipoRegiao(); | |
| 814 | - } | |
| 815 | - else{ | |
| 816 | - $codigo_tipo_regiao = $m->alteraTipoRegiao($codigo_tipo_regiao,$_GET["nome_tipo_regiao"],$_GET["descricao_tipo_regiao"],$_GET["esquemadb"],$_GET["tabela"],$_GET["colunageo"],$_GET["colunacentroide"],$_GET["data"],$_GET["identificador"],$_GET["colunanomeregiao"],$_GET["srid"],$codigo_estat_conexao,$_GET["colunasvisiveis"],$_GET["apelidos"]); | |
| 817 | - } | |
| 818 | - retornaJSON($m->listaTipoRegiao($codigo_tipo_regiao)); | |
| 819 | - exit; | |
| 820 | - break; | |
| 821 | - case "ALTERAAGREGAREGIAO": | |
| 822 | - $m = new Metaestat(); | |
| 823 | - if(empty($id_agregaregiao)){ | |
| 824 | - $id_agregaregiao = $m->alteraAgregaRegiao($codigo_tipo_regiao); | |
| 825 | - } | |
| 826 | - else{ | |
| 827 | - $id_agregaregiao = $m->alteraAgregaRegiao("",$id_agregaregiao,$codigo_tipo_regiao_pai,$_GET["colunaligacao_regiaopai"]); | |
| 828 | - $codigo_tipo_regiao = ""; | |
| 829 | - } | |
| 830 | - retornaJSON($m->listaAgregaRegiao($codigo_tipo_regiao,$id_agregaregiao)); | |
| 831 | - exit; | |
| 832 | - break; | |
| 833 | - /* | |
| 834 | - Valor: ALTERARTIPOPERIODO | |
| 835 | - | |
| 836 | - Altera a tabela de tipos de periodo | |
| 837 | - | |
| 838 | - Retorno: | |
| 839 | - | |
| 840 | - {JSON} | |
| 841 | - */ | |
| 842 | - case "ALTERARTIPOPERIODO": | |
| 843 | - $m = new Metaestat(); | |
| 844 | - if(empty($codigo_tipo_periodo)){ | |
| 845 | - $codigo_tipo_periodo = $m->alteraTipoPeriodo(); | |
| 846 | - } | |
| 847 | - else{ | |
| 848 | - //impede a alteracao dos valores reservados | |
| 849 | - if($codigo_tipo_periodo > 4){ | |
| 850 | - $codigo_unidade_medida = $m->alteraTipoPeriodo($codigo_tipo_periodo,$_GET["nome"],$_GET["descricao"]); | |
| 851 | - } | |
| 852 | - } | |
| 853 | - retornaJSON($m->listaTipoPeriodo($codigo_tipo_periodo)); | |
| 854 | - exit; | |
| 855 | - break; | |
| 856 | - /* | |
| 857 | - Valor: ALTERAMAPA | |
| 858 | - | |
| 859 | - Altera a tabela de mapas para publicacao | |
| 860 | - | |
| 861 | - Retorno: | |
| 862 | - | |
| 863 | - {JSON} | |
| 864 | - */ | |
| 865 | - case "ALTERAMAPA": | |
| 866 | - $m = new Metaestat(); | |
| 867 | - if(empty($id_mapa)){ | |
| 868 | - $id_mapa = $m->alteraMapa(); | |
| 869 | - } | |
| 870 | - else{ | |
| 871 | - $id_mapa = $m->alteraMapa($id_mapa,$_GET["titulo"],$_GET["template"],$_GET["logoesquerdo"],$_GET["logodireito"],$_GET["publicado"]); | |
| 872 | - } | |
| 873 | - retornaJSON($m->listaMapas($id_mapa)); | |
| 874 | - exit; | |
| 875 | - break; | |
| 876 | - /* | |
| 877 | - Valor: ALTERAMAPAGRUPO | |
| 878 | - | |
| 879 | - Altera a tabela de grupos para publicacao | |
| 880 | - | |
| 881 | - Retorno: | |
| 882 | - | |
| 883 | - {JSON} | |
| 884 | - */ | |
| 885 | - case "ALTERAMAPAGRUPO": | |
| 886 | - $m = new Metaestat(); | |
| 887 | - if(empty($id_mapa_grupo)){ | |
| 888 | - $id_mapa_grupo = $m->alteraMapaGrupo($id_mapa); | |
| 889 | - } | |
| 890 | - else{ | |
| 891 | - $id_mapa_grupo = $m->alteraMapaGrupo($id_mapa,$id_mapa_grupo,$_GET["titulo"]); | |
| 892 | - } | |
| 893 | - retornaJSON($m->listaGruposMapa($id_mapa,$id_mapa_grupo)); | |
| 894 | - exit; | |
| 895 | - break; | |
| 896 | - case "ALTERAMAPATEMA": | |
| 897 | - $m = new Metaestat(); | |
| 898 | - if(empty($id_mapa_tema)){ | |
| 899 | - $id_mapa_tema = $m->alteraMapaTema($id_mapa_grupo); | |
| 900 | - } | |
| 901 | - else{ | |
| 902 | - $id_mapa_tema = $m->alteraMapaTema($id_mapa_grupo,$id_mapa_tema,$_GET["titulo"],$id_medida_variavel); | |
| 903 | - } | |
| 904 | - retornaJSON($m->listaTemasMapa($id_mapa_grupo,$id_mapa_tema)); | |
| 905 | - exit; | |
| 906 | - break; | |
| 907 | - /* | |
| 908 | - Valor: EXCLUIRMAPA | |
| 909 | - | |
| 910 | - Exclui um mapa do publicador | |
| 911 | - | |
| 912 | - */ | |
| 913 | - case "EXCLUIRMAPA": | |
| 914 | - $tabela = "i3geoestat_mapa"; | |
| 915 | - $id = $id_mapa; | |
| 916 | - $f = verificaFilhos(); | |
| 917 | - if(!$f){ | |
| 918 | - $m = new Metaestat(); | |
| 919 | - retornaJSON($m->excluirRegistro("i3geoestat_mapa","id_mapa",$id)); | |
| 920 | - } | |
| 921 | - else | |
| 922 | - retornaJSON("erro"); | |
| 923 | - exit; | |
| 924 | - break; | |
| 925 | - case "EXCLUIRMAPAGRUPO": | |
| 926 | - $tabela = "i3geoestat_mapa_grupo"; | |
| 927 | - $id = $id_mapa_grupo; | |
| 928 | - $f = verificaFilhos(); | |
| 929 | - if(!$f){ | |
| 930 | - $m = new Metaestat(); | |
| 931 | - retornaJSON($m->excluirRegistro("i3geoestat_mapa_grupo","id_mapa_grupo",$id)); | |
| 932 | - } | |
| 933 | - else | |
| 934 | - retornaJSON("erro"); | |
| 935 | - exit; | |
| 936 | - break; | |
| 937 | - case "EXCLUIRMAPATEMA": | |
| 938 | - $tabela = "i3geoestat_mapa_tema"; | |
| 939 | - $id = $id_mapa_tema; | |
| 940 | - $m = new Metaestat(); | |
| 941 | - retornaJSON($m->excluirRegistro("i3geoestat_mapa_tema","id_mapa_tema",$id)); | |
| 942 | - exit; | |
| 943 | - break; | |
| 944 | - /* | |
| 945 | - Valor: EXCLUIRVARIAVEL | |
| 946 | - | |
| 947 | - Exclui uma variavel | |
| 948 | - | |
| 949 | - Parametros: | |
| 950 | - | |
| 951 | - codigo_variavel | |
| 952 | - | |
| 953 | - Retorno: | |
| 954 | - | |
| 955 | - {JSON} | |
| 956 | - */ | |
| 957 | - case "EXCLUIRVARIAVEL": | |
| 958 | - $tabela = "i3geoestat_variavel"; | |
| 959 | - $id = $codigo_variavel; | |
| 960 | - $f = verificaFilhos(); | |
| 961 | - if(!$f){ | |
| 962 | - $m = new Metaestat(); | |
| 963 | - retornaJSON($m->excluirRegistro("i3geoestat_variavel","codigo_variavel",$id)); | |
| 964 | - } | |
| 965 | - else | |
| 966 | - retornaJSON("erro"); | |
| 967 | - exit; | |
| 968 | - break; | |
| 969 | - /* | |
| 970 | - Valor: EXCLUIRTIPOPERIODO | |
| 971 | - | |
| 972 | - Exclui uma variavel | |
| 973 | - | |
| 974 | - Parametros: | |
| 975 | - | |
| 976 | - codigo_variavel | |
| 977 | - | |
| 978 | - Retorno: | |
| 979 | - | |
| 980 | - {JSON} | |
| 981 | - */ | |
| 982 | - case "EXCLUIRTIPOPERIODO": | |
| 983 | - //impede a alteracao dos valores reservados | |
| 984 | - if($codigo_tipo_periodo > 4){ | |
| 985 | - $tabela = "i3geoestat_tipo_periodo"; | |
| 986 | - $id = $codigo_tipo_periodo; | |
| 987 | - $f = verificaFilhos(); | |
| 988 | - if(!$f){ | |
| 989 | - $m = new Metaestat(); | |
| 990 | - retornaJSON($m->excluirRegistro("i3geoestat_tipo_periodo","codigo_tipo_periodo",$id)); | |
| 991 | - } | |
| 992 | - else{ | |
| 993 | - retornaJSON("erro"); | |
| 994 | - } | |
| 995 | - } | |
| 996 | - else{ | |
| 997 | - retornaJSON("erro"); | |
| 998 | - } | |
| 999 | - exit; | |
| 1000 | - break; | |
| 1001 | - /* | |
| 1002 | - Valor: EXCLUIRUNIDADEMEDIDA | |
| 1003 | - | |
| 1004 | - Exclui uma unidade de medida"Dados inseridos" | |
| 1005 | - | |
| 1006 | - Retorno: | |
| 1007 | - | |
| 1008 | - {JSON} | |
| 1009 | - */ | |
| 1010 | - case "EXCLUIRUNIDADEMEDIDA": | |
| 1011 | - $tabela = "i3geoestat_unidade_medida"; | |
| 1012 | - $id = $codigo_unidade_medida; | |
| 1013 | - $f = verificaFilhos(); | |
| 1014 | - | |
| 1015 | - if(!$f){ | |
| 1016 | - $m = new Metaestat(); | |
| 1017 | - retornaJSON($m->excluirRegistro("i3geoestat_unidade_medida","codigo_unidade_medida",$id)); | |
| 1018 | - } | |
| 1019 | - else | |
| 1020 | - retornaJSON("erro"); | |
| 1021 | - exit; | |
| 1022 | - break; | |
| 1023 | - case "EXCLUIRFONTEINFO": | |
| 1024 | - $tabela = "i3geoestat_fonteinfo"; | |
| 1025 | - $id = $id_fonteinfo; | |
| 1026 | - $f = verificaFilhos(); | |
| 1027 | - | |
| 1028 | - if(!$f){ | |
| 1029 | - $m = new Metaestat(); | |
| 1030 | - retornaJSON($m->excluirRegistro("i3geoestat_fonteinfo","id_fonteinfo",$id)); | |
| 1031 | - } | |
| 1032 | - else | |
| 1033 | - retornaJSON("erro"); | |
| 1034 | - exit; | |
| 1035 | - break; | |
| 1036 | - case "EXCLUIRFONTEINFOMEDIDA": | |
| 1037 | - $m = new Metaestat(); | |
| 1038 | - retornaJSON($m->excluirFonteinfoMedida($id_medida_variavel,$id_fonteinfo)); | |
| 1039 | - exit; | |
| 1040 | - break; | |
| 1041 | - /* | |
| 1042 | - Valor: EXCLUIRCONEXAO | |
| 1043 | - | |
| 1044 | - Exclui uma conexao | |
| 1045 | - | |
| 1046 | - Retorno: | |
| 1047 | - | |
| 1048 | - {JSON} | |
| 1049 | - */ | |
| 1050 | - case "EXCLUIRCONEXAO": | |
| 1051 | - //impede a alteracao dos valores reservados | |
| 1052 | - if($codigo_estat_conexao > 0){ | |
| 1053 | - $tabela = "i3geoestat_conexao"; | |
| 1054 | - $id = $codigo_estat_conexao; | |
| 1055 | - $f = verificaFilhos(); | |
| 1056 | - if(!$f){ | |
| 1057 | - $m = new Metaestat(); | |
| 1058 | - retornaJSON($m->excluirRegistro("i3geoestat_conexao","codigo_estat_conexao",$id)); | |
| 1059 | - } | |
| 1060 | - else{ | |
| 1061 | - retornaJSON("erro"); | |
| 1062 | - } | |
| 1063 | - } | |
| 1064 | - else{ | |
| 1065 | - retornaJSON("erro"); | |
| 1066 | - } | |
| 1067 | - exit; | |
| 1068 | - break; | |
| 1069 | - /* | |
| 1070 | - Valor: EXCLUIRTIPOREGIAO | |
| 1071 | - | |
| 1072 | - Exclui uma regiao | |
| 1073 | - | |
| 1074 | - Retorno: | |
| 1075 | - | |
| 1076 | - {JSON} | |
| 1077 | - */ | |
| 1078 | - case "EXCLUIRTIPOREGIAO": | |
| 1079 | - $tabela = "i3geoestat_tipo_regiao"; | |
| 1080 | - $id = $codigo_tipo_regiao; | |
| 1081 | - $f = verificaFilhos(); | |
| 1082 | - if(!$f){ | |
| 1083 | - $m = new Metaestat(); | |
| 1084 | - retornaJSON($m->excluirRegistro("i3geoestat_tipo_regiao","codigo_tipo_regiao",$id)); | |
| 1085 | - } | |
| 1086 | - else | |
| 1087 | - retornaJSON("erro"); | |
| 1088 | - exit; | |
| 1089 | - break; | |
| 1090 | - case "EXCLUIRAGREGAREGIAO": | |
| 1091 | - $tabela = "i3geoestat_agregaregiao"; | |
| 1092 | - $id = $id_agregaregiao; | |
| 1093 | - $m = new Metaestat(); | |
| 1094 | - retornaJSON($m->excluirRegistro("i3geoestat_agregaregiao","id_agregaregiao",$id)); | |
| 1095 | - exit; | |
| 1096 | - break; | |
| 1097 | - /* | |
| 1098 | - Valor: EXCLUIRMEDIDAVARIAVEL | |
| 1099 | - | |
| 1100 | - Exclui uma medida da variavel | |
| 1101 | - | |
| 1102 | - Parametros: | |
| 1103 | - | |
| 1104 | - codigo_variavel | |
| 1105 | - | |
| 1106 | - Retorno: | |
| 1107 | - | |
| 1108 | - {JSON} | |
| 1109 | - */ | |
| 1110 | - case "EXCLUIRMEDIDAVARIAVEL": | |
| 1111 | - $tabela = "i3geoestat_medida_variavel"; | |
| 1112 | - $id = $id_medida_variavel; | |
| 1113 | - $f = verificaFilhos(); | |
| 1114 | - if(!$f){ | |
| 1115 | - $m = new Metaestat(); | |
| 1116 | - retornaJSON($m->excluirRegistro("i3geoestat_medida_variavel","id_medida_variavel",$id)); | |
| 1117 | - $m->negativaValoresMedidaVariavel($id); | |
| 1118 | - } | |
| 1119 | - else | |
| 1120 | - retornaJSON("erro"); | |
| 1121 | - exit; | |
| 1122 | - break; | |
| 1123 | - /* | |
| 1124 | - Valor: EXCLUIRPARAMETROMEDIDA | |
| 1125 | - | |
| 1126 | - Exclui uma medida da variavel | |
| 1127 | - | |
| 1128 | - Parametros: | |
| 1129 | - | |
| 1130 | - id_parametro_medida | |
| 1131 | - | |
| 1132 | - Retorno: | |
| 1133 | - | |
| 1134 | - {JSON} | |
| 1135 | - */ | |
| 1136 | - case "EXCLUIRPARAMETROMEDIDA": | |
| 1137 | - $m = new Metaestat(); | |
| 1138 | - retornaJSON($m->excluirRegistro("i3geoestat_parametro_medida","id_parametro_medida",$id_parametro_medida)); | |
| 1139 | - exit; | |
| 1140 | - break; | |
| 1141 | - /* | |
| 1142 | - Valor: EXCLUIRCLASSIFICACAOMEDIDA | |
| 1143 | - | |
| 1144 | - Exclui uma classificacao de uma medida da variavel | |
| 1145 | - | |
| 1146 | - Parametros: | |
| 1147 | - | |
| 1148 | - id_classificacao | |
| 1149 | - | |
| 1150 | - Retorno: | |
| 1151 | - | |
| 1152 | - {JSON} | |
| 1153 | - */ | |
| 1154 | - case "EXCLUIRCLASSIFICACAOMEDIDA": | |
| 1155 | - $tabela = "i3geoestat_classificacao"; | |
| 1156 | - $id = $id_classificacao; | |
| 1157 | - $f = verificaFilhos(); | |
| 1158 | - if(!$f){ | |
| 1159 | - $m = new Metaestat(); | |
| 1160 | - retornaJSON($m->excluirRegistro("i3geoestat_classificacao","id_classificacao",$id)); | |
| 1161 | - } | |
| 1162 | - else | |
| 1163 | - retornaJSON("erro"); | |
| 1164 | - exit; | |
| 1165 | - break; | |
| 1166 | - /* | |
| 1167 | - Valor: EXCLUIRCLASSECLASSIFICACAO | |
| 1168 | - | |
| 1169 | - Exclui uma classe de uma classificacao | |
| 1170 | - | |
| 1171 | - Parametros: | |
| 1172 | - | |
| 1173 | - id_classe | |
| 1174 | - | |
| 1175 | - Retorno: | |
| 1176 | - | |
| 1177 | - {JSON} | |
| 1178 | - */ | |
| 1179 | - case "EXCLUIRCLASSECLASSIFICACAO": | |
| 1180 | - $m = new Metaestat(); | |
| 1181 | - retornaJSON($m->excluirRegistro("i3geoestat_classes","id_classe",$id_classe)); | |
| 1182 | - exit; | |
| 1183 | - break; | |
| 1184 | - case "EXCLUIRLINKMEDIDA": | |
| 1185 | - $m = new Metaestat(); | |
| 1186 | - retornaJSON($m->excluirRegistro("i3geoestat_medida_variavel_link","id_link",$id_link)); | |
| 1187 | - exit; | |
| 1188 | - break; | |
| 1189 | - /* | |
| 1190 | - Valor: LISTADADOSTABELASAUXILIARES | |
| 1191 | - | |
| 1192 | - Lista os valores das tabelas auxiliares | |
| 1193 | - | |
| 1194 | - Retorno: | |
| 1195 | - | |
| 1196 | - {JSON} | |
| 1197 | - */ | |
| 1198 | - case "LISTADADOSTABELASAUXILIARES": | |
| 1199 | - $m = new Metaestat(); | |
| 1200 | - $resultado = array(); | |
| 1201 | - $resultado["tipo_periodo"] = $m->listaTipoPeriodo(); | |
| 1202 | - $resultado["unidade_medida"] = $m->listaUnidadeMedida(); | |
| 1203 | - $resultado["tipo_regiao"] = $m->listaTipoRegiao(); | |
| 1204 | - $resultado["conexao"] = $m->listaConexao(); | |
| 1205 | - $resultado["conexaoregistrada"] = $m->listaConexao("",false,false); | |
| 1206 | - $resultado["fonteinfo"] = $m->listaFonteinfo(); | |
| 1207 | - retornaJSON($resultado); | |
| 1208 | - break; | |
| 1209 | - /* | |
| 1210 | - Valor: SQLMEDIDAVARIAVEL | |
| 1211 | - | |
| 1212 | - Sql para acessar os dados de uma medida de uma variavel | |
| 1213 | - | |
| 1214 | - Retorno: | |
| 1215 | - | |
| 1216 | - {JSON} | |
| 1217 | - */ | |
| 1218 | - case "SQLMEDIDAVARIAVEL": | |
| 1219 | - $m = new Metaestat(); | |
| 1220 | - $dados = $m->sqlMedidaVariavel($id_medida_variavel); | |
| 1221 | - retornaJSON($dados); | |
| 1222 | - exit; | |
| 1223 | - break; | |
| 1224 | - /* | |
| 1225 | - Valor: DADOSMEDIDAVARIAVEL | |
| 1226 | - | |
| 1227 | - Mostra os dados de uma media de uma variavel | |
| 1228 | - | |
| 1229 | - Parametros: | |
| 1230 | - | |
| 1231 | - formato | |
| 1232 | - | |
| 1233 | - filtro | |
| 1234 | - | |
| 1235 | - agruparpor | |
| 1236 | - | |
| 1237 | - todasascolunas - 0 ou 1 | |
| 1238 | - | |
| 1239 | - Retorno: | |
| 1240 | - | |
| 1241 | - {JSON} | |
| 1242 | - */ | |
| 1243 | - case "DADOSMEDIDAVARIAVEL": | |
| 1244 | - $m = new Metaestat(); | |
| 1245 | - $dados = $m->dadosMedidaVariavel($id_medida_variavel,$_GET["filtro"],$_GET["todasascolunas"],$_GET["agruparpor"]); | |
| 1246 | - if($_GET["formato"] == "json"){ | |
| 1247 | - retornaJSON($dados); | |
| 1248 | - } | |
| 1249 | - if($_GET["formato"] == "xml"){ | |
| 1250 | - header("Content-type: application/xml"); | |
| 1251 | - echo($m->formataXML($dados)); | |
| 1252 | - } | |
| 1253 | - if($_GET["formato"] == "csv"){ | |
| 1254 | - require_once(dirname(__FILE__)."/../../pacotes/parsecsv/parsecsv.lib.php"); | |
| 1255 | - $csv = new parseCSV(); | |
| 1256 | - $csv->titles = array_keys($dados[0]); | |
| 1257 | - $csv->output(true, 'mvar'.$id_medida_variavel.'_'.date('dmY').'.csv', $dados); | |
| 1258 | - } | |
| 1259 | - exit; | |
| 1260 | - break; | |
| 1261 | - /* | |
| 1262 | - Valor: MAPFILEMEDIDAVARIAVEL | |
| 1263 | - | |
| 1264 | - Cria o mapfile de uma media de uma variavel | |
| 1265 | - | |
| 1266 | - Parametros: | |
| 1267 | - | |
| 1268 | - formato | |
| 1269 | - | |
| 1270 | - filtro | |
| 1271 | - | |
| 1272 | - agruparpor | |
| 1273 | - | |
| 1274 | - todasascolunas - 0 ou 1 | |
| 1275 | - | |
| 1276 | - Retorno: | |
| 1277 | - | |
| 1278 | - {JSON} | |
| 1279 | - */ | |
| 1280 | - case "MAPFILEMEDIDAVARIAVEL": | |
| 1281 | - //$filtro usa aspas duplas para enviar os parametros | |
| 1282 | - $filtro = str_replace('"',"'",$_GET["filtro"]); | |
| 1283 | - $m = new Metaestat(); | |
| 1284 | - if(!isset($codigo_tipo_regiao)){ | |
| 1285 | - $codigo_tipo_regiao = ""; | |
| 1286 | - } | |
| 1287 | - if(!isset($_GET["opacidade"])){ | |
| 1288 | - $_GET["opacidade"] = ""; | |
| 1289 | - } | |
| 1290 | - if($_GET["cachemapfile"] === "nao"){ | |
| 1291 | - $_GET["cachemapfile"] = false; | |
| 1292 | - } | |
| 1293 | - else{ | |
| 1294 | - $_GET["cachemapfile"] = true; | |
| 1295 | - } | |
| 1296 | - if($_GET["formato"] == "json"){ | |
| 1297 | - retornaJSON($m->mapfileMedidaVariavel($id_medida_variavel,$filtro,$_GET["todasascolunas"],$_GET["tipolayer"],$_GET["titulolayer"],$id_classificacao,$_GET["agruparpor"],$codigo_tipo_regiao,$_GET["opacidade"],false,$_GET["cachemapfile"])); | |
| 1298 | - } | |
| 1299 | - exit; | |
| 1300 | - break; | |
| 1301 | - /* | |
| 1302 | - Valor: MAPFILETIPOREGIAO | |
| 1303 | - | |
| 1304 | - Gera um mapfile de um tipo de regiao | |
| 1305 | - | |
| 1306 | - */ | |
| 1307 | - case "MAPFILETIPOREGIAO": | |
| 1308 | - $m = new Metaestat(); | |
| 1309 | - if(empty($_GET["outlinecolor"])){ | |
| 1310 | - $_GET["outlinecolor"] = "255,0,0"; | |
| 1311 | - } | |
| 1312 | - if(empty($_GET["width"])){ | |
| 1313 | - $_GET["width"] = 1; | |
| 1314 | - } | |
| 1315 | - if(empty($_GET["nomes"])){ | |
| 1316 | - $_GET["nomes"] = "nao"; | |
| 1317 | - } | |
| 1318 | - retornaJSON($m->mapfileTipoRegiao($codigo_tipo_regiao,$_GET["outlinecolor"],$_GET["width"],$_GET["nomes"])); | |
| 1319 | - exit; | |
| 1320 | - break; | |
| 1321 | - /* | |
| 1322 | - Valor: KMLMEDIDAVARIAVEL | |
| 1323 | - | |
| 1324 | - Gera um arquivo kml que pode ser aberto no googleearth | |
| 1325 | - | |
| 1326 | - */ | |
| 1327 | - case "KMLMEDIDAVARIAVEL": | |
| 1328 | - $m = new Metaestat(); | |
| 1329 | - $r = $m->mapfileMedidaVariavel($id_medida_variavel,$_GET["filtro"],$_GET["todasascolunas"],$_GET["tipolayer"],$_GET["titulolayer"],$id_classificacao,$_GET["agruparpor"]); | |
| 1330 | - //cria um mapfile completo, que inclui a camada no mapfile de inicializacao do i3geo | |
| 1331 | - $mapfile = $m->mapfileCompleto($r["mapfile"]); | |
| 1332 | - $formato = $_GET["formato"]; | |
| 1333 | - if($formato == "kml" || $formato == "kmz"){ | |
| 1334 | - //define as variaveis necessarias ao pacote kmlserver | |
| 1335 | - set_time_limit(0); | |
| 1336 | - $_REQUEST["map"] = $mapfile; | |
| 1337 | - $_REQUEST["typename"] = $r["layer"]; | |
| 1338 | - $_REQUEST["request"] = $formato; | |
| 1339 | - //$_REQUEST["service"] = "icon"; | |
| 1340 | - include (dirname(__FILE__)."/../../pacotes/kmlmapserver/classes/kmlserver.class.php"); | |
| 1341 | - $server = new KmlServer(); | |
| 1342 | - }else{//3d com tme | |
| 1343 | - if(!isset($dir_tmp)){ | |
| 1344 | - include(dirname(__FILE__)."/../../ms_configura.php"); | |
| 1345 | - } | |
| 1346 | - $verificaSID = false; | |
| 1347 | - $mv = $m->listaMedidaVariavel("",$id_medida_variavel); | |
| 1348 | - $reg = $m->listaTipoRegiao($mv["codigo_tipo_regiao"]); | |
| 1349 | - $_GET["nomelayer"] = $r["layer"]; | |
| 1350 | - $_GET["colunasvalor"] = $mv["colunavalor"]; | |
| 1351 | - $_GET["colunanomeregiao"] = $reg["colunanomeregiao"]; | |
| 1352 | - $_GET["titulo"] = $r["titulolayer"]; | |
| 1353 | - $_GET["descricao"] = $mv["colunavalor"]; | |
| 1354 | - $_SESSION["map_file"] = $mapfile; | |
| 1355 | - $_SESSION["postgis_mapa"] = ""; | |
| 1356 | - $_SESSION["tmpurl"] = ""; | |
| 1357 | - $_SESSION["mapext"] = ""; | |
| 1358 | - $download = true; | |
| 1359 | - $parametersTME = array( | |
| 1360 | - 'mapType' => 'bar', | |
| 1361 | - 'indicator' => 'valores', | |
| 1362 | - 'year' => "", | |
| 1363 | - 'classification' => 'equal', | |
| 1364 | - 'mapTitle' => $r["titulolayer"], | |
| 1365 | - 'timeType' => "slider", //para mais de um ano, escolha slider ou series | |
| 1366 | - 'dirtmp' => $dir_tmp, | |
| 1367 | - 'barSize'=> 5000 | |
| 1368 | - ); | |
| 1369 | - include (dirname(__FILE__)."/../../pacotes/tme/TME_i3geo.php"); | |
| 1370 | - } | |
| 1371 | - exit; | |
| 1372 | - break; | |
| 1373 | - /* | |
| 1374 | - Valor: SUMARIOMEDIDAVARIAVEL | |
| 1375 | - | |
| 1376 | - Sumario estatistico media de uma variavel | |
| 1377 | - | |
| 1378 | - Parametros: | |
| 1379 | - | |
| 1380 | - formato | |
| 1381 | - | |
| 1382 | - filtro | |
| 1383 | - | |
| 1384 | - Retorno: | |
| 1385 | - | |
| 1386 | - {JSON} | |
| 1387 | - */ | |
| 1388 | - case "SUMARIOMEDIDAVARIAVEL": | |
| 1389 | - $m = new Metaestat(); | |
| 1390 | - $dados = $m->sumarioMedidaVariavel($id_medida_variavel,$_GET["filtro"],$_GET["agruparpor"]); | |
| 1391 | - if($_GET["formato"] == "json"){ | |
| 1392 | - retornaJSON($dados); | |
| 1393 | - } | |
| 1394 | - if($_GET["formato"] == "xml"){ | |
| 1395 | - header("Content-type: application/xml"); | |
| 1396 | - echo($m->formataXML($dados["grupos"])); | |
| 1397 | - } | |
| 1398 | - exit; | |
| 1399 | - break; | |
| 1400 | - /* | |
| 1401 | - Valor: ESQUEMASCONEXAO | |
| 1402 | - | |
| 1403 | - Lista os esquemas de uma conexao | |
| 1404 | - | |
| 1405 | - Parametros: | |
| 1406 | - | |
| 1407 | - formato | |
| 1408 | - | |
| 1409 | - codigo_estat_conexao | |
| 1410 | - | |
| 1411 | - Retorno: | |
| 1412 | - | |
| 1413 | - {JSON} | |
| 1414 | - */ | |
| 1415 | - case "ESQUEMASCONEXAO": | |
| 1416 | - $m = new Metaestat(); | |
| 1417 | - if($_GET["formato"] == "json"){ | |
| 1418 | - retornaJSON($m->esquemasConexao($codigo_estat_conexao)); | |
| 1419 | - } | |
| 1420 | - exit; | |
| 1421 | - break; | |
| 1422 | - /* | |
| 1423 | - Valor: TABELASESQUEMA | |
| 1424 | - | |
| 1425 | - Lista as tabelas de um esquema | |
| 1426 | - | |
| 1427 | - Parametros: | |
| 1428 | - | |
| 1429 | - formato | |
| 1430 | - | |
| 1431 | - codigo_estat_conexao | |
| 1432 | - | |
| 1433 | - nome_esquema | |
| 1434 | - | |
| 1435 | - Retorno: | |
| 1436 | - | |
| 1437 | - {JSON} | |
| 1438 | - */ | |
| 1439 | - case "TABELASESQUEMA": | |
| 1440 | - $m = new Metaestat(); | |
| 1441 | - if(empty($_GET["excluigeom"])){ | |
| 1442 | - $_GET["excluigeom"] = ""; | |
| 1443 | - } | |
| 1444 | - if($_GET["formato"] == "json"){ | |
| 1445 | - retornaJSON($m->tabelasEsquema($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["excluigeom"])); | |
| 1446 | - } | |
| 1447 | - exit; | |
| 1448 | - break; | |
| 1449 | - case "CRIATABELADB": | |
| 1450 | - $m = new Metaestat(); | |
| 1451 | - if($nome_esquema != "i3geo_metaestat"){ | |
| 1452 | - retornaJSON("erro"); | |
| 1453 | - exit; | |
| 1454 | - } | |
| 1455 | - retornaJSON($m->criaTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["comentario"])); | |
| 1456 | - exit; | |
| 1457 | - break; | |
| 1458 | - case "CRIAESQUEMADB": | |
| 1459 | - $m = new Metaestat(); | |
| 1460 | - retornaJSON($m->criaEsquemaDB($codigo_estat_conexao,$_GET["nome_esquema"])); | |
| 1461 | - exit; | |
| 1462 | - break; | |
| 1463 | - case "ALTERANOMETABELADB": | |
| 1464 | - $m = new Metaestat(); | |
| 1465 | - if($_GET["nome_esquema"] != "i3geo_metaestat"){ | |
| 1466 | - retornaJSON("erro"); | |
| 1467 | - exit; | |
| 1468 | - } | |
| 1469 | - retornaJSON($m->alteraNomeTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["novonome_tabela"])); | |
| 1470 | - exit; | |
| 1471 | - break; | |
| 1472 | - case "ALTERANOMEESQUEMADB": | |
| 1473 | - $m = new Metaestat(); | |
| 1474 | - retornaJSON($m->alteraNomeEsquemaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["novonome_esquema"])); | |
| 1475 | - exit; | |
| 1476 | - break; | |
| 1477 | - case "COPIATABELADB": | |
| 1478 | - $m = new Metaestat(); | |
| 1479 | - if($_GET["nome_esquema"] != "i3geo_metaestat"){ | |
| 1480 | - retornaJSON("erro"); | |
| 1481 | - exit; | |
| 1482 | - } | |
| 1483 | - retornaJSON($m->copiaTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["novonome_tabela"])); | |
| 1484 | - exit; | |
| 1485 | - break; | |
| 1486 | - /* | |
| 1487 | - Valor: COLUNASTABELA | |
| 1488 | - | |
| 1489 | - Lista as colunas de uma tabela | |
| 1490 | - | |
| 1491 | - Parametros: | |
| 1492 | - | |
| 1493 | - formato | |
| 1494 | - | |
| 1495 | - codigo_estat_conexao | |
| 1496 | - | |
| 1497 | - nome_esquema | |
| 1498 | - | |
| 1499 | - nome_tabela | |
| 1500 | - | |
| 1501 | - Retorno: | |
| 1502 | - | |
| 1503 | - {JSON} | |
| 1504 | - */ | |
| 1505 | - case "COLUNASTABELA": | |
| 1506 | - $m = new Metaestat(); | |
| 1507 | - if(empty($_GET["tipo"])){ | |
| 1508 | - $_GET["tipo"] = ""; | |
| 1509 | - } | |
| 1510 | - if($_GET["formato"] == "json"){ | |
| 1511 | - retornaJSON($m->colunasTabela($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["tipo"])); | |
| 1512 | - } | |
| 1513 | - exit; | |
| 1514 | - break; | |
| 1515 | - case "INFOTABELA": | |
| 1516 | - $m = new Metaestat(); | |
| 1517 | - $colunas = $m->colunasTabela($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],""); | |
| 1518 | - $comentario = $m->comentarioTabela($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"]); | |
| 1519 | - if($_GET["formato"] == "json"){ | |
| 1520 | - retornaJSON(array( | |
| 1521 | - "colunas"=>$colunas, | |
| 1522 | - "comentario"=>$comentario | |
| 1523 | - )); | |
| 1524 | - } | |
| 1525 | - exit; | |
| 1526 | - case "CRIACOLUNADB": | |
| 1527 | - $m = new Metaestat(); | |
| 1528 | - if($_GET["nome_esquema"] != "i3geo_metaestat"){ | |
| 1529 | - retornaJSON("erro"); | |
| 1530 | - exit; | |
| 1531 | - } | |
| 1532 | - retornaJSON($m->criaColunaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["nova_coluna"],$_GET["tipo"])); | |
| 1533 | - exit; | |
| 1534 | - break; | |
| 1535 | - case "ALTERANOMECOLUNADB": | |
| 1536 | - $m = new Metaestat(); | |
| 1537 | - if($_GET["nome_esquema"] != "i3geo_metaestat"){ | |
| 1538 | - retornaJSON("erro"); | |
| 1539 | - exit; | |
| 1540 | - } | |
| 1541 | - retornaJSON($m->alteraNomeColunaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["nome_coluna"],$_GET["novonome_coluna"])); | |
| 1542 | - exit; | |
| 1543 | - break; | |
| 1544 | - case "OBTEMDADOSTABELADB": | |
| 1545 | - $m = new Metaestat(); | |
| 1546 | - if($_GET["formato"] == "json"){ | |
| 1547 | - retornaJSON($m->obtemDadosTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["geo"],$_GET["nreg"])); | |
| 1548 | - } | |
| 1549 | - if($_GET["formato"] == "csv"){ | |
| 1550 | - $dados = $m->obtemDadosTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["geo"],$_GET["nreg"]); | |
| 1551 | - require_once(dirname(__FILE__)."/../../pacotes/parsecsv/parsecsv.lib.php"); | |
| 1552 | - $csv = new parseCSV(); | |
| 1553 | - //$csv->encoding('UTF-16', 'UTF-8'); | |
| 1554 | - $csv->titles = $dados["nomescolunas"]; | |
| 1555 | - $csv->output(true, 'mvar'.$_GET["nome_tabela"].'_'.date('dmY').'.csv', $dados["linhas"]); | |
| 1556 | - } | |
| 1557 | - exit; | |
| 1558 | - break; | |
| 1559 | - /* | |
| 1560 | - Valor: DESCREVECOLUNASTABELA | |
| 1561 | - | |
| 1562 | - Lista as colunas de uma tabela | |
| 1563 | - | |
| 1564 | - Parametros: | |
| 1565 | - | |
| 1566 | - formato | |
| 1567 | - | |
| 1568 | - codigo_estat_conexao | |
| 1569 | - | |
| 1570 | - nome_esquema | |
| 1571 | - | |
| 1572 | - nome_tabela | |
| 1573 | - | |
| 1574 | - Retorno: | |
| 1575 | - | |
| 1576 | - {JSON} | |
| 1577 | - */ | |
| 1578 | - case "DESCREVECOLUNASTABELA": | |
| 1579 | - $m = new Metaestat(); | |
| 1580 | - if($_GET["formato"] == "json"){ | |
| 1581 | - $c = $m->descreveColunasTabela($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"]); | |
| 1582 | - $s = $m->listaTabelaSerial($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"]); | |
| 1583 | - for($i=0;$i<count($c);$i++){ | |
| 1584 | - if($c[$i]["field"] == $s){ | |
| 1585 | - $c[$i]["serial"] = true; | |
| 1586 | - } | |
| 1587 | - else{ | |
| 1588 | - $c[$i]["serial"] = false; | |
| 1589 | - } | |
| 1590 | - } | |
| 1591 | - retornaJSON($c); | |
| 1592 | - } | |
| 1593 | - exit; | |
| 1594 | - break; | |
| 1595 | - case "ARVOREVAR": | |
| 1596 | - $m = new Metaestat(); | |
| 1597 | - if(empty($codigo_variavel)){ | |
| 1598 | - $codigo_variavel = ""; | |
| 1599 | - } | |
| 1600 | - $dados = $m->relatorioCompleto($codigo_variavel,$_GET["dadosGerenciais"]); | |
| 1601 | - retornaJSON($dados); | |
| 1602 | - exit; | |
| 1603 | - break; | |
| 1604 | - case "RELATORIOCOMPLETO": | |
| 1605 | - $m = new Metaestat(); | |
| 1606 | - if(empty($codigo_variavel)){ | |
| 1607 | - $codigo_variavel = ""; | |
| 1608 | - } | |
| 1609 | - $dados = $m->relatorioCompleto($codigo_variavel,$_GET["dadosGerenciais"]); | |
| 1610 | - if(empty($_GET["detalhes"])){ | |
| 1611 | - $_GET["detalhes"] = "sim"; | |
| 1612 | - } | |
| 1613 | - $dados = $m->formataRelatorioHtml($dados,$_GET["detalhes"]); | |
| 1614 | - retornaJSON($dados); | |
| 1615 | - exit; | |
| 1616 | - break; | |
| 1617 | - //insere dados com base em um arquivo csv ja existente no servidor | |
| 1618 | - case "INSERIRDADOS": | |
| 1619 | - $m = new Metaestat(); | |
| 1620 | - retornaJSON($m->inserirDados($nomearquivoserv,$id_medida_variavel,$_GET["codigoregiao"],$_GET["valor"],$_GET["tipoinclusao"],$_GET["ano"],$_GET["mes"],$_GET["dia"],$_GET["hora"])); | |
| 1621 | - exit; | |
| 1622 | - break; | |
| 1623 | - //grava ou cria um registro de uma regiao | |
| 1624 | - case "MANTEMDADOSREGIAO": | |
| 1625 | - $m = new Metaestat(); | |
| 1626 | - retornaJSON($m->mantemDadosRegiao($codigo_tipo_regiao,$_GET["identificador"],$_GET["identificadornovo"],$_GET["nome"],$_GET["wkt"],$_GET["tipo"])); | |
| 1627 | - exit; | |
| 1628 | - break; | |
| 1629 | - case "LISTAATRIBUTOSMEDIDAVARIAVELXY": | |
| 1630 | - $m = new Metaestat(); | |
| 1631 | - $regiao = $m->xy2regiao($codigo_tipo_regiao, $_GET["x"], $_GET["y"]); | |
| 1632 | - $identificador_regiao = $regiao["identificador_regiao"]; | |
| 1633 | - $resultado = array(); | |
| 1634 | - if($regiao != ""){ | |
| 1635 | - $dados = $m->listaAtributosMedidaVariavelRegiao($identificador_regiao, $id_medida_variavel); | |
| 1636 | - $resultado = array( | |
| 1637 | - "atributos"=>$dados, | |
| 1638 | - "regiao"=>$regiao | |
| 1639 | - ); | |
| 1640 | - } | |
| 1641 | - retornaJSON($resultado); | |
| 1642 | - exit; | |
| 1643 | - break; | |
| 1644 | - case "LISTATODOSATRIBUTOSMEDIDAVARIAVELXY": | |
| 1645 | - $lista = array(); | |
| 1646 | - $m = new Metaestat(); | |
| 1647 | - $regiao = $m->xy2regiao($codigo_tipo_regiao, $_GET["x"], $_GET["y"]); | |
| 1648 | - $identificador_regiao = $regiao["identificador_regiao"]; | |
| 1649 | - $variaveis = $m->listaVariavel(); | |
| 1650 | - $dadosVariavel = array(); | |
| 1651 | - | |
| 1652 | - foreach($variaveis as $variavel){ | |
| 1653 | - $medidas = $m->listaMedidaVariavel($variavel["codigo_variavel"]); | |
| 1654 | - $valores = array(); | |
| 1655 | - foreach($medidas as $medida){ | |
| 1656 | - $dadosMedida = $m->listaAtributosMedidaVariavelRegiao($identificador_regiao,$medida["id_medida_variavel"]); | |
| 1657 | - if($dadosMedida != ""){ | |
| 1658 | - $valores[] = array( | |
| 1659 | - "medida" => $medida["nomemedida"], | |
| 1660 | - "dados" => $dadosMedida | |
| 1661 | - ); | |
| 1662 | - } | |
| 1663 | - } | |
| 1664 | - if(!empty($valores)){ | |
| 1665 | - $dadosVariavel[] = array( | |
| 1666 | - "variavel" => $variavel["nome"], | |
| 1667 | - "dados" => $valores | |
| 1668 | - ); | |
| 1669 | - } | |
| 1670 | - } | |
| 1671 | - retornaJSON($dadosVariavel); | |
| 1672 | - exit; | |
| 1673 | - break; | |
| 1674 | - case "SALVAATRIBUTOSMEDIDAVARIAVEL": | |
| 1675 | - /* "&codigo_tipo_regiao="+codigo_tipo_regiao+"&identificador_regiao="+identificador_regiao+"&id_medida_variavel="+id_medida_variavel+"&colunas="+colunasT[0]+"&valores="+valoresT.join("|")+"&idsunicos="+idsunicosT[0] | |
| 1676 | - */ | |
| 1677 | - $_GET["valores"] = explode("#",$_GET["valores"]);//array de uma lista de strings com valores separados por ; | |
| 1678 | - $_GET["idsunicos"] = explode("|",$_GET["idsunicos"]);//array | |
| 1679 | - $_GET["colunas"] = explode("|",$_GET["colunas"]);//array | |
| 1680 | - $m = new Metaestat(); | |
| 1681 | - $resultado = $m->salvaAtributosMedidaVariavel($id_medida_variavel,$codigo_tipo_regiao,$_GET["identificador_regiao"],$_GET["idsunicos"],$_GET["colunas"],$_GET["valores"]); | |
| 1682 | - retornaJSON($resultado); | |
| 1683 | - exit; | |
| 1684 | - break; | |
| 1685 | - //utilizado na ferramenta de identificacao | |
| 1686 | - case "SALVAATRIBUTOSTIPOREGIAO": | |
| 1687 | - $m = new Metaestat(); | |
| 1688 | - $resultado = $m->mantemDadosRegiao($codigo_tipo_regiao,$_GET["identificador_regiao"],$_GET["identificador_regiao"],$_GET["valores"],"","alterar",$_GET["colunas"]); | |
| 1689 | - retornaJSON($resultado); | |
| 1690 | - exit; | |
| 1691 | - break; | |
| 1692 | - case "EXCLUIATRIBUTOSMEDIDAVARIAVEL": | |
| 1693 | - $m = new Metaestat(); | |
| 1694 | - $resultado = $m->excluiAtributosMedidaVariavel($id_medida_variavel,$codigo_tipo_regiao,$_GET["identificador_regiao"],$id); | |
| 1695 | - retornaJSON($resultado); | |
| 1696 | - exit; | |
| 1697 | - break; | |
| 1698 | - case "REGIAO2SHP": | |
| 1699 | - $m = new Metaestat(); | |
| 1700 | - $shp = $m->regiao2shp($codigo_tipo_regiao); | |
| 1701 | - include(dirname(__FILE__)."/../../pacotes/kmlmapserver/classes/zip.class.php"); | |
| 1702 | - | |
| 1703 | - $handle = fopen($shp.".shp", "r"); | |
| 1704 | - $contentsshp = fread($handle, filesize($shp.".shp")); | |
| 1705 | - fclose($handle); | |
| 1706 | - | |
| 1707 | - $handle = fopen($shp.".shp", "r"); | |
| 1708 | - $contentsdbf = fread($handle, filesize($shp.".dbf")); | |
| 1709 | - fclose($handle); | |
| 1710 | - | |
| 1711 | - $handle = fopen($shp.".shp", "r"); | |
| 1712 | - $contentsshx = fread($handle, filesize($shp.".shx")); | |
| 1713 | - fclose($handle); | |
| 1714 | - | |
| 1715 | - $ziper = new zipfile(); | |
| 1716 | - | |
| 1717 | - $ziper->addFile($contentsshp, basename($shp).'.shp'); | |
| 1718 | - $ziper->addFile($contentsshx, basename($shp).'.shx'); | |
| 1719 | - $ziper->addFile($contentsdbf, basename($shp).'.dbf'); | |
| 1720 | - $arq = $shp.".zip"; | |
| 1721 | - $ziper->output($arq); | |
| 1722 | - $dirtmp = basename(dirname($arq)); | |
| 1723 | - $d = "/ms_tmp/".basename($arq); | |
| 1724 | - echo "<html><script> window.location.assign('$d'); </script></html>"; | |
| 1725 | - break; | |
| 1726 | -} | |
| 1727 | -?> |
admin/php/webservices.php
| ... | ... | @@ -1,166 +0,0 @@ |
| 1 | -<?php | |
| 2 | -/* | |
| 3 | - Title: webservices.php | |
| 4 | - | |
| 5 | -Funções utilizadas pelo editor do cadastro de Web Services | |
| 6 | - | |
| 7 | -É utilizado nas funções em AJAX da interface de ediçã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ério do Meio Ambiente Brasil | |
| 16 | -Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
| 17 | - | |
| 18 | -Este programa é software livre; você pode redistribuí-lo | |
| 19 | -e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 20 | -GNU conforme publicada pela Free Software Foundation; | |
| 21 | - | |
| 22 | -Este programa é distribuído na expectativa de que seja útil, | |
| 23 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 24 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 25 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 26 | -Você deve ter recebido uma cópia da Licença Pública Geral do | |
| 27 | - GNU junto com este programa; se não, escreva para a | |
| 28 | -Free Software Foundation, Inc., no endereç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âmetro principal é "funcao", que define qual operação será executada, por exemplo, webservices.php?funcao=pegaws | |
| 38 | - | |
| 39 | -Cada operação possuí seus próprios parâmetros, que devem ser enviados também na requisição da operação. | |
| 40 | - | |
| 41 | -*/ | |
| 42 | -error_reporting(0); | |
| 43 | -// | |
| 44 | -//não sei pq mas ob_start e clean são necessários no Linux para nã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(array($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ção que deve ser executada | |
| 63 | -switch (strtoupper($funcao)) | |
| 64 | -{ | |
| 65 | - /* | |
| 66 | - Note: | |
| 67 | - | |
| 68 | - Valores que o parâmetro &funcao pode receber. Os parâmetros devem ser enviados na requisição em AJAX. | |
| 69 | - */ | |
| 70 | - /* | |
| 71 | - Valor: PEGAWS | |
| 72 | - | |
| 73 | - Lista de serviç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 | -?> | |
| 167 | 0 | \ No newline at end of file |
| ... | ... | @@ -0,0 +1,1728 @@ |
| 1 | +<?php | |
| 2 | +exit; | |
| 3 | +/* | |
| 4 | +Title: metaestat.php | |
| 5 | + | |
| 6 | +Funções utilizadas pelo sistema de metadados estatísticos | |
| 7 | + | |
| 8 | +Licenca: | |
| 9 | + | |
| 10 | +GPL2 | |
| 11 | + | |
| 12 | +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 13 | + | |
| 14 | +Direitos Autorais Reservados (c) 2012 Edmar Moretti | |
| 15 | +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.gov.br | |
| 16 | + | |
| 17 | +Este programa é software livre; você pode redistribuí-lo | |
| 18 | +e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 19 | +GNU conforme publicada pela Free Software Foundation; | |
| 20 | + | |
| 21 | +Este programa é distribuído na expectativa de que seja útil, | |
| 22 | +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 23 | +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 24 | +Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 25 | +Você deve ter recebido uma copia da Licença Pública Geral do | |
| 26 | +GNU junto com este programa; se não, escreva para a | |
| 27 | +Free Software Foundation, Inc., no endereço | |
| 28 | +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 29 | + | |
| 30 | +Arquivo: | |
| 31 | + | |
| 32 | +i3geo/admin/php/metaestat.php | |
| 33 | + | |
| 34 | +Parametros: | |
| 35 | + | |
| 36 | +O parâmetro principal é "funcao", que define qual operação será executada, por exemplo, sistemas.php?funcao=pegasistemas. | |
| 37 | + | |
| 38 | +Cada operação possuí seus proprios parâmetros, que devem ser enviados também na requisição da operação. | |
| 39 | +*/ | |
| 40 | +include_once(dirname(__FILE__)."/login.php"); | |
| 41 | + | |
| 42 | +$codigo_estat_conexao = $_GET["codigo_estat_conexao"];//pode ser string ou numerico | |
| 43 | +$codigo_variavel = (int) $_GET["codigo_variavel"]; | |
| 44 | +$codigo_tipo_periodo = (int) $_GET["codigo_tipo_periodo"]; | |
| 45 | +$codigo_tipo_regiao = (int) $_GET["codigo_tipo_regiao"]; | |
| 46 | +$codigo_unidade_medida = (int) $_GET["codigo_unidade_medida"]; | |
| 47 | +$codigo_tipo_regiao_pai = (int) $_GET["codigo_tipo_regiao_pai"]; | |
| 48 | +$id_medida_variavel = (int) $_GET["id_medida_variavel"]; | |
| 49 | +$id_classificacao = (int) $_GET["id_classificacao"]; | |
| 50 | +$id_link = (int) $_GET["id_link"]; | |
| 51 | +$id_classe = (int) $_GET["id_classe"]; | |
| 52 | +$id_parametro_medida = (int) $_GET["id_parametro_medida"]; | |
| 53 | +$id_fonteinfo = (int) $_GET["id_fonteinfo"]; | |
| 54 | +$id_agregaregiao = (int) $_GET["id_agregaregiao"]; | |
| 55 | +$id_mapa = (int) $_GET["id_mapa"]; | |
| 56 | +$id_mapa_grupo = (int) $_GET["id_mapa_grupo"]; | |
| 57 | +$id_mapa_tema = (int) $_GET["id_mapa_tema"]; | |
| 58 | +$id_pai = (int) $_GET["id_pai"]; | |
| 59 | + | |
| 60 | +//lista de funcoes que passam pela validacao de login | |
| 61 | +$funcoesEdicao = array( | |
| 62 | + "ALTERAMAPAGRUPO", | |
| 63 | + "ALTERAMAPATEMA", | |
| 64 | + "ALTERAMAPA", | |
| 65 | + "ALTERAVARIAVEL", | |
| 66 | + "ALTERAMEDIDAVARIAVEL", | |
| 67 | + "ALTERAPARAMETROMEDIDA", | |
| 68 | + "ALTERACLASSIFICACAOMEDIDA", | |
| 69 | + "CALCULACLASSIFICACAO", | |
| 70 | + "ALTERACLASSECLASSIFICACAO", | |
| 71 | + "ALTERALINKMEDIDA", | |
| 72 | + "ALTERAFONTEINFO", | |
| 73 | + "ADICIONAFONTEINFOMEDIDA", | |
| 74 | + "ALTERARUNIDADEMEDIDA", | |
| 75 | + "ALTERARCONEXAO", | |
| 76 | + "ALTERARTIPOREGIAO", | |
| 77 | + "ALTERAAGREGAREGIAO", | |
| 78 | + "ALTERARTIPOPERIODO", | |
| 79 | + "EXCLUIRMAPA", | |
| 80 | + "EXCLUIRMAPAGRUPO", | |
| 81 | + "EXCLUIRMAPATEMA", | |
| 82 | + "EXCLUIRVARIAVEL", | |
| 83 | + "EXCLUIRTIPOPERIODO", | |
| 84 | + "EXCLUIRUNIDADEMEDIDA", | |
| 85 | + "EXCLUIRFONTEINFO", | |
| 86 | + "EXCLUIRFONTEINFOMEDIDA", | |
| 87 | + "EXCLUIRCONEXAO", | |
| 88 | + "EXCLUIRTIPOREGIAO", | |
| 89 | + "EXCLUIRAGREGAREGIAO", | |
| 90 | + "EXCLUIRMEDIDAVARIAVEL", | |
| 91 | + "EXCLUIRPARAMETROMEDIDA", | |
| 92 | + "EXCLUIRCLASSIFICACAOMEDIDA", | |
| 93 | + "EXCLUIRCLASSECLASSIFICACAO", | |
| 94 | + "EXCLUIRLINKMEDIDA", | |
| 95 | + "OBTEMDADOSTABELADB", | |
| 96 | + "INSERIRDADOS", | |
| 97 | + "MANTEMDADOSREGIAO", | |
| 98 | + "SALVAATRIBUTOSTIPOREGIAO", | |
| 99 | + "SALVAATRIBUTOSMEDIDAVARIAVEL", | |
| 100 | + "EXCLUIATRIBUTOSMEDIDAVARIAVEL", | |
| 101 | + "REGIAO2SHP", | |
| 102 | + "ESQUEMASCONEXAO", | |
| 103 | + "TABELASESQUEMA", | |
| 104 | + "ALTERAESTILOSCLASSIFICACAO", | |
| 105 | + "INFOTABELA" | |
| 106 | +); | |
| 107 | +if(in_array(strtoupper($funcao),$funcoesEdicao)){ | |
| 108 | + //se a funcao esta no array eh feita a verificacao se o usuario esta logado e se ele esta em um grupo que | |
| 109 | + //permite o uso da operacao admin/metaestat/geral | |
| 110 | + if(verificaOperacaoSessao("admin/metaestat/geral") == false){ | |
| 111 | + //algumas funcoes possuem tratamento especial sem login | |
| 112 | + if(strtoupper($funcao) == "ESQUEMASCONEXAO"){ | |
| 113 | + $esquema = array(array("oid"=>0,"esquema"=>"public")); | |
| 114 | + retornaJSON($esquema);exit; | |
| 115 | + } | |
| 116 | + if(strtoupper($funcao) == "TABELASESQUEMA"){ | |
| 117 | + if($_GET["nome_esquema"] != "public"){ | |
| 118 | + retornaJSON("Vc nao pode realizar essa operacao.");exit; | |
| 119 | + } | |
| 120 | + } | |
| 121 | + if(strtoupper($funcao) != "ESQUEMASCONEXAO" && strtoupper($funcao) != "TABELASESQUEMA"){ | |
| 122 | + retornaJSON("Vc nao pode realizar essa operacao.");exit; | |
| 123 | + } | |
| 124 | + } | |
| 125 | +} | |
| 126 | +//verifica as funcoes que manipulam o banco de dados | |
| 127 | +$funcoesEdicao = array( | |
| 128 | + "CRIATABELADB", | |
| 129 | + "CRIAESQUEMADB", | |
| 130 | + "ALTERANOMETABELADB", | |
| 131 | + "ALTERANOMEESQUEMADB", | |
| 132 | + "COPIATABELADB", | |
| 133 | + "CRIACOLUNADB", | |
| 134 | + "ALTERANOMECOLUNADB", | |
| 135 | +); | |
| 136 | +if(in_array(strtoupper($funcao),$funcoesEdicao)){ | |
| 137 | + if(verificaOperacaoSessao("admin/metaestat/editorbanco") == false){ | |
| 138 | + retornaJSON("Vc nao pode realizar essa operacao.");exit; | |
| 139 | + } | |
| 140 | +} | |
| 141 | + | |
| 142 | +include(dirname(__FILE__)."/classe_metaestat.php"); | |
| 143 | +//error_reporting(0); | |
| 144 | +//faz a busca da função que deve ser executada | |
| 145 | +switch (strtoupper($funcao)) | |
| 146 | +{ | |
| 147 | + /* | |
| 148 | + Note: | |
| 149 | + | |
| 150 | + Valores que o parâmetro &funcao pode receber. Os parâmetros devem ser enviados na requisição em AJAX. | |
| 151 | + */ | |
| 152 | + /* | |
| 153 | + Valor: LISTACONEXAO | |
| 154 | + | |
| 155 | + Lista de conexoes | |
| 156 | + | |
| 157 | + Retorno: | |
| 158 | + | |
| 159 | + {JSON} | |
| 160 | + */ | |
| 161 | + case "LISTACONEXAO": | |
| 162 | + $m = new Metaestat(); | |
| 163 | + retornaJSON($m->listaConexao($codigo_estat_conexao)); | |
| 164 | + exit; | |
| 165 | + break; | |
| 166 | + /* | |
| 167 | + Valor: LISTAVARIAVEL | |
| 168 | + | |
| 169 | + Lista de variaveis | |
| 170 | + | |
| 171 | + Retorno: | |
| 172 | + | |
| 173 | + {JSON} | |
| 174 | + */ | |
| 175 | + case "LISTAVARIAVEL": | |
| 176 | + $m = new Metaestat(); | |
| 177 | + if(empty($_GET["filtro_esquema"])){ | |
| 178 | + $_GET["filtro_esquema"] = ""; | |
| 179 | + } | |
| 180 | + retornaJSON($m->listaVariavel($codigo_variavel,$_GET["filtro_esquema"])); | |
| 181 | + exit; | |
| 182 | + break; | |
| 183 | + /* | |
| 184 | + Valor: LISTACLASSIFICACAOMEDIDA | |
| 185 | + | |
| 186 | + Lista as classificacoes de uma medida de uma variavel | |
| 187 | + | |
| 188 | + Retorno: | |
| 189 | + | |
| 190 | + {JSON} | |
| 191 | + */ | |
| 192 | + case "LISTACLASSIFICACAOMEDIDA": | |
| 193 | + $m = new Metaestat(); | |
| 194 | + retornaJSON($m->listaClassificacaoMedida($id_medida_variavel,$id_classificacao)); | |
| 195 | + exit; | |
| 196 | + break; | |
| 197 | + case "LISTALINKMEDIDA": | |
| 198 | + $m = new Metaestat(); | |
| 199 | + retornaJSON($m->listaLinkMedida($id_medida_variavel,$id_link)); | |
| 200 | + exit; | |
| 201 | + break; | |
| 202 | + /* | |
| 203 | + Valor: LISTACLASSECLASSIFICACAO | |
| 204 | + | |
| 205 | + Lista as classes de uma classificacoes | |
| 206 | + | |
| 207 | + Retorno: | |
| 208 | + | |
| 209 | + {JSON} | |
| 210 | + */ | |
| 211 | + case "LISTACLASSECLASSIFICACAO": | |
| 212 | + $m = new Metaestat(); | |
| 213 | + retornaJSON($m->listaClasseClassificacao($id_classificacao,$id_classe)); | |
| 214 | + exit; | |
| 215 | + break; | |
| 216 | + /* | |
| 217 | + Valor: LISTAMEDIDAVARIAVEL | |
| 218 | + | |
| 219 | + Lista das medidas de uma variavel | |
| 220 | + | |
| 221 | + Retorno: | |
| 222 | + | |
| 223 | + {JSON} | |
| 224 | + */ | |
| 225 | + case "LISTAMEDIDAVARIAVEL": | |
| 226 | + $m = new Metaestat(); | |
| 227 | + retornaJSON($m->listaMedidaVariavel($codigo_variavel,$id_medida_variavel)); | |
| 228 | + exit; | |
| 229 | + break; | |
| 230 | + /* | |
| 231 | + Valor: LISTAPARAMETRO | |
| 232 | + | |
| 233 | + Lista de parametros | |
| 234 | + | |
| 235 | + Retorno: | |
| 236 | + | |
| 237 | + {JSON} | |
| 238 | + */ | |
| 239 | + case "LISTAPARAMETRO": | |
| 240 | + $m = new Metaestat(); | |
| 241 | + retornaJSON($m->listaParametro($id_medida_variavel,$id_parametro_medida)); | |
| 242 | + exit; | |
| 243 | + break; | |
| 244 | + case "LISTAVALORESPARAMETRO": | |
| 245 | + $m = new Metaestat(); | |
| 246 | + retornaJSON($m->listaValoresParametro($id_parametro_medida)); | |
| 247 | + exit; | |
| 248 | + break; | |
| 249 | + /* | |
| 250 | + Valor: LISTAUNIDADEMEDIDA | |
| 251 | + | |
| 252 | + Lista de unidades de medida | |
| 253 | + | |
| 254 | + Retorno: | |
| 255 | + | |
| 256 | + {JSON} | |
| 257 | + */ | |
| 258 | + case "LISTAUNIDADEMEDIDA": | |
| 259 | + $m = new Metaestat(); | |
| 260 | + retornaJSON($m->listaUnidadeMedida($codigo_unidade_medida)); | |
| 261 | + exit; | |
| 262 | + break; | |
| 263 | + case "LISTAFONTEINFO": | |
| 264 | + $m = new Metaestat(); | |
| 265 | + retornaJSON($m->listaFonteinfo($id_fonteinfo)); | |
| 266 | + exit; | |
| 267 | + break; | |
| 268 | + case "LISTAFONTEINFOMEDIDA": | |
| 269 | + $m = new Metaestat(); | |
| 270 | + retornaJSON($m->listaFonteinfoMedida($id_medida_variavel)); | |
| 271 | + exit; | |
| 272 | + break; | |
| 273 | + /* | |
| 274 | + Valor: LISTATIPOPERIODO | |
| 275 | + | |
| 276 | + Lista de unidades de medida | |
| 277 | + | |
| 278 | + Retorno: | |
| 279 | + | |
| 280 | + {JSON} | |
| 281 | + */ | |
| 282 | + case "LISTATIPOPERIODO": | |
| 283 | + $m = new Metaestat(); | |
| 284 | + retornaJSON($m->listaTipoPeriodo($codigo_tipo_periodo)); | |
| 285 | + exit; | |
| 286 | + break; | |
| 287 | + /* | |
| 288 | + Valor: LISTATIPOREGIAO | |
| 289 | + | |
| 290 | + Lista de tipos de regiao | |
| 291 | + | |
| 292 | + Retorno: | |
| 293 | + | |
| 294 | + {JSON} | |
| 295 | + */ | |
| 296 | + case "LISTATIPOREGIAO": | |
| 297 | + $m = new Metaestat(); | |
| 298 | + retornaJSON($m->listaTipoRegiao($codigo_tipo_regiao)); | |
| 299 | + exit; | |
| 300 | + break; | |
| 301 | + case "LISTAHIERARQUIAREGIOES": | |
| 302 | + $m = new Metaestat(); | |
| 303 | + $regioes = $m->listaHierarquiaRegioes($codigo_tipo_regiao); | |
| 304 | + $valores = ""; | |
| 305 | + //se achou apenas uma regiao, pega os valores | |
| 306 | + if(count($regioes) < 2 && $codigo_tipo_regiao != ""){ | |
| 307 | + $valores = $m->listaDadosRegiao($codigo_tipo_regiao,$_GET["codigoregiaopai"],$_GET["valorregiaopai"]); | |
| 308 | + } | |
| 309 | + retornaJSON(array("regiaopai"=>$codigo_tipo_regiao,"regioes"=>$regioes,"valores"=>$valores)); | |
| 310 | + exit; | |
| 311 | + break; | |
| 312 | + case "LISTAREGIOESMEDIDA": | |
| 313 | + $m = new Metaestat(); | |
| 314 | + retornaJSON($m->listaRegioesMedida($id_medida_variavel)); | |
| 315 | + exit; | |
| 316 | + break; | |
| 317 | + case "LISTAAGREGAREGIAO": | |
| 318 | + $m = new Metaestat(); | |
| 319 | + if(empty($codigo_tipo_regiao)){ | |
| 320 | + $codigo_tipo_regiao = ""; | |
| 321 | + } | |
| 322 | + retornaJSON($m->listaAgregaRegiao($codigo_tipo_regiao,$id_agregaregiao)); | |
| 323 | + exit; | |
| 324 | + case "LISTAMAPAS": | |
| 325 | + $m = new Metaestat(); | |
| 326 | + if(empty($id_mapa)){ | |
| 327 | + $id_mapa = ""; | |
| 328 | + } | |
| 329 | + retornaJSON($m->listaMapas($id_mapa)); | |
| 330 | + exit; | |
| 331 | + break; | |
| 332 | + case "LISTAGRUPOSMAPA": | |
| 333 | + $m = new Metaestat(); | |
| 334 | + retornaJSON($m->listaGruposMapa($id_mapa,$id_mapa_grupo)); | |
| 335 | + exit; | |
| 336 | + break; | |
| 337 | + case "LISTATEMASMAPA": | |
| 338 | + $m = new Metaestat(); | |
| 339 | + retornaJSON($m->listaTemasMapa($id_mapa_grupo,$id_mapa_tema)); | |
| 340 | + exit; | |
| 341 | + break; | |
| 342 | + //lista os templates que o usuario pode escolher para publicar mapas | |
| 343 | + //a pasta com alista e definida na variavel $metaestatTemplates localizada no ms_configura.php | |
| 344 | + case "LISTATEMPLATESMAPA": | |
| 345 | + if(empty($metaestatTemplates)){ | |
| 346 | + $d = dirname(__FILE__)."/../../ferramentas/metaestat/templates"; | |
| 347 | + } | |
| 348 | + else{ | |
| 349 | + $d = $locaplic.$metaestatTemplates; | |
| 350 | + } | |
| 351 | + $arq = listaArquivos($d); | |
| 352 | + $arq["metaestatTemplates"] = $metaestatTemplates; | |
| 353 | + retornaJSON($arq); | |
| 354 | + exit; | |
| 355 | + break; | |
| 356 | + //lista os logos que o usuario pode escolher para publicar mapas | |
| 357 | + //a pasta com alista e definida na variavel $metaestatTemplates/logos localizada no ms_configura.php | |
| 358 | + case "LISTALOGOSMAPA": | |
| 359 | + if(empty($metaestatTemplates)){ | |
| 360 | + $metaestatTemplates = dirname(__FILE__)."/../../ferramentas/metaestat/templates"; | |
| 361 | + } | |
| 362 | + else{ | |
| 363 | + $metaestatTemplates = $locaplic.$metaestatTemplates; | |
| 364 | + } | |
| 365 | + retornaJSON(listaArquivos($metaestatTemplates."/logos")); | |
| 366 | + exit; | |
| 367 | + break; | |
| 368 | + /* | |
| 369 | + Valor: ALTERARVARIAVEL | |
| 370 | + | |
| 371 | + Altera os dados de uma variavel | |
| 372 | + */ | |
| 373 | + case "ALTERAVARIAVEL": | |
| 374 | + $m = new Metaestat(); | |
| 375 | + if(empty($codigo_variavel)){ | |
| 376 | + //isso ira criar um novo registro | |
| 377 | + $codigo_variavel = $m->alteraVariavel(); | |
| 378 | + if(!empty($nome)){ | |
| 379 | + $m->alteraVariavel($codigo_variavel,$nome,$descricao); | |
| 380 | + } | |
| 381 | + } | |
| 382 | + else{ | |
| 383 | + $codigo_variavel = $m->alteraVariavel($codigo_variavel,$_GET["nome"],$_GET["descricao"]); | |
| 384 | + } | |
| 385 | + retornaJSON($m->listaVariavel($codigo_variavel)); | |
| 386 | + exit; | |
| 387 | + break; | |
| 388 | + /* | |
| 389 | + Valor: ALTERAMEDIDAVARIAVEL | |
| 390 | + | |
| 391 | + Altera os dados de uma medida de uma variavel | |
| 392 | + | |
| 393 | + Retorno: | |
| 394 | + | |
| 395 | + {JSON} | |
| 396 | + */ | |
| 397 | + case "ALTERAMEDIDAVARIAVEL": | |
| 398 | + $filtro = $_GET["filtro"]; | |
| 399 | + $filtro = str_replace("'",'"',$filtro); | |
| 400 | + $m = new Metaestat(); | |
| 401 | + $default = false; | |
| 402 | + //verifica se a criacao da medida esta sendo feita na tabela default | |
| 403 | + if($codigo_tipo_periodo < 5 && $esquemadb == "i3geo_metaestat" && $_GET["colunaidgeo"] == "codigoregiao" && $_GET["tabela"] = "dados_medidas"){ | |
| 404 | + $default = true; | |
| 405 | + } | |
| 406 | + if(empty($id_medida_variavel)){ | |
| 407 | + //isso ira criar um novo registro | |
| 408 | + $id_medida_variavel = $m->alteraMedidaVariavel($codigo_variavel); | |
| 409 | + //o filtro e necessario para permitir a selecao dos registros apenas do que pertence a medida da variavel escolhida | |
| 410 | + //se a tabela nao for a default, o filtro nao se aplica | |
| 411 | + if($default == true && $filtro == ""){ | |
| 412 | + $filtro = " id_medida_variavel = $id_medida_variavel "; | |
| 413 | + } | |
| 414 | + if(!empty($nomemedida)){ | |
| 415 | + $m->alteraMedidaVariavel("",$id_medida_variavel,$codigo_unidade_medida,$codigo_tipo_periodo,$codigo_tipo_regiao,$codigo_estat_conexao,$_GET["esquemadb"],$_GET["tabela"],$_GET["colunavalor"],$_GET["colunaidgeo"],$_GET["colunaidunico"],$filtro,$_GET["nomemedida"]); | |
| 416 | + } | |
| 417 | + } | |
| 418 | + else{ | |
| 419 | + //o filtro e necessario para permitir a selecao dos registros apenas do que pertence a medida da variavel escolhida | |
| 420 | + if($default == true && $filtro == ""){ | |
| 421 | + $filtro = " id_medida_variavel = $id_medida_variavel "; | |
| 422 | + } | |
| 423 | + $m->alteraMedidaVariavel("",$id_medida_variavel,$codigo_unidade_medida,$codigo_tipo_periodo,$codigo_tipo_regiao,$codigo_estat_conexao,$_GET["esquemadb"],$_GET["tabela"],$_GET["colunavalor"],$_GET["colunaidgeo"],$_GET["colunaidunico"],$filtro,$_GET["nomemedida"]); | |
| 424 | + } | |
| 425 | + if(!empty($_GET["colunaAno"]) || !empty($_GET["colunaMes"]) || !empty($_GET["colunaDia"]) || !empty($_GET["colunaHora"])){ | |
| 426 | + $default = true; | |
| 427 | + } | |
| 428 | + //adiciona os parametros de tempo conforme o tipo de periodo escolhido | |
| 429 | + // | |
| 430 | + //se os nomes das colunas com os parametros de tempo forem definidas | |
| 431 | + //os parametros sao criados | |
| 432 | + //isso acontece se a criacao da medida estiver sendo feita em uma tabela que nao e a default | |
| 433 | + // | |
| 434 | + if($default == true){ | |
| 435 | + $m->excluirRegistro("i3geoestat_parametro_medida","id_medida_variavel",$id_medida_variavel); | |
| 436 | + $id_pai = 0; | |
| 437 | + //anual | |
| 438 | + if($codigo_tipo_periodo >= 1){ | |
| 439 | + if(empty($_GET["colunaAno"])){ | |
| 440 | + $_GET["colunaAno"] = "ano"; | |
| 441 | + } | |
| 442 | + $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel,"","","","","",""); | |
| 443 | + $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Ano","",$_GET["colunaAno"],$id_pai,1); | |
| 444 | + $id_pai = $id_parametro_medida; | |
| 445 | + } | |
| 446 | + //mensal | |
| 447 | + if($codigo_tipo_periodo >= 2){ | |
| 448 | + $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel,"","","","","",""); | |
| 449 | + if(empty($_GET["colunaMes"])){ | |
| 450 | + $_GET["colunaMes"] = "mes"; | |
| 451 | + } | |
| 452 | + $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Mes","",$_GET["colunaMes"],$id_pai,2); | |
| 453 | + $id_pai = $id_parametro_medida; | |
| 454 | + } | |
| 455 | + //diario | |
| 456 | + if($codigo_tipo_periodo >= 3){ | |
| 457 | + $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel,"","","","","",""); | |
| 458 | + if(empty($colunaDia)){ | |
| 459 | + $colunaDia = "dia"; | |
| 460 | + } | |
| 461 | + $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Dia","",$_GET["colunaDia"],$id_pai,3); | |
| 462 | + $id_pai = $id_parametro_medida; | |
| 463 | + } | |
| 464 | + //horario | |
| 465 | + if($codigo_tipo_periodo == 4){ | |
| 466 | + $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel,"","","","","",""); | |
| 467 | + if(empty($_GET["colunaHora"])){ | |
| 468 | + $_GET["colunaHora"] = "hora"; | |
| 469 | + } | |
| 470 | + $m->alteraParametroMedida($id_medida_variavel,$id_parametro_medida,"Hora","",$_GET["colunaHora"],$id_pai,4); | |
| 471 | + } | |
| 472 | + } | |
| 473 | + retornaJSON($m->listaMedidaVariavel("",$id_medida_variavel)); | |
| 474 | + exit; | |
| 475 | + break; | |
| 476 | + /* | |
| 477 | + Valor: ALTERAPARAMETROMEDIDA | |
| 478 | + | |
| 479 | + Altera os dados de uma parametro de uma medida | |
| 480 | + | |
| 481 | + Retorno: | |
| 482 | + | |
| 483 | + {JSON} | |
| 484 | + */ | |
| 485 | + case "ALTERAPARAMETROMEDIDA": | |
| 486 | + $m = new Metaestat(); | |
| 487 | + if(empty($id_parametro_medida)){ | |
| 488 | + //isso ira criar um novo registro | |
| 489 | + $id_parametro_medida = $m->alteraParametroMedida($id_medida_variavel); | |
| 490 | + } | |
| 491 | + else{ | |
| 492 | + $m->alteraParametroMedida("",$id_parametro_medida,$_GET["nome"],$_GET["descricao"],$_GET["coluna"],$id_pai,$_GET["tipo"]); | |
| 493 | + } | |
| 494 | + retornaJSON($m->listaParametro($id_medida_variavel,$id_parametro_medida)); | |
| 495 | + exit; | |
| 496 | + break; | |
| 497 | + /* | |
| 498 | + Valor: ALTERACLASSIFICACAOMEDIDA | |
| 499 | + | |
| 500 | + Altera os dados de uma classificacao de uma medida | |
| 501 | + | |
| 502 | + Retorno: | |
| 503 | + | |
| 504 | + {JSON} | |
| 505 | + */ | |
| 506 | + case "ALTERACLASSIFICACAOMEDIDA": | |
| 507 | + $m = new Metaestat(); | |
| 508 | + if(empty($id_classificacao)){ | |
| 509 | + //isso ira criar um novo registro | |
| 510 | + $id_classificacao = $m->alteraClassificacaoMedida($id_medida_variavel); | |
| 511 | + if(!empty($nome)){ | |
| 512 | + $m->alteraClassificacaoMedida($id_classificacao,$id_classificacao,$_GET["nome"],$_GET["observacao"]); | |
| 513 | + } | |
| 514 | + } | |
| 515 | + else{ | |
| 516 | + $m->alteraClassificacaoMedida("",$id_classificacao,$_GET["nome"],$_GET["observacao"]); | |
| 517 | + } | |
| 518 | + retornaJSON($m->listaClassificacaoMedida($id_medida_variavel,$id_classificacao)); | |
| 519 | + exit; | |
| 520 | + break; | |
| 521 | + case "CALCULACLASSIFICACAO": | |
| 522 | + $cores = $_GET["cores"]; | |
| 523 | + $limite = $_GET["limite"]; | |
| 524 | + $numintervalos = $_GET["numintervalos"]; | |
| 525 | + $tipo = $_GET["tipo"]; | |
| 526 | + //as cores vem no formato rgb(0,0,0); | |
| 527 | + if(!empty($cores)){ | |
| 528 | + $cores = str_replace("rgb(","",$cores); | |
| 529 | + $cores = str_replace(")","",$cores); | |
| 530 | + $cores = explode("|",$cores); | |
| 531 | + } | |
| 532 | + if(empty($limite)){ | |
| 533 | + $limite = ""; | |
| 534 | + } | |
| 535 | + | |
| 536 | + if($tipo == "quebrasnaturais"){ | |
| 537 | + $m = new Metaestat(); | |
| 538 | + $dados = $m->dadosMedidaVariavel($id_medida_variavel,"",0,"",$limite,true); | |
| 539 | + $metaVariavel = $m->listaMedidaVariavel("",$id_medida_variavel); | |
| 540 | + $colunavalor = $metaVariavel["colunavalor"]; | |
| 541 | + $valores = array(); | |
| 542 | + | |
| 543 | + foreach($dados as $d){ | |
| 544 | + if($d[$colunavalor]){ | |
| 545 | + $valores[] = $d[$colunavalor]; | |
| 546 | + } | |
| 547 | + } | |
| 548 | + include(dirname(__FILE__)."/../../pacotes/jenks-master/jenks.php"); | |
| 549 | + $intervalos = getJenksClasses($numintervalos, $valores); | |
| 550 | + $m->excluirRegistro("i3geoestat_classes","id_classificacao",$id_classificacao); | |
| 551 | + for ($i=0; $i < $numintervalos; ++$i){ | |
| 552 | + if ($i == $numintervalos - 1){ | |
| 553 | + $expressao = "(([".$colunavalor."]>=".$intervalos[$i]."))"; | |
| 554 | + $titulo = ">= ".$intervalos[$i]; | |
| 555 | + } | |
| 556 | + else{ | |
| 557 | + $expressao = "(([".$colunavalor."]>=".$intervalos[$i].")and([".$colunavalor."]<".$intervalos[$i+1]."))"; | |
| 558 | + $titulo = ">= ".$intervalos[$i]." e < que ".($intervalos[$i+1]); | |
| 559 | + } | |
| 560 | + $id_classe = $m->alteraClasseClassificacao($id_classificacao); | |
| 561 | + if(!empty($cores)){ | |
| 562 | + $cor = explode(",",$cores[$i]); | |
| 563 | + $vermelho = $cor[0]; | |
| 564 | + $verde = $cor[1]; | |
| 565 | + $azul = $cor[2]; | |
| 566 | + } | |
| 567 | + $m->alteraClasseClassificacao("",$id_classe,$titulo,$expressao,$vermelho,$verde,$azul,"","","255","255","255","2"); | |
| 568 | + } | |
| 569 | + retornaJSON("ok"); | |
| 570 | + exit; | |
| 571 | + } | |
| 572 | + if($tipo == "quartil"){ | |
| 573 | + $m = new Metaestat(); | |
| 574 | + $dados = $m->sumarioMedidaVariavel($id_medida_variavel,"","",$limite,true); | |
| 575 | + if($dados == false){ | |
| 576 | + retornaJSON("erro"); | |
| 577 | + exit; | |
| 578 | + } | |
| 579 | + $dados = $dados["quartis"]; | |
| 580 | + $n = count($dados["expressoes"]); | |
| 581 | + $m->excluirRegistro("i3geoestat_classes","id_classificacao",$id_classificacao); | |
| 582 | + for($i=0;$i<$n;++$i){ | |
| 583 | + $id_classe = $m->alteraClasseClassificacao($id_classificacao); | |
| 584 | + $expressao = $dados["expressoes"][$i]; | |
| 585 | + $titulo = $dados["nomes"][$i]; | |
| 586 | + if(!empty($cores)){ | |
| 587 | + $cor = explode(",",$cores[$i]); | |
| 588 | + $vermelho = $cor[0]; | |
| 589 | + $verde = $cor[1]; | |
| 590 | + $azul = $cor[2]; | |
| 591 | + } | |
| 592 | + $m->alteraClasseClassificacao("",$id_classe,$titulo,$expressao,$vermelho,$verde,$azul,"","","255","255","255","2"); | |
| 593 | + } | |
| 594 | + exit; | |
| 595 | + retornaJSON("ok"); | |
| 596 | + exit; | |
| 597 | + } | |
| 598 | + //para efeitos de compatibilidade com o nome de $tipo | |
| 599 | + if(empty($numintervalos) || $tipo == "intiguais5"){ | |
| 600 | + $numintervalos = 5; | |
| 601 | + } | |
| 602 | + if($tipo == "intiguais5" || $tipo == "intiguais"){ | |
| 603 | + $m = new Metaestat(); | |
| 604 | + $dados = $m->sumarioMedidaVariavel($id_medida_variavel,"","",$limite,true); | |
| 605 | + if($dados == false){ | |
| 606 | + retornaJSON("erro"); | |
| 607 | + exit; | |
| 608 | + } | |
| 609 | + $min = $dados["menor"]; | |
| 610 | + $max = $dados["maior"]; | |
| 611 | + $item = $dados["colunavalor"]; | |
| 612 | + $intervalo = ($max - $min) / $numintervalos; | |
| 613 | + //adiciona as classes novas | |
| 614 | + $intatual = $min; | |
| 615 | + $m->excluirRegistro("i3geoestat_classes","id_classificacao",$id_classificacao); | |
| 616 | + for ($i=0; $i < $numintervalos; ++$i){ | |
| 617 | + if ($i == $numintervalos - 1){ | |
| 618 | + $expressao = "(([".$item."]>=".$intatual.")and([".$item."]<=".($intatual+$intervalo)."))"; | |
| 619 | + } | |
| 620 | + else{ | |
| 621 | + $expressao = "(([".$item."]>=".$intatual.")and([".$item."]<".($intatual+$intervalo)."))"; | |
| 622 | + } | |
| 623 | + $titulo = ">= ".$intatual." e < que ".($intatual+$intervalo); | |
| 624 | + $intatual = $intatual + $intervalo; | |
| 625 | + $id_classe = $m->alteraClasseClassificacao($id_classificacao); | |
| 626 | + if(!empty($cores)){ | |
| 627 | + $cor = explode(",",$cores[$i]); | |
| 628 | + $vermelho = $cor[0]; | |
| 629 | + $verde = $cor[1]; | |
| 630 | + $azul = $cor[2]; | |
| 631 | + } | |
| 632 | + $m->alteraClasseClassificacao("",$id_classe,$titulo,$expressao,$vermelho,$verde,$azul,"","","255","255","255","2"); | |
| 633 | + } | |
| 634 | + retornaJSON("ok"); | |
| 635 | + exit; | |
| 636 | + } | |
| 637 | + //o menor e o maior valor sao enviados como parametro ($min e $max) | |
| 638 | + //para efeitos de compatibilidade com o nome de $tipo | |
| 639 | + if(empty($numintervalos) || $tipo == "intiguais5mm"){ | |
| 640 | + $numintervalos = 5; | |
| 641 | + } | |
| 642 | + if($tipo == "intiguais5mm" || $tipo == "intiguaismm"){ | |
| 643 | + $m = new Metaestat(); | |
| 644 | + $metaVariavel = $m->listaMedidaVariavel("",$id_medida_variavel); | |
| 645 | + $item = $metaVariavel["colunavalor"]; | |
| 646 | + $intervalo = ($max - $min) / $numintervalos; | |
| 647 | + //adiciona as classes novas | |
| 648 | + $intatual = $min; | |
| 649 | + $m->excluirRegistro("i3geoestat_classes","id_classificacao",$id_classificacao); | |
| 650 | + for ($i=0; $i < $numintervalos; ++$i){ | |
| 651 | + if ($i == $numintervalos - 1){ | |
| 652 | + $expressao = "(([".$item."]>=".$intatual.")and([".$item."]<=".($intatual+$intervalo)."))"; | |
| 653 | + } | |
| 654 | + else{ | |
| 655 | + $expressao = "(([".$item."]>=".$intatual.")and([".$item."]<".($intatual+$intervalo)."))"; | |
| 656 | + } | |
| 657 | + $titulo = ">= ".$intatual." e < que ".($intatual+$intervalo); | |
| 658 | + $intatual = $intatual + $intervalo; | |
| 659 | + $id_classe = $m->alteraClasseClassificacao($id_classificacao); | |
| 660 | + if(!empty($cores)){ | |
| 661 | + $cor = explode(",",$cores[$i]); | |
| 662 | + $vermelho = $cor[0]; | |
| 663 | + $verde = $cor[1]; | |
| 664 | + $azul = $cor[2]; | |
| 665 | + } | |
| 666 | + $m->alteraClasseClassificacao("",$id_classe,$titulo,$expressao,$vermelho,$verde,$azul,"","","255","255","255","2"); | |
| 667 | + } | |
| 668 | + retornaJSON("ok"); | |
| 669 | + exit; | |
| 670 | + } | |
| 671 | + retornaJSON("ok"); | |
| 672 | + exit; | |
| 673 | + break; | |
| 674 | + case "ALTERAESTILOSCLASSIFICACAO": | |
| 675 | + $tipo = $_GET["tipo"]; | |
| 676 | + $aumentar = $_GET["aumentar"]; | |
| 677 | + if($tipo == "tamanho"){ | |
| 678 | + $m = new Metaestat(); | |
| 679 | + $classes = $m->listaClasseClassificacao($id_classificacao); | |
| 680 | + $nclasses = count($classes); | |
| 681 | + $tamanhoini -= $aumentar; | |
| 682 | + for($i=0;$i<$nclasses;$i++){ | |
| 683 | + $c = $classes[$i]; | |
| 684 | + $m->alteraClasseClassificacao( | |
| 685 | + $id_classificacao, | |
| 686 | + $c["id_classe"], | |
| 687 | + $c["titulo"], | |
| 688 | + $c["expressao"], | |
| 689 | + $c["vermelho"], | |
| 690 | + $c["verde"], | |
| 691 | + $c["azul"], | |
| 692 | + $tamanhoini + $aumentar, | |
| 693 | + $c["simbolo"], | |
| 694 | + $c["overmelho"], | |
| 695 | + $c["overde"], | |
| 696 | + $c["oazul"], | |
| 697 | + $tamanhoini + $aumentar | |
| 698 | + ); | |
| 699 | + $tamanhoini += $aumentar; | |
| 700 | + } | |
| 701 | + retornaJSON("ok"); | |
| 702 | + exit; | |
| 703 | + } | |
| 704 | + retornaJSON("ok"); | |
| 705 | + exit; | |
| 706 | + break; | |
| 707 | + | |
| 708 | + /* | |
| 709 | + Valor: ALTERACLASSECLASSIFICACAO | |
| 710 | + | |
| 711 | + Altera os dados de uma classe de uma classificacao | |
| 712 | + | |
| 713 | + Retorno: | |
| 714 | + | |
| 715 | + {JSON} | |
| 716 | + */ | |
| 717 | + case "ALTERACLASSECLASSIFICACAO": | |
| 718 | + $m = new Metaestat(); | |
| 719 | + if(empty($id_classe)){ | |
| 720 | + //isso ira criar um novo registro | |
| 721 | + $id_classe = $m->alteraClasseClassificacao($id_classificacao); | |
| 722 | + } | |
| 723 | + else{ | |
| 724 | + $titulo = $_GET["titulo"]; | |
| 725 | + $expressao = $_GET["expressao"]; | |
| 726 | + $m->alteraClasseClassificacao("",$id_classe,$titulo,$expressao,$_GET["vermelho"],$_GET["verde"],$_GET["azul"],$_GET["tamanho"],$_GET["simbolo"],$_GET["overmelho"],$_GET["overde"],$_GET["oazul"],$_GET["otamanho"]); | |
| 727 | + } | |
| 728 | + retornaJSON($m->listaClasseClassificacao($id_classificacao,$id_classe)); | |
| 729 | + exit; | |
| 730 | + break; | |
| 731 | + case "ALTERALINKMEDIDA": | |
| 732 | + $m = new Metaestat(); | |
| 733 | + if(empty($id_link)){ | |
| 734 | + //isso ira criar um novo registro | |
| 735 | + $id_link = $m->alteraLinkMedida($id_medida_variavel); | |
| 736 | + } | |
| 737 | + else{ | |
| 738 | + $m->alteraLinkMedida("",$id_link,$_GET["nome"],$_GET["link"]); | |
| 739 | + } | |
| 740 | + retornaJSON($m->listaLinkMedida($id_medida_variavel,$id_link)); | |
| 741 | + exit; | |
| 742 | + break; | |
| 743 | + case "ALTERAFONTEINFO": | |
| 744 | + $m = new Metaestat(); | |
| 745 | + if(empty($id_fonteinfo)){ | |
| 746 | + //isso ira criar um novo registro | |
| 747 | + $id_fonteinfo = $m->alteraFonteinfo(); | |
| 748 | + } | |
| 749 | + else{ | |
| 750 | + $m->alteraFonteinfo($id_fonteinfo,$_GET["titulo"],$_GET["link"]); | |
| 751 | + } | |
| 752 | + retornaJSON($m->listaFonteinfo($id_fonteinfo)); | |
| 753 | + exit; | |
| 754 | + break; | |
| 755 | + case "ADICIONAFONTEINFOMEDIDA": | |
| 756 | + $m = new Metaestat(); | |
| 757 | + //echo $id_medida_variavel;exit; | |
| 758 | + $m->adicinaFonteinfoMedida($id_medida_variavel,$id_fonteinfo); | |
| 759 | + retornaJSON($m->listaFonteInfo($id_fonteinfo)); | |
| 760 | + exit; | |
| 761 | + break; | |
| 762 | + /* | |
| 763 | + Valor: ALTERARUNIDADEMEDIDA | |
| 764 | + | |
| 765 | + Altera a tabela de unidades de medida | |
| 766 | + | |
| 767 | + Retorno: | |
| 768 | + | |
| 769 | + {JSON} | |
| 770 | + */ | |
| 771 | + case "ALTERARUNIDADEMEDIDA": | |
| 772 | + $m = new Metaestat(); | |
| 773 | + if(empty($codigo_unidade_medida)){ | |
| 774 | + $codigo_unidade_medida = $m->alteraUnidadeMedida(); | |
| 775 | + } | |
| 776 | + else{ | |
| 777 | + $codigo_unidade_medida = $m->alteraUnidadeMedida($codigo_unidade_medida,$_GET["nome"],$_GET["sigla"],$_GET["permitesoma"],$_GET["permitemedia"]); | |
| 778 | + } | |
| 779 | + retornaJSON($m->listaUnidadeMedida($codigo_unidade_medida)); | |
| 780 | + exit; | |
| 781 | + break; | |
| 782 | + /* | |
| 783 | + Valor: ALTERARCONEXAO | |
| 784 | + | |
| 785 | + Altera a tabela de conexoes | |
| 786 | + | |
| 787 | + Retorno: | |
| 788 | + | |
| 789 | + {JSON} | |
| 790 | + */ | |
| 791 | + case "ALTERARCONEXAO": | |
| 792 | + $m = new Metaestat(); | |
| 793 | + if(empty($codigo_estat_conexao)){ | |
| 794 | + $codigo_estat_conexao = $m->alteraConexao(); | |
| 795 | + } | |
| 796 | + else{ | |
| 797 | + $codigo_estat_conexao = $m->alteraConexao($codigo_estat_conexao,$_GET["bancodedados"],$_GET["host"],$_GET["porta"],$_GET["usuario"]); | |
| 798 | + } | |
| 799 | + retornaJSON($m->listaConexao($codigo_estat_conexao)); | |
| 800 | + exit; | |
| 801 | + break; | |
| 802 | + /* | |
| 803 | + Valor: ALTERARTIPOREGIAO | |
| 804 | + | |
| 805 | + Altera a tabela de regioes | |
| 806 | + | |
| 807 | + Retorno: | |
| 808 | + | |
| 809 | + {JSON} | |
| 810 | + */ | |
| 811 | + case "ALTERARTIPOREGIAO": | |
| 812 | + $m = new Metaestat(); | |
| 813 | + if(empty($codigo_tipo_regiao)){ | |
| 814 | + $codigo_tipo_regiao = $m->alteraTipoRegiao(); | |
| 815 | + } | |
| 816 | + else{ | |
| 817 | + $codigo_tipo_regiao = $m->alteraTipoRegiao($codigo_tipo_regiao,$_GET["nome_tipo_regiao"],$_GET["descricao_tipo_regiao"],$_GET["esquemadb"],$_GET["tabela"],$_GET["colunageo"],$_GET["colunacentroide"],$_GET["data"],$_GET["identificador"],$_GET["colunanomeregiao"],$_GET["srid"],$codigo_estat_conexao,$_GET["colunasvisiveis"],$_GET["apelidos"]); | |
| 818 | + } | |
| 819 | + retornaJSON($m->listaTipoRegiao($codigo_tipo_regiao)); | |
| 820 | + exit; | |
| 821 | + break; | |
| 822 | + case "ALTERAAGREGAREGIAO": | |
| 823 | + $m = new Metaestat(); | |
| 824 | + if(empty($id_agregaregiao)){ | |
| 825 | + $id_agregaregiao = $m->alteraAgregaRegiao($codigo_tipo_regiao); | |
| 826 | + } | |
| 827 | + else{ | |
| 828 | + $id_agregaregiao = $m->alteraAgregaRegiao("",$id_agregaregiao,$codigo_tipo_regiao_pai,$_GET["colunaligacao_regiaopai"]); | |
| 829 | + $codigo_tipo_regiao = ""; | |
| 830 | + } | |
| 831 | + retornaJSON($m->listaAgregaRegiao($codigo_tipo_regiao,$id_agregaregiao)); | |
| 832 | + exit; | |
| 833 | + break; | |
| 834 | + /* | |
| 835 | + Valor: ALTERARTIPOPERIODO | |
| 836 | + | |
| 837 | + Altera a tabela de tipos de periodo | |
| 838 | + | |
| 839 | + Retorno: | |
| 840 | + | |
| 841 | + {JSON} | |
| 842 | + */ | |
| 843 | + case "ALTERARTIPOPERIODO": | |
| 844 | + $m = new Metaestat(); | |
| 845 | + if(empty($codigo_tipo_periodo)){ | |
| 846 | + $codigo_tipo_periodo = $m->alteraTipoPeriodo(); | |
| 847 | + } | |
| 848 | + else{ | |
| 849 | + //impede a alteracao dos valores reservados | |
| 850 | + if($codigo_tipo_periodo > 4){ | |
| 851 | + $codigo_unidade_medida = $m->alteraTipoPeriodo($codigo_tipo_periodo,$_GET["nome"],$_GET["descricao"]); | |
| 852 | + } | |
| 853 | + } | |
| 854 | + retornaJSON($m->listaTipoPeriodo($codigo_tipo_periodo)); | |
| 855 | + exit; | |
| 856 | + break; | |
| 857 | + /* | |
| 858 | + Valor: ALTERAMAPA | |
| 859 | + | |
| 860 | + Altera a tabela de mapas para publicacao | |
| 861 | + | |
| 862 | + Retorno: | |
| 863 | + | |
| 864 | + {JSON} | |
| 865 | + */ | |
| 866 | + case "ALTERAMAPA": | |
| 867 | + $m = new Metaestat(); | |
| 868 | + if(empty($id_mapa)){ | |
| 869 | + $id_mapa = $m->alteraMapa(); | |
| 870 | + } | |
| 871 | + else{ | |
| 872 | + $id_mapa = $m->alteraMapa($id_mapa,$_GET["titulo"],$_GET["template"],$_GET["logoesquerdo"],$_GET["logodireito"],$_GET["publicado"]); | |
| 873 | + } | |
| 874 | + retornaJSON($m->listaMapas($id_mapa)); | |
| 875 | + exit; | |
| 876 | + break; | |
| 877 | + /* | |
| 878 | + Valor: ALTERAMAPAGRUPO | |
| 879 | + | |
| 880 | + Altera a tabela de grupos para publicacao | |
| 881 | + | |
| 882 | + Retorno: | |
| 883 | + | |
| 884 | + {JSON} | |
| 885 | + */ | |
| 886 | + case "ALTERAMAPAGRUPO": | |
| 887 | + $m = new Metaestat(); | |
| 888 | + if(empty($id_mapa_grupo)){ | |
| 889 | + $id_mapa_grupo = $m->alteraMapaGrupo($id_mapa); | |
| 890 | + } | |
| 891 | + else{ | |
| 892 | + $id_mapa_grupo = $m->alteraMapaGrupo($id_mapa,$id_mapa_grupo,$_GET["titulo"]); | |
| 893 | + } | |
| 894 | + retornaJSON($m->listaGruposMapa($id_mapa,$id_mapa_grupo)); | |
| 895 | + exit; | |
| 896 | + break; | |
| 897 | + case "ALTERAMAPATEMA": | |
| 898 | + $m = new Metaestat(); | |
| 899 | + if(empty($id_mapa_tema)){ | |
| 900 | + $id_mapa_tema = $m->alteraMapaTema($id_mapa_grupo); | |
| 901 | + } | |
| 902 | + else{ | |
| 903 | + $id_mapa_tema = $m->alteraMapaTema($id_mapa_grupo,$id_mapa_tema,$_GET["titulo"],$id_medida_variavel); | |
| 904 | + } | |
| 905 | + retornaJSON($m->listaTemasMapa($id_mapa_grupo,$id_mapa_tema)); | |
| 906 | + exit; | |
| 907 | + break; | |
| 908 | + /* | |
| 909 | + Valor: EXCLUIRMAPA | |
| 910 | + | |
| 911 | + Exclui um mapa do publicador | |
| 912 | + | |
| 913 | + */ | |
| 914 | + case "EXCLUIRMAPA": | |
| 915 | + $tabela = "i3geoestat_mapa"; | |
| 916 | + $id = $id_mapa; | |
| 917 | + $f = verificaFilhos(); | |
| 918 | + if(!$f){ | |
| 919 | + $m = new Metaestat(); | |
| 920 | + retornaJSON($m->excluirRegistro("i3geoestat_mapa","id_mapa",$id)); | |
| 921 | + } | |
| 922 | + else | |
| 923 | + retornaJSON("erro"); | |
| 924 | + exit; | |
| 925 | + break; | |
| 926 | + case "EXCLUIRMAPAGRUPO": | |
| 927 | + $tabela = "i3geoestat_mapa_grupo"; | |
| 928 | + $id = $id_mapa_grupo; | |
| 929 | + $f = verificaFilhos(); | |
| 930 | + if(!$f){ | |
| 931 | + $m = new Metaestat(); | |
| 932 | + retornaJSON($m->excluirRegistro("i3geoestat_mapa_grupo","id_mapa_grupo",$id)); | |
| 933 | + } | |
| 934 | + else | |
| 935 | + retornaJSON("erro"); | |
| 936 | + exit; | |
| 937 | + break; | |
| 938 | + case "EXCLUIRMAPATEMA": | |
| 939 | + $tabela = "i3geoestat_mapa_tema"; | |
| 940 | + $id = $id_mapa_tema; | |
| 941 | + $m = new Metaestat(); | |
| 942 | + retornaJSON($m->excluirRegistro("i3geoestat_mapa_tema","id_mapa_tema",$id)); | |
| 943 | + exit; | |
| 944 | + break; | |
| 945 | + /* | |
| 946 | + Valor: EXCLUIRVARIAVEL | |
| 947 | + | |
| 948 | + Exclui uma variavel | |
| 949 | + | |
| 950 | + Parametros: | |
| 951 | + | |
| 952 | + codigo_variavel | |
| 953 | + | |
| 954 | + Retorno: | |
| 955 | + | |
| 956 | + {JSON} | |
| 957 | + */ | |
| 958 | + case "EXCLUIRVARIAVEL": | |
| 959 | + $tabela = "i3geoestat_variavel"; | |
| 960 | + $id = $codigo_variavel; | |
| 961 | + $f = verificaFilhos(); | |
| 962 | + if(!$f){ | |
| 963 | + $m = new Metaestat(); | |
| 964 | + retornaJSON($m->excluirRegistro("i3geoestat_variavel","codigo_variavel",$id)); | |
| 965 | + } | |
| 966 | + else | |
| 967 | + retornaJSON("erro"); | |
| 968 | + exit; | |
| 969 | + break; | |
| 970 | + /* | |
| 971 | + Valor: EXCLUIRTIPOPERIODO | |
| 972 | + | |
| 973 | + Exclui uma variavel | |
| 974 | + | |
| 975 | + Parametros: | |
| 976 | + | |
| 977 | + codigo_variavel | |
| 978 | + | |
| 979 | + Retorno: | |
| 980 | + | |
| 981 | + {JSON} | |
| 982 | + */ | |
| 983 | + case "EXCLUIRTIPOPERIODO": | |
| 984 | + //impede a alteracao dos valores reservados | |
| 985 | + if($codigo_tipo_periodo > 4){ | |
| 986 | + $tabela = "i3geoestat_tipo_periodo"; | |
| 987 | + $id = $codigo_tipo_periodo; | |
| 988 | + $f = verificaFilhos(); | |
| 989 | + if(!$f){ | |
| 990 | + $m = new Metaestat(); | |
| 991 | + retornaJSON($m->excluirRegistro("i3geoestat_tipo_periodo","codigo_tipo_periodo",$id)); | |
| 992 | + } | |
| 993 | + else{ | |
| 994 | + retornaJSON("erro"); | |
| 995 | + } | |
| 996 | + } | |
| 997 | + else{ | |
| 998 | + retornaJSON("erro"); | |
| 999 | + } | |
| 1000 | + exit; | |
| 1001 | + break; | |
| 1002 | + /* | |
| 1003 | + Valor: EXCLUIRUNIDADEMEDIDA | |
| 1004 | + | |
| 1005 | + Exclui uma unidade de medida"Dados inseridos" | |
| 1006 | + | |
| 1007 | + Retorno: | |
| 1008 | + | |
| 1009 | + {JSON} | |
| 1010 | + */ | |
| 1011 | + case "EXCLUIRUNIDADEMEDIDA": | |
| 1012 | + $tabela = "i3geoestat_unidade_medida"; | |
| 1013 | + $id = $codigo_unidade_medida; | |
| 1014 | + $f = verificaFilhos(); | |
| 1015 | + | |
| 1016 | + if(!$f){ | |
| 1017 | + $m = new Metaestat(); | |
| 1018 | + retornaJSON($m->excluirRegistro("i3geoestat_unidade_medida","codigo_unidade_medida",$id)); | |
| 1019 | + } | |
| 1020 | + else | |
| 1021 | + retornaJSON("erro"); | |
| 1022 | + exit; | |
| 1023 | + break; | |
| 1024 | + case "EXCLUIRFONTEINFO": | |
| 1025 | + $tabela = "i3geoestat_fonteinfo"; | |
| 1026 | + $id = $id_fonteinfo; | |
| 1027 | + $f = verificaFilhos(); | |
| 1028 | + | |
| 1029 | + if(!$f){ | |
| 1030 | + $m = new Metaestat(); | |
| 1031 | + retornaJSON($m->excluirRegistro("i3geoestat_fonteinfo","id_fonteinfo",$id)); | |
| 1032 | + } | |
| 1033 | + else | |
| 1034 | + retornaJSON("erro"); | |
| 1035 | + exit; | |
| 1036 | + break; | |
| 1037 | + case "EXCLUIRFONTEINFOMEDIDA": | |
| 1038 | + $m = new Metaestat(); | |
| 1039 | + retornaJSON($m->excluirFonteinfoMedida($id_medida_variavel,$id_fonteinfo)); | |
| 1040 | + exit; | |
| 1041 | + break; | |
| 1042 | + /* | |
| 1043 | + Valor: EXCLUIRCONEXAO | |
| 1044 | + | |
| 1045 | + Exclui uma conexao | |
| 1046 | + | |
| 1047 | + Retorno: | |
| 1048 | + | |
| 1049 | + {JSON} | |
| 1050 | + */ | |
| 1051 | + case "EXCLUIRCONEXAO": | |
| 1052 | + //impede a alteracao dos valores reservados | |
| 1053 | + if($codigo_estat_conexao > 0){ | |
| 1054 | + $tabela = "i3geoestat_conexao"; | |
| 1055 | + $id = $codigo_estat_conexao; | |
| 1056 | + $f = verificaFilhos(); | |
| 1057 | + if(!$f){ | |
| 1058 | + $m = new Metaestat(); | |
| 1059 | + retornaJSON($m->excluirRegistro("i3geoestat_conexao","codigo_estat_conexao",$id)); | |
| 1060 | + } | |
| 1061 | + else{ | |
| 1062 | + retornaJSON("erro"); | |
| 1063 | + } | |
| 1064 | + } | |
| 1065 | + else{ | |
| 1066 | + retornaJSON("erro"); | |
| 1067 | + } | |
| 1068 | + exit; | |
| 1069 | + break; | |
| 1070 | + /* | |
| 1071 | + Valor: EXCLUIRTIPOREGIAO | |
| 1072 | + | |
| 1073 | + Exclui uma regiao | |
| 1074 | + | |
| 1075 | + Retorno: | |
| 1076 | + | |
| 1077 | + {JSON} | |
| 1078 | + */ | |
| 1079 | + case "EXCLUIRTIPOREGIAO": | |
| 1080 | + $tabela = "i3geoestat_tipo_regiao"; | |
| 1081 | + $id = $codigo_tipo_regiao; | |
| 1082 | + $f = verificaFilhos(); | |
| 1083 | + if(!$f){ | |
| 1084 | + $m = new Metaestat(); | |
| 1085 | + retornaJSON($m->excluirRegistro("i3geoestat_tipo_regiao","codigo_tipo_regiao",$id)); | |
| 1086 | + } | |
| 1087 | + else | |
| 1088 | + retornaJSON("erro"); | |
| 1089 | + exit; | |
| 1090 | + break; | |
| 1091 | + case "EXCLUIRAGREGAREGIAO": | |
| 1092 | + $tabela = "i3geoestat_agregaregiao"; | |
| 1093 | + $id = $id_agregaregiao; | |
| 1094 | + $m = new Metaestat(); | |
| 1095 | + retornaJSON($m->excluirRegistro("i3geoestat_agregaregiao","id_agregaregiao",$id)); | |
| 1096 | + exit; | |
| 1097 | + break; | |
| 1098 | + /* | |
| 1099 | + Valor: EXCLUIRMEDIDAVARIAVEL | |
| 1100 | + | |
| 1101 | + Exclui uma medida da variavel | |
| 1102 | + | |
| 1103 | + Parametros: | |
| 1104 | + | |
| 1105 | + codigo_variavel | |
| 1106 | + | |
| 1107 | + Retorno: | |
| 1108 | + | |
| 1109 | + {JSON} | |
| 1110 | + */ | |
| 1111 | + case "EXCLUIRMEDIDAVARIAVEL": | |
| 1112 | + $tabela = "i3geoestat_medida_variavel"; | |
| 1113 | + $id = $id_medida_variavel; | |
| 1114 | + $f = verificaFilhos(); | |
| 1115 | + if(!$f){ | |
| 1116 | + $m = new Metaestat(); | |
| 1117 | + retornaJSON($m->excluirRegistro("i3geoestat_medida_variavel","id_medida_variavel",$id)); | |
| 1118 | + $m->negativaValoresMedidaVariavel($id); | |
| 1119 | + } | |
| 1120 | + else | |
| 1121 | + retornaJSON("erro"); | |
| 1122 | + exit; | |
| 1123 | + break; | |
| 1124 | + /* | |
| 1125 | + Valor: EXCLUIRPARAMETROMEDIDA | |
| 1126 | + | |
| 1127 | + Exclui uma medida da variavel | |
| 1128 | + | |
| 1129 | + Parametros: | |
| 1130 | + | |
| 1131 | + id_parametro_medida | |
| 1132 | + | |
| 1133 | + Retorno: | |
| 1134 | + | |
| 1135 | + {JSON} | |
| 1136 | + */ | |
| 1137 | + case "EXCLUIRPARAMETROMEDIDA": | |
| 1138 | + $m = new Metaestat(); | |
| 1139 | + retornaJSON($m->excluirRegistro("i3geoestat_parametro_medida","id_parametro_medida",$id_parametro_medida)); | |
| 1140 | + exit; | |
| 1141 | + break; | |
| 1142 | + /* | |
| 1143 | + Valor: EXCLUIRCLASSIFICACAOMEDIDA | |
| 1144 | + | |
| 1145 | + Exclui uma classificacao de uma medida da variavel | |
| 1146 | + | |
| 1147 | + Parametros: | |
| 1148 | + | |
| 1149 | + id_classificacao | |
| 1150 | + | |
| 1151 | + Retorno: | |
| 1152 | + | |
| 1153 | + {JSON} | |
| 1154 | + */ | |
| 1155 | + case "EXCLUIRCLASSIFICACAOMEDIDA": | |
| 1156 | + $tabela = "i3geoestat_classificacao"; | |
| 1157 | + $id = $id_classificacao; | |
| 1158 | + $f = verificaFilhos(); | |
| 1159 | + if(!$f){ | |
| 1160 | + $m = new Metaestat(); | |
| 1161 | + retornaJSON($m->excluirRegistro("i3geoestat_classificacao","id_classificacao",$id)); | |
| 1162 | + } | |
| 1163 | + else | |
| 1164 | + retornaJSON("erro"); | |
| 1165 | + exit; | |
| 1166 | + break; | |
| 1167 | + /* | |
| 1168 | + Valor: EXCLUIRCLASSECLASSIFICACAO | |
| 1169 | + | |
| 1170 | + Exclui uma classe de uma classificacao | |
| 1171 | + | |
| 1172 | + Parametros: | |
| 1173 | + | |
| 1174 | + id_classe | |
| 1175 | + | |
| 1176 | + Retorno: | |
| 1177 | + | |
| 1178 | + {JSON} | |
| 1179 | + */ | |
| 1180 | + case "EXCLUIRCLASSECLASSIFICACAO": | |
| 1181 | + $m = new Metaestat(); | |
| 1182 | + retornaJSON($m->excluirRegistro("i3geoestat_classes","id_classe",$id_classe)); | |
| 1183 | + exit; | |
| 1184 | + break; | |
| 1185 | + case "EXCLUIRLINKMEDIDA": | |
| 1186 | + $m = new Metaestat(); | |
| 1187 | + retornaJSON($m->excluirRegistro("i3geoestat_medida_variavel_link","id_link",$id_link)); | |
| 1188 | + exit; | |
| 1189 | + break; | |
| 1190 | + /* | |
| 1191 | + Valor: LISTADADOSTABELASAUXILIARES | |
| 1192 | + | |
| 1193 | + Lista os valores das tabelas auxiliares | |
| 1194 | + | |
| 1195 | + Retorno: | |
| 1196 | + | |
| 1197 | + {JSON} | |
| 1198 | + */ | |
| 1199 | + case "LISTADADOSTABELASAUXILIARES": | |
| 1200 | + $m = new Metaestat(); | |
| 1201 | + $resultado = array(); | |
| 1202 | + $resultado["tipo_periodo"] = $m->listaTipoPeriodo(); | |
| 1203 | + $resultado["unidade_medida"] = $m->listaUnidadeMedida(); | |
| 1204 | + $resultado["tipo_regiao"] = $m->listaTipoRegiao(); | |
| 1205 | + $resultado["conexao"] = $m->listaConexao(); | |
| 1206 | + $resultado["conexaoregistrada"] = $m->listaConexao("",false,false); | |
| 1207 | + $resultado["fonteinfo"] = $m->listaFonteinfo(); | |
| 1208 | + retornaJSON($resultado); | |
| 1209 | + break; | |
| 1210 | + /* | |
| 1211 | + Valor: SQLMEDIDAVARIAVEL | |
| 1212 | + | |
| 1213 | + Sql para acessar os dados de uma medida de uma variavel | |
| 1214 | + | |
| 1215 | + Retorno: | |
| 1216 | + | |
| 1217 | + {JSON} | |
| 1218 | + */ | |
| 1219 | + case "SQLMEDIDAVARIAVEL": | |
| 1220 | + $m = new Metaestat(); | |
| 1221 | + $dados = $m->sqlMedidaVariavel($id_medida_variavel); | |
| 1222 | + retornaJSON($dados); | |
| 1223 | + exit; | |
| 1224 | + break; | |
| 1225 | + /* | |
| 1226 | + Valor: DADOSMEDIDAVARIAVEL | |
| 1227 | + | |
| 1228 | + Mostra os dados de uma media de uma variavel | |
| 1229 | + | |
| 1230 | + Parametros: | |
| 1231 | + | |
| 1232 | + formato | |
| 1233 | + | |
| 1234 | + filtro | |
| 1235 | + | |
| 1236 | + agruparpor | |
| 1237 | + | |
| 1238 | + todasascolunas - 0 ou 1 | |
| 1239 | + | |
| 1240 | + Retorno: | |
| 1241 | + | |
| 1242 | + {JSON} | |
| 1243 | + */ | |
| 1244 | + case "DADOSMEDIDAVARIAVEL": | |
| 1245 | + $m = new Metaestat(); | |
| 1246 | + $dados = $m->dadosMedidaVariavel($id_medida_variavel,$_GET["filtro"],$_GET["todasascolunas"],$_GET["agruparpor"]); | |
| 1247 | + if($_GET["formato"] == "json"){ | |
| 1248 | + retornaJSON($dados); | |
| 1249 | + } | |
| 1250 | + if($_GET["formato"] == "xml"){ | |
| 1251 | + header("Content-type: application/xml"); | |
| 1252 | + echo($m->formataXML($dados)); | |
| 1253 | + } | |
| 1254 | + if($_GET["formato"] == "csv"){ | |
| 1255 | + require_once(dirname(__FILE__)."/../../pacotes/parsecsv/parsecsv.lib.php"); | |
| 1256 | + $csv = new parseCSV(); | |
| 1257 | + $csv->titles = array_keys($dados[0]); | |
| 1258 | + $csv->output(true, 'mvar'.$id_medida_variavel.'_'.date('dmY').'.csv', $dados); | |
| 1259 | + } | |
| 1260 | + exit; | |
| 1261 | + break; | |
| 1262 | + /* | |
| 1263 | + Valor: MAPFILEMEDIDAVARIAVEL | |
| 1264 | + | |
| 1265 | + Cria o mapfile de uma media de uma variavel | |
| 1266 | + | |
| 1267 | + Parametros: | |
| 1268 | + | |
| 1269 | + formato | |
| 1270 | + | |
| 1271 | + filtro | |
| 1272 | + | |
| 1273 | + agruparpor | |
| 1274 | + | |
| 1275 | + todasascolunas - 0 ou 1 | |
| 1276 | + | |
| 1277 | + Retorno: | |
| 1278 | + | |
| 1279 | + {JSON} | |
| 1280 | + */ | |
| 1281 | + case "MAPFILEMEDIDAVARIAVEL": | |
| 1282 | + //$filtro usa aspas duplas para enviar os parametros | |
| 1283 | + $filtro = str_replace('"',"'",$_GET["filtro"]); | |
| 1284 | + $m = new Metaestat(); | |
| 1285 | + if(!isset($codigo_tipo_regiao)){ | |
| 1286 | + $codigo_tipo_regiao = ""; | |
| 1287 | + } | |
| 1288 | + if(!isset($_GET["opacidade"])){ | |
| 1289 | + $_GET["opacidade"] = ""; | |
| 1290 | + } | |
| 1291 | + if($_GET["cachemapfile"] === "nao"){ | |
| 1292 | + $_GET["cachemapfile"] = false; | |
| 1293 | + } | |
| 1294 | + else{ | |
| 1295 | + $_GET["cachemapfile"] = true; | |
| 1296 | + } | |
| 1297 | + if($_GET["formato"] == "json"){ | |
| 1298 | + retornaJSON($m->mapfileMedidaVariavel($id_medida_variavel,$filtro,$_GET["todasascolunas"],$_GET["tipolayer"],$_GET["titulolayer"],$id_classificacao,$_GET["agruparpor"],$codigo_tipo_regiao,$_GET["opacidade"],false,$_GET["cachemapfile"])); | |
| 1299 | + } | |
| 1300 | + exit; | |
| 1301 | + break; | |
| 1302 | + /* | |
| 1303 | + Valor: MAPFILETIPOREGIAO | |
| 1304 | + | |
| 1305 | + Gera um mapfile de um tipo de regiao | |
| 1306 | + | |
| 1307 | + */ | |
| 1308 | + case "MAPFILETIPOREGIAO": | |
| 1309 | + $m = new Metaestat(); | |
| 1310 | + if(empty($_GET["outlinecolor"])){ | |
| 1311 | + $_GET["outlinecolor"] = "255,0,0"; | |
| 1312 | + } | |
| 1313 | + if(empty($_GET["width"])){ | |
| 1314 | + $_GET["width"] = 1; | |
| 1315 | + } | |
| 1316 | + if(empty($_GET["nomes"])){ | |
| 1317 | + $_GET["nomes"] = "nao"; | |
| 1318 | + } | |
| 1319 | + retornaJSON($m->mapfileTipoRegiao($codigo_tipo_regiao,$_GET["outlinecolor"],$_GET["width"],$_GET["nomes"])); | |
| 1320 | + exit; | |
| 1321 | + break; | |
| 1322 | + /* | |
| 1323 | + Valor: KMLMEDIDAVARIAVEL | |
| 1324 | + | |
| 1325 | + Gera um arquivo kml que pode ser aberto no googleearth | |
| 1326 | + | |
| 1327 | + */ | |
| 1328 | + case "KMLMEDIDAVARIAVEL": | |
| 1329 | + $m = new Metaestat(); | |
| 1330 | + $r = $m->mapfileMedidaVariavel($id_medida_variavel,$_GET["filtro"],$_GET["todasascolunas"],$_GET["tipolayer"],$_GET["titulolayer"],$id_classificacao,$_GET["agruparpor"]); | |
| 1331 | + //cria um mapfile completo, que inclui a camada no mapfile de inicializacao do i3geo | |
| 1332 | + $mapfile = $m->mapfileCompleto($r["mapfile"]); | |
| 1333 | + $formato = $_GET["formato"]; | |
| 1334 | + if($formato == "kml" || $formato == "kmz"){ | |
| 1335 | + //define as variaveis necessarias ao pacote kmlserver | |
| 1336 | + set_time_limit(0); | |
| 1337 | + $_REQUEST["map"] = $mapfile; | |
| 1338 | + $_REQUEST["typename"] = $r["layer"]; | |
| 1339 | + $_REQUEST["request"] = $formato; | |
| 1340 | + //$_REQUEST["service"] = "icon"; | |
| 1341 | + include (dirname(__FILE__)."/../../pacotes/kmlmapserver/classes/kmlserver.class.php"); | |
| 1342 | + $server = new KmlServer(); | |
| 1343 | + }else{//3d com tme | |
| 1344 | + if(!isset($dir_tmp)){ | |
| 1345 | + include(dirname(__FILE__)."/../../ms_configura.php"); | |
| 1346 | + } | |
| 1347 | + $verificaSID = false; | |
| 1348 | + $mv = $m->listaMedidaVariavel("",$id_medida_variavel); | |
| 1349 | + $reg = $m->listaTipoRegiao($mv["codigo_tipo_regiao"]); | |
| 1350 | + $_GET["nomelayer"] = $r["layer"]; | |
| 1351 | + $_GET["colunasvalor"] = $mv["colunavalor"]; | |
| 1352 | + $_GET["colunanomeregiao"] = $reg["colunanomeregiao"]; | |
| 1353 | + $_GET["titulo"] = $r["titulolayer"]; | |
| 1354 | + $_GET["descricao"] = $mv["colunavalor"]; | |
| 1355 | + $_SESSION["map_file"] = $mapfile; | |
| 1356 | + $_SESSION["postgis_mapa"] = ""; | |
| 1357 | + $_SESSION["tmpurl"] = ""; | |
| 1358 | + $_SESSION["mapext"] = ""; | |
| 1359 | + $download = true; | |
| 1360 | + $parametersTME = array( | |
| 1361 | + 'mapType' => 'bar', | |
| 1362 | + 'indicator' => 'valores', | |
| 1363 | + 'year' => "", | |
| 1364 | + 'classification' => 'equal', | |
| 1365 | + 'mapTitle' => $r["titulolayer"], | |
| 1366 | + 'timeType' => "slider", //para mais de um ano, escolha slider ou series | |
| 1367 | + 'dirtmp' => $dir_tmp, | |
| 1368 | + 'barSize'=> 5000 | |
| 1369 | + ); | |
| 1370 | + include (dirname(__FILE__)."/../../pacotes/tme/TME_i3geo.php"); | |
| 1371 | + } | |
| 1372 | + exit; | |
| 1373 | + break; | |
| 1374 | + /* | |
| 1375 | + Valor: SUMARIOMEDIDAVARIAVEL | |
| 1376 | + | |
| 1377 | + Sumario estatistico media de uma variavel | |
| 1378 | + | |
| 1379 | + Parametros: | |
| 1380 | + | |
| 1381 | + formato | |
| 1382 | + | |
| 1383 | + filtro | |
| 1384 | + | |
| 1385 | + Retorno: | |
| 1386 | + | |
| 1387 | + {JSON} | |
| 1388 | + */ | |
| 1389 | + case "SUMARIOMEDIDAVARIAVEL": | |
| 1390 | + $m = new Metaestat(); | |
| 1391 | + $dados = $m->sumarioMedidaVariavel($id_medida_variavel,$_GET["filtro"],$_GET["agruparpor"]); | |
| 1392 | + if($_GET["formato"] == "json"){ | |
| 1393 | + retornaJSON($dados); | |
| 1394 | + } | |
| 1395 | + if($_GET["formato"] == "xml"){ | |
| 1396 | + header("Content-type: application/xml"); | |
| 1397 | + echo($m->formataXML($dados["grupos"])); | |
| 1398 | + } | |
| 1399 | + exit; | |
| 1400 | + break; | |
| 1401 | + /* | |
| 1402 | + Valor: ESQUEMASCONEXAO | |
| 1403 | + | |
| 1404 | + Lista os esquemas de uma conexao | |
| 1405 | + | |
| 1406 | + Parametros: | |
| 1407 | + | |
| 1408 | + formato | |
| 1409 | + | |
| 1410 | + codigo_estat_conexao | |
| 1411 | + | |
| 1412 | + Retorno: | |
| 1413 | + | |
| 1414 | + {JSON} | |
| 1415 | + */ | |
| 1416 | + case "ESQUEMASCONEXAO": | |
| 1417 | + $m = new Metaestat(); | |
| 1418 | + if($_GET["formato"] == "json"){ | |
| 1419 | + retornaJSON($m->esquemasConexao($codigo_estat_conexao)); | |
| 1420 | + } | |
| 1421 | + exit; | |
| 1422 | + break; | |
| 1423 | + /* | |
| 1424 | + Valor: TABELASESQUEMA | |
| 1425 | + | |
| 1426 | + Lista as tabelas de um esquema | |
| 1427 | + | |
| 1428 | + Parametros: | |
| 1429 | + | |
| 1430 | + formato | |
| 1431 | + | |
| 1432 | + codigo_estat_conexao | |
| 1433 | + | |
| 1434 | + nome_esquema | |
| 1435 | + | |
| 1436 | + Retorno: | |
| 1437 | + | |
| 1438 | + {JSON} | |
| 1439 | + */ | |
| 1440 | + case "TABELASESQUEMA": | |
| 1441 | + $m = new Metaestat(); | |
| 1442 | + if(empty($_GET["excluigeom"])){ | |
| 1443 | + $_GET["excluigeom"] = ""; | |
| 1444 | + } | |
| 1445 | + if($_GET["formato"] == "json"){ | |
| 1446 | + retornaJSON($m->tabelasEsquema($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["excluigeom"])); | |
| 1447 | + } | |
| 1448 | + exit; | |
| 1449 | + break; | |
| 1450 | + case "CRIATABELADB": | |
| 1451 | + $m = new Metaestat(); | |
| 1452 | + if($nome_esquema != "i3geo_metaestat"){ | |
| 1453 | + retornaJSON("erro"); | |
| 1454 | + exit; | |
| 1455 | + } | |
| 1456 | + retornaJSON($m->criaTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["comentario"])); | |
| 1457 | + exit; | |
| 1458 | + break; | |
| 1459 | + case "CRIAESQUEMADB": | |
| 1460 | + $m = new Metaestat(); | |
| 1461 | + retornaJSON($m->criaEsquemaDB($codigo_estat_conexao,$_GET["nome_esquema"])); | |
| 1462 | + exit; | |
| 1463 | + break; | |
| 1464 | + case "ALTERANOMETABELADB": | |
| 1465 | + $m = new Metaestat(); | |
| 1466 | + if($_GET["nome_esquema"] != "i3geo_metaestat"){ | |
| 1467 | + retornaJSON("erro"); | |
| 1468 | + exit; | |
| 1469 | + } | |
| 1470 | + retornaJSON($m->alteraNomeTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["novonome_tabela"])); | |
| 1471 | + exit; | |
| 1472 | + break; | |
| 1473 | + case "ALTERANOMEESQUEMADB": | |
| 1474 | + $m = new Metaestat(); | |
| 1475 | + retornaJSON($m->alteraNomeEsquemaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["novonome_esquema"])); | |
| 1476 | + exit; | |
| 1477 | + break; | |
| 1478 | + case "COPIATABELADB": | |
| 1479 | + $m = new Metaestat(); | |
| 1480 | + if($_GET["nome_esquema"] != "i3geo_metaestat"){ | |
| 1481 | + retornaJSON("erro"); | |
| 1482 | + exit; | |
| 1483 | + } | |
| 1484 | + retornaJSON($m->copiaTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["novonome_tabela"])); | |
| 1485 | + exit; | |
| 1486 | + break; | |
| 1487 | + /* | |
| 1488 | + Valor: COLUNASTABELA | |
| 1489 | + | |
| 1490 | + Lista as colunas de uma tabela | |
| 1491 | + | |
| 1492 | + Parametros: | |
| 1493 | + | |
| 1494 | + formato | |
| 1495 | + | |
| 1496 | + codigo_estat_conexao | |
| 1497 | + | |
| 1498 | + nome_esquema | |
| 1499 | + | |
| 1500 | + nome_tabela | |
| 1501 | + | |
| 1502 | + Retorno: | |
| 1503 | + | |
| 1504 | + {JSON} | |
| 1505 | + */ | |
| 1506 | + case "COLUNASTABELA": | |
| 1507 | + $m = new Metaestat(); | |
| 1508 | + if(empty($_GET["tipo"])){ | |
| 1509 | + $_GET["tipo"] = ""; | |
| 1510 | + } | |
| 1511 | + if($_GET["formato"] == "json"){ | |
| 1512 | + retornaJSON($m->colunasTabela($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["tipo"])); | |
| 1513 | + } | |
| 1514 | + exit; | |
| 1515 | + break; | |
| 1516 | + case "INFOTABELA": | |
| 1517 | + $m = new Metaestat(); | |
| 1518 | + $colunas = $m->colunasTabela($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],""); | |
| 1519 | + $comentario = $m->comentarioTabela($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"]); | |
| 1520 | + if($_GET["formato"] == "json"){ | |
| 1521 | + retornaJSON(array( | |
| 1522 | + "colunas"=>$colunas, | |
| 1523 | + "comentario"=>$comentario | |
| 1524 | + )); | |
| 1525 | + } | |
| 1526 | + exit; | |
| 1527 | + case "CRIACOLUNADB": | |
| 1528 | + $m = new Metaestat(); | |
| 1529 | + if($_GET["nome_esquema"] != "i3geo_metaestat"){ | |
| 1530 | + retornaJSON("erro"); | |
| 1531 | + exit; | |
| 1532 | + } | |
| 1533 | + retornaJSON($m->criaColunaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["nova_coluna"],$_GET["tipo"])); | |
| 1534 | + exit; | |
| 1535 | + break; | |
| 1536 | + case "ALTERANOMECOLUNADB": | |
| 1537 | + $m = new Metaestat(); | |
| 1538 | + if($_GET["nome_esquema"] != "i3geo_metaestat"){ | |
| 1539 | + retornaJSON("erro"); | |
| 1540 | + exit; | |
| 1541 | + } | |
| 1542 | + retornaJSON($m->alteraNomeColunaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["nome_coluna"],$_GET["novonome_coluna"])); | |
| 1543 | + exit; | |
| 1544 | + break; | |
| 1545 | + case "OBTEMDADOSTABELADB": | |
| 1546 | + $m = new Metaestat(); | |
| 1547 | + if($_GET["formato"] == "json"){ | |
| 1548 | + retornaJSON($m->obtemDadosTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["geo"],$_GET["nreg"])); | |
| 1549 | + } | |
| 1550 | + if($_GET["formato"] == "csv"){ | |
| 1551 | + $dados = $m->obtemDadosTabelaDB($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"],$_GET["geo"],$_GET["nreg"]); | |
| 1552 | + require_once(dirname(__FILE__)."/../../pacotes/parsecsv/parsecsv.lib.php"); | |
| 1553 | + $csv = new parseCSV(); | |
| 1554 | + //$csv->encoding('UTF-16', 'UTF-8'); | |
| 1555 | + $csv->titles = $dados["nomescolunas"]; | |
| 1556 | + $csv->output(true, 'mvar'.$_GET["nome_tabela"].'_'.date('dmY').'.csv', $dados["linhas"]); | |
| 1557 | + } | |
| 1558 | + exit; | |
| 1559 | + break; | |
| 1560 | + /* | |
| 1561 | + Valor: DESCREVECOLUNASTABELA | |
| 1562 | + | |
| 1563 | + Lista as colunas de uma tabela | |
| 1564 | + | |
| 1565 | + Parametros: | |
| 1566 | + | |
| 1567 | + formato | |
| 1568 | + | |
| 1569 | + codigo_estat_conexao | |
| 1570 | + | |
| 1571 | + nome_esquema | |
| 1572 | + | |
| 1573 | + nome_tabela | |
| 1574 | + | |
| 1575 | + Retorno: | |
| 1576 | + | |
| 1577 | + {JSON} | |
| 1578 | + */ | |
| 1579 | + case "DESCREVECOLUNASTABELA": | |
| 1580 | + $m = new Metaestat(); | |
| 1581 | + if($_GET["formato"] == "json"){ | |
| 1582 | + $c = $m->descreveColunasTabela($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"]); | |
| 1583 | + $s = $m->listaTabelaSerial($codigo_estat_conexao,$_GET["nome_esquema"],$_GET["nome_tabela"]); | |
| 1584 | + for($i=0;$i<count($c);$i++){ | |
| 1585 | + if($c[$i]["field"] == $s){ | |
| 1586 | + $c[$i]["serial"] = true; | |
| 1587 | + } | |
| 1588 | + else{ | |
| 1589 | + $c[$i]["serial"] = false; | |
| 1590 | + } | |
| 1591 | + } | |
| 1592 | + retornaJSON($c); | |
| 1593 | + } | |
| 1594 | + exit; | |
| 1595 | + break; | |
| 1596 | + case "ARVOREVAR": | |
| 1597 | + $m = new Metaestat(); | |
| 1598 | + if(empty($codigo_variavel)){ | |
| 1599 | + $codigo_variavel = ""; | |
| 1600 | + } | |
| 1601 | + $dados = $m->relatorioCompleto($codigo_variavel,$_GET["dadosGerenciais"]); | |
| 1602 | + retornaJSON($dados); | |
| 1603 | + exit; | |
| 1604 | + break; | |
| 1605 | + case "RELATORIOCOMPLETO": | |
| 1606 | + $m = new Metaestat(); | |
| 1607 | + if(empty($codigo_variavel)){ | |
| 1608 | + $codigo_variavel = ""; | |
| 1609 | + } | |
| 1610 | + $dados = $m->relatorioCompleto($codigo_variavel,$_GET["dadosGerenciais"]); | |
| 1611 | + if(empty($_GET["detalhes"])){ | |
| 1612 | + $_GET["detalhes"] = "sim"; | |
| 1613 | + } | |
| 1614 | + $dados = $m->formataRelatorioHtml($dados,$_GET["detalhes"]); | |
| 1615 | + retornaJSON($dados); | |
| 1616 | + exit; | |
| 1617 | + break; | |
| 1618 | + //insere dados com base em um arquivo csv ja existente no servidor | |
| 1619 | + case "INSERIRDADOS": | |
| 1620 | + $m = new Metaestat(); | |
| 1621 | + retornaJSON($m->inserirDados($nomearquivoserv,$id_medida_variavel,$_GET["codigoregiao"],$_GET["valor"],$_GET["tipoinclusao"],$_GET["ano"],$_GET["mes"],$_GET["dia"],$_GET["hora"])); | |
| 1622 | + exit; | |
| 1623 | + break; | |
| 1624 | + //grava ou cria um registro de uma regiao | |
| 1625 | + case "MANTEMDADOSREGIAO": | |
| 1626 | + $m = new Metaestat(); | |
| 1627 | + retornaJSON($m->mantemDadosRegiao($codigo_tipo_regiao,$_GET["identificador"],$_GET["identificadornovo"],$_GET["nome"],$_GET["wkt"],$_GET["tipo"])); | |
| 1628 | + exit; | |
| 1629 | + break; | |
| 1630 | + case "LISTAATRIBUTOSMEDIDAVARIAVELXY": | |
| 1631 | + $m = new Metaestat(); | |
| 1632 | + $regiao = $m->xy2regiao($codigo_tipo_regiao, $_GET["x"], $_GET["y"]); | |
| 1633 | + $identificador_regiao = $regiao["identificador_regiao"]; | |
| 1634 | + $resultado = array(); | |
| 1635 | + if($regiao != ""){ | |
| 1636 | + $dados = $m->listaAtributosMedidaVariavelRegiao($identificador_regiao, $id_medida_variavel); | |
| 1637 | + $resultado = array( | |
| 1638 | + "atributos"=>$dados, | |
| 1639 | + "regiao"=>$regiao | |
| 1640 | + ); | |
| 1641 | + } | |
| 1642 | + retornaJSON($resultado); | |
| 1643 | + exit; | |
| 1644 | + break; | |
| 1645 | + case "LISTATODOSATRIBUTOSMEDIDAVARIAVELXY": | |
| 1646 | + $lista = array(); | |
| 1647 | + $m = new Metaestat(); | |
| 1648 | + $regiao = $m->xy2regiao($codigo_tipo_regiao, $_GET["x"], $_GET["y"]); | |
| 1649 | + $identificador_regiao = $regiao["identificador_regiao"]; | |
| 1650 | + $variaveis = $m->listaVariavel(); | |
| 1651 | + $dadosVariavel = array(); | |
| 1652 | + | |
| 1653 | + foreach($variaveis as $variavel){ | |
| 1654 | + $medidas = $m->listaMedidaVariavel($variavel["codigo_variavel"]); | |
| 1655 | + $valores = array(); | |
| 1656 | + foreach($medidas as $medida){ | |
| 1657 | + $dadosMedida = $m->listaAtributosMedidaVariavelRegiao($identificador_regiao,$medida["id_medida_variavel"]); | |
| 1658 | + if($dadosMedida != ""){ | |
| 1659 | + $valores[] = array( | |
| 1660 | + "medida" => $medida["nomemedida"], | |
| 1661 | + "dados" => $dadosMedida | |
| 1662 | + ); | |
| 1663 | + } | |
| 1664 | + } | |
| 1665 | + if(!empty($valores)){ | |
| 1666 | + $dadosVariavel[] = array( | |
| 1667 | + "variavel" => $variavel["nome"], | |
| 1668 | + "dados" => $valores | |
| 1669 | + ); | |
| 1670 | + } | |
| 1671 | + } | |
| 1672 | + retornaJSON($dadosVariavel); | |
| 1673 | + exit; | |
| 1674 | + break; | |
| 1675 | + case "SALVAATRIBUTOSMEDIDAVARIAVEL": | |
| 1676 | + /* "&codigo_tipo_regiao="+codigo_tipo_regiao+"&identificador_regiao="+identificador_regiao+"&id_medida_variavel="+id_medida_variavel+"&colunas="+colunasT[0]+"&valores="+valoresT.join("|")+"&idsunicos="+idsunicosT[0] | |
| 1677 | + */ | |
| 1678 | + $_GET["valores"] = explode("#",$_GET["valores"]);//array de uma lista de strings com valores separados por ; | |
| 1679 | + $_GET["idsunicos"] = explode("|",$_GET["idsunicos"]);//array | |
| 1680 | + $_GET["colunas"] = explode("|",$_GET["colunas"]);//array | |
| 1681 | + $m = new Metaestat(); | |
| 1682 | + $resultado = $m->salvaAtributosMedidaVariavel($id_medida_variavel,$codigo_tipo_regiao,$_GET["identificador_regiao"],$_GET["idsunicos"],$_GET["colunas"],$_GET["valores"]); | |
| 1683 | + retornaJSON($resultado); | |
| 1684 | + exit; | |
| 1685 | + break; | |
| 1686 | + //utilizado na ferramenta de identificacao | |
| 1687 | + case "SALVAATRIBUTOSTIPOREGIAO": | |
| 1688 | + $m = new Metaestat(); | |
| 1689 | + $resultado = $m->mantemDadosRegiao($codigo_tipo_regiao,$_GET["identificador_regiao"],$_GET["identificador_regiao"],$_GET["valores"],"","alterar",$_GET["colunas"]); | |
| 1690 | + retornaJSON($resultado); | |
| 1691 | + exit; | |
| 1692 | + break; | |
| 1693 | + case "EXCLUIATRIBUTOSMEDIDAVARIAVEL": | |
| 1694 | + $m = new Metaestat(); | |
| 1695 | + $resultado = $m->excluiAtributosMedidaVariavel($id_medida_variavel,$codigo_tipo_regiao,$_GET["identificador_regiao"],$id); | |
| 1696 | + retornaJSON($resultado); | |
| 1697 | + exit; | |
| 1698 | + break; | |
| 1699 | + case "REGIAO2SHP": | |
| 1700 | + $m = new Metaestat(); | |
| 1701 | + $shp = $m->regiao2shp($codigo_tipo_regiao); | |
| 1702 | + include(dirname(__FILE__)."/../../pacotes/kmlmapserver/classes/zip.class.php"); | |
| 1703 | + | |
| 1704 | + $handle = fopen($shp.".shp", "r"); | |
| 1705 | + $contentsshp = fread($handle, filesize($shp.".shp")); | |
| 1706 | + fclose($handle); | |
| 1707 | + | |
| 1708 | + $handle = fopen($shp.".shp", "r"); | |
| 1709 | + $contentsdbf = fread($handle, filesize($shp.".dbf")); | |
| 1710 | + fclose($handle); | |
| 1711 | + | |
| 1712 | + $handle = fopen($shp.".shp", "r"); | |
| 1713 | + $contentsshx = fread($handle, filesize($shp.".shx")); | |
| 1714 | + fclose($handle); | |
| 1715 | + | |
| 1716 | + $ziper = new zipfile(); | |
| 1717 | + | |
| 1718 | + $ziper->addFile($contentsshp, basename($shp).'.shp'); | |
| 1719 | + $ziper->addFile($contentsshx, basename($shp).'.shx'); | |
| 1720 | + $ziper->addFile($contentsdbf, basename($shp).'.dbf'); | |
| 1721 | + $arq = $shp.".zip"; | |
| 1722 | + $ziper->output($arq); | |
| 1723 | + $dirtmp = basename(dirname($arq)); | |
| 1724 | + $d = "/ms_tmp/".basename($arq); | |
| 1725 | + echo "<html><script> window.location.assign('$d'); </script></html>"; | |
| 1726 | + break; | |
| 1727 | +} | |
| 1728 | +?> | ... | ... |
| ... | ... | @@ -0,0 +1,167 @@ |
| 1 | +<?php | |
| 2 | +exit; | |
| 3 | +/* | |
| 4 | + Title: webservices.php | |
| 5 | + | |
| 6 | +Funções utilizadas pelo editor do cadastro de Web Services | |
| 7 | + | |
| 8 | +É utilizado nas funções em AJAX da interface de edição | |
| 9 | + | |
| 10 | +Licenca: | |
| 11 | + | |
| 12 | +GPL2 | |
| 13 | + | |
| 14 | +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 15 | + | |
| 16 | +Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
| 17 | +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
| 18 | + | |
| 19 | +Este programa é software livre; você pode redistribuí-lo | |
| 20 | +e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 21 | +GNU conforme publicada pela Free Software Foundation; | |
| 22 | + | |
| 23 | +Este programa é distribuído na expectativa de que seja útil, | |
| 24 | +porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 25 | +de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 26 | +Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 27 | +Você deve ter recebido uma cópia da Licença Pública Geral do | |
| 28 | + GNU junto com este programa; se não, escreva para a | |
| 29 | +Free Software Foundation, Inc., no endereço | |
| 30 | +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 31 | + | |
| 32 | +Arquivo: | |
| 33 | + | |
| 34 | +i3geo/admin/php/webservices.php | |
| 35 | + | |
| 36 | +Parametros: | |
| 37 | + | |
| 38 | +O parâmetro principal é "funcao", que define qual operação será executada, por exemplo, webservices.php?funcao=pegaws | |
| 39 | + | |
| 40 | +Cada operação possuí seus próprios parâmetros, que devem ser enviados também na requisição da operação. | |
| 41 | + | |
| 42 | +*/ | |
| 43 | +error_reporting(0); | |
| 44 | +// | |
| 45 | +//não sei pq mas ob_start e clean são necessários no Linux para não gerar erro indesejado | |
| 46 | +// | |
| 47 | +include_once(dirname(__FILE__)."/login.php"); | |
| 48 | + | |
| 49 | +$id_ws = $_GET["id_ws"]; | |
| 50 | +$id = $_GET["id"]; | |
| 51 | + | |
| 52 | +testaSafeNumerico(array($id,$id_ws)); | |
| 53 | + | |
| 54 | +$funcoesEdicao = array( | |
| 55 | + "ALTERARWS", | |
| 56 | + "EXCLUIR" | |
| 57 | +); | |
| 58 | +if(in_array(strtoupper($funcao),$funcoesEdicao)){ | |
| 59 | + if(verificaOperacaoSessao("admin/html/webservices") == false){ | |
| 60 | + retornaJSON("Vc nao pode realizar essa operacao.");exit; | |
| 61 | + } | |
| 62 | +} | |
| 63 | +//faz a busca da função que deve ser executada | |
| 64 | +switch (strtoupper($funcao)) | |
| 65 | +{ | |
| 66 | + /* | |
| 67 | + Note: | |
| 68 | + | |
| 69 | + Valores que o parâmetro &funcao pode receber. Os parâmetros devem ser enviados na requisição em AJAX. | |
| 70 | + */ | |
| 71 | + /* | |
| 72 | + Valor: PEGAWS | |
| 73 | + | |
| 74 | + Lista de serviços cadastrados | |
| 75 | + | |
| 76 | + Retorno: | |
| 77 | + | |
| 78 | + {JSON} | |
| 79 | + */ | |
| 80 | + case "PEGAWS": | |
| 81 | + if(isset($tipows) && $tipows != "") { | |
| 82 | + $sql = "SELECT id_ws,nome_ws,tipo_ws from ".$esquemaadmin."i3geoadmin_ws where tipo_ws = '".strtoupper($_GET["tipows"])."' order by tipo_ws,nome_ws "; | |
| 83 | + } | |
| 84 | + else{ | |
| 85 | + $sql = "SELECT id_ws,nome_ws,tipo_ws from ".$esquemaadmin."i3geoadmin_ws order by tipo_ws,nome_ws"; | |
| 86 | + } | |
| 87 | + retornaJSON(pegaDados($sql)); | |
| 88 | + exit; | |
| 89 | + break; | |
| 90 | + /* | |
| 91 | + Valor: PEGADADOS | |
| 92 | + | |
| 93 | + Dados de um servico | |
| 94 | + | |
| 95 | + Parametro: | |
| 96 | + | |
| 97 | + id_ws {string} | |
| 98 | + | |
| 99 | + Retorno: | |
| 100 | + | |
| 101 | + {JSON} | |
| 102 | + */ | |
| 103 | + case "PEGADADOS": | |
| 104 | + retornaJSON(pegaDados("SELECT * from ".$esquemaadmin."i3geoadmin_ws where id_ws='$id_ws'")); | |
| 105 | + exit; | |
| 106 | + break; | |
| 107 | + /* | |
| 108 | + Valor: ALTERARWS | |
| 109 | + | |
| 110 | + Altera um registro | |
| 111 | + | |
| 112 | + Parametros: | |
| 113 | + | |
| 114 | + id_ws | |
| 115 | + | |
| 116 | + desc_ws | |
| 117 | + | |
| 118 | + nome_ws | |
| 119 | + | |
| 120 | + link_ws | |
| 121 | + | |
| 122 | + autor_ws | |
| 123 | + | |
| 124 | + tipo_ws | |
| 125 | + | |
| 126 | + Retorno: | |
| 127 | + | |
| 128 | + {JSON} | |
| 129 | + */ | |
| 130 | + case "ALTERARWS": | |
| 131 | + $novo = alterarWS(); | |
| 132 | + $sql = "SELECT * from ".$esquemaadmin."i3geoadmin_ws WHERE id_ws = '".$novo."'"; | |
| 133 | + retornaJSON(pegaDados($sql)); | |
| 134 | + exit; | |
| 135 | + break; | |
| 136 | + /* | |
| 137 | + Valor: EXCLUIR | |
| 138 | + | |
| 139 | + Exclui um registro | |
| 140 | + | |
| 141 | + Parametro: | |
| 142 | + | |
| 143 | + id {string} | |
| 144 | + | |
| 145 | + Retorno: | |
| 146 | + | |
| 147 | + {JSON} | |
| 148 | + */ | |
| 149 | + case "EXCLUIR": | |
| 150 | + retornaJSON(excluirWS()); | |
| 151 | + exit; | |
| 152 | + break; | |
| 153 | + | |
| 154 | +} | |
| 155 | +/* | |
| 156 | + Altera o registro de um WS | |
| 157 | +*/ | |
| 158 | +function alterarWS(){ | |
| 159 | + return; | |
| 160 | +} | |
| 161 | +function excluirWS(){ | |
| 162 | + return; | |
| 163 | +} | |
| 164 | +function adicionaAcesso($id_ws,$sucesso){ | |
| 165 | + return; | |
| 166 | +} | |
| 167 | +?> | |
| 0 | 168 | \ No newline at end of file | ... | ... |
classesphp/classe_metaestatinfo.php
| ... | ... | @@ -189,7 +189,7 @@ class MetaestatInfo{ |
| 189 | 189 | * Executa um SQL no banco de dados definido em uma conexao cadastrada no sistema de admnistracao |
| 190 | 190 | * @param codigo da conexao |
| 191 | 191 | * @param tring sql |
| 192 | - * @return resultado de execSQL | |
| 192 | + * @return string | |
| 193 | 193 | */ |
| 194 | 194 | function execSQLDB($codigo_estat_conexao,$sql){ |
| 195 | 195 | $buscar = array("drop","update","insert","delete"); |
| ... | ... | @@ -929,7 +929,7 @@ class MetaestatInfo{ |
| 929 | 929 | * Complementa um mapfile resumido inserindo seus layers em um mapfile completo, contendo todos os elementos necessarios para uso |
| 930 | 930 | * Usado na geracao de WMS e outros servicos |
| 931 | 931 | * @param mapfile resumido |
| 932 | - * @return nome do arquivo com o mapfile completo | |
| 932 | + * @return string | |
| 933 | 933 | */ |
| 934 | 934 | function mapfileCompleto($mapfile){ |
| 935 | 935 | $f = $this->base; |
| ... | ... | @@ -983,7 +983,7 @@ class MetaestatInfo{ |
| 983 | 983 | * @param coluna de agrupamento |
| 984 | 984 | * @param limite do numero de registros |
| 985 | 985 | * @param le os dados diretamente da tabela sem nenhum tipo de agrupamento, seja por data ou outro parametro |
| 986 | - * @return execSQL | |
| 986 | + * @return string | |
| 987 | 987 | */ |
| 988 | 988 | function dadosMedidaVariavel($id_medida_variavel,$filtro="",$todasascolunas = 0,$agruparpor = "",$limite="",$direto=false){ |
| 989 | 989 | set_time_limit(0); |
| ... | ... | @@ -1014,7 +1014,7 @@ class MetaestatInfo{ |
| 1014 | 1014 | * Lista as ocorrencias de valores em uma coluna de uma medida de variavel |
| 1015 | 1015 | * @param id da medida de variavel |
| 1016 | 1016 | * @param coluna |
| 1017 | - * @return execSQL | |
| 1017 | + * @return array | |
| 1018 | 1018 | */ |
| 1019 | 1019 | function valorUnicoMedidaVariavel($id_medida_variavel,$coluna){ |
| 1020 | 1020 | $sqlf = $this->sqlMedidaVariavel($id_medida_variavel,0,$coluna); |
| ... | ... | @@ -1651,7 +1651,7 @@ class MetaestatInfo{ |
| 1651 | 1651 | /** |
| 1652 | 1652 | * Lista os esquemas em um banco de dados |
| 1653 | 1653 | * @param codigo da conexao |
| 1654 | - * @return execSQLDB | |
| 1654 | + * @return array | |
| 1655 | 1655 | */ |
| 1656 | 1656 | function esquemasConexao($codigo_estat_conexao){ |
| 1657 | 1657 | return $this->execSQLDB($codigo_estat_conexao,"SELECT oid,nspname as esquema FROM pg_namespace WHERE nspname NOT LIKE 'pg_%' AND nspname NOT LIKE '%_schema%' group by nspname,oid order by nspname"); |
| ... | ... | @@ -1661,7 +1661,7 @@ class MetaestatInfo{ |
| 1661 | 1661 | * @param codigo da conexao |
| 1662 | 1662 | * @param nome do esquema |
| 1663 | 1663 | * @param sim|nao exclui da lista as tabelas que contem geometria |
| 1664 | - * @return execSQLDB | |
| 1664 | + * @return string | |
| 1665 | 1665 | */ |
| 1666 | 1666 | function tabelasEsquema($codigo_estat_conexao,$nome_esquema,$excluigeom=""){ |
| 1667 | 1667 | $sql = "SELECT table_name as tabela FROM information_schema.tables where table_schema = '$nome_esquema' AND table_schema NOT LIKE 'i3geo%' AND table_schema NOT LIKE 'pg_%' AND table_schema NOT LIKE '%_schema%'"; |
| ... | ... | @@ -1677,7 +1677,7 @@ class MetaestatInfo{ |
| 1677 | 1677 | * @param nome da tabela |
| 1678 | 1678 | * @param tipo de coluna (opcional) |
| 1679 | 1679 | * @param tipo de tratamento do parametro tipo, pode ser =|!= |
| 1680 | - * @return execSQLDB | |
| 1680 | + * @return string | |
| 1681 | 1681 | */ |
| 1682 | 1682 | function colunasTabela($codigo_estat_conexao,$nome_esquema,$nome_tabela,$tipo="",$tipotratamento="="){ |
| 1683 | 1683 | $colunas = array(); |
| ... | ... | @@ -1695,7 +1695,7 @@ class MetaestatInfo{ |
| 1695 | 1695 | * @param codigo da conexao |
| 1696 | 1696 | * @param nome do esquema |
| 1697 | 1697 | * @param nome da tabela |
| 1698 | - * @return execSQLDB | |
| 1698 | + * @return string | |
| 1699 | 1699 | */ |
| 1700 | 1700 | function comentarioTabela($codigo_estat_conexao,$nome_esquema,$nome_tabela){ |
| 1701 | 1701 | $colunas = array(); |
| ... | ... | @@ -1720,7 +1720,7 @@ class MetaestatInfo{ |
| 1720 | 1720 | * @param nome do esquema |
| 1721 | 1721 | * @param nome da tabela |
| 1722 | 1722 | * @param nome da coluna (opcional) |
| 1723 | - * @return execSQLDB | |
| 1723 | + * @return string | |
| 1724 | 1724 | */ |
| 1725 | 1725 | function descreveColunasTabela($codigo_estat_conexao,$nome_esquema,$nome_tabela,$nome_coluna=""){ |
| 1726 | 1726 | if($nome_coluna == ""){ |
| ... | ... | @@ -1738,7 +1738,7 @@ class MetaestatInfo{ |
| 1738 | 1738 | * @param nome da tabela |
| 1739 | 1739 | * @param sim|nao inclui o WKT da geometria de colunas geo |
| 1740 | 1740 | * @param (opcional) numero de registros que serao listados |
| 1741 | - * @return execSQLDB | |
| 1741 | + * @return array | |
| 1742 | 1742 | */ |
| 1743 | 1743 | function obtemDadosTabelaDB($codigo_estat_conexao,$nome_esquema,$nome_tabela,$geo="nao",$nreg=""){ |
| 1744 | 1744 | $desccolunas = $this->descreveColunasTabela($codigo_estat_conexao, $nome_esquema, $nome_tabela); |
| ... | ... | @@ -2003,9 +2003,9 @@ class MetaestatInfo{ |
| 2003 | 2003 | return array("dados"=>$r,"aliascolunas"=>$alias,"colunas"=>$colunas,"descricao"=>$descricao); |
| 2004 | 2004 | } |
| 2005 | 2005 | /** |
| 2006 | - * Converte um tipo de regiao em shapefile | |
| 2006 | + * Converte um tipo de regiao em shapefile e retorna o nome do arquivo | |
| 2007 | 2007 | * @param codigo do tipo de regiao |
| 2008 | - * @return nome do arquivo criado | |
| 2008 | + * @return string | |
| 2009 | 2009 | */ |
| 2010 | 2010 | function regiao2shp($codigo_tipo_regiao){ |
| 2011 | 2011 | $regiao = $this->listaTipoRegiao($codigo_tipo_regiao); | ... | ... |
classesphp/metaestat_controle.php
| 1 | 1 | <?php |
| 2 | 2 | // |
| 3 | -//o aplicativo que abre a janela para acesso a lista de variaveis, nao necessita da variavel de sessao | |
| 3 | +// o aplicativo que abre a janela para acesso a lista de variaveis, nao necessita da variavel de sessao | |
| 4 | 4 | // |
| 5 | 5 | include ("sani_request.php"); |
| 6 | -$_pg = array_merge ( $_GET, $_POST ); | |
| 7 | -$funcao = $_pg ["funcao"]; | |
| 8 | -$g_sid = $_pg ["g_sid"]; | |
| 6 | +$_pg = array_merge($_GET, $_POST); | |
| 7 | +$funcao = $_pg["funcao"]; | |
| 8 | +$g_sid = $_pg["g_sid"]; | |
| 9 | 9 | |
| 10 | -if (empty ( $g_sid ) && strtoupper($funcao) != "LISTAVARIAVEL") { | |
| 11 | - exit (); | |
| 10 | +if (empty($g_sid) && strtoupper($funcao) != "LISTAVARIAVEL") { | |
| 11 | + exit(); | |
| 12 | 12 | } |
| 13 | -if(!empty ( $g_sid )){ | |
| 14 | - session_name ( "i3GeoPHP" ); | |
| 15 | - session_id ( $g_sid ); | |
| 16 | - session_start (); | |
| 17 | - $perfil = $_SESSION ["perfil"]; | |
| 18 | - $_pg ["perfil"] = $perfil; | |
| 19 | - $map_file = $_SESSION ["map_file"]; | |
| 20 | - if (! file_exists ( $map_file )) { | |
| 21 | - exit (); | |
| 22 | - } | |
| 13 | +if (! empty($g_sid)) { | |
| 14 | + session_name("i3GeoPHP"); | |
| 15 | + session_id($g_sid); | |
| 16 | + session_start(); | |
| 17 | + $perfil = $_SESSION["perfil"]; | |
| 18 | + $_pg["perfil"] = $perfil; | |
| 19 | + $map_file = $_SESSION["map_file"]; | |
| 20 | + if (! file_exists($map_file)) { | |
| 21 | + exit(); | |
| 22 | + } | |
| 23 | 23 | } |
| 24 | -include (dirname ( __FILE__ ) . "/carrega_ext.php"); | |
| 25 | -if (! function_exists ( "sobeAnno" )) { | |
| 26 | - include (dirname ( __FILE__ ) . "/funcoes_gerais.php"); | |
| 24 | +include (dirname(__FILE__) . "/carrega_ext.php"); | |
| 25 | +if (! function_exists("sobeAnno")) { | |
| 26 | + include (dirname(__FILE__) . "/funcoes_gerais.php"); | |
| 27 | 27 | } |
| 28 | -if (! isset ( $map_file ) && strtoupper($funcao) != "LISTAVARIAVEL") { | |
| 29 | - ilegal (); | |
| 30 | - exit (); | |
| 28 | +if (! isset($map_file) && strtoupper($funcao) != "LISTAVARIAVEL") { | |
| 29 | + ilegal(); | |
| 30 | + exit(); | |
| 31 | 31 | } |
| 32 | -include (dirname ( __FILE__ ) . "/../ms_configura.php"); | |
| 33 | -include (dirname ( __FILE__ ) . "/classe_metaestatinfo.php"); | |
| 32 | +include (dirname(__FILE__) . "/../ms_configura.php"); | |
| 33 | +include (dirname(__FILE__) . "/classe_metaestatinfo.php"); | |
| 34 | 34 | $retorno = ""; |
| 35 | 35 | |
| 36 | -switch (strtoupper ( $funcao )) { | |
| 37 | - case "LAYERS2CSV" : | |
| 38 | - $layers = explode(",",$_pg["layers"]); | |
| 39 | - $map = ms_newMapObj($map_file); | |
| 40 | - break; | |
| 41 | - case "RELATORIOCOMPLETO" : | |
| 42 | - $m = new MetaestatInfo(); | |
| 43 | - if(empty($_pg ["codigo_variavel"])){ | |
| 44 | - $_pg ["codigo_variavel"] = ""; | |
| 45 | - } | |
| 46 | - $dados = $m->relatorioCompleto($_pg ["codigo_variavel"],$_pg ["dadosGerenciais"]); | |
| 47 | - if(empty($_pg["detalhes"])){ | |
| 48 | - $_pg["detalhes"] = "sim"; | |
| 49 | - } | |
| 50 | - $dados = $m->formataRelatorioHtml($dados,$_pg["detalhes"]); | |
| 51 | - retornaJSON($dados); | |
| 52 | - break; | |
| 53 | - case "LISTATIPOREGIAO" : | |
| 54 | - $m = new MetaestatInfo (); | |
| 55 | - $retorno = $m->listaTipoRegiao ( $_pg ["codigo_tipo_regiao"], false ); | |
| 56 | - retornaJSON ( $retorno ); | |
| 57 | - exit (); | |
| 58 | - break; | |
| 59 | - case "LISTAVARIAVEL" : | |
| 60 | - $m = new MetaestatInfo (); | |
| 61 | - if (empty ( $_pg ["filtro_esquema"] )) { | |
| 62 | - $_pg ["filtro_esquema"] = ""; | |
| 63 | - } | |
| 64 | - retornaJSON ( $m->listaVariavel ( $_pg ["codigo_variavel"], $_pg ["filtro_esquema"] ) ); | |
| 65 | - exit (); | |
| 66 | - break; | |
| 67 | - case "LISTAMEDIDAVARIAVEL" : | |
| 68 | - $m = new MetaestatInfo (); | |
| 69 | - retornaJSON ( $m->listaMedidaVariavel ( $_pg ["codigo_variavel"], $_pg ["id_medida_variavel"] ) ); | |
| 70 | - exit (); | |
| 71 | - break; | |
| 72 | - case "LISTAPARAMETRO" : | |
| 73 | - $m = new MetaestatInfo (); | |
| 74 | - retornaJSON ( $m->listaParametro ( $_pg ["id_medida_variavel"], $_pg ["id_parametro_medida"] ) ); | |
| 75 | - exit (); | |
| 76 | - break; | |
| 77 | - case "LISTAVALORESPARAMETRO" : | |
| 78 | - $m = new MetaestatInfo (); | |
| 79 | - retornaJSON ( $m->listaValoresParametro ( $_pg ["id_parametro_medida"] ) ); | |
| 80 | - exit (); | |
| 81 | - break; | |
| 82 | - case "LISTAUNIDADEMEDIDA" : | |
| 83 | - $m = new MetaestatInfo (); | |
| 84 | - retornaJSON ( $m->listaUnidadeMedida ( $_pg ["codigo_unidade_medida"] ) ); | |
| 85 | - exit (); | |
| 86 | - break; | |
| 87 | - case "LISTAFONTEINFO" : | |
| 88 | - $m = new MetaestatInfo (); | |
| 89 | - retornaJSON ( $m->listaFonteinfo ( $_pg ["id_fonteinfo"] ) ); | |
| 90 | - exit (); | |
| 91 | - break; | |
| 92 | - case "LISTAFONTEINFOMEDIDA" : | |
| 93 | - $m = new MetaestatInfo (); | |
| 94 | - retornaJSON ( $m->listaFonteinfoMedida ( $_pg ["id_medida_variavel"] ) ); | |
| 95 | - exit (); | |
| 96 | - break; | |
| 97 | - case "LISTATIPOPERIODO" : | |
| 98 | - $m = new MetaestatInfo (); | |
| 99 | - retornaJSON ( $m->listaTipoPeriodo ( $_pg ["codigo_tipo_periodo"] ) ); | |
| 100 | - exit (); | |
| 101 | - break; | |
| 102 | - case "LISTATIPOREGIAO" : | |
| 103 | - $m = new MetaestatInfo (); | |
| 104 | - retornaJSON ( $m->listaTipoRegiao ( $_pg ["codigo_tipo_regiao"] ) ); | |
| 105 | - exit (); | |
| 106 | - break; | |
| 107 | - case "LISTAHIERARQUIAREGIOES" : | |
| 108 | - $m = new MetaestatInfo (); | |
| 109 | - $regioes = $m->listaHierarquiaRegioes ( $_pg ["codigo_tipo_regiao"] ); | |
| 110 | - $valores = ""; | |
| 111 | - // se achou apenas uma regiao, pega os valores | |
| 112 | - if (count ( $regioes ) < 2 && $_pg ["codigo_tipo_regiao"] != "") { | |
| 113 | - $valores = $m->listaDadosRegiao ( $_pg ["codigo_tipo_regiao"], $_pg ["codigoregiaopai"], $_pg ["valorregiaopai"] ); | |
| 114 | - } | |
| 115 | - retornaJSON ( array ( | |
| 116 | - "regiaopai" => $_pg ["codigo_tipo_regiao"], | |
| 117 | - "regioes" => $regioes, | |
| 118 | - "valores" => $valores | |
| 119 | - ) ); | |
| 120 | - exit (); | |
| 121 | - break; | |
| 122 | - case "LISTAREGIOESMEDIDA" : | |
| 123 | - $m = new MetaestatInfo (); | |
| 124 | - retornaJSON ( $m->listaRegioesMedida ( $_pg ["id_medida_variavel"] ) ); | |
| 125 | - exit (); | |
| 126 | - break; | |
| 127 | - case "LISTAAGREGAREGIAO" : | |
| 128 | - $m = new MetaestatInfo (); | |
| 129 | - if (empty ( $_pg ["codigo_tipo_regiao"] )) { | |
| 130 | - $_pg ["codigo_tipo_regiao"] = ""; | |
| 131 | - } | |
| 132 | - retornaJSON ( $m->listaAgregaRegiao ( $_pg ["codigo_tipo_regiao"], $_pg ["id_agregaregiao"] ) ); | |
| 133 | - exit (); | |
| 134 | - case "LISTAMAPAS" : | |
| 135 | - $m = new MetaestatInfo (); | |
| 136 | - if (empty ( $_pg ["id_mapa"] )) { | |
| 137 | - $_pg ["id_mapa"] = ""; | |
| 138 | - } | |
| 139 | - retornaJSON ( $m->listaMapas ( $_pg ["id_mapa"] ) ); | |
| 140 | - exit (); | |
| 141 | - break; | |
| 142 | - case "LISTAGRUPOSMAPA" : | |
| 143 | - $m = new MetaestatInfo (); | |
| 144 | - retornaJSON ( $m->listaGruposMapa ( $_pg ["id_mapa"], $_pg ["id_mapa_grupo"] ) ); | |
| 145 | - exit (); | |
| 146 | - break; | |
| 147 | - case "LISTATEMASMAPA" : | |
| 148 | - $m = new MetaestatInfo (); | |
| 149 | - retornaJSON ( $m->listaTemasMapa ( $_pg ["id_mapa_grupo"], $_pg ["id_mapa_tema"] ) ); | |
| 150 | - exit (); | |
| 151 | - break; | |
| 152 | - // lista os templates que o usuario pode escolher para publicar mapas | |
| 153 | - // a pasta com alista e definida na variavel $metaestatTemplates localizada no ms_configura.php | |
| 154 | - case "LISTATEMPLATESMAPA" : | |
| 155 | - if (empty ( $metaestatTemplates )) { | |
| 156 | - $d = dirname ( __FILE__ ) . "/../../ferramentas/metaestat/templates"; | |
| 157 | - } else { | |
| 158 | - $d = $locaplic . $metaestatTemplates; | |
| 159 | - } | |
| 160 | - $arq = listaArquivos ( $d ); | |
| 161 | - $arq ["metaestatTemplates"] = $metaestatTemplates; | |
| 162 | - retornaJSON ( $arq ); | |
| 163 | - exit (); | |
| 164 | - break; | |
| 165 | - // lista os logos que o usuario pode escolher para publicar mapas | |
| 166 | - // a pasta com alista e definida na variavel $metaestatTemplates/logos localizada no ms_configura.php | |
| 167 | - case "LISTALOGOSMAPA" : | |
| 168 | - if (empty ( $metaestatTemplates )) { | |
| 169 | - $metaestatTemplates = dirname ( __FILE__ ) . "/../../ferramentas/metaestat/templates"; | |
| 170 | - } else { | |
| 171 | - $metaestatTemplates = $locaplic . $metaestatTemplates; | |
| 172 | - } | |
| 173 | - retornaJSON ( listaArquivos ( $metaestatTemplates . "/logos" ) ); | |
| 174 | - exit (); | |
| 175 | - break; | |
| 176 | - case "LISTACLASSIFICACAOMEDIDA" : | |
| 177 | - $m = new MetaestatInfo (); | |
| 178 | - $lista = $m->listaClassificacaoMedida ( $_pg ["id_medida_variavel"], $_pg ["id_classificacao"] ); | |
| 179 | - if(count($lista) == 0){ | |
| 180 | - $lista = array(array("id_classificacao"=>"","nome"=>"default")); | |
| 181 | - } | |
| 182 | - retornaJSON ( $lista ); | |
| 183 | - exit (); | |
| 184 | - break; | |
| 185 | - case "MAPFILEMEDIDAVARIAVEL" : | |
| 186 | - // $filtro usa aspas duplas para enviar os parametros | |
| 187 | - $_pg["filtro"] = str_replace ( '"', "'", $_pg ["filtro"] ); | |
| 188 | - $m = new MetaestatInfo (); | |
| 189 | - if (! isset ( $_pg["codigo_tipo_regiao"] )) { | |
| 190 | - $_pg["codigo_tipo_regiao"] = ""; | |
| 191 | - } | |
| 192 | - if (! isset ( $_pg["opacidade"] )) { | |
| 193 | - $_pg["opacidade"] = ""; | |
| 194 | - } | |
| 195 | - if ($_pg["cachemapfile"] === "nao") { | |
| 196 | - $_pg["cachemapfile"] = false; | |
| 197 | - } else { | |
| 198 | - $_pg["cachemapfile"] = true; | |
| 199 | - } | |
| 200 | - if ($_pg["formato"] == "json") { | |
| 201 | - retornaJSON ( $m->mapfileMedidaVariavel ( $_pg["id_medida_variavel"], $_pg["filtro"], $_GET ["todasascolunas"], $_GET ["tipolayer"], $_GET ["titulolayer"], $_pg["id_classificacao"], $_GET ["agruparpor"], $_pg["codigo_tipo_regiao"], $_GET ["opacidade"], false, $_GET ["cachemapfile"] ) ); | |
| 202 | - } | |
| 203 | - exit (); | |
| 204 | - break; | |
| 36 | +switch (strtoupper($funcao)) { | |
| 37 | + case "LAYERS2CSV": | |
| 38 | + $layers = explode(",", $_pg["layers"]); | |
| 39 | + $map = ms_newMapObj($map_file); | |
| 40 | + break; | |
| 41 | + case "RELATORIOCOMPLETO": | |
| 42 | + $m = new MetaestatInfo(); | |
| 43 | + if (empty($_pg["codigo_variavel"])) { | |
| 44 | + $_pg["codigo_variavel"] = ""; | |
| 45 | + } | |
| 46 | + $dados = $m->relatorioCompleto($_pg["codigo_variavel"], $_pg["dadosGerenciais"]); | |
| 47 | + if (empty($_pg["detalhes"])) { | |
| 48 | + $_pg["detalhes"] = "sim"; | |
| 49 | + } | |
| 50 | + $dados = $m->formataRelatorioHtml($dados, $_pg["detalhes"]); | |
| 51 | + retornaJSON($dados); | |
| 52 | + break; | |
| 53 | + case "LISTATIPOREGIAO": | |
| 54 | + $m = new MetaestatInfo(); | |
| 55 | + $retorno = $m->listaTipoRegiao($_pg["codigo_tipo_regiao"], false); | |
| 56 | + retornaJSON($retorno); | |
| 57 | + exit(); | |
| 58 | + break; | |
| 59 | + case "LISTAVARIAVEL": | |
| 60 | + $m = new MetaestatInfo(); | |
| 61 | + if (empty($_pg["filtro_esquema"])) { | |
| 62 | + $_pg["filtro_esquema"] = ""; | |
| 63 | + } | |
| 64 | + retornaJSON($m->listaVariavel($_pg["codigo_variavel"], $_pg["filtro_esquema"])); | |
| 65 | + exit(); | |
| 66 | + break; | |
| 67 | + case "LISTAMEDIDAVARIAVEL": | |
| 68 | + $m = new MetaestatInfo(); | |
| 69 | + retornaJSON($m->listaMedidaVariavel($_pg["codigo_variavel"], $_pg["id_medida_variavel"])); | |
| 70 | + exit(); | |
| 71 | + break; | |
| 72 | + case "LISTAPARAMETRO": | |
| 73 | + $m = new MetaestatInfo(); | |
| 74 | + retornaJSON($m->listaParametro($_pg["id_medida_variavel"], $_pg["id_parametro_medida"])); | |
| 75 | + exit(); | |
| 76 | + break; | |
| 77 | + case "LISTAVALORESPARAMETRO": | |
| 78 | + $m = new MetaestatInfo(); | |
| 79 | + retornaJSON($m->listaValoresParametro($_pg["id_parametro_medida"])); | |
| 80 | + exit(); | |
| 81 | + break; | |
| 82 | + case "LISTAUNIDADEMEDIDA": | |
| 83 | + $m = new MetaestatInfo(); | |
| 84 | + retornaJSON($m->listaUnidadeMedida($_pg["codigo_unidade_medida"])); | |
| 85 | + exit(); | |
| 86 | + break; | |
| 87 | + case "LISTAFONTEINFO": | |
| 88 | + $m = new MetaestatInfo(); | |
| 89 | + retornaJSON($m->listaFonteinfo($_pg["id_fonteinfo"])); | |
| 90 | + exit(); | |
| 91 | + break; | |
| 92 | + case "LISTAFONTEINFOMEDIDA": | |
| 93 | + $m = new MetaestatInfo(); | |
| 94 | + retornaJSON($m->listaFonteinfoMedida($_pg["id_medida_variavel"])); | |
| 95 | + exit(); | |
| 96 | + break; | |
| 97 | + case "LISTATIPOPERIODO": | |
| 98 | + $m = new MetaestatInfo(); | |
| 99 | + retornaJSON($m->listaTipoPeriodo($_pg["codigo_tipo_periodo"])); | |
| 100 | + exit(); | |
| 101 | + break; | |
| 102 | + case "LISTATIPOREGIAO": | |
| 103 | + $m = new MetaestatInfo(); | |
| 104 | + retornaJSON($m->listaTipoRegiao($_pg["codigo_tipo_regiao"])); | |
| 105 | + exit(); | |
| 106 | + break; | |
| 107 | + case "LISTAHIERARQUIAREGIOES": | |
| 108 | + $m = new MetaestatInfo(); | |
| 109 | + $regioes = $m->listaHierarquiaRegioes($_pg["codigo_tipo_regiao"]); | |
| 110 | + $valores = ""; | |
| 111 | + // se achou apenas uma regiao, pega os valores | |
| 112 | + if (count($regioes) < 2 && $_pg["codigo_tipo_regiao"] != "") { | |
| 113 | + $valores = $m->listaDadosRegiao($_pg["codigo_tipo_regiao"], $_pg["codigoregiaopai"], $_pg["valorregiaopai"]); | |
| 114 | + } | |
| 115 | + retornaJSON(array( | |
| 116 | + "regiaopai" => $_pg["codigo_tipo_regiao"], | |
| 117 | + "regioes" => $regioes, | |
| 118 | + "valores" => $valores | |
| 119 | + )); | |
| 120 | + exit(); | |
| 121 | + break; | |
| 122 | + case "LISTAREGIOESMEDIDA": | |
| 123 | + $m = new MetaestatInfo(); | |
| 124 | + retornaJSON($m->listaRegioesMedida($_pg["id_medida_variavel"])); | |
| 125 | + exit(); | |
| 126 | + break; | |
| 127 | + case "LISTAAGREGAREGIAO": | |
| 128 | + $m = new MetaestatInfo(); | |
| 129 | + if (empty($_pg["codigo_tipo_regiao"])) { | |
| 130 | + $_pg["codigo_tipo_regiao"] = ""; | |
| 131 | + } | |
| 132 | + retornaJSON($m->listaAgregaRegiao($_pg["codigo_tipo_regiao"], $_pg["id_agregaregiao"])); | |
| 133 | + exit(); | |
| 134 | + case "LISTAMAPAS": | |
| 135 | + $m = new MetaestatInfo(); | |
| 136 | + if (empty($_pg["id_mapa"])) { | |
| 137 | + $_pg["id_mapa"] = ""; | |
| 138 | + } | |
| 139 | + retornaJSON($m->listaMapas($_pg["id_mapa"])); | |
| 140 | + exit(); | |
| 141 | + break; | |
| 142 | + case "LISTAGRUPOSMAPA": | |
| 143 | + $m = new MetaestatInfo(); | |
| 144 | + retornaJSON($m->listaGruposMapa($_pg["id_mapa"], $_pg["id_mapa_grupo"])); | |
| 145 | + exit(); | |
| 146 | + break; | |
| 147 | + case "LISTATEMASMAPA": | |
| 148 | + $m = new MetaestatInfo(); | |
| 149 | + retornaJSON($m->listaTemasMapa($_pg["id_mapa_grupo"], $_pg["id_mapa_tema"])); | |
| 150 | + exit(); | |
| 151 | + break; | |
| 152 | + // lista os templates que o usuario pode escolher para publicar mapas | |
| 153 | + // a pasta com alista e definida na variavel $metaestatTemplates localizada no ms_configura.php | |
| 154 | + case "LISTATEMPLATESMAPA": | |
| 155 | + if (empty($metaestatTemplates)) { | |
| 156 | + $d = dirname(__FILE__) . "/../../ferramentas/metaestat/templates"; | |
| 157 | + } else { | |
| 158 | + $d = $locaplic . $metaestatTemplates; | |
| 159 | + } | |
| 160 | + $arq = listaArquivos($d); | |
| 161 | + $arq["metaestatTemplates"] = $metaestatTemplates; | |
| 162 | + retornaJSON($arq); | |
| 163 | + exit(); | |
| 164 | + break; | |
| 165 | + // lista os logos que o usuario pode escolher para publicar mapas | |
| 166 | + // a pasta com alista e definida na variavel $metaestatTemplates/logos localizada no ms_configura.php | |
| 167 | + case "LISTALOGOSMAPA": | |
| 168 | + if (empty($metaestatTemplates)) { | |
| 169 | + $metaestatTemplates = dirname(__FILE__) . "/../../ferramentas/metaestat/templates"; | |
| 170 | + } else { | |
| 171 | + $metaestatTemplates = $locaplic . $metaestatTemplates; | |
| 172 | + } | |
| 173 | + retornaJSON(listaArquivos($metaestatTemplates . "/logos")); | |
| 174 | + exit(); | |
| 175 | + break; | |
| 176 | + case "LISTACLASSIFICACAOMEDIDA": | |
| 177 | + $m = new MetaestatInfo(); | |
| 178 | + $lista = $m->listaClassificacaoMedida($_pg["id_medida_variavel"], $_pg["id_classificacao"]); | |
| 179 | + if (count($lista) == 0) { | |
| 180 | + $lista = array( | |
| 181 | + array( | |
| 182 | + "id_classificacao" => "", | |
| 183 | + "nome" => "default" | |
| 184 | + ) | |
| 185 | + ); | |
| 186 | + } | |
| 187 | + retornaJSON($lista); | |
| 188 | + exit(); | |
| 189 | + break; | |
| 190 | + case "MAPFILEMEDIDAVARIAVEL": | |
| 191 | + // $filtro usa aspas duplas para enviar os parametros | |
| 192 | + $_pg["filtro"] = str_replace('"', "'", $_pg["filtro"]); | |
| 193 | + $m = new MetaestatInfo(); | |
| 194 | + if (! isset($_pg["codigo_tipo_regiao"])) { | |
| 195 | + $_pg["codigo_tipo_regiao"] = ""; | |
| 196 | + } | |
| 197 | + if (! isset($_pg["opacidade"])) { | |
| 198 | + $_pg["opacidade"] = ""; | |
| 199 | + } | |
| 200 | + if ($_pg["cachemapfile"] === "nao") { | |
| 201 | + $_pg["cachemapfile"] = false; | |
| 202 | + } else { | |
| 203 | + $_pg["cachemapfile"] = true; | |
| 204 | + } | |
| 205 | + if ($_pg["formato"] == "json") { | |
| 206 | + retornaJSON($m->mapfileMedidaVariavel($_pg["id_medida_variavel"], $_pg["filtro"], $_GET["todasascolunas"], $_GET["tipolayer"], $_GET["titulolayer"], $_pg["id_classificacao"], $_GET["agruparpor"], $_pg["codigo_tipo_regiao"], $_GET["opacidade"], false, $_GET["cachemapfile"])); | |
| 207 | + } | |
| 208 | + exit(); | |
| 209 | + break; | |
| 210 | + case "LISTATODOSATRIBUTOSMEDIDAVARIAVELXY": | |
| 211 | + $lista = array(); | |
| 212 | + $m = new MetaestatInfo(); | |
| 213 | + $regiao = $m->xy2regiao($codigo_tipo_regiao, $_pg["x"], $_pg["y"]); | |
| 214 | + $identificador_regiao = $regiao["identificador_regiao"]; | |
| 215 | + $variaveis = $m->listaVariavel(); | |
| 216 | + $dadosVariavel = array(); | |
| 217 | + | |
| 218 | + foreach ($variaveis as $variavel) { | |
| 219 | + $medidas = $m->listaMedidaVariavel($variavel["codigo_variavel"]); | |
| 220 | + $valores = array(); | |
| 221 | + foreach ($medidas as $medida) { | |
| 222 | + $dadosMedida = $m->listaAtributosMedidaVariavelRegiao($identificador_regiao, $medida["id_medida_variavel"]); | |
| 223 | + if ($dadosMedida != "") { | |
| 224 | + $valores[] = array( | |
| 225 | + "medida" => $medida["nomemedida"], | |
| 226 | + "dados" => $dadosMedida | |
| 227 | + ); | |
| 228 | + } | |
| 229 | + } | |
| 230 | + if (! empty($valores)) { | |
| 231 | + $dadosVariavel[] = array( | |
| 232 | + "variavel" => $variavel["nome"], | |
| 233 | + "dados" => $valores | |
| 234 | + ); | |
| 235 | + } | |
| 236 | + } | |
| 237 | + retornaJSON($dadosVariavel); | |
| 238 | + exit(); | |
| 239 | + break; | |
| 240 | + case "LISTACONEXAO": | |
| 241 | + $m = new MetaestatInfo(); | |
| 242 | + retornaJSON($m->listaConexao($_pg["codigo_estat_conexao"])); | |
| 243 | + exit(); | |
| 244 | + break; | |
| 245 | + case "ESQUEMASCONEXAO": | |
| 246 | + $m = new MetaestatInfo(); | |
| 247 | + if ($_pg["formato"] == "json") { | |
| 248 | + retornaJSON($m->esquemasConexao($_pg["codigo_estat_conexao"])); | |
| 249 | + } | |
| 250 | + exit(); | |
| 251 | + break; | |
| 252 | + case "TABELASESQUEMA": | |
| 253 | + $m = new MetaestatInfo(); | |
| 254 | + if (empty($_pg["excluigeom"])) { | |
| 255 | + $_pg["excluigeom"] = ""; | |
| 256 | + } | |
| 257 | + if ($_pg["formato"] == "json") { | |
| 258 | + retornaJSON($m->tabelasEsquema($_pg["codigo_estat_conexao"], $_pg["nome_esquema"], $_pg["excluigeom"])); | |
| 259 | + } | |
| 260 | + exit(); | |
| 261 | + break; | |
| 262 | + case "DESCREVECOLUNASTABELA": | |
| 263 | + $m = new MetaestatInfo(); | |
| 264 | + if ($_pg["formato"] == "json") { | |
| 265 | + $c = $m->descreveColunasTabela($codigo_estat_conexao, $_pg["nome_esquema"], $_pg["nome_tabela"]); | |
| 266 | + $s = $m->listaTabelaSerial($codigo_estat_conexao, $_pg["nome_esquema"], $_pg["nome_tabela"]); | |
| 267 | + for ($i = 0; $i < count($c); $i ++) { | |
| 268 | + if ($c[$i]["field"] == $s) { | |
| 269 | + $c[$i]["serial"] = true; | |
| 270 | + } else { | |
| 271 | + $c[$i]["serial"] = false; | |
| 272 | + } | |
| 273 | + } | |
| 274 | + retornaJSON($c); | |
| 275 | + } | |
| 276 | + exit(); | |
| 277 | + break; | |
| 278 | + case "DADOSMEDIDAVARIAVEL": | |
| 279 | + $m = new MetaestatInfo(); | |
| 280 | + $dados = $m->dadosMedidaVariavel($id_medida_variavel, $_pg["filtro"], $_pg["todasascolunas"], $_pg["agruparpor"]); | |
| 281 | + if ($_pg["formato"] == "json") { | |
| 282 | + retornaJSON($dados); | |
| 283 | + } | |
| 284 | + if ($_pg["formato"] == "xml") { | |
| 285 | + header("Content-type: application/xml"); | |
| 286 | + echo ($m->formataXML($dados)); | |
| 287 | + } | |
| 288 | + if ($_pg["formato"] == "csv") { | |
| 289 | + require_once (dirname(__FILE__) . "/../pacotes/parsecsv/parsecsv.lib.php"); | |
| 290 | + $csv = new parseCSV(); | |
| 291 | + $csv->titles = array_keys($dados[0]); | |
| 292 | + $csv->output(true, 'mvar' . $id_medida_variavel . '_' . date('dmY') . '.csv', $dados); | |
| 293 | + } | |
| 294 | + exit(); | |
| 295 | + break; | |
| 205 | 296 | } |
| 206 | -function retornaJSON($obj) { | |
| 207 | - global $locaplic; | |
| 208 | - include_once ($locaplic . "/pacotes/cpaint/JSON/json2.php"); | |
| 209 | - //error_reporting ( 0 ); | |
| 210 | - ob_end_clean (); | |
| 211 | - $j = new Services_JSON (); | |
| 212 | - $texto = $j->encode ( $obj ); | |
| 213 | - if (! mb_detect_encoding ( $texto, "UTF-8", true )) { | |
| 214 | - $texto = utf8_encode ( $texto ); | |
| 215 | - } | |
| 216 | - echo $texto; | |
| 297 | + | |
| 298 | +function retornaJSON($obj) | |
| 299 | +{ | |
| 300 | + global $locaplic; | |
| 301 | + include_once ($locaplic . "/pacotes/cpaint/JSON/json2.php"); | |
| 302 | + // error_reporting ( 0 ); | |
| 303 | + ob_end_clean(); | |
| 304 | + $j = new Services_JSON(); | |
| 305 | + $texto = $j->encode($obj); | |
| 306 | + if (! mb_detect_encoding($texto, "UTF-8", true)) { | |
| 307 | + $texto = utf8_encode($texto); | |
| 308 | + } | |
| 309 | + echo $texto; | |
| 217 | 310 | } |
| 218 | 311 | ?> | ... | ... |
ferramentas/editorgm/editorgm.js
| ... | ... | @@ -1,2050 +0,0 @@ |
| 1 | -//TODO documentar | |
| 2 | -//TODO incluir balao de informacoes como um elemento grafico de desenho | |
| 3 | -//TODO incluir caixas de texto | |
| 4 | -//TODO incluir undo na edicao | |
| 5 | - | |
| 6 | -/* | |
| 7 | - Editor vetorial de limites para a interface google maps | |
| 8 | - | |
| 9 | - Utilizado em i3geo/metaestat/editorlimites.php | |
| 10 | - | |
| 11 | - Utiliza a API do Google Maps e pacotes/wicket/wicket.js (que cria o objeto Wkt com funcoes para processamento de Wkt) | |
| 12 | - | |
| 13 | - Licenca: | |
| 14 | - | |
| 15 | - GPL2 | |
| 16 | - | |
| 17 | - i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 18 | - | |
| 19 | - Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
| 20 | - Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com | |
| 21 | - | |
| 22 | - Esse programa utiliza parcialmente os codigos da aplicacao calculadora de carbono desenvolvido pelo | |
| 23 | - IPAM - Instituto de Pesquisa Ambiental da Amazonia | |
| 24 | - | |
| 25 | - Este programa e software livre; voce pode redistribui-lo | |
| 26 | - e/ou modifica-lo sob os termos da Licenca Publica Geral | |
| 27 | - GNU conforme publicada pela Free Software Foundation; | |
| 28 | - | |
| 29 | - Este programa e distribuido na expectativa de que seja util, | |
| 30 | - porem, SEM NENHUMA GARANTIA; nem mesmo a garantia implicita | |
| 31 | - de COMERCIABILIDADE OU ADEQUACAO A UMA FINALIDADE ESPECIFICA. | |
| 32 | - Consulte a Licenca Publica Geral do GNU para mais detalhes. | |
| 33 | - Voce deve ter recebido uma copia da Licenca Publica Geral do | |
| 34 | - GNU junto com este programa; se nao, escreva para a | |
| 35 | - Free Software Foundation, Inc., no endereco | |
| 36 | - 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 37 | - */ | |
| 38 | -// | |
| 39 | -if (typeof (i3GEO) === 'undefined') { | |
| 40 | - var i3GEO = {}; | |
| 41 | -} | |
| 42 | -/* | |
| 43 | - * Classe i3GEO.editorGM | |
| 44 | - * | |
| 45 | - * Funções de edição vetorial utilizadas pelo editor de regiões do sistema METAESTAT | |
| 46 | - */ | |
| 47 | -i3GEO.editorGM = | |
| 48 | - { | |
| 49 | - iconePonto : function(sel) { | |
| 50 | - if (sel) { | |
| 51 | - return i3GEO.configura.locaplic + "/imagens/google/symbol_middot_y.png"; | |
| 52 | - } else { | |
| 53 | - return i3GEO.configura.locaplic + "/imagens/google/symbol_middot.png"; | |
| 54 | - } | |
| 55 | - }, | |
| 56 | - /** | |
| 57 | - * Objeto DOM com a imagem de aguarde existente no cabecalho da janela | |
| 58 | - * | |
| 59 | - */ | |
| 60 | - aguarde : "", | |
| 61 | - /** | |
| 62 | - * Guarda o Id do DIV que recebera o conteudo HTML do editor | |
| 63 | - */ | |
| 64 | - iddiv : "", | |
| 65 | - /** | |
| 66 | - * Objeto criado com new google.maps.drawing.DrawingManager | |
| 67 | - */ | |
| 68 | - drawingManager : "", | |
| 69 | - selectedShape : null, | |
| 70 | - /** | |
| 71 | - * guarda o mapeamento entre o codigo da regiao e o codigo do layer adicionado ao mapa | |
| 72 | - */ | |
| 73 | - regioestemas : {}, | |
| 74 | - /** | |
| 75 | - * Guarda o mapeamento entre o codigo da regiao e o codigo do layer adicionado ao mapa | |
| 76 | - */ | |
| 77 | - temasregioes : {}, | |
| 78 | - /** | |
| 79 | - * Guarda os dados descritivos sobre cada regiao obtidos na formacao no combo de escolha de regioes | |
| 80 | - */ | |
| 81 | - descregioes : [], | |
| 82 | - /** | |
| 83 | - * Inicia o editor | |
| 84 | - * | |
| 85 | - * Cria o objeto da API do Google Maps com new google.maps.drawing.DrawingManager A janela flutuante que recebera os componentes do | |
| 86 | - * editor ja deve estar aberta (veja editorlimites.php) Executa i3GEO.editorGM.html | |
| 87 | - * | |
| 88 | - * @param Id | |
| 89 | - * do DIV que recebera o conteudo HTML do editor | |
| 90 | - */ | |
| 91 | - inicia : function(iddiv) { | |
| 92 | - var i, n, ics; | |
| 93 | - // mensagem | |
| 94 | - // i3GEO.janela.tempoMsg("Atenção: apenas tabelas no esquema i3geo_metaestat podem ser editadas."); | |
| 95 | - i3GEO.editorGM.iddiv = iddiv; | |
| 96 | - $i(iddiv).innerHTML = i3GEO.editorGM.html(); | |
| 97 | - ics = $i(iddiv).getElementsByTagName("button"); | |
| 98 | - n = ics.length; | |
| 99 | - //i3GEO.barraDeBotoes.ativaBotoes(); | |
| 100 | - i3GEO.editorGM.comboRegiaoEditavel(); | |
| 101 | - for (i = 0; i < n; i++) { | |
| 102 | - ics[i].style.backgroundColor = "white"; | |
| 103 | - ics[i].className = "iconeGuiaMovel"; | |
| 104 | - ics[i].onmouseout = function() { | |
| 105 | - this.className = "iconeGuiaMovel iconeGuiaMovelMouseOut"; | |
| 106 | - }; | |
| 107 | - ics[i].onmouseover = function() { | |
| 108 | - this.className = "iconeGuiaMovel iconeGuiaMovelMouseOver"; | |
| 109 | - }; | |
| 110 | - ics[i].style.backgroundImage = "none"; | |
| 111 | - ics[i].style.height = "32px"; | |
| 112 | - ics[i].style.width = "32px"; | |
| 113 | - ics[i].style.border = "1px solid gray"; | |
| 114 | - ics[i].style.margin = "0px"; | |
| 115 | - } | |
| 116 | - i3GEO.editorGM.drawingManager = | |
| 117 | - new google.maps.drawing.DrawingManager({ | |
| 118 | - drawingMode : google.maps.drawing.OverlayType.POLYGON, | |
| 119 | - drawingControl : false, | |
| 120 | - drawingControlOptions : { | |
| 121 | - position : google.maps.ControlPosition.TOP_CENTER, | |
| 122 | - drawingModes : [ | |
| 123 | - google.maps.drawing.OverlayType.POLYGON, | |
| 124 | - google.maps.drawing.OverlayType.MARKER, | |
| 125 | - google.maps.drawing.OverlayType.POLYLINE | |
| 126 | - ] | |
| 127 | - }, | |
| 128 | - markerOptions : { | |
| 129 | - icon : i3GEO.editorGM.iconePonto(), | |
| 130 | - clickable : true, | |
| 131 | - zIndex : 1, | |
| 132 | - draggable : true, | |
| 133 | - tema : "", | |
| 134 | - colunaid : "", | |
| 135 | - valorid : "", | |
| 136 | - colunanome : "", | |
| 137 | - valornome : "", | |
| 138 | - editable : false | |
| 139 | - }, | |
| 140 | - polygonOptions : { | |
| 141 | - fillColor : '#ffff00', | |
| 142 | - fillOpacity : .5, | |
| 143 | - strokeWeight : 2, | |
| 144 | - clickable : true, | |
| 145 | - zIndex : 1, | |
| 146 | - editable : true, | |
| 147 | - tema : "", | |
| 148 | - colunaid : "", | |
| 149 | - valorid : "", | |
| 150 | - colunanome : "", | |
| 151 | - valornome : "" | |
| 152 | - } | |
| 153 | - }); | |
| 154 | - i3GEO.editorGM.drawingManager.setMap(i3GeoMap); | |
| 155 | - i3GEO.editorGM.drawingManager.setDrawingMode(null); | |
| 156 | - google.maps.event.addListener(i3GEO.editorGM.drawingManager, 'overlaycomplete', function(e) { | |
| 157 | - // if (e.type != google.maps.drawing.OverlayType.MARKER) { | |
| 158 | - i3GEO.editorGM.drawingManager.setDrawingMode(null); | |
| 159 | - i3GEO.editorGM.mudaicone(); | |
| 160 | - var newShape = e.overlay; | |
| 161 | - newShape.type = e.type; | |
| 162 | - newShape.tema = $i("i3geoCartoRegioesEditaveis").value; | |
| 163 | - newShape.colunaid = ""; | |
| 164 | - newShape.valorid = ""; | |
| 165 | - newShape.colunanome = ""; | |
| 166 | - newShape.valornome = ""; | |
| 167 | - google.maps.event.addListener(newShape, 'click', function() { | |
| 168 | - i3GEO.editorGM.setSelection(newShape); | |
| 169 | - }); | |
| 170 | - i3GEO.editorGM.setSelection(newShape); | |
| 171 | - i3GEO.desenho.googlemaps.shapes.push(newShape); | |
| 172 | - // } | |
| 173 | - }); | |
| 174 | - google.maps.event.addListener(i3GEO.editorGM.drawingManager, 'drawingmode_changed', i3GEO.editorGM.clearSelection); | |
| 175 | - google.maps.event.addListener(i3GeoMap, 'click', i3GEO.editorGM.clearSelection); | |
| 176 | - }, | |
| 177 | - /** | |
| 178 | - * Atualiza as camadas do mapa que sao oriundas do sistema METAESTAT Busca a lista de camadas com | |
| 179 | - * ferramentas/metaestat/analise.php?funcao=LISTACAMADASMETAESTAT Faz um loop para atualizar cada camada | |
| 180 | - */ | |
| 181 | - atualizaCamadasMetaestat : function() { | |
| 182 | - var p = | |
| 183 | - i3GEO.configura.locaplic + "/ferramentas/metaestat/analise.php?funcao=LISTACAMADASMETAESTAT&g_sid=" + i3GEO.configura.sid, temp = | |
| 184 | - function(retorno) { | |
| 185 | - var n = retorno.data.length, i; | |
| 186 | - for (i = 0; i < n; i++) { | |
| 187 | - i3GEO.Interface.atualizaTema("", retorno.data[i]); | |
| 188 | - } | |
| 189 | - }; | |
| 190 | - cpJSON.call(p, "foo", temp); | |
| 191 | - }, | |
| 192 | - /** | |
| 193 | - * Monta o codigo HTML com o conteudo da ferramenta Define os botoes e demais elementos que serao preenchidos via codigo | |
| 194 | - * | |
| 195 | - * @return html | |
| 196 | - */ | |
| 197 | - html : function() { | |
| 198 | - var ins = | |
| 199 | - '<div style=margin-left:5px >' + ' <button title="' + $trad("dpol") | |
| 200 | - + '" onclick="i3GEO.editorGM.digitalizaPol(this)"><img src="' | |
| 201 | - + i3GEO.configura.locaplic | |
| 202 | - + '/imagens/gisicons/polygon-create.png" /></button>' | |
| 203 | - + ' <button title="' | |
| 204 | - + $trad("dponto") | |
| 205 | - + '" onclick="i3GEO.editorGM.digitalizaPt(this)"><img src="' | |
| 206 | - + i3GEO.configura.locaplic | |
| 207 | - + '/imagens/gisicons/point-create.png" /></button>' | |
| 208 | - + ' <button title="' | |
| 209 | - + $trad("capturar") | |
| 210 | - + '" onclick="i3GEO.editorGM.capturaPoligonoTema.ativa(this)"><img src="' | |
| 211 | - + i3GEO.configura.locaplic | |
| 212 | - + '/imagens/gisicons/layer-import.png" /></button>' | |
| 213 | - + ' <button title="' | |
| 214 | - + $trad("d24t") | |
| 215 | - + '" onclick="i3GEO.editorGM.seleciona(this)"><img src="' | |
| 216 | - + i3GEO.configura.locaplic | |
| 217 | - + '/imagens/gisicons/select.png" /></button>' | |
| 218 | - + ' <button title="' | |
| 219 | - + $trad("studo") | |
| 220 | - + '" onclick="i3GEO.editorGM.selectAll(this)"><img src="' | |
| 221 | - + i3GEO.configura.locaplic | |
| 222 | - + '/imagens/gisicons/selectall.png" /></button>' | |
| 223 | - + ' <button title="' | |
| 224 | - + $trad("excsel") | |
| 225 | - + '" onclick="i3GEO.editorGM.deleteSelectedShape()"><img src="' | |
| 226 | - + i3GEO.configura.locaplic | |
| 227 | - + '/imagens/gisicons/selected-delete.png" /></button>' | |
| 228 | - + ' <button title="' | |
| 229 | - + $trad("salvexc") | |
| 230 | - + '" onclick="i3GEO.editorGM.salvaLimite.inicia()"><img src="' | |
| 231 | - + i3GEO.configura.locaplic | |
| 232 | - + '/imagens/gisicons/vector-save.png" /></button>' | |
| 233 | - + ' <button title="' | |
| 234 | - + $trad("edatrib") | |
| 235 | - + '" onclick="i3GEO.editorGM.editarAtributos.ativa(this)"><img src="' | |
| 236 | - + i3GEO.configura.locaplic | |
| 237 | - + '/imagens/gisicons/annotation-form.png" /></button>' | |
| 238 | - + ' <button title="' | |
| 239 | - + $trad("s1") | |
| 240 | - + '" onmousedown="i3GEO.editorGM.mudaicone()" onclick="i3GEO.editorGM.ajuda()" ><img src="' | |
| 241 | - + i3GEO.configura.locaplic | |
| 242 | - + '/imagens/gisicons/help-contents.png" /></button>' | |
| 243 | - + ' <br><div id="i3geoCartoRegioesEditaveisDiv" ><img style="display:block;z-index:2" src="' | |
| 244 | - + i3GEO.configura.locaplic | |
| 245 | - + '/imagens/aguarde.gif" /></div></div>'; // combo para escolher a regiao | |
| 246 | - return ins; | |
| 247 | - }, | |
| 248 | - /** | |
| 249 | - * Atualiza a ferramenta quando a janela flutuante tem seu foco ativado | |
| 250 | - */ | |
| 251 | - ativaFoco : function() { | |
| 252 | - i3GEO.editorGM.mudaicone(); | |
| 253 | - i3GEO.Interface.googlemaps.recalcPar(); | |
| 254 | - }, | |
| 255 | - /** | |
| 256 | - * Marca uma figura como selecionada | |
| 257 | - * | |
| 258 | - * @param objeto | |
| 259 | - * shape que sera marcado | |
| 260 | - */ | |
| 261 | - setSelection : function(shape) { | |
| 262 | - if (shape.setEditable) { | |
| 263 | - shape.setEditable(!shape.editable); | |
| 264 | - } else { | |
| 265 | - shape.editable = true; | |
| 266 | - shape.setIcon({ | |
| 267 | - url : i3GEO.editorGM.iconePonto(true) | |
| 268 | - }); | |
| 269 | - } | |
| 270 | - }, | |
| 271 | - /** | |
| 272 | - * Marca todas as figuras como nao selecionadas As figuras existentes no mapa sao mantidas na variavel | |
| 273 | - * i3GEO.desenho.googlemaps.shapes | |
| 274 | - */ | |
| 275 | - clearSelection : function() { | |
| 276 | - var i, n = i3GEO.desenho.googlemaps.shapes.length; | |
| 277 | - for (i = 0; i < n; i++) { | |
| 278 | - if (i3GEO.desenho.googlemaps.shapes[i] != "" && i3GEO.desenho.googlemaps.shapes[i].setEditable) { | |
| 279 | - i3GEO.desenho.googlemaps.shapes[i].setEditable(false); | |
| 280 | - } else if (i3GEO.desenho.googlemaps.shapes[i] != "") {// caso for ponto | |
| 281 | - i3GEO.desenho.googlemaps.shapes[i].editable = false; | |
| 282 | - if (i3GEO.desenho.googlemaps.shapes[i].setIcon) { | |
| 283 | - i3GEO.desenho.googlemaps.shapes[i].setIcon({ | |
| 284 | - url : i3GEO.editorGM.iconePonto(false) | |
| 285 | - }); | |
| 286 | - } | |
| 287 | - } | |
| 288 | - } | |
| 289 | - }, | |
| 290 | - /** | |
| 291 | - * Marca todas as figuras como selecionadas As figuras existentes no mapa sao mantidas na variavel i3GEO.desenho.googlemaps.shapes | |
| 292 | - */ | |
| 293 | - selectAll : function() { | |
| 294 | - var i, n = i3GEO.desenho.googlemaps.shapes.length; | |
| 295 | - for (i = 0; i < n; i++) { | |
| 296 | - if (i3GEO.desenho.googlemaps.shapes[i] != "" && i3GEO.desenho.googlemaps.shapes[i].setEditable) { | |
| 297 | - i3GEO.desenho.googlemaps.shapes[i].setEditable(true); | |
| 298 | - } else if (i3GEO.desenho.googlemaps.shapes[i] != "") {// caso for ponto | |
| 299 | - i3GEO.desenho.googlemaps.shapes[i].editable = true; | |
| 300 | - i3GEO.desenho.googlemaps.shapes[i].setIcon({ | |
| 301 | - url : i3GEO.editorGM.iconePonto(true) | |
| 302 | - }); | |
| 303 | - } | |
| 304 | - } | |
| 305 | - }, | |
| 306 | - /** | |
| 307 | - * Remove do mapa as figuras que estiverem selecionadas | |
| 308 | - * | |
| 309 | - * @param boolean | |
| 310 | - * indica se deve ser feita uma confirmacao ou nao antes de apagar | |
| 311 | - */ | |
| 312 | - deleteSelectedShape : function(naoconfirma) { | |
| 313 | - i3GEO.janela.tempoMsg($trad("meneditor1")); | |
| 314 | - if (!naoconfirma) { | |
| 315 | - naoconfirma = false; | |
| 316 | - } | |
| 317 | - var i, n = i3GEO.desenho.googlemaps.shapes.length; | |
| 318 | - if (n > 0) { | |
| 319 | - if (naoconfirma === false) { | |
| 320 | - var x = window.confirm($trad("excsel") + "?"); | |
| 321 | - } else { | |
| 322 | - x = true; | |
| 323 | - } | |
| 324 | - if (x) { | |
| 325 | - for (i = 0; i < n; i++) { | |
| 326 | - if (i3GEO.desenho.googlemaps.shapes[i] != "" && i3GEO.desenho.googlemaps.shapes[i].editable | |
| 327 | - && i3GEO.desenho.googlemaps.shapes[i].editable === true) { | |
| 328 | - i3GEO.desenho.googlemaps.shapes[i].setMap(null); | |
| 329 | - i3GEO.desenho.googlemaps.shapes[i] = ""; | |
| 330 | - } | |
| 331 | - } | |
| 332 | - } | |
| 333 | - } else { | |
| 334 | - i3GEO.janela.tempoMsg($trad("selum")); | |
| 335 | - } | |
| 336 | - }, | |
| 337 | - /** | |
| 338 | - * Lista as figuras que estao marcadas como selecionadas | |
| 339 | - * | |
| 340 | - * @return array de shapes | |
| 341 | - */ | |
| 342 | - selectedShapes : function() { | |
| 343 | - var i, s = [], n = i3GEO.desenho.googlemaps.shapes.length; | |
| 344 | - for (i = 0; i < n; i++) { | |
| 345 | - if (i3GEO.desenho.googlemaps.shapes[i] != "" && i3GEO.desenho.googlemaps.shapes[i].editable === true) { | |
| 346 | - s.push(i3GEO.desenho.googlemaps.shapes[i]); | |
| 347 | - } | |
| 348 | - } | |
| 349 | - return s; | |
| 350 | - }, | |
| 351 | - /** | |
| 352 | - * Lista as coordenadas de todas as figuras existentes | |
| 353 | - * | |
| 354 | - * @return objeto contendo a indicacao do tipo de figura e o array com a lista de coordenadas | |
| 355 | - */ | |
| 356 | - getCoordenadas : function() { | |
| 357 | - var coordenadas = [], lista = [], n = i3GEO.desenho.googlemaps.shapes.length, tipo = "", ps, nps, j, p, i, r; | |
| 358 | - | |
| 359 | - for (i = 0; i < n; i++) { | |
| 360 | - coordenadas = []; | |
| 361 | - if (i3GEO.desenho.googlemaps.shapes[i] != "" && i3GEO.desenho.googlemaps.shapes[i].editable === true) { | |
| 362 | - if (tipo == "") { | |
| 363 | - tipo = i3GEO.desenho.googlemaps.shapes[i].type; | |
| 364 | - } | |
| 365 | - ps = i3GEO.desenho.googlemaps.shapes[i].getPath(); | |
| 366 | - nps = ps.getLength(); | |
| 367 | - for (j = 0; j < nps; j++) { | |
| 368 | - p = ps.getAt(j); | |
| 369 | - coordenadas.push([ | |
| 370 | - p.lng() + " " + p.lat() | |
| 371 | - ]); | |
| 372 | - } | |
| 373 | - lista.push(coordenadas); | |
| 374 | - } | |
| 375 | - } | |
| 376 | - r = { | |
| 377 | - "tipo" : tipo, | |
| 378 | - "coordenadas" : lista | |
| 379 | - }; | |
| 380 | - return r; | |
| 381 | - }, | |
| 382 | - /** | |
| 383 | - * Converte um objeto shape em uma string WKT | |
| 384 | - * | |
| 385 | - * @param shape | |
| 386 | - */ | |
| 387 | - toWKT : function(obj) { | |
| 388 | - var wkt = new Wkt.Wkt(); | |
| 389 | - wkt.fromObject(obj); | |
| 390 | - return wkt.write(); | |
| 391 | - }, | |
| 392 | - merge : function(geoms) { | |
| 393 | - var n = geoms.length, w = new Wkt.Wkt(), g, m, i; | |
| 394 | - w.read(geoms[0].toString()); | |
| 395 | - if (n > 1) { | |
| 396 | - for (i = 1; i < n; i++) { | |
| 397 | - g = geoms[i].toString(); | |
| 398 | - m = new Wkt.Wkt(); | |
| 399 | - m.read(g); | |
| 400 | - w.merge(m); | |
| 401 | - } | |
| 402 | - } | |
| 403 | - return w.write(); | |
| 404 | - }, | |
| 405 | - /** | |
| 406 | - * Funcoes que controlam o processo de obtencao das coordenadas de um componente de uma camada existente no mapa | |
| 407 | - */ | |
| 408 | - capturaPoligonoTema : { | |
| 409 | - /** | |
| 410 | - * Ativa a operaco de captura definindo o evento que sera executado no onclick do mouse sobre o mapa O evento executa | |
| 411 | - * i3GEO.editorGM.capturaPoligonoTema.captura | |
| 412 | - * | |
| 413 | - * @param botao | |
| 414 | - * da interface que foi pressionado | |
| 415 | - */ | |
| 416 | - ativa : function(botao) { | |
| 417 | - i3GEO.editorGM.mudaicone(botao); | |
| 418 | - i3GEO.eventos.cliquePerm.desativa(); | |
| 419 | - i3GEO.eventos.adicionaEventos("MOUSECLIQUE", [ | |
| 420 | - "i3GEO.editorGM.capturaPoligonoTema.captura()" | |
| 421 | - ]); | |
| 422 | - }, | |
| 423 | - desativa : function() { | |
| 424 | - }, | |
| 425 | - /** | |
| 426 | - * Realiza a captura de um componente do mapa quando o usuario faz o clique A captura e feita com | |
| 427 | - * classesphp/mapa_controle.php&funcao=identifica3 O resultado e adicionado ao mapa como um novo objeto shape | |
| 428 | - */ | |
| 429 | - captura : function() { | |
| 430 | - var temp, tema = "", regiao = "", p, par, aguarde = $i("i3GEOjanelaEditor_imagemCabecalho"); | |
| 431 | - if (!$i("i3geoCartoRegioesEditaveis")) { | |
| 432 | - i3GEO.eventos.removeEventos("MOUSECLIQUE", [ | |
| 433 | - "i3GEO.editorGM.capturaPoligonoTema.captura()" | |
| 434 | - ]); | |
| 435 | - } else { | |
| 436 | - temp = | |
| 437 | - function(retorno) { | |
| 438 | - var temp, n, i, WicketWkt, wkt = "", colunaid = "", valorid = "", colunanome = "", valornome = "", aguarde = | |
| 439 | - $i("i3GEOjanelaEditor_imagemCabecalho"); | |
| 440 | - if (i3GEO.editorGM.descregioes["a_" + regiao]["identificador"]) { | |
| 441 | - colunaid = i3GEO.editorGM.descregioes["a_" + regiao]["identificador"]; | |
| 442 | - } | |
| 443 | - if (i3GEO.editorGM.descregioes["a_" + regiao]["colunanomeregiao"]) { | |
| 444 | - colunanome = i3GEO.editorGM.descregioes["a_" + regiao]["colunanomeregiao"]; | |
| 445 | - } | |
| 446 | - if (aguarde) { | |
| 447 | - aguarde.style.visibility = "hidden"; | |
| 448 | - } | |
| 449 | - // obtem os dados buscando nos itens que vem da requisicao ao wms | |
| 450 | - temp = retorno.data[0].resultado[0]; | |
| 451 | - if (temp === " ") { | |
| 452 | - i3GEO.janela.tempoMsg($trad("meneditor2")); | |
| 453 | - return; | |
| 454 | - } | |
| 455 | - i3GEO.editorGM.mudaicone(); | |
| 456 | - n = temp.length; | |
| 457 | - for (i = 0; i < n; i++) { | |
| 458 | - if (temp[i].alias == "wkt") { | |
| 459 | - wkt = temp[i].valor; | |
| 460 | - } | |
| 461 | - if (temp[i].alias == colunaid || temp[i].item == colunaid) { | |
| 462 | - valorid = temp[i].valor; | |
| 463 | - } | |
| 464 | - if (temp[i].alias == colunanome || temp[i].item == colunanome) { | |
| 465 | - valornome = temp[i].valor; | |
| 466 | - } | |
| 467 | - } | |
| 468 | - // objeto do wicket ver pacotes/wicket | |
| 469 | - WicketWkt = new Wkt.Wkt(); | |
| 470 | - // wkt = "MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), ((20 35, 45 20, 30 5, 10 10, 10 30, 20 35), (30 20, 20 | |
| 471 | - // 25, 20 15, 30 20)))"; | |
| 472 | - try { // Catch any malformed WKT strings | |
| 473 | - WicketWkt.read(wkt); | |
| 474 | - } catch (e1) { | |
| 475 | - try { | |
| 476 | - wkt.read(wkt.replace('\n', '').replace('\r', '').replace('\t', '')); | |
| 477 | - } catch (e2) { | |
| 478 | - if (e2.name === 'WKTError') { | |
| 479 | - alert('Wicket could not understand the WKT string you entered. Check that you have parentheses balanced, and try removing tabs and newline characters.'); | |
| 480 | - return; | |
| 481 | - } | |
| 482 | - } | |
| 483 | - } | |
| 484 | - obj = WicketWkt.toObject(i3GeoMap.defaults); | |
| 485 | - // obj.setMap(i3GeoMap); // Add it to the map | |
| 486 | - // i3GEO.desenho.googlemaps.shapes.push(obj); | |
| 487 | - i3GEO.editorGM.adicionaPoligonos(obj, tema, colunaid, valorid, colunanome, valornome); | |
| 488 | - i3GEO.eventos.MOUSECLIQUE = []; | |
| 489 | - }; | |
| 490 | - regiao = $i("i3geoCartoRegioesEditaveis").value; | |
| 491 | - if (regiao != "") { | |
| 492 | - tema = i3GEO.editorGM.regioestemas["a" + regiao]; | |
| 493 | - if (aguarde && aguarde.style.visibility == "hidden") { | |
| 494 | - aguarde.style.visibility = "visible"; | |
| 495 | - p = i3GEO.configura.locaplic + "/classesphp/mapa_controle.php"; | |
| 496 | - par = | |
| 497 | - "funcao=identifica3&opcao=tema&xy=" + objposicaocursor.ddx | |
| 498 | - + "," | |
| 499 | - + objposicaocursor.ddy | |
| 500 | - + "&resolucao=5&g_sid=" | |
| 501 | - + i3GEO.configura.sid | |
| 502 | - + "&ext=" | |
| 503 | - + i3GEO.parametros.mapexten | |
| 504 | - + "&listaDeTemas=&wkt=sim&tema=" | |
| 505 | - + tema; | |
| 506 | - cpJSON.call(p, "identifica", temp, par); | |
| 507 | - } | |
| 508 | - } | |
| 509 | - } | |
| 510 | - } | |
| 511 | - }, | |
| 512 | - /** | |
| 513 | - * Monta um combo com a lista de regioes cadastradas e que podem ser editadas pelo editor A regiao em edicao sera a escolhida nesse | |
| 514 | - * combo Ao ser escolhida, e adicionada uma camada no mapa | |
| 515 | - * | |
| 516 | - * @param opcional | |
| 517 | - * codigo da regiao no cadastro. Se nao for definido, busca todas | |
| 518 | - */ | |
| 519 | - comboRegiaoEditavel : function(codigo_tipo_regiao) { | |
| 520 | - if (!codigo_tipo_regiao) { | |
| 521 | - codigo_tipo_regiao = ""; | |
| 522 | - } | |
| 523 | - var onde = $i("i3geoCartoRegioesEditaveisDiv"), temp = | |
| 524 | - function(dados) { | |
| 525 | - var n = dados.length, ins = '<br><p class="paragrafo" >' + $trad("camedit") + ':</p>', i; | |
| 526 | - ins += | |
| 527 | - "<select onchange='i3GEO.editorGM.comboRegiaoEditavelOnchange(this)' id='i3geoCartoRegioesEditaveis' style='width:175px' ><option value=''>---</option>"; | |
| 528 | - for (i = 0; i < n; i++) { | |
| 529 | - ins += "<option value='" + dados[i].codigo_tipo_regiao + "'>" + dados[i].nome_tipo_regiao + "</option>"; | |
| 530 | - i3GEO.editorGM.descregioes["a_" + dados[i].codigo_tipo_regiao] = dados[i]; | |
| 531 | - } | |
| 532 | - // inclui as camadas que sao editaveis e estao no mapa | |
| 533 | - dados = i3GEO.arvoreDeCamadas.filtraCamadas("editavel", "SIM", "igual"); | |
| 534 | - n = dados.length; | |
| 535 | - for (i = 0; i < n; i++) { | |
| 536 | - // layer e usado aqui para identificar que a camada veio do mapa e nao do cadastro de regioes | |
| 537 | - if (!dados[i].codigo_tipo_regiao || dados[i].codigo_tipo_regiao === "") { | |
| 538 | - ins += "<option value='" + dados[i].name + "'>" + dados[i].tema + "</option>"; | |
| 539 | - dados[i]["identificador"] = dados[i].colunaidunico; | |
| 540 | - dados[i]["colunanomeregiao"] = ""; | |
| 541 | - i3GEO.editorGM.descregioes["a_" + dados[i].name] = dados[i]; | |
| 542 | - } | |
| 543 | - } | |
| 544 | - ins += "</select>"; | |
| 545 | - if (onde) { | |
| 546 | - onde.innerHTML = ins; | |
| 547 | - } | |
| 548 | - return ins; | |
| 549 | - }; | |
| 550 | - i3GEO.php.listaTipoRegiao(temp, codigo_tipo_regiao); | |
| 551 | - }, | |
| 552 | - /** | |
| 553 | - * Funcao ativada no evento onchange do combo criado com comboRegiaoEditavel Executa i3GEO.php.mapfileTipoRegiao | |
| 554 | - */ | |
| 555 | - comboRegiaoEditavelOnchange : function(combo) { | |
| 556 | - if (combo.value === "") { | |
| 557 | - return; | |
| 558 | - } | |
| 559 | - i3GEO.editorGM.editarAtributos.desativa(); | |
| 560 | - // caso a camada escolhida seja uma camada normal, vinda de um mapfile | |
| 561 | - if (i3GEO.arvoreDeCamadas.pegaTema(combo.value) != "") { | |
| 562 | - i3GEO.editorGM.regioestemas["a" + combo.value] = combo.value; | |
| 563 | - i3GEO.editorGM.temasregioes[combo.value] = combo.value; | |
| 564 | - } else { | |
| 565 | - var temp = function(retorno) { | |
| 566 | - if (i3GEO.arvoreDeCamadas.pegaTema(retorno.layer) == "") { | |
| 567 | - i3GEO.php.adtema(i3GEO.atualiza, retorno.mapfile); | |
| 568 | - // guarda o codigo e relaciona com a regiao | |
| 569 | - i3GEO.editorGM.regioestemas["a" + combo.value] = retorno.layer; | |
| 570 | - i3GEO.editorGM.temasregioes[retorno.layer] = combo.value; | |
| 571 | - } | |
| 572 | - }; | |
| 573 | - i3GEO.php.mapfileTipoRegiao(temp, combo.value); | |
| 574 | - } | |
| 575 | - }, | |
| 576 | - /** | |
| 577 | - * Altera as bordas dos icones e desativa eventos Desativa todos os botoes e ativa o indicado | |
| 578 | - * | |
| 579 | - * @param objeto | |
| 580 | - * DOM que representa o botao que sera focado | |
| 581 | - */ | |
| 582 | - mudaicone : function(botao) { | |
| 583 | - var c = $i(i3GEO.editorGM.iddiv), ci = c.getElementsByTagName("img"), n = ci.length, i; | |
| 584 | - for (i = 0; i < n; i++) { | |
| 585 | - ci[i].parentNode.style.backgroundColor = "#F5F5F5"; | |
| 586 | - } | |
| 587 | - i3GEO.eventos.MOUSECLIQUE = []; | |
| 588 | - i3GEO.editorGM.capturaPoligonoTema.desativa(); | |
| 589 | - i3GEO.editorGM.editarAtributos.desativa(); | |
| 590 | - if (botao && botao.style) { | |
| 591 | - botao.style.backgroundColor = "#cedff2"; | |
| 592 | - } | |
| 593 | - }, | |
| 594 | - /** | |
| 595 | - * Ativa a digitalizacao de poligono | |
| 596 | - * | |
| 597 | - * @param objeto | |
| 598 | - * DOM que representa o botao que sera focado | |
| 599 | - */ | |
| 600 | - digitalizaPol : function(botao) { | |
| 601 | - i3GEO.editorGM.mudaicone(botao); | |
| 602 | - i3GEO.editorGM.drawingManager.setOptions({ | |
| 603 | - drawingMode : google.maps.drawing.OverlayType.POLYGON | |
| 604 | - }); | |
| 605 | - }, | |
| 606 | - /** | |
| 607 | - * Ativa a digitalizacao de ponto | |
| 608 | - * | |
| 609 | - * @param objeto | |
| 610 | - * DOM que representa o botao que sera focado | |
| 611 | - */ | |
| 612 | - digitalizaPt : function(botao) { | |
| 613 | - i3GEO.editorGM.mudaicone(botao); | |
| 614 | - i3GEO.editorGM.drawingManager.setOptions({ | |
| 615 | - drawingMode : google.maps.drawing.OverlayType.MARKER | |
| 616 | - }); | |
| 617 | - }, | |
| 618 | - /** | |
| 619 | - * Ativa a selecao de figuras | |
| 620 | - * | |
| 621 | - * @param objeto | |
| 622 | - * DOM que representa o botao que sera focado | |
| 623 | - */ | |
| 624 | - seleciona : function(botao) { | |
| 625 | - i3GEO.editorGM.mudaicone(botao); | |
| 626 | - i3GEO.editorGM.drawingManager.setOptions({ | |
| 627 | - drawingMode : null | |
| 628 | - }); | |
| 629 | - }, | |
| 630 | - /** | |
| 631 | - * Adiciona uma nova figura ao mapa (shape) Pode ser poligono ou ponto | |
| 632 | - * | |
| 633 | - * @param objeto | |
| 634 | - * shape (API do Google) | |
| 635 | - * @param codigo | |
| 636 | - * do layer que sera vinculado ao shape | |
| 637 | - * @param coluna | |
| 638 | - * do tema que contem os identificadores de cada um de seus elementos (registros) | |
| 639 | - * @param valor | |
| 640 | - * do identificador | |
| 641 | - * @param coluna | |
| 642 | - * que cntem os nomes das regioes | |
| 643 | - * @param nome | |
| 644 | - * da regiao a ser adicionada | |
| 645 | - */ | |
| 646 | - adicionaPoligonos : function(obj, tema, colunaid, valorid, colunanome, valornome) { | |
| 647 | - if (!tema) { | |
| 648 | - tema = $i("i3geoCartoRegioesEditaveis").value; | |
| 649 | - } | |
| 650 | - if (!colunaid) { | |
| 651 | - colunaid = ""; | |
| 652 | - } | |
| 653 | - if (!valorid) { | |
| 654 | - valorid = ""; | |
| 655 | - } | |
| 656 | - if (!colunanome) { | |
| 657 | - colunanome = ""; | |
| 658 | - } | |
| 659 | - if (!valornome) { | |
| 660 | - valornome = ""; | |
| 661 | - } | |
| 662 | - var pol; | |
| 663 | - if (Wkt.isArray(obj)) { // Distinguish multigeometries (Arrays) from objects | |
| 664 | - for (i in obj) { | |
| 665 | - if (obj.hasOwnProperty(i) && !Wkt.isArray(obj[i])) { | |
| 666 | - pol = new google.maps.Polygon({ | |
| 667 | - path : obj[i].getPath(), | |
| 668 | - map : i3GeoMap, | |
| 669 | - fillColor : '#ffff00', | |
| 670 | - fillOpacity : .5, | |
| 671 | - strokeWeight : 2, | |
| 672 | - clickable : true, | |
| 673 | - zIndex : 1, | |
| 674 | - editable : true, | |
| 675 | - tema : tema, | |
| 676 | - colunaid : colunaid, | |
| 677 | - valorid : valorid, | |
| 678 | - colunanome : colunanome, | |
| 679 | - valornome : valornome | |
| 680 | - }); | |
| 681 | - google.maps.event.addListener(pol, 'click', function() { | |
| 682 | - i3GEO.editorGM.setSelection(pol); | |
| 683 | - }); | |
| 684 | - i3GEO.desenho.googlemaps.shapes.push(pol); | |
| 685 | - } | |
| 686 | - } | |
| 687 | - return; | |
| 688 | - } | |
| 689 | - if (obj.type === 'polygon' || obj.type === 'linestring') { | |
| 690 | - pol = new google.maps.Polygon({ | |
| 691 | - paths : obj.getPaths(), | |
| 692 | - map : i3GeoMap, | |
| 693 | - fillColor : '#ffff00', | |
| 694 | - fillOpacity : .5, | |
| 695 | - strokeWeight : 2, | |
| 696 | - clickable : true, | |
| 697 | - zIndex : 1, | |
| 698 | - editable : true, | |
| 699 | - tema : tema, | |
| 700 | - colunaid : colunaid, | |
| 701 | - valorid : valorid, | |
| 702 | - colunanome : colunanome, | |
| 703 | - valornome : valornome | |
| 704 | - }); | |
| 705 | - google.maps.event.addListener(pol, 'click', function() { | |
| 706 | - i3GEO.editorGM.setSelection(pol); | |
| 707 | - }); | |
| 708 | - i3GEO.desenho.googlemaps.shapes.push(pol); | |
| 709 | - return; | |
| 710 | - } | |
| 711 | - if (obj.type === 'marker') { | |
| 712 | - i3GEO.editorGM.selectAll(); | |
| 713 | - if (i3GEO.desenho.googlemaps.shapes.length > 0) { | |
| 714 | - i3GEO.editorGM.deleteSelectedShape(true); | |
| 715 | - } | |
| 716 | - pol = new google.maps.Marker({ | |
| 717 | - position : new google.maps.LatLng(obj.getPosition().ob, obj.getPosition().pb), | |
| 718 | - map : i3GeoMap, | |
| 719 | - icon : { | |
| 720 | - url : i3GEO.editorGM.iconePonto(false) | |
| 721 | - }, | |
| 722 | - clickable : true, | |
| 723 | - zIndex : 1, | |
| 724 | - draggable : true, | |
| 725 | - tema : tema, | |
| 726 | - colunaid : colunaid, | |
| 727 | - valorid : valorid, | |
| 728 | - colunanome : colunanome, | |
| 729 | - valornome : valornome, | |
| 730 | - editable : false | |
| 731 | - }); | |
| 732 | - google.maps.event.addListener(pol, 'click', function() { | |
| 733 | - i3GEO.editorGM.setSelection(pol); | |
| 734 | - }); | |
| 735 | - i3GEO.desenho.googlemaps.shapes.push(pol); | |
| 736 | - return; | |
| 737 | - } | |
| 738 | - }, | |
| 739 | - /** | |
| 740 | - * Salva um poligono no banco de dados | |
| 741 | - */ | |
| 742 | - salvaLimite : { | |
| 743 | - /** | |
| 744 | - * Inicia a ferramenta definindo as funcoes dos botoes Executa i3GEO.editorGM.salvaLimite.criaJanelaFlutuante | |
| 745 | - */ | |
| 746 | - inicia : function() { | |
| 747 | - if (i3GEO.login.verificaCookieLogin() === false) { | |
| 748 | - i3GEO.janela.tempoMsg($trad("meneditor3")); | |
| 749 | - if (i3GEO.editorGM.selectedShapes().length > 0) { | |
| 750 | - var temp = i3GEO.editorGM.toWKT(i3GEO.editorGM.selectedShapes()[0]); | |
| 751 | - i3GEO.mapa.dialogo.wkt2layer(temp); | |
| 752 | - } | |
| 753 | - return; | |
| 754 | - } | |
| 755 | - var wkt, temp, s = i3GEO.editorGM.selectedShapes(), n = s.length, janela = YAHOO.i3GEO.janela.manager.find("salvaLimite"); | |
| 756 | - if (janela) { | |
| 757 | - janela.destroy(); | |
| 758 | - } | |
| 759 | - if (n == 1) { | |
| 760 | - s = s[0]; | |
| 761 | - temp = function(retorno) { | |
| 762 | - i3GEO.editorGM.deleteSelectedShape(true); | |
| 763 | - i3GEO.Interface.redesenha(); | |
| 764 | - }; | |
| 765 | - // verifica se e uma regiao cadastrada ou um tema comum editavel | |
| 766 | - if (i3GEO.editorGM.descregioes["a_" + $i("i3geoCartoRegioesEditaveis").value].tema != undefined) { | |
| 767 | - wkt = i3GEO.editorGM.toWKT(i3GEO.editorGM.selectedShapes()[0]); | |
| 768 | - if (wkt && wkt != "") { | |
| 769 | - // cria um novo registro | |
| 770 | - if (s.valorid == "") { | |
| 771 | - p = | |
| 772 | - i3GEO.configura.locaplic + "/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid=" | |
| 773 | - + i3GEO.configura.sid; | |
| 774 | - cpJSON.call(p, "foo", temp, "&tema=" + $i("i3geoCartoRegioesEditaveis").value + "&wkt=" + wkt); | |
| 775 | - } else { | |
| 776 | - // atualiza a geometria | |
| 777 | - p = | |
| 778 | - i3GEO.configura.locaplic + "/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid=" | |
| 779 | - + i3GEO.configura.sid; | |
| 780 | - cpJSON.call(p, "foo", temp, "&idunico=" + s.valorid | |
| 781 | - + "&tema=" | |
| 782 | - + $i("i3geoCartoRegioesEditaveis").value | |
| 783 | - + "&wkt=" | |
| 784 | - + wkt); | |
| 785 | - } | |
| 786 | - } | |
| 787 | - } else { | |
| 788 | - // formulario para o caso de ser um tema cadastrado como regiao no sistema metaestat | |
| 789 | - i3GEO.editorGM.salvaLimite.criaJanelaFlutuante(i3GEO.editorGM.salvaLimite.html( | |
| 790 | - s.colunaid, | |
| 791 | - s.valorid, | |
| 792 | - s.colunanome, | |
| 793 | - s.valornome)); | |
| 794 | - new YAHOO.widget.Button("i3GEOFmetaestati3GEO.editorGMBotao1", { | |
| 795 | - onclick : { | |
| 796 | - fn : function() { | |
| 797 | - i3GEO.editorGM.salvaLimite.gravaDados(true); | |
| 798 | - } | |
| 799 | - } | |
| 800 | - }); | |
| 801 | - new YAHOO.widget.Button("i3GEOFmetaestati3GEO.editorGMBotao2", { | |
| 802 | - onclick : { | |
| 803 | - fn : function() { | |
| 804 | - i3GEO.editorGM.salvaLimite.gravaDados(false); | |
| 805 | - } | |
| 806 | - } | |
| 807 | - }); | |
| 808 | - new YAHOO.widget.Button("i3GEOFmetaestati3GEO.editorGMBotao3", { | |
| 809 | - onclick : { | |
| 810 | - fn : function() { | |
| 811 | - i3GEO.editorGM.salvaLimite.excluiPoligono(); | |
| 812 | - } | |
| 813 | - } | |
| 814 | - }); | |
| 815 | - } | |
| 816 | - } else { | |
| 817 | - i3GEO.janela.tempoMsg("Selecione uma figura"); | |
| 818 | - } | |
| 819 | - }, | |
| 820 | - /** | |
| 821 | - * Monta o HTML para o formulario que permite salvar os dados | |
| 822 | - */ | |
| 823 | - html : function(colunaIdElemento, valorIdElemento, colunaNomeElemento, valorNomeElemento) { | |
| 824 | - var ins = | |
| 825 | - '' + '<p class=paragrafo >Se o valor do código for vazio, será criado um novo elemento. Caso contrário, os valores atualmente registrados serão atualizados.</p>' | |
| 826 | - + '<p class=paragrafo >Edite os atributos:</p>' | |
| 827 | - + '<input type=hidden id="inputColunaIdElemento" value="' + colunaIdElemento | |
| 828 | - + '" />' | |
| 829 | - + '<input type=hidden id="inputColunaNomeElemento" value="' | |
| 830 | - + colunaNomeElemento | |
| 831 | - + '" />' | |
| 832 | - + '<input type=hidden id="inputIdentificadorElemento" value="' | |
| 833 | - + valorIdElemento | |
| 834 | - + '" />' | |
| 835 | - + '<input type=hidden id="inputNomeElemento" value="' | |
| 836 | - + valorNomeElemento | |
| 837 | - + '" />' | |
| 838 | - + '<p class=paragrafo >Código:</p>' | |
| 839 | - + '<p class=paragrafo ><input class=digitar type=text id="inputIdentificadorNovoElemento" value="' | |
| 840 | - + valorIdElemento | |
| 841 | - + '" style="width:180;cursor:text" /></p>' | |
| 842 | - + '<p class=paragrafo >Nome:</p>' | |
| 843 | - + '<p class=paragrafo ><input class=digitar type=text id="inputNomeNovoElemento" value="' | |
| 844 | - + valorNomeElemento | |
| 845 | - + '" style="width:180;cursor:text" /></p>' | |
| 846 | - + '<p class=paragrafo >Escolha a operação desejada:</p>' | |
| 847 | - + '<input id=i3GEOFmetaestati3GEO.editorGMBotao1 type="button" value="Salvar tudo" />' | |
| 848 | - + ' <input id=i3GEOFmetaestati3GEO.editorGMBotao2 type="button" value="Salvar apenas os atributos" />' | |
| 849 | - + '<br><br><input id=i3GEOFmetaestati3GEO.editorGMBotao3 type="button" value="Excluir" />'; | |
| 850 | - return ins; | |
| 851 | - }, | |
| 852 | - /** | |
| 853 | - * Cria a janela flutuante para receber os componentes da ferramenta | |
| 854 | - * | |
| 855 | - * @param html | |
| 856 | - * com o conteudo da ferramenta | |
| 857 | - */ | |
| 858 | - criaJanelaFlutuante : function(html) { | |
| 859 | - var titulo, cabecalho, minimiza, janela; | |
| 860 | - cabecalho = function() { | |
| 861 | - }; | |
| 862 | - minimiza = function() { | |
| 863 | - i3GEO.janela.minimiza("salvaLimite"); | |
| 864 | - }; | |
| 865 | - titulo = "<div class='i3GeoTituloJanela'>" + $trad("sdados") + "</div>"; | |
| 866 | - janela = i3GEO.janela.cria("300px", "265px", "", "", "", titulo, "salvaLimite", true, "hd", cabecalho, minimiza); | |
| 867 | - $i("salvaLimite_corpo").style.backgroundColor = "white"; | |
| 868 | - $i("salvaLimite_corpo").innerHTML = html; | |
| 869 | - YAHOO.util.Event.addListener(janela[0].close, "click", i3GEO.editorGM.mudaicone); | |
| 870 | - }, | |
| 871 | - /** | |
| 872 | - * Aplica a operacao de salvar os dados no banco para o shape selecionado Executa | |
| 873 | - * admin/php/metaestat.php?funcao=mantemDadosRegiao | |
| 874 | - * | |
| 875 | - * @param boolean | |
| 876 | - * indica se as coordenadas serao salvas tambem | |
| 877 | - */ | |
| 878 | - gravaDados : function(comwkt) { | |
| 879 | - if (i3GEO.login.verificaCookieLogin() === false) { | |
| 880 | - i3GEO.janela.tempoMsg($trad("meneditor3")); | |
| 881 | - return; | |
| 882 | - } | |
| 883 | - if (!window.confirm($trad("sdados") + "?")) { | |
| 884 | - return; | |
| 885 | - } | |
| 886 | - var p, codigo_tipo_regiao = $i("i3geoCartoRegioesEditaveis").value, identificadornovo = | |
| 887 | - $i("inputIdentificadorNovoElemento").value, identificador = $i("inputIdentificadorElemento").value, nome = | |
| 888 | - $i("inputNomeNovoElemento").value, wkt = "", temp = function(retorno) { | |
| 889 | - i3GEO.editorGM.deleteSelectedShape(true); | |
| 890 | - var janela = YAHOO.i3GEO.janela.manager.find("salvaLimite"); | |
| 891 | - if (janela) { | |
| 892 | - janela.destroy(); | |
| 893 | - } | |
| 894 | - i3GEO.Interface.redesenha(); | |
| 895 | - }; | |
| 896 | - if (comwkt === true) { | |
| 897 | - wkt = i3GEO.editorGM.toWKT(i3GEO.editorGM.selectedShapes()[0]); | |
| 898 | - } else { | |
| 899 | - if (identificadornovo === identificador && $i("inputNomeElemento").value === nome) { | |
| 900 | - i3GEO.janela.tempoMsg($trad("meneditor4")); | |
| 901 | - return; | |
| 902 | - } | |
| 903 | - } | |
| 904 | - p = i3GEO.configura.locaplic + "/admin/php/metaestat.php?funcao=mantemDadosRegiao&tipo="; | |
| 905 | - cpJSON.call(p, "foo", temp, "&codigo_tipo_regiao=" + codigo_tipo_regiao | |
| 906 | - + "&identificadornovo=" | |
| 907 | - + identificadornovo | |
| 908 | - + "&identificador=" | |
| 909 | - + identificador | |
| 910 | - + "&nome=" | |
| 911 | - + nome | |
| 912 | - + "&wkt=" | |
| 913 | - + wkt); | |
| 914 | - }, | |
| 915 | - /** | |
| 916 | - * Exclui um registro do banco de dados Executa admin/php/metaestat.php?funcao=mantemDadosRegiao&tipo=excluir | |
| 917 | - */ | |
| 918 | - excluiPoligono : function() { | |
| 919 | - if (i3GEO.login.verificaCookieLogin() === false) { | |
| 920 | - i3GEO.janela.tempoMsg($trad("meneditor3")); | |
| 921 | - return; | |
| 922 | - } | |
| 923 | - if (!window.confirm($trad("excsel") + "?")) { | |
| 924 | - return; | |
| 925 | - } | |
| 926 | - var codigo_tipo_regiao = $i("i3geoCartoRegioesEditaveis").value, identificador = $i("inputIdentificadorElemento").value, temp = | |
| 927 | - function(retorno) { | |
| 928 | - i3GEO.editorGM.deleteSelectedShape(true); | |
| 929 | - var janela = YAHOO.i3GEO.janela.manager.find("salvaLimite"); | |
| 930 | - if (janela) { | |
| 931 | - janela.destroy(); | |
| 932 | - } | |
| 933 | - i3GEO.Interface.redesenha(); | |
| 934 | - }, p = i3GEO.configura.locaplic + "/admin/php/metaestat.php?funcao=mantemDadosRegiao&tipo=excluir"; | |
| 935 | - if (identificador === "") { | |
| 936 | - i3GEO.janela.tempoMsg($trad("meneditor5")); | |
| 937 | - } else { | |
| 938 | - cpJSON.call(p, "foo", temp, "&codigo_tipo_regiao=" + codigo_tipo_regiao + "&identificador=" + identificador); | |
| 939 | - } | |
| 940 | - } | |
| 941 | - }, | |
| 942 | - /** | |
| 943 | - * Funcoes que controlam o processo de edicao de atributos de um shape | |
| 944 | - */ | |
| 945 | - editarAtributos : { | |
| 946 | - aliascolunas : "", // guarda os nomes das colunas e seus aliases para permitir a criacao de novos registros | |
| 947 | - x : "", | |
| 948 | - y : "", | |
| 949 | - /** | |
| 950 | - * Ativa a ferramenta Define os eventos de onclick para abrir formulario quando o usuario clica no mapa Para cada regiao sao | |
| 951 | - * obtidas todas as variaveis cadastradas Executa i3GEO.editorGM.editarAtributos.criaJanelaFlutuante Executa | |
| 952 | - * i3GEO.editorGM.editarAtributos.comboVariaveis(); | |
| 953 | - */ | |
| 954 | - ativa : function(botao) { | |
| 955 | - if ($i("i3geoCartoRegioesEditaveis").value == "") { | |
| 956 | - i3GEO.janela.tempoMsg("Escolha uma regiao"); | |
| 957 | - return; | |
| 958 | - } | |
| 959 | - i3GEO.editorGM.mudaicone(botao); | |
| 960 | - i3GEO.eventos.adicionaEventos("MOUSECLIQUE", [ | |
| 961 | - "i3GEO.editorGM.editarAtributos.captura()" | |
| 962 | - ]); | |
| 963 | - var janela = YAHOO.i3GEO.janela.manager.find("editaAtributos"); | |
| 964 | - if (janela) { | |
| 965 | - $i("editarAtributosForm").innerHTML = ""; | |
| 966 | - } else { | |
| 967 | - i3GEO.editorGM.editarAtributos.criaJanelaFlutuante(i3GEO.editorGM.editarAtributos.html()); | |
| 968 | - i3GEO.editorGM.editarAtributos.comboVariaveis(); | |
| 969 | - } | |
| 970 | - }, | |
| 971 | - /** | |
| 972 | - * Fecha a janela de edicao | |
| 973 | - */ | |
| 974 | - desativa : function() { | |
| 975 | - var janela = YAHOO.i3GEO.janela.manager.find("editaAtributos"); | |
| 976 | - if (janela) { | |
| 977 | - janela.destroy(); | |
| 978 | - } | |
| 979 | - }, | |
| 980 | - criaJanelaFlutuante : function(html) { | |
| 981 | - var janela, titulo, cabecalho, minimiza; | |
| 982 | - cabecalho = function() { | |
| 983 | - }; | |
| 984 | - minimiza = function() { | |
| 985 | - i3GEO.janela.minimiza("editaAtributos"); | |
| 986 | - }; | |
| 987 | - titulo = "<div class='i3GeoTituloJanela'>" + $trad("atrib") + "</div>"; | |
| 988 | - janela = i3GEO.janela.cria("250px", "265px", "", "", "", titulo, "editaAtributos", false, "hd", cabecalho, minimiza); | |
| 989 | - $i("editaAtributos_corpo").style.backgroundColor = "white"; | |
| 990 | - $i("editaAtributos_corpo").innerHTML = html; | |
| 991 | - i3GEO.janela.tempoMsg($trad("meneditor6")); | |
| 992 | - YAHOO.util.Event.addListener(janela[0].close, "click", i3GEO.editorGM.mudaicone); | |
| 993 | - }, | |
| 994 | - /** | |
| 995 | - * Fornece o HTML com os objetos que receberao os componentes da ferramenta | |
| 996 | - * | |
| 997 | - * @return html | |
| 998 | - */ | |
| 999 | - html : function() { | |
| 1000 | - var ins = | |
| 1001 | - '' + '<p class="paragrafo" ><div id="editarAtributosVariaveis" ></div></p>' | |
| 1002 | - + '<p class="paragrafo" ><div id="editarAtributosMedidasVariavel" ></div></p>' | |
| 1003 | - + '<p class="paragrafo" ><div id="editarAtributosRegiao" ></div></p>' | |
| 1004 | - + '<p class="paragrafo" ><div id="editarAtributosForm" ></div></p>' | |
| 1005 | - + ''; | |
| 1006 | - return ins; | |
| 1007 | - }, | |
| 1008 | - /** | |
| 1009 | - * Monta um combo para escolha de uma variavel que sera editada Executa i3GEO.php.listaVariavel | |
| 1010 | - */ | |
| 1011 | - comboVariaveis : function() { | |
| 1012 | - var temp = | |
| 1013 | - function(dados) { | |
| 1014 | - var i, n = dados.length, ins = ''; | |
| 1015 | - ins += '<p class="paragrafo" >Escolha uma variável para editar</p>'; | |
| 1016 | - ins += | |
| 1017 | - "<select style='box-shadow:0 1px 5px gray;width:200px' onchange='i3GEO.editorGM.editarAtributos.comboMedidasVariavel(this)'><option value=''>---</option>"; | |
| 1018 | - for (i = 0; i < n; i++) { | |
| 1019 | - ins += | |
| 1020 | - "<option title='" + dados[i].descricao | |
| 1021 | - + "' value='" | |
| 1022 | - + dados[i].codigo_variavel | |
| 1023 | - + "'>" | |
| 1024 | - + dados[i].nome | |
| 1025 | - + "</option>"; | |
| 1026 | - } | |
| 1027 | - ins += "</select>"; | |
| 1028 | - $i("editarAtributosVariaveis").innerHTML = ins; | |
| 1029 | - }; | |
| 1030 | - i3GEO.php.listaVariavel(temp, "i3geo_metaestat"); | |
| 1031 | - }, | |
| 1032 | - /** | |
| 1033 | - * Monta um combo com as medidas de uma variavel Executa i3GEO.php.listaMedidaVariavel | |
| 1034 | - * | |
| 1035 | - * @param objeto | |
| 1036 | - * DOM do tipo select que contem a lista de variaveis | |
| 1037 | - */ | |
| 1038 | - comboMedidasVariavel : function(comboMedidas) { | |
| 1039 | - var temp = | |
| 1040 | - function(dados) { | |
| 1041 | - var i, n = dados.length, ins = ''; | |
| 1042 | - ins += '<p class="paragrafo" >Escolha uma medida da variável para editar</p>'; | |
| 1043 | - ins += | |
| 1044 | - "<select id='editarAtributosComboMedidas' style='box-shadow:0 1px 5px gray;width:200px' onchange=''><option value=''>---</option>"; | |
| 1045 | - for (i = 0; i < n; i++) { | |
| 1046 | - if (dados[i].esquemadb == "i3geo_metaestat" && dados[i].codigo_tipo_regiao == $i("i3geoCartoRegioesEditaveis").value) { | |
| 1047 | - ins += "<option value='" + dados[i].id_medida_variavel + "'>" + dados[i].nomemedida + "</option>"; | |
| 1048 | - } | |
| 1049 | - } | |
| 1050 | - | |
| 1051 | - ins += "</select>"; | |
| 1052 | - $i("editarAtributosMedidasVariavel").innerHTML = ins; | |
| 1053 | - }; | |
| 1054 | - if (comboMedidas.value !== "") { | |
| 1055 | - i3GEO.php.listaMedidaVariavel(comboMedidas.value, temp); | |
| 1056 | - } | |
| 1057 | - }, | |
| 1058 | - /** | |
| 1059 | - * Captura os atributos de um elemento do mapa Executa i3GEO.editorGM.editarAtributos.pegaDados(); | |
| 1060 | - */ | |
| 1061 | - captura : function() { | |
| 1062 | - if (!YAHOO.i3GEO.janela.manager.find("editaAtributos")) { | |
| 1063 | - i3GEO.editorGM.mudaicone(botao); | |
| 1064 | - return; | |
| 1065 | - } | |
| 1066 | - i3GEO.editorGM.editarAtributos.x = objposicaocursor.ddx; | |
| 1067 | - i3GEO.editorGM.editarAtributos.y = objposicaocursor.ddy; | |
| 1068 | - i3GEO.editorGM.editarAtributos.pegaDados(); | |
| 1069 | - }, | |
| 1070 | - /** | |
| 1071 | - * Obtem os dados de um elemento de uma regiao Monta o formulario para edicao Executa | |
| 1072 | - * admin/php/metaestat.php?funcao=listaAtributosMedidaVariavelXY | |
| 1073 | - */ | |
| 1074 | - pegaDados : function() { | |
| 1075 | - var p = i3GEO.configura.locaplic + "/admin/php/metaestat.php?funcao=listaAtributosMedidaVariavelXY", codigo_tipo_regiao = | |
| 1076 | - $i("i3geoCartoRegioesEditaveis").value, id_medida_variavel = $i("editarAtributosComboMedidas").value, temp = | |
| 1077 | - function(retorno) { | |
| 1078 | - var atr = retorno.atributos, i = 0, n = atr.dados.length, j = 0, idunico = "", nj = atr.aliascolunas.length, ins = | |
| 1079 | - "" + '<p class=paragrafo >Limite geográfico escolhido:</p>' | |
| 1080 | - + '<p class=paragrafo ><b>Nome: </b>' | |
| 1081 | - + retorno.regiao.nomeregiao | |
| 1082 | - + '</p>' | |
| 1083 | - + '<p class=paragrafo ><b>Código: </b>' | |
| 1084 | - + retorno.regiao.identificador_regiao | |
| 1085 | - + '</p>' | |
| 1086 | - + '<input type=hidden id="editarAtributosidentificador_regiao" value="' | |
| 1087 | - + retorno.regiao.identificador_regiao | |
| 1088 | - + '" />' | |
| 1089 | - + '<p class=paragrafo >Atributos:</p>' | |
| 1090 | - + '<input id=editarAtributosAdicionar value="Adicionar um novo" />' | |
| 1091 | - + ' <input id=editarAtributosSalvar value="Salvar" />'; | |
| 1092 | - $i("editarAtributosRegiao").innerHTML = ins; | |
| 1093 | - ins = ""; | |
| 1094 | - // registros | |
| 1095 | - for (i = 0; i < n; i++) { | |
| 1096 | - // descobre qual o indice que corresponde ao idunico do registro | |
| 1097 | - for (j = 0; j < nj; j++) { | |
| 1098 | - if (atr.aliascolunas[j] == "idunico") { | |
| 1099 | - idunico = atr.dados[i][atr.colunas[j]]; | |
| 1100 | - } | |
| 1101 | - } | |
| 1102 | - ins += | |
| 1103 | - "<hr><div><p class=paragrafo style='color:blue;cursor:pointer' onclick='i3GEO.editorGM.editarAtributos.excluir(" + idunico | |
| 1104 | - + ")' >excluir</p>"; | |
| 1105 | - // colunas | |
| 1106 | - for (j = 0; j < nj; j++) { | |
| 1107 | - if (atr.aliascolunas[j] !== "idunico") { | |
| 1108 | - ins += | |
| 1109 | - '<p class=paragrafo >' + atr.aliascolunas[j] | |
| 1110 | - + ':<br>' | |
| 1111 | - + '<input class=digitar id="idunico_' | |
| 1112 | - + idunico | |
| 1113 | - + '" value="' | |
| 1114 | - + atr.dados[i][atr.colunas[j]] | |
| 1115 | - + '" name="' | |
| 1116 | - + atr.colunas[j] | |
| 1117 | - + '" /></p>'; | |
| 1118 | - } | |
| 1119 | - } | |
| 1120 | - } | |
| 1121 | - $i("editarAtributosForm").innerHTML = ins; | |
| 1122 | - new YAHOO.widget.Button("editarAtributosAdicionar", { | |
| 1123 | - onclick : { | |
| 1124 | - fn : function() { | |
| 1125 | - var novoel = document.createElement("div"), ins = "<hr><br>"; | |
| 1126 | - for (j = 0; j < nj; j++) { | |
| 1127 | - if (atr.aliascolunas[j] !== "idunico") { | |
| 1128 | - ins += | |
| 1129 | - '<p class=paragrafo >' + atr.aliascolunas[j] | |
| 1130 | - + ' - ' | |
| 1131 | - + atr.descricao[j] | |
| 1132 | - + ':<br>' | |
| 1133 | - + '<input class=digitar id="" value="" name="' | |
| 1134 | - + atr.colunas[j] | |
| 1135 | - + '" /></p>'; | |
| 1136 | - } | |
| 1137 | - } | |
| 1138 | - ins += "<br></div>"; | |
| 1139 | - novoel.innerHTML = ins; | |
| 1140 | - $i("editarAtributosForm").appendChild(novoel); | |
| 1141 | - } | |
| 1142 | - } | |
| 1143 | - }); | |
| 1144 | - new YAHOO.widget.Button("editarAtributosSalvar", { | |
| 1145 | - onclick : { | |
| 1146 | - fn : function() { | |
| 1147 | - i3GEO.editorGM.editarAtributos.salva(); | |
| 1148 | - } | |
| 1149 | - } | |
| 1150 | - }); | |
| 1151 | - }; | |
| 1152 | - cpJSON.call(p, "foo", temp, "&codigo_tipo_regiao=" + codigo_tipo_regiao | |
| 1153 | - + "&id_medida_variavel=" | |
| 1154 | - + id_medida_variavel | |
| 1155 | - + "&x=" | |
| 1156 | - + i3GEO.editorGM.editarAtributos.x | |
| 1157 | - + "&y=" | |
| 1158 | - + i3GEO.editorGM.editarAtributos.y); | |
| 1159 | - }, | |
| 1160 | - // FIXME redesenhar as camadas que sofrerem alteracoes em funcao do salvar ou excluir | |
| 1161 | - /** | |
| 1162 | - * Exclui o valor de uma medida de variavel para o componente de uma regiao | |
| 1163 | - */ | |
| 1164 | - excluir : function(id) { | |
| 1165 | - if (i3GEO.login.verificaCookieLogin() === false) { | |
| 1166 | - i3GEO.janela.tempoMsg("Você precisa fazer login para usar essa opção"); | |
| 1167 | - return; | |
| 1168 | - } | |
| 1169 | - var p = i3GEO.configura.locaplic + "/admin/php/metaestat.php?funcao=excluiAtributosMedidaVariavel", codigo_tipo_regiao = | |
| 1170 | - $i("i3geoCartoRegioesEditaveis").value, id_medida_variavel = $i("editarAtributosComboMedidas").value, identificador_regiao = | |
| 1171 | - $i("editarAtributosidentificador_regiao").value, temp = function(retorno) { | |
| 1172 | - i3GEO.editorGM.editarAtributos.pegaDados(); | |
| 1173 | - i3GEO.janela.fechaAguarde("aguardeSalvaAtributos"); | |
| 1174 | - }; | |
| 1175 | - i3GEO.janela.AGUARDEMODAL = true; | |
| 1176 | - i3GEO.janela.abreAguarde("aguardeSalvaAtributos", "Salvando..."); | |
| 1177 | - i3GEO.janela.AGUARDEMODAL = false; | |
| 1178 | - cpJSON.call(p, "foo", temp, "&codigo_tipo_regiao=" + codigo_tipo_regiao | |
| 1179 | - + "&identificador_regiao=" | |
| 1180 | - + identificador_regiao | |
| 1181 | - + "&id_medida_variavel=" | |
| 1182 | - + id_medida_variavel | |
| 1183 | - + "&id=" | |
| 1184 | - + id); | |
| 1185 | - | |
| 1186 | - }, | |
| 1187 | - /** | |
| 1188 | - * Salva os valores digitados | |
| 1189 | - */ | |
| 1190 | - salva : function() { | |
| 1191 | - if (i3GEO.login.verificaCookieLogin() === false) { | |
| 1192 | - i3GEO.janela.tempoMsg("Você precisa fazer login para usar essa opção"); | |
| 1193 | - return; | |
| 1194 | - } | |
| 1195 | - var container = $i("editarAtributosForm"), divsT = container.getElementsByTagName("div"), n = divsT.length, i = 0, dv = "", inputs = | |
| 1196 | - "", codigo_tipo_regiao = $i("i3geoCartoRegioesEditaveis").value, id_medida_variavel = | |
| 1197 | - $i("editarAtributosComboMedidas").value, identificador_regiao = $i("editarAtributosidentificador_regiao").value, nj, j, colunas = | |
| 1198 | - [], colunasT = [], valores = [], valoresT = [], idsunicosT = [], p = | |
| 1199 | - i3GEO.configura.locaplic + "/admin/php/metaestat.php?funcao=salvaAtributosMedidaVariavel", re = | |
| 1200 | - new RegExp("idunico_", "g"), // prefixo usado para marcar o id dos elementos input que contem os valores que se quer | |
| 1201 | - // obter | |
| 1202 | - temp = function(retorno) { | |
| 1203 | - i3GEO.editorGM.editarAtributos.pegaDados(); | |
| 1204 | - i3GEO.editorGM.atualizaCamadasMetaestat(); | |
| 1205 | - i3GEO.janela.fechaAguarde("aguardeSalvaAtributos"); | |
| 1206 | - }; | |
| 1207 | - if (codigo_tipo_regiao == "") { | |
| 1208 | - i3GEO.janela.tempoMsg("Problemas com o codigo da regiao"); | |
| 1209 | - return; | |
| 1210 | - } | |
| 1211 | - if (id_medida_variavel == "") { | |
| 1212 | - i3GEO.janela.tempoMsg("Escolha uma medida"); | |
| 1213 | - return; | |
| 1214 | - } | |
| 1215 | - if (identificador_regiao == "") { | |
| 1216 | - i3GEO.janela.tempoMsg("Problemas com o identificador da regiao"); | |
| 1217 | - return; | |
| 1218 | - } | |
| 1219 | - for (i = 0; i < n; i++) { | |
| 1220 | - dv = divsT[i]; | |
| 1221 | - inputs = dv.getElementsByTagName("input"); | |
| 1222 | - nj = inputs.length; | |
| 1223 | - colunas = []; | |
| 1224 | - valores = []; | |
| 1225 | - for (j = 0; j < nj; j++) { | |
| 1226 | - colunas.push(inputs[j].name); | |
| 1227 | - valores.push(inputs[j].value); | |
| 1228 | - } | |
| 1229 | - idsunicosT.push(inputs[0].id.replace(re, '')); | |
| 1230 | - colunasT.push(colunas.join("|")); | |
| 1231 | - valoresT.push(valores.join("|")); | |
| 1232 | - } | |
| 1233 | - i3GEO.janela.AGUARDEMODAL = true; | |
| 1234 | - i3GEO.janela.abreAguarde("aguardeSalvaAtributos", "Salvando..."); | |
| 1235 | - i3GEO.janela.AGUARDEMODAL = false; | |
| 1236 | - cpJSON.call(p, "foo", temp, "&codigo_tipo_regiao=" + codigo_tipo_regiao | |
| 1237 | - + "&identificador_regiao=" | |
| 1238 | - + identificador_regiao | |
| 1239 | - + "&id_medida_variavel=" | |
| 1240 | - + id_medida_variavel | |
| 1241 | - + "&colunas=" | |
| 1242 | - + colunasT[0] | |
| 1243 | - + "&valores=" | |
| 1244 | - + valoresT.join("#") | |
| 1245 | - + "&idsunicos=" | |
| 1246 | - + idsunicosT.join("|")); | |
| 1247 | - } | |
| 1248 | - }, | |
| 1249 | - /** | |
| 1250 | - * Abre a janela de ajuda sobre a operacao dos botoes do editor | |
| 1251 | - */ | |
| 1252 | - ajuda : function() { | |
| 1253 | - var titulo, cabecalho, minimiza, html = ""; | |
| 1254 | - cabecalho = function() { | |
| 1255 | - }; | |
| 1256 | - minimiza = function() { | |
| 1257 | - i3GEO.janela.minimiza("editaAtributosAjuda"); | |
| 1258 | - }; | |
| 1259 | - titulo = "<div class='i3GeoTituloJanela'>Ajuda </div>"; | |
| 1260 | - i3GEO.janela.cria("400px", "350px", "", "", "", titulo, "editaAtributosAjuda", false, "hd", cabecalho, minimiza); | |
| 1261 | - $i("editaAtributosAjuda_corpo").style.backgroundColor = "white"; | |
| 1262 | - html += | |
| 1263 | - "<table class=lista8 >" + "<tr><td><img src='" + i3GEO.configura.locaplic | |
| 1264 | - + "/imagens/gisicons/polygon-create.png' /></td>" | |
| 1265 | - + "<td>Clique no mapa para traçar um polígono novo. Cada clique corresponde a um vértice do polígono. Para encerrar o traçado utilize um duplo clique. Após traçar um novo polígono pode-se selecioná-lo novamente e editar os vértices, se for necessário, ou mesmo apagar o polígono por completo. O novo polígono só será salvo por meio da opção específica para isso.</td></tr>" | |
| 1266 | - + "<tr><td><img src='" | |
| 1267 | - + i3GEO.configura.locaplic | |
| 1268 | - + "/imagens/gisicons/layer-import.png' /></td>" | |
| 1269 | - + "<td>Utilize essa opção para capturar os vértices de um polígono existente. O resultado da captura é uma figura que pode ser editada, ou seja, os vértices podem ser modificados de posição ou mesmo removidos. Após editar, salve o novo polígono.</td></tr>" | |
| 1270 | - + "<tr><td><img src='" | |
| 1271 | - + i3GEO.configura.locaplic | |
| 1272 | - + "/imagens/gisicons/select.png' /></td>" | |
| 1273 | - + "<td>Após ativar essa opção clique no mapa sobre uma figura existente (que tenha sido capturada ou digtalizada). A figura passará então para o estado de 'selecionada' podendo ser utilizada por outras ferramentas de edição.</td></tr>" | |
| 1274 | - + "<tr><td><img src='" | |
| 1275 | - + i3GEO.configura.locaplic | |
| 1276 | - + "/imagens/gisicons/selected-delete.png' /></td>" | |
| 1277 | - + "<td>Remove da tela a figura que estiver selecionada. Essa operação não apaga o polígono do banco de dados, apenas remove do modo de edição.</td></tr>" | |
| 1278 | - + "<tr><td><img src='" | |
| 1279 | - + i3GEO.configura.locaplic | |
| 1280 | - + "/imagens/gisicons/vector-save.png' /></td>" | |
| 1281 | - + "<td>Salva no banco de dados a figura que estiver selecionada. Essa opção altera apenas os atributos do limite geográfico, não afetando os valores armazenados em cada medida de variável.</td></tr>" | |
| 1282 | - + "<tr><td><img src='" | |
| 1283 | - + i3GEO.configura.locaplic | |
| 1284 | - + "/imagens/gisicons/annotation-form.png' /></td>" | |
| 1285 | - + "<td>Abre um formulário que permite alterar os valores de uma medida de variável relacionada a uma determinada região. Após abrir o formulário, clique no mapa sobre a região desejada, mas escolha a medida da variável primeiro. Os valores já existentes poderão então ser alterados ou podem ser adicionados novos.</td></tr>" | |
| 1286 | - + "</table>"; | |
| 1287 | - $i("editaAtributosAjuda_corpo").innerHTML = html; | |
| 1288 | - } | |
| 1289 | - }; | |
| 1290 | - | |
| 1291 | -// copia do original de pacotes/wicket | |
| 1292 | - | |
| 1293 | -/* global Wkt, google, document, window, console */ | |
| 1294 | -google.maps.Marker.prototype.type = 'marker'; | |
| 1295 | -google.maps.Polyline.prototype.type = 'polyline'; | |
| 1296 | -google.maps.Polygon.prototype.type = 'polygon'; | |
| 1297 | -google.maps.Rectangle.prototype.type = 'rectangle'; | |
| 1298 | -google.maps.Circle.prototype.type = 'circle'; | |
| 1299 | - | |
| 1300 | -/** | |
| 1301 | - * @license | |
| 1302 | - * | |
| 1303 | - * Copyright (C) 2012 K. Arthur Endsley (kaendsle@mtu.edu) Michigan Tech Research Institute (MTRI) 3600 Green Court, Suite 100, Ann Arbor, | |
| 1304 | - * MI, 48105 | |
| 1305 | - * | |
| 1306 | - * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by | |
| 1307 | - * the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | |
| 1308 | - * | |
| 1309 | - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 1310 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | |
| 1311 | - * | |
| 1312 | - * You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 1313 | - * | |
| 1314 | - */ | |
| 1315 | -(function(Wkt) { | |
| 1316 | - | |
| 1317 | - /** | |
| 1318 | - * @augments Wkt.Wkt A framework-dependent flag, set for each Wkt.Wkt() instance, that indicates whether or not a closed polygon | |
| 1319 | - * geometry should be interpreted as a rectangle. | |
| 1320 | - */ | |
| 1321 | - Wkt.Wkt.prototype.isRectangle = false; | |
| 1322 | - | |
| 1323 | - /** | |
| 1324 | - * @augments Wkt.Wkt An object of framework-dependent construction methods used to generate objects belonging to the various geometry | |
| 1325 | - * classes of the framework. | |
| 1326 | - */ | |
| 1327 | - Wkt.Wkt.prototype.construct = { | |
| 1328 | - /** | |
| 1329 | - * Creates the framework's equivalent point geometry object. | |
| 1330 | - * | |
| 1331 | - * @param config | |
| 1332 | - * {Object} An optional properties hash the object should use | |
| 1333 | - * @param component | |
| 1334 | - * {Object} An optional component to build from | |
| 1335 | - * @return {google.maps.Marker} | |
| 1336 | - */ | |
| 1337 | - point : function(config, component) { | |
| 1338 | - var c = component || this.components; | |
| 1339 | - | |
| 1340 | - config = config || {}; | |
| 1341 | - | |
| 1342 | - config.position = new google.maps.LatLng(c[0].y, c[0].x); | |
| 1343 | - | |
| 1344 | - return new google.maps.Marker(config); | |
| 1345 | - }, | |
| 1346 | - | |
| 1347 | - /** | |
| 1348 | - * Creates the framework's equivalent multipoint geometry object. | |
| 1349 | - * | |
| 1350 | - * @param config | |
| 1351 | - * {Object} An optional properties hash the object should use | |
| 1352 | - * @return {Array} Array containing multiple google.maps.Marker | |
| 1353 | - */ | |
| 1354 | - multipoint : function(config) { | |
| 1355 | - var i, c, arr; | |
| 1356 | - | |
| 1357 | - c = this.components; | |
| 1358 | - | |
| 1359 | - config = config || {}; | |
| 1360 | - | |
| 1361 | - arr = []; | |
| 1362 | - | |
| 1363 | - for (i = 0; i < c.length; i += 1) { | |
| 1364 | - arr.push(this.construct.point(config, c[i])); | |
| 1365 | - } | |
| 1366 | - | |
| 1367 | - return arr; | |
| 1368 | - }, | |
| 1369 | - | |
| 1370 | - /** | |
| 1371 | - * Creates the framework's equivalent linestring geometry object. | |
| 1372 | - * | |
| 1373 | - * @param config | |
| 1374 | - * {Object} An optional properties hash the object should use | |
| 1375 | - * @param component | |
| 1376 | - * {Object} An optional component to build from | |
| 1377 | - * @return {google.maps.Polyline} | |
| 1378 | - */ | |
| 1379 | - linestring : function(config, component) { | |
| 1380 | - var i, c; | |
| 1381 | - | |
| 1382 | - c = component || this.components; | |
| 1383 | - | |
| 1384 | - config = config || { | |
| 1385 | - editable : false | |
| 1386 | - }; | |
| 1387 | - | |
| 1388 | - config.path = []; | |
| 1389 | - | |
| 1390 | - for (i = 0; i < c.length; i += 1) { | |
| 1391 | - config.path.push(new google.maps.LatLng(c[i].y, c[i].x)); | |
| 1392 | - } | |
| 1393 | - | |
| 1394 | - return new google.maps.Polyline(config); | |
| 1395 | - }, | |
| 1396 | - | |
| 1397 | - /** | |
| 1398 | - * Creates the framework's equivalent multilinestring geometry object. | |
| 1399 | - * | |
| 1400 | - * @param config | |
| 1401 | - * {Object} An optional properties hash the object should use | |
| 1402 | - * @return {Array} Array containing multiple google.maps.Polyline instances | |
| 1403 | - */ | |
| 1404 | - multilinestring : function(config) { | |
| 1405 | - var i, c, arr; | |
| 1406 | - | |
| 1407 | - c = this.components; | |
| 1408 | - | |
| 1409 | - config = config || { | |
| 1410 | - editable : false | |
| 1411 | - }; | |
| 1412 | - | |
| 1413 | - config.path = []; | |
| 1414 | - | |
| 1415 | - arr = []; | |
| 1416 | - | |
| 1417 | - for (i = 0; i < c.length; i += 1) { | |
| 1418 | - arr.push(this.construct.linestring(config, c[i])); | |
| 1419 | - } | |
| 1420 | - | |
| 1421 | - return arr; | |
| 1422 | - }, | |
| 1423 | - | |
| 1424 | - /** | |
| 1425 | - * Creates the framework's equivalent Box or Rectangle geometry object. | |
| 1426 | - * | |
| 1427 | - * @param config | |
| 1428 | - * {Object} An optional properties hash the object should use | |
| 1429 | - * @param component | |
| 1430 | - * {Object} An optional component to build from | |
| 1431 | - * @return {google.maps.Rectangle} | |
| 1432 | - */ | |
| 1433 | - box : function(config, component) { | |
| 1434 | - var c = component || this.components; | |
| 1435 | - | |
| 1436 | - config = config || {}; | |
| 1437 | - | |
| 1438 | - config.bounds = new google.maps.LatLngBounds(new google.maps.LatLng(c[0].y, c[0].x), new google.maps.LatLng(c[1].y, c[1].x)); | |
| 1439 | - | |
| 1440 | - return new google.maps.Rectangle(config); | |
| 1441 | - }, | |
| 1442 | - | |
| 1443 | - /** | |
| 1444 | - * Creates the framework's equivalent polygon geometry object. | |
| 1445 | - * | |
| 1446 | - * @param config | |
| 1447 | - * {Object} An optional properties hash the object should use | |
| 1448 | - * @param component | |
| 1449 | - * {Object} An optional component to build from | |
| 1450 | - * @return {google.maps.Polygon} | |
| 1451 | - */ | |
| 1452 | - polygon : function(config, component) { | |
| 1453 | - var j, k, c, rings, verts; | |
| 1454 | - | |
| 1455 | - c = component || this.components; | |
| 1456 | - | |
| 1457 | - config = config || { | |
| 1458 | - editable : false | |
| 1459 | - // Editable geometry off by default | |
| 1460 | - }; | |
| 1461 | - | |
| 1462 | - config.paths = []; | |
| 1463 | - | |
| 1464 | - rings = []; | |
| 1465 | - for (j = 0; j < c.length; j += 1) { // For each ring... | |
| 1466 | - | |
| 1467 | - verts = []; | |
| 1468 | - // NOTE: We iterate to one (1) less than the Array length to skip the last vertex | |
| 1469 | - for (k = 0; k < c[j].length - 1; k += 1) { // For each vertex... | |
| 1470 | - verts.push(new google.maps.LatLng(c[j][k].y, c[j][k].x)); | |
| 1471 | - | |
| 1472 | - } // eo for each vertex | |
| 1473 | - | |
| 1474 | - if (j !== 0) { // Reverse the order of coordinates in inner rings | |
| 1475 | - if (config.reverseInnerPolygons == null || config.reverseInnerPolygons) { | |
| 1476 | - verts.reverse(); | |
| 1477 | - } | |
| 1478 | - } | |
| 1479 | - | |
| 1480 | - rings.push(verts); | |
| 1481 | - } // eo for each ring | |
| 1482 | - | |
| 1483 | - config.paths = config.paths.concat(rings); | |
| 1484 | - | |
| 1485 | - if (this.isRectangle) { | |
| 1486 | - return (function() { | |
| 1487 | - var bounds, v = 0; | |
| 1488 | - | |
| 1489 | - bounds = new google.maps.LatLngBounds(); | |
| 1490 | - | |
| 1491 | - for (v in rings[0]) { // Ought to be only 1 ring in a Rectangle | |
| 1492 | - if (rings[0].hasOwnProperty(v)) { | |
| 1493 | - bounds.extend(rings[0][v]); | |
| 1494 | - } | |
| 1495 | - } | |
| 1496 | - | |
| 1497 | - return new google.maps.Rectangle({ | |
| 1498 | - bounds : bounds | |
| 1499 | - }); | |
| 1500 | - }()); | |
| 1501 | - } else { | |
| 1502 | - return new google.maps.Polygon(config); | |
| 1503 | - } | |
| 1504 | - }, | |
| 1505 | - | |
| 1506 | - /** | |
| 1507 | - * Creates the framework's equivalent multipolygon geometry object. | |
| 1508 | - * | |
| 1509 | - * @param config | |
| 1510 | - * {Object} An optional properties hash the object should use | |
| 1511 | - * @return {Array} Array containing multiple google.maps.Polygon | |
| 1512 | - */ | |
| 1513 | - multipolygon : function(config) { | |
| 1514 | - var i, c, arr; | |
| 1515 | - | |
| 1516 | - c = this.components; | |
| 1517 | - | |
| 1518 | - config = config || { | |
| 1519 | - editable : false | |
| 1520 | - }; | |
| 1521 | - | |
| 1522 | - config.path = []; | |
| 1523 | - | |
| 1524 | - arr = []; | |
| 1525 | - | |
| 1526 | - for (i = 0; i < c.length; i += 1) { | |
| 1527 | - arr.push(this.construct.polygon(config, c[i])); | |
| 1528 | - } | |
| 1529 | - | |
| 1530 | - return arr; | |
| 1531 | - } | |
| 1532 | - | |
| 1533 | - }; | |
| 1534 | - | |
| 1535 | - /** | |
| 1536 | - * @augments Wkt.Wkt A framework-dependent deconstruction method used to generate internal geometric representations from instances of | |
| 1537 | - * framework geometry. This method uses object detection to attempt to classify members of framework geometry classes into the | |
| 1538 | - * standard WKT types. | |
| 1539 | - * @param obj | |
| 1540 | - * {Object} An instance of one of the framework's geometry classes | |
| 1541 | - * @param multiFlag | |
| 1542 | - * {Boolean} If true, then the deconstructor will be forced to return a MultiGeometry (multipoint, multilinestring or | |
| 1543 | - * multipolygon) | |
| 1544 | - * @return {Object} A hash of the 'type' and 'components' thus derived, plus the WKT string of the feature. | |
| 1545 | - */ | |
| 1546 | - Wkt.Wkt.prototype.deconstruct = | |
| 1547 | - function(obj, multiFlag) { | |
| 1548 | - var features, i, j, verts, rings, sign, tmp, response, lat, lng; | |
| 1549 | - | |
| 1550 | - // Shortcut to signed area function (determines clockwise vs counter-clock) | |
| 1551 | - if (google.maps.geometry) { | |
| 1552 | - sign = google.maps.geometry.spherical.computeSignedArea; | |
| 1553 | - } | |
| 1554 | - ; | |
| 1555 | - | |
| 1556 | - // google.maps.LatLng ////////////////////////////////////////////////////// | |
| 1557 | - if (obj.constructor === google.maps.LatLng) { | |
| 1558 | - | |
| 1559 | - response = { | |
| 1560 | - type : 'point', | |
| 1561 | - components : [ | |
| 1562 | - { | |
| 1563 | - x : obj.lng(), | |
| 1564 | - y : obj.lat() | |
| 1565 | - } | |
| 1566 | - ] | |
| 1567 | - }; | |
| 1568 | - return response; | |
| 1569 | - } | |
| 1570 | - | |
| 1571 | - // google.maps.Point ////////////////////////////////////////////////////// | |
| 1572 | - if (obj.constructor === google.maps.Point) { | |
| 1573 | - response = { | |
| 1574 | - type : 'point', | |
| 1575 | - components : [ | |
| 1576 | - { | |
| 1577 | - x : obj.x, | |
| 1578 | - y : obj.y | |
| 1579 | - } | |
| 1580 | - ] | |
| 1581 | - }; | |
| 1582 | - return response; | |
| 1583 | - } | |
| 1584 | - | |
| 1585 | - // google.maps.Marker ////////////////////////////////////////////////////// | |
| 1586 | - if (obj.constructor === google.maps.Marker) { | |
| 1587 | - response = { | |
| 1588 | - type : 'point', | |
| 1589 | - components : [ | |
| 1590 | - { | |
| 1591 | - x : obj.getPosition().lng(), | |
| 1592 | - y : obj.getPosition().lat() | |
| 1593 | - } | |
| 1594 | - ] | |
| 1595 | - }; | |
| 1596 | - return response; | |
| 1597 | - } | |
| 1598 | - | |
| 1599 | - // google.maps.Polyline //////////////////////////////////////////////////// | |
| 1600 | - if (obj.constructor === google.maps.Polyline) { | |
| 1601 | - | |
| 1602 | - verts = []; | |
| 1603 | - for (i = 0; i < obj.getPath().length; i += 1) { | |
| 1604 | - tmp = obj.getPath().getAt(i); | |
| 1605 | - verts.push({ | |
| 1606 | - x : tmp.lng(), | |
| 1607 | - y : tmp.lat() | |
| 1608 | - }); | |
| 1609 | - } | |
| 1610 | - response = { | |
| 1611 | - type : 'linestring', | |
| 1612 | - components : verts | |
| 1613 | - }; | |
| 1614 | - return response; | |
| 1615 | - | |
| 1616 | - } | |
| 1617 | - | |
| 1618 | - // google.maps.Polygon ///////////////////////////////////////////////////// | |
| 1619 | - if (obj.constructor === google.maps.Polygon) { | |
| 1620 | - | |
| 1621 | - rings = []; | |
| 1622 | - | |
| 1623 | - if (multiFlag === undefined) { | |
| 1624 | - multiFlag = (function() { | |
| 1625 | - var areas, l; | |
| 1626 | - | |
| 1627 | - l = obj.getPaths().length; | |
| 1628 | - if (l <= 1) { // Trivial; this is a single polygon | |
| 1629 | - return false; | |
| 1630 | - } | |
| 1631 | - | |
| 1632 | - if (l === 2) { | |
| 1633 | - // If clockwise*clockwise or counter*counter, i.e. | |
| 1634 | - // (-1)*(-1) or (1)*(1), then result would be positive | |
| 1635 | - if (sign(obj.getPaths().getAt(0)) * sign(obj.getPaths().getAt(1)) < 0) { | |
| 1636 | - return false; // Most likely single polygon with 1 hole | |
| 1637 | - } | |
| 1638 | - | |
| 1639 | - return true; | |
| 1640 | - } | |
| 1641 | - | |
| 1642 | - // Must be longer than 3 polygons at this point... | |
| 1643 | - areas = obj.getPaths().getArray().map(function(k) { | |
| 1644 | - return sign(k) / Math.abs(sign(k)); // Unit normalization (outputs 1 or -1) | |
| 1645 | - }); | |
| 1646 | - | |
| 1647 | - // If two clockwise or two counter-clockwise rings are found | |
| 1648 | - // (at different indices)... | |
| 1649 | - if (areas.indexOf(areas[0]) !== areas.lastIndexOf(areas[0])) { | |
| 1650 | - multiFlag = true; // Flag for holes in one or more polygons | |
| 1651 | - return true; | |
| 1652 | - } | |
| 1653 | - | |
| 1654 | - return false; | |
| 1655 | - | |
| 1656 | - }()); | |
| 1657 | - } | |
| 1658 | - | |
| 1659 | - for (i = 0; i < obj.getPaths().length; i += 1) { // For each polygon (ring)... | |
| 1660 | - tmp = obj.getPaths().getAt(i); | |
| 1661 | - verts = []; | |
| 1662 | - for (j = 0; j < obj.getPaths().getAt(i).length; j += 1) { // For each vertex... | |
| 1663 | - verts.push({ | |
| 1664 | - x : tmp.getAt(j).lng(), | |
| 1665 | - y : tmp.getAt(j).lat() | |
| 1666 | - }); | |
| 1667 | - | |
| 1668 | - } | |
| 1669 | - | |
| 1670 | - if (!tmp.getAt(tmp.length - 1).equals(tmp.getAt(0))) { | |
| 1671 | - if (i % 2 !== 0) { // In inner rings, coordinates are reversed... | |
| 1672 | - verts.unshift({ // Add the first coordinate again for closure | |
| 1673 | - x : tmp.getAt(tmp.length - 1).lng(), | |
| 1674 | - y : tmp.getAt(tmp.length - 1).lat() | |
| 1675 | - }); | |
| 1676 | - | |
| 1677 | - } else { | |
| 1678 | - verts.push({ // Add the first coordinate again for closure | |
| 1679 | - x : tmp.getAt(0).lng(), | |
| 1680 | - y : tmp.getAt(0).lat() | |
| 1681 | - }); | |
| 1682 | - | |
| 1683 | - } | |
| 1684 | - | |
| 1685 | - } | |
| 1686 | - | |
| 1687 | - if (obj.getPaths().length > 1 && i > 0) { | |
| 1688 | - // If this and the last ring have the same signs... | |
| 1689 | - if (sign(obj.getPaths().getAt(i)) > 0 && sign(obj.getPaths().getAt(i - 1)) > 0 | |
| 1690 | - || sign(obj.getPaths().getAt(i)) < 0 | |
| 1691 | - && sign(obj.getPaths().getAt(i - 1)) < 0 | |
| 1692 | - && !multiFlag) { | |
| 1693 | - // ...They must both be inner rings (or both be outer rings, in a multipolygon) | |
| 1694 | - verts = [ | |
| 1695 | - verts | |
| 1696 | - ]; // Wrap multipolygons once more (collection) | |
| 1697 | - } | |
| 1698 | - | |
| 1699 | - } | |
| 1700 | - | |
| 1701 | - if (i % 2 !== 0) { // In inner rings, coordinates are reversed... | |
| 1702 | - verts.reverse(); | |
| 1703 | - } | |
| 1704 | - rings.push(verts); | |
| 1705 | - } | |
| 1706 | - | |
| 1707 | - response = { | |
| 1708 | - type : (multiFlag) ? 'multipolygon' : 'polygon', | |
| 1709 | - components : rings | |
| 1710 | - }; | |
| 1711 | - return response; | |
| 1712 | - | |
| 1713 | - } | |
| 1714 | - | |
| 1715 | - // google.maps.Circle ////////////////////////////////////////////////////// | |
| 1716 | - if (obj.constructor === google.maps.Circle) { | |
| 1717 | - var point = obj.getCenter(); | |
| 1718 | - var radius = obj.getRadius(); | |
| 1719 | - verts = []; | |
| 1720 | - var d2r = Math.PI / 180; // degrees to radians | |
| 1721 | - var r2d = 180 / Math.PI; // radians to degrees | |
| 1722 | - radius = radius / 1609; // meters to miles | |
| 1723 | - var earthsradius = 3963; // 3963 is the radius of the earth in miles | |
| 1724 | - var num_seg = 32; // number of segments used to approximate a circle | |
| 1725 | - var rlat = (radius / earthsradius) * r2d; | |
| 1726 | - var rlng = rlat / Math.cos(point.lat() * d2r); | |
| 1727 | - | |
| 1728 | - for (var n = 0; n <= num_seg; n++) { | |
| 1729 | - var theta = Math.PI * (n / (num_seg / 2)); | |
| 1730 | - lng = point.lng() + (rlng * Math.cos(theta)); // center a + radius x * cos(theta) | |
| 1731 | - lat = point.lat() + (rlat * Math.sin(theta)); // center b + radius y * sin(theta) | |
| 1732 | - verts.push({ | |
| 1733 | - x : lng, | |
| 1734 | - y : lat | |
| 1735 | - }); | |
| 1736 | - } | |
| 1737 | - | |
| 1738 | - response = { | |
| 1739 | - type : 'polygon', | |
| 1740 | - components : [ | |
| 1741 | - verts | |
| 1742 | - ] | |
| 1743 | - }; | |
| 1744 | - | |
| 1745 | - return response; | |
| 1746 | - | |
| 1747 | - } | |
| 1748 | - | |
| 1749 | - // google.maps.LatLngBounds /////////////////////////////////////////////////// | |
| 1750 | - if (obj.constructor === google.maps.LatLngBounds) { | |
| 1751 | - | |
| 1752 | - tmp = obj; | |
| 1753 | - verts = []; | |
| 1754 | - verts.push({ // NW corner | |
| 1755 | - x : tmp.getSouthWest().lng(), | |
| 1756 | - y : tmp.getNorthEast().lat() | |
| 1757 | - }); | |
| 1758 | - | |
| 1759 | - verts.push({ // NE corner | |
| 1760 | - x : tmp.getNorthEast().lng(), | |
| 1761 | - y : tmp.getNorthEast().lat() | |
| 1762 | - }); | |
| 1763 | - | |
| 1764 | - verts.push({ // SE corner | |
| 1765 | - x : tmp.getNorthEast().lng(), | |
| 1766 | - y : tmp.getSouthWest().lat() | |
| 1767 | - }); | |
| 1768 | - | |
| 1769 | - verts.push({ // SW corner | |
| 1770 | - x : tmp.getSouthWest().lng(), | |
| 1771 | - y : tmp.getSouthWest().lat() | |
| 1772 | - }); | |
| 1773 | - | |
| 1774 | - verts.push({ // NW corner (again, for closure) | |
| 1775 | - x : tmp.getSouthWest().lng(), | |
| 1776 | - y : tmp.getNorthEast().lat() | |
| 1777 | - }); | |
| 1778 | - | |
| 1779 | - response = { | |
| 1780 | - type : 'polygon', | |
| 1781 | - isRectangle : true, | |
| 1782 | - components : [ | |
| 1783 | - verts | |
| 1784 | - ] | |
| 1785 | - }; | |
| 1786 | - | |
| 1787 | - return response; | |
| 1788 | - | |
| 1789 | - } | |
| 1790 | - | |
| 1791 | - // google.maps.Rectangle /////////////////////////////////////////////////// | |
| 1792 | - if (obj.constructor === google.maps.Rectangle) { | |
| 1793 | - | |
| 1794 | - tmp = obj.getBounds(); | |
| 1795 | - verts = []; | |
| 1796 | - verts.push({ // NW corner | |
| 1797 | - x : tmp.getSouthWest().lng(), | |
| 1798 | - y : tmp.getNorthEast().lat() | |
| 1799 | - }); | |
| 1800 | - | |
| 1801 | - verts.push({ // NE corner | |
| 1802 | - x : tmp.getNorthEast().lng(), | |
| 1803 | - y : tmp.getNorthEast().lat() | |
| 1804 | - }); | |
| 1805 | - | |
| 1806 | - verts.push({ // SE corner | |
| 1807 | - x : tmp.getNorthEast().lng(), | |
| 1808 | - y : tmp.getSouthWest().lat() | |
| 1809 | - }); | |
| 1810 | - | |
| 1811 | - verts.push({ // SW corner | |
| 1812 | - x : tmp.getSouthWest().lng(), | |
| 1813 | - y : tmp.getSouthWest().lat() | |
| 1814 | - }); | |
| 1815 | - | |
| 1816 | - verts.push({ // NW corner (again, for closure) | |
| 1817 | - x : tmp.getSouthWest().lng(), | |
| 1818 | - y : tmp.getNorthEast().lat() | |
| 1819 | - }); | |
| 1820 | - | |
| 1821 | - response = { | |
| 1822 | - type : 'polygon', | |
| 1823 | - isRectangle : true, | |
| 1824 | - components : [ | |
| 1825 | - verts | |
| 1826 | - ] | |
| 1827 | - }; | |
| 1828 | - | |
| 1829 | - return response; | |
| 1830 | - | |
| 1831 | - } | |
| 1832 | - | |
| 1833 | - // google.maps.Data Geometry Types ///////////////////////////////////////////////////// | |
| 1834 | - | |
| 1835 | - // google.maps.Data.Feature ///////////////////////////////////////////////////// | |
| 1836 | - if (obj.constructor === google.maps.Data.Feature) { | |
| 1837 | - return this.deconstruct.call(this, obj.getGeometry()); | |
| 1838 | - } | |
| 1839 | - | |
| 1840 | - // google.maps.Data.Point ///////////////////////////////////////////////////// | |
| 1841 | - if (obj.constructor === google.maps.Data.Point) { | |
| 1842 | - // console.log('It is a google.maps.Data.Point'); | |
| 1843 | - response = { | |
| 1844 | - type : 'point', | |
| 1845 | - components : [ | |
| 1846 | - { | |
| 1847 | - x : obj.get().lng(), | |
| 1848 | - y : obj.get().lat() | |
| 1849 | - } | |
| 1850 | - ] | |
| 1851 | - }; | |
| 1852 | - return response; | |
| 1853 | - } | |
| 1854 | - | |
| 1855 | - // google.maps.Data.LineString ///////////////////////////////////////////////////// | |
| 1856 | - if (obj.constructor === google.maps.Data.LineString) { | |
| 1857 | - verts = []; | |
| 1858 | - // console.log('It is a google.maps.Data.LineString'); | |
| 1859 | - for (i = 0; i < obj.getLength(); i += 1) { | |
| 1860 | - vertex = obj.getAt(i); | |
| 1861 | - verts.push({ | |
| 1862 | - x : vertex.lng(), | |
| 1863 | - y : vertex.lat() | |
| 1864 | - }); | |
| 1865 | - } | |
| 1866 | - response = { | |
| 1867 | - type : 'linestring', | |
| 1868 | - components : verts | |
| 1869 | - }; | |
| 1870 | - return response; | |
| 1871 | - } | |
| 1872 | - | |
| 1873 | - // google.maps.Data.Polygon ///////////////////////////////////////////////////// | |
| 1874 | - if (obj.constructor === google.maps.Data.Polygon) { | |
| 1875 | - var rings = []; | |
| 1876 | - // console.log('It is a google.maps.Data.Polygon'); | |
| 1877 | - for (i = 0; i < obj.getLength(); i += 1) { // For each ring... | |
| 1878 | - ring = obj.getAt(i); | |
| 1879 | - var verts = []; | |
| 1880 | - for (j = 0; j < ring.getLength(); j += 1) { // For each vertex... | |
| 1881 | - vertex = ring.getAt(j); | |
| 1882 | - verts.push({ | |
| 1883 | - x : vertex.lng(), | |
| 1884 | - y : vertex.lat() | |
| 1885 | - }); | |
| 1886 | - } | |
| 1887 | - verts.push({ | |
| 1888 | - x : ring.getAt(0).lng(), | |
| 1889 | - y : ring.getAt(0).lat() | |
| 1890 | - }); | |
| 1891 | - | |
| 1892 | - rings.push(verts); | |
| 1893 | - } | |
| 1894 | - response = { | |
| 1895 | - type : 'polygon', | |
| 1896 | - components : rings | |
| 1897 | - }; | |
| 1898 | - | |
| 1899 | - return response; | |
| 1900 | - } | |
| 1901 | - | |
| 1902 | - // google.maps.Data.MultiPoint ///////////////////////////////////////////////////// | |
| 1903 | - if (obj.constructor === google.maps.Data.MultiPoint) { | |
| 1904 | - verts = []; | |
| 1905 | - for (i = 0; i < obj.getLength(); i += 1) { | |
| 1906 | - vertex = obj.getAt(i); | |
| 1907 | - verts.push([ | |
| 1908 | - { | |
| 1909 | - x : vertex.lng(), | |
| 1910 | - y : vertex.lat() | |
| 1911 | - } | |
| 1912 | - ]); | |
| 1913 | - } | |
| 1914 | - response = { | |
| 1915 | - type : 'multipoint', | |
| 1916 | - components : verts | |
| 1917 | - }; | |
| 1918 | - return response; | |
| 1919 | - } | |
| 1920 | - | |
| 1921 | - // google.maps.Data.MultiLineString ///////////////////////////////////////////////////// | |
| 1922 | - if (obj.constructor === google.maps.Data.MultiLineString) { | |
| 1923 | - linestrings = []; | |
| 1924 | - for (i = 0; i < obj.getLength(); i += 1) { | |
| 1925 | - verts = []; | |
| 1926 | - var linestring = obj.getAt(i); | |
| 1927 | - for (j = 0; j < linestring.getLength(); j += 1) { | |
| 1928 | - vertex = linestring.getAt(j); | |
| 1929 | - verts.push({ | |
| 1930 | - x : vertex.lng(), | |
| 1931 | - y : vertex.lat() | |
| 1932 | - }); | |
| 1933 | - } | |
| 1934 | - linestrings.push(verts); | |
| 1935 | - } | |
| 1936 | - response = { | |
| 1937 | - type : 'multilinestring', | |
| 1938 | - components : linestrings | |
| 1939 | - }; | |
| 1940 | - return response; | |
| 1941 | - } | |
| 1942 | - | |
| 1943 | - // google.maps.Data.MultiPolygon ///////////////////////////////////////////////////// | |
| 1944 | - if (obj.constructor === google.maps.Data.MultiPolygon) { | |
| 1945 | - | |
| 1946 | - var k = 0, polygons = []; | |
| 1947 | - | |
| 1948 | - // console.log('It is a google.maps.Data.MultiPolygon'); | |
| 1949 | - for (k = 0; k < obj.getLength(); k += 1) { // For each multipolygon | |
| 1950 | - var polygon = obj.getAt(k); | |
| 1951 | - var rings = []; | |
| 1952 | - for (i = 0; i < polygon.getLength(); i += 1) { // For each ring... | |
| 1953 | - ring = polygon.getAt(i); | |
| 1954 | - var verts = []; | |
| 1955 | - for (j = 0; j < ring.getLength(); j += 1) { // For each vertex... | |
| 1956 | - vertex = ring.getAt(j); | |
| 1957 | - verts.push({ | |
| 1958 | - x : vertex.lng(), | |
| 1959 | - y : vertex.lat() | |
| 1960 | - }); | |
| 1961 | - } | |
| 1962 | - verts.push({ | |
| 1963 | - x : ring.getAt(0).lng(), | |
| 1964 | - y : ring.getAt(0).lat() | |
| 1965 | - }); | |
| 1966 | - | |
| 1967 | - rings.push(verts); | |
| 1968 | - } | |
| 1969 | - polygons.push(rings); | |
| 1970 | - } | |
| 1971 | - | |
| 1972 | - response = { | |
| 1973 | - type : 'multipolygon', | |
| 1974 | - components : polygons | |
| 1975 | - }; | |
| 1976 | - return response; | |
| 1977 | - } | |
| 1978 | - | |
| 1979 | - // google.maps.Data.GeometryCollection ///////////////////////////////////////////////////// | |
| 1980 | - if (obj.constructor === google.maps.Data.GeometryCollection) { | |
| 1981 | - | |
| 1982 | - var objects = []; | |
| 1983 | - for (k = 0; k < obj.getLength(); k += 1) { // For each multipolygon | |
| 1984 | - var object = obj.getAt(k); | |
| 1985 | - objects.push(this.deconstruct.call(this, object)); | |
| 1986 | - } | |
| 1987 | - // console.log('It is a google.maps.Data.GeometryCollection', objects); | |
| 1988 | - response = { | |
| 1989 | - type : 'geometrycollection', | |
| 1990 | - components : objects | |
| 1991 | - }; | |
| 1992 | - return response; | |
| 1993 | - } | |
| 1994 | - | |
| 1995 | - // Array /////////////////////////////////////////////////////////////////// | |
| 1996 | - if (Wkt.isArray(obj)) { | |
| 1997 | - features = []; | |
| 1998 | - | |
| 1999 | - for (i = 0; i < obj.length; i += 1) { | |
| 2000 | - features.push(this.deconstruct.call(this, obj[i], true)); | |
| 2001 | - } | |
| 2002 | - | |
| 2003 | - response = { | |
| 2004 | - | |
| 2005 | - type : (function() { | |
| 2006 | - var k, type = obj[0].constructor; | |
| 2007 | - | |
| 2008 | - for (k = 0; k < obj.length; k += 1) { | |
| 2009 | - // Check that all items have the same constructor as the first item | |
| 2010 | - if (obj[k].constructor !== type) { | |
| 2011 | - // If they don't, type is heterogeneous geometry collection | |
| 2012 | - return 'geometrycollection'; | |
| 2013 | - } | |
| 2014 | - } | |
| 2015 | - | |
| 2016 | - switch (type) { | |
| 2017 | - case google.maps.Marker: | |
| 2018 | - return 'multipoint'; | |
| 2019 | - case google.maps.Polyline: | |
| 2020 | - return 'multilinestring'; | |
| 2021 | - case google.maps.Polygon: | |
| 2022 | - return 'multipolygon'; | |
| 2023 | - default: | |
| 2024 | - return 'geometrycollection'; | |
| 2025 | - } | |
| 2026 | - | |
| 2027 | - }()), | |
| 2028 | - components : (function() { | |
| 2029 | - // Pluck the components from each Wkt | |
| 2030 | - var i, comps; | |
| 2031 | - | |
| 2032 | - comps = []; | |
| 2033 | - for (i = 0; i < features.length; i += 1) { | |
| 2034 | - if (features[i].components) { | |
| 2035 | - comps.push(features[i].components); | |
| 2036 | - } | |
| 2037 | - } | |
| 2038 | - | |
| 2039 | - return { | |
| 2040 | - "comps" : comps | |
| 2041 | - }; | |
| 2042 | - }()) | |
| 2043 | - | |
| 2044 | - }; | |
| 2045 | - response.components = response.components.comps; | |
| 2046 | - return response; | |
| 2047 | - | |
| 2048 | - } | |
| 2049 | - }; | |
| 2050 | -}(Wkt || require('./wicket'))); |
| ... | ... | @@ -1 +0,0 @@ |
| 1 | -if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.editorGM={iconePonto:function(sel){if(sel){return i3GEO.configura.locaplic+"/imagens/google/symbol_middot_y.png"}else{return i3GEO.configura.locaplic+"/imagens/google/symbol_middot.png"}},aguarde:"",iddiv:"",drawingManager:"",selectedShape:null,regioestemas:{},temasregioes:{},descregioes:[],inicia:function(iddiv){var i,n,ics;i3GEO.editorGM.iddiv=iddiv;$i(iddiv).innerHTML=i3GEO.editorGM.html();ics=$i(iddiv).getElementsByTagName("button");n=ics.length;i3GEO.editorGM.comboRegiaoEditavel();for(i=0;i<n;i++){ics[i].style.backgroundColor="white";ics[i].className="iconeGuiaMovel";ics[i].onmouseout=function(){this.className="iconeGuiaMovel iconeGuiaMovelMouseOut"};ics[i].onmouseover=function(){this.className="iconeGuiaMovel iconeGuiaMovelMouseOver"};ics[i].style.backgroundImage="none";ics[i].style.height="32px";ics[i].style.width="32px";ics[i].style.border="1px solid gray";ics[i].style.margin="0px"}i3GEO.editorGM.drawingManager=new google.maps.drawing.DrawingManager({drawingMode:google.maps.drawing.OverlayType.POLYGON,drawingControl:false,drawingControlOptions:{position:google.maps.ControlPosition.TOP_CENTER,drawingModes:[google.maps.drawing.OverlayType.POLYGON,google.maps.drawing.OverlayType.MARKER,google.maps.drawing.OverlayType.POLYLINE]},markerOptions:{icon:i3GEO.editorGM.iconePonto(),clickable:true,zIndex:1,draggable:true,tema:"",colunaid:"",valorid:"",colunanome:"",valornome:"",editable:false},polygonOptions:{fillColor:'#ffff00',fillOpacity:.5,strokeWeight:2,clickable:true,zIndex:1,editable:true,tema:"",colunaid:"",valorid:"",colunanome:"",valornome:""}});i3GEO.editorGM.drawingManager.setMap(i3GeoMap);i3GEO.editorGM.drawingManager.setDrawingMode(null);google.maps.event.addListener(i3GEO.editorGM.drawingManager,'overlaycomplete',function(e){i3GEO.editorGM.drawingManager.setDrawingMode(null);i3GEO.editorGM.mudaicone();var newShape=e.overlay;newShape.type=e.type;newShape.tema=$i("i3geoCartoRegioesEditaveis").value;newShape.colunaid="";newShape.valorid="";newShape.colunanome="";newShape.valornome="";google.maps.event.addListener(newShape,'click',function(){i3GEO.editorGM.setSelection(newShape)});i3GEO.editorGM.setSelection(newShape);i3GEO.desenho.googlemaps.shapes.push(newShape)});google.maps.event.addListener(i3GEO.editorGM.drawingManager,'drawingmode_changed',i3GEO.editorGM.clearSelection);google.maps.event.addListener(i3GeoMap,'click',i3GEO.editorGM.clearSelection)},atualizaCamadasMetaestat:function(){var p=i3GEO.configura.locaplic+"/ferramentas/metaestat/analise.php?funcao=LISTACAMADASMETAESTAT&g_sid="+i3GEO.configura.sid,temp=function(retorno){var n=retorno.data.length,i;for(i=0;i<n;i++){i3GEO.Interface.atualizaTema("",retorno.data[i])}};cpJSON.call(p,"foo",temp)},html:function(){var ins='<div style=margin-left:5px >'+' <button title="'+$trad("dpol")+'" onclick="i3GEO.editorGM.digitalizaPol(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/polygon-create.png" /></button>'+' <button title="'+$trad("dponto")+'" onclick="i3GEO.editorGM.digitalizaPt(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/point-create.png" /></button>'+' <button title="'+$trad("capturar")+'" onclick="i3GEO.editorGM.capturaPoligonoTema.ativa(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/layer-import.png" /></button>'+' <button title="'+$trad("d24t")+'" onclick="i3GEO.editorGM.seleciona(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/select.png" /></button>'+' <button title="'+$trad("studo")+'" onclick="i3GEO.editorGM.selectAll(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/selectall.png" /></button>'+' <button title="'+$trad("excsel")+'" onclick="i3GEO.editorGM.deleteSelectedShape()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/selected-delete.png" /></button>'+' <button title="'+$trad("salvexc")+'" onclick="i3GEO.editorGM.salvaLimite.inicia()"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/vector-save.png" /></button>'+' <button title="'+$trad("edatrib")+'" onclick="i3GEO.editorGM.editarAtributos.ativa(this)"><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/annotation-form.png" /></button>'+' <button title="'+$trad("s1")+'" onmousedown="i3GEO.editorGM.mudaicone()" onclick="i3GEO.editorGM.ajuda()" ><img src="'+i3GEO.configura.locaplic+'/imagens/gisicons/help-contents.png" /></button>'+' <br><div id="i3geoCartoRegioesEditaveisDiv" ><img style="display:block;z-index:2" src="'+i3GEO.configura.locaplic+'/imagens/aguarde.gif" /></div></div>';return ins},ativaFoco:function(){i3GEO.editorGM.mudaicone();i3GEO.Interface.googlemaps.recalcPar()},setSelection:function(shape){if(shape.setEditable){shape.setEditable(!shape.editable)}else{shape.editable=true;shape.setIcon({url:i3GEO.editorGM.iconePonto(true)})}},clearSelection:function(){var i,n=i3GEO.desenho.googlemaps.shapes.length;for(i=0;i<n;i++){if(i3GEO.desenho.googlemaps.shapes[i]!=""&&i3GEO.desenho.googlemaps.shapes[i].setEditable){i3GEO.desenho.googlemaps.shapes[i].setEditable(false)}else if(i3GEO.desenho.googlemaps.shapes[i]!=""){i3GEO.desenho.googlemaps.shapes[i].editable=false;if(i3GEO.desenho.googlemaps.shapes[i].setIcon){i3GEO.desenho.googlemaps.shapes[i].setIcon({url:i3GEO.editorGM.iconePonto(false)})}}}},selectAll:function(){var i,n=i3GEO.desenho.googlemaps.shapes.length;for(i=0;i<n;i++){if(i3GEO.desenho.googlemaps.shapes[i]!=""&&i3GEO.desenho.googlemaps.shapes[i].setEditable){i3GEO.desenho.googlemaps.shapes[i].setEditable(true)}else if(i3GEO.desenho.googlemaps.shapes[i]!=""){i3GEO.desenho.googlemaps.shapes[i].editable=true;i3GEO.desenho.googlemaps.shapes[i].setIcon({url:i3GEO.editorGM.iconePonto(true)})}}},deleteSelectedShape:function(naoconfirma){i3GEO.janela.tempoMsg($trad("meneditor1"));if(!naoconfirma){naoconfirma=false}var i,n=i3GEO.desenho.googlemaps.shapes.length;if(n>0){if(naoconfirma===false){var x=window.confirm($trad("excsel")+"?")}else{x=true}if(x){for(i=0;i<n;i++){if(i3GEO.desenho.googlemaps.shapes[i]!=""&&i3GEO.desenho.googlemaps.shapes[i].editable&&i3GEO.desenho.googlemaps.shapes[i].editable===true){i3GEO.desenho.googlemaps.shapes[i].setMap(null);i3GEO.desenho.googlemaps.shapes[i]=""}}}}else{i3GEO.janela.tempoMsg($trad("selum"))}},selectedShapes:function(){var i,s=[],n=i3GEO.desenho.googlemaps.shapes.length;for(i=0;i<n;i++){if(i3GEO.desenho.googlemaps.shapes[i]!=""&&i3GEO.desenho.googlemaps.shapes[i].editable===true){s.push(i3GEO.desenho.googlemaps.shapes[i])}}return s},getCoordenadas:function(){var coordenadas=[],lista=[],n=i3GEO.desenho.googlemaps.shapes.length,tipo="",ps,nps,j,p,i,r;for(i=0;i<n;i++){coordenadas=[];if(i3GEO.desenho.googlemaps.shapes[i]!=""&&i3GEO.desenho.googlemaps.shapes[i].editable===true){if(tipo==""){tipo=i3GEO.desenho.googlemaps.shapes[i].type}ps=i3GEO.desenho.googlemaps.shapes[i].getPath();nps=ps.getLength();for(j=0;j<nps;j++){p=ps.getAt(j);coordenadas.push([p.lng()+" "+p.lat()])}lista.push(coordenadas)}}r={"tipo":tipo,"coordenadas":lista};return r},toWKT:function(obj){var wkt=new Wkt.Wkt();wkt.fromObject(obj);return wkt.write()},merge:function(geoms){var n=geoms.length,w=new Wkt.Wkt(),g,m,i;w.read(geoms[0].toString());if(n>1){for(i=1;i<n;i++){g=geoms[i].toString();m=new Wkt.Wkt();m.read(g);w.merge(m)}}return w.write()},capturaPoligonoTema:{ativa:function(botao){i3GEO.editorGM.mudaicone(botao);i3GEO.eventos.cliquePerm.desativa();i3GEO.eventos.adicionaEventos("MOUSECLIQUE",["i3GEO.editorGM.capturaPoligonoTema.captura()"])},desativa:function(){},captura:function(){var temp,tema="",regiao="",p,par,aguarde=$i("i3GEOjanelaEditor_imagemCabecalho");if(!$i("i3geoCartoRegioesEditaveis")){i3GEO.eventos.removeEventos("MOUSECLIQUE",["i3GEO.editorGM.capturaPoligonoTema.captura()"])}else{temp=function(retorno){var temp,n,i,WicketWkt,wkt="",colunaid="",valorid="",colunanome="",valornome="",aguarde=$i("i3GEOjanelaEditor_imagemCabecalho");if(i3GEO.editorGM.descregioes["a_"+regiao]["identificador"]){colunaid=i3GEO.editorGM.descregioes["a_"+regiao]["identificador"]}if(i3GEO.editorGM.descregioes["a_"+regiao]["colunanomeregiao"]){colunanome=i3GEO.editorGM.descregioes["a_"+regiao]["colunanomeregiao"]}if(aguarde){aguarde.style.visibility="hidden"}temp=retorno.data[0].resultado[0];if(temp===" "){i3GEO.janela.tempoMsg($trad("meneditor2"));return}i3GEO.editorGM.mudaicone();n=temp.length;for(i=0;i<n;i++){if(temp[i].alias=="wkt"){wkt=temp[i].valor}if(temp[i].alias==colunaid||temp[i].item==colunaid){valorid=temp[i].valor}if(temp[i].alias==colunanome||temp[i].item==colunanome){valornome=temp[i].valor}}WicketWkt=new Wkt.Wkt();try{WicketWkt.read(wkt)}catch(e1){try{wkt.read(wkt.replace('\n','').replace('\r','').replace('\t',''))}catch(e2){if(e2.name==='WKTError'){alert('Wicket could not understand the WKT string you entered. Check that you have parentheses balanced, and try removing tabs and newline characters.');return}}}obj=WicketWkt.toObject(i3GeoMap.defaults);i3GEO.editorGM.adicionaPoligonos(obj,tema,colunaid,valorid,colunanome,valornome);i3GEO.eventos.MOUSECLIQUE=[]};regiao=$i("i3geoCartoRegioesEditaveis").value;if(regiao!=""){tema=i3GEO.editorGM.regioestemas["a"+regiao];if(aguarde&&aguarde.style.visibility=="hidden"){aguarde.style.visibility="visible";p=i3GEO.configura.locaplic+"/classesphp/mapa_controle.php";par="funcao=identifica3&opcao=tema&xy="+objposicaocursor.ddx+","+objposicaocursor.ddy+"&resolucao=5&g_sid="+i3GEO.configura.sid+"&ext="+i3GEO.parametros.mapexten+"&listaDeTemas=&wkt=sim&tema="+tema;cpJSON.call(p,"identifica",temp,par)}}}}},comboRegiaoEditavel:function(codigo_tipo_regiao){if(!codigo_tipo_regiao){codigo_tipo_regiao=""}var onde=$i("i3geoCartoRegioesEditaveisDiv"),temp=function(dados){var n=dados.length,ins='<br><p class="paragrafo" >'+$trad("camedit")+':</p>',i;ins+="<select onchange='i3GEO.editorGM.comboRegiaoEditavelOnchange(this)' id='i3geoCartoRegioesEditaveis' style='width:175px' ><option value=''>---</option>";for(i=0;i<n;i++){ins+="<option value='"+dados[i].codigo_tipo_regiao+"'>"+dados[i].nome_tipo_regiao+"</option>";i3GEO.editorGM.descregioes["a_"+dados[i].codigo_tipo_regiao]=dados[i]}dados=i3GEO.arvoreDeCamadas.filtraCamadas("editavel","SIM","igual");n=dados.length;for(i=0;i<n;i++){if(!dados[i].codigo_tipo_regiao||dados[i].codigo_tipo_regiao===""){ins+="<option value='"+dados[i].name+"'>"+dados[i].tema+"</option>";dados[i]["identificador"]=dados[i].colunaidunico;dados[i]["colunanomeregiao"]="";i3GEO.editorGM.descregioes["a_"+dados[i].name]=dados[i]}}ins+="</select>";if(onde){onde.innerHTML=ins}return ins};i3GEO.php.listaTipoRegiao(temp,codigo_tipo_regiao)},comboRegiaoEditavelOnchange:function(combo){if(combo.value===""){return}i3GEO.editorGM.editarAtributos.desativa();if(i3GEO.arvoreDeCamadas.pegaTema(combo.value)!=""){i3GEO.editorGM.regioestemas["a"+combo.value]=combo.value;i3GEO.editorGM.temasregioes[combo.value]=combo.value}else{var temp=function(retorno){if(i3GEO.arvoreDeCamadas.pegaTema(retorno.layer)==""){i3GEO.php.adtema(i3GEO.atualiza,retorno.mapfile);i3GEO.editorGM.regioestemas["a"+combo.value]=retorno.layer;i3GEO.editorGM.temasregioes[retorno.layer]=combo.value}};i3GEO.php.mapfileTipoRegiao(temp,combo.value)}},mudaicone:function(botao){var c=$i(i3GEO.editorGM.iddiv),ci=c.getElementsByTagName("img"),n=ci.length,i;for(i=0;i<n;i++){ci[i].parentNode.style.backgroundColor="#F5F5F5"}i3GEO.eventos.MOUSECLIQUE=[];i3GEO.editorGM.capturaPoligonoTema.desativa();i3GEO.editorGM.editarAtributos.desativa();if(botao&&botao.style){botao.style.backgroundColor="#cedff2"}},digitalizaPol:function(botao){i3GEO.editorGM.mudaicone(botao);i3GEO.editorGM.drawingManager.setOptions({drawingMode:google.maps.drawing.OverlayType.POLYGON})},digitalizaPt:function(botao){i3GEO.editorGM.mudaicone(botao);i3GEO.editorGM.drawingManager.setOptions({drawingMode:google.maps.drawing.OverlayType.MARKER})},seleciona:function(botao){i3GEO.editorGM.mudaicone(botao);i3GEO.editorGM.drawingManager.setOptions({drawingMode:null})},adicionaPoligonos:function(obj,tema,colunaid,valorid,colunanome,valornome){if(!tema){tema=$i("i3geoCartoRegioesEditaveis").value}if(!colunaid){colunaid=""}if(!valorid){valorid=""}if(!colunanome){colunanome=""}if(!valornome){valornome=""}var pol;if(Wkt.isArray(obj)){for(i in obj){if(obj.hasOwnProperty(i)&&!Wkt.isArray(obj[i])){pol=new google.maps.Polygon({path:obj[i].getPath(),map:i3GeoMap,fillColor:'#ffff00',fillOpacity:.5,strokeWeight:2,clickable:true,zIndex:1,editable:true,tema:tema,colunaid:colunaid,valorid:valorid,colunanome:colunanome,valornome:valornome});google.maps.event.addListener(pol,'click',function(){i3GEO.editorGM.setSelection(pol)});i3GEO.desenho.googlemaps.shapes.push(pol)}}return}if(obj.type==='polygon'||obj.type==='linestring'){pol=new google.maps.Polygon({paths:obj.getPaths(),map:i3GeoMap,fillColor:'#ffff00',fillOpacity:.5,strokeWeight:2,clickable:true,zIndex:1,editable:true,tema:tema,colunaid:colunaid,valorid:valorid,colunanome:colunanome,valornome:valornome});google.maps.event.addListener(pol,'click',function(){i3GEO.editorGM.setSelection(pol)});i3GEO.desenho.googlemaps.shapes.push(pol);return}if(obj.type==='marker'){i3GEO.editorGM.selectAll();if(i3GEO.desenho.googlemaps.shapes.length>0){i3GEO.editorGM.deleteSelectedShape(true)}pol=new google.maps.Marker({position:new google.maps.LatLng(obj.getPosition().ob,obj.getPosition().pb),map:i3GeoMap,icon:{url:i3GEO.editorGM.iconePonto(false)},clickable:true,zIndex:1,draggable:true,tema:tema,colunaid:colunaid,valorid:valorid,colunanome:colunanome,valornome:valornome,editable:false});google.maps.event.addListener(pol,'click',function(){i3GEO.editorGM.setSelection(pol)});i3GEO.desenho.googlemaps.shapes.push(pol);return}},salvaLimite:{inicia:function(){if(i3GEO.login.verificaCookieLogin()===false){i3GEO.janela.tempoMsg($trad("meneditor3"));if(i3GEO.editorGM.selectedShapes().length>0){var temp=i3GEO.editorGM.toWKT(i3GEO.editorGM.selectedShapes()[0]);i3GEO.mapa.dialogo.wkt2layer(temp)}return}var wkt,temp,s=i3GEO.editorGM.selectedShapes(),n=s.length,janela=YAHOO.i3GEO.janela.manager.find("salvaLimite");if(janela){janela.destroy()}if(n==1){s=s[0];temp=function(retorno){i3GEO.editorGM.deleteSelectedShape(true);i3GEO.Interface.redesenha()};if(i3GEO.editorGM.descregioes["a_"+$i("i3geoCartoRegioesEditaveis").value].tema!=undefined){wkt=i3GEO.editorGM.toWKT(i3GEO.editorGM.selectedShapes()[0]);if(wkt&&wkt!=""){if(s.valorid==""){p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=adicionaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",temp,"&tema="+$i("i3geoCartoRegioesEditaveis").value+"&wkt="+wkt)}else{p=i3GEO.configura.locaplic+"/ferramentas/editortema/exec.php?funcao=atualizaGeometria&g_sid="+i3GEO.configura.sid;cpJSON.call(p,"foo",temp,"&idunico="+s.valorid+"&tema="+$i("i3geoCartoRegioesEditaveis").value+"&wkt="+wkt)}}}else{i3GEO.editorGM.salvaLimite.criaJanelaFlutuante(i3GEO.editorGM.salvaLimite.html(s.colunaid,s.valorid,s.colunanome,s.valornome));new YAHOO.widget.Button("i3GEOFmetaestati3GEO.editorGMBotao1",{onclick:{fn:function(){i3GEO.editorGM.salvaLimite.gravaDados(true)}}});new YAHOO.widget.Button("i3GEOFmetaestati3GEO.editorGMBotao2",{onclick:{fn:function(){i3GEO.editorGM.salvaLimite.gravaDados(false)}}});new YAHOO.widget.Button("i3GEOFmetaestati3GEO.editorGMBotao3",{onclick:{fn:function(){i3GEO.editorGM.salvaLimite.excluiPoligono()}}})}}else{i3GEO.janela.tempoMsg("Selecione uma figura")}},html:function(colunaIdElemento,valorIdElemento,colunaNomeElemento,valorNomeElemento){var ins=''+'<p class=paragrafo >Se o valor do código for vazio, será criado um novo elemento. Caso contrário, os valores atualmente registrados serão atualizados.</p>'+'<p class=paragrafo >Edite os atributos:</p>'+'<input type=hidden id="inputColunaIdElemento" value="'+colunaIdElemento+'" />'+'<input type=hidden id="inputColunaNomeElemento" value="'+colunaNomeElemento+'" />'+'<input type=hidden id="inputIdentificadorElemento" value="'+valorIdElemento+'" />'+'<input type=hidden id="inputNomeElemento" value="'+valorNomeElemento+'" />'+'<p class=paragrafo >Código:</p>'+'<p class=paragrafo ><input class=digitar type=text id="inputIdentificadorNovoElemento" value="'+valorIdElemento+'" style="width:180;cursor:text" /></p>'+'<p class=paragrafo >Nome:</p>'+'<p class=paragrafo ><input class=digitar type=text id="inputNomeNovoElemento" value="'+valorNomeElemento+'" style="width:180;cursor:text" /></p>'+'<p class=paragrafo >Escolha a operação desejada:</p>'+'<input id=i3GEOFmetaestati3GEO.editorGMBotao1 type="button" value="Salvar tudo" />'+' <input id=i3GEOFmetaestati3GEO.editorGMBotao2 type="button" value="Salvar apenas os atributos" />'+'<br><br><input id=i3GEOFmetaestati3GEO.editorGMBotao3 type="button" value="Excluir" />';return ins},criaJanelaFlutuante:function(html){var titulo,cabecalho,minimiza,janela;cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("salvaLimite")};titulo="<div class='i3GeoTituloJanela'>"+$trad("sdados")+"</div>";janela=i3GEO.janela.cria("300px","265px","","","",titulo,"salvaLimite",true,"hd",cabecalho,minimiza);$i("salvaLimite_corpo").style.backgroundColor="white";$i("salvaLimite_corpo").innerHTML=html;YAHOO.util.Event.addListener(janela[0].close,"click",i3GEO.editorGM.mudaicone)},gravaDados:function(comwkt){if(i3GEO.login.verificaCookieLogin()===false){i3GEO.janela.tempoMsg($trad("meneditor3"));return}if(!window.confirm($trad("sdados")+"?")){return}var p,codigo_tipo_regiao=$i("i3geoCartoRegioesEditaveis").value,identificadornovo=$i("inputIdentificadorNovoElemento").value,identificador=$i("inputIdentificadorElemento").value,nome=$i("inputNomeNovoElemento").value,wkt="",temp=function(retorno){i3GEO.editorGM.deleteSelectedShape(true);var janela=YAHOO.i3GEO.janela.manager.find("salvaLimite");if(janela){janela.destroy()}i3GEO.Interface.redesenha()};if(comwkt===true){wkt=i3GEO.editorGM.toWKT(i3GEO.editorGM.selectedShapes()[0])}else{if(identificadornovo===identificador&&$i("inputNomeElemento").value===nome){i3GEO.janela.tempoMsg($trad("meneditor4"));return}}p=i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=mantemDadosRegiao&tipo=";cpJSON.call(p,"foo",temp,"&codigo_tipo_regiao="+codigo_tipo_regiao+"&identificadornovo="+identificadornovo+"&identificador="+identificador+"&nome="+nome+"&wkt="+wkt)},excluiPoligono:function(){if(i3GEO.login.verificaCookieLogin()===false){i3GEO.janela.tempoMsg($trad("meneditor3"));return}if(!window.confirm($trad("excsel")+"?")){return}var codigo_tipo_regiao=$i("i3geoCartoRegioesEditaveis").value,identificador=$i("inputIdentificadorElemento").value,temp=function(retorno){i3GEO.editorGM.deleteSelectedShape(true);var janela=YAHOO.i3GEO.janela.manager.find("salvaLimite");if(janela){janela.destroy()}i3GEO.Interface.redesenha()},p=i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=mantemDadosRegiao&tipo=excluir";if(identificador===""){i3GEO.janela.tempoMsg($trad("meneditor5"))}else{cpJSON.call(p,"foo",temp,"&codigo_tipo_regiao="+codigo_tipo_regiao+"&identificador="+identificador)}}},editarAtributos:{aliascolunas:"",x:"",y:"",ativa:function(botao){if($i("i3geoCartoRegioesEditaveis").value==""){i3GEO.janela.tempoMsg("Escolha uma regiao");return}i3GEO.editorGM.mudaicone(botao);i3GEO.eventos.adicionaEventos("MOUSECLIQUE",["i3GEO.editorGM.editarAtributos.captura()"]);var janela=YAHOO.i3GEO.janela.manager.find("editaAtributos");if(janela){$i("editarAtributosForm").innerHTML=""}else{i3GEO.editorGM.editarAtributos.criaJanelaFlutuante(i3GEO.editorGM.editarAtributos.html());i3GEO.editorGM.editarAtributos.comboVariaveis()}},desativa:function(){var janela=YAHOO.i3GEO.janela.manager.find("editaAtributos");if(janela){janela.destroy()}},criaJanelaFlutuante:function(html){var janela,titulo,cabecalho,minimiza;cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("editaAtributos")};titulo="<div class='i3GeoTituloJanela'>"+$trad("atrib")+"</div>";janela=i3GEO.janela.cria("250px","265px","","","",titulo,"editaAtributos",false,"hd",cabecalho,minimiza);$i("editaAtributos_corpo").style.backgroundColor="white";$i("editaAtributos_corpo").innerHTML=html;i3GEO.janela.tempoMsg($trad("meneditor6"));YAHOO.util.Event.addListener(janela[0].close,"click",i3GEO.editorGM.mudaicone)},html:function(){var ins=''+'<p class="paragrafo" ><div id="editarAtributosVariaveis" ></div></p>'+'<p class="paragrafo" ><div id="editarAtributosMedidasVariavel" ></div></p>'+'<p class="paragrafo" ><div id="editarAtributosRegiao" ></div></p>'+'<p class="paragrafo" ><div id="editarAtributosForm" ></div></p>'+'';return ins},comboVariaveis:function(){var temp=function(dados){var i,n=dados.length,ins='';ins+='<p class="paragrafo" >Escolha uma variável para editar</p>';ins+="<select style='box-shadow:0 1px 5px gray;width:200px' onchange='i3GEO.editorGM.editarAtributos.comboMedidasVariavel(this)'><option value=''>---</option>";for(i=0;i<n;i++){ins+="<option title='"+dados[i].descricao+"' value='"+dados[i].codigo_variavel+"'>"+dados[i].nome+"</option>"}ins+="</select>";$i("editarAtributosVariaveis").innerHTML=ins};i3GEO.php.listaVariavel(temp,"i3geo_metaestat")},comboMedidasVariavel:function(comboMedidas){var temp=function(dados){var i,n=dados.length,ins='';ins+='<p class="paragrafo" >Escolha uma medida da variável para editar</p>';ins+="<select id='editarAtributosComboMedidas' style='box-shadow:0 1px 5px gray;width:200px' onchange=''><option value=''>---</option>";for(i=0;i<n;i++){if(dados[i].esquemadb=="i3geo_metaestat"&&dados[i].codigo_tipo_regiao==$i("i3geoCartoRegioesEditaveis").value){ins+="<option value='"+dados[i].id_medida_variavel+"'>"+dados[i].nomemedida+"</option>"}}ins+="</select>";$i("editarAtributosMedidasVariavel").innerHTML=ins};if(comboMedidas.value!==""){i3GEO.php.listaMedidaVariavel(comboMedidas.value,temp)}},captura:function(){if(!YAHOO.i3GEO.janela.manager.find("editaAtributos")){i3GEO.editorGM.mudaicone(botao);return}i3GEO.editorGM.editarAtributos.x=objposicaocursor.ddx;i3GEO.editorGM.editarAtributos.y=objposicaocursor.ddy;i3GEO.editorGM.editarAtributos.pegaDados()},pegaDados:function(){var p=i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=listaAtributosMedidaVariavelXY",codigo_tipo_regiao=$i("i3geoCartoRegioesEditaveis").value,id_medida_variavel=$i("editarAtributosComboMedidas").value,temp=function(retorno){var atr=retorno.atributos,i=0,n=atr.dados.length,j=0,idunico="",nj=atr.aliascolunas.length,ins=""+'<p class=paragrafo >Limite geográfico escolhido:</p>'+'<p class=paragrafo ><b>Nome: </b>'+retorno.regiao.nomeregiao+'</p>'+'<p class=paragrafo ><b>Código: </b>'+retorno.regiao.identificador_regiao+'</p>'+'<input type=hidden id="editarAtributosidentificador_regiao" value="'+retorno.regiao.identificador_regiao+'" />'+'<p class=paragrafo >Atributos:</p>'+'<input id=editarAtributosAdicionar value="Adicionar um novo" />'+' <input id=editarAtributosSalvar value="Salvar" />';$i("editarAtributosRegiao").innerHTML=ins;ins="";for(i=0;i<n;i++){for(j=0;j<nj;j++){if(atr.aliascolunas[j]=="idunico"){idunico=atr.dados[i][atr.colunas[j]]}}ins+="<hr><div><p class=paragrafo style='color:blue;cursor:pointer' onclick='i3GEO.editorGM.editarAtributos.excluir("+idunico+")' >excluir</p>";for(j=0;j<nj;j++){if(atr.aliascolunas[j]!=="idunico"){ins+='<p class=paragrafo >'+atr.aliascolunas[j]+':<br>'+'<input class=digitar id="idunico_'+idunico+'" value="'+atr.dados[i][atr.colunas[j]]+'" name="'+atr.colunas[j]+'" /></p>'}}}$i("editarAtributosForm").innerHTML=ins;new YAHOO.widget.Button("editarAtributosAdicionar",{onclick:{fn:function(){var novoel=document.createElement("div"),ins="<hr><br>";for(j=0;j<nj;j++){if(atr.aliascolunas[j]!=="idunico"){ins+='<p class=paragrafo >'+atr.aliascolunas[j]+' - '+atr.descricao[j]+':<br>'+'<input class=digitar id="" value="" name="'+atr.colunas[j]+'" /></p>'}}ins+="<br></div>";novoel.innerHTML=ins;$i("editarAtributosForm").appendChild(novoel)}}});new YAHOO.widget.Button("editarAtributosSalvar",{onclick:{fn:function(){i3GEO.editorGM.editarAtributos.salva()}}})};cpJSON.call(p,"foo",temp,"&codigo_tipo_regiao="+codigo_tipo_regiao+"&id_medida_variavel="+id_medida_variavel+"&x="+i3GEO.editorGM.editarAtributos.x+"&y="+i3GEO.editorGM.editarAtributos.y)},excluir:function(id){if(i3GEO.login.verificaCookieLogin()===false){i3GEO.janela.tempoMsg("Você precisa fazer login para usar essa opção");return}var p=i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=excluiAtributosMedidaVariavel",codigo_tipo_regiao=$i("i3geoCartoRegioesEditaveis").value,id_medida_variavel=$i("editarAtributosComboMedidas").value,identificador_regiao=$i("editarAtributosidentificador_regiao").value,temp=function(retorno){i3GEO.editorGM.editarAtributos.pegaDados();i3GEO.janela.fechaAguarde("aguardeSalvaAtributos")};i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaAtributos","Salvando...");i3GEO.janela.AGUARDEMODAL=false;cpJSON.call(p,"foo",temp,"&codigo_tipo_regiao="+codigo_tipo_regiao+"&identificador_regiao="+identificador_regiao+"&id_medida_variavel="+id_medida_variavel+"&id="+id)},salva:function(){if(i3GEO.login.verificaCookieLogin()===false){i3GEO.janela.tempoMsg("Você precisa fazer login para usar essa opção");return}var container=$i("editarAtributosForm"),divsT=container.getElementsByTagName("div"),n=divsT.length,i=0,dv="",inputs="",codigo_tipo_regiao=$i("i3geoCartoRegioesEditaveis").value,id_medida_variavel=$i("editarAtributosComboMedidas").value,identificador_regiao=$i("editarAtributosidentificador_regiao").value,nj,j,colunas=[],colunasT=[],valores=[],valoresT=[],idsunicosT=[],p=i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=salvaAtributosMedidaVariavel",re=new RegExp("idunico_","g"),temp=function(retorno){i3GEO.editorGM.editarAtributos.pegaDados();i3GEO.editorGM.atualizaCamadasMetaestat();i3GEO.janela.fechaAguarde("aguardeSalvaAtributos")};if(codigo_tipo_regiao==""){i3GEO.janela.tempoMsg("Problemas com o codigo da regiao");return}if(id_medida_variavel==""){i3GEO.janela.tempoMsg("Escolha uma medida");return}if(identificador_regiao==""){i3GEO.janela.tempoMsg("Problemas com o identificador da regiao");return}for(i=0;i<n;i++){dv=divsT[i];inputs=dv.getElementsByTagName("input");nj=inputs.length;colunas=[];valores=[];for(j=0;j<nj;j++){colunas.push(inputs[j].name);valores.push(inputs[j].value)}idsunicosT.push(inputs[0].id.replace(re,''));colunasT.push(colunas.join("|"));valoresT.push(valores.join("|"))}i3GEO.janela.AGUARDEMODAL=true;i3GEO.janela.abreAguarde("aguardeSalvaAtributos","Salvando...");i3GEO.janela.AGUARDEMODAL=false;cpJSON.call(p,"foo",temp,"&codigo_tipo_regiao="+codigo_tipo_regiao+"&identificador_regiao="+identificador_regiao+"&id_medida_variavel="+id_medida_variavel+"&colunas="+colunasT[0]+"&valores="+valoresT.join("#")+"&idsunicos="+idsunicosT.join("|"))}},ajuda:function(){var titulo,cabecalho,minimiza,html="";cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("editaAtributosAjuda")};titulo="<div class='i3GeoTituloJanela'>Ajuda </div>";i3GEO.janela.cria("400px","350px","","","",titulo,"editaAtributosAjuda",false,"hd",cabecalho,minimiza);$i("editaAtributosAjuda_corpo").style.backgroundColor="white";html+="<table class=lista8 >"+"<tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/gisicons/polygon-create.png' /></td>"+"<td>Clique no mapa para traçar um polígono novo. Cada clique corresponde a um vértice do polígono. Para encerrar o traçado utilize um duplo clique. Após traçar um novo polígono pode-se selecioná-lo novamente e editar os vértices, se for necessário, ou mesmo apagar o polígono por completo. O novo polígono só será salvo por meio da opção específica para isso.</td></tr>"+"<tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/gisicons/layer-import.png' /></td>"+"<td>Utilize essa opção para capturar os vértices de um polígono existente. O resultado da captura é uma figura que pode ser editada, ou seja, os vértices podem ser modificados de posição ou mesmo removidos. Após editar, salve o novo polígono.</td></tr>"+"<tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/gisicons/select.png' /></td>"+"<td>Após ativar essa opção clique no mapa sobre uma figura existente (que tenha sido capturada ou digtalizada). A figura passará então para o estado de 'selecionada' podendo ser utilizada por outras ferramentas de edição.</td></tr>"+"<tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/gisicons/selected-delete.png' /></td>"+"<td>Remove da tela a figura que estiver selecionada. Essa operação não apaga o polígono do banco de dados, apenas remove do modo de edição.</td></tr>"+"<tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/gisicons/vector-save.png' /></td>"+"<td>Salva no banco de dados a figura que estiver selecionada. Essa opção altera apenas os atributos do limite geográfico, não afetando os valores armazenados em cada medida de variável.</td></tr>"+"<tr><td><img src='"+i3GEO.configura.locaplic+"/imagens/gisicons/annotation-form.png' /></td>"+"<td>Abre um formulário que permite alterar os valores de uma medida de variável relacionada a uma determinada região. Após abrir o formulário, clique no mapa sobre a região desejada, mas escolha a medida da variável primeiro. Os valores já existentes poderão então ser alterados ou podem ser adicionados novos.</td></tr>"+"</table>";$i("editaAtributosAjuda_corpo").innerHTML=html}};google.maps.Marker.prototype.type='marker';google.maps.Polyline.prototype.type='polyline';google.maps.Polygon.prototype.type='polygon';google.maps.Rectangle.prototype.type='rectangle';google.maps.Circle.prototype.type='circle';(function(Wkt){Wkt.Wkt.prototype.isRectangle=false;Wkt.Wkt.prototype.construct={point:function(config,component){var c=component||this.components;config=config||{};config.position=new google.maps.LatLng(c[0].y,c[0].x);return new google.maps.Marker(config)},multipoint:function(config){var i,c,arr;c=this.components;config=config||{};arr=[];for(i=0;i<c.length;i+=1){arr.push(this.construct.point(config,c[i]))}return arr},linestring:function(config,component){var i,c;c=component||this.components;config=config||{editable:false};config.path=[];for(i=0;i<c.length;i+=1){config.path.push(new google.maps.LatLng(c[i].y,c[i].x))}return new google.maps.Polyline(config)},multilinestring:function(config){var i,c,arr;c=this.components;config=config||{editable:false};config.path=[];arr=[];for(i=0;i<c.length;i+=1){arr.push(this.construct.linestring(config,c[i]))}return arr},box:function(config,component){var c=component||this.components;config=config||{};config.bounds=new google.maps.LatLngBounds(new google.maps.LatLng(c[0].y,c[0].x),new google.maps.LatLng(c[1].y,c[1].x));return new google.maps.Rectangle(config)},polygon:function(config,component){var j,k,c,rings,verts;c=component||this.components;config=config||{editable:false};config.paths=[];rings=[];for(j=0;j<c.length;j+=1){verts=[];for(k=0;k<c[j].length-1;k+=1){verts.push(new google.maps.LatLng(c[j][k].y,c[j][k].x))}if(j!==0){if(config.reverseInnerPolygons==null||config.reverseInnerPolygons){verts.reverse()}}rings.push(verts)}config.paths=config.paths.concat(rings);if(this.isRectangle){return(function(){var bounds,v=0;bounds=new google.maps.LatLngBounds();for(v in rings[0]){if(rings[0].hasOwnProperty(v)){bounds.extend(rings[0][v])}}return new google.maps.Rectangle({bounds:bounds})}())}else{return new google.maps.Polygon(config)}},multipolygon:function(config){var i,c,arr;c=this.components;config=config||{editable:false};config.path=[];arr=[];for(i=0;i<c.length;i+=1){arr.push(this.construct.polygon(config,c[i]))}return arr}};Wkt.Wkt.prototype.deconstruct=function(obj,multiFlag){var features,i,j,verts,rings,sign,tmp,response,lat,lng;if(google.maps.geometry){sign=google.maps.geometry.spherical.computeSignedArea};if(obj.constructor===google.maps.LatLng){response={type:'point',components:[{x:obj.lng(),y:obj.lat()}]};return response}if(obj.constructor===google.maps.Point){response={type:'point',components:[{x:obj.x,y:obj.y}]};return response}if(obj.constructor===google.maps.Marker){response={type:'point',components:[{x:obj.getPosition().lng(),y:obj.getPosition().lat()}]};return response}if(obj.constructor===google.maps.Polyline){verts=[];for(i=0;i<obj.getPath().length;i+=1){tmp=obj.getPath().getAt(i);verts.push({x:tmp.lng(),y:tmp.lat()})}response={type:'linestring',components:verts};return response}if(obj.constructor===google.maps.Polygon){rings=[];if(multiFlag===undefined){multiFlag=(function(){var areas,l;l=obj.getPaths().length;if(l<=1){return false}if(l===2){if(sign(obj.getPaths().getAt(0))*sign(obj.getPaths().getAt(1))<0){return false}return true}areas=obj.getPaths().getArray().map(function(k){return sign(k)/Math.abs(sign(k)); });if(areas.indexOf(areas[0])!==areas.lastIndexOf(areas[0])){multiFlag=true;return true}return false}())}for(i=0;i<obj.getPaths().length;i+=1){tmp=obj.getPaths().getAt(i);verts=[];for(j=0;j<obj.getPaths().getAt(i).length;j+=1){verts.push({x:tmp.getAt(j).lng(),y:tmp.getAt(j).lat()})}if(!tmp.getAt(tmp.length-1).equals(tmp.getAt(0))){if(i%2!==0){verts.unshift({x:tmp.getAt(tmp.length-1).lng(),y:tmp.getAt(tmp.length-1).lat()})}else{verts.push({x:tmp.getAt(0).lng(),y:tmp.getAt(0).lat()})}}if(obj.getPaths().length>1&&i>0){if(sign(obj.getPaths().getAt(i))>0&&sign(obj.getPaths().getAt(i-1))>0||sign(obj.getPaths().getAt(i))<0&&sign(obj.getPaths().getAt(i-1))<0&&!multiFlag){verts=[verts]}}if(i%2!==0){verts.reverse()}rings.push(verts)}response={type:(multiFlag)?'multipolygon':'polygon',components:rings};return response}if(obj.constructor===google.maps.Circle){var point=obj.getCenter();var radius=obj.getRadius();verts=[];var d2r=Math.PI/180; var r2d=180/Math.PI; radius=radius/1609; var earthsradius=3963;var num_seg=32;var rlat=(radius/earthsradius)*r2d;var rlng=rlat/Math.cos(point.lat()*d2r);for(var n=0;n<=num_seg;n++){var theta=Math.PI*(n/(num_seg/2));lng=point.lng()+(rlng*Math.cos(theta));lat=point.lat()+(rlat*Math.sin(theta));verts.push({x:lng,y:lat})}response={type:'polygon',components:[verts]};return response}if(obj.constructor===google.maps.LatLngBounds){tmp=obj;verts=[];verts.push({x:tmp.getSouthWest().lng(),y:tmp.getNorthEast().lat()});verts.push({x:tmp.getNorthEast().lng(),y:tmp.getNorthEast().lat()});verts.push({x:tmp.getNorthEast().lng(),y:tmp.getSouthWest().lat()});verts.push({x:tmp.getSouthWest().lng(),y:tmp.getSouthWest().lat()});verts.push({x:tmp.getSouthWest().lng(),y:tmp.getNorthEast().lat()});response={type:'polygon',isRectangle:true,components:[verts]};return response}if(obj.constructor===google.maps.Rectangle){tmp=obj.getBounds();verts=[];verts.push({x:tmp.getSouthWest().lng(),y:tmp.getNorthEast().lat()});verts.push({x:tmp.getNorthEast().lng(),y:tmp.getNorthEast().lat()});verts.push({x:tmp.getNorthEast().lng(),y:tmp.getSouthWest().lat()});verts.push({x:tmp.getSouthWest().lng(),y:tmp.getSouthWest().lat()});verts.push({x:tmp.getSouthWest().lng(),y:tmp.getNorthEast().lat()});response={type:'polygon',isRectangle:true,components:[verts]};return response}if(obj.constructor===google.maps.Data.Feature){return this.deconstruct.call(this,obj.getGeometry())}if(obj.constructor===google.maps.Data.Point){response={type:'point',components:[{x:obj.get().lng(),y:obj.get().lat()}]};return response}if(obj.constructor===google.maps.Data.LineString){verts=[];for(i=0;i<obj.getLength();i+=1){vertex=obj.getAt(i);verts.push({x:vertex.lng(),y:vertex.lat()})}response={type:'linestring',components:verts};return response}if(obj.constructor===google.maps.Data.Polygon){var rings=[];for(i=0;i<obj.getLength();i+=1){ring=obj.getAt(i);var verts=[];for(j=0;j<ring.getLength();j+=1){vertex=ring.getAt(j);verts.push({x:vertex.lng(),y:vertex.lat()})}verts.push({x:ring.getAt(0).lng(),y:ring.getAt(0).lat()});rings.push(verts)}response={type:'polygon',components:rings};return response}if(obj.constructor===google.maps.Data.MultiPoint){verts=[];for(i=0;i<obj.getLength();i+=1){vertex=obj.getAt(i);verts.push([{x:vertex.lng(),y:vertex.lat()}])}response={type:'multipoint',components:verts};return response}if(obj.constructor===google.maps.Data.MultiLineString){linestrings=[];for(i=0;i<obj.getLength();i+=1){verts=[];var linestring=obj.getAt(i);for(j=0;j<linestring.getLength();j+=1){vertex=linestring.getAt(j);verts.push({x:vertex.lng(),y:vertex.lat()})}linestrings.push(verts)}response={type:'multilinestring',components:linestrings};return response}if(obj.constructor===google.maps.Data.MultiPolygon){var k=0,polygons=[];for(k=0;k<obj.getLength();k+=1){var polygon=obj.getAt(k);var rings=[];for(i=0;i<polygon.getLength();i+=1){ring=polygon.getAt(i);var verts=[];for(j=0;j<ring.getLength();j+=1){vertex=ring.getAt(j);verts.push({x:vertex.lng(),y:vertex.lat()})}verts.push({x:ring.getAt(0).lng(),y:ring.getAt(0).lat()});rings.push(verts)}polygons.push(rings)}response={type:'multipolygon',components:polygons};return response}if(obj.constructor===google.maps.Data.GeometryCollection){var objects=[];for(k=0;k<obj.getLength();k+=1){var object=obj.getAt(k);objects.push(this.deconstruct.call(this,object))}response={type:'geometrycollection',components:objects};return response}if(Wkt.isArray(obj)){features=[];for(i=0;i<obj.length;i+=1){features.push(this.deconstruct.call(this,obj[i],true))}response={type:(function(){var k,type=obj[0].constructor;for(k=0;k<obj.length;k+=1){if(obj[k].constructor!==type){return'geometrycollection'}}switch(type){case google.maps.Marker:return'multipoint';case google.maps.Polyline:return'multilinestring';case google.maps.Polygon:return'multipolygon';default:return'geometrycollection'}}()),components:(function(){var i,comps;comps=[];for(i=0;i<features.length;i+=1){if(features[i].components){comps.push(features[i].components)}}return{"comps":comps}}())};response.components=response.components.comps;return response}}}(Wkt||require('./wicket'))); | |
| 2 | 0 | \ No newline at end of file |
ferramentas/identifica/index.js
| ... | ... | @@ -1103,7 +1103,7 @@ i3GEOF.identifica = |
| 1103 | 1103 | } |
| 1104 | 1104 | i3GEO.janela.mensagemSimples("<div style='overflow:auto;height:100%'>" + ins + "</div>", ""); |
| 1105 | 1105 | }; |
| 1106 | - p = i3GEO.configura.locaplic + "/admin/php/metaestat.php?funcao=LISTATODOSATRIBUTOSMEDIDAVARIAVELXY", cpJSON.call( | |
| 1106 | + p = i3GEO.configura.locaplic + "/classesphp/metaestat_controle.php?funcao=LISTATODOSATRIBUTOSMEDIDAVARIAVELXY", cpJSON.call( | |
| 1107 | 1107 | p, |
| 1108 | 1108 | "foo", |
| 1109 | 1109 | temp, | ... | ... |
ferramentas/metaestat/index.js
| ... | ... | @@ -1083,96 +1083,6 @@ i3GEOF.metaestat = { |
| 1083 | 1083 | i3GEOF.metaestat.ID_MEDIDA_VARIAVEL = $i("i3geoCartoComboMedidaVariavelEditor").value; |
| 1084 | 1084 | }, |
| 1085 | 1085 | /** |
| 1086 | - * Calcula os intervalos de classe com base na tecnica de quartis | |
| 1087 | - * Altera uma classificacao ja existente | |
| 1088 | - * E necessario definir as cores das classes. Caso o usuario nao as tenha escolhido, e aberta a janela para escolha | |
| 1089 | - * Executa admin/php/metaestat.php?funcao=calculaClassificacao&tipo=quartil | |
| 1090 | - */ | |
| 1091 | - quartis: function(){ | |
| 1092 | - var id_medida_variavel = $i("i3geoCartoComboMedidaVariavelEditor").value, | |
| 1093 | - id_classificacao = $i("i3geoCartoComboClassificacoesEditor").value, | |
| 1094 | - cores = $i("listaColourRampEditor").value, | |
| 1095 | - p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=calculaClassificacao&tipo=quartil&cores="+cores+"&id_classificacao="+id_classificacao+"&id_medida_variavel="+id_medida_variavel+"&g_sid="+i3GEO.configura.sid, | |
| 1096 | - temp = function(retorno){ | |
| 1097 | - core_carregando("desativa"); | |
| 1098 | - //fecha o editor | |
| 1099 | - if(retorno == "erro"){ | |
| 1100 | - alert("Não foi possível gerar as classes. Verifique se já existem dados para essa medida"); | |
| 1101 | - } | |
| 1102 | - else{ | |
| 1103 | - YAHOO.i3GEO.janela.manager.find("i3geoCartoEditor").destroy(); | |
| 1104 | - } | |
| 1105 | - }; | |
| 1106 | - if(cores == ""){ | |
| 1107 | - i3GEO.janela.tempoMsg("Escolha as cores primeiro. Depois acione a opção de classificação novamente"); | |
| 1108 | - $i("listaColourRampEditor").onchange = function(){i3GEOF.metaestat.editor.quartis();}; | |
| 1109 | - i3GEO.util.abreColourRamp("","listaColourRampEditor",5); | |
| 1110 | - return; | |
| 1111 | - } | |
| 1112 | - core_carregando("ativa"); | |
| 1113 | - i3GEO.util.ajaxGet(p,temp); | |
| 1114 | - }, | |
| 1115 | - /** | |
| 1116 | - * Calcula os intervalos de classe com base na tecnica de intervalos iguais | |
| 1117 | - * Altera uma classificacao ja existente | |
| 1118 | - * O usuario deve definir o menor e o maior valor | |
| 1119 | - * E necessario definir as cores das classes. Caso o usuario nao as tenha escolhido, e aberta a janela para escolha | |
| 1120 | - * Executa admin/php/metaestat.php?funcao=calculaClassificacao&tipo=intiguais5mm | |
| 1121 | - */ | |
| 1122 | - intervalosIguaisMM: function(){ | |
| 1123 | - var id_medida_variavel = $i("i3geoCartoComboMedidaVariavelEditor").value, | |
| 1124 | - id_classificacao = $i("i3geoCartoComboClassificacoesEditor").value, | |
| 1125 | - cores = $i("listaColourRampEditor").value, | |
| 1126 | - p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=calculaClassificacao&tipo=intiguaismm" + | |
| 1127 | - "&numintervalos="+$i("i3GEOFmetaestatEditorNumInt").value + | |
| 1128 | - "&cores="+cores+"&id_classificacao="+id_classificacao+"&id_medida_variavel="+id_medida_variavel+ | |
| 1129 | - "&min="+$i("i3GEOFmetaestatEditorVmin").value + | |
| 1130 | - "&max="+$i("i3GEOFmetaestatEditorVmax").value + | |
| 1131 | - "&g_sid="+i3GEO.configura.sid, | |
| 1132 | - temp = function(retorno){ | |
| 1133 | - core_carregando("desativa"); | |
| 1134 | - YAHOO.i3GEO.janela.manager.find("i3geoCartoEditor").destroy(); | |
| 1135 | - }; | |
| 1136 | - if(cores == ""){ | |
| 1137 | - alert("Escolha as cores primeiro"); | |
| 1138 | - $i("listaColourRampEditor").onchange = function(){i3GEOF.metaestat.editor.intervalosIguaisMM();}; | |
| 1139 | - i3GEO.util.abreColourRamp("","listaColourRampEditor",5); | |
| 1140 | - return; | |
| 1141 | - } | |
| 1142 | - core_carregando("ativa"); | |
| 1143 | - i3GEO.util.ajaxGet(p,temp); | |
| 1144 | - }, | |
| 1145 | - /** | |
| 1146 | - * Calcula os intervalos de classe com base na tecnica de intervalos iguais | |
| 1147 | - * Altera uma classificacao ja existente | |
| 1148 | - * O menor e maior valor sao calculados com base nos valores da medida da variavel | |
| 1149 | - * E necessario definir as cores das classes. Caso o usuario nao as tenha escolhido, e aberta a janela para escolha | |
| 1150 | - * Executa admin/php/metaestat.php?funcao=calculaClassificacao&tipo=intiguais5mm | |
| 1151 | - */ | |
| 1152 | - intervalosIguais: function(){ | |
| 1153 | - var id_medida_variavel = $i("i3geoCartoComboMedidaVariavelEditor").value, | |
| 1154 | - id_classificacao = $i("i3geoCartoComboClassificacoesEditor").value, | |
| 1155 | - cores = $i("listaColourRampEditor").value, | |
| 1156 | - p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=calculaClassificacao&tipo=intiguais&numintervalos="+$i("i3GEOFmetaestatEditorNumInt").value+"&cores="+cores+"&id_classificacao="+id_classificacao+"&id_medida_variavel="+id_medida_variavel+"&g_sid="+i3GEO.configura.sid, | |
| 1157 | - temp = function(retorno){ | |
| 1158 | - core_carregando("desativa"); | |
| 1159 | - if(retorno == "erro"){ | |
| 1160 | - alert("Não foi possível gerar as classes. Verifique se já existem dados para essa medida"); | |
| 1161 | - } | |
| 1162 | - else{ | |
| 1163 | - YAHOO.i3GEO.janela.manager.find("i3geoCartoEditor").destroy(); | |
| 1164 | - } | |
| 1165 | - }; | |
| 1166 | - if(cores == ""){ | |
| 1167 | - alert("Escolha as cores primeiro"); | |
| 1168 | - $i("listaColourRampEditor").onchange = function(){i3GEOF.metaestat.editor.intervalosIguais();}; | |
| 1169 | - i3GEO.util.abreColourRamp("","listaColourRampEditor",5); | |
| 1170 | - return; | |
| 1171 | - } | |
| 1172 | - core_carregando("ativa"); | |
| 1173 | - i3GEO.util.ajaxGet(p,temp); | |
| 1174 | - }, | |
| 1175 | - /** | |
| 1176 | 1086 | * Ativa o botao de upload |
| 1177 | 1087 | * Ao ser clicado, abre uma janela flutuante com as opcoes de download |
| 1178 | 1088 | * @param id do elemento DOM utilizado para compor o botao |
| ... | ... | @@ -2054,7 +1964,7 @@ i3GEOF.metaestat = { |
| 2054 | 1964 | }, |
| 2055 | 1965 | /** |
| 2056 | 1966 | * Abre uma nova janela do navegador para download dos dados de uma medida de uma variavel |
| 2057 | - * Executa admin/php/metaestat.php?funcao=dadosMedidaVariavel que retorna os dados em CSV | |
| 1967 | + * Executa ?funcao=dadosMedidaVariavel que retorna os dados em CSV | |
| 2058 | 1968 | */ |
| 2059 | 1969 | downloadMedida: function(){ |
| 2060 | 1970 | i3GEOF.metaestat.log("i3GEOF.metaestat.principal.downloadMedida()"); |
| ... | ... | @@ -2063,7 +1973,7 @@ i3GEOF.metaestat = { |
| 2063 | 1973 | return; |
| 2064 | 1974 | } |
| 2065 | 1975 | if(window.confirm("Confirma o download dos dados")){ |
| 2066 | - var p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=dadosMedidaVariavel" + | |
| 1976 | + var p = i3GEO.configura.locaplic+"/classesphp/metaestat_controle.php?funcao=dadosMedidaVariavel" + | |
| 2067 | 1977 | "&todasascolunas=1&formato=csv&id_medida_variavel="+$i("i3geoCartoComboMedidasVariavel").value; |
| 2068 | 1978 | window.open(p); |
| 2069 | 1979 | } | ... | ... |
ferramentas/metaestat/listamapas.js
| ... | ... | @@ -70,8 +70,8 @@ i3GEOF.listamapas = { |
| 70 | 70 | }, |
| 71 | 71 | /** |
| 72 | 72 | * Retorna o HTML com o conteudo da ferramenta |
| 73 | - * Executa admin/php/metaestat.php?funcao=listaTemplatesMapa para obter os templates disponiveis para uso nos mapas | |
| 74 | - * Executa admin/php/metaestat.php?funcao=listaMapas para obter a lista de mapas | |
| 73 | + * Executa funcao=listaTemplatesMapa para obter os templates disponiveis para uso nos mapas | |
| 74 | + * Executa funcao=listaMapas para obter a lista de mapas | |
| 75 | 75 | * @param id do DIV que recebera o conteudo |
| 76 | 76 | */ |
| 77 | 77 | html: function(divid){ |
| ... | ... | @@ -102,10 +102,10 @@ i3GEOF.listamapas = { |
| 102 | 102 | } |
| 103 | 103 | $i(divid).innerHTML = ins; |
| 104 | 104 | }, |
| 105 | - p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=listaMapas"; | |
| 105 | + p = i3GEO.configura.locaplic+"/classesphp/metaestat_controle.php?funcao=listaMapas"; | |
| 106 | 106 | i3GEO.util.ajaxGet(p,listaMapas); |
| 107 | 107 | }, |
| 108 | - p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=listaTemplatesMapa"; | |
| 108 | + p = i3GEO.configura.locaplic+"/classesphp/metaestat_controle.php?funcao=listaTemplatesMapa"; | |
| 109 | 109 | i3GEO.util.ajaxGet(p,listaTemplates); |
| 110 | 110 | } |
| 111 | 111 | }; | ... | ... |
ferramentas/navegapostgis/index.js
| ... | ... | @@ -140,7 +140,7 @@ i3GEOF.navegapostgis = { |
| 140 | 140 | i3GEOF.navegapostgis.montaArvore(i3GEOF.navegapostgis.conexao); |
| 141 | 141 | } |
| 142 | 142 | }, |
| 143 | - p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=listaConexao&formato=json", | |
| 143 | + p = i3GEO.configura.locaplic+"/classesphp/metaestat_controle.php?funcao=listaConexao&formato=json", | |
| 144 | 144 | botao = $i("i3GEOFnavegapostgisAplicar"); |
| 145 | 145 | if(botao){ |
| 146 | 146 | botao.style.position = "absolute"; |
| ... | ... | @@ -291,7 +291,7 @@ i3GEOF.navegapostgis = { |
| 291 | 291 | i3GEOF.navegapostgis.ARVORE.draw(); |
| 292 | 292 | |
| 293 | 293 | }, |
| 294 | - p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=esquemasConexao&formato=json&codigo_estat_conexao="+conexao; | |
| 294 | + p = i3GEO.configura.locaplic+"/classesphp/metaestat_controle?funcao=esquemasConexao&formato=json&codigo_estat_conexao="+conexao; | |
| 295 | 295 | cpJSON.call(p,"foo",funcao); |
| 296 | 296 | }, |
| 297 | 297 | listaTabelas: function(node){ |
| ... | ... | @@ -318,7 +318,7 @@ i3GEOF.navegapostgis = { |
| 318 | 318 | } |
| 319 | 319 | node.loadComplete(); |
| 320 | 320 | }, |
| 321 | - p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=tabelasEsquema&formato=json&nome_esquema="+esquema+"&codigo_estat_conexao="+conexao; | |
| 321 | + p = i3GEO.configura.locaplic+"/classesphp/metaestat_controle.php?funcao=tabelasEsquema&formato=json&nome_esquema="+esquema+"&codigo_estat_conexao="+conexao; | |
| 322 | 322 | i3GEOF.navegapostgis.esquema = esquema; |
| 323 | 323 | cpJSON.call(p,"foo",funcao); |
| 324 | 324 | }, |
| ... | ... | @@ -370,7 +370,7 @@ i3GEOF.navegapostgis = { |
| 370 | 370 | $i("i3GEOFnavegapostgisColunas").innerHTML = ins; |
| 371 | 371 | i3GEOF.navegapostgis.geraSql(); |
| 372 | 372 | }, |
| 373 | - p = i3GEO.configura.locaplic+"/admin/php/metaestat.php?funcao=descreveColunasTabela&formato=json&nome_tabela="+tabela+"&nome_esquema="+i3GEOF.navegapostgis.esquema+"&codigo_estat_conexao="+i3GEOF.navegapostgis.conexao; | |
| 373 | + p = i3GEO.configura.locaplic+"/classesphp/metaestat_controle.php?funcao=descreveColunasTabela&formato=json&nome_tabela="+tabela+"&nome_esquema="+i3GEOF.navegapostgis.esquema+"&codigo_estat_conexao="+i3GEOF.navegapostgis.conexao; | |
| 374 | 374 | cpJSON.call(p,"foo",funcao); |
| 375 | 375 | }, |
| 376 | 376 | geraSql: function(){ | ... | ... |
js/caixaDeFerramentas.js
| ... | ... | @@ -88,6 +88,9 @@ i3GEO.caixaDeFerramentas = { |
| 88 | 88 | f.idOndeFolder.html(""); |
| 89 | 89 | f.idOndeLinks.html(""); |
| 90 | 90 | for (i = 0; i < n; i += 1) { |
| 91 | + if(menu[i].Interface && menu[i].Interface != i3GEO.Interface.ATUAL){ | |
| 92 | + continue; | |
| 93 | + } | |
| 91 | 94 | if(subs[menu[i].id].length > 0){ |
| 92 | 95 | t = Mustache.to_html( |
| 93 | 96 | i3GEO.template.ferramentasFolder, |
| ... | ... | @@ -122,6 +125,9 @@ i3GEO.caixaDeFerramentas = { |
| 122 | 125 | f.idOndeFolder.html(""); |
| 123 | 126 | f.idOndeLinks.html(""); |
| 124 | 127 | for (i = 0; i < n; i += 1) { |
| 128 | + if(menu[i].Interface && menu[i].Interface != i3GEO.Interface.ATUAL){ | |
| 129 | + continue; | |
| 130 | + } | |
| 125 | 131 | datan = {"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0": data.n0, "n1":i, "n2": "", "n3": ""}; |
| 126 | 132 | if(menu[i].url){ |
| 127 | 133 | t = Mustache.to_html( |
| ... | ... | @@ -170,6 +176,9 @@ i3GEO.caixaDeFerramentas = { |
| 170 | 176 | f.idOndeFolder.html(""); |
| 171 | 177 | f.idOndeLinks.html(""); |
| 172 | 178 | for (i = 0; i < n; i += 1) { |
| 179 | + if(menu[i].Interface && menu[i].Interface != i3GEO.Interface.ATUAL){ | |
| 180 | + continue; | |
| 181 | + } | |
| 173 | 182 | datan = {"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0": data.n0, "n1":data.n1, "n2": i, "n3": ""}; |
| 174 | 183 | if(menu[i].url){ |
| 175 | 184 | t = Mustache.to_html( | ... | ... |
| 1 | -if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.caixaDeFerramentas={MIGALHA:[],config:{"idOndeFolder":"listaFerramentas","idOndeLinks":"listaFerramentasLinks","idOndeMigalha":"migalhaFerramentas","templateFolder":"templates/ferramentasFolder.html","templateMigalha":"templates/ferramentasMigalha.html","templateLinks":"templates/ferramentasLink.html"},carregaTemplates:function(){var t1=i3GEO.caixaDeFerramentas.config.templateFolder,t2=i3GEO.caixaDeFerramentas.config.templateLinks,t3=i3GEO.caixaDeFerramentas.config.templateMigalha;$.when($.get(t1),$.get(t2),$.get(t3)).done(function(r1,r2,r3){i3GEO.template.ferramentasFolder=r1[0];i3GEO.template.ferramentasLinks=r2[0];i3GEO.template.ferramentasMigalha=r3[0];i3GEO.caixaDeFerramentas.inicia()}).fail(function(){i3GEO.janela.closeMsg($trad("erroTpl"));return})},aguarde:function(){},inicia:function(config){if(config){$.each(config,function(i,v){i3GEO.caixaDeFerramentas.config[i]=v})}i3GEO.caixaDeFerramentas.aguarde();if(!i3GEO.template.ferramentasFolder||!i3GEO.template.ferramentasLinks||!i3GEO.template.ferramentasMigalha){i3GEO.caixaDeFerramentas.carregaTemplates();return}else{i3GEO.caixaDeFerramentas.nivel0()}},migalha:function(data){var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,{"nome":data.nome});$("#"+f.idOndeMigalha).data(data).html(t).click(function(event){var f=i3GEO.caixaDeFerramentas.config;event.stopImmediatePropagation();$("#"+f.idOndeMigalha).off("click");var data=$(this).data();if((data.nivel-1)==0){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel0();i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==1){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==2){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}})},nivel0:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,data;$("#"+f.idOndeMigalha).html(" ");f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(subs[menu[i].id].length>0){t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].nome,"descricao":menu[i].descricao});t=$(t);data={"nivel":1,"nome":menu[i].nome,"id":i,"n0":i,"n1":"","n2":"","n3":""};t.find("a").data(data).click(function(){$(this).find("a").off("click");var data=$(this).data();i3GEO.caixaDeFerramentas.config.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})});i3GEO.caixaDeFerramentas.config.idOndeFolder.append(t)}}},nivel1:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){datan={"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":i,"n2":"","n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,data);f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);f.idOndeFolder.show()})});f.idOndeFolder.append(t)}}data.nivel=1;data.nome=confm.menu[data.id].nome;data.n0=data.id;i3GEO.caixaDeFerramentas.migalha(data)},nivel2:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id][data.n1].submenu.itemdata[0],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){datan={"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":data.n1,"n2":i,"n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var t=Mustache.to_html(i3GEO.caixaDeFerramentas.config.templateMigalha,data)});f.idOndeFolder.append(t)}}data.nivel=2;data.id=data.n0;i3GEO.caixaDeFerramentas.migalha(data)}}; | |
| 2 | 1 | \ No newline at end of file |
| 2 | +if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.caixaDeFerramentas={MIGALHA:[],config:{"idOndeFolder":"listaFerramentas","idOndeLinks":"listaFerramentasLinks","idOndeMigalha":"migalhaFerramentas","templateFolder":"templates/ferramentasFolder.html","templateMigalha":"templates/ferramentasMigalha.html","templateLinks":"templates/ferramentasLink.html"},carregaTemplates:function(){var t1=i3GEO.caixaDeFerramentas.config.templateFolder,t2=i3GEO.caixaDeFerramentas.config.templateLinks,t3=i3GEO.caixaDeFerramentas.config.templateMigalha;$.when($.get(t1),$.get(t2),$.get(t3)).done(function(r1,r2,r3){i3GEO.template.ferramentasFolder=r1[0];i3GEO.template.ferramentasLinks=r2[0];i3GEO.template.ferramentasMigalha=r3[0];i3GEO.caixaDeFerramentas.inicia()}).fail(function(){i3GEO.janela.closeMsg($trad("erroTpl"));return})},aguarde:function(){},inicia:function(config){if(config){$.each(config,function(i,v){i3GEO.caixaDeFerramentas.config[i]=v})}i3GEO.caixaDeFerramentas.aguarde();if(!i3GEO.template.ferramentasFolder||!i3GEO.template.ferramentasLinks||!i3GEO.template.ferramentasMigalha){i3GEO.caixaDeFerramentas.carregaTemplates();return}else{i3GEO.caixaDeFerramentas.nivel0()}},migalha:function(data){var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,{"nome":data.nome});$("#"+f.idOndeMigalha).data(data).html(t).click(function(event){var f=i3GEO.caixaDeFerramentas.config;event.stopImmediatePropagation();$("#"+f.idOndeMigalha).off("click");var data=$(this).data();if((data.nivel-1)==0){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel0();i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==1){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==2){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}})},nivel0:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,data;$("#"+f.idOndeMigalha).html(" ");f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}if(subs[menu[i].id].length>0){t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].nome,"descricao":menu[i].descricao});t=$(t);data={"nivel":1,"nome":menu[i].nome,"id":i,"n0":i,"n1":"","n2":"","n3":""};t.find("a").data(data).click(function(){$(this).find("a").off("click");var data=$(this).data();i3GEO.caixaDeFerramentas.config.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})});i3GEO.caixaDeFerramentas.config.idOndeFolder.append(t)}}},nivel1:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":i,"n2":"","n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,data);f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);f.idOndeFolder.show()})});f.idOndeFolder.append(t)}}data.nivel=1;data.nome=confm.menu[data.id].nome;data.n0=data.id;i3GEO.caixaDeFerramentas.migalha(data)},nivel2:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id][data.n1].submenu.itemdata[0],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":data.n1,"n2":i,"n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var t=Mustache.to_html(i3GEO.caixaDeFerramentas.config.templateMigalha,data)});f.idOndeFolder.append(t)}}data.nivel=2;data.id=data.n0;i3GEO.caixaDeFerramentas.migalha(data)}}; | |
| 3 | 3 | \ No newline at end of file | ... | ... |
| 1 | -if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.editor={botoes:{'zoomin':false,'zoomout':false,'pan':false,'zoombox':false,'zoomtot':false,'legenda':false,'distancia':false,'area':false,'identifica':false,'linha':true,'ponto':true,'poligono':true,'texto':true,'corta':true,'edita':true,'listag':true,'selecao':true,'selecaotudo':true,'apaga':true,'procura':false,'propriedades':true,'salva':true,'ajuda':true,'fecha':true,'tools':true,'undo':true,'frente':true},inicia:function(){i3GEO.eventos.cliquePerm.desativa();i3GEO.editor[i3GEO.Interface.ATUAL].inicia("janelaEditorVetorial")},googlemaps:{inicia:function(idjanela){var temp=function(){var cabecalho,minimiza,fecha,janela=YAHOO.i3GEO.janela.manager.find("i3GEOjanelaEditor");if(janela){janela.destroy()}cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("i3GEOjanelaEditor")};janela=i3GEO.janela.cria("350px","100px","","","","<div class='i3GeoTituloJanela'>Editor</div>","i3GEOjanelaEditor",false,"hd",cabecalho,minimiza);$i("i3GEOjanelaEditor_corpo").style.backgroundColor="white";i3GEO.editorGM.inicia("i3GEOjanelaEditor_corpo");fecha=function(){var temp=window.confirm($trad("x94"));if(i3GEO.eventos){i3GEO.eventos.cliquePerm.ativa()}if(temp===true){i3GEO.desenho.googlemaps.destroyFeatures(i3GEO.desenho.googlemaps.shapes)}};$(janela[0].close).click(fecha)};if(!i3GEO.editorGM){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/editorgm/editorgm_compacto.js",temp,"editorgm.js",true)}else{temp.call()}}},openlayers:{inicia:function(idjanela){if(!i3GEO.editorOL){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/editorol/editorol.js","i3GEO.editor.openlayers.ativaPainel('"+idjanela+"')","editorol.js",true)}else{if(!i3GEO.desenho.layergrafico){i3GEO.desenho.openlayers.criaLayerGrafico();i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}if(!i3GEO.editorOL.backup){i3GEO.editorOL.backup=new ol.layer.Vector({source:new ol.source.Vector({features:new ol.Collection(),useSpatialIndex:false,name:"Backup"}),visible:false});i3GEO.editorOL.backup.setMap(i3geoOL);i3GEO.editorOL.backup.getFeatures=function(){return i3GEO.editorOL.backup.getSource().getFeatures()}}i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes)}},criaJanela:function(){if($i("i3GEOjanelaEditor")){return"i3GEOjanelaEditor"}var janela,divid,titulo,cabecalho,minimiza;cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("i3GEOjanelaEditor")};titulo="<div class='i3GeoTituloJanela'>"+$trad("u29")+"</div>";janela=i3GEO.janela.cria("300px","200px","","","",titulo,"i3GEOjanelaEditor",false,"hd",cabecalho,minimiza);divid=janela[2].id;$i("i3GEOjanelaEditor_corpo").style.backgroundColor="white";$i("i3GEOjanelaEditor_corpo").style.textAlign="left";return divid},ativaPainel:function(idjanela){i3GEO.editorOL.fundo="";i3GEO.editorOL.mapa=i3geoOL;i3GEO.editorOL.maxext="";i3GEO.editorOL.controles=[];if(!i3GEO.desenho.layergrafico){i3GEO.desenho.openlayers.criaLayerGrafico()}if(idjanela){i3GEO.editorOL.criaBotoes(i3GEO.editor.botoes)}}}}; | |
| 2 | 1 | \ No newline at end of file |
| 2 | +if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.editor={botoes:{'zoomin':false,'zoomout':false,'pan':false,'zoombox':false,'zoomtot':false,'legenda':false,'distancia':false,'area':false,'identifica':false,'linha':true,'ponto':true,'poligono':true,'texto':true,'corta':true,'edita':true,'listag':true,'selecao':true,'selecaotudo':true,'apaga':true,'procura':false,'propriedades':true,'salva':true,'ajuda':true,'fecha':true,'tools':true,'undo':true,'frente':true},inicia:function(){i3GEO.eventos.cliquePerm.desativa();i3GEO.editor[i3GEO.Interface.ATUAL].inicia("janelaEditorVetorial")},googlemaps:{inicia:function(idjanela){}},openlayers:{inicia:function(idjanela){if(!i3GEO.editorOL){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/editorol/editorol.js","i3GEO.editor.openlayers.ativaPainel('"+idjanela+"')","editorol.js",true)}else{if(!i3GEO.desenho.layergrafico){i3GEO.desenho.openlayers.criaLayerGrafico();i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}if(!i3GEO.editorOL.backup){i3GEO.editorOL.backup=new ol.layer.Vector({source:new ol.source.Vector({features:new ol.Collection(),useSpatialIndex:false,name:"Backup"}),visible:false});i3GEO.editorOL.backup.setMap(i3geoOL);i3GEO.editorOL.backup.getFeatures=function(){return i3GEO.editorOL.backup.getSource().getFeatures()}}i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes)}},criaJanela:function(){if($i("i3GEOjanelaEditor")){return"i3GEOjanelaEditor"}var janela,divid,titulo,cabecalho,minimiza;cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("i3GEOjanelaEditor")};titulo="<div class='i3GeoTituloJanela'>"+$trad("u29")+"</div>";janela=i3GEO.janela.cria("300px","200px","","","",titulo,"i3GEOjanelaEditor",false,"hd",cabecalho,minimiza);divid=janela[2].id;$i("i3GEOjanelaEditor_corpo").style.backgroundColor="white";$i("i3GEOjanelaEditor_corpo").style.textAlign="left";return divid},ativaPainel:function(idjanela){i3GEO.editorOL.fundo="";i3GEO.editorOL.mapa=i3geoOL;i3GEO.editorOL.maxext="";i3GEO.editorOL.controles=[];if(!i3GEO.desenho.layergrafico){i3GEO.desenho.openlayers.criaLayerGrafico()}if(idjanela){i3GEO.editorOL.criaBotoes(i3GEO.editor.botoes)}}}}; | |
| 3 | 3 | \ No newline at end of file | ... | ... |
js/editor.js
| ... | ... | @@ -43,54 +43,9 @@ i3GEO.editor = |
| 43 | 43 | }, |
| 44 | 44 | // carrega as opcoes de edicao se a interface for do googlemaps |
| 45 | 45 | googlemaps : { |
| 46 | + //removido em funcao da politica do google de impedir engenharia reversa em sua base de dados | |
| 46 | 47 | inicia : function(idjanela) { |
| 47 | - var temp = | |
| 48 | - function() { | |
| 49 | - var cabecalho, minimiza, fecha, janela = YAHOO.i3GEO.janela.manager.find("i3GEOjanelaEditor"); | |
| 50 | - if (janela) { | |
| 51 | - janela.destroy(); | |
| 52 | - } | |
| 53 | - cabecalho = function() { | |
| 54 | - }; | |
| 55 | - minimiza = function() { | |
| 56 | - i3GEO.janela.minimiza("i3GEOjanelaEditor"); | |
| 57 | - }; | |
| 58 | - janela = | |
| 59 | - i3GEO.janela.cria( | |
| 60 | - "350px", | |
| 61 | - "100px", | |
| 62 | - "", | |
| 63 | - "", | |
| 64 | - "", | |
| 65 | - "<div class='i3GeoTituloJanela'>Editor</div>", | |
| 66 | - "i3GEOjanelaEditor", | |
| 67 | - false, | |
| 68 | - "hd", | |
| 69 | - cabecalho, | |
| 70 | - minimiza); | |
| 71 | - $i("i3GEOjanelaEditor_corpo").style.backgroundColor = "white"; | |
| 72 | - i3GEO.editorGM.inicia("i3GEOjanelaEditor_corpo"); | |
| 73 | - fecha = function() { | |
| 74 | - var temp = window.confirm($trad("x94")); | |
| 75 | - if (i3GEO.eventos) { | |
| 76 | - i3GEO.eventos.cliquePerm.ativa(); | |
| 77 | - } | |
| 78 | - if (temp === true) { | |
| 79 | - i3GEO.desenho.googlemaps.destroyFeatures(i3GEO.desenho.googlemaps.shapes); | |
| 80 | - } | |
| 81 | - }; | |
| 82 | - $( janela[0].close ).click(fecha); | |
| 83 | - }; | |
| 84 | - // @TODO incluir o js compactado ao inves do original | |
| 85 | - if (!i3GEO.editorGM) { | |
| 86 | - i3GEO.util.scriptTag( | |
| 87 | - i3GEO.configura.locaplic + "/ferramentas/editorgm/editorgm_compacto.js", | |
| 88 | - temp, | |
| 89 | - "editorgm.js", | |
| 90 | - true); | |
| 91 | - } else { | |
| 92 | - temp.call(); | |
| 93 | - } | |
| 48 | + | |
| 94 | 49 | } |
| 95 | 50 | }, |
| 96 | 51 | openlayers : { | ... | ... |
js/i3geo_tudo_compacto7.js
| ... | ... | @@ -269,7 +269,7 @@ if(typeof(i3GEO)==='undefined'){var i3GEO={}}var objposicaocursor={ddx:"",ddy:"" |
| 269 | 269 | if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.arvoreDeTemas={IDSMENUS:[],buscaTema2:function(palavra){if(palavra===""){return}var busca,root,nodePalavra="";resultadoProcurar=function(retorno){var ig,montaTexto=function(ngSgrupo){var tempn,ngTema,tempng,mostra,d,lk="",st,sg;tempn=ngSgrupo.length;for(sg=0;sg<tempn;sg+=1){ngTema=ngSgrupo[sg].temas;tempng=ngTema.length;for(st=0;st<tempng;st+=1){mostra=true;try{if(i3GEO.arvoreDeTemas.FILTRADOWNLOAD&&ngTema[st].download==="nao"){mostra=false}if(i3GEO.arvoreDeTemas.FILTRAOGC&&ngTema[st].ogc==="nao"){mostra=false}}catch(e){}if(mostra){d=i3GEO.arvoreDeTemas.montaTextoTema("gray",ngTema[st]);if(ngTema[st].link!==" "){lk="<a href='"+ngTema[st].link+"' target='blank'> fonte</a>"}if(ngSgrupo[sg].subgrupo){d+="<td style='text-allign:left'> ("+(ngSgrupo[sg].subgrupo)+") "+lk+"</td>"}else{d+="<td style='text-allign:left'> ("+(ngSgrupo[sg].grupo)+")"+lk+"</td>"}}conta+=1}}}};busca=function(){i3GEO.php.procurartemas2(resultadoProcurar,i3GEO.util.removeAcentos(palavra))}},comboMenus:function(locaplic,funcaoOnchange,idDestino,idCombo,largura,altura){i3GEO.configura.locaplic=locaplic;var combo=function(retorno){var ob,ins,ig;ob=retorno.data;ins="<select id='"+idCombo+"' SIZE="+altura+" style=width:"+largura+"px onchange='"+funcaoOnchange+"(this.value)' ><option value='' >Escolha um menu:</option>";for(ig=0;ig<ob.length;ig+=1){if(ob[ig].publicado!=="nao"&&ob[ig].publicado!=="NAO"){if(ob[ig].nomemenu){ins+="<option value="+ob[ig].idmenu+" >"+ob[ig].nomemenu+"</option>"}}}$i(idDestino).innerHTML=ins+"</select>";return retorno.data};i3GEO.php.pegalistademenus(combo)},comboGruposMenu:function(locaplic,funcaoOnchange,idDestino,idCombo,largura,altura,id_menu){i3GEO.configura.locaplic=locaplic;i3GEO.arvoreDeTemas.temasRaizGrupos=[];var combo=function(retorno){var ins,ig,obGrupos=retorno.data;ins="<select id='"+idCombo+"' SIZE="+altura+" style=width:"+largura+"px onchange='"+funcaoOnchange+"(this.value)' ><option value='' >Escolha um grupo:</option>";for(ig=0;ig<obGrupos.grupos.length;ig+=1){if(obGrupos.grupos[ig].nome){ins+="<option value="+obGrupos.grupos[ig].id_n1+" >"+obGrupos.grupos[ig].nome+"</option>"}i3GEO.arvoreDeTemas.temasRaizGrupos[obGrupos.grupos[ig].id_n1]=obGrupos.grupos[ig].temasgrupo}$i(idDestino).innerHTML=ins+"</select>"};i3GEO.php.pegalistadegrupos(combo,id_menu,"nao")},comboSubGruposMenu:function(locaplic,funcaoOnchange,idDestino,idCombo,idGrupo,largura,altura){if(idGrupo!==""){var combo=function(retorno){var ins,sg,ig;ins="<select id='"+idCombo+"' size="+altura+" style=width:"+largura+"px onchange='"+funcaoOnchange+"(\""+idGrupo+"\",this.value)' ><option value='' >Escolha um sub-grupo:</option>";if(retorno.data.subgrupo){sg=retorno.data.subgrupo;for(ig=0;ig<sg.length;ig+=1){ins+="<option value="+sg[ig].id_n2+" >"+sg[ig].nome+"</option>"}}$i(idDestino).innerHTML=ins+"</select>"};i3GEO.php.pegalistadeSubgrupos(combo,"",idGrupo)}},comboTemasMenu:function(locaplic,funcaoOnchange,idDestino,idCombo,idGrupo,idSubGrupo,largura,altura,id_menu,temas){var combo=function(retorno){var ins,sg,ig;if(idSubGrupo!=""){ins="<select id='"+idCombo+"' size="+altura+" style=width:"+largura+"px onchange='"+funcaoOnchange+"("+idGrupo+","+idSubGrupo+",this.value)' ><option value='' >Escolha um tema:</option>"}else{ins="<select id='"+idCombo+"' size="+altura+" style=width:"+largura+"px onchange='"+funcaoOnchange+"("+idGrupo+",\"\",this.value)' ><option value='' >Escolha um tema:</option>"}if(typeof(retorno.data)!=='undefined'){retorno=retorno.data.temas}sg=retorno.length;for(ig=0;ig<sg;ig++){ins+="<option value="+retorno[ig].tid+" >"+retorno[ig].nome+"</option>"}$i(idDestino).innerHTML=ins+"</select>"};if(typeof(temas)==='undefined'||temas===""){i3GEO.php.pegalistadetemas(combo,id_menu,idGrupo,idSubGrupo)}else{combo(temas)}},dialogo:{uploadarquivo:function(){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/uploadarquivos/dependencias.php","i3GEOF.uploadarquivos.iniciaJanelaFlutuante()","i3GEOF.uploadarquivos_script")},conectaservico:function(){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/conectarservicos/dependencias.php","i3GEOF.conectarservicos.iniciaJanelaFlutuante()","i3GEOF.conectarservicos_script")},carouselTemas:function(){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/carouseltemas/index.js","i3GEOF.carouseltemas.criaJanelaFlutuante()","i3GEOF.carouseltemas_script")},buscaInde:function(){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/buscainde/dependencias.php","i3GEOF.buscainde.iniciaJanelaFlutuante()","i3GEOF.buscainde_script")},nuvemTags:function(){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/nuvemtags/dependencias.php","i3GEOF.nuvemtags.iniciaJanelaFlutuante()","i3GEOF.nuvemtags_script")},nuvemTagsFlash:function(){i3GEO.janela.cria("550px","350px",i3GEO.configura.locaplic+"/ferramentas/nuvemtagsflash/index.htm","","",$trad("x44"))},navegacaoDir:function(){i3GEO.janela.cria("550px","350px",i3GEO.configura.locaplic+"/ferramentas/navegacaodir/index.htm","","","<div class='i3GeoTituloJanela'>"+$trad("x45")+"</div>")},importarwmc:function(){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/importarwmc/dependencias.php","i3GEOF.importarwmc.iniciaJanelaFlutuante()","i3GEOF.importarwmc_script")},conectarwfs:function(){i3GEO.janela.cria("400px","300px",i3GEO.configura.locaplic+"/ferramentas/conectarwfs/index.htm","","","<div class='i3GeoTituloJanela'>WFS</div>")},downloadbase:function(){window.open(i3GEO.configura.locaplic+"/datadownload.htm")}}}; |
| 270 | 270 | // |
| 271 | 271 | //compactados/editor_compacto.js |
| 272 | -if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.editor={botoes:{'zoomin':false,'zoomout':false,'pan':false,'zoombox':false,'zoomtot':false,'legenda':false,'distancia':false,'area':false,'identifica':false,'linha':true,'ponto':true,'poligono':true,'texto':true,'corta':true,'edita':true,'listag':true,'selecao':true,'selecaotudo':true,'apaga':true,'procura':false,'propriedades':true,'salva':true,'ajuda':true,'fecha':true,'tools':true,'undo':true,'frente':true},inicia:function(){i3GEO.eventos.cliquePerm.desativa();i3GEO.editor[i3GEO.Interface.ATUAL].inicia("janelaEditorVetorial")},googlemaps:{inicia:function(idjanela){var temp=function(){var cabecalho,minimiza,fecha,janela=YAHOO.i3GEO.janela.manager.find("i3GEOjanelaEditor");if(janela){janela.destroy()}cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("i3GEOjanelaEditor")};janela=i3GEO.janela.cria("350px","100px","","","","<div class='i3GeoTituloJanela'>Editor</div>","i3GEOjanelaEditor",false,"hd",cabecalho,minimiza);$i("i3GEOjanelaEditor_corpo").style.backgroundColor="white";i3GEO.editorGM.inicia("i3GEOjanelaEditor_corpo");fecha=function(){var temp=window.confirm($trad("x94"));if(i3GEO.eventos){i3GEO.eventos.cliquePerm.ativa()}if(temp===true){i3GEO.desenho.googlemaps.destroyFeatures(i3GEO.desenho.googlemaps.shapes)}};$(janela[0].close).click(fecha)};if(!i3GEO.editorGM){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/editorgm/editorgm_compacto.js",temp,"editorgm.js",true)}else{temp.call()}}},openlayers:{inicia:function(idjanela){if(!i3GEO.editorOL){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/editorol/editorol.js","i3GEO.editor.openlayers.ativaPainel('"+idjanela+"')","editorol.js",true)}else{if(!i3GEO.desenho.layergrafico){i3GEO.desenho.openlayers.criaLayerGrafico();i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}if(!i3GEO.editorOL.backup){i3GEO.editorOL.backup=new ol.layer.Vector({source:new ol.source.Vector({features:new ol.Collection(),useSpatialIndex:false,name:"Backup"}),visible:false});i3GEO.editorOL.backup.setMap(i3geoOL);i3GEO.editorOL.backup.getFeatures=function(){return i3GEO.editorOL.backup.getSource().getFeatures()}}i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes)}},criaJanela:function(){if($i("i3GEOjanelaEditor")){return"i3GEOjanelaEditor"}var janela,divid,titulo,cabecalho,minimiza;cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("i3GEOjanelaEditor")};titulo="<div class='i3GeoTituloJanela'>"+$trad("u29")+"</div>";janela=i3GEO.janela.cria("300px","200px","","","",titulo,"i3GEOjanelaEditor",false,"hd",cabecalho,minimiza);divid=janela[2].id;$i("i3GEOjanelaEditor_corpo").style.backgroundColor="white";$i("i3GEOjanelaEditor_corpo").style.textAlign="left";return divid},ativaPainel:function(idjanela){i3GEO.editorOL.fundo="";i3GEO.editorOL.mapa=i3geoOL;i3GEO.editorOL.maxext="";i3GEO.editorOL.controles=[];if(!i3GEO.desenho.layergrafico){i3GEO.desenho.openlayers.criaLayerGrafico()}if(idjanela){i3GEO.editorOL.criaBotoes(i3GEO.editor.botoes)}}}}; | |
| 272 | +if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.editor={botoes:{'zoomin':false,'zoomout':false,'pan':false,'zoombox':false,'zoomtot':false,'legenda':false,'distancia':false,'area':false,'identifica':false,'linha':true,'ponto':true,'poligono':true,'texto':true,'corta':true,'edita':true,'listag':true,'selecao':true,'selecaotudo':true,'apaga':true,'procura':false,'propriedades':true,'salva':true,'ajuda':true,'fecha':true,'tools':true,'undo':true,'frente':true},inicia:function(){i3GEO.eventos.cliquePerm.desativa();i3GEO.editor[i3GEO.Interface.ATUAL].inicia("janelaEditorVetorial")},googlemaps:{inicia:function(idjanela){}},openlayers:{inicia:function(idjanela){if(!i3GEO.editorOL){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/editorol/editorol.js","i3GEO.editor.openlayers.ativaPainel('"+idjanela+"')","editorol.js",true)}else{if(!i3GEO.desenho.layergrafico){i3GEO.desenho.openlayers.criaLayerGrafico();i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}if(!i3GEO.editorOL.backup){i3GEO.editorOL.backup=new ol.layer.Vector({source:new ol.source.Vector({features:new ol.Collection(),useSpatialIndex:false,name:"Backup"}),visible:false});i3GEO.editorOL.backup.setMap(i3geoOL);i3GEO.editorOL.backup.getFeatures=function(){return i3GEO.editorOL.backup.getSource().getFeatures()}}i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes)}},criaJanela:function(){if($i("i3GEOjanelaEditor")){return"i3GEOjanelaEditor"}var janela,divid,titulo,cabecalho,minimiza;cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("i3GEOjanelaEditor")};titulo="<div class='i3GeoTituloJanela'>"+$trad("u29")+"</div>";janela=i3GEO.janela.cria("300px","200px","","","",titulo,"i3GEOjanelaEditor",false,"hd",cabecalho,minimiza);divid=janela[2].id;$i("i3GEOjanelaEditor_corpo").style.backgroundColor="white";$i("i3GEOjanelaEditor_corpo").style.textAlign="left";return divid},ativaPainel:function(idjanela){i3GEO.editorOL.fundo="";i3GEO.editorOL.mapa=i3geoOL;i3GEO.editorOL.maxext="";i3GEO.editorOL.controles=[];if(!i3GEO.desenho.layergrafico){i3GEO.desenho.openlayers.criaLayerGrafico()}if(idjanela){i3GEO.editorOL.criaBotoes(i3GEO.editor.botoes)}}}}; | |
| 273 | 273 | // |
| 274 | 274 | //compactados/coordenadas_compacto.js |
| 275 | 275 | if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.coordenadas={padrao:"geoProj",defOrigem:"+proj=longlat +ellps=GRS67 +no_defs",config:{"geoProj":{idhtml:"localizarxy",tipo:"geo",titulo:"Geo",ativo:true,defepsg:""},"dd":{idhtml:"localizarxy",tipo:"metrica",titulo:"Déc. de grau",ativo:true,defepsg:""},"geohash":{idhtml:"localizarxy",tipo:"codigo",tipoCodigo:"geohash",titulo:"GeoHash",ativo:true},"policonicaSad69":{idhtml:"localizarxy",tipo:"metrica",titulo:"Polic SAD-69",ativo:true,defepsg:"+proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=aust_SA +units=m +no_defs"},"utmSad69Proj":{idhtml:"localizarxy",tipo:"utm",titulo:"UTM Sad-69",ativo:true,defepsg:"",zona:{"19N":"+proj=utm +zone=19 +ellps=aust_SA +units=m +no_defs","20N":"+proj=utm +zone=20 +ellps=aust_SA +units=m +no_defs","21N":"+proj=utm +zone=21 +ellps=aust_SA +units=m +no_defs","22N":"+proj=utm +zone=22 +ellps=aust_SA +units=m +no_defs","17S":"+proj=utm +zone=17 +south +ellps=aust_SA +units=m +no_defs","18S":"+proj=utm +zone=18 +south +ellps=aust_SA +units=m +no_defs","19S":"+proj=utm +zone=19 +south +ellps=aust_SA +units=m +no_defs","20S":"+proj=utm +zone=20 +south +ellps=aust_SA +units=m +no_defs","21S":"+proj=utm +zone=21 +south +ellps=aust_SA +units=m +no_defs","22S":"+proj=utm +zone=22 +south +ellps=aust_SA +units=m +no_defs","23S":"+proj=utm +zone=23 +south +ellps=aust_SA +units=m +no_defs","24S":"+proj=utm +zone=24 +south +ellps=aust_SA +units=m +no_defs","25S":"+proj=utm +zone=25 +south +ellps=aust_SA +units=m +no_defs"}},"utmSirgas2000Proj":{idhtml:"localizarxy",tipo:"utm",titulo:"UTM Sirgas",ativo:true,defepsg:"",zona:{"11N":"+proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","12N":"+proj=utm +zone=12 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","13N":"+proj=utm +zone=13 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","14N":"+proj=utm +zone=14 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","15N":"+proj=utm +zone=15 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","16N":"+proj=utm +zone=16 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","17N":"+proj=utm +zone=17 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","18N":"+proj=utm +zone=18 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","19N":"+proj=utm +zone=19 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","20N":"+proj=utm +zone=20 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","21N":"+proj=utm +zone=21 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","22N":"+proj=utm +zone=22 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","17S":"+proj=utm +zone=17 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","18S":"+proj=utm +zone=18 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","19S":"+proj=utm +zone=19 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","20S":"+proj=utm +zone=20 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","21S":"+proj=utm +zone=21 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","22S":"+proj=utm +zone=22 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","23S":"+proj=utm +zone=23 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","24S":"+proj=utm +zone=24 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","25S":"+proj=utm +zone=25 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"}}},PARAMETROS:{"mostraCoordenadasUTM":{idhtml:"localizarxy"},"mostraCoordenadasGEO":{idhtml:"localizarxy"},"mostraCoordenadasGeohash":{idhtml:"localizarxy"}},MODOTEXTO:"",atualizaLocalizarGeo:function(id,x,y){if(!id||id==""){id="coordgeotabela"}if(typeof(x)==='undefined'){x=objposicaocursor.dmsx}if(typeof(y)==='undefined'){y=objposicaocursor.dmsy}var temp=$i(id);if(temp&&temp.style.display==="block"){i3GEO.coordenadas.atualizaGeo(x,y,id)}else{i3GEO.eventos.removeEventos("MOUSEMOVE",["i3GEO.coordenadas.atualizaLocalizarGeo('localizarxygeoProj')"])}},geo2zonaUtm:function(l){l=(l*1)+180;l=l/6;return parseInt(l,10)+1},criaMascaraDMS:function(prefixo,titulo,caixa){var ins='<div style="display:block;" class="i3GeoMascaraCoord" id='+prefixo+' >'+caixa+' X: '+'<input type="text" name="" value="-00" size="3" title="grau" id="'+prefixo+'xg" onclick="javascript:this.select();">'+'<input type="text" name="" value="00" size="2" title="minuto" id="'+prefixo+'xm" onclick="javascript:this.select();">'+'<input type="text" name="" value="00.00" size="5" title="segundo" id="'+prefixo+'xs" onclick="javascript:this.select();">'+' Y: '+'<input type="text" name="" value="-00" size="3" title="grau" id="'+prefixo+'yg" onclick="javascript:this.select();">'+'<input type="text" name="" value="00" size="2" title="minuto" id="'+prefixo+'ym" onclick="javascript:this.select();">'+'<input type="text" name="" value="00.00" size="5" title="segundo" id="'+prefixo+'ys" onclick="javascript:this.select();">',temp='var '+prefixo+'xxx = i3GEO.calculo.dms2dd($i(\''+prefixo+'xg\').value,$i(\''+prefixo+'xm\').value,$i(\''+prefixo+'xs\').value);'+'var '+prefixo+'yyy = i3GEO.calculo.dms2dd($i(\''+prefixo+'yg\').value,$i(\''+prefixo+'ym\').value,$i(\''+prefixo+'ys\').value);'+'i3GEO.navega.zoomponto(i3GEO.configura.locaplic,i3GEO.configura.sid,'+prefixo+'xxx,'+prefixo+'yyy);';ins+='<img class=ticfind style="margin-left:8px;" title=zoom onclick="'+temp+'" src="'+i3GEO.configura.locaplic+"/imagens/branco.gif"+'" />'+"</div>";return ins},atualizaGeo:function(dmsx,dmsy,prefixo){var x=dmsx.split(" "),y=dmsy.split(" ");if($i(prefixo+"xg")){$i(prefixo+"xg").value=x[0];$i(prefixo+"xm").value=x[1];$i(prefixo+"xs").value=x[2];$i(prefixo+"yg").value=y[0];$i(prefixo+"ym").value=y[1];$i(prefixo+"ys").value=y[2]}i3GEO.coordenadas.MODOTEXTO+="DMS - Latitude: "+y[0]+" "+y[1]+" "+y[2]+" Longitude: "+x[0]+" "+x[1]+" "+x[2]+"<br><br>"},criaMascaraMetrica:function(prefixo,titulo,caixa){var ins="<div style='display:block;' id="+prefixo+" class='i3GeoMascaraCoord' >"+caixa+" X: "+'<input type="text" name="" value="00" size="12" title="X" id="'+prefixo+'X" >'+" Y: "+'<input type="text" name="" value="00" size="12" title="Y" id="'+prefixo+'Y" >'+" Zn: "+'<input type="text" name="" value="--" size="2" title="Zona" id="'+prefixo+'ZN" >'+"</div>";return ins},criaMascaraCodigo:function(prefixo,titulo,caixa,tipoCodigo){var funcao="",ins="";if(tipoCodigo==="geohash"){funcao="i3GEO.coordenadas.geohash.zoomCodigo(\'"+prefixo+"Codigo\')"}ins="<div style='display:block;' id="+prefixo+" class='i3GeoMascaraCoord' >"+caixa+" "+'<input type="text" name="" value="00" size="12" title="Cod" id="'+prefixo+'Codigo" >'+" "+'<img class=ticfind style="margin-left:8px;" title=zoom onclick="'+funcao+'" src="'+i3GEO.configura.locaplic+"/imagens/branco.gif"+'" />'+"</div>";return ins},atualizaCodigo:function(onde,configProj,x,y){var remove=function(){i3GEO.eventos.removeEventos("MOUSEMOVE",["i3GEO.coordenadas.atualizaCodigo('"+onde+"','"+configProj+"')"])};var ondeValor=$i(onde+configProj+"Codigo"),temp=i3GEO.coordenadas.config[configProj],codigo="";onde=$i(onde);if(onde&&onde.style.display==="none"){remove();return}if(typeof(x)==='undefined'){x=objposicaocursor.ddx}if(typeof(y)==='undefined'){y=objposicaocursor.ddy}if(temp.tipoCodigo==="geohash"){if($i("localizarxygeohash")&&$i("localizarxygeohash").style.display==="none"){i3GEO.eventos.removeEventos("MOUSEMOVE",["i3GEO.coordenadas.atualizaCodigo('localizarxy','geohash')"])}codigo=i3GEO.coordenadas.geohash.encodeGeoHash(y,x)}i3GEO.coordenadas.MODOTEXTO+=temp.titulo+" : "+codigo+"<br><br>";if(ondeValor){ondeValor.value=codigo}},atualizaProj4:function(onde,configProj,x,y){var remove=function(){i3GEO.eventos.removeEventos("MOUSEMOVE",["i3GEO.coordenadas.atualizaProj4('"+onde+"','"+configProj+"')"])};var zona,temp,p,destino="",iu=i3GEO.util;temp=i3GEO.coordenadas.config[configProj];if($i(onde+configProj)&&$i(onde+configProj).style.display==="none"){remove();return}if(temp.tipo==="metrica"){destino=temp.defepsg}if(typeof(x)==='undefined'){x=objposicaocursor.ddx}if(typeof(y)==='undefined'){y=objposicaocursor.ddy}if(temp.tipo==="utm"){zona=i3GEO.coordenadas.geo2zonaUtm(x);if($i(onde+configProj+"ZN")){$i(onde+configProj+"ZN").value=zona}if(objposicaocursor.ddy*1>0){destino=temp.zona[zona+"N"]}else{destino=temp.zona[zona+"S"]}if(typeof(destino)==='undefined'){iu.defineValor(onde+configProj+"X","value","?");iu.defineValor(onde+configProj+"Y","value","?");return}}if(temp.defepsg===""&&temp.tipo==="metrica"){p={x:x,y:y}}else{p=i3GEO.coordenadas.calculaProj4(i3GEO.coordenadas.defOrigem,destino,x,y)}iu.defineValor(onde+configProj+"X","value",p.x);iu.defineValor(onde+configProj+"Y","value",p.y);i3GEO.coordenadas.MODOTEXTO+=temp.titulo+" - X: "+p.x+" Y: "+p.y+"<br><br>"},calculaProj4:function(origem,destino,x,y){Proj4js.defs={'ORIGEM':origem,'DESTINO':destino};Proj4js.getScriptLocation=function(){return i3GEO.configura.locaplic+"/pacotes/proj4js/lib/"};var source=new Proj4js.Proj("ORIGEM"),dest=new Proj4js.Proj("DESTINO"),p=new Proj4js.Point(x,y);Proj4js.transform(source,dest,p);return p},ativaBloco:function(prefixo){var tipos=i3GEO.util.listaChaves(i3GEO.coordenadas.config),n=tipos.length,temp,i=0;for(i=0;i<n;i++){temp=i3GEO.coordenadas.config[tipos[i]];if(temp.ativo===true){if(tipos[i]===this.padrao){$i(prefixo+tipos[i]).style.display="block"}else{$i(prefixo+tipos[i]).style.display="none"}}}},mudaTipo:function(obj,onde){if(obj.value=="janela"){i3GEO.coordenadas.mostraCoordenadasJanela();obj.value="geoProj"}this.padrao=obj.value;i3GEO.coordenadas.ativaBloco(onde);i3GEO.coordenadas.ativaEventos()},mostraCoordenadasJanela:function(x,y){var tipos=i3GEO.util.listaChaves(i3GEO.coordenadas.config),n=tipos.length,temp,ins="",i=0,caixa,janela,nomeFunc;caixa="";for(i=0;i<n;i+=1){temp=i3GEO.coordenadas.config[tipos[i]];if(temp.ativo===true){if(temp.tipo==="geo"){ins+=i3GEO.coordenadas.criaMascaraDMS("coordgeotabela"+tipos[i],temp.titulo,caixa)}else{if(temp.tipo==="codigo"){ins+=i3GEO.coordenadas.criaMascaraCodigo("coordgeotabela"+tipos[i],temp.titulo,temp.titulo,temp.tipoCodigo)}else{ins+=i3GEO.coordenadas.criaMascaraMetrica("coordgeotabela"+tipos[i],temp.titulo,caixa)}}}}janela=i3GEO.janela.cria("510px","210px","","","","<div class='i3GeoTituloJanela'>"+$trad("x49")+"</div>","i3GEOJanelaCoordenadas",false,"hd","","");$(janela[0].close).click(function(){var tipos=i3GEO.util.listaChaves(i3GEO.coordenadas.config),n=tipos.length,temp,i=0,nomeFunc;for(i=0;i<n;i+=1){temp=i3GEO.coordenadas.config[tipos[i]];if(temp.tipo==="geo"){i3GEO.eventos.removeEventos("MOUSEMOVE",["i3GEO.coordenadas.atualizaLocalizarGeo('coordgeotabela"+tipos[i]+"')"])}else{nomeFunc="i3GEO.coordenadas.atualizaProj4";if(temp.tipo==="codigo"){nomeFunc="i3GEO.coordenadas.atualizaCodigo"}i3GEO.eventos.removeEventos("MOUSEMOVE",[nomeFunc+"('coordgeotabela"+tipos[i]+"')"])}}});temp=$i("i3GEOJanelaCoordenadas_corpo");temp.style.backgroundColor="rgb(0, 60, 136)";temp.style.color="white";temp.style.fontSize="12px";temp.style.textAlign="left";temp=$i("i3GEOJanelaCoordenadas");temp.onmouseover="";temp.onmouseout="";onde="i3GEOJanelaCoordenadas_corpo";ins+="<br><a href='#' style='cursor:pointer;color:white' onclick='"+"$(document).keypress(function(e) {if(e.altKey && e.which == 99) {"+"i3GEO.util.copyToClipboard(i3GEO.coordenadas.MODOTEXTO);'>"+"Clique aqui para ativar Alt+C para poder capturar as coordenadas em memória</a>";$i(onde).innerHTML=ins;i3GEO.coordenadas.ativaEventos("coordgeotabela")},ativaEventos:function(prefixo){var tipos=i3GEO.util.listaChaves(i3GEO.coordenadas.config),n=tipos.length,temp,i=0,nomeFunc;if(!prefixo){prefixo="localizarxy"}for(i=0;i<n;i+=1){temp=i3GEO.coordenadas.config[tipos[i]];if(temp.ativo===true){if(temp.tipo==="geo"){i3GEO.eventos.adicionaEventos("MOUSEMOVE",["i3GEO.coordenadas.atualizaLocalizarGeo('"+prefixo+tipos[i]+"')"])}else{nomeFunc="i3GEO.coordenadas.atualizaProj4";if(temp.tipo==="codigo"){nomeFunc="i3GEO.coordenadas.atualizaCodigo"}i3GEO.eventos.adicionaEventos("MOUSEMOVE",[nomeFunc+"('"+prefixo+"','"+tipos[i]+"')"])}}}},limpaModoTexto:function(){i3GEO.coordenadas.MODOTEXTO=""},geohash:{BITS:[16,8,4,2,1],BASE32:"0123456789bcdefghjkmnpqrstuvwxyz",refine_interval:function(interval,cd,mask){if(cd&mask)interval[0]=(interval[0]+interval[1])/2;else interval[1]=(interval[0]+interval[1])/2},decodeGeoHash:function(geohash){var is_even=1,lat=[],lon=[],i,j,x,y;lat[0]=-90.0;lat[1]=90.0;lon[0]=-180.0;lon[1]=180.0;lat_err=90.0;lon_err=180.0;for(i=0;i<geohash.length;i++){c=geohash[i];cd=i3GEO.coordenadas.geohash.BASE32.indexOf(c);for(j=0;j<5;j++){mask=i3GEO.coordenadas.geohash.BITS[j];if(is_even){lon_err/=2;i3GEO.coordenadas.geohash.refine_interval(lon,cd,mask)}else{lat_err/=2;i3GEO.coordenadas.geohash.refine_interval(lat,cd,mask)}is_even=!is_even}}lat[2]=(lat[0]+lat[1])/2;lon[2]=(lon[0]+lon[1])/2;y=(lat[0]+lat[1])/2;x=(lon[0]+lon[1])/2;return{"latitude":y,"longitude":x}},encodeGeoHash:function(latitude,longitude){var mid,is_even=1,lat=[],lon=[],bit=0,ch=0,precision=12,geohash="";lat[0]=-90.0;lat[1]=90.0;lon[0]=-180.0;lon[1]=180.0;while(geohash.length<precision){if(is_even){mid=(lon[0]+lon[1])/2;if(longitude>mid){ch|=i3GEO.coordenadas.geohash.BITS[bit];lon[0]=mid}else lon[1]=mid}else{mid=(lat[0]+lat[1])/2;if(latitude>mid){ch|=i3GEO.coordenadas.geohash.BITS[bit];lat[0]=mid}else lat[1]=mid}is_even=!is_even;if(bit<4)bit++;else{geohash+=i3GEO.coordenadas.geohash.BASE32[ch];bit=0;ch=0}}return geohash},zoomCodigo:function(idobj){var codigo;if($i(idobj)){codigo=$i(idobj).value}else{codigo=idobj}codigo=i3GEO.coordenadas.geohash.decodeGeoHash(codigo);i3GEO.navega.zoomponto(i3GEO.configura.locaplic,i3GEO.configura.sid,codigo.longitude,codigo.latitude)}},zoomPonto:function(){var localizarxygeoProjxxx=i3GEO.calculo.dms2dd($i('localizarxygeoProjxg').value,$i('localizarxygeoProjxm').value,$i('localizarxygeoProjxs').value);var localizarxygeoProjyyy=i3GEO.calculo.dms2dd($i('localizarxygeoProjyg').value,$i('localizarxygeoProjym').value,$i('localizarxygeoProjys').value);i3GEO.navega.zoomponto(i3GEO.configura.locaplic,i3GEO.configura.sid,localizarxygeoProjxxx,localizarxygeoProjyyy)}}; |
| ... | ... | @@ -320,7 +320,7 @@ if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.legenda={IDS:[],CAMADAS:"",co |
| 320 | 320 | if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.busca={PALAVRA:"",BOX:"",SERVICO:"http://mapas.mma.gov.br/webservices/geonames.php",SERVICOWMS:"http://mapas.mma.gov.br/webservices/geonameswms.php",config:{"ondeConteiner":"","inputOndePalavra":"","ondeServicosExternos":"","inputServicosExternos":"","inputTemasMapa":"","ondeTemasMapa":"","inputGoogle":"","ondeGoogle":"","templateTemasMapa":"","templateServico":"","templateGoogle":""},nget:0,carregaTemplates:function(){if(i3GEO.busca.nget==0){i3GEO.busca.nget=2;if(!i3GEO.template.buscaEmTemas){$.get(i3GEO.busca.config.templateTemasMapa,function(template){i3GEO.template.buscaEmTemas=template;i3GEO.busca.nget=i3GEO.busca.nget-1;if(i3GEO.busca.nget==0){i3GEO.busca.inicia()}})}else{i3GEO.busca.nget=i3GEO.busca.nget-1}if(!i3GEO.template.buscaEmServico){$.get(i3GEO.busca.config.templateServico,function(template){i3GEO.template.buscaEmServico=template;i3GEO.busca.nget=i3GEO.busca.nget-1;if(i3GEO.busca.nget==0){i3GEO.busca.inicia()}})}else{i3GEO.busca.nget=i3GEO.busca.nget-1}}},aguarde:function(){return'<div class="alert alert-warning" role="alert">'+$trad("o1")+'</div>'},inicia:function(obj){var palavra="",config=i3GEO.busca.config;if(obj){obj=$(obj);if(obj.attr("data-ondeConteiner")!=undefined){config.ondeConteiner=obj.attr("data-ondeConteiner")}if(obj.attr("data-ondeServicosExternos")!=undefined){config.ondeServicosExternos=obj.attr("data-ondeServicosExternos")}if(obj.attr("data-inputServicosExternos")!=undefined){config.inputServicosExternos=obj.attr("data-inputServicosExternos")}if(obj.attr("data-inputTemasMapa")!=undefined){config.inputTemasMapa=obj.attr("data-inputTemasMapa")}if(obj.attr("data-inputTemasMapa")!=undefined){config.ondeTemasMapa=obj.attr("data-ondeTemasMapa")}if(obj.attr("data-inputGoogle")!=undefined){config.inputGoogle=obj.attr("data-inputGoogle")}if(obj.attr("data-inputGoogle")!=undefined){config.ondeGoogle=obj.attr("data-ondeGoogle")}if(obj.attr("data-inputOndePalavra")!=undefined){config.inputOndePalavra=obj.attr("data-inputOndePalavra")}if(obj.attr("data-templateGoogle")!=undefined){config.templateGoogle=obj.attr("data-templateGoogle")}if(obj.attr("data-templateTemasMapa")!=undefined){config.templateTemasMapa=obj.attr("data-templateTemasMapa")}if(obj.attr("data-templateServico")!=undefined){config.templateServico=obj.attr("data-templateServico")}}if(!i3GEO.template.buscaEmTemas||!i3GEO.template.buscaEmServico){i3GEO.busca.carregaTemplates();return}else{var palavra=$(config.ondeConteiner).find(config.inputOndePalavra).val();if(palavra!=""){i3GEO.busca.PALAVRA=i3GEO.util.removeAcentos(palavra)}else{i3GEO.busca.PALAVRA="";return false}if($(config.ondeConteiner).find(config.inputServicosExternos)[0].checked==true){$(config.ondeConteiner).find(config.ondeServicosExternos).html(i3GEO.busca.aguarde());i3GEO.php.buscaRapida(i3GEO.busca.resultadoServico,i3GEO.configura.locaplic,i3GEO.busca.SERVICO,i3GEO.busca.PALAVRA)}if($(config.ondeConteiner).find(config.inputTemasMapa)[0].checked==true){$(config.ondeConteiner).find(config.inputTemasMapa).html(i3GEO.busca.aguarde());i3GEO.php.buscaRapida(i3GEO.busca.resultadoTemas,i3GEO.configura.locaplic,"temas",i3GEO.busca.PALAVRA)}if($(config.ondeConteiner).find(config.inputGoogle)[0].checked==true){$(config.ondeConteiner).find(config.inputGoogle).html(i3GEO.busca.aguarde());i3GEO.busca.google(i3GEO.busca.PALAVRA)}}},resultadoTemas:function(retorno){var t,config=i3GEO.busca.config;try{if(retorno.data){t=Mustache.to_html("{{#data}}"+i3GEO.template.buscaEmTemas+"{{/data}}",{"data":retorno.data});$(config.ondeConteiner).find(config.ondeTemasMapa).html(t)}}catch(e){$(config.ondeConteiner).find(config.ondeTemasMapa).html("")}},resultadoGoogle:function(retorno){var t,config=i3GEO.busca.config;try{if(retorno.data){t=Mustache.to_html("{{#data}}"+i3GEO.template.buscaEmTemas+"{{/data}}",{"data":retorno.data});$(config.ondeConteiner).find(config.ondeGoogle).html(t)}}catch(e){$(config.ondeConteiner).find(config.ondeGoogle).html("")}},resultadoServico:function(retorno){var t,config=i3GEO.busca.config;try{if(retorno.data){t=Mustache.to_html("{{#data}}"+i3GEO.template.buscaEmServico+"{{/data}}",{"data":retorno.data.geonames});$(config.ondeConteiner).find(config.ondeServicosExternos).html(t)}}catch(e){$(config.ondeConteiner).find(config.ondeServicosExternos).html("")}},google:function(palavra){var geocoder=new google.maps.Geocoder();geocoder.geocode({'address':palavra},function(results,status){if(status==google.maps.GeocoderStatus.OK){if(status!=google.maps.GeocoderStatus.ZERO_RESULTS){if(results){var b,bo,n=results.length,i=0,resultado={"data":[]};for(i=0;i<n;i++){if(results[i]&&results[i].formatted_address&&results[i].geometry&&results[i].geometry.viewport){bo=results[i].geometry.bounds;b=bo.getSouthWest().lng()+" "+bo.getSouthWest().lat()+" "+bo.getNorthEast().lng()+" "+bo.getNorthEast().lat();resultado.data.push({"valor":results[i].formatted_address,"box":b})}}i3GEO.busca.resultadoGoogle(resultado)}}}})},zoom:function(wkt,layer,gid,nm){var adicionaCamada=function(layer,gid,nm,ext){if(i3GEO.Interface.openlayers.googleLike===false){var s=i3GEO.busca.SERVICOWMS+"?gid="+gid+"&";i3GEO.php.adicionaTemaWMS(i3GEO.atualiza,s,layer,"default","EPSG:4618","image/png","1.1.0",nm+" - "+layer,"","nao","",i3GEO.configura.locaplic,i3GEO.configura.sid)}i3GEO.busca.zoomExt(ext)};var ext=i3GEO.util.wkt2ext(wkt,"polygon");if(ext==false){return}i3GEO.php.mudaext(adicionaCamada(layer,gid,nm,ext),i3GEO.configura.tipoimagem,ext,i3GEO.configura.locaplic,i3GEO.configura.sid)},mostraxy:function mostraxy(texto,tipo){var ext,b;if(tipo==="wkt"){ext=i3GEO.util.wkt2ext(texto,"polygon")}else{ext=texto}if(ext==false){return}b=ext.split(" ");if(i3GEO.Interface["ATUAL"]==="openlayers"&&typeof OpenLayers.Control=="undefined"){i3GEO.busca.BOX=false}if(i3GEO.busca.BOX===false){i3GEO.busca.BOX=i3GEO.desenho.addBox(b[0],b[1],b[2],b[3],"boxOndeBusca")}else{i3GEO.busca.BOX=i3GEO.desenho.moveBox(i3GEO.busca.BOX,b[0],b[1],b[2],b[3])}},escondexy:function(){i3GEO.desenho.removeBox("boxOndeBusca")},zoomExt:function(ext){if(i3GEO.Interface.ATUAL=="googlemaps"){i3GEO.Interface.googlemaps.zoom2extent(ext)}if(i3GEO.Interface.ATUAL=="openlayers"){i3GEO.Interface.openlayers.zoom2ext(ext)}}}; |
| 321 | 321 | // |
| 322 | 322 | //compactados/caixaDeFerramentas_compacto.js |
| 323 | -if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.caixaDeFerramentas={MIGALHA:[],config:{"idOndeFolder":"listaFerramentas","idOndeLinks":"listaFerramentasLinks","idOndeMigalha":"migalhaFerramentas","templateFolder":"templates/ferramentasFolder.html","templateMigalha":"templates/ferramentasMigalha.html","templateLinks":"templates/ferramentasLink.html"},carregaTemplates:function(){var t1=i3GEO.caixaDeFerramentas.config.templateFolder,t2=i3GEO.caixaDeFerramentas.config.templateLinks,t3=i3GEO.caixaDeFerramentas.config.templateMigalha;$.when($.get(t1),$.get(t2),$.get(t3)).done(function(r1,r2,r3){i3GEO.template.ferramentasFolder=r1[0];i3GEO.template.ferramentasLinks=r2[0];i3GEO.template.ferramentasMigalha=r3[0];i3GEO.caixaDeFerramentas.inicia()}).fail(function(){i3GEO.janela.closeMsg($trad("erroTpl"));return})},aguarde:function(){},inicia:function(config){if(config){$.each(config,function(i,v){i3GEO.caixaDeFerramentas.config[i]=v})}i3GEO.caixaDeFerramentas.aguarde();if(!i3GEO.template.ferramentasFolder||!i3GEO.template.ferramentasLinks||!i3GEO.template.ferramentasMigalha){i3GEO.caixaDeFerramentas.carregaTemplates();return}else{i3GEO.caixaDeFerramentas.nivel0()}},migalha:function(data){var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,{"nome":data.nome});$("#"+f.idOndeMigalha).data(data).html(t).click(function(event){var f=i3GEO.caixaDeFerramentas.config;event.stopImmediatePropagation();$("#"+f.idOndeMigalha).off("click");var data=$(this).data();if((data.nivel-1)==0){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel0();i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==1){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==2){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}})},nivel0:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,data;$("#"+f.idOndeMigalha).html(" ");f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(subs[menu[i].id].length>0){t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].nome,"descricao":menu[i].descricao});t=$(t);data={"nivel":1,"nome":menu[i].nome,"id":i,"n0":i,"n1":"","n2":"","n3":""};t.find("a").data(data).click(function(){$(this).find("a").off("click");var data=$(this).data();i3GEO.caixaDeFerramentas.config.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})});i3GEO.caixaDeFerramentas.config.idOndeFolder.append(t)}}},nivel1:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){datan={"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":i,"n2":"","n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,data);f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);f.idOndeFolder.show()})});f.idOndeFolder.append(t)}}data.nivel=1;data.nome=confm.menu[data.id].nome;data.n0=data.id;i3GEO.caixaDeFerramentas.migalha(data)},nivel2:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id][data.n1].submenu.itemdata[0],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){datan={"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":data.n1,"n2":i,"n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var t=Mustache.to_html(i3GEO.caixaDeFerramentas.config.templateMigalha,data)});f.idOndeFolder.append(t)}}data.nivel=2;data.id=data.n0;i3GEO.caixaDeFerramentas.migalha(data)}}; | |
| 323 | +if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.caixaDeFerramentas={MIGALHA:[],config:{"idOndeFolder":"listaFerramentas","idOndeLinks":"listaFerramentasLinks","idOndeMigalha":"migalhaFerramentas","templateFolder":"templates/ferramentasFolder.html","templateMigalha":"templates/ferramentasMigalha.html","templateLinks":"templates/ferramentasLink.html"},carregaTemplates:function(){var t1=i3GEO.caixaDeFerramentas.config.templateFolder,t2=i3GEO.caixaDeFerramentas.config.templateLinks,t3=i3GEO.caixaDeFerramentas.config.templateMigalha;$.when($.get(t1),$.get(t2),$.get(t3)).done(function(r1,r2,r3){i3GEO.template.ferramentasFolder=r1[0];i3GEO.template.ferramentasLinks=r2[0];i3GEO.template.ferramentasMigalha=r3[0];i3GEO.caixaDeFerramentas.inicia()}).fail(function(){i3GEO.janela.closeMsg($trad("erroTpl"));return})},aguarde:function(){},inicia:function(config){if(config){$.each(config,function(i,v){i3GEO.caixaDeFerramentas.config[i]=v})}i3GEO.caixaDeFerramentas.aguarde();if(!i3GEO.template.ferramentasFolder||!i3GEO.template.ferramentasLinks||!i3GEO.template.ferramentasMigalha){i3GEO.caixaDeFerramentas.carregaTemplates();return}else{i3GEO.caixaDeFerramentas.nivel0()}},migalha:function(data){var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,{"nome":data.nome});$("#"+f.idOndeMigalha).data(data).html(t).click(function(event){var f=i3GEO.caixaDeFerramentas.config;event.stopImmediatePropagation();$("#"+f.idOndeMigalha).off("click");var data=$(this).data();if((data.nivel-1)==0){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel0();i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==1){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==2){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}})},nivel0:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,data;$("#"+f.idOndeMigalha).html(" ");f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}if(subs[menu[i].id].length>0){t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].nome,"descricao":menu[i].descricao});t=$(t);data={"nivel":1,"nome":menu[i].nome,"id":i,"n0":i,"n1":"","n2":"","n3":""};t.find("a").data(data).click(function(){$(this).find("a").off("click");var data=$(this).data();i3GEO.caixaDeFerramentas.config.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})});i3GEO.caixaDeFerramentas.config.idOndeFolder.append(t)}}},nivel1:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":i,"n2":"","n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,data);f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);f.idOndeFolder.show()})});f.idOndeFolder.append(t)}}data.nivel=1;data.nome=confm.menu[data.id].nome;data.n0=data.id;i3GEO.caixaDeFerramentas.migalha(data)},nivel2:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id][data.n1].submenu.itemdata[0],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":data.n1,"n2":i,"n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var t=Mustache.to_html(i3GEO.caixaDeFerramentas.config.templateMigalha,data)});f.idOndeFolder.append(t)}}data.nivel=2;data.id=data.n0;i3GEO.caixaDeFerramentas.migalha(data)}}; | |
| 324 | 324 | // |
| 325 | 325 | //template.js |
| 326 | 326 | if (typeof (i3GEO) === 'undefined') { | ... | ... |
| ... | ... | @@ -269,7 +269,7 @@ if(typeof(i3GEO)==='undefined'){var i3GEO={}}var objposicaocursor={ddx:"",ddy:"" |
| 269 | 269 | if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.arvoreDeTemas={IDSMENUS:[],buscaTema2:function(palavra){if(palavra===""){return}var busca,root,nodePalavra="";resultadoProcurar=function(retorno){var ig,montaTexto=function(ngSgrupo){var tempn,ngTema,tempng,mostra,d,lk="",st,sg;tempn=ngSgrupo.length;for(sg=0;sg<tempn;sg+=1){ngTema=ngSgrupo[sg].temas;tempng=ngTema.length;for(st=0;st<tempng;st+=1){mostra=true;try{if(i3GEO.arvoreDeTemas.FILTRADOWNLOAD&&ngTema[st].download==="nao"){mostra=false}if(i3GEO.arvoreDeTemas.FILTRAOGC&&ngTema[st].ogc==="nao"){mostra=false}}catch(e){}if(mostra){d=i3GEO.arvoreDeTemas.montaTextoTema("gray",ngTema[st]);if(ngTema[st].link!==" "){lk="<a href='"+ngTema[st].link+"' target='blank'> fonte</a>"}if(ngSgrupo[sg].subgrupo){d+="<td style='text-allign:left'> ("+(ngSgrupo[sg].subgrupo)+") "+lk+"</td>"}else{d+="<td style='text-allign:left'> ("+(ngSgrupo[sg].grupo)+")"+lk+"</td>"}}conta+=1}}}};busca=function(){i3GEO.php.procurartemas2(resultadoProcurar,i3GEO.util.removeAcentos(palavra))}},comboMenus:function(locaplic,funcaoOnchange,idDestino,idCombo,largura,altura){i3GEO.configura.locaplic=locaplic;var combo=function(retorno){var ob,ins,ig;ob=retorno.data;ins="<select id='"+idCombo+"' SIZE="+altura+" style=width:"+largura+"px onchange='"+funcaoOnchange+"(this.value)' ><option value='' >Escolha um menu:</option>";for(ig=0;ig<ob.length;ig+=1){if(ob[ig].publicado!=="nao"&&ob[ig].publicado!=="NAO"){if(ob[ig].nomemenu){ins+="<option value="+ob[ig].idmenu+" >"+ob[ig].nomemenu+"</option>"}}}$i(idDestino).innerHTML=ins+"</select>";return retorno.data};i3GEO.php.pegalistademenus(combo)},comboGruposMenu:function(locaplic,funcaoOnchange,idDestino,idCombo,largura,altura,id_menu){i3GEO.configura.locaplic=locaplic;i3GEO.arvoreDeTemas.temasRaizGrupos=[];var combo=function(retorno){var ins,ig,obGrupos=retorno.data;ins="<select id='"+idCombo+"' SIZE="+altura+" style=width:"+largura+"px onchange='"+funcaoOnchange+"(this.value)' ><option value='' >Escolha um grupo:</option>";for(ig=0;ig<obGrupos.grupos.length;ig+=1){if(obGrupos.grupos[ig].nome){ins+="<option value="+obGrupos.grupos[ig].id_n1+" >"+obGrupos.grupos[ig].nome+"</option>"}i3GEO.arvoreDeTemas.temasRaizGrupos[obGrupos.grupos[ig].id_n1]=obGrupos.grupos[ig].temasgrupo}$i(idDestino).innerHTML=ins+"</select>"};i3GEO.php.pegalistadegrupos(combo,id_menu,"nao")},comboSubGruposMenu:function(locaplic,funcaoOnchange,idDestino,idCombo,idGrupo,largura,altura){if(idGrupo!==""){var combo=function(retorno){var ins,sg,ig;ins="<select id='"+idCombo+"' size="+altura+" style=width:"+largura+"px onchange='"+funcaoOnchange+"(\""+idGrupo+"\",this.value)' ><option value='' >Escolha um sub-grupo:</option>";if(retorno.data.subgrupo){sg=retorno.data.subgrupo;for(ig=0;ig<sg.length;ig+=1){ins+="<option value="+sg[ig].id_n2+" >"+sg[ig].nome+"</option>"}}$i(idDestino).innerHTML=ins+"</select>"};i3GEO.php.pegalistadeSubgrupos(combo,"",idGrupo)}},comboTemasMenu:function(locaplic,funcaoOnchange,idDestino,idCombo,idGrupo,idSubGrupo,largura,altura,id_menu,temas){var combo=function(retorno){var ins,sg,ig;if(idSubGrupo!=""){ins="<select id='"+idCombo+"' size="+altura+" style=width:"+largura+"px onchange='"+funcaoOnchange+"("+idGrupo+","+idSubGrupo+",this.value)' ><option value='' >Escolha um tema:</option>"}else{ins="<select id='"+idCombo+"' size="+altura+" style=width:"+largura+"px onchange='"+funcaoOnchange+"("+idGrupo+",\"\",this.value)' ><option value='' >Escolha um tema:</option>"}if(typeof(retorno.data)!=='undefined'){retorno=retorno.data.temas}sg=retorno.length;for(ig=0;ig<sg;ig++){ins+="<option value="+retorno[ig].tid+" >"+retorno[ig].nome+"</option>"}$i(idDestino).innerHTML=ins+"</select>"};if(typeof(temas)==='undefined'||temas===""){i3GEO.php.pegalistadetemas(combo,id_menu,idGrupo,idSubGrupo)}else{combo(temas)}},dialogo:{uploadarquivo:function(){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/uploadarquivos/dependencias.php","i3GEOF.uploadarquivos.iniciaJanelaFlutuante()","i3GEOF.uploadarquivos_script")},conectaservico:function(){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/conectarservicos/dependencias.php","i3GEOF.conectarservicos.iniciaJanelaFlutuante()","i3GEOF.conectarservicos_script")},carouselTemas:function(){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/carouseltemas/index.js","i3GEOF.carouseltemas.criaJanelaFlutuante()","i3GEOF.carouseltemas_script")},buscaInde:function(){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/buscainde/dependencias.php","i3GEOF.buscainde.iniciaJanelaFlutuante()","i3GEOF.buscainde_script")},nuvemTags:function(){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/nuvemtags/dependencias.php","i3GEOF.nuvemtags.iniciaJanelaFlutuante()","i3GEOF.nuvemtags_script")},nuvemTagsFlash:function(){i3GEO.janela.cria("550px","350px",i3GEO.configura.locaplic+"/ferramentas/nuvemtagsflash/index.htm","","",$trad("x44"))},navegacaoDir:function(){i3GEO.janela.cria("550px","350px",i3GEO.configura.locaplic+"/ferramentas/navegacaodir/index.htm","","","<div class='i3GeoTituloJanela'>"+$trad("x45")+"</div>")},importarwmc:function(){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/importarwmc/dependencias.php","i3GEOF.importarwmc.iniciaJanelaFlutuante()","i3GEOF.importarwmc_script")},conectarwfs:function(){i3GEO.janela.cria("400px","300px",i3GEO.configura.locaplic+"/ferramentas/conectarwfs/index.htm","","","<div class='i3GeoTituloJanela'>WFS</div>")},downloadbase:function(){window.open(i3GEO.configura.locaplic+"/datadownload.htm")}}}; |
| 270 | 270 | // |
| 271 | 271 | //compactados/editor_compacto.js |
| 272 | -if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.editor={botoes:{'zoomin':false,'zoomout':false,'pan':false,'zoombox':false,'zoomtot':false,'legenda':false,'distancia':false,'area':false,'identifica':false,'linha':true,'ponto':true,'poligono':true,'texto':true,'corta':true,'edita':true,'listag':true,'selecao':true,'selecaotudo':true,'apaga':true,'procura':false,'propriedades':true,'salva':true,'ajuda':true,'fecha':true,'tools':true,'undo':true,'frente':true},inicia:function(){i3GEO.eventos.cliquePerm.desativa();i3GEO.editor[i3GEO.Interface.ATUAL].inicia("janelaEditorVetorial")},googlemaps:{inicia:function(idjanela){var temp=function(){var cabecalho,minimiza,fecha,janela=YAHOO.i3GEO.janela.manager.find("i3GEOjanelaEditor");if(janela){janela.destroy()}cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("i3GEOjanelaEditor")};janela=i3GEO.janela.cria("350px","100px","","","","<div class='i3GeoTituloJanela'>Editor</div>","i3GEOjanelaEditor",false,"hd",cabecalho,minimiza);$i("i3GEOjanelaEditor_corpo").style.backgroundColor="white";i3GEO.editorGM.inicia("i3GEOjanelaEditor_corpo");fecha=function(){var temp=window.confirm($trad("x94"));if(i3GEO.eventos){i3GEO.eventos.cliquePerm.ativa()}if(temp===true){i3GEO.desenho.googlemaps.destroyFeatures(i3GEO.desenho.googlemaps.shapes)}};$(janela[0].close).click(fecha)};if(!i3GEO.editorGM){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/editorgm/editorgm_compacto.js",temp,"editorgm.js",true)}else{temp.call()}}},openlayers:{inicia:function(idjanela){if(!i3GEO.editorOL){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/editorol/editorol.js","i3GEO.editor.openlayers.ativaPainel('"+idjanela+"')","editorol.js",true)}else{if(!i3GEO.desenho.layergrafico){i3GEO.desenho.openlayers.criaLayerGrafico();i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}if(!i3GEO.editorOL.backup){i3GEO.editorOL.backup=new ol.layer.Vector({source:new ol.source.Vector({features:new ol.Collection(),useSpatialIndex:false,name:"Backup"}),visible:false});i3GEO.editorOL.backup.setMap(i3geoOL);i3GEO.editorOL.backup.getFeatures=function(){return i3GEO.editorOL.backup.getSource().getFeatures()}}i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes)}},criaJanela:function(){if($i("i3GEOjanelaEditor")){return"i3GEOjanelaEditor"}var janela,divid,titulo,cabecalho,minimiza;cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("i3GEOjanelaEditor")};titulo="<div class='i3GeoTituloJanela'>"+$trad("u29")+"</div>";janela=i3GEO.janela.cria("300px","200px","","","",titulo,"i3GEOjanelaEditor",false,"hd",cabecalho,minimiza);divid=janela[2].id;$i("i3GEOjanelaEditor_corpo").style.backgroundColor="white";$i("i3GEOjanelaEditor_corpo").style.textAlign="left";return divid},ativaPainel:function(idjanela){i3GEO.editorOL.fundo="";i3GEO.editorOL.mapa=i3geoOL;i3GEO.editorOL.maxext="";i3GEO.editorOL.controles=[];if(!i3GEO.desenho.layergrafico){i3GEO.desenho.openlayers.criaLayerGrafico()}if(idjanela){i3GEO.editorOL.criaBotoes(i3GEO.editor.botoes)}}}}; | |
| 272 | +if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.editor={botoes:{'zoomin':false,'zoomout':false,'pan':false,'zoombox':false,'zoomtot':false,'legenda':false,'distancia':false,'area':false,'identifica':false,'linha':true,'ponto':true,'poligono':true,'texto':true,'corta':true,'edita':true,'listag':true,'selecao':true,'selecaotudo':true,'apaga':true,'procura':false,'propriedades':true,'salva':true,'ajuda':true,'fecha':true,'tools':true,'undo':true,'frente':true},inicia:function(){i3GEO.eventos.cliquePerm.desativa();i3GEO.editor[i3GEO.Interface.ATUAL].inicia("janelaEditorVetorial")},googlemaps:{inicia:function(idjanela){}},openlayers:{inicia:function(idjanela){if(!i3GEO.editorOL){i3GEO.util.scriptTag(i3GEO.configura.locaplic+"/ferramentas/editorol/editorol.js","i3GEO.editor.openlayers.ativaPainel('"+idjanela+"')","editorol.js",true)}else{if(!i3GEO.desenho.layergrafico){i3GEO.desenho.openlayers.criaLayerGrafico();i3GEO.editorOL.mapa.addLayers([i3GEO.desenho.layergrafico])}if(!i3GEO.editorOL.backup){i3GEO.editorOL.backup=new ol.layer.Vector({source:new ol.source.Vector({features:new ol.Collection(),useSpatialIndex:false,name:"Backup"}),visible:false});i3GEO.editorOL.backup.setMap(i3geoOL);i3GEO.editorOL.backup.getFeatures=function(){return i3GEO.editorOL.backup.getSource().getFeatures()}}i3GEO.editorOL.criaBotoes(i3GEO.editorOL.botoes)}},criaJanela:function(){if($i("i3GEOjanelaEditor")){return"i3GEOjanelaEditor"}var janela,divid,titulo,cabecalho,minimiza;cabecalho=function(){};minimiza=function(){i3GEO.janela.minimiza("i3GEOjanelaEditor")};titulo="<div class='i3GeoTituloJanela'>"+$trad("u29")+"</div>";janela=i3GEO.janela.cria("300px","200px","","","",titulo,"i3GEOjanelaEditor",false,"hd",cabecalho,minimiza);divid=janela[2].id;$i("i3GEOjanelaEditor_corpo").style.backgroundColor="white";$i("i3GEOjanelaEditor_corpo").style.textAlign="left";return divid},ativaPainel:function(idjanela){i3GEO.editorOL.fundo="";i3GEO.editorOL.mapa=i3geoOL;i3GEO.editorOL.maxext="";i3GEO.editorOL.controles=[];if(!i3GEO.desenho.layergrafico){i3GEO.desenho.openlayers.criaLayerGrafico()}if(idjanela){i3GEO.editorOL.criaBotoes(i3GEO.editor.botoes)}}}}; | |
| 273 | 273 | // |
| 274 | 274 | //compactados/coordenadas_compacto.js |
| 275 | 275 | if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.coordenadas={padrao:"geoProj",defOrigem:"+proj=longlat +ellps=GRS67 +no_defs",config:{"geoProj":{idhtml:"localizarxy",tipo:"geo",titulo:"Geo",ativo:true,defepsg:""},"dd":{idhtml:"localizarxy",tipo:"metrica",titulo:"Déc. de grau",ativo:true,defepsg:""},"geohash":{idhtml:"localizarxy",tipo:"codigo",tipoCodigo:"geohash",titulo:"GeoHash",ativo:true},"policonicaSad69":{idhtml:"localizarxy",tipo:"metrica",titulo:"Polic SAD-69",ativo:true,defepsg:"+proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=aust_SA +units=m +no_defs"},"utmSad69Proj":{idhtml:"localizarxy",tipo:"utm",titulo:"UTM Sad-69",ativo:true,defepsg:"",zona:{"19N":"+proj=utm +zone=19 +ellps=aust_SA +units=m +no_defs","20N":"+proj=utm +zone=20 +ellps=aust_SA +units=m +no_defs","21N":"+proj=utm +zone=21 +ellps=aust_SA +units=m +no_defs","22N":"+proj=utm +zone=22 +ellps=aust_SA +units=m +no_defs","17S":"+proj=utm +zone=17 +south +ellps=aust_SA +units=m +no_defs","18S":"+proj=utm +zone=18 +south +ellps=aust_SA +units=m +no_defs","19S":"+proj=utm +zone=19 +south +ellps=aust_SA +units=m +no_defs","20S":"+proj=utm +zone=20 +south +ellps=aust_SA +units=m +no_defs","21S":"+proj=utm +zone=21 +south +ellps=aust_SA +units=m +no_defs","22S":"+proj=utm +zone=22 +south +ellps=aust_SA +units=m +no_defs","23S":"+proj=utm +zone=23 +south +ellps=aust_SA +units=m +no_defs","24S":"+proj=utm +zone=24 +south +ellps=aust_SA +units=m +no_defs","25S":"+proj=utm +zone=25 +south +ellps=aust_SA +units=m +no_defs"}},"utmSirgas2000Proj":{idhtml:"localizarxy",tipo:"utm",titulo:"UTM Sirgas",ativo:true,defepsg:"",zona:{"11N":"+proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","12N":"+proj=utm +zone=12 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","13N":"+proj=utm +zone=13 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","14N":"+proj=utm +zone=14 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","15N":"+proj=utm +zone=15 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","16N":"+proj=utm +zone=16 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","17N":"+proj=utm +zone=17 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","18N":"+proj=utm +zone=18 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","19N":"+proj=utm +zone=19 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","20N":"+proj=utm +zone=20 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","21N":"+proj=utm +zone=21 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","22N":"+proj=utm +zone=22 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","17S":"+proj=utm +zone=17 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","18S":"+proj=utm +zone=18 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","19S":"+proj=utm +zone=19 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","20S":"+proj=utm +zone=20 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","21S":"+proj=utm +zone=21 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","22S":"+proj=utm +zone=22 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","23S":"+proj=utm +zone=23 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","24S":"+proj=utm +zone=24 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs","25S":"+proj=utm +zone=25 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"}}},PARAMETROS:{"mostraCoordenadasUTM":{idhtml:"localizarxy"},"mostraCoordenadasGEO":{idhtml:"localizarxy"},"mostraCoordenadasGeohash":{idhtml:"localizarxy"}},MODOTEXTO:"",atualizaLocalizarGeo:function(id,x,y){if(!id||id==""){id="coordgeotabela"}if(typeof(x)==='undefined'){x=objposicaocursor.dmsx}if(typeof(y)==='undefined'){y=objposicaocursor.dmsy}var temp=$i(id);if(temp&&temp.style.display==="block"){i3GEO.coordenadas.atualizaGeo(x,y,id)}else{i3GEO.eventos.removeEventos("MOUSEMOVE",["i3GEO.coordenadas.atualizaLocalizarGeo('localizarxygeoProj')"])}},geo2zonaUtm:function(l){l=(l*1)+180;l=l/6;return parseInt(l,10)+1},criaMascaraDMS:function(prefixo,titulo,caixa){var ins='<div style="display:block;" class="i3GeoMascaraCoord" id='+prefixo+' >'+caixa+' X: '+'<input type="text" name="" value="-00" size="3" title="grau" id="'+prefixo+'xg" onclick="javascript:this.select();">'+'<input type="text" name="" value="00" size="2" title="minuto" id="'+prefixo+'xm" onclick="javascript:this.select();">'+'<input type="text" name="" value="00.00" size="5" title="segundo" id="'+prefixo+'xs" onclick="javascript:this.select();">'+' Y: '+'<input type="text" name="" value="-00" size="3" title="grau" id="'+prefixo+'yg" onclick="javascript:this.select();">'+'<input type="text" name="" value="00" size="2" title="minuto" id="'+prefixo+'ym" onclick="javascript:this.select();">'+'<input type="text" name="" value="00.00" size="5" title="segundo" id="'+prefixo+'ys" onclick="javascript:this.select();">',temp='var '+prefixo+'xxx = i3GEO.calculo.dms2dd($i(\''+prefixo+'xg\').value,$i(\''+prefixo+'xm\').value,$i(\''+prefixo+'xs\').value);'+'var '+prefixo+'yyy = i3GEO.calculo.dms2dd($i(\''+prefixo+'yg\').value,$i(\''+prefixo+'ym\').value,$i(\''+prefixo+'ys\').value);'+'i3GEO.navega.zoomponto(i3GEO.configura.locaplic,i3GEO.configura.sid,'+prefixo+'xxx,'+prefixo+'yyy);';ins+='<img class=ticfind style="margin-left:8px;" title=zoom onclick="'+temp+'" src="'+i3GEO.configura.locaplic+"/imagens/branco.gif"+'" />'+"</div>";return ins},atualizaGeo:function(dmsx,dmsy,prefixo){var x=dmsx.split(" "),y=dmsy.split(" ");if($i(prefixo+"xg")){$i(prefixo+"xg").value=x[0];$i(prefixo+"xm").value=x[1];$i(prefixo+"xs").value=x[2];$i(prefixo+"yg").value=y[0];$i(prefixo+"ym").value=y[1];$i(prefixo+"ys").value=y[2]}i3GEO.coordenadas.MODOTEXTO+="DMS - Latitude: "+y[0]+" "+y[1]+" "+y[2]+" Longitude: "+x[0]+" "+x[1]+" "+x[2]+"<br><br>"},criaMascaraMetrica:function(prefixo,titulo,caixa){var ins="<div style='display:block;' id="+prefixo+" class='i3GeoMascaraCoord' >"+caixa+" X: "+'<input type="text" name="" value="00" size="12" title="X" id="'+prefixo+'X" >'+" Y: "+'<input type="text" name="" value="00" size="12" title="Y" id="'+prefixo+'Y" >'+" Zn: "+'<input type="text" name="" value="--" size="2" title="Zona" id="'+prefixo+'ZN" >'+"</div>";return ins},criaMascaraCodigo:function(prefixo,titulo,caixa,tipoCodigo){var funcao="",ins="";if(tipoCodigo==="geohash"){funcao="i3GEO.coordenadas.geohash.zoomCodigo(\'"+prefixo+"Codigo\')"}ins="<div style='display:block;' id="+prefixo+" class='i3GeoMascaraCoord' >"+caixa+" "+'<input type="text" name="" value="00" size="12" title="Cod" id="'+prefixo+'Codigo" >'+" "+'<img class=ticfind style="margin-left:8px;" title=zoom onclick="'+funcao+'" src="'+i3GEO.configura.locaplic+"/imagens/branco.gif"+'" />'+"</div>";return ins},atualizaCodigo:function(onde,configProj,x,y){var remove=function(){i3GEO.eventos.removeEventos("MOUSEMOVE",["i3GEO.coordenadas.atualizaCodigo('"+onde+"','"+configProj+"')"])};var ondeValor=$i(onde+configProj+"Codigo"),temp=i3GEO.coordenadas.config[configProj],codigo="";onde=$i(onde);if(onde&&onde.style.display==="none"){remove();return}if(typeof(x)==='undefined'){x=objposicaocursor.ddx}if(typeof(y)==='undefined'){y=objposicaocursor.ddy}if(temp.tipoCodigo==="geohash"){if($i("localizarxygeohash")&&$i("localizarxygeohash").style.display==="none"){i3GEO.eventos.removeEventos("MOUSEMOVE",["i3GEO.coordenadas.atualizaCodigo('localizarxy','geohash')"])}codigo=i3GEO.coordenadas.geohash.encodeGeoHash(y,x)}i3GEO.coordenadas.MODOTEXTO+=temp.titulo+" : "+codigo+"<br><br>";if(ondeValor){ondeValor.value=codigo}},atualizaProj4:function(onde,configProj,x,y){var remove=function(){i3GEO.eventos.removeEventos("MOUSEMOVE",["i3GEO.coordenadas.atualizaProj4('"+onde+"','"+configProj+"')"])};var zona,temp,p,destino="",iu=i3GEO.util;temp=i3GEO.coordenadas.config[configProj];if($i(onde+configProj)&&$i(onde+configProj).style.display==="none"){remove();return}if(temp.tipo==="metrica"){destino=temp.defepsg}if(typeof(x)==='undefined'){x=objposicaocursor.ddx}if(typeof(y)==='undefined'){y=objposicaocursor.ddy}if(temp.tipo==="utm"){zona=i3GEO.coordenadas.geo2zonaUtm(x);if($i(onde+configProj+"ZN")){$i(onde+configProj+"ZN").value=zona}if(objposicaocursor.ddy*1>0){destino=temp.zona[zona+"N"]}else{destino=temp.zona[zona+"S"]}if(typeof(destino)==='undefined'){iu.defineValor(onde+configProj+"X","value","?");iu.defineValor(onde+configProj+"Y","value","?");return}}if(temp.defepsg===""&&temp.tipo==="metrica"){p={x:x,y:y}}else{p=i3GEO.coordenadas.calculaProj4(i3GEO.coordenadas.defOrigem,destino,x,y)}iu.defineValor(onde+configProj+"X","value",p.x);iu.defineValor(onde+configProj+"Y","value",p.y);i3GEO.coordenadas.MODOTEXTO+=temp.titulo+" - X: "+p.x+" Y: "+p.y+"<br><br>"},calculaProj4:function(origem,destino,x,y){Proj4js.defs={'ORIGEM':origem,'DESTINO':destino};Proj4js.getScriptLocation=function(){return i3GEO.configura.locaplic+"/pacotes/proj4js/lib/"};var source=new Proj4js.Proj("ORIGEM"),dest=new Proj4js.Proj("DESTINO"),p=new Proj4js.Point(x,y);Proj4js.transform(source,dest,p);return p},ativaBloco:function(prefixo){var tipos=i3GEO.util.listaChaves(i3GEO.coordenadas.config),n=tipos.length,temp,i=0;for(i=0;i<n;i++){temp=i3GEO.coordenadas.config[tipos[i]];if(temp.ativo===true){if(tipos[i]===this.padrao){$i(prefixo+tipos[i]).style.display="block"}else{$i(prefixo+tipos[i]).style.display="none"}}}},mudaTipo:function(obj,onde){if(obj.value=="janela"){i3GEO.coordenadas.mostraCoordenadasJanela();obj.value="geoProj"}this.padrao=obj.value;i3GEO.coordenadas.ativaBloco(onde);i3GEO.coordenadas.ativaEventos()},mostraCoordenadasJanela:function(x,y){var tipos=i3GEO.util.listaChaves(i3GEO.coordenadas.config),n=tipos.length,temp,ins="",i=0,caixa,janela,nomeFunc;caixa="";for(i=0;i<n;i+=1){temp=i3GEO.coordenadas.config[tipos[i]];if(temp.ativo===true){if(temp.tipo==="geo"){ins+=i3GEO.coordenadas.criaMascaraDMS("coordgeotabela"+tipos[i],temp.titulo,caixa)}else{if(temp.tipo==="codigo"){ins+=i3GEO.coordenadas.criaMascaraCodigo("coordgeotabela"+tipos[i],temp.titulo,temp.titulo,temp.tipoCodigo)}else{ins+=i3GEO.coordenadas.criaMascaraMetrica("coordgeotabela"+tipos[i],temp.titulo,caixa)}}}}janela=i3GEO.janela.cria("510px","210px","","","","<div class='i3GeoTituloJanela'>"+$trad("x49")+"</div>","i3GEOJanelaCoordenadas",false,"hd","","");$(janela[0].close).click(function(){var tipos=i3GEO.util.listaChaves(i3GEO.coordenadas.config),n=tipos.length,temp,i=0,nomeFunc;for(i=0;i<n;i+=1){temp=i3GEO.coordenadas.config[tipos[i]];if(temp.tipo==="geo"){i3GEO.eventos.removeEventos("MOUSEMOVE",["i3GEO.coordenadas.atualizaLocalizarGeo('coordgeotabela"+tipos[i]+"')"])}else{nomeFunc="i3GEO.coordenadas.atualizaProj4";if(temp.tipo==="codigo"){nomeFunc="i3GEO.coordenadas.atualizaCodigo"}i3GEO.eventos.removeEventos("MOUSEMOVE",[nomeFunc+"('coordgeotabela"+tipos[i]+"')"])}}});temp=$i("i3GEOJanelaCoordenadas_corpo");temp.style.backgroundColor="rgb(0, 60, 136)";temp.style.color="white";temp.style.fontSize="12px";temp.style.textAlign="left";temp=$i("i3GEOJanelaCoordenadas");temp.onmouseover="";temp.onmouseout="";onde="i3GEOJanelaCoordenadas_corpo";ins+="<br><a href='#' style='cursor:pointer;color:white' onclick='"+"$(document).keypress(function(e) {if(e.altKey && e.which == 99) {"+"i3GEO.util.copyToClipboard(i3GEO.coordenadas.MODOTEXTO);'>"+"Clique aqui para ativar Alt+C para poder capturar as coordenadas em memória</a>";$i(onde).innerHTML=ins;i3GEO.coordenadas.ativaEventos("coordgeotabela")},ativaEventos:function(prefixo){var tipos=i3GEO.util.listaChaves(i3GEO.coordenadas.config),n=tipos.length,temp,i=0,nomeFunc;if(!prefixo){prefixo="localizarxy"}for(i=0;i<n;i+=1){temp=i3GEO.coordenadas.config[tipos[i]];if(temp.ativo===true){if(temp.tipo==="geo"){i3GEO.eventos.adicionaEventos("MOUSEMOVE",["i3GEO.coordenadas.atualizaLocalizarGeo('"+prefixo+tipos[i]+"')"])}else{nomeFunc="i3GEO.coordenadas.atualizaProj4";if(temp.tipo==="codigo"){nomeFunc="i3GEO.coordenadas.atualizaCodigo"}i3GEO.eventos.adicionaEventos("MOUSEMOVE",[nomeFunc+"('"+prefixo+"','"+tipos[i]+"')"])}}}},limpaModoTexto:function(){i3GEO.coordenadas.MODOTEXTO=""},geohash:{BITS:[16,8,4,2,1],BASE32:"0123456789bcdefghjkmnpqrstuvwxyz",refine_interval:function(interval,cd,mask){if(cd&mask)interval[0]=(interval[0]+interval[1])/2;else interval[1]=(interval[0]+interval[1])/2},decodeGeoHash:function(geohash){var is_even=1,lat=[],lon=[],i,j,x,y;lat[0]=-90.0;lat[1]=90.0;lon[0]=-180.0;lon[1]=180.0;lat_err=90.0;lon_err=180.0;for(i=0;i<geohash.length;i++){c=geohash[i];cd=i3GEO.coordenadas.geohash.BASE32.indexOf(c);for(j=0;j<5;j++){mask=i3GEO.coordenadas.geohash.BITS[j];if(is_even){lon_err/=2;i3GEO.coordenadas.geohash.refine_interval(lon,cd,mask)}else{lat_err/=2;i3GEO.coordenadas.geohash.refine_interval(lat,cd,mask)}is_even=!is_even}}lat[2]=(lat[0]+lat[1])/2;lon[2]=(lon[0]+lon[1])/2;y=(lat[0]+lat[1])/2;x=(lon[0]+lon[1])/2;return{"latitude":y,"longitude":x}},encodeGeoHash:function(latitude,longitude){var mid,is_even=1,lat=[],lon=[],bit=0,ch=0,precision=12,geohash="";lat[0]=-90.0;lat[1]=90.0;lon[0]=-180.0;lon[1]=180.0;while(geohash.length<precision){if(is_even){mid=(lon[0]+lon[1])/2;if(longitude>mid){ch|=i3GEO.coordenadas.geohash.BITS[bit];lon[0]=mid}else lon[1]=mid}else{mid=(lat[0]+lat[1])/2;if(latitude>mid){ch|=i3GEO.coordenadas.geohash.BITS[bit];lat[0]=mid}else lat[1]=mid}is_even=!is_even;if(bit<4)bit++;else{geohash+=i3GEO.coordenadas.geohash.BASE32[ch];bit=0;ch=0}}return geohash},zoomCodigo:function(idobj){var codigo;if($i(idobj)){codigo=$i(idobj).value}else{codigo=idobj}codigo=i3GEO.coordenadas.geohash.decodeGeoHash(codigo);i3GEO.navega.zoomponto(i3GEO.configura.locaplic,i3GEO.configura.sid,codigo.longitude,codigo.latitude)}},zoomPonto:function(){var localizarxygeoProjxxx=i3GEO.calculo.dms2dd($i('localizarxygeoProjxg').value,$i('localizarxygeoProjxm').value,$i('localizarxygeoProjxs').value);var localizarxygeoProjyyy=i3GEO.calculo.dms2dd($i('localizarxygeoProjyg').value,$i('localizarxygeoProjym').value,$i('localizarxygeoProjys').value);i3GEO.navega.zoomponto(i3GEO.configura.locaplic,i3GEO.configura.sid,localizarxygeoProjxxx,localizarxygeoProjyyy)}}; |
| ... | ... | @@ -320,7 +320,7 @@ if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.legenda={IDS:[],CAMADAS:"",co |
| 320 | 320 | if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.busca={PALAVRA:"",BOX:"",SERVICO:"http://mapas.mma.gov.br/webservices/geonames.php",SERVICOWMS:"http://mapas.mma.gov.br/webservices/geonameswms.php",config:{"ondeConteiner":"","inputOndePalavra":"","ondeServicosExternos":"","inputServicosExternos":"","inputTemasMapa":"","ondeTemasMapa":"","inputGoogle":"","ondeGoogle":"","templateTemasMapa":"","templateServico":"","templateGoogle":""},nget:0,carregaTemplates:function(){if(i3GEO.busca.nget==0){i3GEO.busca.nget=2;if(!i3GEO.template.buscaEmTemas){$.get(i3GEO.busca.config.templateTemasMapa,function(template){i3GEO.template.buscaEmTemas=template;i3GEO.busca.nget=i3GEO.busca.nget-1;if(i3GEO.busca.nget==0){i3GEO.busca.inicia()}})}else{i3GEO.busca.nget=i3GEO.busca.nget-1}if(!i3GEO.template.buscaEmServico){$.get(i3GEO.busca.config.templateServico,function(template){i3GEO.template.buscaEmServico=template;i3GEO.busca.nget=i3GEO.busca.nget-1;if(i3GEO.busca.nget==0){i3GEO.busca.inicia()}})}else{i3GEO.busca.nget=i3GEO.busca.nget-1}}},aguarde:function(){return'<div class="alert alert-warning" role="alert">'+$trad("o1")+'</div>'},inicia:function(obj){var palavra="",config=i3GEO.busca.config;if(obj){obj=$(obj);if(obj.attr("data-ondeConteiner")!=undefined){config.ondeConteiner=obj.attr("data-ondeConteiner")}if(obj.attr("data-ondeServicosExternos")!=undefined){config.ondeServicosExternos=obj.attr("data-ondeServicosExternos")}if(obj.attr("data-inputServicosExternos")!=undefined){config.inputServicosExternos=obj.attr("data-inputServicosExternos")}if(obj.attr("data-inputTemasMapa")!=undefined){config.inputTemasMapa=obj.attr("data-inputTemasMapa")}if(obj.attr("data-inputTemasMapa")!=undefined){config.ondeTemasMapa=obj.attr("data-ondeTemasMapa")}if(obj.attr("data-inputGoogle")!=undefined){config.inputGoogle=obj.attr("data-inputGoogle")}if(obj.attr("data-inputGoogle")!=undefined){config.ondeGoogle=obj.attr("data-ondeGoogle")}if(obj.attr("data-inputOndePalavra")!=undefined){config.inputOndePalavra=obj.attr("data-inputOndePalavra")}if(obj.attr("data-templateGoogle")!=undefined){config.templateGoogle=obj.attr("data-templateGoogle")}if(obj.attr("data-templateTemasMapa")!=undefined){config.templateTemasMapa=obj.attr("data-templateTemasMapa")}if(obj.attr("data-templateServico")!=undefined){config.templateServico=obj.attr("data-templateServico")}}if(!i3GEO.template.buscaEmTemas||!i3GEO.template.buscaEmServico){i3GEO.busca.carregaTemplates();return}else{var palavra=$(config.ondeConteiner).find(config.inputOndePalavra).val();if(palavra!=""){i3GEO.busca.PALAVRA=i3GEO.util.removeAcentos(palavra)}else{i3GEO.busca.PALAVRA="";return false}if($(config.ondeConteiner).find(config.inputServicosExternos)[0].checked==true){$(config.ondeConteiner).find(config.ondeServicosExternos).html(i3GEO.busca.aguarde());i3GEO.php.buscaRapida(i3GEO.busca.resultadoServico,i3GEO.configura.locaplic,i3GEO.busca.SERVICO,i3GEO.busca.PALAVRA)}if($(config.ondeConteiner).find(config.inputTemasMapa)[0].checked==true){$(config.ondeConteiner).find(config.inputTemasMapa).html(i3GEO.busca.aguarde());i3GEO.php.buscaRapida(i3GEO.busca.resultadoTemas,i3GEO.configura.locaplic,"temas",i3GEO.busca.PALAVRA)}if($(config.ondeConteiner).find(config.inputGoogle)[0].checked==true){$(config.ondeConteiner).find(config.inputGoogle).html(i3GEO.busca.aguarde());i3GEO.busca.google(i3GEO.busca.PALAVRA)}}},resultadoTemas:function(retorno){var t,config=i3GEO.busca.config;try{if(retorno.data){t=Mustache.to_html("{{#data}}"+i3GEO.template.buscaEmTemas+"{{/data}}",{"data":retorno.data});$(config.ondeConteiner).find(config.ondeTemasMapa).html(t)}}catch(e){$(config.ondeConteiner).find(config.ondeTemasMapa).html("")}},resultadoGoogle:function(retorno){var t,config=i3GEO.busca.config;try{if(retorno.data){t=Mustache.to_html("{{#data}}"+i3GEO.template.buscaEmTemas+"{{/data}}",{"data":retorno.data});$(config.ondeConteiner).find(config.ondeGoogle).html(t)}}catch(e){$(config.ondeConteiner).find(config.ondeGoogle).html("")}},resultadoServico:function(retorno){var t,config=i3GEO.busca.config;try{if(retorno.data){t=Mustache.to_html("{{#data}}"+i3GEO.template.buscaEmServico+"{{/data}}",{"data":retorno.data.geonames});$(config.ondeConteiner).find(config.ondeServicosExternos).html(t)}}catch(e){$(config.ondeConteiner).find(config.ondeServicosExternos).html("")}},google:function(palavra){var geocoder=new google.maps.Geocoder();geocoder.geocode({'address':palavra},function(results,status){if(status==google.maps.GeocoderStatus.OK){if(status!=google.maps.GeocoderStatus.ZERO_RESULTS){if(results){var b,bo,n=results.length,i=0,resultado={"data":[]};for(i=0;i<n;i++){if(results[i]&&results[i].formatted_address&&results[i].geometry&&results[i].geometry.viewport){bo=results[i].geometry.bounds;b=bo.getSouthWest().lng()+" "+bo.getSouthWest().lat()+" "+bo.getNorthEast().lng()+" "+bo.getNorthEast().lat();resultado.data.push({"valor":results[i].formatted_address,"box":b})}}i3GEO.busca.resultadoGoogle(resultado)}}}})},zoom:function(wkt,layer,gid,nm){var adicionaCamada=function(layer,gid,nm,ext){if(i3GEO.Interface.openlayers.googleLike===false){var s=i3GEO.busca.SERVICOWMS+"?gid="+gid+"&";i3GEO.php.adicionaTemaWMS(i3GEO.atualiza,s,layer,"default","EPSG:4618","image/png","1.1.0",nm+" - "+layer,"","nao","",i3GEO.configura.locaplic,i3GEO.configura.sid)}i3GEO.busca.zoomExt(ext)};var ext=i3GEO.util.wkt2ext(wkt,"polygon");if(ext==false){return}i3GEO.php.mudaext(adicionaCamada(layer,gid,nm,ext),i3GEO.configura.tipoimagem,ext,i3GEO.configura.locaplic,i3GEO.configura.sid)},mostraxy:function mostraxy(texto,tipo){var ext,b;if(tipo==="wkt"){ext=i3GEO.util.wkt2ext(texto,"polygon")}else{ext=texto}if(ext==false){return}b=ext.split(" ");if(i3GEO.Interface["ATUAL"]==="openlayers"&&typeof OpenLayers.Control=="undefined"){i3GEO.busca.BOX=false}if(i3GEO.busca.BOX===false){i3GEO.busca.BOX=i3GEO.desenho.addBox(b[0],b[1],b[2],b[3],"boxOndeBusca")}else{i3GEO.busca.BOX=i3GEO.desenho.moveBox(i3GEO.busca.BOX,b[0],b[1],b[2],b[3])}},escondexy:function(){i3GEO.desenho.removeBox("boxOndeBusca")},zoomExt:function(ext){if(i3GEO.Interface.ATUAL=="googlemaps"){i3GEO.Interface.googlemaps.zoom2extent(ext)}if(i3GEO.Interface.ATUAL=="openlayers"){i3GEO.Interface.openlayers.zoom2ext(ext)}}}; |
| 321 | 321 | // |
| 322 | 322 | //compactados/caixaDeFerramentas_compacto.js |
| 323 | -if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.caixaDeFerramentas={MIGALHA:[],config:{"idOndeFolder":"listaFerramentas","idOndeLinks":"listaFerramentasLinks","idOndeMigalha":"migalhaFerramentas","templateFolder":"templates/ferramentasFolder.html","templateMigalha":"templates/ferramentasMigalha.html","templateLinks":"templates/ferramentasLink.html"},carregaTemplates:function(){var t1=i3GEO.caixaDeFerramentas.config.templateFolder,t2=i3GEO.caixaDeFerramentas.config.templateLinks,t3=i3GEO.caixaDeFerramentas.config.templateMigalha;$.when($.get(t1),$.get(t2),$.get(t3)).done(function(r1,r2,r3){i3GEO.template.ferramentasFolder=r1[0];i3GEO.template.ferramentasLinks=r2[0];i3GEO.template.ferramentasMigalha=r3[0];i3GEO.caixaDeFerramentas.inicia()}).fail(function(){i3GEO.janela.closeMsg($trad("erroTpl"));return})},aguarde:function(){},inicia:function(config){if(config){$.each(config,function(i,v){i3GEO.caixaDeFerramentas.config[i]=v})}i3GEO.caixaDeFerramentas.aguarde();if(!i3GEO.template.ferramentasFolder||!i3GEO.template.ferramentasLinks||!i3GEO.template.ferramentasMigalha){i3GEO.caixaDeFerramentas.carregaTemplates();return}else{i3GEO.caixaDeFerramentas.nivel0()}},migalha:function(data){var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,{"nome":data.nome});$("#"+f.idOndeMigalha).data(data).html(t).click(function(event){var f=i3GEO.caixaDeFerramentas.config;event.stopImmediatePropagation();$("#"+f.idOndeMigalha).off("click");var data=$(this).data();if((data.nivel-1)==0){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel0();i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==1){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==2){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}})},nivel0:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,data;$("#"+f.idOndeMigalha).html(" ");f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(subs[menu[i].id].length>0){t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].nome,"descricao":menu[i].descricao});t=$(t);data={"nivel":1,"nome":menu[i].nome,"id":i,"n0":i,"n1":"","n2":"","n3":""};t.find("a").data(data).click(function(){$(this).find("a").off("click");var data=$(this).data();i3GEO.caixaDeFerramentas.config.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})});i3GEO.caixaDeFerramentas.config.idOndeFolder.append(t)}}},nivel1:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){datan={"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":i,"n2":"","n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,data);f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);f.idOndeFolder.show()})});f.idOndeFolder.append(t)}}data.nivel=1;data.nome=confm.menu[data.id].nome;data.n0=data.id;i3GEO.caixaDeFerramentas.migalha(data)},nivel2:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id][data.n1].submenu.itemdata[0],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){datan={"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":data.n1,"n2":i,"n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var t=Mustache.to_html(i3GEO.caixaDeFerramentas.config.templateMigalha,data)});f.idOndeFolder.append(t)}}data.nivel=2;data.id=data.n0;i3GEO.caixaDeFerramentas.migalha(data)}}; | |
| 323 | +if(typeof(i3GEO)==='undefined'){var i3GEO={}}i3GEO.caixaDeFerramentas={MIGALHA:[],config:{"idOndeFolder":"listaFerramentas","idOndeLinks":"listaFerramentasLinks","idOndeMigalha":"migalhaFerramentas","templateFolder":"templates/ferramentasFolder.html","templateMigalha":"templates/ferramentasMigalha.html","templateLinks":"templates/ferramentasLink.html"},carregaTemplates:function(){var t1=i3GEO.caixaDeFerramentas.config.templateFolder,t2=i3GEO.caixaDeFerramentas.config.templateLinks,t3=i3GEO.caixaDeFerramentas.config.templateMigalha;$.when($.get(t1),$.get(t2),$.get(t3)).done(function(r1,r2,r3){i3GEO.template.ferramentasFolder=r1[0];i3GEO.template.ferramentasLinks=r2[0];i3GEO.template.ferramentasMigalha=r3[0];i3GEO.caixaDeFerramentas.inicia()}).fail(function(){i3GEO.janela.closeMsg($trad("erroTpl"));return})},aguarde:function(){},inicia:function(config){if(config){$.each(config,function(i,v){i3GEO.caixaDeFerramentas.config[i]=v})}i3GEO.caixaDeFerramentas.aguarde();if(!i3GEO.template.ferramentasFolder||!i3GEO.template.ferramentasLinks||!i3GEO.template.ferramentasMigalha){i3GEO.caixaDeFerramentas.carregaTemplates();return}else{i3GEO.caixaDeFerramentas.nivel0()}},migalha:function(data){var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,{"nome":data.nome});$("#"+f.idOndeMigalha).data(data).html(t).click(function(event){var f=i3GEO.caixaDeFerramentas.config;event.stopImmediatePropagation();$("#"+f.idOndeMigalha).off("click");var data=$(this).data();if((data.nivel-1)==0){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel0();i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==1){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}if((data.nivel-1)==2){f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})}})},nivel0:function(){var confm=i3GEO.listaDeFerramentas,subs=i3GEO.listaDeFerramentas.submenus,menu=confm.menu,n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,data;$("#"+f.idOndeMigalha).html(" ");f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}if(subs[menu[i].id].length>0){t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].nome,"descricao":menu[i].descricao});t=$(t);data={"nivel":1,"nome":menu[i].nome,"id":i,"n0":i,"n1":"","n2":"","n3":""};t.find("a").data(data).click(function(){$(this).find("a").off("click");var data=$(this).data();i3GEO.caixaDeFerramentas.config.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel1(data);i3GEO.caixaDeFerramentas.config.idOndeFolder.show()})});i3GEO.caixaDeFerramentas.config.idOndeFolder.append(t)}}},nivel1:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":2,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":i,"n2":"","n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var f=i3GEO.caixaDeFerramentas.config;var t=Mustache.to_html(i3GEO.template.ferramentasMigalha,data);f.idOndeFolder.fadeOut("fast",function(){i3GEO.caixaDeFerramentas.nivel2(data);f.idOndeFolder.show()})});f.idOndeFolder.append(t)}}data.nivel=1;data.nome=confm.menu[data.id].nome;data.n0=data.id;i3GEO.caixaDeFerramentas.migalha(data)},nivel2:function(data){var confm=i3GEO.listaDeFerramentas,menu=confm.submenus[confm.menu[data.n0].id][data.n1].submenu.itemdata[0],n=menu.length,f=i3GEO.caixaDeFerramentas.config,i,t,datan;f.idOndeFolder.html("");f.idOndeLinks.html("");for(i=0;i<n;i+=1){if(menu[i].Interface&&menu[i].Interface!=i3GEO.Interface.ATUAL){continue}datan={"nivel":3,"nome":menu[i].text,"id":menu[i].id,"n0":data.n0,"n1":data.n1,"n2":i,"n3":""};if(menu[i].url){t=Mustache.to_html(i3GEO.template.ferramentasLinks,{"nome":menu[i].text,"target":menu[i].target,"url":menu[i].url,"opcional":menu[i].opcional});t=$(t);f.idOndeLinks.append(t)}else{t=Mustache.to_html(i3GEO.template.ferramentasFolder,{"nome":menu[i].text});t=$(t);t.find("a").data(datan).click(function(){$(this).find("a").off("click");var data=$(this).data();var t=Mustache.to_html(i3GEO.caixaDeFerramentas.config.templateMigalha,data)});f.idOndeFolder.append(t)}}data.nivel=2;data.id=data.n0;i3GEO.caixaDeFerramentas.migalha(data)}}; | |
| 324 | 324 | // |
| 325 | 325 | //template.js |
| 326 | 326 | if (typeof (i3GEO) === 'undefined') { | ... | ... |
js/listaDeFerramentas.js
| ... | ... | @@ -620,7 +620,8 @@ i3GEO.listaDeFerramentas = { |
| 620 | 620 | { |
| 621 | 621 | id : "omenudataBarraEdicao", |
| 622 | 622 | text : $trad("u29"), |
| 623 | - url : "javascript:i3GEO.editor.inicia()" | |
| 623 | + url : "javascript:i3GEO.editor.inicia()", | |
| 624 | + Interface : "googlemaps" //so para a interface openlayers | |
| 624 | 625 | } |
| 625 | 626 | ] |
| 626 | 627 | } | ... | ... |
pacotes/yui290/build/container/container_compacto.js
100755 → 100644
pacotes/yui290/build/container/container_core_compacto.js
100755 → 100644
pacotes/yui290/build/utilities/utilities_compacto.js
100755 → 100644