PageSourceSearch

https://www.controlroll.com/assets/js/mapaGoogle.js?231020251512

js controlroll.com collected 2026-09-24 13:38:42 UTC 10,471 bytes, 354 lines download raw bytes

1
2function callMap(lat,lon) {
3
4    var wait = setTimeout(function () { InitializeMapFaceID(lat, lon); }, 2000);
5    
6}
7
8var map_faceid;
9function InitializeMapFaceID(lat, lon) {
10
11    //alert('prueba');
12    if (map_faceid == null) {
13        var latlng = new google.maps.LatLng(lat, lon);
14        var myOptions =
15        {
16            zoom: 13,
17            center: latlng,
18            mapTypeId: google.maps.MapTypeId.ROADMAP
19        };
20        var dd = document.getElementById("map_faceid");
21        map_faceid = new google.maps.Map(document.getElementById("map_faceid"), myOptions);
22
23        //var marker = new google.maps.Marker({
24        //    position: latlng
25        //});
26        //marker.setMap(map_faceid);
27    }
28    add_marks_map_faceid(lat, lon);
29}
30var markers_fid = [];
31function add_marks_map_faceid(lat, lon) {
32
33    for (var i = 0; i < markers_fid.length; i++) {
34        markers_fid[i].setMap(null);
35    }
36
37    var myLatlng = new google.maps.LatLng(lat, lon);
38
39    var marker = new google.maps.Marker({
40        position: myLatlng
41    });
42
43    markers_fid.push(marker);
44    map_faceid.setCenter(new google.maps.LatLng(lat, lon));
45    map_faceid.setMapTypeId(google.maps.MapTypeId.ROADMAP);
46    marker.setMap(map_faceid);
47    
48    $('#map_faceid').show();
49    $('#lbl_lat').text(lat);
50    $('#lbl_lon').text(lon);
51    $('#map_faceid_text').show();
52
53}
54
55
56
57var map_ronda;
58function initmap_det_ronda(dat_puntos, dat_line) {
59
60    var latlng = new google.maps.LatLng(dat_puntos[0][1], dat_puntos[0][2]);
61
62
63    var g = google.maps;
64    var opts_map = {
65        center: latlng,
66        zoom: 19,
67        draggableCursor: 'auto',
68        mapTypeId: g.MapTypeId.ROADMAP,
69        mapTypeControlOptions: {
70            mapTypeIds: [g.MapTypeId.ROADMAP, g.MapTypeId.TERRAIN, g.MapTypeId.SATELLITE]
71        },
72        zoomControlOptions: {
73            style: g.ZoomControlStyle.SMALL
74        }
75    };
76
77    map_ronda = new g.Map(document.getElementById("cont_map_puntos"), opts_map);
78
79    var infowindow = new google.maps.InfoWindow();
80
81    var marker, i, z;
82
83    for (i = 0; i < dat_puntos.length; i++) {
84
85        marker = new MarkerWithLabel({
86            position: new google.maps.LatLng(dat_puntos[i][1], dat_puntos[i][2]),
87            map: map_ronda,
88            //draggable: true,
89            raiseOnDrag: true,
90            labelContent: dat_puntos[i][5],
91            labelAnchor: new google.maps.Point((dat_puntos[i][4].lastIndexOf("icon_fin") > 0 ? 0 : 15), (dat_puntos[i][4].lastIndexOf("icon_fin") > 0 ? 10 : 65)),
92            labelClass: (dat_puntos[i][4].lastIndexOf("icon_fin") > 0 ? "labels_icon_map_finish" : "labels_icon_map"), // the CSS class for the label
93            labelInBackground: false,
94            icon: (dat_puntos[i][4].lastIndexOf("icon_fin") > 0 ? dat_puntos[i][4] : pinSymbol('#0836a9'))
95        });
96
97        google.maps.event.addListener(marker, 'click', (function (marker, i) {
98            return function () {
99                infowindow.setContent(dat_puntos[i][0]);
100                infowindow.open(map_ronda, marker);
101            }
102        })(marker, i));
103    }
104
105    for (z = 0; z < dat_line.length; z++) {
106        var red_poly = createPoly(dat_line[z][0], dat_line[z][1], dat_line[z][2]);
107    }
108
109    $('#cont_map_puntos').show();
110    
111    $('#map_faceid_text').show();
112
113}
114
115/******************label linea mapa************************/
116function pinSymbol(color) {
117    return {
118        path: 'M 0,0 C -2,-20 -10,-22 -10,-30 A 10,10 0 1,1 10,-30 C 10,-22 2,-20 0,0 z',
119        fillColor: color,
120        fillOpacity: 1,
121        strokeColor: '#000',
122        strokeWeight: 2,
123        scale: 2
124    };
125}
126
127
128// Label constructor function
129function Label(opts, poly) {
130
131    // Initialization
132    this.setValues(opts);
133    this.map_ = opts.map;
134    this.poly_ = poly;
135    this.opacity = 0;
136    this.timer = null;
137    var div = this.div_ = document.createElement("div");
138    // Class name of div element to style it via CSS
139    div.className = "label_polyline";
140}
141
142Label.prototype = {
143
144    // Define draw method to keep OverlayView happy
145    draw: function () { },
146
147    getPos: function (pos) {
148
149        // Convert latlng of cursor position to pixels
150        var projection = this.getProjection();
151        var pixel = projection.fromLatLngToDivPixel(pos);
152        var div = this.div_;
153
154        // Adjust the label's position
155        var gap = 12;
156        var posX = pixel.x + gap;
157        var posY = pixel.y + gap;
158
159        // Flip technique
160        var mywidth = div.offsetWidth;
161        // Right boundary of the map
162        var boundsNE = this.map_.getBounds().getNorthEast();
163        boundsNE.pixel = projection.fromLatLngToDivPixel(boundsNE);
164
165        if (mywidth + posX > boundsNE.pixel.x) {
166            posX -= mywidth + gap;
167        }
168        div.style.left = posX + "px";
169        div.style.top = posY + "px";
170    },
171
172
173    fade1: function (begin, end, duration, fps) {
174
175        // Fades using setInterval
176        if (!duration) duration = 200;
177        if (!fps) fps = 20;
178
179        var me = this,
180            mystyle = this.div_.style,
181            change = end - begin,
182            interval = Math.ceil(1000 / fps),
183            totalFrames = Math.ceil(duration / interval),
184            fixedStep = change / totalFrames,
185            startTime = new Date().getTime(),
186            frame = 1;
187
188        // Avoid flickering - as far as possible
189        if (this.timer) {
190            clearInterval(this.timer);
191        }
192
193        this.timer = setInterval(function () {
194            var runtime = new Date().getTime();
195            frame = parseInt((runtime - startTime) / interval);
196
197            me.opacity = begin + fixedStep * frame; // Linear equation
198            mystyle.opacity = me.opacity;
199            mystyle.filter = "Alpha(opacity=" + me.opacity * 100 + ")";
200
201            //  document.getElementById("rep").innerHTML = me.opacity;
202            // if (runtime >= startTime + duration) {
203            if ((runtime - startTime) / duration >= 1) {
204                clearInterval(me.timer);
205            }
206        }, interval);
207        // this.timer = setInterval(setOpacity, interval);
208    },
209
210    fade2: function (begin, end, duration, fps) {
211
212        // Fades using setTimeout
213        if (!duration) duration = 600;
214        if (!fps) fps = 12;
215
216        var me = this,
217            mystyle = this.div_.style,
218            change = end - begin,
219            interval = Math.ceil(1000 / fps),
220            totalFrames = Math.ceil(duration / interval),
221            fixedStep = change / totalFrames,
222            i = 0,
223            timer = null;
224
225
226
227
228        function countFrames(frame) {
229            timer = setTimeout(function () {
230                me.opacity = begin + fixedStep * frame;
231                mystyle.opacity = me.opacity;
232                mystyle.filter = "Alpha(opacity=" + me.opacity * 100 + ")";
233            }, interval * frame);
234            // timer = setTimeout(inner, interval*frame);
235        }
236        // To stop the animation break this loop
237        while (++i <= totalFrames) {
238            countFrames(i);
239        }
240    },
241
242
243    fade3: function (begin, end, duration, time) {
244
245        // Old fading technique
246        var me = this;
247        var mystyle = this.div_.style;
248
249        if (this.timer) {
250            clearTimeout(this.timer);
251        }
252
253
254        var runtime = new Date().getTime();
255        var elapsedTicks = runtime - time;
256        me.opacity = begin + (end - begin) * elapsedTicks / duration;
257
258        //  if (runtime >= time + duration) {
259        //  if (Math.abs(me.opacity - begin) > Math.abs(end - begin )) {
260        //    return;
261        //  }
262        //  document.getElementById("rep").innerHTML = me.opacity;
263        mystyle.opacity = me.opacity;
264
265        function c() {
266            me.fade3(begin, end, duration, time);
267        }
268
269        if (runtime < time + duration) {
270            this.timer = setTimeout(c, duration / 100);
271        }
272    },
273
274
275    add_: function (text) {
276
277        var me = this;
278        var g = google.maps.event;
279        var div = me.div_;
280
281        div.innerHTML = text;
282        // Label is initially invisible
283        div.style.opacity = 0;
284        // Append the label's div to the floatPane
285        this.getPanes().floatPane.appendChild(this.div_);
286        // Calls fade to fade the label in
287        this.fade1(0, 1, 400, 25);
288
289        // this.fade3(0, 1, 400, new Date().getTime());
290
291        // Get the cursor position over poly
292        this.listener_ = g.addListener(me.poly_, "mousemove", function (evt) {
293            me.getPos(evt.latLng);
294        });
295    },
296
297    remove_: function () {
298
299        // Calls fade to fade the label out
300        this.fade1(1, 0, 300, 25);
301
302        // this.fade3(1, 0, 300, new Date().getTime());
303
304        if (this.opacity <= 0) {
305
306            // Clear the listeners to stop events when not needed.
307            if (this.listener_) {
308                google.maps.event.removeListener(this.listener_);
309                delete this.listener_;
310            }
311            // Remove the tooltip from the map pane.
312            var parent = this.div_.parentNode;
313            if (parent) parent.removeChild(this.div_);
314        }
315    }
316};
317
318function inherit(addTo, getFrom) {
319
320    var from = getFrom.prototype;  // prototype object to get methods from
321    var to = addTo.prototype;      // prototype object to add methods to
322    for (var prop in from) {
323        if (typeof to[prop] == "undefined") to[prop] = from[prop];
324    }
325}
326
327// Inherits methods from OverlayView from the Google Maps API
328inherit(Label, google.maps.OverlayView);
329
330
331function createPoly(path, color, name) {
332
333    var g = google.maps;
334    var poly = new g.Polyline({
335        path: path,
336        strokeColor: color,
337        strokeOpacity: 1,
338        strokeWeight: 6
339    });
340
341    var label = new Label({ map: map_ronda }, poly);
342
343    // Add mouse events to poly
344    g.event.addListener(poly, "mouseover", function () {
345        label.add_(name);
346    });
347    g.event.addListener(poly, "mouseout", function () {
348        label.remove_();
349    });
350
351    poly.setMap(map_ronda);
352    return poly;
353}
354/********************fin**************************************************/

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.