{-# LANGUAGE EmptyDataDecls, ExistentialQuantification,
  FlexibleContexts, FlexibleInstances, ForeignFunctionInterface,
  MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies,
  TypeSynonymInstances #-}
module GDAL.OGRPolygon.Interface where
import Data.Word
import Data.Int
import Foreign.C
import Foreign.Ptr
import FFICXX.Runtime.Cast
import GDAL.OGRPolygon.RawType
import GDAL.OGRCurvePolygon.Interface

class (IOGRCurvePolygon a) => IOGRPolygon a where

upcastOGRPolygon ::
                 forall a . (FPtr a, IOGRPolygon a) => a -> OGRPolygon
upcastOGRPolygon :: forall a. (FPtr a, IOGRPolygon a) => a -> OGRPolygon
upcastOGRPolygon a
h
  = let fh :: Ptr (Raw a)
fh = a -> Ptr (Raw a)
forall a. FPtr a => a -> Ptr (Raw a)
get_fptr a
h
        Ptr RawOGRPolygon
fh2 :: Ptr RawOGRPolygon = Ptr (Raw a) -> Ptr RawOGRPolygon
forall a b. Ptr a -> Ptr b
castPtr Ptr (Raw a)
fh
      in Ptr (Raw OGRPolygon) -> OGRPolygon
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj Ptr (Raw OGRPolygon)
Ptr RawOGRPolygon
fh2

downcastOGRPolygon ::
                   forall a . (FPtr a, IOGRPolygon a) => OGRPolygon -> a
downcastOGRPolygon :: forall a. (FPtr a, IOGRPolygon a) => OGRPolygon -> a
downcastOGRPolygon OGRPolygon
h
  = let fh :: Ptr (Raw OGRPolygon)
fh = OGRPolygon -> Ptr (Raw OGRPolygon)
forall a. FPtr a => a -> Ptr (Raw a)
get_fptr OGRPolygon
h
        fh2 :: Ptr (Raw a)
fh2 = Ptr RawOGRPolygon -> Ptr (Raw a)
forall a b. Ptr a -> Ptr b
castPtr Ptr (Raw OGRPolygon)
Ptr RawOGRPolygon
fh
      in Ptr (Raw a) -> a
forall a. FPtr a => Ptr (Raw a) -> a
cast_fptr_to_obj Ptr (Raw a)
fh2