Fix enum types

This commit is contained in:
ahocevar
2018-04-21 10:48:38 +02:00
parent 417dd85f83
commit c23a5086ae
20 changed files with 87 additions and 50 deletions

View File

@@ -25,7 +25,7 @@ const Property = {
* @constructor
* @extends {module:ol/events/Event~Event}
* @implements {oli.CollectionEvent}
* @param {module:ol/CollectionEventType~CollectionEventType} type Type.
* @param {module:ol/CollectionEventType} type Type.
* @param {*=} opt_element Element.
*/
export const CollectionEvent = function(type, opt_element) {

View File

@@ -605,7 +605,7 @@ Graticule.prototype.getParallels = function() {
/**
* @param {module:ol/render/Event~Event} e Event.
* @param {module:ol/render/Event~RenderEvent} e Event.
* @private
*/
Graticule.prototype.handlePostCompose_ = function(e) {

View File

@@ -62,8 +62,8 @@ import CanvasVectorTileLayerRenderer from './renderer/canvas/VectorTileLayer.js'
* @param {module:ol/PluggableMap~MapOptions} options Map options.
* @fires module:ol/MapBrowserEvent~MapBrowserEvent
* @fires module:ol/MapEvent~MapEvent
* @fires module:ol/render/Event~Event#postcompose
* @fires module:ol/render/Event~Event#precompose
* @fires module:ol/render/Event~RenderEvent#postcompose
* @fires module:ol/render/Event~RenderEvent#precompose
* @api
*/
const Map = function(options) {

View File

@@ -136,8 +136,8 @@ import {create as createTransform, apply as applyTransform} from './transform.js
* @param {module:ol/PluggableMap~MapOptions} options Map options.
* @fires module:ol/MapBrowserEvent~MapBrowserEvent
* @fires module:ol/MapEvent~MapEvent
* @fires module:ol/render/Event~Event#postcompose
* @fires module:ol/render/Event~Event#precompose
* @fires module:ol/render/Event~RenderEvent#postcompose
* @fires module:ol/render/Event~RenderEvent#precompose
* @api
*/
const PluggableMap = function(options) {

View File

@@ -62,8 +62,8 @@ import WebGLVectorLayerRenderer from './renderer/webgl/VectorLayer.js';
* @param {module:ol/PluggableMap~MapOptions} options Map options.
* @fires module:ol/MapBrowserEvent~MapBrowserEvent
* @fires module:ol/MapEvent~MapEvent
* @fires module:ol/render/Event~Event#postcompose
* @fires module:ol/render/Event~Event#precompose
* @fires module:ol/render/Event~RenderEvent#postcompose
* @fires module:ol/render/Event~RenderEvent#precompose
* @api
*/
const WebGLMap = function(options) {

View File

@@ -24,7 +24,7 @@ import {get as getProjection} from '../proj.js';
/**
* @const
* @type {Object.<module:ol/geom/GeometryType~GeometryType, function(EsriJSONGeometry): module:ol/geom/Geometry~Geometry>}
* @type {Object.<module:ol/geom/GeometryType, function(EsriJSONGeometry): module:ol/geom/Geometry~Geometry>}
*/
const GEOMETRY_READERS = {};
GEOMETRY_READERS[GeometryType.POINT] = readPointGeometry;
@@ -90,7 +90,7 @@ function readGeometry(object, opt_options) {
if (!object) {
return null;
}
/** @type {module:ol/geom/GeometryType~GeometryType} */
/** @type {module:ol/geom/GeometryType} */
let type;
if (typeof object.x === 'number' && typeof object.y === 'number') {
type = GeometryType.POINT;

View File

@@ -125,7 +125,7 @@ FeatureFormat.prototype.getLastExtent = function() {
/**
* @abstract
* @return {module:ol/format/FormatType~FormatType} Format.
* @return {module:ol/format/FormatType} Format.
*/
FeatureFormat.prototype.getType = function() {};

View File

@@ -24,7 +24,7 @@ import RenderFeature from '../render/Feature.js';
/**
* @typedef {Object} Options
* @property {function((module:ol/geom/Geometry~Geometry|Object.<string,*>)=)|function(module:ol/geom/GeometryType~GeometryType,Array.<number>,(Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)} [featureClass]
* @property {function((module:ol/geom/Geometry~Geometry|Object.<string,*>)=)|function(module:ol/geom/GeometryType,Array.<number>,(Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)} [featureClass]
* Class for features returned by {@link ol.format.MVT#readFeatures}. Set to
* {@link module:ol/Feature~Feature} to get full editing and geometry support at the cost of
* decreased rendering performance. The default is {@link module:ol/render/Feature~RenderFeature},
@@ -64,7 +64,7 @@ const MVT = function(opt_options) {
/**
* @private
* @type {function((module:ol/geom/Geometry~Geometry|Object.<string,*>)=)|
* function(module:ol/geom/GeometryType~GeometryType,Array.<number>,
* function(module:ol/geom/GeometryType,Array.<number>,
* (Array.<number>|Array.<Array.<number>>),Object.<string,*>,number)}
*/
this.featureClass_ = options.featureClass ?
@@ -272,10 +272,10 @@ MVT.prototype.readRawGeometry_ = function(pbf, feature, flatCoordinates, ends) {
* @param {number} type The raw feature's geometry type
* @param {number} numEnds Number of ends of the flat coordinates of the
* geometry.
* @return {module:ol/geom/GeometryType~GeometryType} The geometry type.
* @return {module:ol/geom/GeometryType} The geometry type.
*/
function getGeometryType(type, numEnds) {
/** @type {module:ol/geom/GeometryType~GeometryType} */
/** @type {module:ol/geom/GeometryType} */
let geometryType;
if (type === 1) {
geometryType = numEnds === 1 ?

View File

@@ -10,6 +10,7 @@ import {get as getProjection, getTransform} from '../proj.js';
import Units from '../proj/Units.js';
import {create as createTransform, compose as composeTransform} from '../transform.js';
/**
* @classdesc
* Abstract base class; normally only used for creating subclasses and not
@@ -203,7 +204,7 @@ Geometry.prototype.getSimplifiedGeometry = function(squaredTolerance) {};
/**
* Get the type of this geometry.
* @abstract
* @return {module:ol/geom/GeometryType~GeometryType} Geometry type.
* @return {module:ol/geom/GeometryType} Geometry type.
*/
Geometry.prototype.getType = function() {};

View File

@@ -31,7 +31,7 @@ import {createEditingStyle} from '../style/Style.js';
/**
* @typedef {Object} Options
* @property {module:ol/geom/GeometryType~GeometryType} type Geometry type of
* @property {module:ol/geom/GeometryType} type Geometry type of
* the geometries being drawn with this instance.
* @property {number} [clickTolerance=6] The maximum distance in pixels between
* "down" and "up" for a "up" event to be considered a "click" event and
@@ -222,10 +222,10 @@ const Draw = function(options) {
/**
* Geometry type.
* @type {module:ol/geom/GeometryType~GeometryType}
* @type {module:ol/geom/GeometryType}
* @private
*/
this.type_ = /** @type {module:ol/geom/GeometryType~GeometryType} */ (options.type);
this.type_ = /** @type {module:ol/geom/GeometryType} */ (options.type);
/**
* Drawing mode (derived from geometry type.
@@ -1008,7 +1008,7 @@ export function createBox() {
/**
* Get the drawing mode. The mode for mult-part geometries is the same as for
* their single-part cousins.
* @param {module:ol/geom/GeometryType~GeometryType} type Geometry type.
* @param {module:ol/geom/GeometryType} type Geometry type.
* @return {module:ol/interaction/Draw~Mode} Drawing mode.
*/
function getMode(type) {

View File

@@ -23,12 +23,12 @@ import {createEditingStyle} from '../style/Style.js';
* initial extent.
* @property {module:ol/style/Style~Style|Array.<module:ol/style/Style~Style>|module:ol/style~StyleFunction} [boxStyle]
* Style for the drawn extent box. Defaults to
* {@link module:ol/style/Style~createEditing()[module:ol/geom/GeometryType~GeometryType.POLYGON]}
* {@link module:ol/style/Style~createEditing()[module:ol/geom/GeometryType.POLYGON]}
* @property {number} [pixelTolerance=10] Pixel tolerance for considering the
* pointer close enough to a segment or vertex for editing.
* @property {module:ol/style/Style~Style|Array.<module:ol/style/Style~Style>|module:ol/style~StyleFunction} [pointerStyle]
* Style for the cursor used to draw the extent. Defaults to
* {@link module:ol/style/Style~createEditing()[module:ol/geom/GeometryType~GeometryType.POINT]}
* {@link module:ol/style/Style~createEditing()[module:ol/geom/GeometryType.POINT]}
* @property {boolean} [wrapX=false] Wrap the drawn extent across multiple maps
* in the X direction? Only affects visuals, not functionality.
*/

View File

@@ -69,7 +69,7 @@ const BaseLayer = function(options) {
/**
* The layer type.
* @type {module:ol/LayerType~LayerType}
* @type {module:ol/LayerType}
* @protected;
*/
this.type;
@@ -81,7 +81,7 @@ inherits(BaseLayer, BaseObject);
/**
* Get the layer type (used when creating a layer renderer).
* @return {module:ol/LayerType~LayerType} The layer type.
* @return {module:ol/LayerType} The layer type.
*/
BaseLayer.prototype.getType = function() {
return this.type;

View File

@@ -47,7 +47,7 @@ const ImageLayer = function(opt_options) {
/**
* The layer type.
* @protected
* @type {module:ol/LayerType~LayerType}
* @type {module:ol/LayerType}
*/
this.type = LayerType.IMAGE;

View File

@@ -61,7 +61,7 @@ const TileLayer = function(opt_options) {
/**
* The layer type.
* @protected
* @type {module:ol/LayerType~LayerType}
* @type {module:ol/LayerType}
*/
this.type = LayerType.TILE;

View File

@@ -27,7 +27,7 @@ import {createDefaultStyle, toFunction as toStyleFunction} from '../style/Style.
* @property {number} [renderBuffer=100] The buffer in pixels around the viewport extent used by the
* renderer when getting features from the vector source for the rendering or hit-detection.
* Recommended value: the size of the largest symbol, line width or label.
* @property {module:ol/layer/VectorRenderType~VectorRenderType|string} [renderMode='vector'] Render mode for vector layers:
* @property {module:ol/layer/VectorRenderType|string} [renderMode='vector'] Render mode for vector layers:
* * `'image'`: Vector layers are rendered as images. Great performance, but point symbols and
* texts are always rotated with the view and pixels are scaled during zoom animations.
* * `'vector'`: Vector layers are rendered as vectors. Most accurate rendering even during
@@ -52,6 +52,22 @@ import {createDefaultStyle, toFunction as toStyleFunction} from '../style/Style.
*/
/**
* @enum {string}
* Render mode for vector layers:
* * `'image'`: Vector layers are rendered as images. Great performance, but
* point symbols and texts are always rotated with the view and pixels are
* scaled during zoom animations.
* * `'vector'`: Vector layers are rendered as vectors. Most accurate rendering
* even during animations, but slower performance.
* @api
*/
export const RenderType = {
IMAGE: 'image',
VECTOR: 'vector'
};
/**
* @enum {string}
* @private
@@ -138,7 +154,7 @@ const VectorLayer = function(opt_options) {
/**
* The layer type.
* @protected
* @type {module:ol/LayerType~LayerType}
* @type {module:ol/LayerType}
*/
this.type = LayerType.VECTOR;
@@ -258,7 +274,7 @@ VectorLayer.prototype.setStyle = function(style) {
/**
* @return {module:ol/layer/VectorRenderType~VectorRenderType|string} The render mode.
* @return {module:ol/layer/VectorRenderType|string} The render mode.
*/
VectorLayer.prototype.getRenderMode = function() {
return this.renderMode_;

View File

@@ -10,6 +10,26 @@ import VectorTileRenderType from '../layer/VectorTileRenderType.js';
import {assign} from '../obj.js';
/**
* @enum {string}
* Render mode for vector tiles:
* * `'image'`: Vector tiles are rendered as images. Great performance, but
* point symbols and texts are always rotated with the view and pixels are
* scaled during zoom animations.
* * `'hybrid'`: Polygon and line elements are rendered as images, so pixels
* are scaled during zoom animations. Point symbols and texts are accurately
* rendered as vectors and can stay upright on rotated views.
* * `'vector'`: Vector tiles are rendered as vectors. Most accurate rendering
* even during animations, but slower performance than the other options.
* @api
*/
export const RenderType = {
IMAGE: 'image',
HYBRID: 'hybrid',
VECTOR: 'vector'
};
/**
* @typedef {Object} Options
* @property {number} [opacity=1] Opacity (0, 1).
@@ -30,7 +50,7 @@ import {assign} from '../obj.js';
* Recommended value: Vector tiles are usually generated with a buffer, so this value should match
* the largest possible buffer of the used tiles. It should be at least the size of the largest
* point symbol or line width.
* @property {module:ol/layer/VectorRenderType~VectorRenderType|string} [renderMode='hybrid'] Render mode for vector tiles:
* @property {module:ol/layer/VectorTileRenderType|string} [renderMode='hybrid'] Render mode for vector tiles:
* * `'image'`: Vector tiles are rendered as images. Great performance, but point symbols and texts
* are always rotated with the view and pixels are scaled during zoom animations.
* * `'hybrid'`: Polygon and line elements are rendered as images, so pixels are scaled during zoom
@@ -71,7 +91,7 @@ import {assign} from '../obj.js';
/**
* @classdesc
* Layer for vector tile data that is rendered client-side.
* Note that any property set in the options is set as a {@link }
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
@@ -107,7 +127,7 @@ const VectorTileLayer = function(opt_options) {
/**
* The layer type.
* @protected
* @type {module:ol/LayerType~LayerType}
* @type {module:ol/LayerType}
*/
this.type = LayerType.VECTOR_TILE;

View File

@@ -17,7 +17,7 @@ import {create as createTransform, compose as composeTransform} from '../transfo
* through the API is limited to getting the type and extent of the geometry.
*
* @constructor
* @param {module:ol/geom/GeometryType~GeometryType} type Geometry type.
* @param {module:ol/geom/GeometryType} type Geometry type.
* @param {Array.<number>} flatCoordinates Flat coordinates. These always need
* to be right-handed for polygons.
* @param {Array.<number>|Array.<Array.<number>>} ends Ends or Endss.
@@ -39,7 +39,7 @@ const RenderFeature = function(type, flatCoordinates, ends, properties, id) {
/**
* @private
* @type {module:ol/geom/GeometryType~GeometryType}
* @type {module:ol/geom/GeometryType}
*/
this.type_ = type;
@@ -249,7 +249,7 @@ RenderFeature.prototype.getStyleFunction = UNDEFINED;
/**
* Get the type of this feature's geometry.
* @return {module:ol/geom/GeometryType~GeometryType} Geometry type.
* @return {module:ol/geom/GeometryType} Geometry type.
* @api
*/
RenderFeature.prototype.getType = function() {

View File

@@ -16,7 +16,7 @@ const SIMPLIFY_TOLERANCE = 0.5;
/**
* @const
* @type {Object.<module:ol/geom/GeometryType~GeometryType,
* @type {Object.<module:ol/geom/GeometryType,
* function(module:ol/render/ReplayGroup~ReplayGroup, module:ol/geom/Geometry~Geometry,
* module:ol/style/Style~Style, Object)>}
*/

View File

@@ -380,10 +380,10 @@ export function createDefaultStyle(feature, resolution) {
/**
* Default styles for editing features.
* @return {Object.<module:ol/geom/GeometryType~GeometryType, Array.<module:ol/style/Style~Style>>} Styles
* @return {Object.<module:ol/geom/GeometryType, Array.<module:ol/style/Style~Style>>} Styles
*/
export function createEditingStyle() {
/** @type {Object.<module:ol/geom/GeometryType~GeometryType, Array.<module:ol/style/Style~Style>>} */
/** @type {Object.<module:ol/geom/GeometryType, Array.<module:ol/style/Style~Style>>} */
const styles = {};
const white = [255, 255, 255, 1];
const blue = [0, 153, 255, 1];

View File

@@ -28,16 +28,16 @@
* var white = [255, 255, 255, 1];
* var blue = [0, 153, 255, 1];
* var width = 3;
* styles[module:ol/geom/GeometryType~GeometryType.POLYGON] = [
* styles[module:ol/geom/GeometryType.POLYGON] = [
* new ol.style.Style({
* fill: new ol.style.Fill({
* color: [255, 255, 255, 0.5]
* })
* })
* ];
* styles[module:ol/geom/GeometryType~GeometryType.MULTI_POLYGON] =
* styles[module:ol/geom/GeometryType~GeometryType.POLYGON];
* styles[module:ol/geom/GeometryType~GeometryType.LINE_STRING] = [
* styles[module:ol/geom/GeometryType.MULTI_POLYGON] =
* styles[module:ol/geom/GeometryType.POLYGON];
* styles[module:ol/geom/GeometryType.LINE_STRING] = [
* new ol.style.Style({
* stroke: new ol.style.Stroke({
* color: white,
@@ -51,9 +51,9 @@
* })
* })
* ];
* styles[module:ol/geom/GeometryType~GeometryType.MULTI_LINE_STRING] =
* styles[module:ol/geom/GeometryType~GeometryType.LINE_STRING];
* styles[module:ol/geom/GeometryType~GeometryType.POINT] = [
* styles[module:ol/geom/GeometryType.MULTI_LINE_STRING] =
* styles[module:ol/geom/GeometryType.LINE_STRING];
* styles[module:ol/geom/GeometryType.POINT] = [
* new ol.style.Style({
* image: new ol.style.Circle({
* radius: width * 2,
@@ -68,11 +68,11 @@
* zIndex: Infinity
* })
* ];
* styles[module:ol/geom/GeometryType~GeometryType.MULTI_POINT] =
* styles[module:ol/geom/GeometryType~GeometryType.POINT];
* styles[module:ol/geom/GeometryType~GeometryType.GEOMETRY_COLLECTION] =
* styles[module:ol/geom/GeometryType~GeometryType.POLYGON].concat(
* styles[module:ol/geom/GeometryType~GeometryType.POINT]
* styles[module:ol/geom/GeometryType.MULTI_POINT] =
* styles[module:ol/geom/GeometryType.POINT];
* styles[module:ol/geom/GeometryType.GEOMETRY_COLLECTION] =
* styles[module:ol/geom/GeometryType.POLYGON].concat(
* styles[module:ol/geom/GeometryType.POINT]
* );
*```
*