ol 7.3.0 → 7.3.1-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Collection.d.ts +2 -2
- package/Collection.d.ts.map +1 -1
- package/DataTile.d.ts +1 -1
- package/DataTile.d.ts.map +1 -1
- package/DataTile.js +2 -1
- package/Feature.d.ts +1 -1
- package/Feature.d.ts.map +1 -1
- package/Geolocation.d.ts +2 -2
- package/Geolocation.d.ts.map +1 -1
- package/Image.d.ts +1 -1
- package/Image.d.ts.map +1 -1
- package/ImageBase.d.ts +1 -1
- package/ImageBase.d.ts.map +1 -1
- package/ImageCanvas.d.ts +1 -1
- package/ImageCanvas.d.ts.map +1 -1
- package/ImageTile.d.ts +1 -1
- package/ImageTile.d.ts.map +1 -1
- package/Map.d.ts +7 -7
- package/Map.d.ts.map +1 -1
- package/Map.js +2 -1
- package/MapBrowserEvent.d.ts +1 -1
- package/MapBrowserEvent.d.ts.map +1 -1
- package/MapBrowserEventHandler.d.ts +1 -1
- package/MapBrowserEventHandler.d.ts.map +1 -1
- package/MapEvent.d.ts +1 -1
- package/MapEvent.d.ts.map +1 -1
- package/Object.d.ts +2 -2
- package/Object.d.ts.map +1 -1
- package/Observable.d.ts +1 -1
- package/Observable.d.ts.map +1 -1
- package/Overlay.d.ts +1 -1
- package/Overlay.d.ts.map +1 -1
- package/Tile.d.ts +1 -1
- package/Tile.d.ts.map +1 -1
- package/TileCache.d.ts +1 -1
- package/TileCache.d.ts.map +1 -1
- package/TileQueue.d.ts +1 -1
- package/TileQueue.d.ts.map +1 -1
- package/VectorRenderTile.d.ts +1 -1
- package/VectorRenderTile.d.ts.map +1 -1
- package/VectorTile.d.ts +1 -1
- package/VectorTile.d.ts.map +1 -1
- package/View.d.ts +10 -6
- package/View.d.ts.map +1 -1
- package/View.js +9 -6
- package/array.d.ts.map +1 -1
- package/array.js +38 -20
- package/control/Attribution.d.ts +1 -1
- package/control/Attribution.d.ts.map +1 -1
- package/control/Control.d.ts +1 -1
- package/control/Control.d.ts.map +1 -1
- package/control/FullScreen.d.ts +1 -1
- package/control/FullScreen.d.ts.map +1 -1
- package/control/MousePosition.d.ts +1 -1
- package/control/MousePosition.d.ts.map +1 -1
- package/control/OverviewMap.d.ts +3 -3
- package/control/OverviewMap.d.ts.map +1 -1
- package/control/Rotate.d.ts +1 -1
- package/control/Rotate.d.ts.map +1 -1
- package/control/ScaleLine.d.ts +1 -1
- package/control/ScaleLine.d.ts.map +1 -1
- package/control/Zoom.d.ts +1 -1
- package/control/Zoom.d.ts.map +1 -1
- package/control/ZoomSlider.d.ts +1 -1
- package/control/ZoomSlider.d.ts.map +1 -1
- package/control/ZoomToExtent.d.ts +1 -1
- package/control/ZoomToExtent.d.ts.map +1 -1
- package/control/defaults.d.ts +1 -1
- package/control/defaults.d.ts.map +1 -1
- package/dist/ol.js +2 -2
- package/dist/ol.js.map +1 -1
- package/events/Key.d.ts +8 -0
- package/events/Key.d.ts.map +1 -0
- package/events/Key.js +14 -0
- package/events/Target.d.ts +1 -1
- package/events/Target.d.ts.map +1 -1
- package/events/condition.d.ts +2 -2
- package/events/condition.d.ts.map +1 -1
- package/extent.d.ts.map +1 -1
- package/extent.js +7 -2
- package/format/EsriJSON.d.ts +1 -1
- package/format/EsriJSON.d.ts.map +1 -1
- package/format/GML.d.ts +1 -1
- package/format/GML.d.ts.map +1 -1
- package/format/GML2.d.ts +1 -1
- package/format/GML2.d.ts.map +1 -1
- package/format/GML3.d.ts +5 -5
- package/format/GML3.d.ts.map +1 -1
- package/format/GML32.d.ts +1 -1
- package/format/GML32.d.ts.map +1 -1
- package/format/GMLBase.d.ts +9 -9
- package/format/GMLBase.d.ts.map +1 -1
- package/format/GPX.d.ts +2 -2
- package/format/GPX.d.ts.map +1 -1
- package/format/GeoJSON.d.ts +1 -1
- package/format/GeoJSON.d.ts.map +1 -1
- package/format/IGC.d.ts +1 -1
- package/format/IGC.d.ts.map +1 -1
- package/format/IIIFInfo.d.ts +8 -8
- package/format/IIIFInfo.d.ts.map +1 -1
- package/format/IIIFInfo.js +10 -9
- package/format/JSONFeature.d.ts +1 -1
- package/format/JSONFeature.d.ts.map +1 -1
- package/format/JSONFeature.js +2 -1
- package/format/KML.d.ts +121 -5
- package/format/KML.d.ts.map +1 -1
- package/format/KML.js +105 -7
- package/format/MVT.d.ts +2 -2
- package/format/MVT.d.ts.map +1 -1
- package/format/OSMXML.d.ts +1 -1
- package/format/OSMXML.d.ts.map +1 -1
- package/format/OSMXML.js +11 -4
- package/format/OWS.d.ts +1 -1
- package/format/OWS.d.ts.map +1 -1
- package/format/Polyline.d.ts +2 -2
- package/format/Polyline.d.ts.map +1 -1
- package/format/TextFeature.d.ts +1 -1
- package/format/TextFeature.d.ts.map +1 -1
- package/format/TopoJSON.d.ts +1 -1
- package/format/TopoJSON.d.ts.map +1 -1
- package/format/WFS.d.ts +2 -2
- package/format/WFS.d.ts.map +1 -1
- package/format/WFS.js +8 -4
- package/format/WKB.d.ts +1 -1
- package/format/WKB.d.ts.map +1 -1
- package/format/WKB.js +6 -4
- package/format/WKT.d.ts +1 -1
- package/format/WKT.d.ts.map +1 -1
- package/format/WMSCapabilities.d.ts +1 -1
- package/format/WMSCapabilities.d.ts.map +1 -1
- package/format/WMSGetFeatureInfo.d.ts +1 -1
- package/format/WMSGetFeatureInfo.d.ts.map +1 -1
- package/format/WMTSCapabilities.d.ts +1 -1
- package/format/WMTSCapabilities.d.ts.map +1 -1
- package/format/XML.d.ts.map +1 -1
- package/format/XML.js +4 -2
- package/format/XMLFeature.d.ts +1 -1
- package/format/XMLFeature.d.ts.map +1 -1
- package/format/XMLFeature.js +16 -8
- package/format/filter/And.d.ts +1 -1
- package/format/filter/And.d.ts.map +1 -1
- package/format/filter/Bbox.d.ts +1 -1
- package/format/filter/Bbox.d.ts.map +1 -1
- package/format/filter/Comparison.d.ts +1 -1
- package/format/filter/Comparison.d.ts.map +1 -1
- package/format/filter/ComparisonBinary.d.ts +1 -1
- package/format/filter/ComparisonBinary.d.ts.map +1 -1
- package/format/filter/Contains.d.ts +1 -1
- package/format/filter/Contains.d.ts.map +1 -1
- package/format/filter/DWithin.d.ts +1 -1
- package/format/filter/DWithin.d.ts.map +1 -1
- package/format/filter/Disjoint.d.ts +1 -1
- package/format/filter/Disjoint.d.ts.map +1 -1
- package/format/filter/During.d.ts +1 -1
- package/format/filter/During.d.ts.map +1 -1
- package/format/filter/EqualTo.d.ts +1 -1
- package/format/filter/EqualTo.d.ts.map +1 -1
- package/format/filter/GreaterThan.d.ts +1 -1
- package/format/filter/GreaterThan.d.ts.map +1 -1
- package/format/filter/GreaterThanOrEqualTo.d.ts +1 -1
- package/format/filter/GreaterThanOrEqualTo.d.ts.map +1 -1
- package/format/filter/Intersects.d.ts +1 -1
- package/format/filter/Intersects.d.ts.map +1 -1
- package/format/filter/IsBetween.d.ts +1 -1
- package/format/filter/IsBetween.d.ts.map +1 -1
- package/format/filter/IsLike.d.ts +1 -1
- package/format/filter/IsLike.d.ts.map +1 -1
- package/format/filter/IsNull.d.ts +1 -1
- package/format/filter/IsNull.d.ts.map +1 -1
- package/format/filter/LessThan.d.ts +1 -1
- package/format/filter/LessThan.d.ts.map +1 -1
- package/format/filter/LessThanOrEqualTo.d.ts +1 -1
- package/format/filter/LessThanOrEqualTo.d.ts.map +1 -1
- package/format/filter/LogicalNary.d.ts +1 -1
- package/format/filter/LogicalNary.d.ts.map +1 -1
- package/format/filter/Not.d.ts +1 -1
- package/format/filter/Not.d.ts.map +1 -1
- package/format/filter/NotEqualTo.d.ts +1 -1
- package/format/filter/NotEqualTo.d.ts.map +1 -1
- package/format/filter/Or.d.ts +2 -2
- package/format/filter/Or.d.ts.map +1 -1
- package/format/filter/Or.js +1 -1
- package/format/filter/ResourceId.d.ts +1 -1
- package/format/filter/ResourceId.d.ts.map +1 -1
- package/format/filter/Spatial.d.ts +1 -1
- package/format/filter/Spatial.d.ts.map +1 -1
- package/format/filter/Within.d.ts +1 -1
- package/format/filter/Within.d.ts.map +1 -1
- package/format/filter.d.ts +20 -20
- package/format/filter.d.ts.map +1 -1
- package/geom/Circle.d.ts +1 -1
- package/geom/Circle.d.ts.map +1 -1
- package/geom/Circle.js +1 -17
- package/geom/Geometry.d.ts +1 -1
- package/geom/Geometry.d.ts.map +1 -1
- package/geom/GeometryCollection.d.ts +1 -1
- package/geom/GeometryCollection.d.ts.map +1 -1
- package/geom/LineString.d.ts +1 -1
- package/geom/LineString.d.ts.map +1 -1
- package/geom/LinearRing.d.ts +1 -1
- package/geom/LinearRing.d.ts.map +1 -1
- package/geom/MultiLineString.d.ts +2 -2
- package/geom/MultiLineString.d.ts.map +1 -1
- package/geom/MultiPoint.d.ts +2 -2
- package/geom/MultiPoint.d.ts.map +1 -1
- package/geom/MultiPolygon.d.ts +3 -3
- package/geom/MultiPolygon.d.ts.map +1 -1
- package/geom/Point.d.ts +1 -1
- package/geom/Point.d.ts.map +1 -1
- package/geom/Polygon.d.ts +3 -3
- package/geom/Polygon.d.ts.map +1 -1
- package/geom/SimpleGeometry.d.ts +1 -1
- package/geom/SimpleGeometry.d.ts.map +1 -1
- package/geom/flat/interpolate.d.ts.map +1 -1
- package/geom/flat/interpolate.js +4 -2
- package/geom/flat/orient.d.ts +1 -1
- package/geom/flat/orient.js +1 -1
- package/interaction/DblClickDragZoom.d.ts +110 -0
- package/interaction/DblClickDragZoom.d.ts.map +1 -0
- package/interaction/DblClickDragZoom.js +251 -0
- package/interaction/DoubleClickZoom.d.ts +1 -1
- package/interaction/DoubleClickZoom.d.ts.map +1 -1
- package/interaction/DragAndDrop.d.ts +2 -2
- package/interaction/DragAndDrop.d.ts.map +1 -1
- package/interaction/DragBox.d.ts +2 -2
- package/interaction/DragBox.d.ts.map +1 -1
- package/interaction/DragPan.d.ts +1 -1
- package/interaction/DragPan.d.ts.map +1 -1
- package/interaction/DragRotate.d.ts +1 -1
- package/interaction/DragRotate.d.ts.map +1 -1
- package/interaction/DragRotateAndZoom.d.ts +1 -1
- package/interaction/DragRotateAndZoom.d.ts.map +1 -1
- package/interaction/DragZoom.d.ts +1 -1
- package/interaction/DragZoom.d.ts.map +1 -1
- package/interaction/Draw.d.ts +6 -6
- package/interaction/Draw.d.ts.map +1 -1
- package/interaction/Extent.d.ts +2 -2
- package/interaction/Extent.d.ts.map +1 -1
- package/interaction/Extent.js +2 -1
- package/interaction/Interaction.d.ts +1 -1
- package/interaction/Interaction.d.ts.map +1 -1
- package/interaction/KeyboardPan.d.ts +1 -1
- package/interaction/KeyboardPan.d.ts.map +1 -1
- package/interaction/KeyboardPan.js +9 -9
- package/interaction/KeyboardZoom.d.ts +1 -1
- package/interaction/KeyboardZoom.d.ts.map +1 -1
- package/interaction/Link.d.ts +1 -1
- package/interaction/Link.d.ts.map +1 -1
- package/interaction/Modify.d.ts +6 -6
- package/interaction/Modify.d.ts.map +1 -1
- package/interaction/Modify.js +6 -1
- package/interaction/MouseWheelZoom.d.ts +1 -1
- package/interaction/MouseWheelZoom.d.ts.map +1 -1
- package/interaction/PinchRotate.d.ts +1 -1
- package/interaction/PinchRotate.d.ts.map +1 -1
- package/interaction/PinchZoom.d.ts +1 -1
- package/interaction/PinchZoom.d.ts.map +1 -1
- package/interaction/Pointer.d.ts +1 -1
- package/interaction/Pointer.d.ts.map +1 -1
- package/interaction/Select.d.ts +5 -5
- package/interaction/Select.d.ts.map +1 -1
- package/interaction/Snap.d.ts +1 -1
- package/interaction/Snap.d.ts.map +1 -1
- package/interaction/Snap.js +10 -4
- package/interaction/Translate.d.ts +4 -4
- package/interaction/Translate.d.ts.map +1 -1
- package/interaction/Translate.js +18 -3
- package/interaction/defaults.d.ts +1 -1
- package/interaction/defaults.d.ts.map +1 -1
- package/interaction.d.ts +1 -0
- package/interaction.js +1 -0
- package/layer/Base.d.ts +4 -3
- package/layer/Base.d.ts.map +1 -1
- package/layer/Base.js +3 -2
- package/layer/BaseImage.d.ts +1 -1
- package/layer/BaseImage.d.ts.map +1 -1
- package/layer/BaseTile.d.ts +1 -1
- package/layer/BaseTile.d.ts.map +1 -1
- package/layer/BaseVector.d.ts +10 -4
- package/layer/BaseVector.d.ts.map +1 -1
- package/layer/BaseVector.js +9 -3
- package/layer/Graticule.d.ts +6 -6
- package/layer/Graticule.d.ts.map +1 -1
- package/layer/Group.d.ts +4 -4
- package/layer/Group.d.ts.map +1 -1
- package/layer/Heatmap.d.ts +2 -2
- package/layer/Heatmap.d.ts.map +1 -1
- package/layer/Image.d.ts +2 -2
- package/layer/Image.d.ts.map +1 -1
- package/layer/Layer.d.ts +14 -11
- package/layer/Layer.d.ts.map +1 -1
- package/layer/Layer.js +28 -8
- package/layer/MapboxVector.d.ts +1 -1
- package/layer/MapboxVector.d.ts.map +1 -1
- package/layer/Tile.d.ts +2 -2
- package/layer/Tile.d.ts.map +1 -1
- package/layer/Vector.d.ts +2 -2
- package/layer/Vector.d.ts.map +1 -1
- package/layer/VectorImage.d.ts +2 -2
- package/layer/VectorImage.d.ts.map +1 -1
- package/layer/VectorTile.d.ts +2 -2
- package/layer/VectorTile.d.ts.map +1 -1
- package/layer/WebGLPoints.d.ts +4 -4
- package/layer/WebGLPoints.d.ts.map +1 -1
- package/layer/WebGLPoints.js +13 -4
- package/layer/WebGLTile.d.ts +9 -2
- package/layer/WebGLTile.d.ts.map +1 -1
- package/layer/WebGLTile.js +6 -6
- package/package.json +2 -2
- package/proj/proj4.d.ts +2 -2
- package/proj/proj4.d.ts.map +1 -1
- package/proj/proj4.js +1 -1
- package/proj.d.ts +9 -9
- package/proj.d.ts.map +1 -1
- package/proj.js +9 -8
- package/render/Box.d.ts +1 -1
- package/render/Box.d.ts.map +1 -1
- package/render/Event.d.ts +1 -1
- package/render/Event.d.ts.map +1 -1
- package/render/Feature.d.ts +7 -7
- package/render/Feature.d.ts.map +1 -1
- package/render/canvas/Builder.d.ts +1 -1
- package/render/canvas/Builder.d.ts.map +1 -1
- package/render/canvas/ImageBuilder.d.ts +1 -1
- package/render/canvas/ImageBuilder.d.ts.map +1 -1
- package/render/canvas/Immediate.d.ts +1 -1
- package/render/canvas/Immediate.d.ts.map +1 -1
- package/render/canvas/Immediate.js +9 -1
- package/render/canvas/LineStringBuilder.d.ts +1 -1
- package/render/canvas/LineStringBuilder.d.ts.map +1 -1
- package/render/canvas/PolygonBuilder.d.ts +1 -1
- package/render/canvas/PolygonBuilder.d.ts.map +1 -1
- package/render/canvas/TextBuilder.d.ts +1 -1
- package/render/canvas/TextBuilder.d.ts.map +1 -1
- package/render/canvas.d.ts +1 -1
- package/render/canvas.d.ts.map +1 -1
- package/render/webgl/MixedGeometryBatch.d.ts +37 -131
- package/render/webgl/MixedGeometryBatch.d.ts.map +1 -1
- package/render/webgl/MixedGeometryBatch.js +230 -147
- package/render/webgl/VectorStyleRenderer.d.ts +256 -0
- package/render/webgl/VectorStyleRenderer.d.ts.map +1 -0
- package/render/webgl/VectorStyleRenderer.js +440 -0
- package/render/webgl/constants.d.ts +1 -1
- package/render/webgl/constants.js +1 -1
- package/render/webgl/renderinstructions.d.ts +36 -0
- package/render/webgl/renderinstructions.d.ts.map +1 -0
- package/render/webgl/renderinstructions.js +241 -0
- package/render/webgl/utils.d.ts +4 -4
- package/render/webgl/utils.d.ts.map +1 -1
- package/render/webgl/utils.js +9 -9
- package/render.d.ts +1 -1
- package/render.d.ts.map +1 -1
- package/renderer/Composite.d.ts +1 -1
- package/renderer/Composite.d.ts.map +1 -1
- package/renderer/Layer.d.ts +1 -1
- package/renderer/Layer.d.ts.map +1 -1
- package/renderer/Map.d.ts +1 -1
- package/renderer/Map.d.ts.map +1 -1
- package/renderer/canvas/ImageLayer.d.ts +1 -1
- package/renderer/canvas/ImageLayer.d.ts.map +1 -1
- package/renderer/canvas/Layer.d.ts +1 -1
- package/renderer/canvas/Layer.d.ts.map +1 -1
- package/renderer/canvas/TileLayer.d.ts +1 -1
- package/renderer/canvas/TileLayer.d.ts.map +1 -1
- package/renderer/canvas/VectorImageLayer.d.ts +1 -1
- package/renderer/canvas/VectorImageLayer.d.ts.map +1 -1
- package/renderer/canvas/VectorLayer.d.ts +3 -3
- package/renderer/canvas/VectorLayer.d.ts.map +1 -1
- package/renderer/canvas/VectorTileLayer.d.ts +2 -2
- package/renderer/canvas/VectorTileLayer.d.ts.map +1 -1
- package/renderer/webgl/Layer.d.ts +2 -2
- package/renderer/webgl/Layer.d.ts.map +1 -1
- package/renderer/webgl/PointsLayer.d.ts +3 -3
- package/renderer/webgl/PointsLayer.d.ts.map +1 -1
- package/renderer/webgl/PointsLayer.js +5 -8
- package/renderer/webgl/TileLayer.d.ts +32 -99
- package/renderer/webgl/TileLayer.d.ts.map +1 -1
- package/renderer/webgl/TileLayer.js +103 -644
- package/renderer/webgl/TileLayerBase.d.ts +194 -0
- package/renderer/webgl/TileLayerBase.d.ts.map +1 -0
- package/renderer/webgl/TileLayerBase.js +750 -0
- package/renderer/webgl/VectorLayer.d.ts +59 -60
- package/renderer/webgl/VectorLayer.d.ts.map +1 -1
- package/renderer/webgl/VectorLayer.js +118 -156
- package/renderer/webgl/VectorTileLayer.d.ts +87 -0
- package/renderer/webgl/VectorTileLayer.d.ts.map +1 -0
- package/renderer/webgl/VectorTileLayer.js +201 -0
- package/reproj/DataTile.d.ts +1 -1
- package/reproj/DataTile.d.ts.map +1 -1
- package/reproj/Image.d.ts +1 -1
- package/reproj/Image.d.ts.map +1 -1
- package/reproj/Image.js +22 -8
- package/reproj/Tile.d.ts +1 -1
- package/reproj/Tile.d.ts.map +1 -1
- package/reproj/Triangulation.js +2 -2
- package/source/BingMaps.d.ts +1 -1
- package/source/BingMaps.d.ts.map +1 -1
- package/source/CartoDB.d.ts +1 -1
- package/source/CartoDB.d.ts.map +1 -1
- package/source/Cluster.d.ts +3 -3
- package/source/Cluster.d.ts.map +1 -1
- package/source/DataTile.d.ts +4 -4
- package/source/DataTile.d.ts.map +1 -1
- package/source/DataTile.js +1 -1
- package/source/GeoTIFF.d.ts +1 -1
- package/source/GeoTIFF.d.ts.map +1 -1
- package/source/IIIF.d.ts +1 -1
- package/source/IIIF.d.ts.map +1 -1
- package/source/Image.d.ts +2 -2
- package/source/Image.d.ts.map +1 -1
- package/source/ImageArcGISRest.d.ts +1 -1
- package/source/ImageArcGISRest.d.ts.map +1 -1
- package/source/ImageCanvas.d.ts +1 -1
- package/source/ImageCanvas.d.ts.map +1 -1
- package/source/ImageMapGuide.d.ts +1 -1
- package/source/ImageMapGuide.d.ts.map +1 -1
- package/source/ImageStatic.d.ts +1 -1
- package/source/ImageStatic.d.ts.map +1 -1
- package/source/ImageWMS.d.ts +1 -1
- package/source/ImageWMS.d.ts.map +1 -1
- package/source/OGCMapTile.d.ts +1 -1
- package/source/OGCMapTile.d.ts.map +1 -1
- package/source/OGCVectorTile.d.ts +1 -1
- package/source/OGCVectorTile.d.ts.map +1 -1
- package/source/OSM.d.ts +1 -1
- package/source/OSM.d.ts.map +1 -1
- package/source/Raster.d.ts +3 -3
- package/source/Raster.d.ts.map +1 -1
- package/source/Source.d.ts +5 -5
- package/source/Source.d.ts.map +1 -1
- package/source/Source.js +2 -2
- package/source/Stamen.d.ts +1 -1
- package/source/Stamen.d.ts.map +1 -1
- package/source/Tile.d.ts +2 -2
- package/source/Tile.d.ts.map +1 -1
- package/source/TileArcGISRest.d.ts +1 -1
- package/source/TileArcGISRest.d.ts.map +1 -1
- package/source/TileDebug.d.ts +1 -1
- package/source/TileDebug.d.ts.map +1 -1
- package/source/TileImage.d.ts +4 -4
- package/source/TileImage.d.ts.map +1 -1
- package/source/TileJSON.d.ts +1 -1
- package/source/TileJSON.d.ts.map +1 -1
- package/source/TileWMS.d.ts +1 -1
- package/source/TileWMS.d.ts.map +1 -1
- package/source/UTFGrid.d.ts +2 -2
- package/source/UTFGrid.d.ts.map +1 -1
- package/source/UrlTile.d.ts +1 -1
- package/source/UrlTile.d.ts.map +1 -1
- package/source/Vector.d.ts +3 -3
- package/source/Vector.d.ts.map +1 -1
- package/source/Vector.js +6 -3
- package/source/VectorTile.d.ts +4 -4
- package/source/VectorTile.d.ts.map +1 -1
- package/source/WMTS.d.ts +1 -1
- package/source/WMTS.d.ts.map +1 -1
- package/source/XYZ.d.ts +1 -1
- package/source/XYZ.d.ts.map +1 -1
- package/source/Zoomify.d.ts +2 -2
- package/source/Zoomify.d.ts.map +1 -1
- package/structs/LRUCache.d.ts.map +1 -1
- package/structs/LRUCache.js +2 -1
- package/style/Circle.d.ts +1 -1
- package/style/Circle.d.ts.map +1 -1
- package/style/Icon.d.ts +4 -78
- package/style/Icon.d.ts.map +1 -1
- package/style/Icon.js +89 -86
- package/style/IconImage.d.ts +1 -1
- package/style/IconImage.d.ts.map +1 -1
- package/style/RegularShape.d.ts +1 -1
- package/style/RegularShape.d.ts.map +1 -1
- package/style/RegularShape.js +1 -1
- package/style/Style.d.ts +2 -2
- package/style/Style.d.ts.map +1 -1
- package/style/Text.d.ts +5 -5
- package/style/Text.d.ts.map +1 -1
- package/style/Text.js +2 -2
- package/style/expressions.d.ts +42 -17
- package/style/expressions.d.ts.map +1 -1
- package/style/expressions.js +258 -118
- package/style/flat.d.ts +14 -0
- package/style/flat.d.ts.map +1 -1
- package/style/flat.js +6 -0
- package/style/literal.d.ts +204 -3
- package/style/literal.d.ts.map +1 -1
- package/style/literal.js +106 -3
- package/tilegrid/TileGrid.d.ts +1 -9
- package/tilegrid/TileGrid.d.ts.map +1 -1
- package/tilegrid/TileGrid.js +0 -18
- package/tilegrid/WMTS.d.ts +1 -1
- package/tilegrid/WMTS.d.ts.map +1 -1
- package/tilegrid.d.ts +1 -1
- package/tilegrid.d.ts.map +1 -1
- package/util.d.ts.map +1 -1
- package/util.js +1 -1
- package/webgl/BaseTileRepresentation.d.ts +72 -0
- package/webgl/BaseTileRepresentation.d.ts.map +1 -0
- package/webgl/BaseTileRepresentation.js +108 -0
- package/webgl/Buffer.d.ts +9 -6
- package/webgl/Buffer.d.ts.map +1 -1
- package/webgl/Buffer.js +6 -0
- package/webgl/Helper.d.ts +19 -12
- package/webgl/Helper.d.ts.map +1 -1
- package/webgl/Helper.js +79 -71
- package/webgl/ShaderBuilder.d.ts +75 -65
- package/webgl/ShaderBuilder.d.ts.map +1 -1
- package/webgl/ShaderBuilder.js +382 -241
- package/webgl/TileGeometry.d.ts +29 -0
- package/webgl/TileGeometry.d.ts.map +1 -0
- package/webgl/TileGeometry.js +73 -0
- package/webgl/TileTexture.d.ts +8 -51
- package/webgl/TileTexture.d.ts.map +1 -1
- package/webgl/TileTexture.js +11 -62
- package/webgl/styleparser.d.ts +61 -0
- package/webgl/styleparser.d.ts.map +1 -0
- package/webgl/styleparser.js +406 -0
- package/worker/webgl.js +1 -1
- package/events/KeyCode.d.ts +0 -8
- package/events/KeyCode.d.ts.map +0 -1
- package/events/KeyCode.js +0 -14
- package/render/webgl/BatchRenderer.d.ts +0 -92
- package/render/webgl/BatchRenderer.d.ts.map +0 -1
- package/render/webgl/BatchRenderer.js +0 -200
- package/render/webgl/LineStringBatchRenderer.d.ts +0 -27
- package/render/webgl/LineStringBatchRenderer.d.ts.map +0 -1
- package/render/webgl/LineStringBatchRenderer.js +0 -114
- package/render/webgl/PointBatchRenderer.d.ts +0 -26
- package/render/webgl/PointBatchRenderer.d.ts.map +0 -1
- package/render/webgl/PointBatchRenderer.js +0 -95
- package/render/webgl/PolygonBatchRenderer.d.ts +0 -25
- package/render/webgl/PolygonBatchRenderer.d.ts.map +0 -1
- package/render/webgl/PolygonBatchRenderer.js +0 -115
- package/renderer/webgl/shaders.d.ts +0 -43
- package/renderer/webgl/shaders.d.ts.map +0 -1
- package/renderer/webgl/shaders.js +0 -198
package/style/expressions.js
CHANGED
|
@@ -21,15 +21,16 @@ import {asArray, fromString, isStringColor} from '../color.js';
|
|
|
21
21
|
* of bands, depending on the underlying data source and
|
|
22
22
|
* {@link import("../source/GeoTIFF.js").Options configuration}. `xOffset` and `yOffset` are optional
|
|
23
23
|
* and allow specifying pixel offsets for x and y. This is used for sampling data from neighboring pixels.
|
|
24
|
-
* * `['get', 'attributeName']` fetches a feature
|
|
25
|
-
*
|
|
24
|
+
* * `['get', 'attributeName', typeHint]` fetches a feature property value, similar to `feature.get('attributeName')`
|
|
25
|
+
* A type hint can optionally be specified, in case the resulting expression contains a type ambiguity which
|
|
26
|
+
* will make it invalid. Type hints can be one of: 'string', 'color', 'number', 'boolean', 'number[]'
|
|
26
27
|
* * `['resolution']` returns the current resolution
|
|
27
28
|
* * `['time']` returns the time in seconds since the creation of the layer
|
|
28
|
-
* * `['var', 'varName']` fetches a value from the style variables
|
|
29
|
+
* * `['var', 'varName']` fetches a value from the style variables; will throw an error if that variable is undefined
|
|
29
30
|
* * `['zoom']` returns the current zoom level
|
|
30
31
|
*
|
|
31
32
|
* * Math operators:
|
|
32
|
-
* * `['*', value1, value2]` multiplies `value1` by `value2`
|
|
33
|
+
* * `['*', value1, value2]` multiplies `value1` by `value2` (either numbers or colors)
|
|
33
34
|
* * `['/', value1, value2]` divides `value1` by `value2`
|
|
34
35
|
* * `['+', value1, value2]` adds `value1` and `value2`
|
|
35
36
|
* * `['-', value1, value2]` subtracts `value2` from `value1`
|
|
@@ -90,6 +91,7 @@ import {asArray, fromString, isStringColor} from '../color.js';
|
|
|
90
91
|
* Literal values can be of the following types:
|
|
91
92
|
* * `boolean`
|
|
92
93
|
* * `number`
|
|
94
|
+
* * `number[]` (number arrays can only have a length of 2, 3 or 4)
|
|
93
95
|
* * `string`
|
|
94
96
|
* * {@link module:ol/color~Color}
|
|
95
97
|
*
|
|
@@ -112,14 +114,36 @@ export const ValueTypes = {
|
|
|
112
114
|
NONE: 0,
|
|
113
115
|
};
|
|
114
116
|
|
|
117
|
+
/**
|
|
118
|
+
* @param {string} typeHint Type hint
|
|
119
|
+
* @return {ValueTypes} Resulting value type (will be a single type)
|
|
120
|
+
*/
|
|
121
|
+
function getTypeFromHint(typeHint) {
|
|
122
|
+
switch (typeHint) {
|
|
123
|
+
case 'string':
|
|
124
|
+
return ValueTypes.STRING;
|
|
125
|
+
case 'color':
|
|
126
|
+
return ValueTypes.COLOR;
|
|
127
|
+
case 'number':
|
|
128
|
+
return ValueTypes.NUMBER;
|
|
129
|
+
case 'boolean':
|
|
130
|
+
return ValueTypes.BOOLEAN;
|
|
131
|
+
case 'number[]':
|
|
132
|
+
return ValueTypes.NUMBER_ARRAY;
|
|
133
|
+
default:
|
|
134
|
+
throw new Error(`Unrecognized type hint: ${typeHint}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
115
138
|
/**
|
|
116
139
|
* An operator declaration must contain two methods: `getReturnType` which returns a type based on
|
|
117
140
|
* the operator arguments, and `toGlsl` which returns a GLSL-compatible string.
|
|
118
141
|
* Note: both methods can process arguments recursively.
|
|
119
142
|
* @typedef {Object} Operator
|
|
120
143
|
* @property {function(Array<ExpressionValue>): ValueTypes|number} getReturnType Returns one or several types
|
|
121
|
-
* @property {function(ParsingContext, Array<ExpressionValue>, ValueTypes
|
|
122
|
-
*
|
|
144
|
+
* @property {function(ParsingContext, Array<ExpressionValue>, ValueTypes): string} toGlsl Returns a GLSL-compatible string
|
|
145
|
+
* given a parsing context, an array of arguments and an expected type.
|
|
146
|
+
* Note: the expected type can be a combination such as ValueTypes.NUMBER | ValueTypes.STRING or ValueTypes.ANY for instance
|
|
123
147
|
*/
|
|
124
148
|
|
|
125
149
|
/**
|
|
@@ -185,16 +209,48 @@ export function isTypeUnique(valueType) {
|
|
|
185
209
|
return Math.log2(valueType) % 1 === 0;
|
|
186
210
|
}
|
|
187
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Print types as a readable string
|
|
214
|
+
* @param {ValueTypes|number} valueType Number containing value type binary flags
|
|
215
|
+
* @return {string} Types
|
|
216
|
+
*/
|
|
217
|
+
function printTypes(valueType) {
|
|
218
|
+
const result = [];
|
|
219
|
+
if ((valueType & ValueTypes.NUMBER) > 0) {
|
|
220
|
+
result.push('number');
|
|
221
|
+
}
|
|
222
|
+
if ((valueType & ValueTypes.COLOR) > 0) {
|
|
223
|
+
result.push('color');
|
|
224
|
+
}
|
|
225
|
+
if ((valueType & ValueTypes.BOOLEAN) > 0) {
|
|
226
|
+
result.push('boolean');
|
|
227
|
+
}
|
|
228
|
+
if ((valueType & ValueTypes.NUMBER_ARRAY) > 0) {
|
|
229
|
+
result.push('number[]');
|
|
230
|
+
}
|
|
231
|
+
if ((valueType & ValueTypes.STRING) > 0) {
|
|
232
|
+
result.push('string');
|
|
233
|
+
}
|
|
234
|
+
return result.length > 0 ? result.join(', ') : '(no type)';
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @typedef {Object} ParsingContextExternal
|
|
239
|
+
* @property {string} name Name, unprefixed
|
|
240
|
+
* @property {ValueTypes} type One of the value types constants
|
|
241
|
+
*/
|
|
242
|
+
|
|
188
243
|
/**
|
|
189
244
|
* Context available during the parsing of an expression.
|
|
190
245
|
* @typedef {Object} ParsingContext
|
|
191
246
|
* @property {boolean} [inFragmentShader] If false, means the expression output should be made for a vertex shader
|
|
192
|
-
* @property {Array<
|
|
193
|
-
* @property {Array<
|
|
247
|
+
* @property {Array<ParsingContextExternal>} variables External variables used in the expression
|
|
248
|
+
* @property {Array<ParsingContextExternal>} attributes External attributes used in the expression
|
|
194
249
|
* @property {Object<string, number>} stringLiteralsMap This object maps all encountered string values to a number
|
|
195
250
|
* @property {Object<string, string>} functions Lookup of functions used by the style.
|
|
196
251
|
* @property {number} [bandCount] Number of bands per pixel.
|
|
197
252
|
* @property {Array<PaletteTexture>} [paletteTextures] List of palettes used by the style.
|
|
253
|
+
* @property {import("../style/literal").LiteralStyle} style The style being parsed
|
|
198
254
|
*/
|
|
199
255
|
|
|
200
256
|
/**
|
|
@@ -229,15 +285,15 @@ export function arrayToGlsl(array) {
|
|
|
229
285
|
* @return {string} The color expressed in the `vec4(1.0, 1.0, 1.0, 1.0)` form.
|
|
230
286
|
*/
|
|
231
287
|
export function colorToGlsl(color) {
|
|
232
|
-
const array = asArray(color)
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
array
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
);
|
|
288
|
+
const array = asArray(color);
|
|
289
|
+
const alpha = array.length > 3 ? array[3] : 1;
|
|
290
|
+
// all components are premultiplied with alpha value
|
|
291
|
+
return arrayToGlsl([
|
|
292
|
+
(array[0] / 255) * alpha,
|
|
293
|
+
(array[1] / 255) * alpha,
|
|
294
|
+
(array[2] / 255) * alpha,
|
|
295
|
+
alpha,
|
|
296
|
+
]);
|
|
241
297
|
}
|
|
242
298
|
|
|
243
299
|
/**
|
|
@@ -271,10 +327,13 @@ export function stringToGlsl(context, string) {
|
|
|
271
327
|
* will be read and modified during the parsing operation.
|
|
272
328
|
* @param {ParsingContext} context Parsing context
|
|
273
329
|
* @param {ExpressionValue} value Value
|
|
274
|
-
* @param {ValueTypes|number} [
|
|
330
|
+
* @param {ValueTypes|number} [expectedType] Expected final type (can be several types combined)
|
|
331
|
+
* If omitted, defaults to ValueTypes.NUMBER
|
|
275
332
|
* @return {string} GLSL-compatible output
|
|
276
333
|
*/
|
|
277
|
-
export function expressionToGlsl(context, value,
|
|
334
|
+
export function expressionToGlsl(context, value, expectedType) {
|
|
335
|
+
const returnType =
|
|
336
|
+
expectedType !== undefined ? expectedType : ValueTypes.NUMBER;
|
|
278
337
|
// operator
|
|
279
338
|
if (Array.isArray(value) && typeof value[0] === 'string') {
|
|
280
339
|
const operator = Operators[value[0]];
|
|
@@ -283,41 +342,39 @@ export function expressionToGlsl(context, value, typeHint) {
|
|
|
283
342
|
`Unrecognized expression operator: ${JSON.stringify(value)}`
|
|
284
343
|
);
|
|
285
344
|
}
|
|
286
|
-
return operator.toGlsl(context, value.slice(1),
|
|
345
|
+
return operator.toGlsl(context, value.slice(1), returnType);
|
|
287
346
|
}
|
|
288
347
|
|
|
289
|
-
const
|
|
290
|
-
|
|
348
|
+
const possibleType = getValueType(value) & returnType;
|
|
349
|
+
assertNotEmptyType(value, possibleType, '');
|
|
350
|
+
|
|
351
|
+
if ((possibleType & ValueTypes.NUMBER) > 0) {
|
|
291
352
|
return numberToGlsl(/** @type {number} */ (value));
|
|
292
353
|
}
|
|
293
354
|
|
|
294
|
-
if ((
|
|
355
|
+
if ((possibleType & ValueTypes.BOOLEAN) > 0) {
|
|
295
356
|
return value.toString();
|
|
296
357
|
}
|
|
297
358
|
|
|
298
|
-
if (
|
|
299
|
-
(valueType & ValueTypes.STRING) > 0 &&
|
|
300
|
-
(typeHint === undefined || typeHint == ValueTypes.STRING)
|
|
301
|
-
) {
|
|
359
|
+
if ((possibleType & ValueTypes.STRING) > 0) {
|
|
302
360
|
return stringToGlsl(context, value.toString());
|
|
303
361
|
}
|
|
304
362
|
|
|
305
|
-
if (
|
|
306
|
-
(valueType & ValueTypes.COLOR) > 0 &&
|
|
307
|
-
(typeHint === undefined || typeHint == ValueTypes.COLOR)
|
|
308
|
-
) {
|
|
363
|
+
if ((possibleType & ValueTypes.COLOR) > 0) {
|
|
309
364
|
return colorToGlsl(/** @type {Array<number> | string} */ (value));
|
|
310
365
|
}
|
|
311
366
|
|
|
312
|
-
if ((
|
|
367
|
+
if ((possibleType & ValueTypes.NUMBER_ARRAY) > 0) {
|
|
313
368
|
return arrayToGlsl(/** @type {Array<number>} */ (value));
|
|
314
369
|
}
|
|
315
370
|
|
|
316
|
-
throw new Error(
|
|
371
|
+
throw new Error(
|
|
372
|
+
`Unexpected expression ${value} (expected type ${printTypes(returnType)})`
|
|
373
|
+
);
|
|
317
374
|
}
|
|
318
375
|
|
|
319
376
|
function assertNumber(value) {
|
|
320
|
-
if (
|
|
377
|
+
if ((getValueType(value) & ValueTypes.NUMBER) === 0) {
|
|
321
378
|
throw new Error(
|
|
322
379
|
`A numeric value was expected, got ${JSON.stringify(value)} instead`
|
|
323
380
|
);
|
|
@@ -329,14 +386,14 @@ function assertNumbers(values) {
|
|
|
329
386
|
}
|
|
330
387
|
}
|
|
331
388
|
function assertString(value) {
|
|
332
|
-
if (
|
|
389
|
+
if ((getValueType(value) & ValueTypes.STRING) === 0) {
|
|
333
390
|
throw new Error(
|
|
334
391
|
`A string value was expected, got ${JSON.stringify(value)} instead`
|
|
335
392
|
);
|
|
336
393
|
}
|
|
337
394
|
}
|
|
338
395
|
function assertBoolean(value) {
|
|
339
|
-
if (
|
|
396
|
+
if ((getValueType(value) & ValueTypes.BOOLEAN) === 0) {
|
|
340
397
|
throw new Error(
|
|
341
398
|
`A boolean value was expected, got ${JSON.stringify(value)} instead`
|
|
342
399
|
);
|
|
@@ -366,40 +423,81 @@ function assertArgsMaxCount(args, count) {
|
|
|
366
423
|
function assertArgsEven(args) {
|
|
367
424
|
if (args.length % 2 !== 0) {
|
|
368
425
|
throw new Error(
|
|
369
|
-
`An even amount of arguments was expected, got ${
|
|
426
|
+
`An even amount of arguments was expected, got ${JSON.stringify(
|
|
427
|
+
args
|
|
428
|
+
)} instead`
|
|
370
429
|
);
|
|
371
430
|
}
|
|
372
431
|
}
|
|
373
432
|
function assertArgsOdd(args) {
|
|
374
433
|
if (args.length % 2 === 0) {
|
|
375
434
|
throw new Error(
|
|
376
|
-
`An odd amount of arguments was expected, got ${
|
|
435
|
+
`An odd amount of arguments was expected, got ${JSON.stringify(
|
|
436
|
+
args
|
|
437
|
+
)} instead`
|
|
377
438
|
);
|
|
378
439
|
}
|
|
379
440
|
}
|
|
380
|
-
function
|
|
381
|
-
if (
|
|
441
|
+
function assertNotEmptyType(args, types, descriptor) {
|
|
442
|
+
if (types === ValueTypes.NONE) {
|
|
382
443
|
throw new Error(
|
|
383
|
-
`
|
|
444
|
+
`No matching type was found for the following expression ${descriptor}: ${JSON.stringify(
|
|
384
445
|
args
|
|
385
446
|
)}`
|
|
386
447
|
);
|
|
387
448
|
}
|
|
388
449
|
}
|
|
450
|
+
function assertSingleType(args, types, descriptor) {
|
|
451
|
+
assertNotEmptyType(args, types, descriptor);
|
|
452
|
+
if (!isTypeUnique(types)) {
|
|
453
|
+
throw new Error(
|
|
454
|
+
`Expected to have a unique type for the following expression ${descriptor}: ${JSON.stringify(
|
|
455
|
+
args
|
|
456
|
+
)}
|
|
457
|
+
Got the following types instead: ${printTypes(types)}`
|
|
458
|
+
);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function assertOfType(args, types, expectedTypes, descriptor) {
|
|
462
|
+
if ((types & expectedTypes) === ValueTypes.NONE) {
|
|
463
|
+
throw new Error(
|
|
464
|
+
`Expected the ${descriptor} type of the following expression: ${JSON.stringify(
|
|
465
|
+
args
|
|
466
|
+
)} to be of the following types: ${printTypes(expectedTypes)}
|
|
467
|
+
Got these types instead: ${printTypes(types)}`
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
389
471
|
|
|
390
472
|
Operators['get'] = {
|
|
391
473
|
getReturnType: function (args) {
|
|
474
|
+
if (args.length === 2) {
|
|
475
|
+
const hint = args[1];
|
|
476
|
+
return getTypeFromHint(/** @type {string} */ (hint));
|
|
477
|
+
}
|
|
392
478
|
return ValueTypes.ANY;
|
|
393
479
|
},
|
|
394
|
-
toGlsl: function (context, args) {
|
|
395
|
-
|
|
480
|
+
toGlsl: function (context, args, expectedType) {
|
|
481
|
+
assertArgsMinCount(args, 1);
|
|
482
|
+
assertArgsMaxCount(args, 2);
|
|
396
483
|
assertString(args[0]);
|
|
397
|
-
const
|
|
398
|
-
|
|
399
|
-
|
|
484
|
+
const outputType = expectedType & Operators['get'].getReturnType(args);
|
|
485
|
+
assertSingleType(['get', ...args], outputType, '');
|
|
486
|
+
const name = args[0].toString();
|
|
487
|
+
const existing = context.attributes.find((a) => a.name === name);
|
|
488
|
+
if (!existing) {
|
|
489
|
+
context.attributes.push({
|
|
490
|
+
name: name,
|
|
491
|
+
type: outputType,
|
|
492
|
+
});
|
|
493
|
+
} else if (outputType !== existing.type) {
|
|
494
|
+
throw new Error(
|
|
495
|
+
`The following attribute was used in different places with incompatible types: ${name}
|
|
496
|
+
Types were: ${printTypes(existing.type)} and ${printTypes(outputType)}`
|
|
497
|
+
);
|
|
400
498
|
}
|
|
401
499
|
const prefix = context.inFragmentShader ? 'v_' : 'a_';
|
|
402
|
-
return prefix +
|
|
500
|
+
return prefix + name;
|
|
403
501
|
},
|
|
404
502
|
};
|
|
405
503
|
|
|
@@ -413,17 +511,37 @@ export function uniformNameForVariable(variableName) {
|
|
|
413
511
|
}
|
|
414
512
|
|
|
415
513
|
Operators['var'] = {
|
|
416
|
-
getReturnType: function (
|
|
514
|
+
getReturnType: function () {
|
|
417
515
|
return ValueTypes.ANY;
|
|
418
516
|
},
|
|
419
|
-
toGlsl: function (context, args) {
|
|
517
|
+
toGlsl: function (context, args, expectedType) {
|
|
420
518
|
assertArgsCount(args, 1);
|
|
421
519
|
assertString(args[0]);
|
|
422
|
-
const
|
|
423
|
-
if (
|
|
424
|
-
context.variables
|
|
520
|
+
const name = args[0].toString();
|
|
521
|
+
if (
|
|
522
|
+
!context.style.variables ||
|
|
523
|
+
context.style.variables[name] === undefined
|
|
524
|
+
) {
|
|
525
|
+
throw new Error(
|
|
526
|
+
`The following variable is missing from the style: ${name}`
|
|
527
|
+
);
|
|
425
528
|
}
|
|
426
|
-
|
|
529
|
+
const initialValue = context.style.variables[name];
|
|
530
|
+
const outputType = expectedType & getValueType(initialValue);
|
|
531
|
+
assertSingleType(['var', ...args], outputType, '');
|
|
532
|
+
const existing = context.variables.find((a) => a.name === name);
|
|
533
|
+
if (!existing) {
|
|
534
|
+
context.variables.push({
|
|
535
|
+
name: name,
|
|
536
|
+
type: outputType,
|
|
537
|
+
});
|
|
538
|
+
} else if (outputType !== existing.type) {
|
|
539
|
+
throw new Error(
|
|
540
|
+
`The following variable was used in different places with incompatible types: ${name}
|
|
541
|
+
Types were: ${printTypes(existing.type)} and ${printTypes(outputType)}`
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
return uniformNameForVariable(name);
|
|
427
545
|
},
|
|
428
546
|
};
|
|
429
547
|
|
|
@@ -431,7 +549,7 @@ export const PALETTE_TEXTURE_ARRAY = 'u_paletteTextures';
|
|
|
431
549
|
|
|
432
550
|
// ['palette', index, colors]
|
|
433
551
|
Operators['palette'] = {
|
|
434
|
-
getReturnType: function (
|
|
552
|
+
getReturnType: function () {
|
|
435
553
|
return ValueTypes.COLOR;
|
|
436
554
|
},
|
|
437
555
|
toGlsl: function (context, args) {
|
|
@@ -489,7 +607,7 @@ Operators['palette'] = {
|
|
|
489
607
|
const GET_BAND_VALUE_FUNC = 'getBandValue';
|
|
490
608
|
|
|
491
609
|
Operators['band'] = {
|
|
492
|
-
getReturnType: function (
|
|
610
|
+
getReturnType: function () {
|
|
493
611
|
return ValueTypes.NUMBER;
|
|
494
612
|
},
|
|
495
613
|
toGlsl: function (context, args) {
|
|
@@ -532,7 +650,7 @@ Operators['band'] = {
|
|
|
532
650
|
};
|
|
533
651
|
|
|
534
652
|
Operators['time'] = {
|
|
535
|
-
getReturnType: function (
|
|
653
|
+
getReturnType: function () {
|
|
536
654
|
return ValueTypes.NUMBER;
|
|
537
655
|
},
|
|
538
656
|
toGlsl: function (context, args) {
|
|
@@ -542,7 +660,7 @@ Operators['time'] = {
|
|
|
542
660
|
};
|
|
543
661
|
|
|
544
662
|
Operators['zoom'] = {
|
|
545
|
-
getReturnType: function (
|
|
663
|
+
getReturnType: function () {
|
|
546
664
|
return ValueTypes.NUMBER;
|
|
547
665
|
},
|
|
548
666
|
toGlsl: function (context, args) {
|
|
@@ -552,7 +670,7 @@ Operators['zoom'] = {
|
|
|
552
670
|
};
|
|
553
671
|
|
|
554
672
|
Operators['resolution'] = {
|
|
555
|
-
getReturnType: function (
|
|
673
|
+
getReturnType: function () {
|
|
556
674
|
return ValueTypes.NUMBER;
|
|
557
675
|
},
|
|
558
676
|
toGlsl: function (context, args) {
|
|
@@ -563,17 +681,32 @@ Operators['resolution'] = {
|
|
|
563
681
|
|
|
564
682
|
Operators['*'] = {
|
|
565
683
|
getReturnType: function (args) {
|
|
566
|
-
|
|
684
|
+
let outputType = ValueTypes.NUMBER | ValueTypes.COLOR;
|
|
685
|
+
for (let i = 0; i < args.length; i++) {
|
|
686
|
+
outputType = outputType & getValueType(args[i]);
|
|
687
|
+
}
|
|
688
|
+
return outputType;
|
|
567
689
|
},
|
|
568
|
-
toGlsl: function (context, args) {
|
|
690
|
+
toGlsl: function (context, args, expectedType) {
|
|
569
691
|
assertArgsMinCount(args, 2);
|
|
570
|
-
|
|
571
|
-
|
|
692
|
+
let outputType = expectedType;
|
|
693
|
+
for (let i = 0; i < args.length; i++) {
|
|
694
|
+
outputType = outputType & getValueType(args[i]);
|
|
695
|
+
}
|
|
696
|
+
assertOfType(
|
|
697
|
+
args,
|
|
698
|
+
outputType,
|
|
699
|
+
ValueTypes.NUMBER | ValueTypes.COLOR,
|
|
700
|
+
'output'
|
|
701
|
+
);
|
|
702
|
+
return `(${args
|
|
703
|
+
.map((arg) => expressionToGlsl(context, arg, outputType))
|
|
704
|
+
.join(' * ')})`;
|
|
572
705
|
},
|
|
573
706
|
};
|
|
574
707
|
|
|
575
708
|
Operators['/'] = {
|
|
576
|
-
getReturnType: function (
|
|
709
|
+
getReturnType: function () {
|
|
577
710
|
return ValueTypes.NUMBER;
|
|
578
711
|
},
|
|
579
712
|
toGlsl: function (context, args) {
|
|
@@ -587,19 +720,18 @@ Operators['/'] = {
|
|
|
587
720
|
};
|
|
588
721
|
|
|
589
722
|
Operators['+'] = {
|
|
590
|
-
getReturnType: function (
|
|
723
|
+
getReturnType: function () {
|
|
591
724
|
return ValueTypes.NUMBER;
|
|
592
725
|
},
|
|
593
726
|
toGlsl: function (context, args) {
|
|
594
727
|
assertArgsMinCount(args, 2);
|
|
595
728
|
assertNumbers(args);
|
|
596
|
-
|
|
597
729
|
return `(${args.map((arg) => expressionToGlsl(context, arg)).join(' + ')})`;
|
|
598
730
|
},
|
|
599
731
|
};
|
|
600
732
|
|
|
601
733
|
Operators['-'] = {
|
|
602
|
-
getReturnType: function (
|
|
734
|
+
getReturnType: function () {
|
|
603
735
|
return ValueTypes.NUMBER;
|
|
604
736
|
},
|
|
605
737
|
toGlsl: function (context, args) {
|
|
@@ -613,7 +745,7 @@ Operators['-'] = {
|
|
|
613
745
|
};
|
|
614
746
|
|
|
615
747
|
Operators['clamp'] = {
|
|
616
|
-
getReturnType: function (
|
|
748
|
+
getReturnType: function () {
|
|
617
749
|
return ValueTypes.NUMBER;
|
|
618
750
|
},
|
|
619
751
|
toGlsl: function (context, args) {
|
|
@@ -626,7 +758,7 @@ Operators['clamp'] = {
|
|
|
626
758
|
};
|
|
627
759
|
|
|
628
760
|
Operators['%'] = {
|
|
629
|
-
getReturnType: function (
|
|
761
|
+
getReturnType: function () {
|
|
630
762
|
return ValueTypes.NUMBER;
|
|
631
763
|
},
|
|
632
764
|
toGlsl: function (context, args) {
|
|
@@ -640,7 +772,7 @@ Operators['%'] = {
|
|
|
640
772
|
};
|
|
641
773
|
|
|
642
774
|
Operators['^'] = {
|
|
643
|
-
getReturnType: function (
|
|
775
|
+
getReturnType: function () {
|
|
644
776
|
return ValueTypes.NUMBER;
|
|
645
777
|
},
|
|
646
778
|
toGlsl: function (context, args) {
|
|
@@ -654,7 +786,7 @@ Operators['^'] = {
|
|
|
654
786
|
};
|
|
655
787
|
|
|
656
788
|
Operators['abs'] = {
|
|
657
|
-
getReturnType: function (
|
|
789
|
+
getReturnType: function () {
|
|
658
790
|
return ValueTypes.NUMBER;
|
|
659
791
|
},
|
|
660
792
|
toGlsl: function (context, args) {
|
|
@@ -665,7 +797,7 @@ Operators['abs'] = {
|
|
|
665
797
|
};
|
|
666
798
|
|
|
667
799
|
Operators['floor'] = {
|
|
668
|
-
getReturnType: function (
|
|
800
|
+
getReturnType: function () {
|
|
669
801
|
return ValueTypes.NUMBER;
|
|
670
802
|
},
|
|
671
803
|
toGlsl: function (context, args) {
|
|
@@ -676,7 +808,7 @@ Operators['floor'] = {
|
|
|
676
808
|
};
|
|
677
809
|
|
|
678
810
|
Operators['round'] = {
|
|
679
|
-
getReturnType: function (
|
|
811
|
+
getReturnType: function () {
|
|
680
812
|
return ValueTypes.NUMBER;
|
|
681
813
|
},
|
|
682
814
|
toGlsl: function (context, args) {
|
|
@@ -687,7 +819,7 @@ Operators['round'] = {
|
|
|
687
819
|
};
|
|
688
820
|
|
|
689
821
|
Operators['ceil'] = {
|
|
690
|
-
getReturnType: function (
|
|
822
|
+
getReturnType: function () {
|
|
691
823
|
return ValueTypes.NUMBER;
|
|
692
824
|
},
|
|
693
825
|
toGlsl: function (context, args) {
|
|
@@ -698,7 +830,7 @@ Operators['ceil'] = {
|
|
|
698
830
|
};
|
|
699
831
|
|
|
700
832
|
Operators['sin'] = {
|
|
701
|
-
getReturnType: function (
|
|
833
|
+
getReturnType: function () {
|
|
702
834
|
return ValueTypes.NUMBER;
|
|
703
835
|
},
|
|
704
836
|
toGlsl: function (context, args) {
|
|
@@ -709,7 +841,7 @@ Operators['sin'] = {
|
|
|
709
841
|
};
|
|
710
842
|
|
|
711
843
|
Operators['cos'] = {
|
|
712
|
-
getReturnType: function (
|
|
844
|
+
getReturnType: function () {
|
|
713
845
|
return ValueTypes.NUMBER;
|
|
714
846
|
},
|
|
715
847
|
toGlsl: function (context, args) {
|
|
@@ -720,7 +852,7 @@ Operators['cos'] = {
|
|
|
720
852
|
};
|
|
721
853
|
|
|
722
854
|
Operators['atan'] = {
|
|
723
|
-
getReturnType: function (
|
|
855
|
+
getReturnType: function () {
|
|
724
856
|
return ValueTypes.NUMBER;
|
|
725
857
|
},
|
|
726
858
|
toGlsl: function (context, args) {
|
|
@@ -737,7 +869,7 @@ Operators['atan'] = {
|
|
|
737
869
|
};
|
|
738
870
|
|
|
739
871
|
Operators['>'] = {
|
|
740
|
-
getReturnType: function (
|
|
872
|
+
getReturnType: function () {
|
|
741
873
|
return ValueTypes.BOOLEAN;
|
|
742
874
|
},
|
|
743
875
|
toGlsl: function (context, args) {
|
|
@@ -751,7 +883,7 @@ Operators['>'] = {
|
|
|
751
883
|
};
|
|
752
884
|
|
|
753
885
|
Operators['>='] = {
|
|
754
|
-
getReturnType: function (
|
|
886
|
+
getReturnType: function () {
|
|
755
887
|
return ValueTypes.BOOLEAN;
|
|
756
888
|
},
|
|
757
889
|
toGlsl: function (context, args) {
|
|
@@ -765,7 +897,7 @@ Operators['>='] = {
|
|
|
765
897
|
};
|
|
766
898
|
|
|
767
899
|
Operators['<'] = {
|
|
768
|
-
getReturnType: function (
|
|
900
|
+
getReturnType: function () {
|
|
769
901
|
return ValueTypes.BOOLEAN;
|
|
770
902
|
},
|
|
771
903
|
toGlsl: function (context, args) {
|
|
@@ -779,7 +911,7 @@ Operators['<'] = {
|
|
|
779
911
|
};
|
|
780
912
|
|
|
781
913
|
Operators['<='] = {
|
|
782
|
-
getReturnType: function (
|
|
914
|
+
getReturnType: function () {
|
|
783
915
|
return ValueTypes.BOOLEAN;
|
|
784
916
|
},
|
|
785
917
|
toGlsl: function (context, args) {
|
|
@@ -794,7 +926,7 @@ Operators['<='] = {
|
|
|
794
926
|
|
|
795
927
|
function getEqualOperator(operator) {
|
|
796
928
|
return {
|
|
797
|
-
getReturnType: function (
|
|
929
|
+
getReturnType: function () {
|
|
798
930
|
return ValueTypes.BOOLEAN;
|
|
799
931
|
},
|
|
800
932
|
toGlsl: function (context, args) {
|
|
@@ -831,19 +963,19 @@ Operators['=='] = getEqualOperator('==');
|
|
|
831
963
|
Operators['!='] = getEqualOperator('!=');
|
|
832
964
|
|
|
833
965
|
Operators['!'] = {
|
|
834
|
-
getReturnType: function (
|
|
966
|
+
getReturnType: function () {
|
|
835
967
|
return ValueTypes.BOOLEAN;
|
|
836
968
|
},
|
|
837
969
|
toGlsl: function (context, args) {
|
|
838
970
|
assertArgsCount(args, 1);
|
|
839
971
|
assertBoolean(args[0]);
|
|
840
|
-
return `(!${expressionToGlsl(context, args[0])})`;
|
|
972
|
+
return `(!${expressionToGlsl(context, args[0], ValueTypes.BOOLEAN)})`;
|
|
841
973
|
},
|
|
842
974
|
};
|
|
843
975
|
|
|
844
976
|
function getDecisionOperator(operator) {
|
|
845
977
|
return {
|
|
846
|
-
getReturnType: function (
|
|
978
|
+
getReturnType: function () {
|
|
847
979
|
return ValueTypes.BOOLEAN;
|
|
848
980
|
},
|
|
849
981
|
toGlsl: function (context, args) {
|
|
@@ -851,9 +983,8 @@ function getDecisionOperator(operator) {
|
|
|
851
983
|
for (let i = 0; i < args.length; i++) {
|
|
852
984
|
assertBoolean(args[i]);
|
|
853
985
|
}
|
|
854
|
-
let result =
|
|
855
|
-
|
|
856
|
-
.map((arg) => expressionToGlsl(context, arg))
|
|
986
|
+
let result = args
|
|
987
|
+
.map((arg) => expressionToGlsl(context, arg, ValueTypes.BOOLEAN))
|
|
857
988
|
.join(` ${operator} `);
|
|
858
989
|
result = `(${result})`;
|
|
859
990
|
return result;
|
|
@@ -866,7 +997,7 @@ Operators['all'] = getDecisionOperator('&&');
|
|
|
866
997
|
Operators['any'] = getDecisionOperator('||');
|
|
867
998
|
|
|
868
999
|
Operators['between'] = {
|
|
869
|
-
getReturnType: function (
|
|
1000
|
+
getReturnType: function () {
|
|
870
1001
|
return ValueTypes.BOOLEAN;
|
|
871
1002
|
},
|
|
872
1003
|
toGlsl: function (context, args) {
|
|
@@ -880,7 +1011,7 @@ Operators['between'] = {
|
|
|
880
1011
|
};
|
|
881
1012
|
|
|
882
1013
|
Operators['array'] = {
|
|
883
|
-
getReturnType: function (
|
|
1014
|
+
getReturnType: function () {
|
|
884
1015
|
return ValueTypes.NUMBER_ARRAY;
|
|
885
1016
|
},
|
|
886
1017
|
toGlsl: function (context, args) {
|
|
@@ -888,31 +1019,28 @@ Operators['array'] = {
|
|
|
888
1019
|
assertArgsMaxCount(args, 4);
|
|
889
1020
|
assertNumbers(args);
|
|
890
1021
|
const parsedArgs = args.map(function (val) {
|
|
891
|
-
return expressionToGlsl(context, val
|
|
1022
|
+
return expressionToGlsl(context, val);
|
|
892
1023
|
});
|
|
893
1024
|
return `vec${args.length}(${parsedArgs.join(', ')})`;
|
|
894
1025
|
},
|
|
895
1026
|
};
|
|
896
1027
|
|
|
897
1028
|
Operators['color'] = {
|
|
898
|
-
getReturnType: function (
|
|
1029
|
+
getReturnType: function () {
|
|
899
1030
|
return ValueTypes.COLOR;
|
|
900
1031
|
},
|
|
901
1032
|
toGlsl: function (context, args) {
|
|
902
1033
|
assertArgsMinCount(args, 3);
|
|
903
1034
|
assertArgsMaxCount(args, 4);
|
|
904
1035
|
assertNumbers(args);
|
|
905
|
-
const
|
|
1036
|
+
const parsedArgs = args
|
|
1037
|
+
.slice(0, 3)
|
|
1038
|
+
.map((val) => `${expressionToGlsl(context, val)} / 255.0`);
|
|
906
1039
|
if (args.length === 3) {
|
|
907
|
-
|
|
1040
|
+
return `vec4(${parsedArgs.join(', ')}, 1.0)`;
|
|
908
1041
|
}
|
|
909
|
-
const
|
|
910
|
-
|
|
911
|
-
expressionToGlsl(context, val, ValueTypes.NUMBER) +
|
|
912
|
-
(i < 3 ? ' / 255.0' : '')
|
|
913
|
-
);
|
|
914
|
-
});
|
|
915
|
-
return `vec${args.length}(${parsedArgs.join(', ')})`;
|
|
1042
|
+
const alpha = expressionToGlsl(context, args[3]);
|
|
1043
|
+
return `(${alpha} * vec4(${parsedArgs.join(', ')}, 1.0))`;
|
|
916
1044
|
},
|
|
917
1045
|
};
|
|
918
1046
|
|
|
@@ -924,7 +1052,7 @@ Operators['interpolate'] = {
|
|
|
924
1052
|
}
|
|
925
1053
|
return type;
|
|
926
1054
|
},
|
|
927
|
-
toGlsl: function (context, args,
|
|
1055
|
+
toGlsl: function (context, args, expectedType) {
|
|
928
1056
|
assertArgsEven(args);
|
|
929
1057
|
assertArgsMinCount(args, 6);
|
|
930
1058
|
|
|
@@ -950,19 +1078,20 @@ Operators['interpolate'] = {
|
|
|
950
1078
|
}
|
|
951
1079
|
|
|
952
1080
|
// compute input/output types
|
|
953
|
-
|
|
954
|
-
const outputType =
|
|
955
|
-
|
|
1081
|
+
const inputType = ValueTypes.NUMBER;
|
|
1082
|
+
const outputType =
|
|
1083
|
+
Operators['interpolate'].getReturnType(args) & expectedType;
|
|
1084
|
+
assertSingleType(['interpolate', ...args], outputType, 'output');
|
|
956
1085
|
|
|
957
|
-
const input = expressionToGlsl(context, args[1]);
|
|
1086
|
+
const input = expressionToGlsl(context, args[1], inputType);
|
|
958
1087
|
const exponent = numberToGlsl(interpolation);
|
|
959
1088
|
|
|
960
1089
|
let result = '';
|
|
961
1090
|
for (let i = 2; i < args.length - 2; i += 2) {
|
|
962
|
-
const stop1 = expressionToGlsl(context, args[i]);
|
|
1091
|
+
const stop1 = expressionToGlsl(context, args[i], inputType);
|
|
963
1092
|
const output1 =
|
|
964
1093
|
result || expressionToGlsl(context, args[i + 1], outputType);
|
|
965
|
-
const stop2 = expressionToGlsl(context, args[i + 2]);
|
|
1094
|
+
const stop2 = expressionToGlsl(context, args[i + 2], inputType);
|
|
966
1095
|
const output2 = expressionToGlsl(context, args[i + 3], outputType);
|
|
967
1096
|
result = `mix(${output1}, ${output2}, pow(clamp((${input} - ${stop1}) / (${stop2} - ${stop1}), 0.0, 1.0), ${exponent}))`;
|
|
968
1097
|
}
|
|
@@ -979,15 +1108,27 @@ Operators['match'] = {
|
|
|
979
1108
|
type = type & getValueType(args[args.length - 1]);
|
|
980
1109
|
return type;
|
|
981
1110
|
},
|
|
982
|
-
toGlsl: function (context, args,
|
|
1111
|
+
toGlsl: function (context, args, expectedType) {
|
|
983
1112
|
assertArgsEven(args);
|
|
984
1113
|
assertArgsMinCount(args, 4);
|
|
985
1114
|
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1115
|
+
let inputType = getValueType(args[0]);
|
|
1116
|
+
for (let i = 1; i < args.length - 1; i += 2) {
|
|
1117
|
+
inputType = inputType & getValueType(args[i]);
|
|
1118
|
+
}
|
|
1119
|
+
assertOfType(
|
|
1120
|
+
['match', ...args],
|
|
1121
|
+
inputType,
|
|
1122
|
+
ValueTypes.STRING | ValueTypes.NUMBER | ValueTypes.BOOLEAN,
|
|
1123
|
+
'input'
|
|
1124
|
+
);
|
|
1125
|
+
inputType =
|
|
1126
|
+
(ValueTypes.STRING | ValueTypes.NUMBER | ValueTypes.BOOLEAN) & inputType;
|
|
1127
|
+
|
|
1128
|
+
const outputType = Operators['match'].getReturnType(args) & expectedType;
|
|
1129
|
+
assertSingleType(['match', ...args], outputType, 'output');
|
|
989
1130
|
|
|
990
|
-
const input = expressionToGlsl(context, args[0]);
|
|
1131
|
+
const input = expressionToGlsl(context, args[0], inputType);
|
|
991
1132
|
const fallback = expressionToGlsl(
|
|
992
1133
|
context,
|
|
993
1134
|
args[args.length - 1],
|
|
@@ -995,7 +1136,7 @@ Operators['match'] = {
|
|
|
995
1136
|
);
|
|
996
1137
|
let result = null;
|
|
997
1138
|
for (let i = args.length - 3; i >= 1; i -= 2) {
|
|
998
|
-
const match = expressionToGlsl(context, args[i]);
|
|
1139
|
+
const match = expressionToGlsl(context, args[i], inputType);
|
|
999
1140
|
const output = expressionToGlsl(context, args[i + 1], outputType);
|
|
1000
1141
|
result = `(${input} == ${match} ? ${output} : ${result || fallback})`;
|
|
1001
1142
|
}
|
|
@@ -1012,13 +1153,12 @@ Operators['case'] = {
|
|
|
1012
1153
|
type = type & getValueType(args[args.length - 1]);
|
|
1013
1154
|
return type;
|
|
1014
1155
|
},
|
|
1015
|
-
toGlsl: function (context, args,
|
|
1156
|
+
toGlsl: function (context, args, expectedType) {
|
|
1016
1157
|
assertArgsOdd(args);
|
|
1017
1158
|
assertArgsMinCount(args, 3);
|
|
1018
1159
|
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
assertUniqueInferredType(args, outputType);
|
|
1160
|
+
const outputType = Operators['case'].getReturnType(args) & expectedType;
|
|
1161
|
+
assertSingleType(['case', ...args], outputType, 'output');
|
|
1022
1162
|
for (let i = 0; i < args.length - 1; i += 2) {
|
|
1023
1163
|
assertBoolean(args[i]);
|
|
1024
1164
|
}
|
|
@@ -1030,7 +1170,7 @@ Operators['case'] = {
|
|
|
1030
1170
|
);
|
|
1031
1171
|
let result = null;
|
|
1032
1172
|
for (let i = args.length - 3; i >= 0; i -= 2) {
|
|
1033
|
-
const condition = expressionToGlsl(context, args[i]);
|
|
1173
|
+
const condition = expressionToGlsl(context, args[i], ValueTypes.BOOLEAN);
|
|
1034
1174
|
const output = expressionToGlsl(context, args[i + 1], outputType);
|
|
1035
1175
|
result = `(${condition} ? ${output} : ${result || fallback})`;
|
|
1036
1176
|
}
|