This rather large commit refactors the build system to solve a number of problems: - Object literal types are now declared in just one place - There are no more circular dependencies - There is no need for concealed subclasses in build-standalone mode When building in standalone mode, you need to include the source in build/src/external. This declares object literal types as externs so that their properties are not renamed. When building with the application, you need to include the source in build/src/internal. This declares object literal types as typedefs so that their properties can be renamed and removed. Note also that ol.MapOptions has been merged into ol.Map, with some renaming.
48 lines
1.4 KiB
JavaScript
48 lines
1.4 KiB
JavaScript
goog.require('goog.debug.Console');
|
|
goog.require('goog.debug.Logger');
|
|
goog.require('goog.debug.Logger.Level');
|
|
goog.require('ol.Collection');
|
|
goog.require('ol.Coordinate');
|
|
goog.require('ol.CoordinateFormat');
|
|
goog.require('ol.Map');
|
|
goog.require('ol.overlay.Overlay');
|
|
goog.require('ol.source.MapQuestOpenAerial');
|
|
|
|
|
|
if (goog.DEBUG) {
|
|
goog.debug.Console.autoInstall();
|
|
goog.debug.Logger.getLogger('ol').setLevel(goog.debug.Logger.Level.INFO);
|
|
}
|
|
|
|
|
|
var layer = new ol.layer.TileLayer({
|
|
source: new ol.source.MapQuestOpenAerial()
|
|
});
|
|
var map = new ol.Map(document.getElementById('map'), {
|
|
center: new ol.Coordinate(0, 0),
|
|
layers: new ol.Collection([layer]),
|
|
zoom: 2
|
|
});
|
|
|
|
// Vienna label
|
|
var vienna = new ol.overlay.Overlay({
|
|
map: map,
|
|
coordinate: ol.Projection.transformWithCodes(
|
|
new ol.Coordinate(16.3725, 48.208889), 'EPSG:4326', 'EPSG:3857'),
|
|
element: document.getElementById('vienna')
|
|
});
|
|
|
|
// Popup showing the position the user clicked
|
|
var popup = new ol.overlay.Overlay({
|
|
element: document.getElementById('popup')
|
|
});
|
|
map.addEventListener('click', function(evt) {
|
|
var coordinate = evt.getCoordinate();
|
|
popup.getElement().innerHTML =
|
|
'Welcome to ol3. The location you clicked was<br>' +
|
|
ol.CoordinateFormat.hdms(ol.Projection.transformWithCodes(
|
|
coordinate, 'EPSG:3857', 'EPSG:4326'));
|
|
popup.setMap(evt.map);
|
|
popup.setCoordinate(evt.getCoordinate());
|
|
});
|