Commit ac03c5c6faed3160d79fc3e38d42aede7c1e66dd
1 parent
66650e6b
Exists in
master
and in
7 other branches
Incluido o javascript keydragzoom.js no diretorio pacotes/google Esse script per…
…mite a implementação da operação de zoom por box na interface google maps
Showing
11 changed files
with
705 additions
and
31 deletions
Show diff stats
classesjs/classe_analise.js
@@ -442,7 +442,7 @@ i3GEO.analise = { | @@ -442,7 +442,7 @@ i3GEO.analise = { | ||
442 | */ | 442 | */ |
443 | inicia: function(){ | 443 | inicia: function(){ |
444 | if(typeof(console) !== 'undefined'){console.info("i3GEO.analise.medeArea.inicia()");} | 444 | if(typeof(console) !== 'undefined'){console.info("i3GEO.analise.medeArea.inicia()");} |
445 | - var temp; | 445 | + var temp,x,y,ll1,ll2,d; |
446 | pontosdistobj = []; | 446 | pontosdistobj = []; |
447 | i3GEO.analise.medeArea.criaJanela(); | 447 | i3GEO.analise.medeArea.criaJanela(); |
448 | if (g_tipoacao != "area"){ | 448 | if (g_tipoacao != "area"){ |
@@ -470,8 +470,18 @@ i3GEO.analise = { | @@ -470,8 +470,18 @@ i3GEO.analise = { | ||
470 | i3GEO.janela.abreAguarde("i3GEO.atualiza",$trad("o1")); | 470 | i3GEO.janela.abreAguarde("i3GEO.atualiza",$trad("o1")); |
471 | i3GEO.php.areaPixel(temp,i3GEO.parametros.pixelsize); | 471 | i3GEO.php.areaPixel(temp,i3GEO.parametros.pixelsize); |
472 | } | 472 | } |
473 | - else | ||
474 | - {alert("Operacao nao disponivel");} | 473 | + if(i3GEO.Interface.ATUAL == "googlemaps"){ |
474 | + x = parseInt(i3GEO.parametros.w / 2,10); | ||
475 | + y = parseInt(i3GEO.parametros.h / 2,10); | ||
476 | + ll1 = i3GEO.calculo.tela2dd(x,y,"",""); | ||
477 | + ll2 = i3GEO.calculo.tela2dd(x + 1,y,"",""); | ||
478 | + d = i3GEO.calculo.distancia(ll1[0],ll1[1],ll2[0],ll2[1]); | ||
479 | + d = d * 1000; | ||
480 | + d = d * d; | ||
481 | + temp({data:d}); | ||
482 | + } | ||
483 | + //else | ||
484 | + //{alert("Operacao nao disponivel");} | ||
475 | } | 485 | } |
476 | else{i3GEO.desenho.richdraw.fecha();} | 486 | else{i3GEO.desenho.richdraw.fecha();} |
477 | }, | 487 | }, |
classesjs/classe_calculo.js
@@ -213,17 +213,23 @@ i3GEO.calculo = { | @@ -213,17 +213,23 @@ i3GEO.calculo = { | ||
213 | try | 213 | try |
214 | { | 214 | { |
215 | var amext,longdd,latdd; | 215 | var amext,longdd,latdd; |
216 | - if (navm){ | ||
217 | - xfign = xfign - 2.2; | ||
218 | - yfign = yfign - 2.7; | 216 | + if(i3GEO.Interface.ATUAL == "googlemaps"){ |
217 | + amext = i3GeoMapOverlay.getProjection().fromContainerPixelToLatLng(new google.maps.Point(xfign,yfign)); | ||
218 | + return [amext.lng(),amext.lat()]; | ||
219 | } | 219 | } |
220 | else{ | 220 | else{ |
221 | - xfign = xfign - 0.12; | ||
222 | - yfign = yfign - 1.05; | 221 | + if (navm){ |
222 | + xfign = xfign - 2.2; | ||
223 | + yfign = yfign - 2.7; | ||
224 | + } | ||
225 | + else{ | ||
226 | + xfign = xfign - 0.12; | ||
227 | + yfign = yfign - 1.05; | ||
228 | + } | ||
229 | + amext = imgext.split(" "); | ||
230 | + longdd = (amext[0] * 1) + (g_celula * xfign); | ||
231 | + latdd = (amext[3] * 1) - (g_celula * yfign); | ||
223 | } | 232 | } |
224 | - amext = imgext.split(" "); | ||
225 | - longdd = (amext[0] * 1) + (g_celula * xfign); | ||
226 | - latdd = (amext[3] * 1) - (g_celula * yfign); | ||
227 | return [longdd,latdd]; | 233 | return [longdd,latdd]; |
228 | } | 234 | } |
229 | catch(e){return(0);} | 235 | catch(e){return(0);} |
classesjs/classe_configura.js
@@ -599,6 +599,8 @@ i3GEO.configura = { | @@ -599,6 +599,8 @@ i3GEO.configura = { | ||
599 | tipo:"dinamico", | 599 | tipo:"dinamico", |
600 | dica:$trad("d3"), | 600 | dica:$trad("d3"), |
601 | funcaoonclick:function(){ | 601 | funcaoonclick:function(){ |
602 | + if(i3GEO.Interface.ATUAL === "googlemaps") | ||
603 | + {alert("Pressione a tecla CTRL junto com o botão esquerdo do mouse");return;} | ||
602 | var temp; | 604 | var temp; |
603 | temp = "zoom"; | 605 | temp = "zoom"; |
604 | if(i3GEO.Interface.ATIVAMENUCONTEXTO) | 606 | if(i3GEO.Interface.ATIVAMENUCONTEXTO) |
@@ -632,6 +634,10 @@ i3GEO.configura = { | @@ -632,6 +634,10 @@ i3GEO.configura = { | ||
632 | g_operacao='navega'; | 634 | g_operacao='navega'; |
633 | i3GEO.barraDeBotoes.ativaIcone("pan"); | 635 | i3GEO.barraDeBotoes.ativaIcone("pan"); |
634 | i3GEO.barraDeBotoes.BOTAOPADRAO = "pan"; | 636 | i3GEO.barraDeBotoes.BOTAOPADRAO = "pan"; |
637 | + if(i3GEO.Interface.ATUAL === "googlemaps"){ | ||
638 | + i3GeoMap.setOptions({draggable:true}); | ||
639 | + return; | ||
640 | + } | ||
635 | if($i(i3GEO.Interface.IDMAPA)){ | 641 | if($i(i3GEO.Interface.IDMAPA)){ |
636 | $i(i3GEO.Interface.IDMAPA).title = ""; | 642 | $i(i3GEO.Interface.IDMAPA).title = ""; |
637 | temp = "pan"; | 643 | temp = "pan"; |
@@ -1003,9 +1009,9 @@ i3GEO.configura = { | @@ -1003,9 +1009,9 @@ i3GEO.configura = { | ||
1003 | dica:$trad("d21a"), | 1009 | dica:$trad("d21a"), |
1004 | funcaoonclick:function(){ | 1010 | funcaoonclick:function(){ |
1005 | i3GEO.barraDeBotoes.ativaIcone("area"); | 1011 | i3GEO.barraDeBotoes.ativaIcone("area"); |
1006 | - if($i("img")){ | ||
1007 | - $i("img").title = ""; | ||
1008 | - i3GEO.util.mudaCursor(i3GEO.configura.cursores,"area","img",i3GEO.configura.locaplic); | 1012 | + if($i(i3GEO.Interface.IDMAPA)){ |
1013 | + $i(i3GEO.Interface.IDMAPA).title = ""; | ||
1014 | + i3GEO.util.mudaCursor(i3GEO.configura.cursores,"area",i3GEO.Interface.IDMAPA,i3GEO.configura.locaplic); | ||
1009 | } | 1015 | } |
1010 | g_tipoacao = ""; | 1016 | g_tipoacao = ""; |
1011 | g_operacao=""; | 1017 | g_operacao=""; |
classesjs/classe_interface.js
@@ -1136,7 +1136,7 @@ i3GEO.Interface = { | @@ -1136,7 +1136,7 @@ i3GEO.Interface = { | ||
1136 | i3GEO.Interface.googlemaps.criaLayers(); | 1136 | i3GEO.Interface.googlemaps.criaLayers(); |
1137 | }, | 1137 | }, |
1138 | cria: function(w,h){ | 1138 | cria: function(w,h){ |
1139 | - var i,f,ins; | 1139 | + var i,f,ins,js; |
1140 | posfixo = "&"; | 1140 | posfixo = "&"; |
1141 | i = $i(i3GEO.Interface.IDCORPO); | 1141 | i = $i(i3GEO.Interface.IDCORPO); |
1142 | if(i){ | 1142 | if(i){ |
@@ -1153,7 +1153,12 @@ i3GEO.Interface = { | @@ -1153,7 +1153,12 @@ i3GEO.Interface = { | ||
1153 | i3GEO.Interface.IDMAPA = "googlemapsdiv"; | 1153 | i3GEO.Interface.IDMAPA = "googlemapsdiv"; |
1154 | i3GEO.barraDeBotoes.INCLUIBOTAO.zoomli = true; | 1154 | i3GEO.barraDeBotoes.INCLUIBOTAO.zoomli = true; |
1155 | i3GEO.barraDeBotoes.INCLUIBOTAO.pan = true; | 1155 | i3GEO.barraDeBotoes.INCLUIBOTAO.pan = true; |
1156 | - i3GEO.barraDeBotoes.INCLUIBOTAO.zoomtot = true; | 1156 | + i3GEO.barraDeBotoes.INCLUIBOTAO.zoomtot = true; |
1157 | + }, | ||
1158 | + ativaZoomBox: function(){ | ||
1159 | + i3GeoMap.enableKeyDragZoom({ | ||
1160 | + key: 'ctrl' | ||
1161 | + }); | ||
1157 | }, | 1162 | }, |
1158 | inicia: function(){ | 1163 | inicia: function(){ |
1159 | var pol,ret,pt1,pt2,bottomLeft,bottomRight,i3GEOTile; | 1164 | var pol,ret,pt1,pt2,bottomLeft,bottomRight,i3GEOTile; |
@@ -1162,6 +1167,12 @@ i3GEO.Interface = { | @@ -1162,6 +1167,12 @@ i3GEO.Interface = { | ||
1162 | function montaMapa(retorno){ | 1167 | function montaMapa(retorno){ |
1163 | var pos, sw,ne,z,myMapType; | 1168 | var pos, sw,ne,z,myMapType; |
1164 | i3GeoMap = new google.maps.Map($i(i3GEO.Interface.IDMAPA),{scaleControl:true}); | 1169 | i3GeoMap = new google.maps.Map($i(i3GEO.Interface.IDMAPA),{scaleControl:true}); |
1170 | + // | ||
1171 | + //carrega o javascript que permite fazer o zoom por box | ||
1172 | + // | ||
1173 | + js = i3GEO.configura.locaplic+"/pacotes/google/keydragzoom.js.php"; | ||
1174 | + i3GEO.util.scriptTag(js,"i3GEO.Interface.googlemaps.ativaZoomBox()","keydragzoom_script"); | ||
1175 | + | ||
1165 | i3GeoMap.setMapTypeId(i3GEO.Interface.googlemaps.TIPOMAPA); | 1176 | i3GeoMap.setMapTypeId(i3GEO.Interface.googlemaps.TIPOMAPA); |
1166 | sw = new google.maps.LatLng(ret[1],ret[0]); | 1177 | sw = new google.maps.LatLng(ret[1],ret[0]); |
1167 | ne = new google.maps.LatLng(ret[3],ret[2]); | 1178 | ne = new google.maps.LatLng(ret[3],ret[2]); |
classesjs/classe_navega.js
@@ -779,6 +779,11 @@ i3GEO.navega = { | @@ -779,6 +779,11 @@ i3GEO.navega = { | ||
779 | limpa.call(); | 779 | limpa.call(); |
780 | i3GEO.eventos.MOUSEMOVE.remove("i3GEO.navega.zoomBox.desloca()"); | 780 | i3GEO.eventos.MOUSEMOVE.remove("i3GEO.navega.zoomBox.desloca()"); |
781 | i3GEO.eventos.MOUSEUP.remove("i3GEO.navega.zoomBox.termina()"); | 781 | i3GEO.eventos.MOUSEUP.remove("i3GEO.navega.zoomBox.termina()"); |
782 | + if(i3GEO.Interface.ATUAL === "googlemaps"){ | ||
783 | + i3GEO.Interface.googlemaps.zoom2extent(v); | ||
784 | + return; | ||
785 | + } | ||
786 | + | ||
782 | f = "i3GEO.navega.timerNavega = null;i3GEO.navega.zoomExt('"+i3GEO.configura.locaplic+"','"+i3GEO.configura.sid+"','"+i3GEO.configura.tipoimagem+"','"+v+"')"; | 787 | f = "i3GEO.navega.timerNavega = null;i3GEO.navega.zoomExt('"+i3GEO.configura.locaplic+"','"+i3GEO.configura.sid+"','"+i3GEO.configura.tipoimagem+"','"+v+"')"; |
783 | if(i3GEO.navega.timerNavega !== undefined) | 788 | if(i3GEO.navega.timerNavega !== undefined) |
784 | {clearTimeout(i3GEO.navega.timerNavega);} | 789 | {clearTimeout(i3GEO.navega.timerNavega);} |
classesphp/mapa_controle.php
@@ -1942,11 +1942,14 @@ Identifica elementos no mapa. | @@ -1942,11 +1942,14 @@ Identifica elementos no mapa. | ||
1942 | if (!isset($tema)){$tema = "";} | 1942 | if (!isset($tema)){$tema = "";} |
1943 | if (!isset($resolucao)){$resolucao = 5;} | 1943 | if (!isset($resolucao)){$resolucao = 5;} |
1944 | include_once("classe_atributos.php"); | 1944 | include_once("classe_atributos.php"); |
1945 | - $m = new Atributos($map_file,$tema); | ||
1946 | if(!isset($ext)) | 1945 | if(!isset($ext)) |
1947 | {$ext = "";} | 1946 | {$ext = "";} |
1948 | if(isset($ext) && $ext != "" && $interface == "googlemaps") | 1947 | if(isset($ext) && $ext != "" && $interface == "googlemaps") |
1949 | - {$ext = projetaExt($map_file,$ext);} | 1948 | + { |
1949 | + $ext = projetaExt($map_file,$ext); | ||
1950 | + $xy = projetaExt($map_file,$xy,","); | ||
1951 | + } | ||
1952 | + $m = new Atributos($map_file,$tema,"",$ext); | ||
1950 | $retorno = $m->identifica2($opcao,$xy,$resolucao,$ext,$listaDeTemas); | 1953 | $retorno = $m->identifica2($opcao,$xy,$resolucao,$ext,$listaDeTemas); |
1951 | break; | 1954 | break; |
1952 | 1955 | ||
@@ -2704,26 +2707,39 @@ Parametros: | @@ -2704,26 +2707,39 @@ Parametros: | ||
2704 | 2707 | ||
2705 | $map_file {string} | 2708 | $map_file {string} |
2706 | 2709 | ||
2707 | -$ext {string} - extensão geográfica com valores separados por espaço | 2710 | +$ext {string} - extensão geográfica com valores separados por espaço ou um par de coordenadas x y |
2708 | 2711 | ||
2709 | Return: | 2712 | Return: |
2710 | 2713 | ||
2711 | {string} | 2714 | {string} |
2712 | */ | 2715 | */ |
2713 | -function projetaExt($map_file,$ext) | 2716 | +function projetaExt($map_file,$ext,$separador=" ") |
2714 | { | 2717 | { |
2718 | + $ext = str_replace($separador," ",$ext); | ||
2719 | + | ||
2715 | $extA = explode(" ",$ext); | 2720 | $extA = explode(" ",$ext); |
2716 | $mapa = ms_newMapObj($map_file); | 2721 | $mapa = ms_newMapObj($map_file); |
2722 | + $ponto = false; | ||
2717 | if($extA[0] < 180 && $extA[0] > -180) | 2723 | if($extA[0] < 180 && $extA[0] > -180) |
2718 | { | 2724 | { |
2725 | + if(count($extA) == 2) | ||
2726 | + { | ||
2727 | + $ponto = true; | ||
2728 | + $extA[] = $extA[0] + 1; | ||
2729 | + $extA[] = $extA[1] + 1; | ||
2730 | + } | ||
2719 | $rect = ms_newRectObj(); | 2731 | $rect = ms_newRectObj(); |
2720 | $rect->setextent($extA[0],$extA[1],$extA[2],$extA[3]); | 2732 | $rect->setextent($extA[0],$extA[1],$extA[2],$extA[3]); |
2721 | $prjMapa = $mapa->getProjection(); | 2733 | $prjMapa = $mapa->getProjection(); |
2722 | $projInObj = ms_newprojectionobj("proj=latlong"); | 2734 | $projInObj = ms_newprojectionobj("proj=latlong"); |
2723 | $projOutObj = ms_newprojectionobj($prjMapa); | 2735 | $projOutObj = ms_newprojectionobj($prjMapa); |
2724 | $rect->project($projInObj, $projOutObj); | 2736 | $rect->project($projInObj, $projOutObj); |
2725 | - $ext = $rect->minx." ".$rect->miny." ".$rect->maxx." ".$rect->maxy; | 2737 | + if($ponto == false) |
2738 | + {$ext = $rect->minx." ".$rect->miny." ".$rect->maxx." ".$rect->maxy;} | ||
2739 | + else | ||
2740 | + {$ext = $rect->minx." ".$rect->miny;} | ||
2726 | } | 2741 | } |
2742 | + $ext = str_replace(" ",$separador,$ext); | ||
2727 | return $ext; | 2743 | return $ext; |
2728 | } | 2744 | } |
2729 | /* | 2745 | /* |
classesphp/mapa_googlemaps.php
@@ -110,8 +110,8 @@ foreach ($layersNames as $layerName) | @@ -110,8 +110,8 @@ foreach ($layersNames as $layerName) | ||
110 | } | 110 | } |
111 | } | 111 | } |
112 | } | 112 | } |
113 | - if($l->getProjection() == MS_FALSE) | ||
114 | - {$l->setProjection("init=epsg:4291");} | 113 | + if($l->getProjection() == MS_FALSE || $l->getProjection() == "" ) |
114 | + {$l->setProjection("init=epsg:4291");} | ||
115 | } | 115 | } |
116 | if($layerName == $_GET["layer"]) | 116 | if($layerName == $_GET["layer"]) |
117 | { | 117 | { |
classesphp/mapa_inicia.php
@@ -137,7 +137,8 @@ function iniciaMapa() | @@ -137,7 +137,8 @@ function iniciaMapa() | ||
137 | } | 137 | } |
138 | } | 138 | } |
139 | } | 139 | } |
140 | - if($layer->getProjection() == MS_FALSE) | 140 | + //echo $l->getProjection();exit; |
141 | + if($layer->getProjection() == MS_FALSE || $layer->getProjection() == "" ) | ||
141 | {$layer->setProjection("init=epsg:4291");} | 142 | {$layer->setProjection("init=epsg:4291");} |
142 | } | 143 | } |
143 | $temp = $m->scalebar; | 144 | $temp = $m->scalebar; |
ferramentas/identifica/index.js.php
@@ -437,13 +437,6 @@ i3GEOF.identifica = { | @@ -437,13 +437,6 @@ i3GEOF.identifica = { | ||
437 | {opcao = "ligados";} | 437 | {opcao = "ligados";} |
438 | else | 438 | else |
439 | {opcao = "tema";} | 439 | {opcao = "tema";} |
440 | - /* | ||
441 | - if(i3GEO.Interface.ATUAL === "openlayers"){ | ||
442 | - if(opcao === "ligados") | ||
443 | - {opcao = "lista";} | ||
444 | - listaDeTemas = i3GEO.Interface.openlayers.LIGADOS.join(","); | ||
445 | - } | ||
446 | - */ | ||
447 | i3GEO.php.identifica2(i3GEOF.identifica.mostraDadosTema,i3GEOF.identifica.x,i3GEOF.identifica.y,resolucao,opcao,i3GEO.configura.locaplic,i3GEO.configura.sid,tema,i3GEO.parametros.mapexten,listaDeTemas); | 440 | i3GEO.php.identifica2(i3GEOF.identifica.mostraDadosTema,i3GEOF.identifica.x,i3GEOF.identifica.y,resolucao,opcao,i3GEO.configura.locaplic,i3GEO.configura.sid,tema,i3GEO.parametros.mapexten,listaDeTemas); |
448 | }, | 441 | }, |
449 | /* | 442 | /* |
@@ -0,0 +1,562 @@ | @@ -0,0 +1,562 @@ | ||
1 | +<?php error_reporting(0);if(extension_loaded('zlib')){ob_start('ob_gzhandler');} header("Content-type: text/javascript"); ?> | ||
2 | +/** | ||
3 | + * @name Key Drag Zoom for V3 | ||
4 | + * @version 1.0 | ||
5 | + * @author: Nianwei Liu [nianwei at gmail dot com] & Gary Little [gary at luxcentral dot com] | ||
6 | + * @fileoverview This library adds a drag zoom capability to a Google map. | ||
7 | + * When drag zoom is enabled, holding down a user-defined hot key <code>(shift | ctrl | alt)</code> | ||
8 | + * while dragging a box around an area of interest will zoom the map | ||
9 | + * to that area when the hot key is released. | ||
10 | + * Only one line of code is needed: <code>google.maps.Map.enableKeyDragZoom();</code> | ||
11 | + * <p> | ||
12 | + * Note that if the map's container has a border around it, the border widths must be specified | ||
13 | + * in pixel units (or as thin, medium, or thick). This is required because of an MSIE limitation. | ||
14 | + * <p>NL: 2009-05-28: initial port to core API V3. | ||
15 | + */ | ||
16 | +/*! | ||
17 | + * | ||
18 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
19 | + * you may not use this file except in compliance with the License. | ||
20 | + * You may obtain a copy of the License at | ||
21 | + * | ||
22 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
23 | + * | ||
24 | + * Unless required by applicable law or agreed to in writing, software | ||
25 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
26 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
27 | + * See the License for the specific language governing permissions and | ||
28 | + * limitations under the License. | ||
29 | + */ | ||
30 | +(function () { | ||
31 | + /*jslint browser:true */ | ||
32 | + /*global google */ | ||
33 | + /** | ||
34 | + * Converts 'thin', 'medium', and 'thick' to pixel widths | ||
35 | + * in an MSIE environment. Not called for other browsers | ||
36 | + * because getComputedStyle() returns pixel widths automatically. | ||
37 | + * @param {String} widthValue | ||
38 | + */ | ||
39 | + var toPixels = function (widthValue) { | ||
40 | + var px; | ||
41 | + switch (widthValue) { | ||
42 | + case 'thin': | ||
43 | + px = "2px"; | ||
44 | + break; | ||
45 | + case 'medium': | ||
46 | + px = "4px"; | ||
47 | + break; | ||
48 | + case 'thick': | ||
49 | + px = "6px"; | ||
50 | + break; | ||
51 | + default: | ||
52 | + px = widthValue; | ||
53 | + } | ||
54 | + return px; | ||
55 | + }; | ||
56 | + /** | ||
57 | + * Get the widths of the borders of an HTML element. | ||
58 | + * | ||
59 | + * @param {Object} h HTML element | ||
60 | + * @return {Object} widths object (top, bottom left, right) | ||
61 | + */ | ||
62 | + var getBorderWidths = function (h) { | ||
63 | + var computedStyle; | ||
64 | + var bw = {}; | ||
65 | + if (document.defaultView && document.defaultView.getComputedStyle) { | ||
66 | + computedStyle = h.ownerDocument.defaultView.getComputedStyle(h, ""); | ||
67 | + if (computedStyle) { | ||
68 | + // The computed styles are always in pixel units (good!) | ||
69 | + bw.top = parseInt(computedStyle.borderTopWidth, 10) || 0; | ||
70 | + bw.bottom = parseInt(computedStyle.borderBottomWidth, 10) || 0; | ||
71 | + bw.left = parseInt(computedStyle.borderLeftWidth, 10) || 0; | ||
72 | + bw.right = parseInt(computedStyle.borderRightWidth, 10) || 0; | ||
73 | + return bw; | ||
74 | + } | ||
75 | + } else if (document.documentElement.currentStyle) { // MSIE | ||
76 | + if (h.currentStyle) { | ||
77 | + // The current styles may not be in pixel units so try to convert (bad!) | ||
78 | + bw.top = parseInt(toPixels(h.currentStyle.borderTopWidth), 10) || 0; | ||
79 | + bw.bottom = parseInt(toPixels(h.currentStyle.borderBottomWidth), 10) || 0; | ||
80 | + bw.left = parseInt(toPixels(h.currentStyle.borderLeftWidth), 10) || 0; | ||
81 | + bw.right = parseInt(toPixels(h.currentStyle.borderRightWidth), 10) || 0; | ||
82 | + return bw; | ||
83 | + } | ||
84 | + } | ||
85 | + // Shouldn't get this far for any modern browser | ||
86 | + bw.top = parseInt(h.style["border-top-width"], 10) || 0; | ||
87 | + bw.bottom = parseInt(h.style["border-bottom-width"], 10) || 0; | ||
88 | + bw.left = parseInt(h.style["border-left-width"], 10) || 0; | ||
89 | + bw.right = parseInt(h.style["border-right-width"], 10) || 0; | ||
90 | + return bw; | ||
91 | + }; | ||
92 | + | ||
93 | + /** | ||
94 | + * Get the position of the mouse relative to the document. | ||
95 | + * @param {Object} e Mouse event | ||
96 | + * @return {Object} left & top position | ||
97 | + */ | ||
98 | + var getMousePosition = function (e) { | ||
99 | + var posX = 0, posY = 0; | ||
100 | + e = e || window.event; | ||
101 | + if (typeof e.pageX !== "undefined") { | ||
102 | + posX = e.pageX; | ||
103 | + posY = e.pageY; | ||
104 | + } else if (typeof e.clientX !== "undefined") { | ||
105 | + posX = e.clientX + | ||
106 | + (typeof document.documentElement.scrollLeft !== "undefined" ? document.documentElement.scrollLeft : document.body.scrollLeft); | ||
107 | + posY = e.clientY + | ||
108 | + (typeof document.documentElement.scrollTop !== "undefined" ? document.documentElement.scrollTop : document.body.scrollTop); | ||
109 | + } | ||
110 | + return { | ||
111 | + left: posX, | ||
112 | + top: posY | ||
113 | + }; | ||
114 | + }; | ||
115 | + | ||
116 | + /** | ||
117 | + * Get the position of an HTML element relative to the document. | ||
118 | + * @param {Object} h HTML element | ||
119 | + * @return {Object} left & top position | ||
120 | + */ | ||
121 | + var getElementPosition = function (h) { | ||
122 | + var posX = h.offsetLeft; | ||
123 | + var posY = h.offsetTop; | ||
124 | + var parent = h.offsetParent; | ||
125 | + // Add offsets for all ancestors in the hierarchy | ||
126 | + while (parent !== null) { | ||
127 | + // Adjust for scrolling elements which may affect the map position. | ||
128 | + // | ||
129 | + // See http://www.howtocreate.co.uk/tutorials/javascript/browserspecific | ||
130 | + // | ||
131 | + // "...make sure that every element [on a Web page] with an overflow | ||
132 | + // of anything other than visible also has a position style set to | ||
133 | + // something other than the default static..." | ||
134 | + if (parent !== document.body && parent !== document.documentElement) { | ||
135 | + posX -= parent.scrollLeft; | ||
136 | + posY -= parent.scrollTop; | ||
137 | + } | ||
138 | + posX += parent.offsetLeft; | ||
139 | + posY += parent.offsetTop; | ||
140 | + parent = parent.offsetParent; | ||
141 | + } | ||
142 | + return { | ||
143 | + left: posX, | ||
144 | + top: posY | ||
145 | + }; | ||
146 | + }; | ||
147 | + /** | ||
148 | + * Set the properties of an object to those from another object. | ||
149 | + * @param {Object} obj target object | ||
150 | + * @param {Object} vals source object | ||
151 | + */ | ||
152 | + var setVals = function (obj, vals) { | ||
153 | + if (obj && vals) { | ||
154 | + for (var x in vals) { | ||
155 | + if (vals.hasOwnProperty(x)) { | ||
156 | + obj[x] = vals[x]; | ||
157 | + } | ||
158 | + } | ||
159 | + } | ||
160 | + return obj; | ||
161 | + }; | ||
162 | + /** | ||
163 | + * Set the opacity. If op is not passed in, this function just performs an MSIE fix. | ||
164 | + * @param {Node} div | ||
165 | + * @param {Number} op (0-1) | ||
166 | + */ | ||
167 | + var setOpacity = function (div, op) { | ||
168 | + if (typeof op !== 'undefined') { | ||
169 | + div.style.opacity = op; | ||
170 | + } | ||
171 | + if (typeof div.style.opacity !== 'undefined') { | ||
172 | + div.style.filter = "alpha(opacity=" + (div.style.opacity * 100) + ")"; | ||
173 | + } | ||
174 | + }; | ||
175 | + | ||
176 | + /** | ||
177 | + * @name KeyDragZoomOptions | ||
178 | + * @class This class represents the optional parameter passed into <code>google.maps.Map.enableDragBoxZoom</code>. | ||
179 | + * @property {String} [key] the hot key to hold down to activate a drag zoom, <code>shift | ctrl | alt</code>. | ||
180 | + * The default is <code>shift</code>. | ||
181 | + * @property {Object} [boxStyle] the css style of the zoom box. | ||
182 | + * The default is <code>{border: 'thin solid #FF0000'}</code>. | ||
183 | + * Border widths must be specified in pixel units (or as thin, medium, or thick). | ||
184 | + * @property {Object} [paneStyle] the css style of the pane which overlays the map when a drag zoom is activated. | ||
185 | + * The default is <code>{backgroundColor: 'white', opacity: 0.0, cursor: 'crosshair'}</code>. | ||
186 | + */ | ||
187 | + /** | ||
188 | + * @name DragZoom | ||
189 | + * @class This class represents a drag zoom object for a map. The object is activated by holding down the hot key. | ||
190 | + * This object is created when <code>google.maps.Map.enableKeyDragZoom</code> is called; it cannot be created directly. | ||
191 | + * Use <code>google.maps.Map.getDragZoomObject</code> to gain access to this object in order to attach event listeners. | ||
192 | + * @param {google.maps.Map} map | ||
193 | + * @param {KeyDragZoomOptions} opt_zoomOpts | ||
194 | + */ | ||
195 | + function DragZoom(map, opt_zoomOpts) { | ||
196 | + var ov = new google.maps.OverlayView(); | ||
197 | + var me = this; | ||
198 | + ov.onAdd = function () { | ||
199 | + me.init_(map, opt_zoomOpts); | ||
200 | + }; | ||
201 | + ov.draw = function () { | ||
202 | + }; | ||
203 | + ov.onRemove = function () { | ||
204 | + }; | ||
205 | + ov.setMap(map); | ||
206 | + this.prjov_ = ov; | ||
207 | + } | ||
208 | + /** | ||
209 | + * Init the tool. | ||
210 | + * @param {google.maps.Map} map | ||
211 | + * @param {KeyDragZoomOptions} opt_zoomOpts | ||
212 | + */ | ||
213 | + DragZoom.prototype.init_ = function (map, opt_zoomOpts) { | ||
214 | + this.map_ = map; | ||
215 | + opt_zoomOpts = opt_zoomOpts || {}; | ||
216 | + this.key_ = opt_zoomOpts.key || 'shift'; | ||
217 | + this.key_ = this.key_.toLowerCase(); | ||
218 | + this.borderWidths_ = getBorderWidths(this.map_.getDiv());//Container()); | ||
219 | + this.paneDiv_ = document.createElement("div"); | ||
220 | + this.paneDiv_.onselectstart = function () { | ||
221 | + return false; | ||
222 | + }; | ||
223 | + // default style | ||
224 | + setVals(this.paneDiv_.style, { | ||
225 | + backgroundColor: 'white', | ||
226 | + opacity: 0.0, | ||
227 | + cursor: 'crosshair' | ||
228 | + }); | ||
229 | + // allow overwrite | ||
230 | + setVals(this.paneDiv_.style, opt_zoomOpts.paneStyle); | ||
231 | + // stuff that cannot be overwritten | ||
232 | + setVals(this.paneDiv_.style, { | ||
233 | + position: 'absolute', | ||
234 | + overflow: 'hidden', | ||
235 | + zIndex: 10001, | ||
236 | + display: 'none' | ||
237 | + }); | ||
238 | + if (this.key_ === 'shift') { // Workaround for Firefox Shift-Click problem | ||
239 | + this.paneDiv_.style.MozUserSelect = "none"; | ||
240 | + } | ||
241 | + setOpacity(this.paneDiv_); | ||
242 | + // An IE fix: if the background is transparent, it cannot capture mousedown events | ||
243 | + if (this.paneDiv_.style.backgroundColor === 'transparent') { | ||
244 | + this.paneDiv_.style.backgroundColor = 'white'; | ||
245 | + setOpacity(this.paneDiv_, 0); | ||
246 | + } | ||
247 | + this.map_.getDiv().appendChild(this.paneDiv_);//Container() | ||
248 | + this.boxDiv_ = document.createElement('div'); | ||
249 | + setVals(this.boxDiv_.style, { | ||
250 | + border: 'thin solid #FF0000' | ||
251 | + }); | ||
252 | + setVals(this.boxDiv_.style, opt_zoomOpts.boxStyle); | ||
253 | + setVals(this.boxDiv_.style, { | ||
254 | + position: 'absolute', | ||
255 | + display: 'none' | ||
256 | + }); | ||
257 | + setOpacity(this.boxDiv_); | ||
258 | + this.map_.getDiv().appendChild(this.boxDiv_); | ||
259 | + this.boxBorderWidths_ = getBorderWidths(this.boxDiv_); | ||
260 | + var me = this; | ||
261 | + this.keyDownListener_ = google.maps.event.addDomListener(document, 'keydown', function (e) { | ||
262 | + me.onKeyDown_(e); | ||
263 | + }); | ||
264 | + this.keyUpListener_ = google.maps.event.addDomListener(document, 'keyup', function (e) { | ||
265 | + me.onKeyUp_(e); | ||
266 | + }); | ||
267 | + this.mouseDownListener_ = google.maps.event.addDomListener(this.paneDiv_, 'mousedown', function (e) { | ||
268 | + me.onMouseDown_(e); | ||
269 | + }); | ||
270 | + this.mouseDownListenerDocument_ = google.maps.event.addDomListener(document, 'mousedown', function (e) { | ||
271 | + me.onMouseDownDocument_(e); | ||
272 | + }); | ||
273 | + this.mouseMoveListener_ = google.maps.event.addDomListener(document, 'mousemove', function (e) { | ||
274 | + me.onMouseMove_(e); | ||
275 | + }); | ||
276 | + this.mouseUpListener_ = google.maps.event.addDomListener(document, 'mouseup', function (e) { | ||
277 | + me.onMouseUp_(e); | ||
278 | + }); | ||
279 | + | ||
280 | + this.hotKeyDown_ = false; | ||
281 | + this.dragging_ = false; | ||
282 | + this.startPt_ = null; | ||
283 | + this.endPt_ = null; | ||
284 | + this.boxMaxX_ = null; | ||
285 | + this.boxMaxY_ = null; | ||
286 | + this.mousePosn_ = null; | ||
287 | + this.mapPosn_ = getElementPosition(this.map_.getDiv()); | ||
288 | + this.mouseDown_ = false; | ||
289 | + }; | ||
290 | + | ||
291 | + /** | ||
292 | + * Returns true if the hot key is being pressed when an event occurs. | ||
293 | + * @param {Event} e | ||
294 | + * @return {Boolean} | ||
295 | + */ | ||
296 | + DragZoom.prototype.isHotKeyDown_ = function (e) { | ||
297 | + var isHot; | ||
298 | + e = e || window.event; | ||
299 | + isHot = (e.shiftKey && this.key_ === 'shift') || (e.altKey && this.key_ === 'alt') || (e.ctrlKey && this.key_ === 'ctrl'); | ||
300 | + if (!isHot) { | ||
301 | + // Need to look at keyCode for Opera because it | ||
302 | + // doesn't set the shiftKey, altKey, ctrlKey properties | ||
303 | + // unless a non-modifier event is being reported. | ||
304 | + // | ||
305 | + // See http://cross-browser.com/x/examples/shift_mode.php | ||
306 | + // Also see http://unixpapa.com/js/key.html | ||
307 | + switch (e.keyCode) { | ||
308 | + case 16: | ||
309 | + if (this.key_ === 'shift') { | ||
310 | + isHot = true; | ||
311 | + } | ||
312 | + break; | ||
313 | + case 17: | ||
314 | + if (this.key_ === 'ctrl') { | ||
315 | + isHot = true; | ||
316 | + } | ||
317 | + break; | ||
318 | + case 18: | ||
319 | + if (this.key_ === 'alt') { | ||
320 | + isHot = true; | ||
321 | + } | ||
322 | + break; | ||
323 | + } | ||
324 | + } | ||
325 | + return isHot; | ||
326 | + }; | ||
327 | + | ||
328 | + /** | ||
329 | + * Checks if the mouse is on top of the map. The position is captured | ||
330 | + * in onMouseMove_. | ||
331 | + * @return true if mouse is on top of the map div. | ||
332 | + */ | ||
333 | + DragZoom.prototype.isMouseOnMap_ = function () { | ||
334 | + var mousePos = this.mousePosn_; | ||
335 | + if (mousePos) { | ||
336 | + var mapPos = this.mapPosn_; | ||
337 | + var mapDiv = this.map_.getDiv(); | ||
338 | + return mousePos.left > mapPos.left && mousePos.left < mapPos.left + mapDiv.offsetWidth && | ||
339 | + mousePos.top > mapPos.top && mousePos.top < mapPos.top + mapDiv.offsetHeight; | ||
340 | + } else { | ||
341 | + // if user never moved mouse | ||
342 | + return false; | ||
343 | + } | ||
344 | + }; | ||
345 | + | ||
346 | + /** | ||
347 | + * Show or hide the overlay pane, depending on whether the mouse is over the map. | ||
348 | + */ | ||
349 | + DragZoom.prototype.setPaneVisibility_ = function () { | ||
350 | + if (this.map_ && this.hotKeyDown_ && this.isMouseOnMap_()) { | ||
351 | + var mapDiv = this.map_.getDiv(); | ||
352 | + this.paneDiv_.style.left = 0 + 'px'; | ||
353 | + this.paneDiv_.style.top = 0 + 'px'; | ||
354 | + this.paneDiv_.style.width = mapDiv.offsetWidth - (this.borderWidths_.left + this.borderWidths_.right) + 'px'; | ||
355 | + this.paneDiv_.style.height = mapDiv.offsetHeight - (this.borderWidths_.top + this.borderWidths_.bottom) + 'px'; | ||
356 | + this.paneDiv_.style.display = 'block'; | ||
357 | + this.boxMaxX_ = parseInt(this.paneDiv_.style.width, 10) - (this.boxBorderWidths_.left + this.boxBorderWidths_.right); | ||
358 | + this.boxMaxY_ = parseInt(this.paneDiv_.style.height, 10) - (this.boxBorderWidths_.top + this.boxBorderWidths_.bottom); | ||
359 | + } else { | ||
360 | + this.paneDiv_.style.display = 'none'; | ||
361 | + } | ||
362 | + }; | ||
363 | + /** | ||
364 | + * Handle key down. Activate the tool only if the mouse is on top of the map. | ||
365 | + * @param {Event} e | ||
366 | + */ | ||
367 | + DragZoom.prototype.onKeyDown_ = function (e) { | ||
368 | + var me = this; | ||
369 | + if (this.map_ && !this.hotKeyDown_ && this.isHotKeyDown_(e)) { | ||
370 | + me.hotKeyDown_ = true; | ||
371 | + me.setPaneVisibility_(); | ||
372 | + /** | ||
373 | + * This event is fired when the hot key is pressed. | ||
374 | + * @name DragZoom#activate | ||
375 | + * @event | ||
376 | + */ | ||
377 | + google.maps.event.trigger(me, 'activate'); | ||
378 | + } | ||
379 | + }; | ||
380 | + /** | ||
381 | + * Get the <code>google.maps.Point</code> of the mouse position. | ||
382 | + * @param {Object} e | ||
383 | + * @return {google.maps.Point} point | ||
384 | + * @private | ||
385 | + */ | ||
386 | + DragZoom.prototype.getMousePoint_ = function (e) { | ||
387 | + var mousePosn = getMousePosition(e); | ||
388 | + var p = new google.maps.Point(); | ||
389 | + p.x = mousePosn.left - this.mapPosn_.left - this.borderWidths_.left; | ||
390 | + p.y = mousePosn.top - this.mapPosn_.top - this.borderWidths_.top; | ||
391 | + p.x = Math.min(p.x, this.boxMaxX_); | ||
392 | + p.y = Math.min(p.y, this.boxMaxY_); | ||
393 | + p.x = Math.max(p.x, 0); | ||
394 | + p.y = Math.max(p.y, 0); | ||
395 | + return p; | ||
396 | + }; | ||
397 | + /** | ||
398 | + * Handle mouse down. | ||
399 | + * @param {Event} e | ||
400 | + */ | ||
401 | + DragZoom.prototype.onMouseDown_ = function (e) { | ||
402 | + if (this.map_ && this.hotKeyDown_) { | ||
403 | + this.mapPosn_ = getElementPosition(this.map_.getDiv()); | ||
404 | + this.dragging_ = true; | ||
405 | + this.startPt_ = this.endPt_ = this.getMousePoint_(e); | ||
406 | + var prj = this.prjov_.getProjection(); | ||
407 | + var latlng = prj.fromDivPixelToLatLng(this.startPt_); | ||
408 | + /** | ||
409 | + * This event is fired when the drag operation begins. | ||
410 | + * @name DragZoom#dragstart | ||
411 | + * @param {GLatLng} startLatLng | ||
412 | + * @event | ||
413 | + */ | ||
414 | + google.maps.event.trigger(this, 'dragstart', latlng); | ||
415 | + } | ||
416 | + }; | ||
417 | + /** | ||
418 | + * Handle mouse down at the document level. | ||
419 | + * @param {Event} e | ||
420 | + */ | ||
421 | + DragZoom.prototype.onMouseDownDocument_ = function (e) { | ||
422 | + this.mouseDown_ = true; | ||
423 | + }; | ||
424 | + /** | ||
425 | + * Handle mouse move. | ||
426 | + * @param {Event} e | ||
427 | + */ | ||
428 | + DragZoom.prototype.onMouseMove_ = function (e) { | ||
429 | + this.mousePosn_ = getMousePosition(e); | ||
430 | + if (this.dragging_) { | ||
431 | + this.endPt_ = this.getMousePoint_(e); | ||
432 | + var left = Math.min(this.startPt_.x, this.endPt_.x); | ||
433 | + var top = Math.min(this.startPt_.y, this.endPt_.y); | ||
434 | + var width = Math.abs(this.startPt_.x - this.endPt_.x); | ||
435 | + var height = Math.abs(this.startPt_.y - this.endPt_.y); | ||
436 | + this.boxDiv_.style.left = left + 'px'; | ||
437 | + this.boxDiv_.style.top = top + 'px'; | ||
438 | + this.boxDiv_.style.width = width + 'px'; | ||
439 | + this.boxDiv_.style.height = height + 'px'; | ||
440 | + this.boxDiv_.style.display = 'block'; | ||
441 | + /** | ||
442 | + * This event is repeatedly fired while the user drags the box. The southwest and northeast | ||
443 | + * point are passed as parameters of type <code>google.maps.Point</code> (for performance reasons), | ||
444 | + * relative to the map container. Note: the event listener is responsible | ||
445 | + * for converting Pixel to LatLng, if necessary. | ||
446 | + * @name DragZoom#drag | ||
447 | + * @param {google.maps.Point} southwestPixel | ||
448 | + * @param {google.maps.Point} northeastPixel | ||
449 | + * @event | ||
450 | + */ | ||
451 | + google.maps.event.trigger(this, 'drag', new google.maps.Point(left, top + height), new google.maps.Point(left + width, top)); | ||
452 | + } else if (!this.mouseDown_) { | ||
453 | + this.setPaneVisibility_(); | ||
454 | + } | ||
455 | + }; | ||
456 | + /** | ||
457 | + * Handle mouse up. | ||
458 | + * @param {Event} e | ||
459 | + */ | ||
460 | + DragZoom.prototype.onMouseUp_ = function (e) { | ||
461 | + this.mouseDown_ = false; | ||
462 | + if (this.dragging_) { | ||
463 | + var left = Math.min(this.startPt_.x, this.endPt_.x); | ||
464 | + var top = Math.min(this.startPt_.y, this.endPt_.y); | ||
465 | + var width = Math.abs(this.startPt_.x - this.endPt_.x); | ||
466 | + var height = Math.abs(this.startPt_.y - this.endPt_.y); | ||
467 | + var prj = this.prjov_.getProjection(); | ||
468 | + // 2009-05-29: since V3 does not have fromContainerPixel, | ||
469 | + //needs find offset here | ||
470 | + var containerPos = getElementPosition(this.map_.getDiv()); | ||
471 | + var mapPanePos = getElementPosition(this.prjov_.getPanes().mapPane); | ||
472 | + left = left + (containerPos.left - mapPanePos.left); | ||
473 | + top = top + (containerPos.top - mapPanePos.top); | ||
474 | + var sw = prj.fromDivPixelToLatLng(new google.maps.Point(left, top + height)); | ||
475 | + var ne = prj.fromDivPixelToLatLng(new google.maps.Point(left + width, top)); | ||
476 | + var bnds = new google.maps.LatLngBounds(sw, ne); | ||
477 | + this.map_.fitBounds(bnds); | ||
478 | + this.dragging_ = false; | ||
479 | + this.boxDiv_.style.display = 'none'; | ||
480 | + /** | ||
481 | + * This event is fired when the drag operation ends. | ||
482 | + * Note that the event is not fired if the hot key is released before the drag operation ends. | ||
483 | + * @name DragZoom#dragend | ||
484 | + * @param {GLatLngBounds} newBounds | ||
485 | + * @event | ||
486 | + */ | ||
487 | + google.maps.event.trigger(this, 'dragend', bnds); | ||
488 | + } | ||
489 | + }; | ||
490 | + | ||
491 | + /** | ||
492 | + * Handle key up. | ||
493 | + * @param {Event} e | ||
494 | + */ | ||
495 | + DragZoom.prototype.onKeyUp_ = function (e) { | ||
496 | + if (this.map_ && this.hotKeyDown_) { | ||
497 | + this.hotKeyDown_ = false; | ||
498 | + this.dragging_ = false; | ||
499 | + this.boxDiv_.style.display = 'none'; | ||
500 | + this.paneDiv_.style.display = "none"; | ||
501 | + /** | ||
502 | + * This event is fired while the user release the key | ||
503 | + * @name DragZoom#deactivate | ||
504 | + * @event | ||
505 | + */ | ||
506 | + google.maps.event.trigger(this, 'deactivate'); | ||
507 | + } | ||
508 | + }; | ||
509 | + | ||
510 | + | ||
511 | + | ||
512 | + | ||
513 | + /** | ||
514 | + * @name google.maps.Map | ||
515 | + * @class These are new methods added to the Google Maps API's | ||
516 | + * <a href = 'http://code.google.com/apis/maps/documentation/v3/reference.html#Map'>Map</a> | ||
517 | + * class. | ||
518 | + */ | ||
519 | + /** | ||
520 | + * Enable drag zoom. The user can zoom to an area of interest by holding down the hot key | ||
521 | + * <code>(shift | ctrl | alt )</code> while dragging a box around the area. | ||
522 | + * @param {KeyDragZoomOptions} opt_zoomOpts | ||
523 | + */ | ||
524 | + | ||
525 | + google.maps.Map.prototype.enableKeyDragZoom = function (opt_zoomOpts) { | ||
526 | + this.dragZoom_ = new DragZoom(this, opt_zoomOpts); | ||
527 | + }; | ||
528 | + /** | ||
529 | + * Disable drag zoom. | ||
530 | + */ | ||
531 | + google.maps.Map.prototype.disableKeyDragZoom = function () { | ||
532 | + var d = this.dragZoom_; | ||
533 | + if (d) { | ||
534 | + google.maps.event.removeListener(d.mouseDownListener_); | ||
535 | + google.maps.event.removeListener(d.mouseDownListenerDocument_); | ||
536 | + google.maps.event.removeListener(d.mouseMoveListener_); | ||
537 | + google.maps.event.removeListener(d.mouseUpListener_); | ||
538 | + google.maps.event.removeListener(d.keyUpListener_); | ||
539 | + google.maps.event.removeListener(d.keyDownListener_); | ||
540 | + this.getDiv().removeChild(d.boxDiv_); | ||
541 | + this.getDiv().removeChild(d.paneDiv_); | ||
542 | + this.dragZoom_ = null; | ||
543 | + } | ||
544 | + }; | ||
545 | + /** | ||
546 | + * Returns true if the drag zoom feature has been enabled. | ||
547 | + * @return {Boolean} | ||
548 | + */ | ||
549 | + google.maps.Map.prototype.keyDragZoomEnabled = function () { | ||
550 | + return this.dragZoom_ !== null; | ||
551 | + }; | ||
552 | + /** | ||
553 | + * Returns the DragZoom object which is created when <code>google.maps.Map.enableKeyDragZoom</code> is called. | ||
554 | + * With this object you can use <code>google.maps.event.addListener</code> to attach event listeners | ||
555 | + * for the 'activate', 'deactivate', 'dragstart', 'drag', and 'dragend' events. | ||
556 | + * @return {DragZoom} | ||
557 | + */ | ||
558 | + google.maps.Map.prototype.getDragZoomObject = function () { | ||
559 | + return this.dragZoom_; | ||
560 | + }; | ||
561 | +})(); | ||
562 | +<?php error_reporting(0);if(extension_loaded('zlib')){ob_end_flush();}?> | ||
0 | \ No newline at end of file | 563 | \ No newline at end of file |
@@ -0,0 +1,64 @@ | @@ -0,0 +1,64 @@ | ||
1 | +MAP | ||
2 | + FONTSET "../symbols/fontes.txt" | ||
3 | + SYMBOLSET "../symbols/simbolos.sym" | ||
4 | + | ||
5 | + LAYER | ||
6 | + CONNECTION "user=postgres password=postgres dbname=pgutf8 host=localhost port=5432 options='-c client_encoding=LATIN1'" | ||
7 | + CONNECTIONTYPE POSTGIS | ||
8 | + DATA "the_geom FROM (select the_geom, sig_uf, totacidentes, gid FROM geo_br_estados as estados,(select comple,count(comple) as totacidentes FROM acidentes.acidente as a, acidentes.regiao as r WHERE r.tipo = 1 AND r.regiao = a.regiao group by comple )as contagem WHERE estados.sig_uf = contagem.comple) as foo USING UNIQUE gid USING SRID=4291" | ||
9 | + METADATA | ||
10 | + "CLASSE" "SIM" | ||
11 | + "download" "SIM" | ||
12 | + "permitekml" "sim" | ||
13 | + "permiteogc" "sim" | ||
14 | + "TEMA" "Total de acidentes por UF" | ||
15 | + END | ||
16 | + NAME "p2r2uf1" | ||
17 | + STATUS OFF | ||
18 | + TEMPLATE "none.htm" | ||
19 | + TYPE POLYGON | ||
20 | + UNITS METERS | ||
21 | + CLASS | ||
22 | + NAME "Quartil 1 (<=3)" | ||
23 | + EXPRESSION ([totacidentes]<=3) | ||
24 | + STYLE | ||
25 | + ANGLE 360 | ||
26 | + COLOR 255 240 240 | ||
27 | + OPACITY 100 | ||
28 | + SYMBOL 0 | ||
29 | + END | ||
30 | + END | ||
31 | + CLASS | ||
32 | + NAME "Quartil 2 (>3 e <=20)" | ||
33 | + EXPRESSION (([totacidentes]>3)and([totacidentes]<=20)) | ||
34 | + STYLE | ||
35 | + ANGLE 360 | ||
36 | + COLOR 255 230 230 | ||
37 | + OPACITY 100 | ||
38 | + SYMBOL 0 | ||
39 | + END | ||
40 | + END | ||
41 | + CLASS | ||
42 | + NAME "Quartil 3 (>20 e <=89)" | ||
43 | + EXPRESSION (([totacidentes]>20)and([totacidentes]<=89)) | ||
44 | + STYLE | ||
45 | + ANGLE 360 | ||
46 | + COLOR 255 150 150 | ||
47 | + OPACITY 100 | ||
48 | + SYMBOL 0 | ||
49 | + END | ||
50 | + END | ||
51 | + CLASS | ||
52 | + NAME "Quartil 4 (>89)" | ||
53 | + EXPRESSION ([totacidentes]>89) | ||
54 | + STYLE | ||
55 | + ANGLE 360 | ||
56 | + COLOR 255 0 0 | ||
57 | + OPACITY 100 | ||
58 | + SYMBOL 0 | ||
59 | + END | ||
60 | + END | ||
61 | + | ||
62 | + END | ||
63 | +END | ||
64 | + |