1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
191.
192.
193.
194.
195.
196.
197.
198.
199.
200.
201.
202.
203.
204.
205.
206.
207.
208.
209.
210.
211.
212.
213.
214.
| 1. / 2. / ...
var gdir;
function cs_googlemaps_createusersmapmarker(point,tabs,image,id,nick,url) {
var icon = new GIcon();
icon.image = image[0];
icon.iconSize = new GSize(image[1], image[2]);
subt = image[2] / 100 * 11;
subt = Math.ceil(subt);
var anchor = image[2] - subt;
icon.iconAnchor= new GPoint(10, anchor);
var infoanchor = image[2] / 3;
icon.infoWindowAnchor = new GPoint(infoanchor, 2);
side_bar_html += '<img src=' + url + '> <a href=\"javascript:cs_googlemaps_click(' + id + ')\">' + nick + '</a><br>';
var marker = new GMarker(point, icon);
return marker;
}
function cs_googlemaps_createtabmarker(point, tabs, image, id){
var icon = new GIcon();
icon.image = image[0];
icon.iconSize = new GSize(image[1], image[2]);
subt = image[2] / 100 * 11;
subt = Math.ceil(subt);
var anchor = image[2] - subt;
icon.iconAnchor= new GPoint(10, anchor);
var infoanchor = image[2] / 3;
icon.infoWindowAnchor = new GPoint(infoanchor, 2);
var marker = new GMarker(point, icon);
return marker;
}
function cs_googlemaps_gdir() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("cs_googlemaps"));
gdir = new GDirections(map, document.getElementById("directions"));
GEvent.addListener(gdir, "load", cs_googlemaps_OnGDirectionsLoad);
GEvent.addListener(gdir, "error", cs_googlemaps_handleerrors);
cs_googlemaps_setdirections("Mannheim", "Berlin", "de");
}
}
function cs_googlemaps_geo(lat, lng, zoom) {
if (GBrowserIsCompatible())
{
map = new GMap2(document.getElementById("cs_googlemaps"), {mapTypes:[G_SATELLITE_MAP, G_HYBRID_MAP, G_NORMAL_MAP]});
map.setCenter(new GLatLng(lat, lng), zoom);
GEvent.addListener(map, "click", function(overlay, point)
{
map.clearOverlays();
if (point) {
map.addOverlay(new GMarker(point));
map.panTo(point);
document.getElementById("lat").value = point.lat();
document.getElementById("lng").value = point.lng();
}
}
);
}
else
{
alert("Browser Error - Googlemap API Key !");
}
}
function cs_googlemaps_setdirections(fromAddress, toAddress, locale) {
gdir.load("from: " + fromAddress + " to: " + toAddress,
{ "locale": locale });
}
function cs_googlemaps_OnGDirectionsLoad(){
}
function cs_googlemaps_geocodeaddress(address,tabs,marker,zoom,id) {
geocoder.getLatLng(
address,
function(point) {
if (point) {
var lat = point.lat();
var lng = point.lng();
marker = cs_googlemaps_createtabmarker(point,tabs,marker,id);
map.addOverlay(marker);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowTabsHtml(tabs);
});
}
}
);
}
function cs_googlemaps_geocodeaddressusersmap(address,tabs,marker,zoom,id,nick,url) {
geocoder.getLatLng(
address,
function(point) {
if (point) {
var lat = point.lat();
var lng = point.lng();
marker = cs_googlemaps_createusersmapmarker(point,tabs,marker,id,nick,url);
map.addOverlay(marker);
document.getElementById("cs_googleusersmap").innerHTML = side_bar_html;
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowTabsHtml(tabs);
});
gmarkers[id] = marker;
}
}
);
}
function cs_googlemaps_geocodeaddress_user(address,tabs,marker,zoom,id) {
geocoder.getLatLng(
address,
function(point) {
if (point) {
var lat = point.lat();
var lng = point.lng();
marker = cs_googlemaps_createtabmarker(point,tabs,marker,id);
map.addOverlay(marker);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowTabsHtml(tabs);
});
}
}
);
}
function createTabMarker(point, tabs,image)
{
var icon = new GIcon();
icon.image = image[0];
icon.iconSize = new GSize(image[1], image[2]);
subt = image[2] / 100 * 11;
subt = Math.ceil(subt);
var anchor = image[2] - subt;
icon.iconAnchor= new GPoint(10, anchor);
var infoanchor = image[2] / 3;
icon.infoWindowAnchor = new GPoint(infoanchor, 2);
var marker = new GMarker(point,icon);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowTabsHtml(tabs);
});
return marker;
}
function createTabMarkerex(point,tabs,image,id,nick,url)
{
var icon = new GIcon();
icon.image = image[0];
icon.iconSize = new GSize(image[1], image[2]);
subt = image[2] / 100 * 11;
subt = Math.ceil(subt);
var anchor = image[2] - subt;
icon.iconAnchor= new GPoint(10, anchor);
var infoanchor = image[2] / 3;
icon.infoWindowAnchor = new GPoint(infoanchor, 2);
side_bar_html += '<img src=' + url + '> <a href="javascript:cs_googlemaps_click(' + id + ')">' + nick + '</a><br>';
var marker = new GMarker(point,icon);
gmarkers[id] = marker;
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowTabsHtml(tabs);
});
return marker;
}
function cs_googlemaps_tilechk(){
paragraphs = map.getContainer().getElementsByTagName('p').length;
if(paragraphs>4)
{
map.zoomOut(false,true);
}
}
function cs_googlemaps_wheelevent(e){
if (!e) e = window.event;
if (e.preventDefault) e.preventDefault();
e.returnValue = false;
}
function cs_googlemaps_click(i) {
GEvent.trigger(gmarkers[i], "click");
}
var arrowIcon = new GIcon();
arrowIcon.iconSize = new GSize(24,24);
arrowIcon.shadowSize = new GSize(1,1);
arrowIcon.iconAnchor = new GPoint(12,12);
arrowIcon.infoWindowAnchor = new GPoint(0,0);
var degreesPerRadian = 180.0 / Math.PI;
function bearing( from, to ) {
var lat1 = from.latRadians();
var lon1 = from.lngRadians();
var lat2 = to.latRadians();
var lon2 = to.lngRadians();
var angle = - Math.atan2( Math.sin( lon1 - lon2 ) * Math.cos( lat2 ), Math.cos( lat1 ) * Math.sin( lat2 ) - Math.sin( lat1 ) * Math.cos( lat2 ) * Math.cos( lon1 - lon2 ) );
if ( angle < 0.0 )
angle += Math.PI * 2.0;
angle = angle * degreesPerRadian;
angle = angle.toFixed(1);
return angle;
}
function arrowHead(points) {
var p1=points[points.length-1];
var p2=points[points.length-2];
var dir = bearing(p2,p1);
var dir = Math.round(dir/3) * 3;
while (dir >= 120) {dir -= 120;}
arrowIcon.image = "symbols/googlemaps/arrow/dir_"+dir+".png";
map.addOverlay(new GMarker(p1, arrowIcon));
}
function midArrows(points) {
for (var i=1; i < points.length-1; i++) {
var p1=points[i-1];
var p2=points[i+1];
var dir = bearing(p1,p2);
var dir = Math.round(dir/3) * 3;
while (dir >= 120) {dir -= 120;}
arrowIcon.image = "symbols/googlemaps/arrow/dir_"+dir+".png";
map.addOverlay(new GMarker(points[i], arrowIcon));
}
}
window.onunload = GUnload; |