Commit 2e9d74096dc2313a4893cfcfab9d1e00e70b60b5

Authored by Edmar Moretti
1 parent b51e077b

--no commit message

admin/admin.db
No preview for this file type
classesphp/mapa_openlayers.php
... ... @@ -67,6 +67,7 @@ inicializa();
67 67 //nos casos do modo notile, a requisicao e feita como se fosse um wms
68 68 //quando for do tipo tms $_GET["tms"] contem os parametros do tile
69 69 //
  70 +
70 71 if(isset($_GET["tms"])){
71 72 $_GET["WIDTH"] = 256;
72 73 $_GET["HEIGHT"] = 256;
... ... @@ -83,10 +84,11 @@ if(isset($_GET["tms"])){
83 84 $lat2 = ($y+1) / $n * 180.0 - 90.0;
84 85 $_GET["BBOX"] = $lon1." ".$lat1." ".$lon2." ".$lat2;
85 86 }
  87 +
86 88 //para o caso da versao 3 do OpenLayers
87   -//excluir?
88   -if(isset($_GET["X"])){
89   - $box = explode(",",$_GET["BBOX"]);
  89 +if(isset($_GET["X"]) && !($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature")){
  90 + $box = str_replace(" ",",",$_GET["BBOX"]);
  91 + $box = explode(",",$box);
90 92 $res = ($box[2] + 180) - ($box[0] + 180);
91 93 $res = $res / 256;
92 94 $z = intval((0.703125 / $res) / 4) + 1;
... ... @@ -98,6 +100,7 @@ if(isset($_GET["X"])){
98 100 $_GET["tms"] = "/".$_GET["layer"]."/".$z."/".$x."/".$y.".png";
99 101 echo $_GET["BBOX"]." ".$_GET["tms"];exit;
100 102 }
  103 +
101 104 if(isset($_GET["TileMatrix"])){
102 105 $_GET["WIDTH"] = 256;
103 106 $_GET["HEIGHT"] = 256;
... ... @@ -128,6 +131,7 @@ if(isset($_GET["TileMatrix"])){
128 131  
129 132 $_GET["BBOX"] = $lon1." ".$lat1." ".$lon2." ".$lat2;
130 133 }
  134 +
131 135 $map_fileX = $_SESSION["map_file"];
132 136 //
133 137 //verifica se o request e OGC
... ... @@ -139,11 +143,14 @@ if(!empty($_GET["request"])){
139 143 //
140 144 $qyfile = dirname($map_fileX)."/".$_GET["layer"].".php";
141 145 $qy = file_exists($qyfile);
142   -if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){
  146 +
  147 +if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){
143 148 $_GET["DESLIGACACHE"] = "sim";
144 149 }
145   -if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){
146   - carregaCacheImagem($_SESSION["cachedir"],$_SESSION["map_file"],$_GET["tms"],$_SESSION["i3georendermode"]);
  150 +else{
  151 + if($qy == false && $_GET["cache"] == "sim" && $_GET["DESLIGACACHE"] != "sim"){
  152 + carregaCacheImagem($_SESSION["cachedir"],$_SESSION["map_file"],$_GET["tms"],$_SESSION["i3georendermode"]);
  153 + }
147 154 }
148 155 //
149 156 //map_fileX e para o caso register_globals = On no PHP.INI
... ... @@ -219,7 +226,6 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter
219 226 }
220 227 }
221 228 }
222   -
223 229 if($layerName == $_GET["layer"]){
224 230 if(strtolower($l->getmetadata("cache")) == "sim"){
225 231 $cache = true;
... ... @@ -228,7 +234,7 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter
228 234 $nomecache = $layerName;
229 235 }
230 236 }
231   - if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature" ){
  237 + if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature" ){
232 238 $l->setmetadata("gml_include_items","all");
233 239 $l->set("template","none.htm");
234 240 $l->setmetadata("WMS_INCLUDE_ITEMS","all");
... ... @@ -243,6 +249,7 @@ if(!isset($_GET["telaR"])){//no caso de projecoes remotas, o mapfile nao e alter
243 249 }
244 250 }
245 251 }
  252 +
246 253 if (!function_exists('imagepng')){
247 254 $_GET["TIPOIMAGEM"] = "";
248 255 }
... ... @@ -273,9 +280,13 @@ if(isset($_GET["mapext"])){
273 280 //
274 281 //qd a cahamda e para um WMS, redireciona para ogc.php
275 282 //
276   -if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){
  283 +if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){
277 284 $req = ms_newowsrequestobj();
  285 + if($_GET["BBOX"]){
  286 + $_GET["BBOX"] = str_replace(" ",",",$_GET["BBOX"]);
  287 + }
278 288 $_GET = array_merge($_GET,$_POST);
  289 +
279 290 foreach ($_GET as $k=>$v){
280 291 $req->setParameter($k, $v);
281 292 }
... ... @@ -283,7 +294,6 @@ if($_GET["REQUEST"] == "GetFeatureInfo" || $_GET["REQUEST"] == "getfeature"){
283 294 $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
284 295 $or = $proto.$server.$_SERVER['PHP_SELF'];
285 296 $mapa->setmetadata("wfs_onlineresource",$or."?".$_SERVER["QUERY_STRING"]);
286   -
287 297 ms_ioinstallstdouttobuffer();
288 298 $mapa->owsdispatch($req);
289 299 $contenttype = ms_iostripstdoutbuffercontenttype();
... ... @@ -560,7 +570,7 @@ function inicializa(){
560 570 ilegal();
561 571 }
562 572 session_start();
563   - if($_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){
  573 + if($_GET["REQUEST"] == "getfeatureinfo" || $_GET["REQUEST"] == "GetFeatureInfo" || strtolower($_GET["REQUEST"]) == "getfeature"){
564 574 return;
565 575 }
566 576 if(@$_SESSION["fingerprint"]){
... ...
ferramentas/editorol/editorol.js
... ... @@ -747,13 +747,16 @@ i3GEO.editorOL =
747 747 YAHOO.legendaeditorOL.container.panel.show();
748 748 }
749 749 },
750   - captura : function(lonlat) {
751   - // if(i3GEO.desenho.layergrafico !== ""){return;}
752   -
753   - var d = 0.1, layers = [
754   - i3GEO.editorOL.layerAtivo()
755   - ], xy = lonlat.split(","), u = layers[0].url + "&REQUEST=getfeature&service=wfs&version=1.0.0";
756   - u += "&OUTPUTFORMAT=gml2&typename=" + layers[0].params.LAYERS;
  750 + captura : function(x,y,tema) {
  751 + var d = 0.1,
  752 + layer = i3geoOL.getLayersByName(tema)[0],
  753 + xy = [x,y],
  754 + u = layer.getSource().getUrls()[0],
  755 + poligono, retorno;
  756 +
  757 + u += "&REQUEST=getfeature&service=wfs&version=1.0.0";
  758 + u += "&OUTPUTFORMAT=gml2&typename=undefined";
  759 +
757 760 // remove parametros nao desejados
758 761 if (i3GEO.Interface.openlayers.googleLike === true) {
759 762 u += "&SRS=EPSG:3857";
... ... @@ -761,12 +764,10 @@ i3GEO.editorOL =
761 764 u = u.replace("&cache=sim", "&DESLIGACACHE=sim");
762 765 u = u.replace("&Z=${z}&X=${x}&Y=${y}", "");
763 766 u = u.replace("Z=${z}&X=${x}&Y=${y}", "");
764   - // u +=
765   - // "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Point><gml:coordinates>"+lonlat+"</gml:coordinates></gml:Point></Intersects></Filter>";
766 767  
767 768 xy[0] = xy[0] * 1;
768 769 xy[1] = xy[1] * 1;
769   - var poligono =
  770 + poligono =
770 771 (xy[0] - d) + ","
771 772 + (xy[1] + d)
772 773 + " "
... ... @@ -788,46 +789,13 @@ i3GEO.editorOL =
788 789 u +=
789 790 "&filter=<Filter><Intersects><PropertyName>Geometry</PropertyName><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:posList>" + poligono
790 791 + "</gml:posList></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></Intersects></Filter>";
791   -
792   - document.body.style.cursor = "wait";
793   - if (document.getElementById("i3geoMapa")) {
794   - document.getElementById("i3geoMapa").style.cursor = "wait";
795   - }
796   - OpenLayers.Request.issue({
797   - method : "GET",
798   - url : u,
799   - callback : function(retorno) {
800   - document.body.style.cursor = "default";
801   - if (document.getElementById("i3geoMapa")) {
802   - document.getElementById("i3geoMapa").style.cursor = "default";
803   - }
804   - var i, n, f, fromgml = new OpenLayers.Format.GML({
805   - geometryName : "msGeometry"
806   - }), gml = fromgml.read(retorno.responseText);
807   - n = gml.length;
808   - for (i = 0; i < n; i++) {
809   - f = gml[i];
810   - f["attributes"] = {
811   - opacidade : i3GEO.editorOL.simbologia.opacidade,
812   - texto : i3GEO.editorOL.simbologia.texto,
813   - fillColor : i3GEO.editorOL.simbologia.fillColor,
814   - strokeWidth : i3GEO.editorOL.simbologia.strokeWidth,
815   - strokeColor : i3GEO.editorOL.simbologia.strokeColor,
816   - pointRadius : i3GEO.editorOL.simbologia.pointRadius,
817   - graphicName : i3GEO.editorOL.simbologia.graphicName,
818   - registros : f["attributes"]
819   - };
820   - }
821   - i3GEO.desenho.layergrafico.addFeatures(gml);
822   - },
823   - failure : function() {
824   - document.body.style.cursor = "default";
825   - if (document.getElementById("i3geoMapa")) {
826   - document.getElementById("i3geoMapa").style.cursor = "default";
827   - }
828   - alert("Erro");
829   - }
830   - });
  792 + retorno = function(r){
  793 + //parser gml
  794 + };
  795 + u = i3GEO.configura.locaplic + "/classesphp/proxy.php?"
  796 + + u
  797 + + "&tipoRetornoProxy=string";
  798 + cpJSON.call(u, "foo", retorno, "");
831 799 },
832 800 salvaGeometrias : function() {
833 801 var geos = i3GEO.desenho.layergrafico.selectedFeatures, n = geos.length, ins = "";
... ... @@ -1514,18 +1482,45 @@ i3GEO.editorOL =
1514 1482 url = layer.getSource().getUrls()[0];
1515 1483 xy = evt.target.downPx_;
1516 1484 retorno = function(r){
1517   - var xy = evt.feature.getGeometry().getFirstCoordinate();
  1485 + var texto = "", lonlattexto, xy, temp, temp1, n, i, f = [], textoN = r.split(":");
  1486 + xy = evt.feature.getGeometry().getFirstCoordinate();
1518 1487 i3GEO.eventos.cliquePerm.ativo = true;
1519   - i3GEO.Interface.openlayers.balao(r,"", xy[0], xy[1]);
  1488 + try {
  1489 + if (textoN.length > 1) {
  1490 + temp = textoN[2].replace(/\n\r/g, "");
  1491 + temp = temp.replace(/'/g, "");
  1492 + temp = temp.replace(/\n/g, "|");
  1493 + temp = temp.replace(/_/g, " ");
  1494 + temp = temp.replace(/=/g, ":");
  1495 + temp = temp.split("|");
  1496 + n = temp.length;
  1497 + for (i = 0; i < n; i++) {
  1498 + temp1 = temp[i].replace(/^\s+/, "");
  1499 + temp1 = temp1.replace(/\s+$/, "");
  1500 + if (temp1 != "")
  1501 + f.push(temp1);
  1502 + }
  1503 + texto = "<pre>" + f.join("<br>") + "</pre>";
  1504 + }
  1505 + } catch (e) {}
  1506 + //funcao para capturar a geometria
  1507 + lonlattexto =
  1508 + "<span style=font-size:12px;color:blue;cursor:pointer onclick='i3GEO.editorOL.captura(" + xy[0]
  1509 + + ","
  1510 + + xy[1]
  1511 + + ",\""
  1512 + + tema.value
  1513 + + "\")'>edita geometria</span><br>";
  1514 + i3GEO.Interface.openlayers.balao("<div style='text-align:left' >" + lonlattexto + texto + "</div>","", xy[0], xy[1], false, false);
1520 1515 i3GEO.eventos.cliquePerm.ativo = false;
1521 1516 };
1522 1517 p = i3GEO.configura.locaplic + "/classesphp/proxy.php?"
1523 1518 + url
1524 1519 + "&tipoRetornoProxy=string&REQUEST=GetFeatureInfo&TIPOIMAGEM=nenhum&DESLIGACACHE=sim&STYLES=&SERVICE=WMS&VERSION=1.1.1&FEATURE_COUNT=1"
1525 1520 + "&FORMAT=image/png&INFO_FORMAT=text/plain&SRS=EPSG:4326"
1526   - + "&LAYERS= " + tema.value
1527   - + "&layer= " + tema.value
1528   - + "&QUERY_LAYERS= " + tema.value
  1521 + + "&LAYERS=" + tema.value
  1522 + + "&layer=" + tema.value
  1523 + + "&QUERY_LAYERS=" + tema.value
1529 1524 + "&HEIGHT=" + i3GEO.parametros.h
1530 1525 + "&WIDTH=" + i3GEO.parametros.w
1531 1526 + "&BBOX=" + i3geoOL.getExtent().toBBOX().split(",").join(" ")
... ...
js/interface.js
... ... @@ -735,9 +735,15 @@ i3GEO.Interface =
735 735 minWidth : '200px',
736 736 baloes : []
737 737 },
738   - balao : function(texto, completo, x, y) {
  738 + balao : function(texto, completo, x, y, botaoMais, botaoProp) {
739 739 var icone, painel, b, cabecalho, conteudo, p = i3GEO.Interface.openlayers.BALAOPROP, removeBaloes;
740 740  
  741 + if(botaoMais === undefined){
  742 + botaoMais = true;
  743 + }
  744 + if(botaoProp === undefined){
  745 + botaoProp = true;
  746 + }
741 747 removeBaloes = function() {
742 748 var t, n = i3GEO.Interface.openlayers.BALAOPROP.baloes.length, i;
743 749 for (i = 0; i < n; i++) {
... ... @@ -775,25 +781,29 @@ i3GEO.Interface =
775 781 };
776 782 cabecalho.appendChild(icone);
777 783 // icone das propriedades
778   - icone = document.createElement("div");
779   - icone.className = "i3GEOiconeFerramentas";
780   - icone.style.left = "3px";
781   - icone.onclick = function() {
782   - i3GEO.janela.prompt($trad("tolerancia"), function() {
783   - i3GEO.mapa.RESOLUCAOTIP = $i("i3GEOjanelaprompt").value;
784   - }, i3GEO.mapa.RESOLUCAOTIP);
785   - return false;
786   - };
787   - cabecalho.appendChild(icone);
  784 + if(botaoProp === true){
  785 + icone = document.createElement("div");
  786 + icone.className = "i3GEOiconeFerramentas";
  787 + icone.style.left = "3px";
  788 + icone.onclick = function() {
  789 + i3GEO.janela.prompt($trad("tolerancia"), function() {
  790 + i3GEO.mapa.RESOLUCAOTIP = $i("i3GEOjanelaprompt").value;
  791 + }, i3GEO.mapa.RESOLUCAOTIP);
  792 + return false;
  793 + };
  794 + cabecalho.appendChild(icone);
  795 + }
788 796 // icone mais info
789   - icone = document.createElement("div");
790   - icone.className = "i3GEOiconeMais";
791   - icone.style.left = "9px";
792   - icone.onclick = function() {
793   - i3GEO.janela.mensagemSimples("<div style='overflow:auto;height:100%'>" + completo + "</div>", "");
794   - return false;
795   - };
796   - cabecalho.appendChild(icone);
  797 + if(botaoMais === true){
  798 + icone = document.createElement("div");
  799 + icone.className = "i3GEOiconeMais";
  800 + icone.style.left = "9px";
  801 + icone.onclick = function() {
  802 + i3GEO.janela.mensagemSimples("<div style='overflow:auto;height:100%'>" + completo + "</div>", "");
  803 + return false;
  804 + };
  805 + cabecalho.appendChild(icone);
  806 + }
797 807 // icone x
798 808 icone = document.createElement("div");
799 809 icone.className = "ol-popup-closer";
... ...