packages feed

hgeos 0.1.7.2 → 0.1.7.3

raw patch · 4 files changed

+45/−4 lines, 4 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Data.Geolocation.GEOS: createCollection :: GeometryType -> [Geometry] -> IO (Maybe Geometry)
+ Data.Geolocation.GEOS: createEmptyPolygon :: Context -> IO (Maybe Geometry)
+ Data.Geolocation.GEOS.Imports: c_GEOSGeom_createCollection_r :: GEOSContextHandle -> CInt -> Ptr GEOSGeometryPtr -> CUInt -> IO GEOSGeometryPtr
+ Data.Geolocation.GEOS.Imports: c_GEOSGeom_createEmptyPolygon_r :: GEOSContextHandle -> IO GEOSGeometryPtr
+ Data.Geolocation.GEOS.Trans: createCollectionM :: GeometryType -> [Geometry] -> MaybeT IO Geometry
+ Data.Geolocation.GEOS.Trans: createEmptyPolygonM :: Context -> MaybeT IO Geometry

Files

hgeos.cabal view
@@ -1,5 +1,5 @@ name:                 hgeos-version:              0.1.7.2+version:              0.1.7.3 synopsis:             Simple Haskell bindings to GEOS C API description:   Simple Haskell bindings to the <https://trac.osgeo.org/geos/ GEOS>
src/lib/Data/Geolocation/GEOS.hs view
@@ -30,7 +30,9 @@     , Reader ()     , Writer ()     , area+    , createCollection     , createCoordSeq+    , createEmptyPolygon     , createLinearRing     , createPolygon     , envelope@@ -104,7 +106,11 @@ data Writer = Writer ContextStateRef DeleteAction GEOSWKTWriterPtr  -- |References a <https://trac.osgeo.org/geos/ GEOS> geometry-data Geometry = Geometry ContextStateRef DeleteAction GEOSGeometryPtr+data Geometry = Geometry+    { geometryStateRef :: ContextStateRef+    , geometryDeleteAction :: DeleteAction+    , geometryRawPtr :: GEOSGeometryPtr+    }  -- |Returns area of a 'Geometry' instance area :: Geometry -> IO (Maybe Double)@@ -148,6 +154,15 @@ emptyDeleteAction :: DeleteAction emptyDeleteAction = DeleteAction (ptrToIntPtr nullPtr) (return ()) +-- |Creates a 'Geometry' collection+createCollection :: GeometryType -> [Geometry] -> IO (Maybe Geometry)+createCollection geometryType gs@((Geometry sr _ _) : _) = do+    untrack sr (map geometryDeleteAction gs)+    withArrayLen (map geometryRawPtr gs) $ \count array ->+        checkAndTrackGeometry+            sr+            (\hCtx -> c_GEOSGeom_createCollection_r hCtx (fromIntegral $ fromEnum geometryType) nullPtr (fromIntegral count))+ -- |Creates an empty 'CoordinateSequence' instance createCoordSeq :: Context -> Word -> Word -> IO (Maybe CoordinateSequence) createCoordSeq (Context sr) size dims =@@ -157,6 +172,12 @@         c_GEOSCoordSeq_destroy_r         CoordinateSequence +-- |Returns an empty polygon 'Geometry' instance+createEmptyPolygon :: Context -> IO (Maybe Geometry)+createEmptyPolygon (Context sr) = do+    ContextState{..} <- readIORef sr+    checkAndTrackGeometry sr c_GEOSGeom_createEmptyPolygon_r+ -- |Returns a linear ring 'Geometry' instance from the given coordinate -- sequence createLinearRing :: CoordinateSequence -> IO (Maybe Geometry)@@ -168,8 +189,8 @@ -- array of holes createPolygon :: Geometry -> [Geometry] -> IO (Maybe Geometry) createPolygon (Geometry sr deleteAction h) holes = do-    untrack sr (deleteAction : map (\(Geometry _ x _) -> x) holes)-    withArrayLen (map (\(Geometry _ _ h') -> h') holes) $ \count array ->+    untrack sr (deleteAction : map geometryDeleteAction holes)+    withArrayLen (map geometryRawPtr holes) $ \count array ->         checkAndTrackGeometry             sr             (\hCtx -> c_GEOSGeom_createPolygon_r hCtx h array (fromIntegral count))
src/lib/Data/Geolocation/GEOS/Imports.hs view
@@ -43,6 +43,8 @@     , c_GEOSEnvelope_r     , c_GEOSFree_r_CString     , c_GEOSGeomTypeId_r+    , c_GEOSGeom_createCollection_r+    , c_GEOSGeom_createEmptyPolygon_r     , c_GEOSGeom_createLinearRing_r     , c_GEOSGeom_createPolygon_r     , c_GEOSGeom_destroy_r@@ -160,6 +162,14 @@ -- |Wraps @GEOSGeomTypeId_r@ foreign import ccall "GEOSGeomTypeId_r"     c_GEOSGeomTypeId_r :: GEOSContextHandle -> GEOSGeometryPtr -> IO CInt++-- |Wraps @GEOSGeom_createCollection_r@+foreign import ccall "GEOSGeom_createCollection_r"+    c_GEOSGeom_createCollection_r :: GEOSContextHandle -> CInt -> Ptr GEOSGeometryPtr -> CUInt -> IO GEOSGeometryPtr++-- |Wraps @GEOSGeom_createEmptyPolygon_r@+foreign import ccall "GEOSGeom_createEmptyPolygon_r"+    c_GEOSGeom_createEmptyPolygon_r :: GEOSContextHandle -> IO GEOSGeometryPtr  -- |Wraps @GEOSGeom_createLinearRing_r@ foreign import ccall "GEOSGeom_createLinearRing_r"
src/lib/Data/Geolocation/GEOS/Trans.hs view
@@ -19,7 +19,9 @@  module Data.Geolocation.GEOS.Trans     ( areaM+    , createCollectionM     , createCoordSeqM+    , createEmptyPolygonM     , createLinearRingM     , createPolygonM     , envelopeM@@ -68,9 +70,17 @@ areaM :: Geometry -> MaybeT IO Double areaM = unaryGEOSFunc area +-- |@MaybeT@-wrapped version of 'createCollection'+createCollectionM :: GeometryType -> [Geometry] -> MaybeT IO Geometry+createCollectionM = binaryGEOSFunc createCollection+ -- |@MaybeT@-wrapped version of 'createCoordSeq' createCoordSeqM :: Context -> Word -> Word -> MaybeT IO CoordinateSequence createCoordSeqM = ternaryGEOSFunc createCoordSeq++-- |@MaybeT@-wrapped version of 'createEmptyPolygon'+createEmptyPolygonM :: Context -> MaybeT IO Geometry+createEmptyPolygonM = unaryGEOSFunc createEmptyPolygon  -- |@MaybeT@-wrapped version of 'createLinearRing' createLinearRingM :: CoordinateSequence -> MaybeT IO Geometry