GPX 0.4.5 → 0.4.6
raw patch · 5 files changed
+126/−2 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.Geo.GPX.Util.Remove: removeExtensions :: (Extensions a) => a -> a
+ Data.Geo.GPX.Util.Remove: removeMetadata :: (Metadata a) => a -> a
+ Data.Geo.GPX.Util.Remove: removeRtes :: (Rtes a) => a -> a
+ Data.Geo.GPX.Util.Remove: removeTrks :: (Trks a) => a -> a
+ Data.Geo.GPX.Util.Remove: removeWpts :: (Wpts a) => a -> a
+ Data.Geo.GPX.Util.Reverse: reverseConservingTime :: (Time a) => [a] -> [a]
+ Data.Geo.GPX.Util.Reverse: reverseRtes :: (Rtes a) => a -> a
+ Data.Geo.GPX.Util.Reverse: reverseTrks :: (Trks a) => a -> a
+ Data.Geo.GPX.Util.Reverse: reverseTrksegs :: (Trksegs a) => a -> a
+ Data.Geo.GPX.Util.Reverse: reverseWpts :: (Wpts a) => a -> a
+ Data.Geo.GPX.WptType: wptType' :: LatitudeType -> LongitudeType -> WptType
Files
- Data/Geo/GPX.hs +4/−0
- Data/Geo/GPX/Util/Remove.hs +44/−0
- Data/Geo/GPX/Util/Reverse.hs +47/−0
- Data/Geo/GPX/WptType.hs +28/−1
- GPX.cabal +3/−1
Data/Geo/GPX.hs view
@@ -70,6 +70,8 @@ module Data.Geo.GPX.Accessor.Trkpts, module Data.Geo.GPX.Accessor.Trksegs, module Data.Geo.GPX.Accessor.Latlon,+ module Data.Geo.GPX.Util.Remove,+ module Data.Geo.GPX.Util.Reverse, module Control.Arrow ) where @@ -143,4 +145,6 @@ import Data.Geo.GPX.Accessor.Trkpts import Data.Geo.GPX.Accessor.Trksegs import Data.Geo.GPX.Accessor.Latlon+import Data.Geo.GPX.Util.Remove+import Data.Geo.GPX.Util.Reverse import Control.Arrow
+ Data/Geo/GPX/Util/Remove.hs view
@@ -0,0 +1,44 @@+-- | Utility functions for removing elements of GPX files.+module Data.Geo.GPX.Util.Remove(+ removeWpts,+ removeTrks,+ removeRtes,+ removeMetadata,+ removeExtensions+ ) where++import Data.Geo.GPX.Accessor.Wpts+import Data.Geo.GPX.Accessor.Rtes+import Data.Geo.GPX.Accessor.Trks+import Data.Geo.GPX.Accessor.Metadata+import Data.Geo.GPX.Accessor.Extensions++-- | Removes all waypoints (wpt) elements from the given value.+removeWpts :: (Wpts a) =>+ a+ -> a+removeWpts = usingWpts (const [])++-- | Removes all tracks (trk) elements from the given value.+removeTrks :: (Trks a) =>+ a+ -> a+removeTrks = usingTrks (const [])++-- | Removes all routes (rte) elements from the given value.+removeRtes :: (Rtes a) =>+ a+ -> a+removeRtes = usingRtes (const [])++-- | Removes the metadata element from the given value.+removeMetadata :: (Metadata a) =>+ a+ -> a+removeMetadata = usingMetadata (const Nothing)++-- | Removes the extensions element from the given value.+removeExtensions :: (Extensions a) =>+ a+ -> a+removeExtensions = usingExtensions (const Nothing)
+ Data/Geo/GPX/Util/Reverse.hs view
@@ -0,0 +1,47 @@+-- | Reversing element lists of a GPX files.+module Data.Geo.GPX.Util.Reverse(+ reverseRtes,+ reverseTrks,+ reverseTrksegs,+ reverseWpts,+ reverseConservingTime+ ) where++import Data.Geo.GPX.Accessor.Trks+import Data.Geo.GPX.Accessor.Trkpts+import Data.Geo.GPX.Accessor.Trksegs+import Data.Geo.GPX.Accessor.Wpts+import Data.Geo.GPX.Accessor.Rtes+import Data.Geo.GPX.Accessor.Rtepts+import Data.Geo.GPX.Accessor.Time+import Control.Applicative++-- | Reverses a list of routes (rte).+reverseRtes :: (Rtes a) =>+ a+ -> a+reverseRtes = usingRtes (map (usingRtepts reverse) . reverse)++-- | Reverses a list of tracks (trk).+reverseTrks :: (Trks a) =>+ a+ -> a+reverseTrks = usingTrks (map reverseTrksegs . reverse)++-- | Reverses a list of track segments (trkseg).+reverseTrksegs :: (Trksegs a) =>+ a+ -> a+reverseTrksegs = usingTrksegs (map (usingTrkpts reverse) . reverse)++-- | Reverses a list of waypoints (wpt).+reverseWpts :: (Wpts a) =>+ a+ -> a+reverseWpts = usingWpts reverse++-- | Reverses a list of elements with a time, however, the time is not reversed.+reverseConservingTime :: (Time a) =>+ [a]+ -> [a]+reverseConservingTime = zipWith setTime . map time <*> reverse
Data/Geo/GPX/WptType.hs view
@@ -1,7 +1,8 @@ -- | Complex Type: @wptType@ <http://www.topografix.com/GPX/1/1/#type_wptType> module Data.Geo.GPX.WptType( WptType,- wptType+ wptType,+ wptType' ) where import Data.Geo.GPX.LatitudeType@@ -84,6 +85,32 @@ -> Maybe ExtensionsType -- ^ The extensions. -> WptType wptType a b c d e f g h i j k l m n o p = WptType a b c d e f g h i j k l m n o (fmap abs p)++-- | A waypoint with only a latitude and longitude.+wptType' :: LatitudeType -- ^ The lat.+ -> LongitudeType -- ^ The lon.+ -> WptType+wptType' lat' lon' = wptType lat'+ lon'+ Nothing+ Nothing+ Nothing+ Nothing+ Nothing+ Nothing+ Nothing+ Nothing+ []+ Nothing+ Nothing+ Nothing+ Nothing+ Nothing+ Nothing+ Nothing+ Nothing+ Nothing+ Nothing instance XmlPickler WptType where xpickle = xpWrap (\(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) -> wptType a b c d e f g h i j k l m n o p q r s t u,
GPX.cabal view
@@ -1,5 +1,5 @@ Name: GPX-Version: 0.4.5+Version: 0.4.6 License: BSD3 License-File: LICENSE Synopsis: Parse GPX files@@ -94,3 +94,5 @@ Data.Geo.GPX.Accessor.Trkpts Data.Geo.GPX.Accessor.Trksegs Data.Geo.GPX.Accessor.Latlon+ Data.Geo.GPX.Util.Remove+ Data.Geo.GPX.Util.Reverse