diff --git a/bin/generate-exports.py b/bin/generate-exports.py index 09ccfdc2ab..64b4a67de1 100755 --- a/bin/generate-exports.py +++ b/bin/generate-exports.py @@ -199,10 +199,43 @@ def main(argv): objects = {} requires = set() for arg in args: + in_comment = False + object_literal = None for line in open(arg): line = line.strip() if not line: continue + if line == '/**': + assert not in_comment + in_comment = True + continue + if line == '*/': + assert in_comment + in_comment = False + object_literal = None + continue + if in_comment: + if not line.startswith('*'): + raise RuntimeError(line) # malformed comment + m = re.match(r'\*\s*@typedef\s*\{Object\}\s*(?P\S+)', line) + if m: + assert object_literal is None + name = m.group('name') + if name in objects: + raise RuntimeError(line) # Name already defined + object_literal = ObjectLiteral(name) + objects[name] = object_literal + continue + m = re.match(r'\*\s*@property\s*{(?P.*)}\s*(?P\S+)', line) + if m: + assert object_literal is not None + prop = m.group('prop') + if prop in object_literal.prop_types: + raise RuntimeError(line) # Duplicate property + type = m.group('type') + object_literal.prop_types[prop] = type + continue + continue m = re.match(r'@exportClass\s+(?P\S+)(?:\s+(?P\S+))?\Z', line) if m: name = m.group('name') @@ -215,27 +248,6 @@ def main(argv): klass = Class(name, object_literal, objects) objects[name] = klass continue - m = re.match(r'@exportObjectLiteral\s+(?P\S+)\Z', line) - if m: - name = m.group('name') - if name in objects: - raise RuntimeError(line) # Name already defined - object_literal = ObjectLiteral(name) - objects[name] = object_literal - continue - m = re.match(r'@exportObjectLiteralProperty\s+(?P\S+)\s+(?P\S+)\Z', line) - if m: - components = m.group('prop').split('.') - name = '.'.join(components[:-1]) - if not name in objects: - raise RuntimeError(line) # Undefined object literal - object_literal = objects[name] - prop = components[-1] - if prop in object_literal.prop_types: - raise RuntimeError(line) # Duplicate property - type = m.group('type') - object_literal.prop_types[prop] = type - continue m = re.match(r'@exportProperty\s+(?P\S+)\Z', line) if m: components = m.group('prop').split('.') diff --git a/build.py b/build.py index 16f066ec35..ec71b6182a 100755 --- a/build.py +++ b/build.py @@ -89,8 +89,7 @@ EXECUTABLES = [variables.GIT, variables.GJSLINT, variables.JAVA, variables.JAR, EXPORTS = [path for path in ifind('src') - if path.endswith('.exports') - if path != 'src/objectliterals.exports'] + if path.endswith('.exports')] EXTERNAL_SRC = [ 'build/src/external/externs/types.js', @@ -212,24 +211,24 @@ def build_ol_all_js(t): @target('build/src/external/externs/types.js', 'bin/generate-exports.py', - 'src/objectliterals.exports') + 'src/objectliterals.jsdoc') def build_src_external_externs_types_js(t): t.output('%(PYTHON)s', 'bin/generate-exports.py', - '--externs', 'src/objectliterals.exports') + '--externs', 'src/objectliterals.jsdoc') @target('build/src/external/src/exports.js', 'bin/generate-exports.py', - 'src/objectliterals.exports', EXPORTS) + 'src/objectliterals.jsdoc', EXPORTS) def build_src_external_src_exports_js(t): t.output('%(PYTHON)s', 'bin/generate-exports.py', - '--exports', 'src/objectliterals.exports', EXPORTS) + '--exports', 'src/objectliterals.jsdoc', EXPORTS) @target('build/src/external/src/types.js', 'bin/generate-exports.py', - 'src/objectliterals.exports') + 'src/objectliterals.jsdoc') def build_src_external_src_types_js(t): t.output('%(PYTHON)s', 'bin/generate-exports.py', - '--typedef', 'src/objectliterals.exports') + '--typedef', 'src/objectliterals.jsdoc') if os.path.exists(TEMPLATE_GLSL_COMPILER_JS): @@ -268,10 +267,10 @@ def build_test_requireall_js(t): @target('build/src/internal/src/types.js', 'bin/generate-exports.py', - 'src/objectliterals.exports') + 'src/objectliterals.jsdoc') def build_src_internal_types_js(t): t.output('%(PYTHON)s', 'bin/generate-exports.py', - '--typedef', 'src/objectliterals.exports') + '--typedef', 'src/objectliterals.jsdoc') virtual('build-examples', 'examples', EXAMPLES_COMBINED) diff --git a/src/objectliterals.exports b/src/objectliterals.exports deleted file mode 100644 index a642af2c39..0000000000 --- a/src/objectliterals.exports +++ /dev/null @@ -1,271 +0,0 @@ -@exportObjectLiteral ol.MapOptions -@exportObjectLiteralProperty ol.MapOptions.controls Array.|undefined -@exportObjectLiteralProperty ol.MapOptions.interactions ol.Collection|undefined -@exportObjectLiteralProperty ol.MapOptions.layers Array.|ol.Collection|undefined -@exportObjectLiteralProperty ol.MapOptions.renderer ol.RendererHint|undefined -@exportObjectLiteralProperty ol.MapOptions.renderers Array.|undefined -@exportObjectLiteralProperty ol.MapOptions.target Element|string -@exportObjectLiteralProperty ol.MapOptions.view ol.IView|undefined - -@exportObjectLiteral ol.OverlayOptions -@exportObjectLiteralProperty ol.OverlayOptions.element Element|undefined -@exportObjectLiteralProperty ol.OverlayOptions.map ol.Map|undefined -@exportObjectLiteralProperty ol.OverlayOptions.position ol.Coordinate|undefined -@exportObjectLiteralProperty ol.OverlayOptions.positioning ol.OverlayPositioning|undefined - -@exportObjectLiteral ol.Proj4jsProjectionOptions -@exportObjectLiteralProperty ol.Proj4jsProjectionOptions.code string -@exportObjectLiteralProperty ol.Proj4jsProjectionOptions.extent ol.Extent -@exportObjectLiteralProperty ol.Proj4jsProjectionOptions.global boolean|undefined - -@exportObjectLiteral ol.ProjectionOptions -@exportObjectLiteralProperty ol.ProjectionOptions.code string -@exportObjectLiteralProperty ol.ProjectionOptions.units ol.ProjectionUnits -@exportObjectLiteralProperty ol.ProjectionOptions.extent ol.Extent -@exportObjectLiteralProperty ol.ProjectionOptions.axisOrientation string|undefined -@exportObjectLiteralProperty ol.ProjectionOptions.global boolean|undefined - -@exportObjectLiteral ol.View2DOptions -@exportObjectLiteralProperty ol.View2DOptions.center ol.Coordinate|undefined -@exportObjectLiteralProperty ol.View2DOptions.maxResolution number|undefined -@exportObjectLiteralProperty ol.View2DOptions.numZoomLevels number|undefined -@exportObjectLiteralProperty ol.View2DOptions.projection ol.ProjectionLike -@exportObjectLiteralProperty ol.View2DOptions.resolution number|undefined -@exportObjectLiteralProperty ol.View2DOptions.resolutions Array.|undefined -@exportObjectLiteralProperty ol.View2DOptions.rotation number|undefined -@exportObjectLiteralProperty ol.View2DOptions.zoom number|undefined -@exportObjectLiteralProperty ol.View2DOptions.zoomFactor number|undefined - -@exportObjectLiteral ol.animation.BounceOptions -@exportObjectLiteralProperty ol.animation.BounceOptions.resolution number -@exportObjectLiteralProperty ol.animation.BounceOptions.start number|undefined -@exportObjectLiteralProperty ol.animation.BounceOptions.duration number|undefined -@exportObjectLiteralProperty ol.animation.BounceOptions.easing function(number):number|undefined - -@exportObjectLiteral ol.animation.PanOptions -@exportObjectLiteralProperty ol.animation.PanOptions.source ol.Coordinate -@exportObjectLiteralProperty ol.animation.PanOptions.start number|undefined -@exportObjectLiteralProperty ol.animation.PanOptions.duration number|undefined -@exportObjectLiteralProperty ol.animation.PanOptions.easing function(number):number|undefined - -@exportObjectLiteral ol.animation.RotateOptions -@exportObjectLiteralProperty ol.animation.RotateOptions.rotation number -@exportObjectLiteralProperty ol.animation.RotateOptions.start number|undefined -@exportObjectLiteralProperty ol.animation.RotateOptions.duration number|undefined -@exportObjectLiteralProperty ol.animation.RotateOptions.easing function(number):number|undefined - -@exportObjectLiteral ol.animation.ZoomOptions -@exportObjectLiteralProperty ol.animation.ZoomOptions.resolution number -@exportObjectLiteralProperty ol.animation.ZoomOptions.start number|undefined -@exportObjectLiteralProperty ol.animation.ZoomOptions.duration number|undefined -@exportObjectLiteralProperty ol.animation.ZoomOptions.easing function(number):number|undefined - -@exportObjectLiteral ol.control.AttributionOptions -@exportObjectLiteralProperty ol.control.AttributionOptions.map ol.Map|undefined -@exportObjectLiteralProperty ol.control.AttributionOptions.target Element|undefined - -@exportObjectLiteral ol.control.DefaultsOptions -@exportObjectLiteralProperty ol.control.DefaultsOptions.attribution boolean|undefined -@exportObjectLiteralProperty ol.control.DefaultsOptions.attributionOptions ol.control.AttributionOptions|undefined -@exportObjectLiteralProperty ol.control.DefaultsOptions.logo boolean|undefined -@exportObjectLiteralProperty ol.control.DefaultsOptions.logoOptions ol.control.LogoOptions|undefined -@exportObjectLiteralProperty ol.control.DefaultsOptions.zoom boolean|undefined -@exportObjectLiteralProperty ol.control.DefaultsOptions.zoomOptions ol.control.ZoomOptions|undefined - -@exportObjectLiteral ol.control.LogoOptions -@exportObjectLiteralProperty ol.control.LogoOptions.map ol.Map|undefined -@exportObjectLiteralProperty ol.control.LogoOptions.target Element|undefined - -@exportObjectLiteral ol.control.MousePositionOptions -@exportObjectLiteralProperty ol.control.MousePositionOptions.coordinateFormat ol.CoordinateFormatType|undefined -@exportObjectLiteralProperty ol.control.MousePositionOptions.map ol.Map|undefined -@exportObjectLiteralProperty ol.control.MousePositionOptions.projection ol.ProjectionLike -@exportObjectLiteralProperty ol.control.MousePositionOptions.target Element|undefined -@exportObjectLiteralProperty ol.control.MousePositionOptions.undefinedHTML string|undefined - -@exportObjectLiteral ol.control.ScaleLineOptions -@exportObjectLiteralProperty ol.control.ScaleLineOptions.map ol.Map|undefined -@exportObjectLiteralProperty ol.control.ScaleLineOptions.minWidth number|undefined -@exportObjectLiteralProperty ol.control.ScaleLineOptions.target Element|undefined -@exportObjectLiteralProperty ol.control.ScaleLineOptions.units ol.control.ScaleLineUnits|undefined - -@exportObjectLiteral ol.control.ZoomOptions -@exportObjectLiteralProperty ol.control.ZoomOptions.delta number|undefined -@exportObjectLiteralProperty ol.control.ZoomOptions.map ol.Map|undefined -@exportObjectLiteralProperty ol.control.ZoomOptions.target Element|undefined - -@exportObjectLiteral ol.control.ZoomSliderOptions -@exportObjectLiteralProperty ol.control.ZoomSliderOptions.map ol.Map|undefined -@exportObjectLiteralProperty ol.control.ZoomSliderOptions.maxResolution number|undefined -@exportObjectLiteralProperty ol.control.ZoomSliderOptions.minResolution number|undefined - -@exportObjectLiteral ol.interaction.DefaultsOptions -@exportObjectLiteralProperty ol.interaction.DefaultsOptions.doubleClickZoom boolean|undefined -@exportObjectLiteralProperty ol.interaction.DefaultsOptions.dragPan boolean|undefined -@exportObjectLiteralProperty ol.interaction.DefaultsOptions.keyboard boolean|undefined -@exportObjectLiteralProperty ol.interaction.DefaultsOptions.mouseWheelZoom boolean|undefined -@exportObjectLiteralProperty ol.interaction.DefaultsOptions.shiftDragZoom boolean|undefined -@exportObjectLiteralProperty ol.interaction.DefaultsOptions.touchPan boolean|undefined -@exportObjectLiteralProperty ol.interaction.DefaultsOptions.touchRotate boolean|undefined -@exportObjectLiteralProperty ol.interaction.DefaultsOptions.touchZoom boolean|undefined - -@exportObjectLiteral ol.interaction.KeyboardPanOptions -@exportObjectLiteralProperty ol.interaction.KeyboardPanOptions.pixelDelta number|undefined - -@exportObjectLiteral ol.interaction.KeyboardZoomOptions -@exportObjectLiteralProperty ol.interaction.KeyboardZoomOptions.delta number|undefined - -@exportObjectLiteral ol.layer.LayerOptions -@exportObjectLiteralProperty ol.layer.LayerOptions.brightness number|undefined -@exportObjectLiteralProperty ol.layer.LayerOptions.contrast number|undefined -@exportObjectLiteralProperty ol.layer.LayerOptions.hue number|undefined -@exportObjectLiteralProperty ol.layer.LayerOptions.opacity number|undefined -@exportObjectLiteralProperty ol.layer.LayerOptions.saturation number|undefined -@exportObjectLiteralProperty ol.layer.LayerOptions.source ol.source.Source -@exportObjectLiteralProperty ol.layer.LayerOptions.visible boolean|undefined - -@exportObjectLiteral ol.layer.TileLayerOptions -@exportObjectLiteralProperty ol.layer.TileLayerOptions.brightness number|undefined -@exportObjectLiteralProperty ol.layer.TileLayerOptions.contrast number|undefined -@exportObjectLiteralProperty ol.layer.TileLayerOptions.hue number|undefined -@exportObjectLiteralProperty ol.layer.TileLayerOptions.opacity number|undefined -@exportObjectLiteralProperty ol.layer.TileLayerOptions.preload number|undefined -@exportObjectLiteralProperty ol.layer.TileLayerOptions.saturation number|undefined -@exportObjectLiteralProperty ol.layer.TileLayerOptions.source ol.source.Source -@exportObjectLiteralProperty ol.layer.TileLayerOptions.visible boolean|undefined - -@exportObjectLiteral ol.layer.VectorLayerOptions -@exportObjectLiteralProperty ol.layer.VectorLayerOptions.opacity number|undefined -@exportObjectLiteralProperty ol.layer.VectorLayerOptions.source ol.source.Source -@exportObjectLiteralProperty ol.layer.VectorLayerOptions.style ol.style.Style|undefined -@exportObjectLiteralProperty ol.layer.VectorLayerOptions.visible boolean|undefined - -@exportObjectLiteral ol.source.BingMapsOptions -@exportObjectLiteralProperty ol.source.BingMapsOptions.culture string|undefined -@exportObjectLiteralProperty ol.source.BingMapsOptions.key string -@exportObjectLiteralProperty ol.source.BingMapsOptions.style string - -@exportObjectLiteral ol.source.DebugTileSourceOptions -@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.extent ol.Extent|undefined -@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.projection ol.ProjectionLike -@exportObjectLiteralProperty ol.source.DebugTileSourceOptions.tileGrid ol.tilegrid.TileGrid|undefined - -@exportObjectLiteral ol.source.OpenStreetMapOptions -@exportObjectLiteralProperty ol.source.OpenStreetMapOptions.attribution ol.Attribution|undefined -@exportObjectLiteralProperty ol.source.OpenStreetMapOptions.attributions Array.|undefined -@exportObjectLiteralProperty ol.source.OpenStreetMapOptions.maxZoom number|undefined -@exportObjectLiteralProperty ol.source.OpenStreetMapOptions.url string|undefined - -@exportObjectLiteral ol.source.SingleImageWMSOptions -@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.attributions Array.|undefined -@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.crossOrigin null|string|undefined -@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.extent ol.Extent|undefined -@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.params Object. -@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.projection ol.ProjectionLike -@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.ratio number|undefined -@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.resolutions Array.|undefined -@exportObjectLiteralProperty ol.source.SingleImageWMSOptions.url string|undefined - -@exportObjectLiteral ol.source.SourceOptions -@exportObjectLiteralProperty ol.source.SourceOptions.attributions Array.|undefined -@exportObjectLiteralProperty ol.source.SourceOptions.extent ol.Extent|undefined -@exportObjectLiteralProperty ol.source.SourceOptions.logo string|undefined -@exportObjectLiteralProperty ol.source.SourceOptions.projection ol.ProjectionLike - -@exportObjectLiteral ol.source.StamenOptions -@exportObjectLiteralProperty ol.source.StamenOptions.layer string -@exportObjectLiteralProperty ol.source.StamenOptions.minZoom number|undefined -@exportObjectLiteralProperty ol.source.StamenOptions.maxZoom number|undefined -@exportObjectLiteralProperty ol.source.StamenOptions.opaque boolean|undefined -@exportObjectLiteralProperty ol.source.StamenOptions.url string|undefined - -@exportObjectLiteral ol.source.StaticImageOptions -@exportObjectLiteralProperty ol.source.StaticImageOptions.attributions Array.|undefined -@exportObjectLiteralProperty ol.source.StaticImageOptions.crossOrigin null|string|undefined -@exportObjectLiteralProperty ol.source.StaticImageOptions.extent ol.Extent|undefined -@exportObjectLiteralProperty ol.source.StaticImageOptions.imageExtent ol.Extent|undefined -@exportObjectLiteralProperty ol.source.StaticImageOptions.imageSize ol.Size|undefined -@exportObjectLiteralProperty ol.source.StaticImageOptions.projection ol.ProjectionLike -@exportObjectLiteralProperty ol.source.StaticImageOptions.url string|undefined - -@exportObjectLiteral ol.source.TileJSONOptions -@exportObjectLiteralProperty ol.source.TileJSONOptions.crossOrigin null|string|undefined -@exportObjectLiteralProperty ol.source.TileJSONOptions.url string - -@exportObjectLiteral ol.source.TiledWMSOptions -@exportObjectLiteralProperty ol.source.TiledWMSOptions.attributions Array.|undefined -@exportObjectLiteralProperty ol.source.TiledWMSOptions.params Object -@exportObjectLiteralProperty ol.source.TiledWMSOptions.crossOrigin null|string|undefined -@exportObjectLiteralProperty ol.source.TiledWMSOptions.extent ol.Extent|undefined -@exportObjectLiteralProperty ol.source.TiledWMSOptions.tileGrid ol.tilegrid.TileGrid|undefined -@exportObjectLiteralProperty ol.source.TiledWMSOptions.maxZoom number|undefined -@exportObjectLiteralProperty ol.source.TiledWMSOptions.projection ol.ProjectionLike -@exportObjectLiteralProperty ol.source.TiledWMSOptions.url string|undefined -@exportObjectLiteralProperty ol.source.TiledWMSOptions.urls Array.|undefined - -@exportObjectLiteral ol.source.WMTSOptions -@exportObjectLiteralProperty ol.source.WMTSOptions.attributions Array.|undefined -@exportObjectLiteralProperty ol.source.WMTSOptions.crossOrigin string|null|undefined -@exportObjectLiteralProperty ol.source.WMTSOptions.extent ol.Extent|undefined -@exportObjectLiteralProperty ol.source.WMTSOptions.tileGrid ol.tilegrid.WMTS -@exportObjectLiteralProperty ol.source.WMTSOptions.projection ol.Projection|undefined -@exportObjectLiteralProperty ol.source.WMTSOptions.requestEncoding ol.source.WMTSRequestEncoding|undefined -@exportObjectLiteralProperty ol.source.WMTSOptions.layer string -@exportObjectLiteralProperty ol.source.WMTSOptions.style string -@exportObjectLiteralProperty ol.source.WMTSOptions.format string|undefined -@exportObjectLiteralProperty ol.source.WMTSOptions.matrixSet string -@exportObjectLiteralProperty ol.source.WMTSOptions.dimensions Object|undefined -@exportObjectLiteralProperty ol.source.WMTSOptions.url string|undefined -@exportObjectLiteralProperty ol.source.WMTSOptions.maxZoom number|undefined -@exportObjectLiteralProperty ol.source.WMTSOptions.urls Array.|undefined - -@exportObjectLiteral ol.style.IconOptions -@exportObjectLiteralProperty ol.style.IconOptions.url string|ol.Expression -@exportObjectLiteralProperty ol.style.IconOptions.width number|ol.Expression|undefined -@exportObjectLiteralProperty ol.style.IconOptions.height number|ol.Expression|undefined -@exportObjectLiteralProperty ol.style.IconOptions.opacity number|ol.Expression|undefined -@exportObjectLiteralProperty ol.style.IconOptions.rotation number|ol.Expression|undefined - -@exportObjectLiteral ol.style.LineOptions -@exportObjectLiteralProperty ol.style.LineOptions.strokeColor string|ol.Expression|undefined -@exportObjectLiteralProperty ol.style.LineOptions.strokeWidth number|ol.Expression|undefined -@exportObjectLiteralProperty ol.style.LineOptions.opacity number|ol.Expression|undefined - -@exportObjectLiteral ol.style.PolygonOptions -@exportObjectLiteralProperty ol.style.PolygonOptions.fillColor string|ol.Expression|undefined -@exportObjectLiteralProperty ol.style.PolygonOptions.strokeColor string|ol.Expression|undefined -@exportObjectLiteralProperty ol.style.PolygonOptions.strokeWidth number|ol.Expression|undefined -@exportObjectLiteralProperty ol.style.PolygonOptions.opacity number|ol.Expression|undefined - -@exportObjectLiteral ol.style.RuleOptions -@exportObjectLiteralProperty ol.style.RuleOptions.filter ol.filter.Filter|undefined -@exportObjectLiteralProperty ol.style.RuleOptions.symbolizers Array.|undefined - -@exportObjectLiteral ol.style.ShapeOptions -@exportObjectLiteralProperty ol.style.ShapeOptions.type ol.style.ShapeType|undefined -@exportObjectLiteralProperty ol.style.ShapeOptions.size number|ol.Expression|undefined -@exportObjectLiteralProperty ol.style.ShapeOptions.fillColor string|ol.Expression|undefined -@exportObjectLiteralProperty ol.style.ShapeOptions.strokeColor string|ol.Expression|undefined -@exportObjectLiteralProperty ol.style.ShapeOptions.strokeWidth number|ol.Expression|undefined -@exportObjectLiteralProperty ol.style.ShapeOptions.opacity number|ol.Expression|undefined - -@exportObjectLiteral ol.style.StyleOptions -@exportObjectLiteralProperty ol.style.StyleOptions.rules Array. - -@exportObjectLiteral ol.tilegrid.TileGridOptions -@exportObjectLiteralProperty ol.tilegrid.TileGridOptions.origin ol.Coordinate|undefined -@exportObjectLiteralProperty ol.tilegrid.TileGridOptions.origins Array.|undefined -@exportObjectLiteralProperty ol.tilegrid.TileGridOptions.resolutions !Array. -@exportObjectLiteralProperty ol.tilegrid.TileGridOptions.tileSize ol.Size|undefined -@exportObjectLiteralProperty ol.tilegrid.TileGridOptions.tileSizes Array.|undefined - -@exportObjectLiteral ol.tilegrid.WMTSOptions -@exportObjectLiteralProperty ol.tilegrid.WMTSOptions.origin ol.Coordinate|undefined -@exportObjectLiteralProperty ol.tilegrid.WMTSOptions.origins Array.|undefined -@exportObjectLiteralProperty ol.tilegrid.WMTSOptions.resolutions !Array. -@exportObjectLiteralProperty ol.tilegrid.WMTSOptions.matrixIds !Array. -@exportObjectLiteralProperty ol.tilegrid.WMTSOptions.tileSize ol.Size|undefined -@exportObjectLiteralProperty ol.tilegrid.WMTSOptions.tileSizes Array.|undefined - -@exportObjectLiteral ol.tilegrid.XYZOptions -@exportObjectLiteralProperty ol.tilegrid.XYZOptions.maxZoom number diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc new file mode 100644 index 0000000000..0d6db86d24 --- /dev/null +++ b/src/objectliterals.jsdoc @@ -0,0 +1,405 @@ +/** + * Object literal with config options for the map. + * @typedef {Object} ol.MapOptions + * @property {Array.|undefined} controls Controls initially + * added to the map. + * @property {ol.Collection|undefined} interactions Interactions. + * @property {Array.|ol.Collection|undefined} layers Layers. + * @property {ol.RendererHint|undefined} renderer Renderer. + * @property {Array.|undefined} renderers Renderers. + * @property {Element|string} target The container for the map. + * @property {ol.IView|undefined} view View. + */ + +/** + * Object literal with config options for the overlay. + * @typedef {Object} ol.OverlayOptions + * @property {Element|undefined} element The overlay element. + * @property {ol.Map|undefined} map The map to overlay onto. + * @property {ol.Coordinate|undefined} position The overlay position in map + * projection. + * @property {ol.OverlayPositioning|undefined} positioning Positioning. + */ + +/** + * Object literal with config options for the Proj4js projection. + * @typedef {Object} ol.Proj4jsProjectionOptions + * @property {string} code The SRS identifier code, e.g. 'EPSG:31256'. + * @property {ol.Extent} extent The validity extent for the SRS. + * @property {boolean|undefined} global Whether the projection is valid for the + * whole globe. Default is false. + */ + +/** + * Object literal with config options for the projection. + * @typedef {Object} ol.ProjectionOptions + * @property {string} code The SRS identifier code, e.g. 'EPSG:4326'. + * @property {ol.ProjectionUnits} units Units. + * @property {ol.Extent} extent The validity extent for the SRS. + * @property {string|undefined} axisOrientation The axis orientation as + * specified in Proj4. The default is 'enu'. + * @property {boolean|undefined} global Whether the projection is valid for the + * whole globe. Default is false. + */ + +/** + * Object literal with config options for the view. + * @typedef {Object} ol.View2DOptions + * @property {ol.Coordinate|undefined} center The view center in map projection. + * @property {number|undefined} maxResolution The maximum resolution in map + * units per pixel. + * @property {number|undefined} numZoomLevels The number of zoom levels for this + * view. Zoom level 0 uses the `maxResolution`; subsequent zoom levels are + * calculated by dividing the previous resolution by `zoomFactor`. + * @property {ol.ProjectionLike} projection The map projection. + * @property {number|undefined} resolution The initial resolution for the view. + * @property {Array.|undefined} resolutions The resolutions for this + * view. If configured, this is equivalent to specifying `maxResolution` and + * `numZoomLevels`. + * @property {number|undefined} rotation Initial rotation of the view. + * @property {number|undefined} zoom Initial zoom level of the view. + * @property {number|undefined} zoomFactor Factor to calculate resolutions for + * zoom levels. Default is 2. + */ + +/** + * @typedef {Object} ol.animation.BounceOptions + * @property {number} resolution Resolution. + * @property {number|undefined} start Start. + * @property {number|undefined} duration Duration. + * @property {function(number):number|undefined} easing Easing function. + */ + +/** + * @typedef {Object} ol.animation.PanOptions + * @property {ol.Coordinate} source Source. + * @property {number|undefined} start Start. + * @property {number|undefined} duration Duration. + * @property {function(number):number|undefined} easing Easing function. + */ + +/** + * @typedef {Object} ol.animation.RotateOptions + * @property {number} rotation Rotation. + * @property {number|undefined} start Start. + * @property {number|undefined} duration Duration. + * @property {function(number):number|undefined} easing Easing function. + */ + +/** + * @typedef {Object} ol.animation.ZoomOptions + * @property {number} resolution number Resolution. + * @property {number|undefined} start Start. + * @property {number|undefined} duration Duration. + * @property {function(number):number|undefined} easing Easing function. + */ + +/** + * @typedef {Object} ol.control.AttributionOptions + * @property {ol.Map|undefined} map Map. + * @property {Element|undefined} target Target. + */ + +/** + * @typedef {Object} ol.control.DefaultsOptions + * @property {boolean|undefined} attribution Attribution. + * @property {ol.control.AttributionOptions|undefined} attributionOptions + * Attribution options. + * @property {boolean|undefined} logo Logo. + * @property {ol.control.LogoOptions|undefined} logoOptions Logo options. + * @property {boolean|undefined} zoom Zoom. + * @property {ol.control.ZoomOptions|undefined} zoomOptions Zoom options. + */ + +/** + * @typedef {Object} ol.control.LogoOptions + * @property {ol.Map|undefined} map Map. + * @property {Element|undefined} target Target. + */ + +/** + * @typedef {Object} ol.control.MousePositionOptions + * @property {ol.CoordinateFormatType|undefined} coordinateFormat Coordinate + * format. + * @property {ol.Map|undefined} map Map. + * @property {ol.ProjectionLike} projection Projection. + * @property {Element|undefined} target Target. + * @property {string|undefined} undefinedHTML Markup for undefined coordinates. + */ + +/** + * @typedef {Object} ol.control.ScaleLineOptions + * @property {ol.Map|undefined} map Map. + * @property {number|undefined} minWidth Minimum width in pixels. + * @property {Element|undefined} target Target. + * @property {ol.control.ScaleLineUnits|undefined} units Units. + */ + +/** + * @typedef {Object} ol.control.ZoomOptions + * @property {number|undefined} delta Delta. + * @property {ol.Map|undefined} map Map. + * @property {Element|undefined} target Target. + */ + +/** + * @typedef {Object} ol.control.ZoomSliderOptions + * @property {ol.Map|undefined} map Map. + * @property {number|undefined} maxResolution Maximum resolution. + * @property {number|undefined} minResolution Minimum resolution. + */ + +/** + * Interactions for the map. Default is true for all options. + * @typedef {Object} ol.interaction.DefaultsOptions + * @property {boolean|undefined} doubleClickZoom Whether double click zoom is + * desired. + * @property {boolean|undefined} dragPan Whether drag-pan is desired. + * @property {boolean|undefined} keyboard Whether keyboard interaction is + * desired. + * @property {boolean|undefined} mouseWheelZoom Whether mousewheel zoom is + * desired. + * @property {boolean|undefined} shiftDragZoom Whether Shift-drag zoom is + * desired. + * @property {boolean|undefined} touchPan Whether touch pan is + * desired. + * @property {boolean|undefined} touchRotate Whether touch rotate is desired. + * @property {boolean|undefined} touchZoom Whether touch zoom is desired. + */ + +/** + * @typedef {Object} ol.interaction.KeyboardPanOptions + * @property {number|undefined} pixelDelta Pixel delta + */ + +/** + * @typedef {Object} ol.interaction.KeyboardZoomOptions + * @property {number|undefined} delta Delta. + */ + +/** + * @typedef {Object} ol.layer.LayerOptions + * @property {number|undefined} brightness Brightness. + * @property {number|undefined} contrast Contrast. + * @property {number|undefined} hue Hue. + * @property {number|undefined} opacity Opacity. 0-1. Default is 1. + * @property {number|undefined} saturation Saturation. + * @property {ol.source.Source} source Source for this layer. + * @property {boolean|undefined} visible Visibility. Default is true (visible). + */ + +/** + * @typedef {Object} ol.layer.TileLayerOptions + * @property {number|undefined} brightness Brightness. + * @property {number|undefined} contrast Contrast. + * @property {number|undefined} hue Hue. + * @property {number|undefined} opacity Opacity. 0-1. Default is 1. + * @property {number|undefined} preload Preload. + * @property {number|undefined} saturation Saturation. + * @property {ol.source.Source} source Source for this layer. + * @property {boolean|undefined} visible Visibility. Default is true (visible). + */ + +/** + * @typedef {Object} ol.layer.VectorLayerOptions + * @property {number|undefined} opacity Opacity. 0-1. Default is 1. + * @property {ol.source.Source} source Source for this layer. + * @property {ol.style.Style|undefined} style Style. + * @property {boolean|undefined} visible Visibility. Default is true (visible). + */ + +/** + * @typedef {Object} ol.source.BingMapsOptions + * @property {string|undefined} culture Culture. + * @property {string} key Bing Maps API key. Get yours at + * http://bingmapsportal.com/. + * @property {string} style Style. + */ + +/** + * @typedef {Object} ol.source.DebugTileSourceOptions + * @property {ol.Extent|undefined} extent Extent. + * @property {ol.ProjectionLike} projection Projection. + * @property {ol.tilegrid.TileGrid|undefined} tileGrid Tile grid. + */ + +/** + * @typedef {Object} ol.source.OpenStreetMapOptions + * @property {ol.Attribution|undefined} attribution Attribution. + * @property {Array.|undefined} attributions Attributions. + * @property {number|undefined} maxZoom Max zoom. + * @property {string|undefined} url URL. + */ + +/** + * @typedef {Object} ol.source.SingleImageWMSOptions + * @property {Array.|undefined} attributions Attributions. + * @property {null|string|undefined} crossOrigin crossOrigin setting for image + * requests. + * @property {ol.Extent|undefined} extent Extent. + * @property {Object.} params WMS request parameters. At least a + * `LAYERS` param is required. `STYLES` is '' by default. `VERSION` is + * '1.3.0' by default. `WIDTH`, `HEIGHT`, `BBOX` and `CRS` (`SRS` for WMS + * version < 1.3.0) will be set dynamically. + * @property {ol.ProjectionLike} projection Projection. + * @property {number|undefined} ratio Ratio. 1 means image requests are the size + * of the map viewport, 2 means twice the size of the map viewport, and so + * on. + * @property {Array.|undefined} resolutions Resolutions. If specified, + * requests will be made for these resolutions only. + * @property {string|undefined} url WMS service url. + */ + +/** + * @typedef {Object} ol.source.SourceOptions + * @property {Array.|undefined} attributions Attributions. + * @property {ol.Extent|undefined} extent Extent. + * @property {string|undefined} logo Logo. + * @property {ol.ProjectionLike} projection Projection. + */ + +/** + * @typedef {Object} ol.source.StamenOptions + * @property {string} layer Layer. + * @property {number|undefined} minZoom Minimum zoom. + * @property {number|undefined} maxZoom Maximum zoom. + * @property {boolean|undefined} opaque Whether the layer is opaque. + * @property {string|undefined} url Url. + */ + +/** + * @typedef {Object} ol.source.StaticImageOptions + * @property {Array.|undefined} attributions Attributions. + * @property {null|string|undefined} crossOrigin crossOrigin setting for image + * requests. + * @property {ol.Extent|undefined} extent Extent. + * @property {ol.Extent|undefined} imageExtent Extent of the image. + * @property {ol.Size|undefined} imageSize Size of the image. + * @property {ol.ProjectionLike} projection Projection. + * @property {string|undefined} url Url. + */ + +/** + * @typedef {Object} ol.source.TileJSONOptions + * @property {null|string|undefined} crossOrigin crossOriin setting for image + * requests. + * @property {string} url Url. + */ + +/** + * @typedef {Object} ol.source.TiledWMSOptions + * @property {Array.|undefined} attributions Attributions. + * @property {Object.} params WMS request parameters. At least a + * `LAYERS` param is required. `STYLES` is '' by default. `VERSION` is + * '1.3.0' by default. `WIDTH`, `HEIGHT`, `BBOX` and `CRS` (`SRS` for WMS + * version < 1.3.0) will be set dynamically. + * @property {null|string|undefined} crossOrigin crossOrigin setting for image + * requests. + * @property {ol.Extent|undefined} extent Extent. + * @property {ol.tilegrid.TileGrid|undefined} tileGrid Tile grid. + * @property {number|undefined} maxZoom Maximum zoom. + * @property {ol.ProjectionLike} projection Projection. + * @property {string|undefined} url WMS service url. + * @property {Array.|undefined} urls WMS service urls. Use this instead + * of `url` when the WMS supports multiple urls for GetMap requests. + */ + +/** + * @typedef {Object} ol.source.WMTSOptions + * @property {Array.|undefined} attributions Attributions. + * @property {string|null|undefined} crossOrigin crossOrigin setting for image + * requeests. + * @property {ol.Extent|undefined} extent Extent. + * @property {ol.tilegrid.WMTS} tileGrid Tile grid. + * @property {ol.Projection|undefined} projection Projection. + * @property {ol.source.WMTSRequestEncoding|undefined} requestEncoding Request + * encoding. + * @property {string} layer Layer. + * @property {string} style Style. + * @property {string|undefined} format Format. + * @property {string} matrixSet Matrix set. + * @property {Object|undefined} dimensions Dimensions. + * @property {string|undefined} url Url. + * @property {number|undefined} maxZoom Maximum zoom. + * @property {Array.|undefined} urls Urls. + */ + +/** + * @typedef {Object} ol.style.IconOptions + * @property {string|ol.Expression} url Icon image url. + * @property {number|ol.Expression|undefined} width Width of the icon in pixels. + * Default is the width of the icon image. + * @property {number|ol.Expression|undefined} height Height of the icon in + * pixels. Default is the height of the icon image. + * @property {number|ol.Expression|undefined} opacity Icon opacity (0-1). + * @property {number|ol.Expression|undefined} rotation Rotation in degrees + * (0-360). + */ + +/** + * @typedef {Object} ol.style.LineOptions + * @property {string|ol.Expression|undefined} strokeColor Stroke color as hex + * color code. + * @property {number|ol.Expression|undefined} strokeWidth Stroke width in + * pixels. + * @property {number|ol.Expression|undefined} opacity Opacity (0-1). + */ + +/** + * @typedef {Object} ol.style.PolygonOptions + * @property {string|ol.Expression|undefined} fillColor Fill color as hex color + * code. + * @property {string|ol.Expression|undefined} strokeColor Stroke color as hex + * color code. + * @property {number|ol.Expression|undefined} strokeWidth Stroke width in + * pixels. + * @property {number|ol.Expression|undefined} opacity Opacity (0-1). + */ + +/** + * @typedef {Object} ol.style.RuleOptions + * @property {ol.filter.Filter|undefined} filter Filter. + * @property {Array.|undefined} symbolizers Symbolizers. + */ + +/** + * @typedef {Object} ol.style.ShapeOptions + * @property {ol.style.ShapeType|undefined} type Type. + * @property {number|ol.Expression|undefined} size Size in pixels. + * @property {string|ol.Expression|undefined} fillColor Fill color as hex color + * code. + * @property {string|ol.Expression|undefined} strokeColor Stroke color as hex + * color code. + * @property {number|ol.Expression|undefined} strokeWidth Stroke width in + * pixels. + * @property {number|ol.Expression|undefined} opacity Opacity (0-1). + */ + +/** + * @typedef {Object} ol.style.StyleOptions + * @property {Array.} rules Rules. + */ + +/** + * @typedef {Object} ol.tilegrid.TileGridOptions + * @property {ol.Coordinate|undefined} origin Origin. + * @property {Array.|undefined} origins Origins. + * @property {!Array.} resolutions Resolutions. + * @property {ol.Size|undefined} tileSize Tile size. + * @property {Array.|undefined} tileSizes Tile sizes. + */ + +/** + * @typedef {Object} ol.tilegrid.WMTSOptions + * @property {ol.Coordinate|undefined} origin Origin. + * @property {Array.|undefined} origins Origins. + * @property {!Array.} resolutions Resolutions. + * @property {!Array.} matrixIds matrix IDs. + * @property {ol.Size|undefined} tileSize Tile size. + * @property {Array.|undefined} tileSizes Tile sizes. + */ + +/** + * @typedef {Object} ol.tilegrid.XYZOptions + * @property {number} maxZoom Maximum zoom. + */ \ No newline at end of file diff --git a/src/ol/animation.jsdoc b/src/ol/animation.jsdoc new file mode 100644 index 0000000000..1e659969cf --- /dev/null +++ b/src/ol/animation.jsdoc @@ -0,0 +1,3 @@ +/** + * @namespace ol.animation + */ \ No newline at end of file diff --git a/src/ol/control/control.jsdoc b/src/ol/control/control.jsdoc new file mode 100644 index 0000000000..6c5dd9f581 --- /dev/null +++ b/src/ol/control/control.jsdoc @@ -0,0 +1,3 @@ +/** + * @namespace ol.control + */ \ No newline at end of file diff --git a/src/ol/layer/layer.jsdoc b/src/ol/layer/layer.jsdoc new file mode 100644 index 0000000000..a8bc4e6add --- /dev/null +++ b/src/ol/layer/layer.jsdoc @@ -0,0 +1,3 @@ +/** + * @namespace ol.layer + */ \ No newline at end of file diff --git a/src/ol/ol.jsdoc b/src/ol/ol.jsdoc new file mode 100644 index 0000000000..2f2adb8a64 --- /dev/null +++ b/src/ol/ol.jsdoc @@ -0,0 +1,3 @@ +/** + * @namespace ol + */ \ No newline at end of file diff --git a/src/ol/projection/projection.js b/src/ol/projection/projection.js index 830aaeb554..ede75e0442 100644 --- a/src/ol/projection/projection.js +++ b/src/ol/projection/projection.js @@ -25,7 +25,8 @@ ol.HAVE_PROJ4JS = ol.ENABLE_PROJ4JS && typeof Proj4js == 'object'; /** - * @typedef {ol.Projection|string|undefined} + * A projection as {@link ol.Projection}, SRS identifier string or undefined. + * @typedef {ol.Projection|string|undefined} ol.ProjectionLike */ ol.ProjectionLike; diff --git a/src/ol/source/source.jsdoc b/src/ol/source/source.jsdoc new file mode 100644 index 0000000000..637fb44216 --- /dev/null +++ b/src/ol/source/source.jsdoc @@ -0,0 +1,3 @@ +/** + * @namespace ol.source + */ \ No newline at end of file diff --git a/src/ol/style/style.jsdoc b/src/ol/style/style.jsdoc new file mode 100644 index 0000000000..d95f551e7f --- /dev/null +++ b/src/ol/style/style.jsdoc @@ -0,0 +1,3 @@ +/** + * @namespace ol.style + */ \ No newline at end of file diff --git a/src/ol/tilegrid/tilegrid.jsdoc b/src/ol/tilegrid/tilegrid.jsdoc new file mode 100644 index 0000000000..55f249fbbd --- /dev/null +++ b/src/ol/tilegrid/tilegrid.jsdoc @@ -0,0 +1,3 @@ +/** + * @namespace ol.tilegrid + */ \ No newline at end of file