Skip to content

Commit

Permalink
Merge pull request openlayers#6313 from tschaub/no-debug
Browse files Browse the repository at this point in the history
Remove ol.DEBUG
tschaub authored Jan 2, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents e1ad3ca + 137cdc0 commit ab3d97d
Showing 128 changed files with 309 additions and 2,027 deletions.
2 changes: 1 addition & 1 deletion changelog/upgrade-notes.md
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

#### Removed build flags (`@define`)

The `ol.ENABLE_TILE`, `ol.ENABLE_IMAGE`, `ol.ENABLE_VECTOR`, and `ol.ENABLE_VECTOR_TILE` build flags are no longer necessary and have been removed. If you were using these in a `define` array for a custom build, you can remove them.
The `ol.DEBUG`, `ol.ENABLE_TILE`, `ol.ENABLE_IMAGE`, `ol.ENABLE_VECTOR`, and `ol.ENABLE_VECTOR_TILE` build flags are no longer necessary and have been removed. If you were using these in a `define` array for a custom build, you can remove them.

#### Simplified `ol.View#fit()` API

3 changes: 0 additions & 3 deletions config/example.json
Original file line number Diff line number Diff line change
@@ -23,9 +23,6 @@
"externs/tilejson.js",
"externs/topojson.js"
],
"define": [
"ol.DEBUG=false"
],
"jscomp_error": [
"*"
],
3 changes: 0 additions & 3 deletions config/examples-all.json
Original file line number Diff line number Diff line change
@@ -23,9 +23,6 @@
"externs/tilejson.js",
"externs/topojson.js"
],
"define": [
"ol.DEBUG=false"
],
"jscomp_error": [
"*"
],
3 changes: 0 additions & 3 deletions config/ol.json
Original file line number Diff line number Diff line change
@@ -14,9 +14,6 @@
"externs/tilejson.js",
"externs/topojson.js"
],
"define": [
"ol.DEBUG=false"
],
"jscomp_error": [
"*"
],
2 changes: 0 additions & 2 deletions doc/tutorials/closure.md
Original file line number Diff line number Diff line change
@@ -169,7 +169,6 @@ The minimum config file looks like this:
"node_modules/openlayers/externs/topojson.js"
],
"define": [
"ol.DEBUG=false",
"ol.ENABLE_WEBGL=false"
],
"js": [
@@ -220,7 +219,6 @@ Here is a version of `config.json` with more compilation checks enabled:
"node_modules/openlayers/externs/topojson.js"
],
"define": [
"ol.DEBUG=false",
"ol.ENABLE_WEBGL=false"
],
"js": [
6 changes: 1 addition & 5 deletions doc/tutorials/custom-builds.md
Original file line number Diff line number Diff line change
@@ -59,9 +59,6 @@ Creating a custom build requires writing a build configuration file. The format
"externs/tilejson.js",
"externs/topojson.js"
],
"define": [
"ol.DEBUG=false"
],
"extra_annotation_name": [
"api", "observable"
],
@@ -205,8 +202,7 @@ Now let's try a more complicated example: [`heatmaps-earthquakes`](https://openl
],
"define": [
"ol.ENABLE_WEBGL=false",
"ol.ENABLE_PROJ4JS=false",
"ol.DEBUG=false"
"ol.ENABLE_PROJ4JS=false"
],
"compilation_level": "ADVANCED",
"manage_closure_dependencies": true
4 changes: 0 additions & 4 deletions src/ol/animation.js
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@ goog.require('ol.easing');
* @api
*/
ol.animation.bounce = function(options) {
ol.DEBUG && console.warn('ol.animation.bounce() is deprecated. Use view.animate() instead.');
var resolution = options.resolution;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
@@ -54,7 +53,6 @@ ol.animation.bounce = function(options) {
* @api
*/
ol.animation.pan = function(options) {
ol.DEBUG && console.warn('ol.animation.pan() is deprecated. Use view.animate() instead.');
var source = options.source;
var start = options.start ? options.start : Date.now();
var sourceX = source[0];
@@ -97,7 +95,6 @@ ol.animation.pan = function(options) {
* @api
*/
ol.animation.rotate = function(options) {
ol.DEBUG && console.warn('ol.animation.rotate() is deprecated. Use view.animate() instead.');
var sourceRotation = options.rotation ? options.rotation : 0;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
@@ -146,7 +143,6 @@ ol.animation.rotate = function(options) {
* @api
*/
ol.animation.zoom = function(options) {
ol.DEBUG && console.warn('ol.animation.zoom() is deprecated. Use view.animate() instead.');
var sourceResolution = options.resolution;
var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000;
4 changes: 0 additions & 4 deletions src/ol/array.js
Original file line number Diff line number Diff line change
@@ -114,10 +114,6 @@ ol.array.linearFindNearest = function(arr, target, direction) {
* @param {number} end End index.
*/
ol.array.reverseSubArray = function(arr, begin, end) {
ol.DEBUG && console.assert(begin >= 0,
'Array begin index should be equal to or greater than 0');
ol.DEBUG && console.assert(end < arr.length,
'Array end index should be less than the array length');
while (begin < end) {
var tmp = arr[begin];
arr[begin] = arr[end];
1 change: 0 additions & 1 deletion src/ol/events/eventtarget.js
Original file line number Diff line number Diff line change
@@ -144,7 +144,6 @@ ol.events.EventTarget.prototype.removeEventListener = function(type, listener) {
var listeners = this.listeners_[type];
if (listeners) {
var index = listeners.indexOf(listener);
ol.DEBUG && console.assert(index != -1, 'listener not found');
if (type in this.pendingRemovals_) {
// make listener a no-op, and remove later in #dispatchEvent()
listeners[index] = ol.nullFunction;
2 changes: 0 additions & 2 deletions src/ol/extent.js
Original file line number Diff line number Diff line change
@@ -30,8 +30,6 @@ ol.extent.boundingExtent = function(coordinates) {
* @return {ol.Extent} Extent.
*/
ol.extent.boundingExtentXYs_ = function(xs, ys, opt_extent) {
ol.DEBUG && console.assert(xs.length > 0, 'xs length should be larger than 0');
ol.DEBUG && console.assert(ys.length > 0, 'ys length should be larger than 0');
var minX = Math.min.apply(null, xs);
var minY = Math.min.apply(null, ys);
var maxX = Math.max.apply(null, xs);
19 changes: 0 additions & 19 deletions src/ol/format/esrijson.js
Original file line number Diff line number Diff line change
@@ -144,8 +144,6 @@ ol.format.EsriJSON.convertRings_ = function(rings, layout) {
* @return {ol.geom.Geometry} Point.
*/
ol.format.EsriJSON.readPointGeometry_ = function(object) {
ol.DEBUG && console.assert(typeof object.x === 'number', 'object.x should be number');
ol.DEBUG && console.assert(typeof object.y === 'number', 'object.y should be number');
var point;
if (object.m !== undefined && object.z !== undefined) {
point = new ol.geom.Point([object.x, object.y, object.z, object.m],
@@ -169,10 +167,6 @@ ol.format.EsriJSON.readPointGeometry_ = function(object) {
* @return {ol.geom.Geometry} LineString.
*/
ol.format.EsriJSON.readLineStringGeometry_ = function(object) {
ol.DEBUG && console.assert(Array.isArray(object.paths),
'object.paths should be an array');
ol.DEBUG && console.assert(object.paths.length === 1,
'object.paths array length should be 1');
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
return new ol.geom.LineString(object.paths[0], layout);
};
@@ -184,10 +178,6 @@ ol.format.EsriJSON.readLineStringGeometry_ = function(object) {
* @return {ol.geom.Geometry} MultiLineString.
*/
ol.format.EsriJSON.readMultiLineStringGeometry_ = function(object) {
ol.DEBUG && console.assert(Array.isArray(object.paths),
'object.paths should be an array');
ol.DEBUG && console.assert(object.paths.length > 1,
'object.paths array length should be more than 1');
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
return new ol.geom.MultiLineString(object.paths, layout);
};
@@ -228,8 +218,6 @@ ol.format.EsriJSON.readMultiPointGeometry_ = function(object) {
* @return {ol.geom.Geometry} MultiPolygon.
*/
ol.format.EsriJSON.readMultiPolygonGeometry_ = function(object) {
ol.DEBUG && console.assert(object.rings.length > 1,
'object.rings should have length larger than 1');
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
return new ol.geom.MultiPolygon(
/** @type {Array.<Array.<Array.<Array.<number>>>>} */(object.rings),
@@ -243,7 +231,6 @@ ol.format.EsriJSON.readMultiPolygonGeometry_ = function(object) {
* @return {ol.geom.Geometry} Polygon.
*/
ol.format.EsriJSON.readPolygonGeometry_ = function(object) {
ol.DEBUG && console.assert(object.rings);
var layout = ol.format.EsriJSON.getGeometryLayout_(object);
return new ol.geom.Polygon(object.rings, layout);
};
@@ -469,9 +456,6 @@ ol.format.EsriJSON.prototype.readFeatures;
ol.format.EsriJSON.prototype.readFeatureFromObject = function(
object, opt_options) {
var esriJSONFeature = /** @type {EsriJSONFeature} */ (object);
ol.DEBUG && console.assert(esriJSONFeature.geometry ||
esriJSONFeature.attributes,
'geometry or attributes should be defined');
var geometry = ol.format.EsriJSON.readGeometry_(esriJSONFeature.geometry,
opt_options);
var feature = new ol.Feature();
@@ -481,9 +465,6 @@ ol.format.EsriJSON.prototype.readFeatureFromObject = function(
feature.setGeometry(geometry);
if (opt_options && opt_options.idField &&
esriJSONFeature.attributes[opt_options.idField]) {
ol.DEBUG && console.assert(
typeof esriJSONFeature.attributes[opt_options.idField] === 'number',
'objectIdFieldName value should be a number');
feature.setId(/** @type {number} */(
esriJSONFeature.attributes[opt_options.idField]));
}
17 changes: 0 additions & 17 deletions src/ol/format/geojson.js
Original file line number Diff line number Diff line change
@@ -90,8 +90,6 @@ ol.format.GeoJSON.readGeometry_ = function(object, opt_options) {
*/
ol.format.GeoJSON.readGeometryCollectionGeometry_ = function(
object, opt_options) {
ol.DEBUG && console.assert(object.type == 'GeometryCollection',
'object.type should be GeometryCollection');
var geometries = object.geometries.map(
/**
* @param {GeoJSONGeometry} geometry Geometry.
@@ -110,8 +108,6 @@ ol.format.GeoJSON.readGeometryCollectionGeometry_ = function(
* @return {ol.geom.Point} Point.
*/
ol.format.GeoJSON.readPointGeometry_ = function(object) {
ol.DEBUG && console.assert(object.type == 'Point',
'object.type should be Point');
return new ol.geom.Point(object.coordinates);
};

@@ -122,8 +118,6 @@ ol.format.GeoJSON.readPointGeometry_ = function(object) {
* @return {ol.geom.LineString} LineString.
*/
ol.format.GeoJSON.readLineStringGeometry_ = function(object) {
ol.DEBUG && console.assert(object.type == 'LineString',
'object.type should be LineString');
return new ol.geom.LineString(object.coordinates);
};

@@ -134,8 +128,6 @@ ol.format.GeoJSON.readLineStringGeometry_ = function(object) {
* @return {ol.geom.MultiLineString} MultiLineString.
*/
ol.format.GeoJSON.readMultiLineStringGeometry_ = function(object) {
ol.DEBUG && console.assert(object.type == 'MultiLineString',
'object.type should be MultiLineString');
return new ol.geom.MultiLineString(object.coordinates);
};

@@ -146,8 +138,6 @@ ol.format.GeoJSON.readMultiLineStringGeometry_ = function(object) {
* @return {ol.geom.MultiPoint} MultiPoint.
*/
ol.format.GeoJSON.readMultiPointGeometry_ = function(object) {
ol.DEBUG && console.assert(object.type == 'MultiPoint',
'object.type should be MultiPoint');
return new ol.geom.MultiPoint(object.coordinates);
};

@@ -158,8 +148,6 @@ ol.format.GeoJSON.readMultiPointGeometry_ = function(object) {
* @return {ol.geom.MultiPolygon} MultiPolygon.
*/
ol.format.GeoJSON.readMultiPolygonGeometry_ = function(object) {
ol.DEBUG && console.assert(object.type == 'MultiPolygon',
'object.type should be MultiPolygon');
return new ol.geom.MultiPolygon(object.coordinates);
};

@@ -170,8 +158,6 @@ ol.format.GeoJSON.readMultiPolygonGeometry_ = function(object) {
* @return {ol.geom.Polygon} Polygon.
*/
ol.format.GeoJSON.readPolygonGeometry_ = function(object) {
ol.DEBUG && console.assert(object.type == 'Polygon',
'object.type should be Polygon');
return new ol.geom.Polygon(object.coordinates);
};

@@ -389,9 +375,6 @@ ol.format.GeoJSON.prototype.readFeatures;
*/
ol.format.GeoJSON.prototype.readFeatureFromObject = function(
object, opt_options) {

ol.DEBUG && console.assert(object.type !== 'FeatureCollection', 'Expected a Feature or geometry');

/**
* @type {GeoJSONFeature}
*/
19 changes: 0 additions & 19 deletions src/ol/format/gml2.js
Original file line number Diff line number Diff line change
@@ -100,9 +100,6 @@ ol.format.GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
* @return {ol.Extent|undefined} Envelope.
*/
ol.format.GML2.prototype.readBox_ = function(node, objectStack) {
ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE,
'node.nodeType should be ELEMENT');
ol.DEBUG && console.assert(node.localName == 'Box', 'localName should be Box');
/** @type {Array.<number>} */
var flatCoordinates = ol.xml.pushParseAndPop([null],
this.BOX_PARSERS_, node, objectStack, this);
@@ -118,20 +115,12 @@ ol.format.GML2.prototype.readBox_ = function(node, objectStack) {
* @private
*/
ol.format.GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE,
'node.nodeType should be ELEMENT');
ol.DEBUG && console.assert(node.localName == 'innerBoundaryIs',
'localName should be innerBoundaryIs');
/** @type {Array.<number>|undefined} */
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this);
if (flatLinearRing) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */
(objectStack[objectStack.length - 1]);
ol.DEBUG && console.assert(Array.isArray(flatLinearRings),
'flatLinearRings should be an array');
ol.DEBUG && console.assert(flatLinearRings.length > 0,
'flatLinearRings should have an array length larger than 0');
flatLinearRings.push(flatLinearRing);
}
};
@@ -143,20 +132,12 @@ ol.format.GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
* @private
*/
ol.format.GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
ol.DEBUG && console.assert(node.nodeType == Node.ELEMENT_NODE,
'node.nodeType should be ELEMENT');
ol.DEBUG && console.assert(node.localName == 'outerBoundaryIs',
'localName should be outerBoundaryIs');
/** @type {Array.<number>|undefined} */
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this);
if (flatLinearRing) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */
(objectStack[objectStack.length - 1]);
ol.DEBUG && console.assert(Array.isArray(flatLinearRings),
'flatLinearRings should be an array');
ol.DEBUG && console.assert(flatLinearRings.length > 0,
'flatLinearRings should have an array length larger than 0');
flatLinearRings[0] = flatLinearRing;
}
};
Loading

0 comments on commit ab3d97d

Please sign in to comment.