Changeset 9287
- Timestamp:
- 05/06/08 06:19:30 (3 months ago)
- Files:
-
- my-mit-maps/trunk/api/scripts/buildings.js (modified) (1 diff)
- my-mit-maps/trunk/api/scripts/flooroverlay.js (modified) (3 diffs)
- my-mit-maps/trunk/api/scripts/lines.js (modified) (2 diffs)
- my-mit-maps/trunk/api/scripts/mit-floor-plans.js (modified) (6 diffs)
- my-mit-maps/trunk/api/scripts/records.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
my-mit-maps/trunk/api/scripts/buildings.js
r9234 r9287 11 11 }, 12 12 minZoom: 17, 13 fullZoom: 20, 13 14 maxZoom: 22, 14 15 tileData: { my-mit-maps/trunk/api/scripts/flooroverlay.js
r9265 r9287 3 3 */ 4 4 5 // GLatLng Bounds bounds - boundsfor location of overlay over floor plan6 function FloorOverlay(floorNumber, buildingNumber, bounds) {5 // GLatLng center - center for location of overlay over floor plan 6 function FloorOverlay(floorNumber, buildingNumber, center) { 7 7 this.floor_ = floorNumber; 8 8 this.building_ = buildingNumber; 9 this. bounds_ = bounds;9 this.center_ = center; 10 10 } 11 11 … … 16 16 //div.setAttribute("class", "floor-overlay"); // TODO: set .floor-overlay style in CSS 17 17 div.style.position = "absolute"; 18 div.style.border = "1px solid #000000"; 19 div.style.background = "#ffffff"; 18 div.style.border = "2px solid #000000"; 19 div.style.opacity = "0.5"; 20 div.style.background = "#888"; 21 div.style.color = "white"; 20 22 21 div.innerHTML = "<span>"+this.floor_+" - "+this._building+"</span>" ; 23 var span = document.createElement("span"); 24 span.innerHTML = "<center>"+this.building_+" - "+this.floor_+"</center>"; 25 span.style.padding = "4px 0px"; 26 span.style.font = "24pt bold Helvetica"; 27 div.appendChild(span); 22 28 23 29 map.getPane(G_MAP_MAP_PANE).appendChild(div); 24 30 this.map_ = map; 25 31 this.div_ = div; 26 console.log(div);27 32 } 28 33 … … 39 44 if (!force) return; 40 45 41 var c1 = this.map_.fromLatLngToDivPixel(this.bounds_.getSouthWest());42 var c2 = this.map_.fromLatLngToDivPixel(this.bounds_.getNorthEast());46 this.div_.style.width = "100px"; 47 this.div_.style.height = "50px"; 43 48 44 this.div_.style.width = Math.abs(c2.x - c1.x) + "px"; 45 this.div_.style.height = Math.abs(c2.y - c1.y) + "px"; 46 this.div_.style.left = (Math.min(c2.x, c1.x) - 1) + "px"; 47 this.div_.style.top = (Math.min(c2.y, c1.y) - 1) + "px"; 48 console.log(this.bounds_); 49 49 var c = this.map_.fromLatLngToDivPixel(this.center_); 50 this.div_.style.left = (Math.floor(c.x - 50)) + "px"; 51 this.div_.style.top = (Math.floor(c.y) - 25) + "px"; 50 52 } 51 53 my-mit-maps/trunk/api/scripts/lines.js
r9263 r9287 22 22 var latlng = clickedPoint; 23 23 24 map.panTo(clickedPoint); // get rid of this but keep double click working24 map.panTo(clickedPoint); // TODO get rid of this but keep double click working 25 25 newLine.points.push(clickedPoint); 26 26 if(newLine.points.length == 1) { … … 126 126 } 127 127 var line = new GPolyline(latlngs, feature.color); // weight, opacity 128 var marker = new GMarker(latlngs[ latlngs.length-1], { icon: new GIcon(G_DEFAULT_ICON) });128 var marker = new GMarker(latlngs[Math.floor(latlngs.length/2)], { icon: new GIcon(G_DEFAULT_ICON) }); 129 129 var onclick = function() { onFeatureClick(feature, marker); }; 130 130 131 131 GEvent.addListener(line, "click", onclick); 132 GEvent.addListener(marker, "click", onclick);133 132 map.addOverlay(line); 134 133 map.addOverlay(marker); 134 marker.hide() 135 135 feature.line = line; 136 136 feature.marker = marker; my-mit-maps/trunk/api/scripts/mit-floor-plans.js
r9265 r9287 107 107 map.showFloors(map._floors); 108 108 }; 109 110 // create FloorOverlay111 var floorNavBounds = new GLatLngBounds(new GLatLng(42.361584231438876, -71.09073758125305),112 new GLatLng(42.36174872923669,-71.0904210805893));113 map.addOverlay(new FloorOverlay(1, 32, floorNavBounds));114 109 115 110 return map; … … 271 266 MITFloorPlans.createControls(currentFloor); 272 267 document.getElementById("search-textbox").onkeypress = onSearchKeyPress; 273 274 268 } 275 269 … … 323 317 var html = []; 324 318 var floors = currentBuilding.floors; 325 for (var f = floors.length - 1; f >= 0; f--) { // TODO generalize319 for (var f = floors.length - 1; f >= 0; f--) { 326 320 html.push( 327 321 "<a class='" + (floors[f] == currentFloor ? "floor-link-selected" : "floor-link") + "' href='javascript:MITFloorPlans.setFloor(" + floors[f] + ");' id='floor-link-" + floors[f] + "'>" + … … 333 327 container.innerHTML = html.join(""); 334 328 335 recreateFeatures(initialFloor); 329 recreateFeatures(initialFloor); 330 MITFloorPlans.renderFloorOverlay(); 336 331 } 337 332 338 333 MITFloorPlans.setFloor = function(f, cont) { 339 334 if (f != currentFloor) { 335 /* 340 336 var floorIndicator = document.getElementById("floor-indicator"); 341 337 floorIndicator.innerHTML = "<span>floor " + f + "</span>"; 342 338 floorIndicator.style.display = "block"; 339 */ 343 340 344 341 document.getElementById("floor-link-" + currentFloor).className = "floor-link"; … … 351 348 recreateFeatures(f); 352 349 350 /* 353 351 window.setTimeout(function() { 354 352 floorIndicator.style.display = "none"; 355 353 }, 500); 354 */ 356 355 357 356 if (cont) { … … 403 402 } 404 403 404 MITFloorPlans.renderFloorOverlay = function() { 405 var floorNavCenter = new GLatLng(42.36174872923669,-71.0904210805893); 406 map.addOverlay(new FloorOverlay(currentFloor, currentBuilding.id, floorNavCenter)); 407 } 408 405 409 function encodeUrlString(s) { 406 410 return encodeURIComponent(encodeJavascriptString(s)); my-mit-maps/trunk/api/scripts/records.js
r9263 r9287 25 25 } 26 26 } 27 MITFloorPlans.renderFloorOverlay(); 27 28 } 28 29
