aboutsummaryrefslogtreecommitdiffstats
path: root/src/Mapbox
diff options
context:
space:
mode:
authorJakub Hampl <kopomir@gmail.com>2018-08-01 09:38:06 +0100
committerJakub Hampl <kopomir@gmail.com>2018-08-01 09:38:06 +0100
commit11d932001ed65fed690b835e5eef504f90845533 (patch)
treea38fc395fbb9babfe0d3ab0127c0d44d1021dccf /src/Mapbox
parent1bf47c82dbf2849495db3ce9b586c14cb2819a8c (diff)
Misc fixes
Diffstat (limited to 'src/Mapbox')
-rw-r--r--src/Mapbox/Element.elm14
-rw-r--r--src/Mapbox/Expression.elm228
-rw-r--r--src/Mapbox/Layer.elm136
-rw-r--r--src/Mapbox/Source.elm2
-rw-r--r--src/Mapbox/Style.elm2
5 files changed, 194 insertions, 188 deletions
diff --git a/src/Mapbox/Element.elm b/src/Mapbox/Element.elm
index f7382ca..14b6873 100644
--- a/src/Mapbox/Element.elm
+++ b/src/Mapbox/Element.elm
@@ -1,4 +1,4 @@
-module Mapbox.Element exposing (map, css, MapboxAttr, token, id, maxZoom, minZoom, maxBounds, renderWorldCopies, EventData, TouchEvent, eventFeaturesFilter, eventFeaturesLayers, onMouseDown, onMouseUp, onMouseOver, onMouseMove, onClick, onDblClick, onMouseOut, onContextMenu, onZoom, onZoomStart, onZoomEnd, onRotate, onRotateStart, onRotateEnd, onTouchEnd, onTouchMove, onTouchCancel)
+module Mapbox.Element exposing (EventData, MapboxAttr, TouchEvent, css, eventFeaturesFilter, eventFeaturesLayers, id, map, maxBounds, maxZoom, minZoom, onClick, onContextMenu, onDblClick, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onRotate, onRotateEnd, onRotateStart, onTouchCancel, onTouchEnd, onTouchMove, onZoom, onZoomEnd, onZoomStart, renderWorldCopies, token)
{-| This library wraps a Custom Element that actually renders a map.
@@ -25,8 +25,8 @@ import Json.Decode as Decode exposing (Decoder, Value)
import Json.Encode as Encode
import LngLat exposing (LngLat)
import Mapbox.Expression exposing (DataExpression, Expression)
-import Mapbox.Style exposing (Style)
import Mapbox.Helpers exposing (encodePair)
+import Mapbox.Style exposing (Style)
{-| This is the type that all attributes have.
@@ -51,15 +51,15 @@ map attrs style =
(Mapbox.Style.encode style
|> property "mapboxStyle"
)
- :: (List.map (\(MapboxAttr attr) -> attr) attrs)
+ :: List.map (\(MapboxAttr attr) -> attr) attrs
in
- node "elm-mapbox-map" props []
+ node "elm-mapbox-map" props []
{-| This is literally:
<link
- href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.0/mapbox-gl.css'
+ href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.47.0/mapbox-gl.css'
rel='stylesheet' />
You can include the required styles yourself if it fits better with the way you deploy your assets, this is meant as a quick way to get started.
@@ -67,7 +67,7 @@ You can include the required styles yourself if it fits better with the way you
-}
css : Html msg
css =
- node "link" [ attribute "href" "https://api.tiles.mapbox.com/mapbox-gl-js/v0.46.0/mapbox-gl.css", attribute "rel" "stylesheet" ] []
+ node "link" [ attribute "href" "https://api.tiles.mapbox.com/mapbox-gl-js/v0.47.0/mapbox-gl.css", attribute "rel" "stylesheet" ] []
{-| The minimum zoom level of the map (0-24).
@@ -398,4 +398,4 @@ controlledMap { center, zoom, bearing, pitch } attrs style =
:: property "pitch" (Encode.float pitch)
:: List.map (\(MapboxAttr attr) -> attr) attrs
in
- node "elm-mapbox-map" props []
+ node "elm-mapbox-map" props []
diff --git a/src/Mapbox/Expression.elm b/src/Mapbox/Expression.elm
index 31c53c7..d800188 100644
--- a/src/Mapbox/Expression.elm
+++ b/src/Mapbox/Expression.elm
@@ -1,150 +1,150 @@
module Mapbox.Expression
exposing
- ( Expression
- , DataExpression
+ ( Anchor(..)
+ , AnchorAuto
, CameraExpression
- , encode
+ , Collator
, Color
+ , DataExpression
+ , Expression
+ , Interpolation(..)
+ , LineCap
+ , LineJoin
, Object
- , Collator
- , defaultCollator
- , true
- , false
- , bool
- , int
- , float
- , str
- , rgba
- , floats
- , strings
- , object
- , collator
+ , Position
+ , RasterResampling
+ , SymbolPlacement
+ , TextFit
+ , TextJustify
+ , TextTransform
+ , abs
+ , acos
+ , all
+ , anchorAutoAuto
+ , anchorAutoMap
+ , anchorAutoViewport
+ , anchorMap
+ , anchorViewport
+ , any
+ , append
+ , asin
, assertArray
- , assertArrayOfStrings
- , assertArrayOfFloats
, assertArrayOfBools
+ , assertArrayOfFloats
+ , assertArrayOfStrings
, assertBool
, assertFloat
, assertObject
, assertString
- , toBool
- , toColor
- , toFloat
- , toString
- , typeof
, at
- , get
- , has
+ , atan
+ , bool
+ , ceil
+ , coalesce
+ , collator
+ , conditionally
+ , cos
, count
- , length
+ , defaultCollator
+ , divideBy
+ , downcase
+ , e
+ , encode
+ , false
, featureState
+ , float
+ , floats
+ , floor
, geometryType
- , id
- , properties
+ , get
, getProperty
- , hasProperty
- , isEqual
- , notEqual
- , lessThan
- , lessThanOrEqual
, greaterThan
, greaterThanOrEqual
- , isEqualWithCollator
- , notEqualWithCollator
- , lessThanWithCollator
- , lessThanOrEqualWithCollator
- , greaterThanWithCollator
, greaterThanOrEqualWithCollator
- , not
- , all
- , any
+ , greaterThanWithCollator
+ , has
+ , hasProperty
+ , heatmapDensity
+ , id
, ifElse
- , conditionally
- , matchesStr
- , matchesFloat
- , coalesce
+ , int
, interpolate
- , Interpolation(..)
- , step
- , append
- , downcase
- , upcase
+ , isEqual
+ , isEqualWithCollator
, isSupportedScript
- , resolvedLocale
- , makeRGBColor
- , makeRGBAColor
- , rgbaChannels
- , minus
- , multiply
- , divideBy
- , modBy
- , plus
- , raiseBy
- , sqrt
- , abs
- , ceil
- , floor
- , round
- , cos
- , sin
- , tan
- , acos
- , asin
- , atan
- , e
- , pi
+ , length
+ , lessThan
+ , lessThanOrEqual
+ , lessThanOrEqualWithCollator
+ , lessThanWithCollator
+ , lineCapButt
+ , lineCapRound
+ , lineCapSquare
+ , lineJoinBevel
+ , lineJoinMiter
+ , lineJoinRound
+ , lineProgress
, ln
, ln2
, log10
, log2
- , zoom
- , heatmapDensity
- , lineProgress
- , Anchor(..)
- , anchorMap
- , anchorViewport
- , AnchorAuto
- , anchorAutoMap
- , anchorAutoViewport
- , anchorAutoAuto
- , Position
+ , makeRGBAColor
+ , makeRGBColor
+ , matchesFloat
+ , matchesStr
+ , minus
+ , modBy
+ , multiply
+ , not
+ , notEqual
+ , notEqualWithCollator
+ , object
+ , pi
+ , plus
+ , positionBottom
+ , positionBottomLeft
+ , positionBottomRight
, positionCenter
, positionLeft
, positionRight
, positionTop
- , positionBottom
, positionTopLeft
, positionTopRight
- , positionBottomLeft
- , positionBottomRight
- , TextFit
- , textFitNone
- , textFitWidth
- , textFitHeight
- , textFitBoth
- , LineCap
- , lineCapButt
- , lineCapRound
- , lineCapSquare
- , LineJoin
- , lineJoinBevel
- , lineJoinRound
- , lineJoinMiter
- , SymbolPlacement
- , symbolPlacementPoint
+ , properties
+ , raiseBy
+ , rasterResamplingLinear
+ , rasterResamplingNearest
+ , resolvedLocale
+ , rgba
+ , rgbaChannels
+ , round
+ , sin
+ , sqrt
+ , step
+ , str
+ , strings
, symbolPlacementLine
, symbolPlacementLineCenter
- , TextJustify
- , textJustifyLeft
+ , symbolPlacementPoint
+ , tan
+ , textFitBoth
+ , textFitHeight
+ , textFitNone
+ , textFitWidth
, textJustifyCenter
+ , textJustifyLeft
, textJustifyRight
- , TextTransform
+ , textTransformLowercase
, textTransformNone
, textTransformUppercase
- , textTransformLowercase
- , RasterResampling
- , rasterResamplingLinear
- , rasterResamplingNearest
+ , toBool
+ , toColor
+ , toFloat
+ , toString
+ , true
+ , typeof
+ , upcase
+ , zoom
)
{-| Expressions form a little language that can be used to compute values for various layer properties.
@@ -779,6 +779,12 @@ assertBool =
call1 "boolean"
+{-| -}
+assertBoolWithFalback : Bool -> Expression exprType any -> Expression exprType Bool
+assertBoolWithFalback fallback value =
+ call2 "boolean" value (bool fallback)
+
+
-- assertAtLeastOneBool : List (Expression exprType any) -> Expression exprType Bool
-- assertAtLeastOneBool =
@@ -1099,7 +1105,7 @@ matchesStr options (Expression default) (Expression input) =
properOptions =
List.concatMap (\( label, Expression output ) -> [ Json.Encode.string label, output ]) options
in
- call "match" (input :: properOptions ++ [ default ])
+ call "match" (input :: properOptions ++ [ default ])
{-| Selects the output whose label value matches the input value, or the fallback value if no match is found.
@@ -1119,7 +1125,7 @@ matchesFloat options (Expression default) (Expression input) =
properOptions =
List.concatMap (\( label, Expression output ) -> [ Json.Encode.float label, output ]) options
in
- call "match" (input :: properOptions ++ [ default ])
+ call "match" (input :: properOptions ++ [ default ])
{-| Interpolation types:
diff --git a/src/Mapbox/Layer.elm b/src/Mapbox/Layer.elm
index 20e7af5..ce0fa67 100644
--- a/src/Mapbox/Layer.elm
+++ b/src/Mapbox/Layer.elm
@@ -1,55 +1,22 @@
module Mapbox.Layer
exposing
- ( Layer
- , SourceId
- , Background
- , Fill
- , Symbol
- , Line
- , Raster
+ ( Background
, Circle
+ , Fill
, FillExtrusion
, Heatmap
, Hillshade
+ , Layer
, LayerAttr
- , encode
+ , Line
+ , Raster
+ , SourceId
+ , Symbol
, background
- , fill
- , symbol
- , line
- , raster
+ , backgroundColor
+ , backgroundOpacity
+ , backgroundPattern
, circle
- , fillExtrusion
- , heatmap
- , hillshade
- , metadata
- , sourceLayer
- , minzoom
- , maxzoom
- , filter
- , visible
- , fillAntialias
- , fillColor
- , fillOpacity
- , fillOutlineColor
- , fillPattern
- , fillTranslate
- , fillTranslateAnchor
- , lineBlur
- , lineCap
- , lineColor
- , lineDasharray
- , lineGapWidth
- , lineGradient
- , lineJoin
- , lineMiterLimit
- , lineOffset
- , lineOpacity
- , linePattern
- , lineRoundLimit
- , lineTranslate
- , lineTranslateAnchor
- , lineWidth
, circleBlur
, circleColor
, circleOpacity
@@ -61,11 +28,11 @@ module Mapbox.Layer
, circleStrokeWidth
, circleTranslate
, circleTranslateAnchor
- , heatmapColor
- , heatmapIntensity
- , heatmapOpacity
- , heatmapRadius
- , heatmapWeight
+ , encode
+ , fill
+ , fillAntialias
+ , fillColor
+ , fillExtrusion
, fillExtrusionBase
, fillExtrusionColor
, fillExtrusionHeight
@@ -73,6 +40,25 @@ module Mapbox.Layer
, fillExtrusionPattern
, fillExtrusionTranslate
, fillExtrusionTranslateAnchor
+ , fillOpacity
+ , fillOutlineColor
+ , fillPattern
+ , fillTranslate
+ , fillTranslateAnchor
+ , filter
+ , heatmap
+ , heatmapColor
+ , heatmapIntensity
+ , heatmapOpacity
+ , heatmapRadius
+ , heatmapWeight
+ , hillshade
+ , hillshadeAccentColor
+ , hillshadeExaggeration
+ , hillshadeHighlightColor
+ , hillshadeIlluminationAnchor
+ , hillshadeIlluminationDirection
+ , hillshadeShadowColor
, iconAllowOverlap
, iconAnchor
, iconColor
@@ -94,6 +80,36 @@ module Mapbox.Layer
, iconTextFitPadding
, iconTranslate
, iconTranslateAnchor
+ , line
+ , lineBlur
+ , lineCap
+ , lineColor
+ , lineDasharray
+ , lineGapWidth
+ , lineGradient
+ , lineJoin
+ , lineMiterLimit
+ , lineOffset
+ , lineOpacity
+ , linePattern
+ , lineRoundLimit
+ , lineTranslate
+ , lineTranslateAnchor
+ , lineWidth
+ , maxzoom
+ , metadata
+ , minzoom
+ , raster
+ , rasterBrightnessMax
+ , rasterBrightnessMin
+ , rasterContrast
+ , rasterFadeDuration
+ , rasterHueRotate
+ , rasterOpacity
+ , rasterResampling
+ , rasterSaturation
+ , sourceLayer
+ , symbol
, symbolAvoidEdges
, symbolPlacement
, symbolSpacing
@@ -123,30 +139,14 @@ module Mapbox.Layer
, textTransform
, textTranslate
, textTranslateAnchor
- , rasterBrightnessMax
- , rasterBrightnessMin
- , rasterContrast
- , rasterResampling
- , rasterFadeDuration
- , rasterHueRotate
- , rasterOpacity
- , rasterSaturation
- , hillshadeAccentColor
- , hillshadeExaggeration
- , hillshadeHighlightColor
- , hillshadeIlluminationAnchor
- , hillshadeIlluminationDirection
- , hillshadeShadowColor
- , backgroundColor
- , backgroundOpacity
- , backgroundPattern
+ , visible
)
{-| Layers specify what is actually rendered on the map and are rendered in order.
Except for layers of the background type, each layer needs to refer to a source. Layers take the data that they get from a source, optionally filter features, and then define how those features are styled.
-There are two kinds of properties: *Layout* and *Paint* properties.
+There are two kinds of properties: _Layout_ and _Paint_ properties.
Layout properties are applied early in the rendering process and define how data for that layer is passed to the GPU. Changes to a layout property require an asynchronous "layout" step.
@@ -218,7 +218,7 @@ Paint properties are applied later in the rendering process. Changes to a paint
import Array exposing (Array)
import Json.Encode as Encode exposing (Value)
-import Mapbox.Expression as Expression exposing (Anchor, AnchorAuto, CameraExpression, Color, DataExpression, Expression, LineCap, LineJoin, Position, SymbolPlacement, TextFit, TextJustify, TextTransform, RasterResampling)
+import Mapbox.Expression as Expression exposing (Anchor, AnchorAuto, CameraExpression, Color, DataExpression, Expression, LineCap, LineJoin, Position, RasterResampling, SymbolPlacement, TextFit, TextJustify, TextTransform)
{-| Represents a layer.
@@ -313,7 +313,7 @@ encodeAttrs attrs =
{ top = [], layout = [], paint = [] }
attrs
in
- ( "layout", Encode.object layout ) :: ( "paint", Encode.object paint ) :: top
+ ( "layout", Encode.object layout ) :: ( "paint", Encode.object paint ) :: top
{-| The background color or pattern of the map.
diff --git a/src/Mapbox/Source.elm b/src/Mapbox/Source.elm
index 7677df8..5cc571d 100644
--- a/src/Mapbox/Source.elm
+++ b/src/Mapbox/Source.elm
@@ -1,4 +1,4 @@
-module Mapbox.Source exposing (Source, SourceOption, raster, tileSize, rasterFromUrl, RasterSource, scheme, Scheme(..), rasterDEMMapbox, rasterDEMTerrarium, geoJSONFromUrl, geoJSONFromValue, GeoJSONSource, buffer, tolerance, cluster, clusterRadius, lineMetrics, Coords, image, video, staticCanvas, animatedCanvas, bounds, minzoom, maxzoom, attribution, encode, getId, Id, Url, vector, vectorFromUrl, VectorSource)
+module Mapbox.Source exposing (Coords, GeoJSONSource, Id, RasterSource, Scheme(..), Source, SourceOption, Url, VectorSource, animatedCanvas, attribution, bounds, buffer, cluster, clusterRadius, encode, geoJSONFromUrl, geoJSONFromValue, getId, image, lineMetrics, maxzoom, minzoom, raster, rasterDEMMapbox, rasterDEMTerrarium, rasterFromUrl, scheme, staticCanvas, tileSize, tolerance, vector, vectorFromUrl, video)
{-|
diff --git a/src/Mapbox/Style.elm b/src/Mapbox/Style.elm
index 1793067..500cf47 100644
--- a/src/Mapbox/Style.elm
+++ b/src/Mapbox/Style.elm
@@ -1,4 +1,4 @@
-module Mapbox.Style exposing (Style(..), StyleDef, encode, Light, defaultLight, Transition, defaultTransition, MiscAttr, sprite, glyphs, name, defaultCenter, defaultZoomLevel, defaultBearing, defaultPitch, metadata, streets, outdoors, light, dark, satellite, satelliteStreets)
+module Mapbox.Style exposing (Light, MiscAttr, Style(..), StyleDef, Transition, dark, defaultBearing, defaultCenter, defaultLight, defaultPitch, defaultTransition, defaultZoomLevel, encode, glyphs, light, metadata, name, outdoors, satellite, satelliteStreets, sprite, streets)
{-| A Mapbox style is a document that defines the visual appearance of a map: what data to draw, the order to draw it in, and how to style the data when drawing it. A style document is a JSON object with specific root level and nested properties. This specification defines and describes these properties.