Merge pull request #7577 from tschaub/ol-index-todos
Redistribute things in ol/index.js
This commit is contained in:
@@ -107,7 +107,7 @@ In case you are creating a custom build of OpenLayers and do not need the reproj
|
||||
See [Custom builds](custom-builds.html#defines) tutorial on how to do this.
|
||||
|
||||
### Triangulation precision threshold
|
||||
The default [triangulation error threshold](#dynamic-triangulation) in pixels is given by `DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD` (0.5 pixel).
|
||||
The default [triangulation error threshold](#dynamic-triangulation) in pixels is given by `ERROR_THRESHOLD` (0.5 pixel).
|
||||
In case a different threshold needs to be defined for different sources, the `reprojectionErrorThreshold` option can be passed when constructing the tile image source.
|
||||
|
||||
###Limiting visibility of reprojected map by extent
|
||||
|
||||
@@ -7443,7 +7443,7 @@ olx.source.ZoomifyOptions.prototype.transition;
|
||||
|
||||
/**
|
||||
* Tile size. Same tile size is used for all zoom levels. Default value is
|
||||
* `OpenLayers.DEFAULT_TILE_SIZE`.
|
||||
* `256`.
|
||||
* @type {number|undefined}
|
||||
* @api
|
||||
*/
|
||||
@@ -8612,8 +8612,7 @@ olx.style.AtlasManagerOptions;
|
||||
|
||||
|
||||
/**
|
||||
* The size in pixels of the first atlas image. If no value is given the
|
||||
* `ol.INITIAL_ATLAS_SIZE` compile-time constant will be used.
|
||||
* The size in pixels of the first atlas image. Default is `256`.
|
||||
* @type {number|undefined}
|
||||
* @api
|
||||
*/
|
||||
@@ -8621,11 +8620,8 @@ olx.style.AtlasManagerOptions.prototype.initialSize;
|
||||
|
||||
|
||||
/**
|
||||
* The maximum size in pixels of atlas images. If no value is given then
|
||||
* the `ol.MAX_ATLAS_SIZE` compile-time constant will be used. And if
|
||||
* `ol.MAX_ATLAS_SIZE` is set to `-1` (the default) then
|
||||
* `ol.WEBGL_MAX_TEXTURE_SIZE` will used if WebGL is supported. Otherwise
|
||||
* 2048 is used.
|
||||
* The maximum size in pixels of atlas images. Default is
|
||||
* `WEBGL_MAX_TEXTURE_SIZE` or 2048 if WebGL is not supported.
|
||||
* @type {number|undefined}
|
||||
* @api
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/Map
|
||||
*/
|
||||
import {ENABLE_CANVAS, ENABLE_WEBGL, inherits} from './index.js';
|
||||
import {inherits} from './index.js';
|
||||
import _ol_PluggableMap_ from './PluggableMap.js';
|
||||
import _ol_PluginType_ from './PluginType.js';
|
||||
import _ol_control_ from './control.js';
|
||||
@@ -19,24 +19,21 @@ import _ol_renderer_webgl_TileLayer_ from './renderer/webgl/TileLayer.js';
|
||||
import _ol_renderer_webgl_VectorLayer_ from './renderer/webgl/VectorLayer.js';
|
||||
|
||||
|
||||
if (ENABLE_CANVAS) {
|
||||
_ol_plugins_.register(_ol_PluginType_.MAP_RENDERER, _ol_renderer_canvas_Map_);
|
||||
_ol_plugins_.registerMultiple(_ol_PluginType_.LAYER_RENDERER, [
|
||||
_ol_renderer_canvas_ImageLayer_,
|
||||
_ol_renderer_canvas_TileLayer_,
|
||||
_ol_renderer_canvas_VectorLayer_,
|
||||
_ol_renderer_canvas_VectorTileLayer_
|
||||
]);
|
||||
}
|
||||
_ol_plugins_.register(_ol_PluginType_.MAP_RENDERER, _ol_renderer_canvas_Map_);
|
||||
_ol_plugins_.registerMultiple(_ol_PluginType_.LAYER_RENDERER, [
|
||||
_ol_renderer_canvas_ImageLayer_,
|
||||
_ol_renderer_canvas_TileLayer_,
|
||||
_ol_renderer_canvas_VectorLayer_,
|
||||
_ol_renderer_canvas_VectorTileLayer_
|
||||
]);
|
||||
|
||||
if (ENABLE_WEBGL) {
|
||||
_ol_plugins_.register(_ol_PluginType_.MAP_RENDERER, _ol_renderer_webgl_Map_);
|
||||
_ol_plugins_.registerMultiple(_ol_PluginType_.LAYER_RENDERER, [
|
||||
_ol_renderer_webgl_ImageLayer_,
|
||||
_ol_renderer_webgl_TileLayer_,
|
||||
_ol_renderer_webgl_VectorLayer_
|
||||
]);
|
||||
}
|
||||
// TODO: move these to new ol-webgl package
|
||||
_ol_plugins_.register(_ol_PluginType_.MAP_RENDERER, _ol_renderer_webgl_Map_);
|
||||
_ol_plugins_.registerMultiple(_ol_PluginType_.LAYER_RENDERER, [
|
||||
_ol_renderer_webgl_ImageLayer_,
|
||||
_ol_renderer_webgl_TileLayer_,
|
||||
_ol_renderer_webgl_VectorLayer_
|
||||
]);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* @module ol/View
|
||||
*/
|
||||
import {DEFAULT_MIN_ZOOM, DEFAULT_TILE_SIZE, inherits, getUid, nullFunction} from './index.js';
|
||||
import {DEFAULT_TILE_SIZE} from './tilegrid/common.js';
|
||||
import {inherits, getUid, nullFunction} from './index.js';
|
||||
import _ol_CenterConstraint_ from './CenterConstraint.js';
|
||||
import _ol_Object_ from './Object.js';
|
||||
import _ol_ResolutionConstraint_ from './ResolutionConstraint.js';
|
||||
@@ -21,6 +22,13 @@ import _ol_obj_ from './obj.js';
|
||||
import _ol_proj_ from './proj.js';
|
||||
import _ol_proj_Units_ from './proj/Units.js';
|
||||
|
||||
|
||||
/**
|
||||
* @type {number} Default min zoom level for the map view.
|
||||
*/
|
||||
var DEFAULT_MIN_ZOOM = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* An ol.View object represents a simple 2D view of the map.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/control/OverviewMap
|
||||
*/
|
||||
import {OVERVIEWMAP_MAX_RATIO, OVERVIEWMAP_MIN_RATIO, inherits} from '../index.js';
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Collection_ from '../Collection.js';
|
||||
import _ol_PluggableMap_ from '../PluggableMap.js';
|
||||
import _ol_MapEventType_ from '../MapEventType.js';
|
||||
@@ -19,6 +19,21 @@ import _ol_events_ from '../events.js';
|
||||
import _ol_events_EventType_ from '../events/EventType.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
|
||||
|
||||
/**
|
||||
* @type {number} Maximum width and/or height extent ratio that determines
|
||||
* when the overview map should be zoomed out.
|
||||
*/
|
||||
var MAX_RATIO = 0.75;
|
||||
|
||||
|
||||
/**
|
||||
* @type {number} Minimum width and/or height extent ratio that determines
|
||||
* when the overview map should be zoomed in.
|
||||
*/
|
||||
var MIN_RATIO = 0.1;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new control with a map acting as an overview map for an other
|
||||
* defined map.
|
||||
@@ -336,10 +351,10 @@ _ol_control_OverviewMap_.prototype.validateExtent_ = function() {
|
||||
var ovmapWidth = ovmapSize[0];
|
||||
var ovmapHeight = ovmapSize[1];
|
||||
|
||||
if (boxWidth < ovmapWidth * OVERVIEWMAP_MIN_RATIO ||
|
||||
boxHeight < ovmapHeight * OVERVIEWMAP_MIN_RATIO ||
|
||||
boxWidth > ovmapWidth * OVERVIEWMAP_MAX_RATIO ||
|
||||
boxHeight > ovmapHeight * OVERVIEWMAP_MAX_RATIO) {
|
||||
if (boxWidth < ovmapWidth * MIN_RATIO ||
|
||||
boxHeight < ovmapHeight * MIN_RATIO ||
|
||||
boxWidth > ovmapWidth * MAX_RATIO ||
|
||||
boxHeight > ovmapHeight * MAX_RATIO) {
|
||||
this.resetExtent_();
|
||||
} else if (!_ol_extent_.containsExtent(ovextent, extent)) {
|
||||
this.recenter_();
|
||||
@@ -353,7 +368,7 @@ _ol_control_OverviewMap_.prototype.validateExtent_ = function() {
|
||||
* @private
|
||||
*/
|
||||
_ol_control_OverviewMap_.prototype.resetExtent_ = function() {
|
||||
if (OVERVIEWMAP_MAX_RATIO === 0 || OVERVIEWMAP_MIN_RATIO === 0) {
|
||||
if (MAX_RATIO === 0 || MIN_RATIO === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -371,8 +386,8 @@ _ol_control_OverviewMap_.prototype.resetExtent_ = function() {
|
||||
// box sizes using the min and max ratio, pick the step in the middle used
|
||||
// to calculate the extent from the main map to set it to the overview map,
|
||||
var steps = Math.log(
|
||||
OVERVIEWMAP_MAX_RATIO / OVERVIEWMAP_MIN_RATIO) / Math.LN2;
|
||||
var ratio = 1 / (Math.pow(2, steps / 2) * OVERVIEWMAP_MIN_RATIO);
|
||||
MAX_RATIO / MIN_RATIO) / Math.LN2;
|
||||
var ratio = 1 / (Math.pow(2, steps / 2) * MIN_RATIO);
|
||||
_ol_extent_.scaleFromCenter(extent, ratio);
|
||||
ovview.fit(extent);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/has
|
||||
*/
|
||||
import {ENABLE_CANVAS, ASSUME_TOUCH, HAS_WEBGL} from './index.js';
|
||||
import {HAS_WEBGL} from './index.js';
|
||||
|
||||
var _ol_has_ = {};
|
||||
|
||||
@@ -51,13 +51,12 @@ _ol_has_.CANVAS_LINE_DASH = false;
|
||||
|
||||
|
||||
/**
|
||||
* True if both the library and browser support Canvas. Always `false`
|
||||
* if `ol.ENABLE_CANVAS` is set to `false` at compile time.
|
||||
* True if the and browsers support Canvas.
|
||||
* @const
|
||||
* @type {boolean}
|
||||
* @api
|
||||
*/
|
||||
_ol_has_.CANVAS = ENABLE_CANVAS && (
|
||||
_ol_has_.CANVAS = (
|
||||
/**
|
||||
* @return {boolean} Canvas supported.
|
||||
*/
|
||||
@@ -105,7 +104,7 @@ _ol_has_.GEOLOCATION = 'geolocation' in navigator;
|
||||
* @type {boolean}
|
||||
* @api
|
||||
*/
|
||||
_ol_has_.TOUCH = ASSUME_TOUCH || 'ontouchstart' in window;
|
||||
_ol_has_.TOUCH = 'ontouchstart' in window;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
194
src/ol/index.js
194
src/ol/index.js
@@ -6,174 +6,15 @@ import webgl from './webgl.js';
|
||||
|
||||
|
||||
/**
|
||||
* Constants defined with the define tag cannot be changed in application
|
||||
* code, but can be set at compile time.
|
||||
* Some reduce the size of the build in advanced compile mode.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @type {boolean} Assume touch. Default is `false`.
|
||||
*/
|
||||
export var ASSUME_TOUCH = false;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: rename this to something having to do with tile grids
|
||||
* see https://github.com/openlayers/openlayers/issues/2076
|
||||
* @type {number} Default maximum zoom for default tile grids.
|
||||
*/
|
||||
export var DEFAULT_MAX_ZOOM = 42;
|
||||
|
||||
|
||||
/**
|
||||
* @type {number} Default min zoom level for the map view. Default is `0`.
|
||||
*/
|
||||
export var DEFAULT_MIN_ZOOM = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @type {number} Default maximum allowed threshold (in pixels) for
|
||||
* reprojection triangulation. Default is `0.5`.
|
||||
*/
|
||||
export var DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD = 0.5;
|
||||
|
||||
|
||||
/**
|
||||
* @type {number} Default tile size.
|
||||
*/
|
||||
export var DEFAULT_TILE_SIZE = 256;
|
||||
|
||||
|
||||
/**
|
||||
* @type {string} Default WMS version.
|
||||
*/
|
||||
export var DEFAULT_WMS_VERSION = '1.3.0';
|
||||
|
||||
|
||||
/**
|
||||
* @type {boolean} Enable the Canvas renderer. Default is `true`. Setting
|
||||
* this to false at compile time in advanced mode removes all code
|
||||
* supporting the Canvas renderer from the build.
|
||||
*/
|
||||
export var ENABLE_CANVAS = true;
|
||||
|
||||
|
||||
/**
|
||||
* @type {boolean} Enable integration with the Proj4js library. Default is
|
||||
* `true`.
|
||||
*/
|
||||
export var ENABLE_PROJ4JS = true;
|
||||
|
||||
|
||||
/**
|
||||
* @type {boolean} Enable automatic reprojection of raster sources. Default is
|
||||
* `true`.
|
||||
*/
|
||||
export var ENABLE_RASTER_REPROJECTION = true;
|
||||
|
||||
|
||||
/**
|
||||
* @type {boolean} Enable the WebGL renderer. Default is `true`. Setting
|
||||
* this to false at compile time in advanced mode removes all code
|
||||
* supporting the WebGL renderer from the build.
|
||||
*/
|
||||
export var ENABLE_WEBGL = true;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: move to a separate ol-webgl package
|
||||
* @type {boolean} Include debuggable shader sources. Default is `true`.
|
||||
* This should be set to `false` for production builds (if `ENABLE_WEBGL`
|
||||
* is `true`).
|
||||
* This should be set to `false` for production builds.
|
||||
*/
|
||||
export var DEBUG_WEBGL = true;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: get rid of this or move it to AtlasManager.js
|
||||
* @type {number} The size in pixels of the first atlas image. Default is
|
||||
* `256`.
|
||||
*/
|
||||
export var INITIAL_ATLAS_SIZE = 256;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: get rid of this or move it to AtlasManager.js
|
||||
* @type {number} The maximum size in pixels of atlas images. Default is
|
||||
* `-1`, meaning it is not used (and `WEBGL_MAX_TEXTURE_SIZE` is
|
||||
* used instead).
|
||||
*/
|
||||
export var MAX_ATLAS_SIZE = -1;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: move this to MouseWheelZoom.js
|
||||
* @type {number} Maximum mouse wheel delta.
|
||||
*/
|
||||
export var MOUSEWHEELZOOM_MAXDELTA = 1;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: move this to OverviewMap.js
|
||||
* @type {number} Maximum width and/or height extent ratio that determines
|
||||
* when the overview map should be zoomed out.
|
||||
*/
|
||||
export var OVERVIEWMAP_MAX_RATIO = 0.75;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: move this to OverviewMap.js
|
||||
* @type {number} Minimum width and/or height extent ratio that determines
|
||||
* when the overview map should be zoomed in.
|
||||
*/
|
||||
export var OVERVIEWMAP_MIN_RATIO = 0.1;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: move this to Triangulation.js
|
||||
* @type {number} Maximum number of subdivision steps during raster
|
||||
* reprojection triangulation. Prevents high memory usage and large
|
||||
* number of proj4 calls (for certain transformations and areas).
|
||||
* At most `2*(2^this)` triangles are created for each triangulated
|
||||
* extent (tile/image). Default is `10`.
|
||||
*/
|
||||
export var RASTER_REPROJECTION_MAX_SUBDIVISION = 10;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: move this to Triangulation.js
|
||||
* @type {number} Maximum allowed size of triangle relative to world width.
|
||||
* When transforming corners of world extent between certain projections,
|
||||
* the resulting triangulation seems to have zero error and no subdivision
|
||||
* is performed.
|
||||
* If the triangle width is more than this (relative to world width; 0-1),
|
||||
* subdivison is forced (up to `RASTER_REPROJECTION_MAX_SUBDIVISION`).
|
||||
* Default is `0.25`.
|
||||
*/
|
||||
export var RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH = 0.25;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: move this to renderer/vector.js
|
||||
* @type {number} Tolerance for geometry simplification in device pixels.
|
||||
*/
|
||||
export var SIMPLIFY_TOLERANCE = 0.5;
|
||||
|
||||
|
||||
/**
|
||||
* TODO: move this to webgl/Map.js
|
||||
* @type {number} Texture cache high water mark.
|
||||
*/
|
||||
export var WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK = 1024;
|
||||
|
||||
|
||||
/**
|
||||
* @type {string} OpenLayers version.
|
||||
*/
|
||||
export var VERSION = 'v4.6.4';
|
||||
|
||||
|
||||
/**
|
||||
* TODO: move to a separate ol-webgl package
|
||||
* The maximum supported WebGL texture size in pixels. If WebGL is not
|
||||
* supported, the value is set to `undefined`.
|
||||
* @const
|
||||
@@ -183,6 +24,7 @@ var WEBGL_MAX_TEXTURE_SIZE; // value is set below
|
||||
|
||||
|
||||
/**
|
||||
* TODO: move to a separate ol-webgl package
|
||||
* List of supported WebGL extensions.
|
||||
* @const
|
||||
* @type {Array.<string>}
|
||||
@@ -191,13 +33,14 @@ var WEBGL_EXTENSIONS; // value is set below
|
||||
|
||||
|
||||
/**
|
||||
* TODO: move to a separate ol-webgl package
|
||||
* WebGL is available.
|
||||
* @type {boolean}
|
||||
*/
|
||||
var HAS_WEBGL = false;
|
||||
|
||||
|
||||
if (ENABLE_WEBGL && 'WebGLRenderingContext' in window) {
|
||||
if ('WebGLRenderingContext' in window) {
|
||||
try {
|
||||
var canvas = /** @type {HTMLCanvasElement} */
|
||||
(document.createElement('CANVAS'));
|
||||
@@ -216,6 +59,12 @@ if (ENABLE_WEBGL && 'WebGLRenderingContext' in window) {
|
||||
export {HAS_WEBGL, WEBGL_MAX_TEXTURE_SIZE, WEBGL_EXTENSIONS};
|
||||
|
||||
|
||||
/**
|
||||
* @type {string} OpenLayers version.
|
||||
*/
|
||||
export var VERSION = 'v4.6.4';
|
||||
|
||||
|
||||
/**
|
||||
* Inherit the prototype methods from one constructor into another.
|
||||
*
|
||||
@@ -277,27 +126,8 @@ export default {
|
||||
nullFunction: nullFunction,
|
||||
inherits: inherits,
|
||||
VERSION: VERSION,
|
||||
ASSUME_TOUCH: ASSUME_TOUCH,
|
||||
DEFAULT_MAX_ZOOM: DEFAULT_MAX_ZOOM,
|
||||
DEFAULT_MIN_ZOOM: DEFAULT_MIN_ZOOM,
|
||||
DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD: DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD,
|
||||
DEFAULT_TILE_SIZE: DEFAULT_TILE_SIZE,
|
||||
DEFAULT_WMS_VERSION: DEFAULT_WMS_VERSION,
|
||||
ENABLE_CANVAS: ENABLE_CANVAS,
|
||||
ENABLE_PROJ4JS: ENABLE_PROJ4JS,
|
||||
ENABLE_RASTER_REPROJECTION: ENABLE_RASTER_REPROJECTION,
|
||||
ENABLE_WEBGL: ENABLE_WEBGL,
|
||||
DEBUG_WEBGL: DEBUG_WEBGL,
|
||||
INITIAL_ATLAS_SIZE: INITIAL_ATLAS_SIZE,
|
||||
MAX_ATLAS_SIZE: MAX_ATLAS_SIZE,
|
||||
MOUSEWHEELZOOM_MAXDELTA: MOUSEWHEELZOOM_MAXDELTA,
|
||||
OVERVIEWMAP_MAX_RATIO: OVERVIEWMAP_MAX_RATIO,
|
||||
OVERVIEWMAP_MIN_RATIO: OVERVIEWMAP_MIN_RATIO,
|
||||
RASTER_REPROJECTION_MAX_SUBDIVISION: RASTER_REPROJECTION_MAX_SUBDIVISION,
|
||||
RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH: RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH,
|
||||
SIMPLIFY_TOLERANCE: SIMPLIFY_TOLERANCE,
|
||||
HAS_WEBGL: HAS_WEBGL,
|
||||
WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK: WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK,
|
||||
WEBGL_MAX_TEXTURE_SIZE: WEBGL_MAX_TEXTURE_SIZE,
|
||||
WEBGL_EXTENSIONS: WEBGL_EXTENSIONS
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/interaction/MouseWheelZoom
|
||||
*/
|
||||
import {MOUSEWHEELZOOM_MAXDELTA, inherits} from '../index.js';
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_ViewHint_ from '../ViewHint.js';
|
||||
import _ol_easing_ from '../easing.js';
|
||||
import _ol_events_EventType_ from '../events/EventType.js';
|
||||
@@ -9,6 +9,13 @@ import _ol_has_ from '../has.js';
|
||||
import _ol_interaction_Interaction_ from '../interaction/Interaction.js';
|
||||
import _ol_math_ from '../math.js';
|
||||
|
||||
|
||||
/**
|
||||
* @type {number} Maximum mouse wheel delta.
|
||||
*/
|
||||
var MAX_DELTA = 1;
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Allows the user to zoom the map by scrolling the mouse wheel.
|
||||
@@ -252,7 +259,7 @@ _ol_interaction_MouseWheelZoom_.prototype.handleWheelZoom_ = function(map) {
|
||||
if (view.getAnimating()) {
|
||||
view.cancelAnimations();
|
||||
}
|
||||
var maxDelta = MOUSEWHEELZOOM_MAXDELTA;
|
||||
var maxDelta = MAX_DELTA;
|
||||
var delta = _ol_math_.clamp(this.delta_, -maxDelta, maxDelta);
|
||||
_ol_interaction_Interaction_.zoomByDelta(view, -delta, this.lastAnchor_,
|
||||
this.duration_);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/**
|
||||
* @module ol/proj
|
||||
*/
|
||||
import {ENABLE_PROJ4JS} from './index.js';
|
||||
import _ol_Sphere_ from './Sphere.js';
|
||||
import _ol_extent_ from './extent.js';
|
||||
import _ol_math_ from './math.js';
|
||||
@@ -32,23 +31,21 @@ _ol_proj_.METERS_PER_UNIT = _ol_proj_Units_.METERS_PER_UNIT;
|
||||
_ol_proj_.SPHERE_ = new _ol_Sphere_(_ol_Sphere_.DEFAULT_RADIUS);
|
||||
|
||||
|
||||
if (ENABLE_PROJ4JS) {
|
||||
/**
|
||||
* Register proj4. If not explicitly registered, it will be assumed that
|
||||
* proj4js will be loaded in the global namespace. For example in a
|
||||
* browserify ES6 environment you could use:
|
||||
*
|
||||
* import ol from 'openlayers';
|
||||
* import proj4 from 'proj4';
|
||||
* ol.proj.setProj4(proj4);
|
||||
*
|
||||
* @param {Proj4} proj4 Proj4.
|
||||
* @api
|
||||
*/
|
||||
_ol_proj_.setProj4 = function(proj4) {
|
||||
_ol_proj_proj4_.set(proj4);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Register proj4. If not explicitly registered, it will be assumed that
|
||||
* proj4js will be loaded in the global namespace. For example in a
|
||||
* browserify ES6 environment you could use:
|
||||
*
|
||||
* import ol from 'openlayers';
|
||||
* import proj4 from 'proj4';
|
||||
* ol.proj.setProj4(proj4);
|
||||
*
|
||||
* @param {Proj4} proj4 Proj4.
|
||||
* @api
|
||||
*/
|
||||
_ol_proj_.setProj4 = function(proj4) {
|
||||
_ol_proj_proj4_.set(proj4);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@@ -311,7 +308,7 @@ _ol_proj_.get = function(projectionLike) {
|
||||
} else if (typeof projectionLike === 'string') {
|
||||
var code = projectionLike;
|
||||
projection = _ol_proj_projections_.get(code);
|
||||
if (ENABLE_PROJ4JS && !projection) {
|
||||
if (!projection) {
|
||||
var proj4js = _ol_proj_proj4_.get();
|
||||
if (typeof proj4js == 'function' &&
|
||||
proj4js.defs(code) !== undefined) {
|
||||
@@ -380,7 +377,7 @@ _ol_proj_.getTransformFromProjections = function(sourceProjection, destinationPr
|
||||
var sourceCode = sourceProjection.getCode();
|
||||
var destinationCode = destinationProjection.getCode();
|
||||
var transform = _ol_proj_transforms_.get(sourceCode, destinationCode);
|
||||
if (ENABLE_PROJ4JS && !transform) {
|
||||
if (!transform) {
|
||||
var proj4js = _ol_proj_proj4_.get();
|
||||
if (typeof proj4js == 'function') {
|
||||
var sourceDef = proj4js.defs(sourceCode);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/**
|
||||
* @module ol/proj/Projection
|
||||
*/
|
||||
import {ENABLE_PROJ4JS} from '../index.js';
|
||||
import _ol_proj_Units_ from '../proj/Units.js';
|
||||
import _ol_proj_proj4_ from '../proj/proj4.js';
|
||||
|
||||
@@ -108,20 +107,18 @@ var _ol_proj_Projection_ = function(options) {
|
||||
this.metersPerUnit_ = options.metersPerUnit;
|
||||
|
||||
var code = options.code;
|
||||
if (ENABLE_PROJ4JS) {
|
||||
var proj4js = _ol_proj_proj4_.get();
|
||||
if (typeof proj4js == 'function') {
|
||||
var def = proj4js.defs(code);
|
||||
if (def !== undefined) {
|
||||
if (def.axis !== undefined && options.axisOrientation === undefined) {
|
||||
this.axisOrientation_ = def.axis;
|
||||
}
|
||||
if (options.metersPerUnit === undefined) {
|
||||
this.metersPerUnit_ = def.to_meter;
|
||||
}
|
||||
if (options.units === undefined) {
|
||||
this.units_ = def.units;
|
||||
}
|
||||
var proj4js = _ol_proj_proj4_.get();
|
||||
if (typeof proj4js == 'function') {
|
||||
var def = proj4js.defs(code);
|
||||
if (def !== undefined) {
|
||||
if (def.axis !== undefined && options.axisOrientation === undefined) {
|
||||
this.axisOrientation_ = def.axis;
|
||||
}
|
||||
if (options.metersPerUnit === undefined) {
|
||||
this.metersPerUnit_ = def.to_meter;
|
||||
}
|
||||
if (options.units === undefined) {
|
||||
this.units_ = def.units;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* @module ol/renderer/canvas/ImageLayer
|
||||
*/
|
||||
import {ENABLE_RASTER_REPROJECTION, inherits} from '../../index.js';
|
||||
import {ENABLE_RASTER_REPROJECTION} from '../../reproj/common.js';
|
||||
import {inherits} from '../../index.js';
|
||||
import _ol_ImageCanvas_ from '../../ImageCanvas.js';
|
||||
import _ol_LayerType_ from '../../LayerType.js';
|
||||
import _ol_ViewHint_ from '../../ViewHint.js';
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
/**
|
||||
* @module ol/renderer/vector
|
||||
*/
|
||||
import {SIMPLIFY_TOLERANCE, getUid} from '../index.js';
|
||||
import {getUid} from '../index.js';
|
||||
import _ol_ImageState_ from '../ImageState.js';
|
||||
import _ol_geom_GeometryType_ from '../geom/GeometryType.js';
|
||||
import _ol_render_ReplayType_ from '../render/ReplayType.js';
|
||||
var _ol_renderer_vector_ = {};
|
||||
|
||||
|
||||
/**
|
||||
* @type {number} Tolerance for geometry simplification in device pixels.
|
||||
*/
|
||||
var SIMPLIFY_TOLERANCE = 0.5;
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.Feature|ol.render.Feature} feature1 Feature 1.
|
||||
* @param {ol.Feature|ol.render.Feature} feature2 Feature 2.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* @module ol/renderer/webgl/ImageLayer
|
||||
*/
|
||||
import {ENABLE_RASTER_REPROJECTION, inherits, nullFunction} from '../../index.js';
|
||||
import {ENABLE_RASTER_REPROJECTION} from '../../reproj/common.js';
|
||||
import {inherits, nullFunction} from '../../index.js';
|
||||
import _ol_LayerType_ from '../../LayerType.js';
|
||||
import _ol_ViewHint_ from '../../ViewHint.js';
|
||||
import _ol_dom_ from '../../dom.js';
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/**
|
||||
* @module ol/renderer/webgl/Map
|
||||
*/
|
||||
// FIXME check against gl.getParameter(webgl.MAX_TEXTURE_SIZE)
|
||||
|
||||
import {WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK, inherits} from '../../index.js';
|
||||
import {inherits} from '../../index.js';
|
||||
import _ol_array_ from '../../array.js';
|
||||
import _ol_css_ from '../../css.js';
|
||||
import _ol_dom_ from '../../dom.js';
|
||||
@@ -22,6 +21,13 @@ import _ol_webgl_ from '../../webgl.js';
|
||||
import _ol_webgl_Context_ from '../../webgl/Context.js';
|
||||
import _ol_webgl_ContextEventType_ from '../../webgl/ContextEventType.js';
|
||||
|
||||
|
||||
/**
|
||||
* @type {number} Texture cache high water mark.
|
||||
*/
|
||||
var WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK = 1024;
|
||||
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends {ol.renderer.Map}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* @module ol/reproj/Image
|
||||
*/
|
||||
import {DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD, inherits} from '../index.js';
|
||||
import {ERROR_THRESHOLD} from './common.js';
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_ImageBase_ from '../ImageBase.js';
|
||||
import _ol_ImageState_ from '../ImageState.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
@@ -48,7 +49,7 @@ var _ol_reproj_Image_ = function(sourceProj, targetProj,
|
||||
var sourceResolution = _ol_reproj_.calculateSourceResolution(
|
||||
sourceProj, targetProj, targetCenter, targetResolution);
|
||||
|
||||
var errorThresholdInPixels = DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD;
|
||||
var errorThresholdInPixels = ERROR_THRESHOLD;
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* @module ol/reproj/Tile
|
||||
*/
|
||||
import {DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD, inherits} from '../index.js';
|
||||
import {ERROR_THRESHOLD} from './common.js';
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Tile_ from '../Tile.js';
|
||||
import _ol_TileState_ from '../TileState.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
@@ -136,7 +137,7 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
|
||||
}
|
||||
|
||||
var errorThresholdInPixels = opt_errorThreshold !== undefined ?
|
||||
opt_errorThreshold : DEFAULT_RASTER_REPROJECTION_ERROR_THRESHOLD;
|
||||
opt_errorThreshold : ERROR_THRESHOLD;
|
||||
|
||||
/**
|
||||
* @private
|
||||
|
||||
@@ -1,11 +1,33 @@
|
||||
/**
|
||||
* @module ol/reproj/Triangulation
|
||||
*/
|
||||
import {RASTER_REPROJECTION_MAX_SUBDIVISION, RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH} from '../index.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import _ol_math_ from '../math.js';
|
||||
import _ol_proj_ from '../proj.js';
|
||||
|
||||
|
||||
/**
|
||||
* @type {number} Maximum number of subdivision steps during raster
|
||||
* reprojection triangulation. Prevents high memory usage and large
|
||||
* number of proj4 calls (for certain transformations and areas).
|
||||
* At most `2*(2^this)` triangles are created for each triangulated
|
||||
* extent (tile/image).
|
||||
*/
|
||||
var MAX_SUBDIVISION = 10;
|
||||
|
||||
|
||||
/**
|
||||
* @type {number} Maximum allowed size of triangle relative to world width.
|
||||
* When transforming corners of world extent between certain projections,
|
||||
* the resulting triangulation seems to have zero error and no subdivision
|
||||
* is performed.
|
||||
* If the triangle width is more than this (relative to world width; 0-1),
|
||||
* subdivison is forced (up to `MAX_SUBDIVISION`).
|
||||
* Default is `0.25`.
|
||||
*/
|
||||
var MAX_TRIANGLE_WIDTH = 0.25;
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Class containing triangulation of the given target extent.
|
||||
@@ -112,7 +134,7 @@ var _ol_reproj_Triangulation_ = function(sourceProj, targetProj, targetExtent,
|
||||
destinationTopLeft, destinationTopRight,
|
||||
destinationBottomRight, destinationBottomLeft,
|
||||
sourceTopLeft, sourceTopRight, sourceBottomRight, sourceBottomLeft,
|
||||
RASTER_REPROJECTION_MAX_SUBDIVISION);
|
||||
MAX_SUBDIVISION);
|
||||
|
||||
if (this.wrapsXInSource_) {
|
||||
var leftBound = Infinity;
|
||||
@@ -213,11 +235,11 @@ _ol_reproj_Triangulation_.prototype.addQuad_ = function(a, b, c, d,
|
||||
var targetCoverageX =
|
||||
_ol_extent_.getWidth(targetQuadExtent) / this.targetWorldWidth_;
|
||||
needsSubdivision |=
|
||||
targetCoverageX > RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH;
|
||||
targetCoverageX > MAX_TRIANGLE_WIDTH;
|
||||
}
|
||||
if (!wrapsX && this.sourceProj_.isGlobal() && sourceCoverageX) {
|
||||
needsSubdivision |=
|
||||
sourceCoverageX > RASTER_REPROJECTION_MAX_TRIANGLE_WIDTH;
|
||||
sourceCoverageX > MAX_TRIANGLE_WIDTH;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
12
src/ol/reproj/common.js
Normal file
12
src/ol/reproj/common.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @type {number} Default maximum allowed threshold (in pixels) for
|
||||
* reprojection triangulation.
|
||||
*/
|
||||
export var ERROR_THRESHOLD = 0.5;
|
||||
|
||||
/**
|
||||
* TODO: decide if we want to expose this as a build flag or remove it
|
||||
* @type {boolean} Enable automatic reprojection of raster sources. Default is
|
||||
* `true`.
|
||||
*/
|
||||
export var ENABLE_RASTER_REPROJECTION = true;
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* @module ol/source/Image
|
||||
*/
|
||||
import {ENABLE_RASTER_REPROJECTION, inherits} from '../index.js';
|
||||
import {ENABLE_RASTER_REPROJECTION} from '../reproj/common.js';
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_ImageState_ from '../ImageState.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
import _ol_events_Event_ from '../events/Event.js';
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
* @module ol/source/ImageWMS
|
||||
*/
|
||||
|
||||
import {DEFAULT_WMS_VERSION, inherits} from '../index.js';
|
||||
import {DEFAULT_WMS_VERSION} from './common.js';
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_Image_ from '../Image.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import _ol_events_ from '../events.js';
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* @module ol/source/TileImage
|
||||
*/
|
||||
import {ENABLE_RASTER_REPROJECTION, getUid, inherits} from '../index.js';
|
||||
import {ENABLE_RASTER_REPROJECTION} from '../reproj/common.js';
|
||||
import {getUid, inherits} from '../index.js';
|
||||
import _ol_ImageTile_ from '../ImageTile.js';
|
||||
import _ol_TileCache_ from '../TileCache.js';
|
||||
import _ol_TileState_ from '../TileState.js';
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
* @module ol/source/TileWMS
|
||||
*/
|
||||
|
||||
import {DEFAULT_WMS_VERSION, inherits} from '../index.js';
|
||||
import {DEFAULT_WMS_VERSION} from './common.js';
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import _ol_extent_ from '../extent.js';
|
||||
import _ol_obj_ from '../obj.js';
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* @module ol/source/Zoomify
|
||||
*/
|
||||
import {DEFAULT_TILE_SIZE, inherits} from '../index.js';
|
||||
import {DEFAULT_TILE_SIZE} from '../tilegrid/common.js';
|
||||
import {inherits} from '../index.js';
|
||||
import _ol_ImageTile_ from '../ImageTile.js';
|
||||
import _ol_TileState_ from '../TileState.js';
|
||||
import _ol_TileUrlFunction_ from '../TileUrlFunction.js';
|
||||
|
||||
4
src/ol/source/common.js
Normal file
4
src/ol/source/common.js
Normal file
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @type {string} Default WMS version.
|
||||
*/
|
||||
export var DEFAULT_WMS_VERSION = '1.3.0';
|
||||
@@ -1,9 +1,21 @@
|
||||
/**
|
||||
* @module ol/style/AtlasManager
|
||||
*/
|
||||
import {INITIAL_ATLAS_SIZE, MAX_ATLAS_SIZE, WEBGL_MAX_TEXTURE_SIZE, nullFunction} from '../index.js';
|
||||
import {WEBGL_MAX_TEXTURE_SIZE, nullFunction} from '../index.js';
|
||||
import _ol_style_Atlas_ from '../style/Atlas.js';
|
||||
|
||||
|
||||
/**
|
||||
* @type {number} The size in pixels of the first atlas image.
|
||||
*/
|
||||
var INITIAL_ATLAS_SIZE = 256;
|
||||
|
||||
/**
|
||||
* @type {number} The maximum size in pixels of atlas images.
|
||||
*/
|
||||
var MAX_ATLAS_SIZE = -1;
|
||||
|
||||
|
||||
/**
|
||||
* Manages the creation of image atlases.
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/tilegrid
|
||||
*/
|
||||
import {DEFAULT_MAX_ZOOM, DEFAULT_TILE_SIZE} from './index.js';
|
||||
import {DEFAULT_MAX_ZOOM, DEFAULT_TILE_SIZE} from './tilegrid/common.js';
|
||||
import _ol_size_ from './size.js';
|
||||
import _ol_extent_ from './extent.js';
|
||||
import _ol_extent_Corner_ from './extent/Corner.js';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/tilegrid/TileGrid
|
||||
*/
|
||||
import {DEFAULT_TILE_SIZE} from '../index.js';
|
||||
import {DEFAULT_TILE_SIZE} from './common.js';
|
||||
import _ol_asserts_ from '../asserts.js';
|
||||
import _ol_TileRange_ from '../TileRange.js';
|
||||
import _ol_array_ from '../array.js';
|
||||
|
||||
9
src/ol/tilegrid/common.js
Normal file
9
src/ol/tilegrid/common.js
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* @type {number} Default maximum zoom for default tile grids.
|
||||
*/
|
||||
export var DEFAULT_MAX_ZOOM = 42;
|
||||
|
||||
/**
|
||||
* @type {number} Default tile size.
|
||||
*/
|
||||
export var DEFAULT_TILE_SIZE = 256;
|
||||
@@ -1,4 +1,4 @@
|
||||
import {DEFAULT_TILE_SIZE} from '../../../../src/ol/index.js';
|
||||
import {DEFAULT_TILE_SIZE} from '../../../../src/ol/tilegrid/common.js';
|
||||
import _ol_events_ from '../../../../src/ol/events.js';
|
||||
import _ol_proj_Projection_ from '../../../../src/ol/proj/Projection.js';
|
||||
import _ol_source_Zoomify_ from '../../../../src/ol/source/Zoomify.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {DEFAULT_MAX_ZOOM, DEFAULT_TILE_SIZE} from '../../../../src/ol/index.js';
|
||||
import {DEFAULT_MAX_ZOOM, DEFAULT_TILE_SIZE} from '../../../../src/ol/tilegrid/common.js';
|
||||
import _ol_TileRange_ from '../../../../src/ol/TileRange.js';
|
||||
import _ol_extent_ from '../../../../src/ol/extent.js';
|
||||
import _ol_proj_ from '../../../../src/ol/proj.js';
|
||||
|
||||
Reference in New Issue
Block a user