Commit 077fdef0bee3fcb9f606f4b180a201caffed3514
1 parent
0827b8bc
Exists in
master
and in
7 other branches
Padronização do sistema de administração. Modificação na operação de salvar geom…
…etrias do tipo ponto, que passaram a usar point no lugar de multipoint
Showing
14 changed files
with
491 additions
and
378 deletions
Show diff stats
admin/admin.db
No preview for this file type
admin1/catalogo/mapfile/comportamento/exec.php
@@ -34,113 +34,33 @@ if (verificaOperacaoSessao ( "admin/html/editormapfile" ) === false) { | @@ -34,113 +34,33 @@ if (verificaOperacaoSessao ( "admin/html/editormapfile" ) === false) { | ||
34 | } | 34 | } |
35 | 35 | ||
36 | include (dirname ( __FILE__ ) . "/../../../../admin/php/conexao.php"); | 36 | include (dirname ( __FILE__ ) . "/../../../../admin/php/conexao.php"); |
37 | +include ("funcoes.php"); | ||
37 | 38 | ||
38 | $codigo = $_POST ["codigo"]; | 39 | $codigo = $_POST ["codigo"]; |
40 | +$codigo = str_replace ( " ", "", removeAcentos ( $codigo ) ); | ||
41 | +$codigo = str_replace ( ".", "", $codigo ); | ||
42 | +$codigo = strip_tags ( $codigo ); | ||
43 | +$codigo = htmlspecialchars ( $codigo, ENT_QUOTES ); | ||
44 | + | ||
39 | $id_tema = ( int ) $_POST ["id_tema"]; | 45 | $id_tema = ( int ) $_POST ["id_tema"]; |
40 | 46 | ||
41 | $funcao = strtoupper ( $funcao ); | 47 | $funcao = strtoupper ( $funcao ); |
42 | switch ($funcao) { | 48 | switch ($funcao) { |
43 | case "ALTERAR" : | 49 | case "ALTERAR" : |
44 | - $codigo = str_replace ( " ", "", removeAcentos ( $codigo ) ); | ||
45 | - $codigo = str_replace ( ".", "", $codigo ); | ||
46 | - $codigo = strip_tags ( $codigo ); | ||
47 | - $codigo = htmlspecialchars ( $codigo, ENT_QUOTES ); | ||
48 | - $arq = $locaplic . "/temas/" . $codigo . ".map"; | ||
49 | - if ($codigo == "" || ! file_exists ( $arq )) { | ||
50 | - header ( "HTTP/1.1 400 arquivo nao existe" ); | ||
51 | - exit (); | ||
52 | - } | ||
53 | // quando e feita a listagem unica, o mapfile ja foi registrado no banco se nao tinha sido antes | 50 | // quando e feita a listagem unica, o mapfile ja foi registrado no banco se nao tinha sido antes |
54 | - $novo = alterar ( $locaplic, $id_tema, $codigo, $_POST["aplicaextensao"],$_POST["permitecomentario"],$_POST["temporizador"],$_POST["escondido"],$_POST["transitioneffect"],$_POST["status"],$_POST["iconetema"], $_POST["mensagem"]); | ||
55 | - if ($novo === false) { | ||
56 | - header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | ||
57 | - exit (); | 51 | + $dados = \admin\catalogo\mapfile\comportamento\alterar ( $locaplic, $id_tema, $codigo, $_POST["aplicaextensao"],$_POST["permitecomentario"],$_POST["temporizador"],$_POST["escondido"],$_POST["transitioneffect"],$_POST["status"],$_POST["iconetema"], $_POST["mensagem"]); |
52 | + if ($dados === false) { | ||
53 | + header ( "HTTP/1.1 500 erro ao alterar" ); | ||
58 | } | 54 | } |
59 | - retornaJSON ( array ( | ||
60 | - "codigo" => $codigo | ||
61 | - ) ); | ||
62 | - exit (); | ||
63 | break; | 55 | break; |
64 | case "LISTA" : | 56 | case "LISTA" : |
65 | - // pega o nome registrado no mapfile | ||
66 | - if (! file_exists ( $locaplic . "/temas/" . $codigo . ".map" )) { | ||
67 | - header ( "HTTP/1.1 500 erro mapfile nao existe" ); | ||
68 | - exit (); | ||
69 | - } | ||
70 | - $mapa = ms_newMapObj ( $locaplic . "/temas/" . $codigo . ".map" ); | ||
71 | - $layer = $mapa->getlayerbyname ( $codigo ); | ||
72 | - if ($layer == "") { | ||
73 | - header ( "HTTP/1.1 500 erro nao existe LAYER com o nome $codigo" ); | ||
74 | - exit (); | ||
75 | - } | ||
76 | - $dados = array (); | ||
77 | - $dados["aplicaextensao"] = $layer->getmetadata("aplicaextensao"); | ||
78 | - if (empty ( $dados ["aplicaextensao"] )) { | ||
79 | - $dados ["aplicaextensao"] = "NAO"; | ||
80 | - } | ||
81 | - $dados["permitecomentario"] = $layer->getmetadata("permitecomentario"); | ||
82 | - if (empty ( $dados ["permitecomentario"] )) { | ||
83 | - $dados ["permitecomentario"] = "NAO"; | ||
84 | - } | ||
85 | - $dados["temporizador"] = $layer->getmetadata("temporizador"); | ||
86 | - if ($dados ["temporizador"] == 0) { | ||
87 | - $dados ["temporizador"] = ""; | ||
88 | - } | ||
89 | - $dados["escondido"] = $layer->getmetadata("escondido"); | ||
90 | - if (empty ( $dados ["escondido"] )) { | ||
91 | - $dados ["escondido"] = "NAO"; | ||
92 | - } | ||
93 | - $dados["transitioneffect"] = $layer->getmetadata("transitioneffect"); | ||
94 | - if (empty ( $dados ["transitioneffect"] )) { | ||
95 | - $dados ["transitioneffect"] = "NAO"; | ||
96 | - } | ||
97 | - $dados["iconetema"] = $layer->getmetadata("iconetema"); | ||
98 | - if (empty ( $dados ["iconetema"] )) { | ||
99 | - $dados ["iconetema"] = ""; | ||
100 | - } | ||
101 | - $dados["mensagem"] = $layer->getmetadata("mensagem"); | ||
102 | - if (empty ( $dados ["mensagem"] )) { | ||
103 | - $dados ["mensagem"] = ""; | ||
104 | - } | ||
105 | - if(mb_detect_encoding($mensagem,'UTF-8, ISO-8859-1') == "ISO-8859-1"){ | ||
106 | - $mensagem = utf8_encode($mensagem); | ||
107 | - } | ||
108 | - $dados["status"] = $layer->status; | 57 | + $dados = \admin\catalogo\mapfile\comportamento\listar ($locaplic,$codigo); |
109 | retornaJSON ( array ( | 58 | retornaJSON ( array ( |
110 | - "dados" => $dados | 59 | + "dados" => $dados |
111 | ) ); | 60 | ) ); |
112 | break; | 61 | break; |
113 | -} | ||
114 | -cpjson ( $retorno ); | ||
115 | -function alterar($locaplic, $id_tema, $codigo, $aplicaextensao, $permitecomentario, $temporizador, $escondido, $transitioneffect, $status, $iconetema, $mensagem) { | ||
116 | - global $convUTF, $esquemaadmin; | ||
117 | - $arq = $locaplic . "/temas/" . $codigo . ".map"; | ||
118 | - if (! file_exists ( $locaplic . "/temas/" . $codigo . ".map" )) { | ||
119 | - return false; | ||
120 | - } | ||
121 | - $mapa = ms_newMapObj ( $arq ); | ||
122 | - $layer = @$mapa->getlayerbyname ( $codigo ); | ||
123 | - if ($layer == "") { | ||
124 | - return false; | ||
125 | - } | ||
126 | - $layer->setmetadata ( "aplicaextensao", $aplicaextensao ); | ||
127 | - $layer->setmetadata ( "permitecomentario", $permitecomentario ); | ||
128 | - $layer->setmetadata ( "temporizador", $temporizador ); | ||
129 | - $layer->setmetadata ( "escondido", $escondido ); | ||
130 | - $layer->setmetadata ( "transitioneffect", $transitioneffect ); | ||
131 | - $layer->setmetadata ( "iconetema", $iconetema ); | ||
132 | - if(mb_detect_encoding($mensagem,'UTF-8, ISO-8859-1') == "UTF-8"){ | ||
133 | - $mensagem = utf8_decode($mensagem); | ||
134 | - } | ||
135 | - $layer->setmetadata ( "mensagem", $mensagem ); | ||
136 | - $layer->set("status",$status); | ||
137 | - try { | ||
138 | - $mapa->save ( $arq ); | ||
139 | - include (dirname ( __FILE__ ) . "/../../../php/removeCabecalhoMapfile.php"); | ||
140 | - removeCabecalhoMapfile ( $arq ); | ||
141 | - return true; | ||
142 | - } catch (Exception $e) { | ||
143 | - return false; | ||
144 | - } | 62 | + default: |
63 | + header ( "HTTP/1.1 500 erro funcao nao existe" ); | ||
64 | + break; | ||
145 | } | 65 | } |
146 | ?> | 66 | ?> |
@@ -0,0 +1,81 @@ | @@ -0,0 +1,81 @@ | ||
1 | +<?php | ||
2 | +namespace admin\catalogo\mapfile\comportamento; | ||
3 | +function listar($locaplic,$codigo){ | ||
4 | + // pega o nome registrado no mapfile | ||
5 | + if (! file_exists ( $locaplic . "/temas/" . $codigo . ".map" )) { | ||
6 | + header ( "HTTP/1.1 500 erro mapfile nao existe" ); | ||
7 | + exit (); | ||
8 | + } | ||
9 | + $mapa = ms_newMapObj ( $locaplic . "/temas/" . $codigo . ".map" ); | ||
10 | + $layer = $mapa->getlayerbyname ( $codigo ); | ||
11 | + if ($layer == "") { | ||
12 | + header ( "HTTP/1.1 500 erro nao existe LAYER com o nome $codigo" ); | ||
13 | + exit (); | ||
14 | + } | ||
15 | + $dados = array (); | ||
16 | + $dados["aplicaextensao"] = $layer->getmetadata("aplicaextensao"); | ||
17 | + if (empty ( $dados ["aplicaextensao"] )) { | ||
18 | + $dados ["aplicaextensao"] = "NAO"; | ||
19 | + } | ||
20 | + $dados["permitecomentario"] = $layer->getmetadata("permitecomentario"); | ||
21 | + if (empty ( $dados ["permitecomentario"] )) { | ||
22 | + $dados ["permitecomentario"] = "NAO"; | ||
23 | + } | ||
24 | + $dados["temporizador"] = $layer->getmetadata("temporizador"); | ||
25 | + if ($dados ["temporizador"] == 0) { | ||
26 | + $dados ["temporizador"] = ""; | ||
27 | + } | ||
28 | + $dados["escondido"] = $layer->getmetadata("escondido"); | ||
29 | + if (empty ( $dados ["escondido"] )) { | ||
30 | + $dados ["escondido"] = "NAO"; | ||
31 | + } | ||
32 | + $dados["transitioneffect"] = $layer->getmetadata("transitioneffect"); | ||
33 | + if (empty ( $dados ["transitioneffect"] )) { | ||
34 | + $dados ["transitioneffect"] = "NAO"; | ||
35 | + } | ||
36 | + $dados["iconetema"] = $layer->getmetadata("iconetema"); | ||
37 | + if (empty ( $dados ["iconetema"] )) { | ||
38 | + $dados ["iconetema"] = ""; | ||
39 | + } | ||
40 | + $dados["mensagem"] = $layer->getmetadata("mensagem"); | ||
41 | + if (empty ( $dados ["mensagem"] )) { | ||
42 | + $dados ["mensagem"] = ""; | ||
43 | + } | ||
44 | + if(mb_detect_encoding($mensagem,'UTF-8, ISO-8859-1') == "ISO-8859-1"){ | ||
45 | + $mensagem = utf8_encode($mensagem); | ||
46 | + } | ||
47 | + $dados["status"] = $layer->status; | ||
48 | + return $dados; | ||
49 | +} | ||
50 | +function alterar($locaplic, $id_tema, $codigo, $aplicaextensao, $permitecomentario, $temporizador, $escondido, $transitioneffect, $status, $iconetema, $mensagem){ | ||
51 | + global $convUTF, $esquemaadmin; | ||
52 | + $arq = $locaplic . "/temas/" . $codigo . ".map"; | ||
53 | + if (! file_exists ( $locaplic . "/temas/" . $codigo . ".map" )) { | ||
54 | + return false; | ||
55 | + } | ||
56 | + $mapa = ms_newMapObj ( $arq ); | ||
57 | + $layer = @$mapa->getlayerbyname ( $codigo ); | ||
58 | + if ($layer == "") { | ||
59 | + return false; | ||
60 | + } | ||
61 | + $layer->setmetadata ( "aplicaextensao", $aplicaextensao ); | ||
62 | + $layer->setmetadata ( "permitecomentario", $permitecomentario ); | ||
63 | + $layer->setmetadata ( "temporizador", $temporizador ); | ||
64 | + $layer->setmetadata ( "escondido", $escondido ); | ||
65 | + $layer->setmetadata ( "transitioneffect", $transitioneffect ); | ||
66 | + $layer->setmetadata ( "iconetema", $iconetema ); | ||
67 | + if(mb_detect_encoding($mensagem,'UTF-8, ISO-8859-1') == "UTF-8"){ | ||
68 | + $mensagem = utf8_decode($mensagem); | ||
69 | + } | ||
70 | + $layer->setmetadata ( "mensagem", $mensagem ); | ||
71 | + $layer->set("status",$status); | ||
72 | + try { | ||
73 | + $mapa->save ( $arq ); | ||
74 | + include (dirname ( __FILE__ ) . "/../../../php/removeCabecalhoMapfile.php"); | ||
75 | + removeCabecalhoMapfile ( $arq ); | ||
76 | + return true; | ||
77 | + } catch (Exception $e) { | ||
78 | + return false; | ||
79 | + } | ||
80 | +} | ||
81 | +?> | ||
0 | \ No newline at end of file | 82 | \ No newline at end of file |
admin1/catalogo/mapfile/disponibilidade/exec.php
@@ -34,115 +34,33 @@ if (verificaOperacaoSessao ( "admin/html/editormapfile" ) === false) { | @@ -34,115 +34,33 @@ if (verificaOperacaoSessao ( "admin/html/editormapfile" ) === false) { | ||
34 | } | 34 | } |
35 | 35 | ||
36 | include (dirname ( __FILE__ ) . "/../../../../admin/php/conexao.php"); | 36 | include (dirname ( __FILE__ ) . "/../../../../admin/php/conexao.php"); |
37 | +include ("funcoes.php"); | ||
37 | 38 | ||
38 | $codigo = $_POST ["codigo"]; | 39 | $codigo = $_POST ["codigo"]; |
40 | +$codigo = str_replace ( " ", "", removeAcentos ( $codigo ) ); | ||
41 | +$codigo = str_replace ( ".", "", $codigo ); | ||
42 | +$codigo = strip_tags ( $codigo ); | ||
43 | +$codigo = htmlspecialchars ( $codigo, ENT_QUOTES ); | ||
44 | + | ||
39 | $id_tema = ( int ) $_POST ["id_tema"]; | 45 | $id_tema = ( int ) $_POST ["id_tema"]; |
40 | 46 | ||
41 | $funcao = strtoupper ( $funcao ); | 47 | $funcao = strtoupper ( $funcao ); |
42 | switch ($funcao) { | 48 | switch ($funcao) { |
43 | case "ALTERAR" : | 49 | case "ALTERAR" : |
44 | - $codigo = str_replace ( " ", "", removeAcentos ( $codigo ) ); | ||
45 | - $codigo = str_replace ( ".", "", $codigo ); | ||
46 | - $codigo = strip_tags ( $codigo ); | ||
47 | - $codigo = htmlspecialchars ( $codigo, ENT_QUOTES ); | ||
48 | - $arq = $locaplic . "/temas/" . $codigo . ".map"; | ||
49 | - if ($codigo == "" || ! file_exists ( $arq )) { | ||
50 | - header ( "HTTP/1.1 400 arquivo nao existe" ); | ||
51 | - exit (); | ||
52 | - } | ||
53 | - // quando e feita a listagem unica, o mapfile ja foi registrado no banco se nao tinha sido antes | ||
54 | - $novo = alterar ( $locaplic, $id_tema, $codigo, $_POST["permiteogc"], $_POST["permitedownload"], $_POST["permitekml"], $_POST["permitekmz"], $_POST["download"], $_POST["arquivodownload"], $_POST["arquivokmz"], $dbhw ); | ||
55 | - if ($novo === false) { | 50 | + $dados = \admin\catalogo\mapfile\disponibilidade\alterar ($locaplic, $id_tema, $codigo, $_POST["permiteogc"], $_POST["permitedownload"], $_POST["permitekml"], $_POST["permitekmz"], $_POST["download"], $_POST["arquivodownload"], $_POST["arquivokmz"], $dbhw); |
51 | + if ($dados === false) { | ||
56 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | 52 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); |
57 | exit (); | 53 | exit (); |
58 | } | 54 | } |
59 | - retornaJSON ( array ( | ||
60 | - "codigo" => $codigo | ||
61 | - ) ); | ||
62 | - exit (); | ||
63 | break; | 55 | break; |
64 | case "LISTA" : | 56 | case "LISTA" : |
65 | - // pega o nome registrado no mapfile | ||
66 | - if (! file_exists ( $locaplic . "/temas/" . $codigo . ".map" )) { | ||
67 | - header ( "HTTP/1.1 500 erro mapfile nao existe" ); | ||
68 | - exit (); | ||
69 | - } | ||
70 | - $mapa = ms_newMapObj ( $locaplic . "/temas/" . $codigo . ".map" ); | ||
71 | - $layer = $mapa->getlayerbyname ( $codigo ); | ||
72 | - if ($layer == "") { | ||
73 | - header ( "HTTP/1.1 500 erro nao existe LAYER com o nome $codigo" ); | ||
74 | - exit (); | ||
75 | - } | ||
76 | - $dados = array (); | ||
77 | - $dados ["download"] = strtoupper ( $layer->getmetadata ( "download" ) ); | ||
78 | - if (empty ( $dados ["download"] )) { | ||
79 | - $dados ["download"] = "SIM"; | ||
80 | - } | ||
81 | - $dados ["permiteogc"] = strtoupper ( $layer->getmetadata ( "permiteogc" ) ); | ||
82 | - if (empty ( $dados ["permiteogc"] )) { | ||
83 | - $dados ["permiteogc"] = "SIM"; | ||
84 | - } | ||
85 | - $dados ["permitedownload"] = strtoupper ( $layer->getmetadata ( "permitedownload" ) ); | ||
86 | - if (empty ( $dados ["permitedownload"] )) { | ||
87 | - $dados ["permitedownload"] = "SIM"; | ||
88 | - } | ||
89 | - $dados ["permitekml"] = strtoupper ( $layer->getmetadata ( "permitekml" ) ); | ||
90 | - if (empty ( $dados ["permitekml"] )) { | ||
91 | - $dados ["permitekml"] = "SIM"; | ||
92 | - } | ||
93 | - $dados ["permitekmz"] = strtoupper ( $layer->getmetadata ( "permitekmz" ) ); | ||
94 | - if (empty ( $dados ["permitekmz"] )) { | ||
95 | - $dados ["permitekmz"] = "SIM"; | ||
96 | - } | ||
97 | - $dados ["arquivodownload"] = $layer->getmetadata ( "arquivodownload" ); | ||
98 | - $dados ["arquivokmz"] = $layer->getmetadata ( "arquivokmz" ); | 57 | + $dados = \admin\catalogo\mapfile\disponibilidade\listar ($locaplic,$codigo); |
99 | retornaJSON ( array ( | 58 | retornaJSON ( array ( |
100 | - "dados" => $dados | 59 | + "dados" => $dados |
101 | ) ); | 60 | ) ); |
102 | break; | 61 | break; |
103 | -} | ||
104 | -cpjson ( $retorno ); | ||
105 | -function alterar($locaplic, $id_tema, $codigo, $permiteogc, $permitedownload, $permitekml, $permitekmz, $download, $arquivodownload, $arquivokmz, $dbhw) { | ||
106 | - global $esquemaadmin; | ||
107 | - $arq = $locaplic . "/temas/" . $codigo . ".map"; | ||
108 | - if (! file_exists ( $locaplic . "/temas/" . $codigo . ".map" )) { | ||
109 | - return false; | ||
110 | - } | ||
111 | - $mapa = ms_newMapObj ( $arq ); | ||
112 | - $layer = @$mapa->getlayerbyname ( $codigo ); | ||
113 | - if ($layer == "") { | ||
114 | - return false; | ||
115 | - } | ||
116 | - $layer->setmetadata ( "download", $download ); | ||
117 | - $layer->setmetadata ( "permiteogc", $permiteogc ); | ||
118 | - $layer->setmetadata ( "permitedownload", $permitedownload ); | ||
119 | - $layer->setmetadata ( "permitekml", $permitekml ); | ||
120 | - $layer->setmetadata ( "permitekmz", $permitekmz ); | ||
121 | - $layer->setmetadata ( "arquivodownload", $arquivodownload ); | ||
122 | - $layer->setmetadata ( "arquivokmz", $arquivokmz ); | ||
123 | - if (! empty ( $id_tema )) { | ||
124 | - try { | ||
125 | - $dataCol = array ( | ||
126 | - "kml_tema" => $permitekml, | ||
127 | - "kmz_tema" => $permitekmz, | ||
128 | - "ogc_tema" => $permiteogc, | ||
129 | - "download_tema" => $download | ||
130 | - ); | ||
131 | - $resultado = i3GeoAdminUpdate ( $dbhw, "i3geoadmin_temas", $dataCol, "WHERE id_tema = $id_tema" ); | ||
132 | - if ($resultado === false) { | ||
133 | - return false; | ||
134 | - } | ||
135 | - } catch ( PDOException $e ) { | ||
136 | - return false; | ||
137 | - } | ||
138 | - } | ||
139 | - try { | ||
140 | - $mapa->save ( $arq ); | ||
141 | - include (dirname ( __FILE__ ) . "/../../../php/removeCabecalhoMapfile.php"); | ||
142 | - removeCabecalhoMapfile ( $arq ); | ||
143 | - return true; | ||
144 | - } catch (Exception $e) { | ||
145 | - return false; | ||
146 | - } | 62 | + default: |
63 | + header ( "HTTP/1.1 500 erro funcao nao existe" ); | ||
64 | + break; | ||
147 | } | 65 | } |
148 | ?> | 66 | ?> |
@@ -0,0 +1,84 @@ | @@ -0,0 +1,84 @@ | ||
1 | +<?php | ||
2 | +namespace admin\catalogo\mapfile\disponibilidade; | ||
3 | +function listar($locaplic,$codigo){ | ||
4 | + // pega o nome registrado no mapfile | ||
5 | + if (! file_exists ( $locaplic . "/temas/" . $codigo . ".map" )) { | ||
6 | + header ( "HTTP/1.1 500 erro mapfile nao existe" ); | ||
7 | + exit (); | ||
8 | + } | ||
9 | + $mapa = ms_newMapObj ( $locaplic . "/temas/" . $codigo . ".map" ); | ||
10 | + $layer = $mapa->getlayerbyname ( $codigo ); | ||
11 | + if ($layer == "") { | ||
12 | + header ( "HTTP/1.1 500 erro nao existe LAYER com o nome $codigo" ); | ||
13 | + exit (); | ||
14 | + } | ||
15 | + $dados = array (); | ||
16 | + $dados ["download"] = strtoupper ( $layer->getmetadata ( "download" ) ); | ||
17 | + if (empty ( $dados ["download"] )) { | ||
18 | + $dados ["download"] = "SIM"; | ||
19 | + } | ||
20 | + $dados ["permiteogc"] = strtoupper ( $layer->getmetadata ( "permiteogc" ) ); | ||
21 | + if (empty ( $dados ["permiteogc"] )) { | ||
22 | + $dados ["permiteogc"] = "SIM"; | ||
23 | + } | ||
24 | + $dados ["permitedownload"] = strtoupper ( $layer->getmetadata ( "permitedownload" ) ); | ||
25 | + if (empty ( $dados ["permitedownload"] )) { | ||
26 | + $dados ["permitedownload"] = "SIM"; | ||
27 | + } | ||
28 | + $dados ["permitekml"] = strtoupper ( $layer->getmetadata ( "permitekml" ) ); | ||
29 | + if (empty ( $dados ["permitekml"] )) { | ||
30 | + $dados ["permitekml"] = "SIM"; | ||
31 | + } | ||
32 | + $dados ["permitekmz"] = strtoupper ( $layer->getmetadata ( "permitekmz" ) ); | ||
33 | + if (empty ( $dados ["permitekmz"] )) { | ||
34 | + $dados ["permitekmz"] = "SIM"; | ||
35 | + } | ||
36 | + $dados ["arquivodownload"] = $layer->getmetadata ( "arquivodownload" ); | ||
37 | + $dados ["arquivokmz"] = $layer->getmetadata ( "arquivokmz" ); | ||
38 | + return $dados; | ||
39 | +} | ||
40 | +function alterar($locaplic, $id_tema, $codigo, $permiteogc, $permitedownload, $permitekml, $permitekmz, $download, $arquivodownload, $arquivokmz, $dbhw){ | ||
41 | + global $esquemaadmin; | ||
42 | + $arq = $locaplic . "/temas/" . $codigo . ".map"; | ||
43 | + if ($codigo == "" || ! file_exists ( $arq )) { | ||
44 | + header ( "HTTP/1.1 400 arquivo nao existe" ); | ||
45 | + exit (); | ||
46 | + } | ||
47 | + $mapa = ms_newMapObj ( $arq ); | ||
48 | + $layer = @$mapa->getlayerbyname ( $codigo ); | ||
49 | + if ($layer == "") { | ||
50 | + return false; | ||
51 | + } | ||
52 | + $layer->setmetadata ( "download", $download ); | ||
53 | + $layer->setmetadata ( "permiteogc", $permiteogc ); | ||
54 | + $layer->setmetadata ( "permitedownload", $permitedownload ); | ||
55 | + $layer->setmetadata ( "permitekml", $permitekml ); | ||
56 | + $layer->setmetadata ( "permitekmz", $permitekmz ); | ||
57 | + $layer->setmetadata ( "arquivodownload", $arquivodownload ); | ||
58 | + $layer->setmetadata ( "arquivokmz", $arquivokmz ); | ||
59 | + if (! empty ( $id_tema )) { | ||
60 | + try { | ||
61 | + $dataCol = array ( | ||
62 | + "kml_tema" => $permitekml, | ||
63 | + "kmz_tema" => $permitekmz, | ||
64 | + "ogc_tema" => $permiteogc, | ||
65 | + "download_tema" => $download | ||
66 | + ); | ||
67 | + $resultado = i3GeoAdminUpdate ( $dbhw, "i3geoadmin_temas", $dataCol, "WHERE id_tema = $id_tema" ); | ||
68 | + if ($resultado === false) { | ||
69 | + return false; | ||
70 | + } | ||
71 | + } catch ( PDOException $e ) { | ||
72 | + return false; | ||
73 | + } | ||
74 | + } | ||
75 | + try { | ||
76 | + $mapa->save ( $arq ); | ||
77 | + include (dirname ( __FILE__ ) . "/../../../php/removeCabecalhoMapfile.php"); | ||
78 | + removeCabecalhoMapfile ( $arq ); | ||
79 | + return true; | ||
80 | + } catch (Exception $e) { | ||
81 | + return false; | ||
82 | + } | ||
83 | +} | ||
84 | +?> | ||
0 | \ No newline at end of file | 85 | \ No newline at end of file |
admin1/catalogo/mapfile/gruposusuarios/exec.php
@@ -34,8 +34,14 @@ if (verificaOperacaoSessao ( "admin/html/arvore" ) === false) { | @@ -34,8 +34,14 @@ if (verificaOperacaoSessao ( "admin/html/arvore" ) === false) { | ||
34 | } | 34 | } |
35 | 35 | ||
36 | include (dirname ( __FILE__ ) . "/../../../../admin/php/conexao.php"); | 36 | include (dirname ( __FILE__ ) . "/../../../../admin/php/conexao.php"); |
37 | +include ("funcoes.php"); | ||
38 | + | ||
39 | +$codigo = $_POST ["codigo"]; | ||
40 | +$codigo = str_replace ( " ", "", removeAcentos ( $codigo ) ); | ||
41 | +$codigo = str_replace ( ".", "", $codigo ); | ||
42 | +$codigo = strip_tags ( $codigo ); | ||
43 | +$codigo = htmlspecialchars ( $codigo, ENT_QUOTES ); | ||
37 | 44 | ||
38 | -$codigo = str_replace(" ","",$_POST["codigo"]); | ||
39 | $id_grupo = $_POST["id_grupo"]; | 45 | $id_grupo = $_POST["id_grupo"]; |
40 | $id_tema = $_POST["id_tema"]; | 46 | $id_tema = $_POST["id_tema"]; |
41 | 47 | ||
@@ -44,105 +50,31 @@ testaSafeNumerico([$id_grupo,$id_tema]); | @@ -44,105 +50,31 @@ testaSafeNumerico([$id_grupo,$id_tema]); | ||
44 | $funcao = strtoupper ( $funcao ); | 50 | $funcao = strtoupper ( $funcao ); |
45 | switch ($funcao) { | 51 | switch ($funcao) { |
46 | case "ADICIONAR" : | 52 | case "ADICIONAR" : |
47 | - $sql = "select * from ".$esquemaadmin."i3geousr_grupotema where id_tema = $id_tema and id_grupo = $id_grupo"; | ||
48 | - $q = pegaDados($sql, $dbh, false); | ||
49 | - if($q){ | ||
50 | - if(count($q) != 0){ | ||
51 | - header ( "HTTP/1.1 500 erro valor ja cadastrado" ); | ||
52 | - exit (); | ||
53 | - } | ||
54 | - } | ||
55 | - if(empty($id_grupo) || empty($id_tema)){ | ||
56 | - header ( "HTTP/1.1 500 erro parametro invalido" ); | ||
57 | - exit (); | ||
58 | - } | ||
59 | - if(!file_exists($locaplic."/temas/".$codigo.".map")){ | ||
60 | - $dbhw = null; | ||
61 | - $dbh = null; | ||
62 | - header ( "HTTP/1.1 500 erro mapfile nao existe" ); | ||
63 | - exit (); | ||
64 | - } | ||
65 | - $novo = adicionar( $id_grupo, $id_tema, $dbhw ); | 53 | + $novo = \admin\catalogo\mapfile\gruposusuarios\adicionar( $locaplic, $codigo, $id_grupo, $id_tema, $dbhw ); |
54 | + $dbhw = null; | ||
55 | + $dbh = null; | ||
66 | if ($novo === false) { | 56 | if ($novo === false) { |
67 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | 57 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); |
68 | - exit (); | ||
69 | } | 58 | } |
70 | - retornaJSON ( array("ok") ); | ||
71 | break; | 59 | break; |
72 | case "LISTA" : | 60 | case "LISTA" : |
73 | - if(empty($codigo) || empty($id_tema)){ | ||
74 | - $dbhw = null; | ||
75 | - $dbh = null; | ||
76 | - header ( "HTTP/1.1 500 erro codigo invalido" ); | ||
77 | - exit (); | ||
78 | - } | ||
79 | - if(file_exists($locaplic."/temas/".$codigo.".map")){ | ||
80 | - $sql = " | ||
81 | - select ".$esquemaadmin."i3geoadmin_temas.codigo_tema, ".$esquemaadmin."i3geousr_grupos.id_grupo, | ||
82 | - ".$esquemaadmin."i3geousr_grupos.nome, ".$esquemaadmin."i3geousr_grupos.descricao, | ||
83 | - ".$esquemaadmin."i3geousr_grupotema.id_tema | ||
84 | - from | ||
85 | - ".$esquemaadmin."i3geoadmin_temas | ||
86 | - join ".$esquemaadmin."i3geousr_grupotema | ||
87 | - on ".$esquemaadmin."i3geousr_grupotema.id_grupo = ".$esquemaadmin."i3geousr_grupos.id_grupo | ||
88 | - join ".$esquemaadmin."i3geousr_grupos | ||
89 | - on ".$esquemaadmin."i3geoadmin_temas.id_tema = ".$esquemaadmin."i3geousr_grupotema.id_tema | ||
90 | - where codigo_tema = '".$codigo."' order by lower(nome) | ||
91 | - "; | ||
92 | - $dados = pegaDados ( $sql, $dbh, false ); | ||
93 | - } | ||
94 | - else { | ||
95 | - $dbhw = null; | ||
96 | - $dbh = null; | ||
97 | - header ( "HTTP/1.1 500 erro mapfile nao existe" ); | ||
98 | - exit (); | ||
99 | - } | ||
100 | - if ($dados === false) { | ||
101 | - $dbhw = null; | ||
102 | - $dbh = null; | ||
103 | - header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | ||
104 | - exit (); | ||
105 | - } | ||
106 | - $grupos = pegaDados("select * from ".$esquemaadmin."i3geousr_grupos order by lower(nome)", $dbh, false); | 61 | + $dados = \admin\catalogo\mapfile\gruposusuarios\listar ($dbh,$locaplic,$codigo); |
62 | + include ("../../../usuarios/grupos/funcoes.php"); | ||
63 | + $grupos = \admin\usuarios\grupos\listar($dbh); | ||
107 | $dbhw = null; | 64 | $dbhw = null; |
108 | $dbh = null; | 65 | $dbh = null; |
109 | retornaJSON ( array("dados" => $dados, "grupos" => $grupos) ); | 66 | retornaJSON ( array("dados" => $dados, "grupos" => $grupos) ); |
110 | break; | 67 | break; |
111 | case "EXCLUIR" : | 68 | case "EXCLUIR" : |
112 | - $retorna = excluir ( $id_tema, $id_grupo, $dbhw ); | 69 | + $retorna = \admin\catalogo\mapfile\gruposusuarios\excluir ( $id_tema, $id_grupo, $dbhw ); |
113 | $dbhw = null; | 70 | $dbhw = null; |
114 | $dbh = null; | 71 | $dbh = null; |
115 | if ($retorna === false) { | 72 | if ($retorna === false) { |
116 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | 73 | header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); |
117 | - exit (); | ||
118 | } | 74 | } |
119 | - retornaJSON ( "ok" ); | 75 | + break; |
76 | + default: | ||
77 | + header ( "HTTP/1.1 500 erro funcao nao existe" ); | ||
120 | break; | 78 | break; |
121 | } | 79 | } |
122 | -// $papeis deve ser um array | ||
123 | -function adicionar($id_grupo, $id_tema, $dbhw) { | ||
124 | - global $esquemaadmin; | ||
125 | - try { | ||
126 | - $dataCol = array( | ||
127 | - "id_tema" => $id_tema, | ||
128 | - "id_grupo" => $id_grupo | ||
129 | - ); | ||
130 | - $retorna = i3GeoAdminInsert($dbhw,"i3geousr_grupotema",$dataCol); | ||
131 | - return $retorna; | ||
132 | - } catch ( PDOException $e ) { | ||
133 | - return false; | ||
134 | - } | ||
135 | -} | ||
136 | -function excluir($id_tema, $id_grupo, $dbhw) { | ||
137 | - global $esquemaadmin; | ||
138 | - try { | ||
139 | - $sql = "DELETE from ".$esquemaadmin."i3geousr_grupotema where id_tema = ? and id_grupo = ? "; | ||
140 | - $prep = $dbhw->prepare($sql); | ||
141 | - $prep->execute(array($id_tema,$id_grupo)); | ||
142 | - i3GeoAdminInsertLog($dbhw,$sql,array($id_tema,$id_grupo)); | ||
143 | - return true; | ||
144 | - } catch ( PDOException $e ) { | ||
145 | - return false; | ||
146 | - } | ||
147 | -} | ||
148 | -?> | 80 | +?> |
149 | \ No newline at end of file | 81 | \ No newline at end of file |
@@ -0,0 +1,150 @@ | @@ -0,0 +1,150 @@ | ||
1 | +<?php | ||
2 | +namespace admin\catalogo\mapfile\gruposusuarios; | ||
3 | +function listar($dbh,$locaplic,$codigo){ | ||
4 | + global $esquemaadmin; | ||
5 | + if(empty($codigo)){ | ||
6 | + $dbhw = null; | ||
7 | + $dbh = null; | ||
8 | + header ( "HTTP/1.1 500 erro codigo invalido" ); | ||
9 | + exit (); | ||
10 | + } | ||
11 | + if(file_exists($locaplic."/temas/".$codigo.".map")){ | ||
12 | + $sql = " | ||
13 | + select ".$esquemaadmin."i3geoadmin_temas.codigo_tema, ".$esquemaadmin."i3geousr_grupos.id_grupo, | ||
14 | + ".$esquemaadmin."i3geousr_grupos.nome, ".$esquemaadmin."i3geousr_grupos.descricao, | ||
15 | + ".$esquemaadmin."i3geousr_grupotema.id_tema | ||
16 | + from | ||
17 | + ".$esquemaadmin."i3geoadmin_temas | ||
18 | + join ".$esquemaadmin."i3geousr_grupotema | ||
19 | + on ".$esquemaadmin."i3geousr_grupotema.id_grupo = ".$esquemaadmin."i3geousr_grupos.id_grupo | ||
20 | + join ".$esquemaadmin."i3geousr_grupos | ||
21 | + on ".$esquemaadmin."i3geoadmin_temas.id_tema = ".$esquemaadmin."i3geousr_grupotema.id_tema | ||
22 | + where codigo_tema = '".$codigo."' order by lower(nome) | ||
23 | + "; | ||
24 | + $dados = pegaDados ( $sql, $dbh, false ); | ||
25 | + } else { | ||
26 | + $dbhw = null; | ||
27 | + $dbh = null; | ||
28 | + header ( "HTTP/1.1 500 erro mapfile nao existe" ); | ||
29 | + exit (); | ||
30 | + } | ||
31 | + if ($dados === false) { | ||
32 | + return false; | ||
33 | + } else { | ||
34 | + return $dados; | ||
35 | + } | ||
36 | +} | ||
37 | +function adicionar($locaplic,$codigo,$id_grupo, $id_tema, $dbhw) { | ||
38 | + global $esquemaadmin; | ||
39 | + if(!file_exists($locaplic."/temas/".$codigo.".map")){ | ||
40 | + $dbhw = null; | ||
41 | + $dbh = null; | ||
42 | + header ( "HTTP/1.1 500 erro mapfile nao existe" ); | ||
43 | + exit (); | ||
44 | + } | ||
45 | + if(empty($id_grupo) || empty($id_tema)){ | ||
46 | + header ( "HTTP/1.1 500 erro parametro invalido" ); | ||
47 | + exit (); | ||
48 | + } | ||
49 | + $sql = "select * from ".$esquemaadmin."i3geousr_grupotema where id_tema = $id_tema and id_grupo = $id_grupo"; | ||
50 | + $q = pegaDados($sql, $dbh, false); | ||
51 | + if($q){ | ||
52 | + if(count($q) != 0){ | ||
53 | + header ( "HTTP/1.1 500 erro valor ja cadastrado" ); | ||
54 | + exit (); | ||
55 | + } | ||
56 | + } | ||
57 | + try { | ||
58 | + $dataCol = array( | ||
59 | + "id_tema" => $id_tema, | ||
60 | + "id_grupo" => $id_grupo | ||
61 | + ); | ||
62 | + $retorna = i3GeoAdminInsert($dbhw,"i3geousr_grupotema",$dataCol); | ||
63 | + return $retorna; | ||
64 | + } catch ( PDOException $e ) { | ||
65 | + return false; | ||
66 | + } | ||
67 | +} | ||
68 | +function excluir($id_tema, $id_grupo, $dbhw) { | ||
69 | + global $esquemaadmin; | ||
70 | + try { | ||
71 | + $sql = "DELETE from ".$esquemaadmin."i3geousr_grupotema where id_tema = ? and id_grupo = ? "; | ||
72 | + $prep = $dbhw->prepare($sql); | ||
73 | + $prep->execute(array($id_tema,$id_grupo)); | ||
74 | + i3GeoAdminInsertLog($dbhw,$sql,array($id_tema,$id_grupo)); | ||
75 | + return true; | ||
76 | + } catch ( PDOException $e ) { | ||
77 | + return false; | ||
78 | + } | ||
79 | +} | ||
80 | + | ||
81 | +//apagar | ||
82 | + | ||
83 | +function listaUsuarios($dbh){ | ||
84 | + global $esquemaadmin; | ||
85 | + $dados = pegaDados ( "SELECT id_usuario, nome_usuario FROM " . $esquemaadmin . "i3geousr_usuarios WHERE ativo = 1 ORDER BY nome_usuario", dbh, false ); | ||
86 | + if ($dados === false) { | ||
87 | + header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | ||
88 | + exit (); | ||
89 | + } else { | ||
90 | + return $dados; | ||
91 | + } | ||
92 | +} | ||
93 | +function listaGruposUsuario($id_grupo,$dbh){ | ||
94 | + global $esquemaadmin; | ||
95 | + $dados = pegaDados ( "SELECT U.nome_usuario, U.id_usuario, UP.id_grupo FROM " . $esquemaadmin . "i3geousr_grupousuario AS UP JOIN " . $esquemaadmin . "i3geousr_usuarios AS U ON U.id_usuario = UP.id_usuario WHERE UP.id_grupo = $id_grupo", dbh, false ); | ||
96 | + if ($dados === false) { | ||
97 | + header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); | ||
98 | + exit (); | ||
99 | + } else { | ||
100 | + return $dados; | ||
101 | + } | ||
102 | +} | ||
103 | + | ||
104 | +function alterar($id_grupo, $nome, $descricao, $usuarios, $dbhw) { | ||
105 | + global $convUTF, $esquemaadmin; | ||
106 | + if ($convUTF != true) { | ||
107 | + $nome = utf8_decode ( $nome ); | ||
108 | + $descricao = utf8_decode ( $descricao ); | ||
109 | + } | ||
110 | + $dataCol = array ( | ||
111 | + "nome" => $nome, | ||
112 | + "descricao" => $descricao | ||
113 | + ); | ||
114 | + | ||
115 | + $resultado = i3GeoAdminUpdate ( $dbhw, "i3geousr_grupos", $dataCol, "WHERE id_grupo = $id_grupo" ); | ||
116 | + if ($resultado === false) { | ||
117 | + return false; | ||
118 | + } | ||
119 | + // apaga todos os papeis | ||
120 | + $resultado = \admin\usuarios\grupos\excluirUsuarios ( $id_grupo, $dbhw ); | ||
121 | + if ($resultado === false) { | ||
122 | + return false; | ||
123 | + } | ||
124 | + if (! empty ( $usuarios )) { | ||
125 | + // atualiza papeis vinculados | ||
126 | + foreach ( $usuarios as $p ) { | ||
127 | + $resultado = \admin\usuarios\grupos\adicionaUsuario ( $id_grupo, $p, $dbhw ); | ||
128 | + if ($resultado === false) { | ||
129 | + return false; | ||
130 | + } | ||
131 | + } | ||
132 | + } | ||
133 | + return $id_grupo; | ||
134 | +} | ||
135 | +function adicionaUsuario($id_grupo, $id_usuario, $dbhw) { | ||
136 | + global $esquemaadmin; | ||
137 | + $dataCol = array ( | ||
138 | + "id_usuario" => $id_usuario, | ||
139 | + "id_grupo" => $id_grupo | ||
140 | + ); | ||
141 | + $resultado = i3GeoAdminInsert ( $dbhw, "i3geousr_grupousuario", $dataCol ); | ||
142 | + return $resultado; | ||
143 | +} | ||
144 | + | ||
145 | +function excluirUsuarios($id_grupo, $dbhw) { | ||
146 | + global $esquemaadmin; | ||
147 | + $resultado = i3GeoAdminExclui ( $esquemaadmin . "i3geousr_grupousuario", "id_grupo", $id_grupo, $dbhw, false ); | ||
148 | + return $resultado; | ||
149 | +} | ||
150 | +?> | ||
0 | \ No newline at end of file | 151 | \ No newline at end of file |
classesphp/funcoes_gerais.php
@@ -2643,6 +2643,7 @@ function retornaShapesSelecionados($objLayer,$map_file,$objMapa,$indexado=false) | @@ -2643,6 +2643,7 @@ function retornaShapesSelecionados($objLayer,$map_file,$objMapa,$indexado=false) | ||
2643 | $sopen = $objLayer->open(); | 2643 | $sopen = $objLayer->open(); |
2644 | if($sopen == MS_FAILURE){return "erro";} | 2644 | if($sopen == MS_FAILURE){return "erro";} |
2645 | $res_count = $objLayer->getNumresults(); | 2645 | $res_count = $objLayer->getNumresults(); |
2646 | + | ||
2646 | $centroides = array(); | 2647 | $centroides = array(); |
2647 | $shapes = array(); | 2648 | $shapes = array(); |
2648 | //pega um shape especifico | 2649 | //pega um shape especifico |
ferramentas/editorol/editorol.js
@@ -2231,7 +2231,7 @@ i3GEO.editorOL = | @@ -2231,7 +2231,7 @@ i3GEO.editorOL = | ||
2231 | temp = i3GEO.editorOL.merge(linhas); | 2231 | temp = i3GEO.editorOL.merge(linhas); |
2232 | } | 2232 | } |
2233 | if (pontos.length > 0) { | 2233 | if (pontos.length > 0) { |
2234 | - temp = i3GEO.editorOL.merge(pontos); | 2234 | + temp = i3GEO.editorOL.desagrupa(pontos); |
2235 | } | 2235 | } |
2236 | if (i3GEO.mapa) { | 2236 | if (i3GEO.mapa) { |
2237 | i3GEO.mapa.dialogo.wkt2layer(temp); | 2237 | i3GEO.mapa.dialogo.wkt2layer(temp); |
@@ -2277,6 +2277,19 @@ i3GEO.editorOL = | @@ -2277,6 +2277,19 @@ i3GEO.editorOL = | ||
2277 | i3GEO.janela.tempoMsg("Selecione pelo menos dois elementos"); | 2277 | i3GEO.janela.tempoMsg("Selecione pelo menos dois elementos"); |
2278 | } | 2278 | } |
2279 | }, | 2279 | }, |
2280 | + desagrupa : function(geoms) { | ||
2281 | + var n = geoms.length, | ||
2282 | + w = [], | ||
2283 | + g, m, i, | ||
2284 | + format = new ol.format.WKT(); | ||
2285 | + for (i = 0; i < n; i++) { | ||
2286 | + g = format.writeFeatures([geoms[i]]); | ||
2287 | + m = new Wkt.Wkt(); | ||
2288 | + m.read(g); | ||
2289 | + w.push(m); | ||
2290 | + } | ||
2291 | + return w.join("\n"); | ||
2292 | + }, | ||
2280 | merge : function(geoms) { | 2293 | merge : function(geoms) { |
2281 | var n = geoms.length, | 2294 | var n = geoms.length, |
2282 | w = new Wkt.Wkt(), | 2295 | w = new Wkt.Wkt(), |
ferramentas/pontosdistri/exec.php
@@ -19,10 +19,12 @@ Executa script R para gerar a imagem. | @@ -19,10 +19,12 @@ Executa script R para gerar a imagem. | ||
19 | case "ANALISEDISTRIPT": | 19 | case "ANALISEDISTRIPT": |
20 | include_once(dirname(__FILE__)."/../../classesphp/classe_analise.php"); | 20 | include_once(dirname(__FILE__)."/../../classesphp/classe_analise.php"); |
21 | copiaSeguranca($map_file); | 21 | copiaSeguranca($map_file); |
22 | - if(!isset($_GET["tema2"])) | ||
23 | - {$_GET["tema2"] = "";} | ||
24 | - if(!isset($_GET["limitepontos"])) | ||
25 | - {$_GET["limitepontos"] = "";} | 22 | + if(!isset($_GET["tema2"])){ |
23 | + $_GET["tema2"] = ""; | ||
24 | + } | ||
25 | + if(!isset($_GET["limitepontos"])){ | ||
26 | + $_GET["limitepontos"] = ""; | ||
27 | + } | ||
26 | $m = new Analise($map_file,$tema,$locaplic,$ext); | 28 | $m = new Analise($map_file,$tema,$locaplic,$ext); |
27 | if(empty($_GET["item"])){ | 29 | if(empty($_GET["item"])){ |
28 | $_GET["item"] = ""; | 30 | $_GET["item"] = ""; |
ferramentas/wkt2layer/exec.php
@@ -20,7 +20,8 @@ Insere elementos no mapa como um layer do tipo feature baseado em wkt | @@ -20,7 +20,8 @@ Insere elementos no mapa como um layer do tipo feature baseado em wkt | ||
20 | if(!isset($_GET["marca"])){ | 20 | if(!isset($_GET["marca"])){ |
21 | $_GET["marca"]=""; | 21 | $_GET["marca"]=""; |
22 | } | 22 | } |
23 | - $shp = ms_shapeObjFromWkt($_GET["xy"]); | 23 | + $wkt = explode("|",$_GET["xy"]); |
24 | + $shp = ms_shapeObjFromWkt($wkt[0]); | ||
24 | if($shp->type == MS_SHAPE_POINT){ | 25 | if($shp->type == MS_SHAPE_POINT){ |
25 | $tipo = "POINT"; | 26 | $tipo = "POINT"; |
26 | } | 27 | } |
@@ -30,19 +31,22 @@ Insere elementos no mapa como um layer do tipo feature baseado em wkt | @@ -30,19 +31,22 @@ Insere elementos no mapa como um layer do tipo feature baseado em wkt | ||
30 | if($shp->type == MS_SHAPE_POLYGON){ | 31 | if($shp->type == MS_SHAPE_POLYGON){ |
31 | $tipo = "POLYGON"; | 32 | $tipo = "POLYGON"; |
32 | } | 33 | } |
33 | - $m->insereFeature($_GET["marca"],$_GET["tipo"],$_GET["xy"],$_GET["texto"],$_GET["position"],$_GET["partials"],$_GET["offsetx"],$_GET["offsety"],$_GET["minfeaturesize"],$_GET["mindistance"],$_GET["force"],$_GET["shadowcolor"],$_GET["shadowsizex"],$_GET["shadowsizey"],$_GET["outlinecolor"],$_GET["cor"],$_GET["sombray"],$_GET["sombrax"],$_GET["sombra"],$_GET["fundo"],$_GET["angulo"],$_GET["tamanho"],$_GET["fonte"],$_GET["wrap"],true,$_GET["nometema"]); | 34 | + foreach($wkt as $w){ |
35 | + $m->insereFeature($_GET["marca"],$_GET["tipo"],$w,$_GET["texto"],$_GET["position"],$_GET["partials"],$_GET["offsetx"],$_GET["offsety"],$_GET["minfeaturesize"],$_GET["mindistance"],$_GET["force"],$_GET["shadowcolor"],$_GET["shadowsizex"],$_GET["shadowsizey"],$_GET["outlinecolor"],$_GET["cor"],$_GET["sombray"],$_GET["sombrax"],$_GET["sombra"],$_GET["fundo"],$_GET["angulo"],$_GET["tamanho"],$_GET["fonte"],$_GET["wrap"],true,$_GET["nometema"]); | ||
36 | + } | ||
34 | $m->salva(); | 37 | $m->salva(); |
35 | redesenhaMapa(); | 38 | redesenhaMapa(); |
36 | break; | 39 | break; |
37 | case "SHAPEFILE": | 40 | case "SHAPEFILE": |
38 | include_once("../../classesphp/classe_analise.php"); | 41 | include_once("../../classesphp/classe_analise.php"); |
39 | $m = new Analise($map_file,""); | 42 | $m = new Analise($map_file,""); |
40 | - $nomeLayer = $m->aplicaFuncaoListaWKT(array($_GET["xy"]),"converteSHP",$dir_tmp,$imgdir); | 43 | + $wkt = explode("|",$_GET["xy"]); |
44 | + $nomeLayer = $m->aplicaFuncaoListaWKT($wkt,"converteSHP",$dir_tmp,$imgdir); | ||
41 | 45 | ||
42 | $l = $m->mapa->getlayerbyname($nomeLayer); | 46 | $l = $m->mapa->getlayerbyname($nomeLayer); |
43 | $l->setmetadata("tema",$_GET["nometema"]); | 47 | $l->setmetadata("tema",$_GET["nometema"]); |
44 | //verifica projecao | 48 | //verifica projecao |
45 | - $shp = ms_shapeObjFromWkt($_GET["xy"]); | 49 | + $shp = ms_shapeObjFromWkt($wkt[0]); |
46 | $c = $shp->getCentroid(); | 50 | $c = $shp->getCentroid(); |
47 | $c = $c->x; | 51 | $c = $c->x; |
48 | if($c > -181 && $c < 181){ | 52 | if($c > -181 && $c < 181){ |
ferramentas/wkt2layer/index.js
@@ -165,6 +165,7 @@ i3GEOF.wkt2layer = | @@ -165,6 +165,7 @@ i3GEOF.wkt2layer = | ||
165 | }; | 165 | }; |
166 | par = i3GEOF.wkt2layer.pegaPar(); | 166 | par = i3GEOF.wkt2layer.pegaPar(); |
167 | wkt = $i("i3GEOFwkt2layerWkt").value; | 167 | wkt = $i("i3GEOFwkt2layerWkt").value; |
168 | + wkt = wkt.split("\n").join("|"); | ||
168 | p = i3GEO.configura.locaplic+"/ferramentas/wkt2layer/exec.php?g_sid="+i3GEO.configura.sid+ | 169 | p = i3GEO.configura.locaplic+"/ferramentas/wkt2layer/exec.php?g_sid="+i3GEO.configura.sid+ |
169 | "&funcao=feature&"+par; | 170 | "&funcao=feature&"+par; |
170 | cp = new cpaint(); | 171 | cp = new cpaint(); |
@@ -190,6 +191,7 @@ i3GEOF.wkt2layer = | @@ -190,6 +191,7 @@ i3GEOF.wkt2layer = | ||
190 | }; | 191 | }; |
191 | par = i3GEOF.wkt2layer.pegaPar(); | 192 | par = i3GEOF.wkt2layer.pegaPar(); |
192 | wkt = $i("i3GEOFwkt2layerWkt").value; | 193 | wkt = $i("i3GEOFwkt2layerWkt").value; |
194 | + wkt = wkt.split("\n").join("|"); | ||
193 | p = i3GEO.configura.locaplic+"/ferramentas/wkt2layer/exec.php?g_sid="+i3GEO.configura.sid+ | 195 | p = i3GEO.configura.locaplic+"/ferramentas/wkt2layer/exec.php?g_sid="+i3GEO.configura.sid+ |
194 | "&funcao=shapefile&"+par; | 196 | "&funcao=shapefile&"+par; |
195 | cp = new cpaint(); | 197 | cp = new cpaint(); |
temas/_lbiomashp.map
1 | -MAP | ||
2 | - FONTSET "../symbols/fontes.txt" | ||
3 | - SYMBOLSET "../symbols/simbolosv6.sym" | ||
4 | - LAYER | ||
5 | - CONNECTION "" | ||
6 | - DATA "/var/www/i3geo/aplicmap/dados/biomas.shp" | ||
7 | - METADATA | ||
8 | - "TIP" "CD_LEGENDA" | ||
9 | - "cache" "SIM" | ||
10 | - "CLASSE" "sim" | ||
11 | - "permitekmz" "SIM" | ||
12 | - "ITENSDESC" "Teste de acentuação" | ||
13 | - "TILES" "SIM" | ||
14 | - "ESCALA" "1000000" | ||
15 | - "extensao" "-73.990940816816 -33.74827031115 -34.822855820777 5.272224303909" | ||
16 | - "permitedownload" "SIM" | ||
17 | - "permitecomentario" "NAO" | ||
18 | - "escondido" "NAO" | ||
19 | - "download" "SIM" | ||
20 | - "itembuscarapida" "CD_LEGENDA" | ||
21 | - "ITENS" "CD_LEGENDA" | ||
22 | - "permitekml" "SIM" | ||
23 | - "permiteogc" "SIM" | ||
24 | - "transitioneffect" "NAO" | ||
25 | - "TEMA" "Biomas shapefile (acentuação)" | ||
26 | - "identifica" "sim" | ||
27 | - "aplicaextensao" "NAO" | ||
28 | - END # METADATA | ||
29 | - NAME "_lbiomashp" | ||
30 | - PROCESSING "ITEMS=CD_LEGENDA" | ||
31 | - PROCESSING "LABEL_NO_CLIP=True" | ||
32 | - PROCESSING "POLYLINE_NO_CLIP=True" | ||
33 | - STATUS DEFAULT | ||
34 | - TEMPLATE "none.htm" | ||
35 | - TILEITEM "location" | ||
36 | - OPACITY 90 | ||
37 | - TYPE POLYGON | ||
38 | - UNITS METERS | ||
39 | - CLASS | ||
40 | - NAME "CAATINGA" | ||
41 | - EXPRESSION ('[CD_LEGENDA]'eq'CAATINGA') | ||
42 | - STYLE | ||
43 | - COLOR 183 247 169 | ||
44 | - OUTLINECOLOR 255 255 255 | ||
45 | - END # STYLE | ||
46 | - TITLE "" | ||
47 | - END # CLASS | ||
48 | - CLASS | ||
49 | - NAME "PAMPA area > 5" | ||
50 | - EXPRESSION ('[CD_LEGENDA]'eq'PAMPA area > 5') | ||
51 | - STYLE | ||
52 | - COLOR 239 22 152 | ||
53 | - OUTLINECOLOR 255 255 255 | ||
54 | - END # STYLE | ||
55 | - TITLE "" | ||
56 | - END # CLASS | ||
57 | - CLASS | ||
58 | - NAME "CERRADO" | ||
59 | - EXPRESSION ('[CD_LEGENDA]'eq'CERRADO') | ||
60 | - STYLE | ||
61 | - COLOR 57 32 234 | ||
62 | - OUTLINECOLOR 255 255 255 | ||
63 | - END # STYLE | ||
64 | - TITLE "" | ||
65 | - END # CLASS | ||
66 | - CLASS | ||
67 | - NAME "PANTANAL" | ||
68 | - EXPRESSION ('[CD_LEGENDA]'eq'PANTANAL') | ||
69 | - STYLE | ||
70 | - COLOR 214 107 232 | ||
71 | - OUTLINECOLOR 255 255 255 | ||
72 | - END # STYLE | ||
73 | - TITLE "" | ||
74 | - END # CLASS | ||
75 | - CLASS | ||
76 | - NAME "AMAZÔNIA" | ||
77 | - EXPRESSION ('[CD_LEGENDA]'eq'AMAZÔNIA') | ||
78 | - STYLE | ||
79 | - COLOR 0 177 0 | ||
80 | - OUTLINECOLOR 255 255 255 | ||
81 | - END # STYLE | ||
82 | - TITLE "" | ||
83 | - END # CLASS | ||
84 | - CLASS | ||
85 | - NAME "MATA ATLÂNTICA" | ||
86 | - EXPRESSION ('[CD_LEGENDA]'eq'MATA ATLÂNTICA') | ||
87 | - STYLE | ||
88 | - COLOR 44 215 49 | ||
89 | - OUTLINECOLOR 255 255 255 | ||
90 | - END # STYLE | ||
91 | - TITLE "" | ||
92 | - END # CLASS | ||
93 | - END # LAYER | ||
94 | -END # MAP | ||
95 | \ No newline at end of file | 1 | \ No newline at end of file |
2 | +MAP | ||
3 | + FONTSET "../symbols/fontes.txt" | ||
4 | + SYMBOLSET "../symbols/simbolosv6.sym" | ||
5 | + LAYER | ||
6 | + CONNECTION "" | ||
7 | + DATA "/var/www/i3geo/aplicmap/dados/biomas.shp" | ||
8 | + METADATA | ||
9 | + "cache" "SIM" | ||
10 | + "TIP" "CD_LEGENDA" | ||
11 | + "CLASSE" "sim" | ||
12 | + "permitekmz" "SIM" | ||
13 | + "temporizador" "" | ||
14 | + "ITENSDESC" "Teste de acentuação" | ||
15 | + "iconetema" "" | ||
16 | + "ESCALA" "1000000" | ||
17 | + "TILES" "SIM" | ||
18 | + "extensao" "-73.990940816816 -33.74827031115 -34.822855820777 5.272224303909" | ||
19 | + "permitedownload" "SIM" | ||
20 | + "permitecomentario" "NAO" | ||
21 | + "escondido" "NAO" | ||
22 | + "download" "SIM" | ||
23 | + "itembuscarapida" "CD_LEGENDA" | ||
24 | + "arquivokmz" "" | ||
25 | + "arquivodownload" "" | ||
26 | + "ITENS" "CD_LEGENDA" | ||
27 | + "transitioneffect" "NAO" | ||
28 | + "permiteogc" "SIM" | ||
29 | + "permitekml" "SIM" | ||
30 | + "TEMA" "Biomas shapefile (acentuação)" | ||
31 | + "aplicaextensao" "NAO" | ||
32 | + "identifica" "sim" | ||
33 | + END # METADATA | ||
34 | + NAME "_lbiomashp" | ||
35 | + PROCESSING "ITEMS=CD_LEGENDA" | ||
36 | + PROCESSING "LABEL_NO_CLIP=True" | ||
37 | + PROCESSING "POLYLINE_NO_CLIP=True" | ||
38 | + STATUS DEFAULT | ||
39 | + TEMPLATE "none.htm" | ||
40 | + TILEITEM "location" | ||
41 | + OPACITY 90 | ||
42 | + TYPE POLYGON | ||
43 | + UNITS METERS | ||
44 | + CLASS | ||
45 | + NAME "CAATINGA" | ||
46 | + EXPRESSION ('[CD_LEGENDA]'eq'CAATINGA') | ||
47 | + STYLE | ||
48 | + COLOR 183 247 169 | ||
49 | + OUTLINECOLOR 255 255 255 | ||
50 | + END # STYLE | ||
51 | + TITLE "" | ||
52 | + END # CLASS | ||
53 | + CLASS | ||
54 | + NAME "PAMPA area > 5" | ||
55 | + EXPRESSION ('[CD_LEGENDA]'eq'PAMPA area > 5') | ||
56 | + STYLE | ||
57 | + COLOR 239 22 152 | ||
58 | + OUTLINECOLOR 255 255 255 | ||
59 | + END # STYLE | ||
60 | + TITLE "" | ||
61 | + END # CLASS | ||
62 | + CLASS | ||
63 | + NAME "CERRADO" | ||
64 | + EXPRESSION ('[CD_LEGENDA]'eq'CERRADO') | ||
65 | + STYLE | ||
66 | + COLOR 57 32 234 | ||
67 | + OUTLINECOLOR 255 255 255 | ||
68 | + END # STYLE | ||
69 | + TITLE "" | ||
70 | + END # CLASS | ||
71 | + CLASS | ||
72 | + NAME "PANTANAL" | ||
73 | + EXPRESSION ('[CD_LEGENDA]'eq'PANTANAL') | ||
74 | + STYLE | ||
75 | + COLOR 214 107 232 | ||
76 | + OUTLINECOLOR 255 255 255 | ||
77 | + END # STYLE | ||
78 | + TITLE "" | ||
79 | + END # CLASS | ||
80 | + CLASS | ||
81 | + NAME "AMAZÔNIA" | ||
82 | + EXPRESSION ('[CD_LEGENDA]'eq'AMAZÔNIA') | ||
83 | + STYLE | ||
84 | + COLOR 0 177 0 | ||
85 | + OUTLINECOLOR 255 255 255 | ||
86 | + END # STYLE | ||
87 | + TITLE "" | ||
88 | + END # CLASS | ||
89 | + CLASS | ||
90 | + NAME "MATA ATLÂNTICA" | ||
91 | + EXPRESSION ('[CD_LEGENDA]'eq'MATA ATLÂNTICA') | ||
92 | + STYLE | ||
93 | + COLOR 44 215 49 | ||
94 | + OUTLINECOLOR 255 255 255 | ||
95 | + END # STYLE | ||
96 | + TITLE "" | ||
97 | + END # CLASS | ||
98 | + END # LAYER | ||
99 | + | ||
100 | +END # MAP | ||
101 | + |