s/View/Control/, thanks @elemoine

This commit is contained in:
Tom Payne
2012-08-13 15:18:17 +02:00
parent 208db33bfc
commit ec3475806e
3 changed files with 25 additions and 24 deletions
+3 -3
View File
@@ -1,8 +1,8 @@
goog.require('ol.RendererHint'); goog.require('ol.RendererHint');
goog.require('ol.control.Attribution');
goog.require('ol.createMap'); goog.require('ol.createMap');
goog.require('ol.interaction.Keyboard'); goog.require('ol.interaction.Keyboard');
goog.require('ol.layer.MapQuestOpenAerial'); goog.require('ol.layer.MapQuestOpenAerial');
goog.require('ol.view.Attribution');
var layer = new ol.layer.MapQuestOpenAerial(); var layer = new ol.layer.MapQuestOpenAerial();
@@ -28,9 +28,9 @@ if (!goog.isNull(webglMap)) {
webglMap.bindTo('rotation', domMap); webglMap.bindTo('rotation', domMap);
} }
var attributionView = new ol.view.Attribution(domMap); var attributionControl = new ol.control.Attribution(domMap);
document.getElementById('attribution').appendChild( document.getElementById('attribution').appendChild(
attributionView.getElement()); attributionControl.getElement());
var keyboardInteraction = new ol.interaction.Keyboard(); var keyboardInteraction = new ol.interaction.Keyboard();
keyboardInteraction.addCallback('0', function() { keyboardInteraction.addCallback('0', function() {
@@ -3,7 +3,7 @@
// FIXME handle layer order // FIXME handle layer order
// FIXME check clean-up code // FIXME check clean-up code
goog.provide('ol.view.Attribution'); goog.provide('ol.control.Attribution');
goog.require('goog.dom'); goog.require('goog.dom');
goog.require('goog.dom.TagName'); goog.require('goog.dom.TagName');
@@ -12,20 +12,20 @@ goog.require('goog.events.EventType');
goog.require('goog.object'); goog.require('goog.object');
goog.require('goog.style'); goog.require('goog.style');
goog.require('ol.Collection'); goog.require('ol.Collection');
goog.require('ol.Control');
goog.require('ol.CoverageArea'); goog.require('ol.CoverageArea');
goog.require('ol.Layer'); goog.require('ol.Layer');
goog.require('ol.MapProperty'); goog.require('ol.MapProperty');
goog.require('ol.TileCoverageArea'); goog.require('ol.TileCoverageArea');
goog.require('ol.View');
/** /**
* @constructor * @constructor
* @extends {ol.View} * @extends {ol.Control}
* @param {ol.Map} map Map. * @param {ol.Map} map Map.
*/ */
ol.view.Attribution = function(map) { ol.control.Attribution = function(map) {
goog.base(this, map); goog.base(this, map);
@@ -75,14 +75,14 @@ ol.view.Attribution = function(map) {
this.handleMapLayersChanged(); this.handleMapLayersChanged();
}; };
goog.inherits(ol.view.Attribution, ol.View); goog.inherits(ol.control.Attribution, ol.Control);
/** /**
* @param {ol.Layer} layer Layer. * @param {ol.Layer} layer Layer.
* @private * @private
*/ */
ol.view.Attribution.prototype.createAttributionElementsForLayer_ = ol.control.Attribution.prototype.createAttributionElementsForLayer_ =
function(layer) { function(layer) {
var store = layer.getStore(); var store = layer.getStore();
@@ -132,7 +132,7 @@ ol.view.Attribution.prototype.createAttributionElementsForLayer_ =
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.view.Attribution.prototype.getElement = function() { ol.control.Attribution.prototype.getElement = function() {
return this.ulElement_; return this.ulElement_;
}; };
@@ -141,7 +141,7 @@ ol.view.Attribution.prototype.getElement = function() {
* @param {ol.Layer} layer Layer. * @param {ol.Layer} layer Layer.
* @protected * @protected
*/ */
ol.view.Attribution.prototype.addLayer = function(layer) { ol.control.Attribution.prototype.addLayer = function(layer) {
var layerKey = goog.getUid(layer); var layerKey = goog.getUid(layer);
@@ -162,7 +162,7 @@ ol.view.Attribution.prototype.addLayer = function(layer) {
/** /**
* @param {goog.events.Event} event Event. * @param {goog.events.Event} event Event.
*/ */
ol.view.Attribution.prototype.handleLayerLoad = function(event) { ol.control.Attribution.prototype.handleLayerLoad = function(event) {
var layer = /** @type {ol.Layer} */ event.target; var layer = /** @type {ol.Layer} */ event.target;
this.createAttributionElementsForLayer_(layer); this.createAttributionElementsForLayer_(layer);
}; };
@@ -172,7 +172,7 @@ ol.view.Attribution.prototype.handleLayerLoad = function(event) {
* @param {ol.Layer} layer Layer. * @param {ol.Layer} layer Layer.
* @protected * @protected
*/ */
ol.view.Attribution.prototype.removeLayer = function(layer) { ol.control.Attribution.prototype.removeLayer = function(layer) {
var layerKey = goog.getUid(layer); var layerKey = goog.getUid(layer);
@@ -194,7 +194,7 @@ ol.view.Attribution.prototype.removeLayer = function(layer) {
* @param {goog.events.Event} event Eveny. * @param {goog.events.Event} event Eveny.
* @protected * @protected
*/ */
ol.view.Attribution.prototype.handleLayerVisibleChanged = function(event) { ol.control.Attribution.prototype.handleLayerVisibleChanged = function(event) {
var map = this.getMap(); var map = this.getMap();
var mapIsDef = map.isDef(); var mapIsDef = map.isDef();
@@ -214,7 +214,7 @@ ol.view.Attribution.prototype.handleLayerVisibleChanged = function(event) {
* @param {ol.CollectionEvent} collectionEvent Collection event. * @param {ol.CollectionEvent} collectionEvent Collection event.
* @protected * @protected
*/ */
ol.view.Attribution.prototype.handleLayersAdd = function(collectionEvent) { ol.control.Attribution.prototype.handleLayersAdd = function(collectionEvent) {
var layer = /** @type {ol.Layer} */ collectionEvent.elem; var layer = /** @type {ol.Layer} */ collectionEvent.elem;
this.addLayer(layer); this.addLayer(layer);
}; };
@@ -224,7 +224,8 @@ ol.view.Attribution.prototype.handleLayersAdd = function(collectionEvent) {
* @param {ol.CollectionEvent} collectionEvent Collection event. * @param {ol.CollectionEvent} collectionEvent Collection event.
* @protected * @protected
*/ */
ol.view.Attribution.prototype.handleLayersRemove = function(collectionEvent) { ol.control.Attribution.prototype.handleLayersRemove =
function(collectionEvent) {
var layer = /** @type {ol.Layer} */ collectionEvent.elem; var layer = /** @type {ol.Layer} */ collectionEvent.elem;
this.removeLayer(layer); this.removeLayer(layer);
}; };
@@ -233,7 +234,7 @@ ol.view.Attribution.prototype.handleLayersRemove = function(collectionEvent) {
/** /**
* @protected * @protected
*/ */
ol.view.Attribution.prototype.handleMapChanged = function() { ol.control.Attribution.prototype.handleMapChanged = function() {
var map = this.getMap(); var map = this.getMap();
var mapIsDef = map.isDef(); var mapIsDef = map.isDef();
@@ -253,7 +254,7 @@ ol.view.Attribution.prototype.handleMapChanged = function() {
/** /**
* @protected * @protected
*/ */
ol.view.Attribution.prototype.handleMapLayersChanged = function() { ol.control.Attribution.prototype.handleMapLayersChanged = function() {
if (!goog.isNull(this.layersListenerKeys_)) { if (!goog.isNull(this.layersListenerKeys_)) {
goog.array.forEach(this.layersListenerKeys_, goog.events.unlistenByKey); goog.array.forEach(this.layersListenerKeys_, goog.events.unlistenByKey);
this.layersListenerKeys_ = null; this.layersListenerKeys_ = null;
@@ -285,7 +286,7 @@ ol.view.Attribution.prototype.handleMapLayersChanged = function() {
* @return {Object.<number, boolean>} Attribution visibilities. * @return {Object.<number, boolean>} Attribution visibilities.
* @private * @private
*/ */
ol.view.Attribution.prototype.getLayerAttributionVisiblities_ = ol.control.Attribution.prototype.getLayerAttributionVisiblities_ =
function(layer, mapExtent, mapResolution, mapProjection) { function(layer, mapExtent, mapResolution, mapProjection) {
var store = layer.getStore(); var store = layer.getStore();
@@ -367,7 +368,7 @@ ol.view.Attribution.prototype.getLayerAttributionVisiblities_ =
* @param {ol.Projection} mapProjection Map projection. * @param {ol.Projection} mapProjection Map projection.
* @private * @private
*/ */
ol.view.Attribution.prototype.updateLayerAttributionsVisibility_ = ol.control.Attribution.prototype.updateLayerAttributionsVisibility_ =
function(layer, mapIsDef, mapExtent, mapResolution, mapProjection) { function(layer, mapIsDef, mapExtent, mapResolution, mapProjection) {
if (mapIsDef && layer.getVisible()) { if (mapIsDef && layer.getVisible()) {
var attributionVisibilities = this.getLayerAttributionVisiblities_( var attributionVisibilities = this.getLayerAttributionVisiblities_(
@@ -1,4 +1,4 @@
goog.provide('ol.View'); goog.provide('ol.Control');
goog.require('ol.Map'); goog.require('ol.Map');
@@ -8,7 +8,7 @@ goog.require('ol.Map');
* @constructor * @constructor
* @param {ol.Map} map Map. * @param {ol.Map} map Map.
*/ */
ol.View = function(map) { ol.Control = function(map) {
/** /**
* @private * @private
@@ -22,12 +22,12 @@ ol.View = function(map) {
/** /**
* @return {Element} Element. * @return {Element} Element.
*/ */
ol.View.prototype.getElement = goog.abstractMethod; ol.Control.prototype.getElement = goog.abstractMethod;
/** /**
* @return {ol.Map} Map. * @return {ol.Map} Map.
*/ */
ol.View.prototype.getMap = function() { ol.Control.prototype.getMap = function() {
return this.map_; return this.map_;
}; };