hgis-1.0.0.2: src/GIS/Graphics/Types.hs
-- | Module for types associated with generating maps. Includes lenses.
module GIS.Graphics.Types ( Map (..)
, projection
, title
, labelEntities
, labelledDistricts
) where
import Control.Lens
import Data.Default
import GIS.Types
-- | Data type for a map
data Map = Map { _projection :: Projection
, _title :: String
, _labelEntities :: Bool -- whether to label districts
, _labelledDistricts :: [([Polygon], String)] -- the data we actually want to map
}
projection :: Lens' Map Projection
projection f s = fmap (\x -> s { _projection = x }) (f (_projection s))
title :: Lens' Map String
title f s = fmap (\x -> s { _title = x }) (f (_title s))
labelEntities :: Lens' Map Bool
labelEntities f s = fmap (\x -> s { _labelEntities = x }) (f (_labelEntities s))
labelledDistricts :: Lens' Map [([Polygon], String)]
labelledDistricts f s = fmap (\x -> s { _labelledDistricts = x }) (f (_labelledDistricts s))
instance Default Map where
def = Map { _projection = id , _title = mempty , _labelEntities = False , _labelledDistricts = mempty }