Commit cdc014762b5ea9607d87ca2e94a417746f7450f3
1 parent
09744148
Exists in
master
and in
7 other branches
Inclusão do plugin parametrossql para uso nos mashups
Showing
7 changed files
with
134 additions
and
322 deletions
Show diff stats
ferramentas/parametrossql/index.js
| @@ -147,6 +147,9 @@ i3GEOF.parametrossql = { | @@ -147,6 +147,9 @@ i3GEOF.parametrossql = { | ||
| 147 | true | 147 | true |
| 148 | ); | 148 | ); |
| 149 | divid = janela[2].id; | 149 | divid = janela[2].id; |
| 150 | + temp = $i("i3GEOF.parametrossql_corpo").style; | ||
| 151 | + temp.paddingLeft = "0px"; | ||
| 152 | + temp.paddingRight = "0px"; | ||
| 150 | i3GEOF.parametrossql.aguarde = $i("i3GEOF.parametrossql_imagemCabecalho").style; | 153 | i3GEOF.parametrossql.aguarde = $i("i3GEOF.parametrossql_imagemCabecalho").style; |
| 151 | YAHOO.util.Event.addListener(janela[0].close, "click", i3GEOF.parametrossql.cancela); | 154 | YAHOO.util.Event.addListener(janela[0].close, "click", i3GEOF.parametrossql.cancela); |
| 152 | i3GEOF.parametrossql.inicia(divid,camada); | 155 | i3GEOF.parametrossql.inicia(divid,camada); |
| @@ -270,9 +273,10 @@ i3GEOF.parametrossql = { | @@ -270,9 +273,10 @@ i3GEOF.parametrossql = { | ||
| 270 | reg = new RegExp("plugin" + "([=])+([a-zA-Z0-9_]*)"); | 273 | reg = new RegExp("plugin" + "([=])+([a-zA-Z0-9_]*)"); |
| 271 | p.url = p.url.replace(reg, ""); | 274 | p.url = p.url.replace(reg, ""); |
| 272 | p.url = p.url + "&plugin=" + valores.join(","); | 275 | p.url = p.url + "&plugin=" + valores.join(","); |
| 273 | - p.setUrl(p.url); | 276 | + p.setUrl(p.url+"&"); |
| 274 | i3GEO.janela.destroi("i3GEOF.parametrossql"); | 277 | i3GEO.janela.destroi("i3GEOF.parametrossql"); |
| 275 | - p.redraw(); | 278 | + p.setVisibility(false); |
| 279 | + p.setVisibility(true); | ||
| 276 | } | 280 | } |
| 277 | } | 281 | } |
| 278 | }, | 282 | }, |
ferramentas/parametrossql/ogc.php
| @@ -24,11 +24,7 @@ if($_GET["SRS"] == "EPSG:900913"){ | @@ -24,11 +24,7 @@ if($_GET["SRS"] == "EPSG:900913"){ | ||
| 24 | $_GET["SRS"] = "EPSG:3857"; | 24 | $_GET["SRS"] = "EPSG:3857"; |
| 25 | } | 25 | } |
| 26 | $req = ms_newowsrequestobj(); | 26 | $req = ms_newowsrequestobj(); |
| 27 | -$tipo = ""; | ||
| 28 | $_GET = array_merge($_GET,$_POST); | 27 | $_GET = array_merge($_GET,$_POST); |
| 29 | -if(isset($_GET["sld"]) || isset($_GET["filter"])){ | ||
| 30 | - $cache = false; | ||
| 31 | -} | ||
| 32 | if(!isset($_GET["srs"]) && !isset($_GET["SRS"])){ | 28 | if(!isset($_GET["srs"]) && !isset($_GET["SRS"])){ |
| 33 | $_GET["srs"] = "EPSG:4326"; | 29 | $_GET["srs"] = "EPSG:4326"; |
| 34 | } | 30 | } |
| @@ -43,27 +39,28 @@ foreach ($_GET as $k=>$v){ | @@ -43,27 +39,28 @@ foreach ($_GET as $k=>$v){ | ||
| 43 | } | 39 | } |
| 44 | $req->setParameter("srsName",$req->getValueByName("SRS")); | 40 | $req->setParameter("srsName",$req->getValueByName("SRS")); |
| 45 | $listaepsg = $req->getValueByName("SRS")." EPSG:4618 EPSG:4291 EPSG:4326 EPSG:22521 EPSG:22522 EPSG:22523 EPSG:22524 EPSG:22525 EPSG:29101 EPSG:29119 EPSG:29120 EPSG:29121 EPSG:29122 EPSG:29177 EPSG:29178 EPSG:29179 EPSG:29180 EPSG:29181 EPSG:29182 EPSG:29183 EPSG:29184 EPSG:29185"; | 41 | $listaepsg = $req->getValueByName("SRS")." EPSG:4618 EPSG:4291 EPSG:4326 EPSG:22521 EPSG:22522 EPSG:22523 EPSG:22524 EPSG:22525 EPSG:29101 EPSG:29119 EPSG:29120 EPSG:29121 EPSG:29122 EPSG:29177 EPSG:29178 EPSG:29179 EPSG:29180 EPSG:29181 EPSG:29182 EPSG:29183 EPSG:29184 EPSG:29185"; |
| 46 | -$tipo = ""; | ||
| 47 | if(isset($version) && !isset($VERSION)){ | 42 | if(isset($version) && !isset($VERSION)){ |
| 48 | $VERSION = $version; | 43 | $VERSION = $version; |
| 49 | } | 44 | } |
| 50 | if(!isset($VERSION)){ | 45 | if(!isset($VERSION)){ |
| 51 | $req->setParameter("VeRsIoN","1.0.0"); | 46 | $req->setParameter("VeRsIoN","1.0.0"); |
| 52 | } | 47 | } |
| 48 | +// | ||
| 53 | //compatibiliza chamadas fora do padrao | 49 | //compatibiliza chamadas fora do padrao |
| 54 | // | 50 | // |
| 55 | if(isset($_GET["outputFormat"]) && $_GET["outputFormat"] != ""){ | 51 | if(isset($_GET["outputFormat"]) && $_GET["outputFormat"] != ""){ |
| 56 | $_GET["OUTPUTFORMAT"] = $_GET["outputFormat"]; | 52 | $_GET["OUTPUTFORMAT"] = $_GET["outputFormat"]; |
| 57 | } | 53 | } |
| 58 | -$_GET["DESLIGACACHE"] = "sim"; | ||
| 59 | -$agora = time(); | ||
| 60 | -$cache = false; | ||
| 61 | -$nomeMapfileTmp = $dir_tmp."/ogc_".md5($tema)."_".$agora.".map"; | 54 | +$agora = intval(time() / 1000); |
| 55 | +if(isset($_GET["Z"]) && isset($_GET["X"])){ | ||
| 56 | + $agora .= "google"; | ||
| 57 | +} | ||
| 58 | +$nomeMapfileTmp = $dir_tmp."/ogc_".md5($tema.$plugin.($req->getValueByName("SRS")))."_".$agora.".map"; | ||
| 62 | $nomeMapfileTmp = str_replace(",","",$nomeMapfileTmp); | 59 | $nomeMapfileTmp = str_replace(",","",$nomeMapfileTmp); |
| 63 | $nomeMapfileTmp = str_replace(" ","",$nomeMapfileTmp); | 60 | $nomeMapfileTmp = str_replace(" ","",$nomeMapfileTmp); |
| 64 | //essa variavel e usada para definir se a imagem final gerada devera ser cortada ou nao | 61 | //essa variavel e usada para definir se a imagem final gerada devera ser cortada ou nao |
| 65 | $cortePixels = 0; | 62 | $cortePixels = 0; |
| 66 | -if(file_exists($nomeMapfileTmp) && $tipo == ""){ | 63 | +if(file_exists($nomeMapfileTmp)){ |
| 67 | $oMap = ms_newMapobj($nomeMapfileTmp); | 64 | $oMap = ms_newMapobj($nomeMapfileTmp); |
| 68 | } | 65 | } |
| 69 | else{ | 66 | else{ |
| @@ -76,319 +73,103 @@ else{ | @@ -76,319 +73,103 @@ else{ | ||
| 76 | $proto = "http" . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "") . "://"; | 73 | $proto = "http" . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "s" : "") . "://"; |
| 77 | $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; | 74 | $server = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; |
| 78 | $or = $proto.$server.$_SERVER['PHP_SELF']; | 75 | $or = $proto.$server.$_SERVER['PHP_SELF']; |
| 79 | - if((isset($tema)) && ($tema != "") && ($tipo=="metadados")){ | ||
| 80 | - $or = $or."?tema=".$tema."&"; | ||
| 81 | - } | 76 | + $or = $or."?tema=".$tema."&"; |
| 82 | // | 77 | // |
| 83 | //parametros no nível maior | 78 | //parametros no nível maior |
| 84 | // | 79 | // |
| 85 | $oMap->setmetadata("ows_onlineresource",$or); | 80 | $oMap->setmetadata("ows_onlineresource",$or); |
| 86 | $oMap->setmetadata("wms_onlineresource",$or); | 81 | $oMap->setmetadata("wms_onlineresource",$or); |
| 87 | - $oMap->setmetadata("wms_title",$tituloInstituicao." - i3geo"); | ||
| 88 | - $oMap->setmetadata("wfs_title",$tituloInstituicao." - i3geo"); | ||
| 89 | - $oMap->setmetadata("wms_attribution_logourl_format","image/png"); | ||
| 90 | - $oMap->setmetadata("wms_attribution_logourl_height","56"); | ||
| 91 | - $oMap->setmetadata("wms_attribution_logourl_width","85"); | ||
| 92 | - $oMap->setmetadata("wms_attribution_logourl_href",$proto.$server.dirname($_SERVER['PHP_SELF'])."/imagens/i3geo.png"); | ||
| 93 | $oMap->setmetadata("wms_attribution_onlineresource",$proto.$server.dirname($_SERVER['PHP_SELF'])); | 82 | $oMap->setmetadata("wms_attribution_onlineresource",$proto.$server.dirname($_SERVER['PHP_SELF'])); |
| 94 | - $oMap->setmetadata("wms_attribution_title",$tituloInstituicao); | ||
| 95 | $oMap->setmetadata("ows_enable_request","*"); | 83 | $oMap->setmetadata("ows_enable_request","*"); |
| 96 | //parametro mandatario | 84 | //parametro mandatario |
| 97 | if($oMap->getmetadata("wms_srs") == ""){ | 85 | if($oMap->getmetadata("wms_srs") == ""){ |
| 98 | $oMap->setmetadata("wms_srs","EPSG:4326"); | 86 | $oMap->setmetadata("wms_srs","EPSG:4326"); |
| 99 | } | 87 | } |
| 88 | + | ||
| 100 | $e = $oMap->extent; | 89 | $e = $oMap->extent; |
| 101 | $extensaoMap = ($e->minx)." ".($e->miny)." ".($e->maxx)." ".($e->maxy); | 90 | $extensaoMap = ($e->minx)." ".($e->miny)." ".($e->maxx)." ".($e->maxy); |
| 102 | //gera o mapa | 91 | //gera o mapa |
| 103 | - if ($tipo == "" || $tipo == "metadados"){ | ||
| 104 | - $tema = explode(" ",$tema); | ||
| 105 | - //para o caso do tema ser um arquivo mapfile existente em uma pasta qualquer | ||
| 106 | - //$temai3geo = true indica que o layer será buscado na pasta i3geo/temas | ||
| 107 | - $temai3geo = true; | ||
| 108 | - if(file_exists($_GET["tema"]) && !isset($id_medida_variavel)){ | ||
| 109 | - $nmap = ms_newMapobj($_GET["tema"]); | ||
| 110 | - $temai3geo = false; | ||
| 111 | - $nmap->setmetadata("ows_enable_request","*"); | ||
| 112 | - } | ||
| 113 | - foreach ($tema as $tx){ | ||
| 114 | - $extensao = ".map"; | ||
| 115 | - if($temai3geo == true && file_exists($locaplic."/temas/".$tx.".php")){ | ||
| 116 | - $extensao = ".php"; | ||
| 117 | - } | ||
| 118 | - if($temai3geo == true && file_exists($locaplic."/temas/".$tx.".gvp")){ | ||
| 119 | - $extensao = ".gvp"; | ||
| 120 | - } | ||
| 121 | - if($extensao == ".map"){ | ||
| 122 | - //cria o mapfile com base no sistema de metadados estatisticos | ||
| 123 | - //verifica se o id_medida_variavel existe no mapfile e nao foi passado como um parametro | ||
| 124 | - if(!isset($id_medida_variavel) && $temai3geo == true){ | ||
| 125 | - $nmap = ms_newMapobj($locaplic."/temas/".$tx.".map"); | ||
| 126 | - $l = $nmap->getlayer(0); | ||
| 127 | - $teste = $l->getmetadata("METAESTAT_ID_MEDIDA_VARIAVEL"); | ||
| 128 | - if($teste != "" && $l->data == ""){ | ||
| 129 | - $id_medida_variavel = $teste; | ||
| 130 | - } | ||
| 131 | - } | ||
| 132 | - if(isset($id_medida_variavel)){ | ||
| 133 | - $temai3geo = false; | ||
| 134 | - include("admin/php/classe_metaestat.php"); | ||
| 135 | - $m = new Metaestat(); | ||
| 136 | - $m->nomecache = "ogcmetaestat".$id_medida_variavel; | ||
| 137 | - $mapfileMetaestat = $m->mapfileMedidaVariavel($id_medida_variavel,"",1,"","","","","","",true); | ||
| 138 | - $nmap = ms_newMapobj($mapfileMetaestat["mapfile"]); | ||
| 139 | - $nmap->setmetadata("ows_enable_request","*"); | ||
| 140 | - $req->setParameter("LAYERS", "ogcmetaestat".$id_medida_variavel); | ||
| 141 | - } | ||
| 142 | - if($temai3geo == true){ | ||
| 143 | - $nmap = ms_newMapobj($locaplic."/temas/".$tx.".map"); | ||
| 144 | - $nmap->setmetadata("ows_enable_request","*"); | ||
| 145 | - } | ||
| 146 | - if($temai3geo == false || empty($layers)) | ||
| 147 | - { | ||
| 148 | - $ts = $nmap->getalllayernames(); | ||
| 149 | - $nmap->setmetadata("ows_enable_request","*"); | 92 | + $nmap = ms_newMapobj($locaplic."/temas/".$tema.".map"); |
| 93 | + $nmap->setmetadata("ows_enable_request","*"); | ||
| 94 | + $l = $nmap->getlayerbyname($tema); | ||
| 95 | + //$l->setmetadata("ows_title",pegaNome($l)); | ||
| 96 | + $l->setmetadata("ows_srs",$listaepsg); | ||
| 97 | + $l->set("group",""); | ||
| 98 | + $l->setmetadata("gml_include_items","all"); | ||
| 99 | + $l->set("template","none.htm"); | ||
| 100 | + $l->set("dump",MS_TRUE); | ||
| 101 | + $l->setmetadata("WMS_INCLUDE_ITEMS","all"); | ||
| 102 | + $l->setmetadata("WFS_INCLUDE_ITEMS","all"); | ||
| 103 | + //inclui extensao geografica | ||
| 104 | + $extensao = $l->getmetadata("EXTENSAO"); | ||
| 105 | + if($extensao == ""){ | ||
| 106 | + $extensao = $extensaoMap; | ||
| 107 | + } | ||
| 108 | + $l->setmetadata("wms_extent",$extensao); | ||
| 109 | + if (!empty($postgis_mapa)){ | ||
| 110 | + if ($l->connectiontype == MS_POSTGIS){ | ||
| 111 | + $lcon = $l->connection; | ||
| 112 | + if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))){ | ||
| 113 | + // | ||
| 114 | + //o metadata CONEXAOORIGINAL guarda o valor original para posterior substituição | ||
| 115 | + // | ||
| 116 | + if(($lcon == " ") || ($lcon == "")){ | ||
| 117 | + $l->set("connection",$postgis_mapa); | ||
| 118 | + $l->setmetadata("CONEXAOORIGINAL",$lcon); | ||
| 150 | } | 119 | } |
| 151 | else{ | 120 | else{ |
| 152 | - $ts = explode(",",str_replace(" ",",",$layers)); | 121 | + $l->set("connection",$postgis_mapa[$lcon]); |
| 122 | + $l->setmetadata("CONEXAOORIGINAL",$lcon); | ||
| 153 | } | 123 | } |
| 154 | - foreach ($ts as $t){ | ||
| 155 | - $l = $nmap->getlayerbyname($t); | ||
| 156 | - $permite = $l->getmetadata("permiteogc"); | ||
| 157 | - if(strtolower($permite) != "nao"){ | ||
| 158 | - //necessário pq o mapfile pode ter todos os layers como default | ||
| 159 | - if($temai3geo == false){ | ||
| 160 | - $l->set("status",MS_OFF); | ||
| 161 | - } | ||
| 162 | - /* | ||
| 163 | - if($cache == true && strtolower($l->getmetadata('cache')) == 'sim' && $tipo == '' && count($tema) == 1){ | ||
| 164 | - carregaCacheImagem($_GET['BBOX'],$tx,$_GET['WIDTH'],$_GET['HEIGHT'],$cachedir); | ||
| 165 | - } | ||
| 166 | - */ | ||
| 167 | - $l->setmetadata("ows_title",pegaNome($l)); | ||
| 168 | - $l->setmetadata("ows_srs",$listaepsg); | ||
| 169 | - $l->set("group",""); | ||
| 170 | - //essa linha é necessária pq as vezes no mapfile não tem nenhum layer com o nome igual ao nome do mapfile | ||
| 171 | - if(count($ts)==1 && $temai3geo == true){ | ||
| 172 | - $l->set("name",$tx); | ||
| 173 | - } | ||
| 174 | - $l->setmetadata("gml_include_items","all"); | ||
| 175 | - $l->set("template","none.htm"); | ||
| 176 | - $l->set("dump",MS_TRUE); | ||
| 177 | - $l->setmetadata("WMS_INCLUDE_ITEMS","all"); | ||
| 178 | - $l->setmetadata("WFS_INCLUDE_ITEMS","all"); | ||
| 179 | - if(file_exists($locaplic."/temas/miniaturas/".$t.".map.mini.png")){ | ||
| 180 | - $mini = $proto.$server.dirname($_SERVER['PHP_SELF'])."/temas/miniaturas/".$t.".map.mini.png"; | ||
| 181 | - $l->setmetadata("wms_attribution_logourl_format","image/png"); | ||
| 182 | - $l->setmetadata("wms_attribution_logourl_height","50"); | ||
| 183 | - $l->setmetadata("wms_attribution_logourl_width","50"); | ||
| 184 | - $l->setmetadata("wms_attribution_logourl_href",$mini); | ||
| 185 | - } | ||
| 186 | - if($l->type == MS_LAYER_RASTER && $l->numclasses > 0){ | ||
| 187 | - $c = $l->getclass(0); | ||
| 188 | - if($c->name == ""){ | ||
| 189 | - $c->name = " "; | ||
| 190 | - } | ||
| 191 | - } | ||
| 192 | - //inclui extensao geografica | ||
| 193 | - $extensao = $l->getmetadata("EXTENSAO"); | ||
| 194 | - if($extensao == ""){ | ||
| 195 | - $extensao = $extensaoMap; | ||
| 196 | - } | ||
| 197 | - $l->setmetadata("wms_extent",$extensao); | ||
| 198 | - if (!empty($postgis_mapa)){ | ||
| 199 | - if ($l->connectiontype == MS_POSTGIS){ | ||
| 200 | - $lcon = $l->connection; | ||
| 201 | - if (($lcon == " ") || ($lcon == "") || (in_array($lcon,array_keys($postgis_mapa)))){ | ||
| 202 | - // | ||
| 203 | - //o metadata CONEXAOORIGINAL guarda o valor original para posterior substituição | ||
| 204 | - // | ||
| 205 | - if(($lcon == " ") || ($lcon == "")){ | ||
| 206 | - $l->set("connection",$postgis_mapa); | ||
| 207 | - $l->setmetadata("CONEXAOORIGINAL",$lcon); | ||
| 208 | - } | ||
| 209 | - else{ | ||
| 210 | - $l->set("connection",$postgis_mapa[$lcon]); | ||
| 211 | - $l->setmetadata("CONEXAOORIGINAL",$lcon); | ||
| 212 | - } | ||
| 213 | - } | ||
| 214 | - } | ||
| 215 | - } | ||
| 216 | - autoClasses($l,$oMap); | ||
| 217 | - if($versao > 5){ | ||
| 218 | - $pr = $l->getProcessing(); | ||
| 219 | - if(!in_array("LABEL_NO_CLIP=True",$pr)){ | ||
| 220 | - $l->setprocessing("LABEL_NO_CLIP=True"); | ||
| 221 | - } | ||
| 222 | - if(!in_array("POLYLINE_NO_CLIP=True",$pr)){ | ||
| 223 | - $l->setprocessing("POLYLINE_NO_CLIP=True"); | ||
| 224 | - } | ||
| 225 | - } | ||
| 226 | - // | ||
| 227 | - //verifica se existem parametros de substituicao passados via url | ||
| 228 | - // | ||
| 229 | - $parametro = $_GET["map_layer_".$l->name."_filter"]; | ||
| 230 | - //echo $parametro;exit; | ||
| 231 | - if(!empty($parametro)){ | ||
| 232 | - $l->setfilter($parametro); | ||
| 233 | - $cache = false; | ||
| 234 | - } | ||
| 235 | - | ||
| 236 | - ms_newLayerObj($oMap, $l); | ||
| 237 | - //$req->setParameter("LAYERS", "mundo"); | ||
| 238 | - } | ||
| 239 | - } | ||
| 240 | - } | ||
| 241 | - if($extensao == ".php"){ | ||
| 242 | - include_once($locaplic."/temas/".$tx.".php"); | ||
| 243 | - eval($tx."(\$oMap);"); | ||
| 244 | - } | ||
| 245 | - if($extensao == ".gvp"){ | ||
| 246 | - include_once($locaplic."/pacotes/gvsig/gvsig2mapfile/class.gvsig2mapfile.php"); | ||
| 247 | - $gm = new gvsig2mapfile($locaplic."/temas/".$tx.".gvp"); | ||
| 248 | - $gvsigview = $gm->getViewsNames(); | ||
| 249 | - foreach($gvsigview as $gv){ | ||
| 250 | - $dataView = $gm->getViewData($gv); | ||
| 251 | - $oMap = $gm->addLayers($oMap,$gv,$dataView["layerNames"]); | ||
| 252 | - } | ||
| 253 | - $numlayers = $oMap->numlayers; | ||
| 254 | - $layers = array(); | ||
| 255 | - //$layers[] = "default"; | ||
| 256 | - for ($i=0;$i < $numlayers;$i++){ | ||
| 257 | - $l = $oMap->getlayer($i); | ||
| 258 | - $l->setmetadata("gml_include_items","all"); | ||
| 259 | - $l->set("dump",MS_TRUE); | ||
| 260 | - $l->setmetadata("WMS_INCLUDE_ITEMS","all"); | ||
| 261 | - $l->setmetadata("WFS_INCLUDE_ITEMS","all"); | ||
| 262 | - $l->setmetadata("ows_srs",$listaepsg); | ||
| 263 | - $l->setmetadata("ows_title",$l->getmetadata("TEMA")); | ||
| 264 | - $l->set("status",MS_OFF); | ||
| 265 | - $layers[] = $l->name; | ||
| 266 | - if(file_exists($locaplic."/temas/miniaturas/".$tx.".map.mini.png")){ | ||
| 267 | - $mini = $proto.$server.dirname($_SERVER['PHP_SELF'])."/temas/miniaturas/".$tx.".map.mini.png"; | ||
| 268 | - $l->setmetadata("wms_attribution_logourl_format","image/png"); | ||
| 269 | - $l->setmetadata("wms_attribution_logourl_height","50"); | ||
| 270 | - $l->setmetadata("wms_attribution_logourl_width","50"); | ||
| 271 | - $l->setmetadata("wms_attribution_logourl_href",$mini); | ||
| 272 | - } | ||
| 273 | - if($l->type == MS_LAYER_RASTER && $l->numclasses > 0){ | ||
| 274 | - $c = $l->getclass(0); | ||
| 275 | - if($c->name == ""){ | ||
| 276 | - $c->name = " "; | ||
| 277 | - } | ||
| 278 | - } | ||
| 279 | - //inclui extensao geografica | ||
| 280 | - $extensao = $l->getmetadata("EXTENSAO"); | ||
| 281 | - if($extensao == ""){ | ||
| 282 | - $extensao = $extensaoMap; | ||
| 283 | - } | ||
| 284 | - $l->setmetadata("wms_extent",$extensao); | ||
| 285 | - // | ||
| 286 | - //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos | ||
| 287 | - // | ||
| 288 | - if ($l->getmetadata("cortepixels") != ""){ | ||
| 289 | - $cortePixels = $l->getmetadata("cortepixels"); | ||
| 290 | - } | ||
| 291 | - } | ||
| 292 | - $req->setParameter("LAYERS", implode(",",$layers)); | ||
| 293 | - $req->setParameter("STYLES", ""); | ||
| 294 | - //r_dump($req);exit; | ||
| 295 | } | 124 | } |
| 296 | } | 125 | } |
| 297 | } | 126 | } |
| 298 | - else{ | ||
| 299 | - $conta = 0; | ||
| 300 | - $int = explode(",",$intervalo); | ||
| 301 | - $codigosTema = array(); | ||
| 302 | - if(empty($perfil)){ | ||
| 303 | - $perfil = ""; | 127 | + autoClasses($l,$oMap); |
| 128 | + if($versao > 5){ | ||
| 129 | + $pr = $l->getProcessing(); | ||
| 130 | + if(!in_array("LABEL_NO_CLIP=True",$pr)){ | ||
| 131 | + $l->setprocessing("LABEL_NO_CLIP=True"); | ||
| 304 | } | 132 | } |
| 305 | - include("classesphp/classe_menutemas.php"); | ||
| 306 | - $m = new Menutemas("",$perfil,$locaplic,$urli3geo); | ||
| 307 | - $menus = $m->pegaListaDeMenus(); | ||
| 308 | - foreach ($menus as $menu){ | ||
| 309 | - $grupos = $m->pegaListaDeGrupos($menu["idmenu"],$listasistemas="nao",$listasgrupos="sim"); | ||
| 310 | - foreach($grupos as $grupo){ | ||
| 311 | - if(strtolower($grupo["ogc"]) == "sim"){ | ||
| 312 | - foreach($grupo["subgrupos"] as $sgrupo){ | ||
| 313 | - if(strtolower($sgrupo["ogc"]) == "sim"){ | ||
| 314 | - $temas = $m->pegaListaDeTemas($grupo["id_n1"],$sgrupo["id_n2"],$menu["idmenu"]); | ||
| 315 | - foreach($temas as $tema){ | ||
| 316 | - if(strtolower($tema["ogc"]) == "sim"){ | ||
| 317 | - $codigosTema[] = array("tema"=>$tema["tid"],"fonte"=>$tema["link"]); | ||
| 318 | - } | ||
| 319 | - } | ||
| 320 | - } | ||
| 321 | - } | ||
| 322 | - } | ||
| 323 | - } | 133 | + if(!in_array("POLYLINE_NO_CLIP=True",$pr)){ |
| 134 | + $l->setprocessing("POLYLINE_NO_CLIP=True"); | ||
| 324 | } | 135 | } |
| 325 | - //echo "<pre>"; | ||
| 326 | - //var_dump($codigosTema); | ||
| 327 | - //exit; | ||
| 328 | - | ||
| 329 | - foreach($codigosTema as $c){ | ||
| 330 | - $codigoTema = $c["tema"]; | ||
| 331 | - if(file_exists($locaplic."/temas/".$codigoTema.".map")){ | ||
| 332 | - if (@ms_newMapobj($locaplic."/temas/".$codigoTema.".map")){ | ||
| 333 | - $nmap = ms_newMapobj($locaplic."/temas/".$codigoTema.".map"); | ||
| 334 | - $nmap->setmetadata("ows_enable_request","*"); | ||
| 335 | - $ts = $nmap->getalllayernames(); | ||
| 336 | - if (count($ts) == 1){ | ||
| 337 | - foreach ($ts as $t){ | ||
| 338 | - if ($oMap->getlayerbyname($t) == ""){ | ||
| 339 | - $conta++; | ||
| 340 | - if (($conta >= $int[0]) && ($conta <= $int[1])){ | ||
| 341 | - $l = $nmap->getlayerbyname($t); | ||
| 342 | - $extensao = $l->getmetadata("EXTENSAO"); | ||
| 343 | - if($extensao == ""){ | ||
| 344 | - $extensao = $extensaoMap; | ||
| 345 | - } | ||
| 346 | - $l->setmetadata("wms_extent",$extensao); | ||
| 347 | - | ||
| 348 | - $l->setmetadata("ows_title",pegaNome($l)); | ||
| 349 | - $l->setmetadata("ows_srs",$listaepsg); | ||
| 350 | - $l->set("status",MS_OFF); | ||
| 351 | - $l->setmetadata("gml_include_items","all"); | ||
| 352 | - $l->set("dump",MS_TRUE); | ||
| 353 | - $l->setmetadata("WMS_INCLUDE_ITEMS","all"); | ||
| 354 | - $l->setmetadata("WFS_INCLUDE_ITEMS","all"); | ||
| 355 | - if($l->getmetadata("ows_metadataurl_href") == ""){ | ||
| 356 | - $l->setmetadata("ows_metadataurl_href",$c["fonte"]); | ||
| 357 | - $l->setmetadata("ows_metadataurl_type","TC211"); | ||
| 358 | - $l->setmetadata("ows_metadataurl_format","text/html"); | ||
| 359 | - } | ||
| 360 | - if(file_exists($locaplic."/temas/miniaturas/".$t.".map.mini.png")){ | ||
| 361 | - $mini = $proto.$server.dirname($_SERVER['PHP_SELF'])."/temas/miniaturas/".$t.".map.mini.png"; | ||
| 362 | - $l->setmetadata("wms_attribution_logourl_format","image/png"); | ||
| 363 | - $l->setmetadata("wms_attribution_logourl_height","50"); | ||
| 364 | - $l->setmetadata("wms_attribution_logourl_width","50"); | ||
| 365 | - $l->setmetadata("wms_attribution_logourl_href",$mini); | ||
| 366 | - } | ||
| 367 | - // | ||
| 368 | - //numero de pixels que serao considerados para corte da imagem no caso de cache ativo e tema de pontos | ||
| 369 | - // | ||
| 370 | - if ($l->getmetadata("cortepixels") != ""){ | ||
| 371 | - $cortePixels = $l->getmetadata("cortepixels"); | ||
| 372 | - } | ||
| 373 | - cloneInlineSymbol($l,$nmap,$oMap); | ||
| 374 | - ms_newLayerObj($oMap, $l); | ||
| 375 | - | ||
| 376 | - } | ||
| 377 | - } | ||
| 378 | - } | ||
| 379 | - } | ||
| 380 | - } | ||
| 381 | - else{ | ||
| 382 | - echo "Erro no arquivo ".$locaplic."/temas/".$codigoTema.".map <br>"; | ||
| 383 | - $error = ms_GetErrorObj(); | ||
| 384 | - while($error && $error->code != MS_NOERR){ | ||
| 385 | - printf("<br>Error in %s: %s<br>\n", $error->routine, $error->message); | ||
| 386 | - $error = $error->next(); | ||
| 387 | - } | ||
| 388 | - } | ||
| 389 | - } | 136 | + } |
| 137 | + //aplica os parametros especificos do plugin | ||
| 138 | + if(!empty($plugin)){ | ||
| 139 | + $data = $l->data; | ||
| 140 | + $c = $l->getmetadata("PLUGINI3GEO"); | ||
| 141 | + if($c != ""){ | ||
| 142 | + $cs = json_decode($c,true); | ||
| 143 | + $cs = $cs["parametros"]; | ||
| 144 | + $chaves = array(); | ||
| 145 | + foreach($cs as $c){ | ||
| 146 | + $chaves[] = $c["chave"]; | ||
| 147 | + } | ||
| 148 | + $chaves = implode(",",$chaves); | ||
| 149 | + $filtro = $l->getFilterString(); | ||
| 150 | + | ||
| 151 | + $chaves = str_ireplace(array(" and ", " or ", "select","from","where","update","delete","insert","--"),"",$chaves); | ||
| 152 | + $chaves = explode(",",$chaves); | ||
| 153 | + $valores = str_ireplace(array(" and ", " or ", "select","from","where","update","delete","insert","--"),"",$plugin); | ||
| 154 | + $valores = explode(",",strip_tags($valores)); | ||
| 155 | + $n = count($chaves); | ||
| 156 | + for($i = 0; $i < $n; $i++){ | ||
| 157 | + if($chaves[$i] != ""){ | ||
| 158 | + $v = $valores[$i]; | ||
| 159 | + $data = str_replace($chaves[$i],$v,$data); | ||
| 160 | + if($filtro != ""){ | ||
| 161 | + $filtro = str_replace($chaves[$i],$v,$filtro); | ||
| 162 | + } | ||
| 163 | + } | ||
| 164 | + } | ||
| 165 | + if($filtro != ""){ | ||
| 166 | + $l->setfilter($filtro); | ||
| 167 | + } | ||
| 168 | + $l->set("data",$data); | ||
| 390 | } | 169 | } |
| 391 | } | 170 | } |
| 171 | + ms_newLayerObj($oMap, $l); | ||
| 172 | + | ||
| 392 | $oMap->setSymbolSet($locaplic."/symbols/".basename($oMap->symbolsetfilename)); | 173 | $oMap->setSymbolSet($locaplic."/symbols/".basename($oMap->symbolsetfilename)); |
| 393 | $oMap->setFontSet($locaplic."/symbols/".basename($oMap->fontsetfilename)); | 174 | $oMap->setFontSet($locaplic."/symbols/".basename($oMap->fontsetfilename)); |
| 394 | $oMap->save($nomeMapfileTmp); | 175 | $oMap->save($nomeMapfileTmp); |
| @@ -509,9 +290,7 @@ if(strtolower($req->getValueByName("REQUEST")) == "getlegendgraphic"){ | @@ -509,9 +290,7 @@ if(strtolower($req->getValueByName("REQUEST")) == "getlegendgraphic"){ | ||
| 509 | echo $leg;exit; | 290 | echo $leg;exit; |
| 510 | } | 291 | } |
| 511 | } | 292 | } |
| 512 | - | ||
| 513 | } | 293 | } |
| 514 | - | ||
| 515 | if(strtolower($req->getValueByName("REQUEST")) == "getfeature"){ | 294 | if(strtolower($req->getValueByName("REQUEST")) == "getfeature"){ |
| 516 | $l = $oMap->getlayer(0); | 295 | $l = $oMap->getlayer(0); |
| 517 | if($req->getValueByName("TYPENAME") == "" || $req->getValueByName("TYPENAME") == "undefined"){ | 296 | if($req->getValueByName("TYPENAME") == "" || $req->getValueByName("TYPENAME") == "undefined"){ |
| @@ -533,14 +312,6 @@ if(strtolower($req->getValueByName("REQUEST")) == "getfeatureinfo"){ | @@ -533,14 +312,6 @@ if(strtolower($req->getValueByName("REQUEST")) == "getfeatureinfo"){ | ||
| 533 | $_GET["SRS"] = "EPSG:3857"; | 312 | $_GET["SRS"] = "EPSG:3857"; |
| 534 | } | 313 | } |
| 535 | } | 314 | } |
| 536 | -// | ||
| 537 | -//altera os caminhos das imagens | ||
| 538 | -// | ||
| 539 | -if((isset($legenda)) && (strtolower($legenda) == "sim")){ | ||
| 540 | - $leg = $oMap->legend; | ||
| 541 | - $leg->set("status",MS_EMBED); | ||
| 542 | -} | ||
| 543 | - | ||
| 544 | ms_ioinstallstdouttobuffer(); | 315 | ms_ioinstallstdouttobuffer(); |
| 545 | //verifica parametro outputformat | 316 | //verifica parametro outputformat |
| 546 | if(strtolower($req->getValueByName("REQUEST")) == "getmap" && $req->getValueByName("format") == ""){ | 317 | if(strtolower($req->getValueByName("REQUEST")) == "getmap" && $req->getValueByName("format") == ""){ |
| @@ -570,7 +341,9 @@ function nomeRand($n=10) | @@ -570,7 +341,9 @@ function nomeRand($n=10) | ||
| 570 | $a = 'azertyuiopqsdfghjklmwxcvbnABCDEFGHIJKLMNOPQRSTUVWXYZ'; | 341 | $a = 'azertyuiopqsdfghjklmwxcvbnABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
| 571 | $max = 51; | 342 | $max = 51; |
| 572 | for($i=0; $i < $n; ++$i) | 343 | for($i=0; $i < $n; ++$i) |
| 573 | - {$nomes .= $a{mt_rand(0, $max)};} | 344 | + { |
| 345 | + $nomes .= $a{mt_rand(0, $max)}; | ||
| 346 | + } | ||
| 574 | return $nomes; | 347 | return $nomes; |
| 575 | } | 348 | } |
| 576 | 349 |
init/dicionario.js
init/index.php
| @@ -194,7 +194,7 @@ botoesIni.push({ | @@ -194,7 +194,7 @@ botoesIni.push({ | ||
| 194 | },{ | 194 | },{ |
| 195 | "img":"mashup.png", | 195 | "img":"mashup.png", |
| 196 | "href":"../mashups", | 196 | "href":"../mashups", |
| 197 | - "titulo":$trad(18,g_traducao_init) | 197 | + "titulo":$trad(18,g_traducao_init) + "<br><a href='../mashups/osm.php?temas=&largura=800&altura=500' target=_blank >OSM</a>" + " - <a href='../mashups/openlayers.php?temas=&largura=800&altura=500' target=_blank >OpenLayers</a>" |
| 198 | },{ | 198 | },{ |
| 199 | "img":"googlemaps.png", | 199 | "img":"googlemaps.png", |
| 200 | "href":"../<?php echo $customDir; ?>/black_gm.phtml", | 200 | "href":"../<?php echo $customDir; ?>/black_gm.phtml", |
mashups/openlayers.php
| @@ -449,8 +449,8 @@ function ajuda(){ | @@ -449,8 +449,8 @@ function ajuda(){ | ||
| 449 | <?php | 449 | <?php |
| 450 | //carrega o script para layers do tipo plugin | 450 | //carrega o script para layers do tipo plugin |
| 451 | if(count($temasPluginI3Geo) > 0){ | 451 | if(count($temasPluginI3Geo) > 0){ |
| 452 | - echo '<script type="text/javascript" src="../classesjs/classe_plugini3geo.js"></script>'."\n"; | ||
| 453 | - //echo '<script type="text/javascript" src="../classesjs/compactados/classe_plugini3geo_compacto.js"></script>'."\n"; | 452 | + //echo '<script type="text/javascript" src="../classesjs/classe_plugini3geo.js"></script>'."\n"; |
| 453 | + echo '<script type="text/javascript" src="../classesjs/compactados/classe_plugini3geo_compacto.js"></script>'."\n"; | ||
| 454 | echo '<script type="text/javascript" src="../pacotes/cpaint/cpaint2_compacto.inc.js"></script>'."\n"; | 454 | echo '<script type="text/javascript" src="../pacotes/cpaint/cpaint2_compacto.inc.js"></script>'."\n"; |
| 455 | } | 455 | } |
| 456 | ?> | 456 | ?> |
mashups/osm.php
| @@ -438,7 +438,8 @@ function ajuda(){ | @@ -438,7 +438,8 @@ function ajuda(){ | ||
| 438 | <?php | 438 | <?php |
| 439 | //carrega o script para layers do tipo plugin | 439 | //carrega o script para layers do tipo plugin |
| 440 | if(count($temasPluginI3Geo) > 0){ | 440 | if(count($temasPluginI3Geo) > 0){ |
| 441 | - echo '<script type="text/javascript" src="../classesjs/classe_plugini3geo.js"></script>'."\n"; | 441 | + echo '<script type="text/javascript" src="../classesjs/compactados/classe_plugini3geo_compacto.js"></script>'."\n"; |
| 442 | + echo '<script type="text/javascript" src="../pacotes/cpaint/cpaint2_compacto.inc.js"></script>'."\n"; | ||
| 442 | } | 443 | } |
| 443 | ?> | 444 | ?> |
| 444 | <link rel="stylesheet" href="openlayers_compacto.css" type="text/css" /> | 445 | <link rel="stylesheet" href="openlayers_compacto.css" type="text/css" /> |
| @@ -458,6 +459,26 @@ if(count($temasPluginI3Geo) > 0){ | @@ -458,6 +459,26 @@ if(count($temasPluginI3Geo) > 0){ | ||
| 458 | opacity: .8; | 459 | opacity: .8; |
| 459 | filter: alpha(opacity = 80); | 460 | filter: alpha(opacity = 80); |
| 460 | } | 461 | } |
| 462 | +.pluginParametrossql { | ||
| 463 | + background-image: url("../imagens/gisicons/settings.png"); | ||
| 464 | + background-size: 14px auto; | ||
| 465 | + cursor: pointer; | ||
| 466 | + position: relative; | ||
| 467 | + top: 3px; | ||
| 468 | + width: 14px; | ||
| 469 | +} | ||
| 470 | + | ||
| 471 | +.ajuda_usuario { | ||
| 472 | + background-image: url(../imagens/external.png); | ||
| 473 | + background-position: 0px 0px; | ||
| 474 | + background-repeat: no-repeat; | ||
| 475 | + margin-left: 0; | ||
| 476 | + text-decoration: none; | ||
| 477 | + cursor: help; | ||
| 478 | + position: relative; | ||
| 479 | + top: 2px; | ||
| 480 | + font-size: 13px; | ||
| 481 | +} | ||
| 461 | </style> | 482 | </style> |
| 462 | </head> | 483 | </head> |
| 463 | <body class=" yui-skin-sam"> | 484 | <body class=" yui-skin-sam"> |
| @@ -532,7 +553,7 @@ i3GEO.editorOL.ativarodadomouse = "<?php | @@ -532,7 +553,7 @@ i3GEO.editorOL.ativarodadomouse = "<?php | ||
| 532 | i3GEO.editorOL.legendahtml = "<?php | 553 | i3GEO.editorOL.legendahtml = "<?php |
| 533 | if(isset($legendahtml)){echo $legendahtml;} | 554 | if(isset($legendahtml)){echo $legendahtml;} |
| 534 | else | 555 | else |
| 535 | - {echo "false";} | 556 | + {echo "true";} |
| 536 | ?>"; | 557 | ?>"; |
| 537 | <?php | 558 | <?php |
| 538 | if(isset($controles)){ | 559 | if(isset($controles)){ |
| @@ -584,21 +605,35 @@ i3GEO.editorOL.mapa = new OpenLayers.Map( | @@ -584,21 +605,35 @@ i3GEO.editorOL.mapa = new OpenLayers.Map( | ||
| 584 | minResolution: i3GEO.editorOL.minresolution | 605 | minResolution: i3GEO.editorOL.minresolution |
| 585 | } | 606 | } |
| 586 | ); | 607 | ); |
| 587 | -i3GEO.editorOL.inicia(); | 608 | + |
| 588 | if(!i3GEO.configura){ | 609 | if(!i3GEO.configura){ |
| 589 | i3GEO.configura = {"locaplic": "../"}; | 610 | i3GEO.configura = {"locaplic": "../"}; |
| 590 | } | 611 | } |
| 591 | 612 | ||
| 592 | <?php | 613 | <?php |
| 593 | //camadas plugin | 614 | //camadas plugin |
| 594 | - | ||
| 595 | foreach ($temasPluginI3Geo as $t){ | 615 | foreach ($temasPluginI3Geo as $t){ |
| 596 | //cria um objeto javascript para iniciar o plugin | 616 | //cria um objeto javascript para iniciar o plugin |
| 597 | $camada = '{"tema": "'.$t["tema"].'","name":"'.$t["name"].'","plugini3geo":'.$t["plugin"].'}'; | 617 | $camada = '{"tema": "'.$t["tema"].'","name":"'.$t["name"].'","plugini3geo":'.$t["plugin"].'}'; |
| 598 | echo "var camada = $camada;\n"; | 618 | echo "var camada = $camada;\n"; |
| 599 | - echo "i3GEO.pluginI3geo[camada.plugini3geo.plugin].openlayers.inicia(camada,i3GEO.editorOL.mapa);\n"; | 619 | + //echo "i3GEO.pluginI3geo[camada.plugini3geo.plugin].openlayers.inicia(camada,i3GEO.editorOL.mapa);\n"; |
| 620 | + $visivel = "false"; | ||
| 621 | + if(in_array($t["name"],$visiveis)){ | ||
| 622 | + $visivel = "true"; | ||
| 623 | + } | ||
| 624 | + echo "adicionaPluginI3geo(camada,$visivel);\n"; | ||
| 600 | } | 625 | } |
| 601 | ?> | 626 | ?> |
| 627 | +i3GEO.editorOL.inicia(); | ||
| 628 | + | ||
| 629 | +function adicionaPluginI3geo(camada,visivel){ | ||
| 630 | + //TODO nao funciona | ||
| 631 | + var l = i3GEO.pluginI3geo.layerMashup("openlayers",camada,"4326"); | ||
| 632 | + l.setVisibility(visivel); | ||
| 633 | + if(l != true){ | ||
| 634 | + i3GEO.editorOL.layersIniciais.push(l); | ||
| 635 | + } | ||
| 636 | +} | ||
| 602 | </script> | 637 | </script> |
| 603 | </body> | 638 | </body> |
| 604 | </html> | 639 | </html> |
ogc.php
| @@ -272,7 +272,7 @@ if(isset($_GET["DESLIGACACHE"]) && $_GET["DESLIGACACHE"] == "sim"){ | @@ -272,7 +272,7 @@ if(isset($_GET["DESLIGACACHE"]) && $_GET["DESLIGACACHE"] == "sim"){ | ||
| 272 | $agora = time(); | 272 | $agora = time(); |
| 273 | $cache = false; | 273 | $cache = false; |
| 274 | } | 274 | } |
| 275 | -$nomeMapfileTmp = $dir_tmp."/ogc_".md5($tema)."_".$agora.".map"; | 275 | +$nomeMapfileTmp = $dir_tmp."/ogc_".md5($tema.($req->getValueByName("SRS")))."_".$agora.".map"; |
| 276 | $nomeMapfileTmp = str_replace(",","",$nomeMapfileTmp); | 276 | $nomeMapfileTmp = str_replace(",","",$nomeMapfileTmp); |
| 277 | $nomeMapfileTmp = str_replace(" ","",$nomeMapfileTmp); | 277 | $nomeMapfileTmp = str_replace(" ","",$nomeMapfileTmp); |
| 278 | //essa variavel e usada para definir se a imagem final gerada devera ser cortada ou nao | 278 | //essa variavel e usada para definir se a imagem final gerada devera ser cortada ou nao |