Commit 6f31739cb6696fd5a54caff0e6cf75697be138ad

Authored by Edmar Moretti
1 parent a56e4ee7

Inclusão do OL3 no editor de mapfiles

admin/php/editortexto.php
@@ -226,10 +226,10 @@ Alt-left - Início da linha<br> @@ -226,10 +226,10 @@ Alt-left - Início da linha<br>
226 <?php 226 <?php
227 $mapfile = str_replace("\\","/",$mapfile); 227 $mapfile = str_replace("\\","/",$mapfile);
228 if(!empty($extensao)){ 228 if(!empty($extensao)){
229 - echo "<iframe id='mapaPreview' src='../../mashups/openlayers.php?mapext=".$extensao."&servidor=../admin/php/preview.php&fundo=e_wsm&nocache=sim&DESLIGACACHE=sim&controles=navigation,panzoombar,scaleline,mouseposition&botoes=identifica&largura=550&altura=400&temas=".$mapfile."' style='position:relative;top:2px;overflow:hidden;width:100%;height:450px;border:0px solid gray;'>"; 229 + echo "<iframe id='mapaPreview' src='../../mashups/openlayers3.php?mapext=".$extensao."&servidor=../admin/php/preview.php&fundo=e_wsm&nocache=sim&DESLIGACACHE=sim&controles=navigation,panzoombar,scaleline,mouseposition&botoes=identifica&largura=550&altura=400&temas=".$mapfile."' style='position:relative;top:2px;overflow:hidden;width:100%;height:450px;border:0px solid gray;'>";
230 } 230 }
231 else{ 231 else{
232 - echo "<iframe id='mapaPreview' src='../../mashups/openlayers.php?servidor=../admin/php/preview.php&fundo=e_wsm&nocache=sim&DESLIGACACHE=sim&controles=navigation,panzoombar,scaleline,mouseposition&botoes=identifica&largura=550&altura=400&temas=".$mapfile."' style='position:relative;top:2px;overflow:hidden;width:100%;height:450px;border:0px solid gray;'>"; 232 + echo "<iframe id='mapaPreview' src='../../mashups/openlayers3.php?servidor=../admin/php/preview.php&fundo=e_wsm&nocache=sim&DESLIGACACHE=sim&controles=navigation,panzoombar,scaleline,mouseposition&botoes=identifica&largura=550&altura=400&temas=".$mapfile."' style='position:relative;top:2px;overflow:hidden;width:100%;height:450px;border:0px solid gray;'>";
233 } 233 }
234 echo "</iframe>"; 234 echo "</iframe>";
235 echo "<input type=hidden name=tipo value=gravar />"; 235 echo "<input type=hidden name=tipo value=gravar />";
ferramentas/editorol/editorol.js
@@ -243,14 +243,6 @@ i3GEO.editorOL = @@ -243,14 +243,6 @@ i3GEO.editorOL =
243 matrixIds : [], 243 matrixIds : [],
244 //utilizado pelo mashup 244 //utilizado pelo mashup
245 inicia : function() { 245 inicia : function() {
246 - /*  
247 - var temp = i3GEO.editorOL.minresolution,  
248 - r = [ i3GEO.editorOL.minresolution ];  
249 - for (var j = 0; j < (i3GEO.editorOL.numzoom - 1); j++) {  
250 - temp = temp / 2;  
251 - r.push(temp);  
252 - }  
253 - */  
254 var projectionExtent, size,resolutions,matrixIds,z; 246 var projectionExtent, size,resolutions,matrixIds,z;
255 if (i3GEO.Interface.openlayers.googleLike === true) { 247 if (i3GEO.Interface.openlayers.googleLike === true) {
256 projectionExtent = ol.proj.get('EPSG:3857').getExtent(); 248 projectionExtent = ol.proj.get('EPSG:3857').getExtent();
@@ -352,16 +344,8 @@ i3GEO.editorOL = @@ -352,16 +344,8 @@ i3GEO.editorOL =
352 if (i3GEO.editorOL.fundo != "") { 344 if (i3GEO.editorOL.fundo != "") {
353 for (i = nfundo - 1; i >= 0; i--) { 345 for (i = nfundo - 1; i >= 0; i--) {
354 if (fundo[i] != "") { 346 if (fundo[i] != "") {
355 - try {  
356 - i3GEO.editorOL[fundo[i]].transitionEffect = 'resize';  
357 - i3GEO.editorOL[fundo[i]].setVisibility(false);  
358 - i3GEO.editorOL[fundo[i]].singleTile = false;  
359 - alayers.push(i3GEO.editorOL[fundo[i]]);  
360 - } catch (e) {  
361 - if (alayers[0]) {  
362 - alayers[0].setVisibility(true);  
363 - }  
364 - } 347 + alayers.push(i3GEO.editorOL[fundo[i]]);
  348 + i3GEO.editorOL[fundo[i]].setVisibility(true);
365 } 349 }
366 } 350 }
367 } 351 }
@@ -518,7 +502,7 @@ i3GEO.editorOL = @@ -518,7 +502,7 @@ i3GEO.editorOL =
518 var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, i, ins, combo = 502 var layers = i3GEO.editorOL.layersLigados(), nlayers = layers.length, i, ins, combo =
519 "<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>"; 503 "<select id=i3GEOOLlistaTemasBusca ><option value=''>----</option>";
520 for (i = 0; i < nlayers; i++) { 504 for (i = 0; i < nlayers; i++) {
521 - combo += "<option value='" + i + "' >" + layers[i].name + "</option>"; 505 + combo += "<option value='" + i + "' >" + layers[i].getProperties().name + "</option>";
522 } 506 }
523 combo += "</select>"; 507 combo += "</select>";
524 ins = "<div class=paragrafo >" + $trad("a7") + ":<br>" + combo; 508 ins = "<div class=paragrafo >" + $trad("a7") + ":<br>" + combo;
mashups/openlayers3.php
@@ -118,26 +118,19 @@ if(isset($controles)){ @@ -118,26 +118,19 @@ if(isset($controles)){
118 $controles = strtolower($controles); 118 $controles = strtolower($controles);
119 $controles = explode(",",$controles); 119 $controles = explode(",",$controles);
120 if(in_array("navigation",$controles)){ 120 if(in_array("navigation",$controles)){
121 - $objControles[] = "new OpenLayers.Control.Navigation()"; 121 + $objControles[] = "new ol.control.Zoom()";
122 } 122 }
123 if(in_array("panzoombar",$controles)){ 123 if(in_array("panzoombar",$controles)){
124 - $objControles[] = "new OpenLayers.Control.PanZoomBar()";  
125 - }  
126 - if(in_array("layerswitcher",$controles)){  
127 - $objControles[] = "new OpenLayers.Control.LayerSwitcher({'ascending':false})"; 124 + $objControles[] = "new ol.control.ZoomSlider()";
128 } 125 }
129 if(in_array("scaleline",$controles)){ 126 if(in_array("scaleline",$controles)){
130 - $objControles[] = "new OpenLayers.Control.ScaleLine()"; 127 + $objControles[] = "new ol.control.ScaleLine()";
131 } 128 }
132 - if(in_array("mouseposition",$controles))  
133 - {  
134 - $objControles[] = "new OpenLayers.Control.MousePosition({'separator':' '})"; 129 + if(in_array("mouseposition",$controles)){
  130 + $objControles[] = "new ol.control.MousePosition({coordinateFormat : function(c){return ol.coordinate.toStringHDMS(c);}})";
135 } 131 }
136 if(in_array("overviewmap",$controles)){ 132 if(in_array("overviewmap",$controles)){
137 - $objControles[] = "new OpenLayers.Control.OverviewMap()";  
138 - }  
139 - if(in_array("keyboarddefaults",$controles)){  
140 - $objControles[] = "new OpenLayers.Control.KeyboardDefaults()"; 133 + $objControles[] = "new ol.control.OverviewMap()";
141 } 134 }
142 } 135 }
143 // 136 //
@@ -385,6 +378,8 @@ if($temas != &quot;&quot;){ @@ -385,6 +378,8 @@ if($temas != &quot;&quot;){
385 projection : "EPSG:4326", 378 projection : "EPSG:4326",
386 ferramentas :'.$ferramentas.', 379 ferramentas :'.$ferramentas.',
387 extent :'.$e.', 380 extent :'.$e.',
  381 + title: "'. $tituloLayer .'",
  382 + name: "'. $tema .'",
388 source: new ol.source.WMTS({ 383 source: new ol.source.WMTS({
389 url : "'.$servidor.'?'.$nocache.'tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&tms=", 384 url : "'.$servidor.'?'.$nocache.'tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&tms=",
390 tileGrid : new ol.tilegrid.WMTS({ 385 tileGrid : new ol.tilegrid.WMTS({
@@ -426,10 +421,19 @@ if($temas != &quot;&quot;){ @@ -426,10 +421,19 @@ if($temas != &quot;&quot;){
426 $teffect = 'transitionEffect: null,'; 421 $teffect = 'transitionEffect: null,';
427 } 422 }
428 if($tituloLayer != ""){ 423 if($tituloLayer != ""){
429 - $objOpenLayers[] = 'new OpenLayers.Layer.WMS( "'.$tituloLayer.'", "'.$servidor.'?'.$nocache.'tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&",{opacity:'.$opacidade.',layers:"'.$nomeLayer.'",transparent: "true", format: "image/png"},{'.$teffect.' singleTile:'.$singleTile.',visibility:'.$visivel.',isBaseLayer:'.$ebase.', ferramentas :'.$ferramentas.'})';  
430 - }  
431 - else{  
432 - $objOpenLayers[] = 'new OpenLayers.Layer.WMS( "'.$tituloLayer.'", "'.$servidor.'?'.$nocache.'tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&",{opacity:'.$opacidade.',layers:"'.$nomeLayer.'",transparent: "true", format: "image/png"},{'.$teffect.' displayInLayerSwitcher:false,singleTile:'.$singleTile.',visibility:'.$visivel.',isBaseLayer:'.$ebase.', ferramentas :'.$ferramentas.'})'; 424 + $url = $servidor.'?'.$nocache.'tema='.$tema.'&DESLIGACACHE='.$DESLIGACACHE.'&';
  425 + $objOpenLayers[] = 'new ol.layer.Image({
  426 + extent: ['. $mapext .'],
  427 + source: new ol.source.ImageWMS({
  428 + url: "'. $url .'",
  429 + params: {
  430 + opacity:'.$opacidade.',layers:"'.$nomeLayer.'",transparent: "true", format: "image/png"
  431 + },
  432 + serverType: "geoserver"
  433 + }),
  434 + title: "'. $tituloLayer .'",
  435 + name: "'. $tema .'"
  436 + })';
433 } 437 }
434 } 438 }
435 } 439 }
@@ -648,6 +652,16 @@ if(count($temasPluginI3Geo) &gt; 0){ @@ -648,6 +652,16 @@ if(count($temasPluginI3Geo) &gt; 0){
648 top: 2px; 652 top: 2px;
649 font-size: 13px; 653 font-size: 13px;
650 } 654 }
  655 +.ol-mouse-position {
  656 + margin: auto;
  657 + position: absolute;
  658 + right: 0;
  659 + top: 0;
  660 +}
  661 +.ol-overlaycontainer-stopevent .olControlEditingToolbar1 {
  662 + top: 15px;
  663 +}
  664 +
651 </style> 665 </style>
652 </head> 666 </head>
653 <body class=" yui-skin-sam"> 667 <body class=" yui-skin-sam">