module Data.Geo.OSM.Way
(
Way
, way
) where
import Text.XML.HXT.Arrow.Pickle
import Data.Geo.OSM.Nd
import Data.Geo.OSM.NWRCommon
import Data.Geo.OSM.Tag
import Data.Geo.OSM.Lens.NdL
import Data.Geo.OSM.Lens.IdL
import Data.Geo.OSM.Lens.TagsL
import Data.Geo.OSM.Lens.ChangesetL
import Data.Geo.OSM.Lens.VisibleL
import Data.Geo.OSM.Lens.UserL
import Data.Geo.OSM.Lens.UidL
import Data.Geo.OSM.Lens.TimestampL
import Data.Lens.Common
import Control.Comonad.Trans.Store
import Control.Category
import Prelude hiding ((.))
data Way =
Way [Nd] NWRCommon
deriving Eq
instance XmlPickler Way where
xpickle =
xpElem "way" (xpWrap (uncurry Way, \(Way n r) -> (n, r))
(xpPair (xpList xpickle) xpickle))
instance Show Way where
show =
showPickled []
instance NdL Way where
ndL =
Lens $ \(Way nds common) -> store (\nds -> Way nds common) nds
commonL ::
Lens Way NWRCommon
commonL =
Lens (\(Way nds common) -> store (\common -> Way nds common) common)
instance IdL Way where
idL =
idL . commonL
instance TagsL Way where
tagsL =
tagsL . commonL
instance ChangesetL Way where
changesetL =
changesetL . commonL
instance VisibleL Way where
visibleL =
visibleL . commonL
instance UserL Way (Maybe String) where
userL =
userL . commonL
instance UidL Way where
uidL =
uidL . commonL
instance TimestampL Way (Maybe String) where
timestampL =
timestampL . commonL
way ::
[Nd]
-> String
-> [Tag]
-> Maybe String
-> Bool
-> (Maybe String, Maybe String)
-> Maybe String
-> Way
way =
(. nwrCommon) . (.) . (.) . (.) . (.) . (.) . Way