opencascade-hs 0.0.0.1 → 0.1.0.0
raw patch · 17 files changed
+592/−7 lines, 17 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ OpenCascade.Font.BRepFont: ascender :: Ptr BRepFont -> IO Double
+ OpenCascade.Font.BRepFont: data BRepFont
+ OpenCascade.Font.BRepFont: descender :: Ptr BRepFont -> IO Double
+ OpenCascade.Font.BRepFont: fromPathAndSize :: FilePath -> Double -> Acquire (Ptr BRepFont)
+ OpenCascade.Font.BRepFont: initFromNameAspectAndSize :: Ptr BRepFont -> String -> FontAspect -> Double -> IO Bool
+ OpenCascade.Font.BRepFont: initFromPathAndSize :: Ptr BRepFont -> FilePath -> Double -> IO Bool
+ OpenCascade.Font.BRepFont: lineSpacing :: Ptr BRepFont -> IO Double
+ OpenCascade.Font.BRepFont: new :: Acquire (Ptr BRepFont)
+ OpenCascade.Font.BRepFont: pointSize :: Ptr BRepFont -> IO Double
+ OpenCascade.Font.BRepTextBuilder: data BRepTextBuilder
+ OpenCascade.Font.BRepTextBuilder: new :: Acquire (Ptr BRepTextBuilder)
+ OpenCascade.Font.BRepTextBuilder: perform :: Ptr BRepTextBuilder -> Ptr BRepFont -> String -> Ptr Ax3 -> HorizontalTextAlignment -> VerticalTextAlignment -> Acquire (Ptr Shape)
+ OpenCascade.Font.FontAspect: Bold :: FontAspect
+ OpenCascade.Font.FontAspect: BoldItalic :: FontAspect
+ OpenCascade.Font.FontAspect: Italic :: FontAspect
+ OpenCascade.Font.FontAspect: Regular :: FontAspect
+ OpenCascade.Font.FontAspect: Undefined :: FontAspect
+ OpenCascade.Font.FontAspect: data FontAspect
+ OpenCascade.Font.FontAspect: instance GHC.Enum.Enum OpenCascade.Font.FontAspect.FontAspect
+ OpenCascade.Font.FontAspect: instance GHC.Show.Show OpenCascade.Font.FontAspect.FontAspect
+ OpenCascade.Font.Internal.Destructors: deleteBRepFont :: Ptr BRepFont -> IO ()
+ OpenCascade.Font.Internal.Destructors: deleteBRepTextBuilder :: Ptr BRepTextBuilder -> IO ()
+ OpenCascade.Font.Types: data BRepFont
+ OpenCascade.Font.Types: data BRepTextBuilder
+ OpenCascade.GP.Ax3: angle :: Ptr Ax3 -> Ptr Ax3 -> IO Double
+ OpenCascade.GP.Ax3: ax2 :: Ptr Ax3 -> Acquire (Ptr Ax2)
+ OpenCascade.GP.Ax3: axis :: Ptr Ax3 -> Acquire (Ptr Ax1)
+ OpenCascade.GP.Ax3: data Ax3
+ OpenCascade.GP.Ax3: direct :: Ptr Ax3 -> IO Bool
+ OpenCascade.GP.Ax3: direction :: Ptr Ax3 -> Acquire (Ptr Dir)
+ OpenCascade.GP.Ax3: fromAx2 :: Ptr Ax2 -> Acquire (Ptr Ax3)
+ OpenCascade.GP.Ax3: fromPntAndDir :: Ptr Pnt -> Ptr Dir -> Acquire (Ptr Ax3)
+ OpenCascade.GP.Ax3: fromPntDirAndDir :: Ptr Pnt -> Ptr Dir -> Ptr Dir -> Acquire (Ptr Ax3)
+ OpenCascade.GP.Ax3: isCoplanar :: Ptr Ax3 -> Ptr Ax3 -> Double -> Double -> IO Bool
+ OpenCascade.GP.Ax3: isCoplanarAx1 :: Ptr Ax3 -> Ptr Ax1 -> Double -> Double -> IO Bool
+ OpenCascade.GP.Ax3: location :: Ptr Ax3 -> Acquire (Ptr Pnt)
+ OpenCascade.GP.Ax3: mirror :: Ptr Ax3 -> Ptr Ax1 -> IO ()
+ OpenCascade.GP.Ax3: mirrorAx2 :: Ptr Ax3 -> Ptr Ax2 -> IO ()
+ OpenCascade.GP.Ax3: mirrored :: Ptr Ax3 -> Ptr Ax1 -> Acquire (Ptr Ax3)
+ OpenCascade.GP.Ax3: mirroredAx2 :: Ptr Ax3 -> Ptr Ax2 -> Acquire (Ptr Ax3)
+ OpenCascade.GP.Ax3: new :: Acquire (Ptr Ax3)
+ OpenCascade.GP.Ax3: rotate :: Ptr Ax3 -> Ptr Ax1 -> Double -> IO ()
+ OpenCascade.GP.Ax3: rotated :: Ptr Ax3 -> Ptr Ax1 -> Double -> Acquire (Ptr Ax3)
+ OpenCascade.GP.Ax3: scale :: Ptr Ax3 -> Ptr Pnt -> Double -> IO ()
+ OpenCascade.GP.Ax3: scaled :: Ptr Ax3 -> Ptr Pnt -> Double -> Acquire (Ptr Ax3)
+ OpenCascade.GP.Ax3: setAxis :: Ptr Ax3 -> Ptr Ax1 -> IO ()
+ OpenCascade.GP.Ax3: setDirection :: Ptr Ax3 -> Ptr Dir -> IO ()
+ OpenCascade.GP.Ax3: setLocation :: Ptr Ax3 -> Ptr Pnt -> IO ()
+ OpenCascade.GP.Ax3: setXDirection :: Ptr Ax3 -> Ptr Dir -> IO ()
+ OpenCascade.GP.Ax3: setYDirection :: Ptr Ax3 -> Ptr Dir -> IO ()
+ OpenCascade.GP.Ax3: transform :: Ptr Ax3 -> Ptr Trsf -> IO ()
+ OpenCascade.GP.Ax3: transformed :: Ptr Ax3 -> Ptr Trsf -> Acquire (Ptr Ax3)
+ OpenCascade.GP.Ax3: translate :: Ptr Ax3 -> Ptr Vec -> IO ()
+ OpenCascade.GP.Ax3: translateRelative :: Ptr Ax3 -> Ptr Pnt -> Ptr Pnt -> IO ()
+ OpenCascade.GP.Ax3: translated :: Ptr Ax3 -> Ptr Vec -> Acquire (Ptr Ax3)
+ OpenCascade.GP.Ax3: translatedRelative :: Ptr Ax3 -> Ptr Pnt -> Ptr Pnt -> Acquire (Ptr Ax3)
+ OpenCascade.GP.Ax3: xDirection :: Ptr Ax3 -> Acquire (Ptr Dir)
+ OpenCascade.GP.Ax3: xReverse :: Ptr Ax3 -> IO ()
+ OpenCascade.GP.Ax3: yDirection :: Ptr Ax3 -> Acquire (Ptr Dir)
+ OpenCascade.GP.Ax3: yReverse :: Ptr Ax3 -> IO ()
+ OpenCascade.GP.Ax3: zReverse :: Ptr Ax3 -> IO ()
+ OpenCascade.GP.Internal.Destructors: deleteAx3 :: Ptr Ax3 -> IO ()
+ OpenCascade.GP.Types: data Ax3
+ OpenCascade.Graphic3D.HorizontalTextAlignment: Center :: HorizontalTextAlignment
+ OpenCascade.Graphic3D.HorizontalTextAlignment: Left :: HorizontalTextAlignment
+ OpenCascade.Graphic3D.HorizontalTextAlignment: Right :: HorizontalTextAlignment
+ OpenCascade.Graphic3D.HorizontalTextAlignment: data HorizontalTextAlignment
+ OpenCascade.Graphic3D.HorizontalTextAlignment: instance GHC.Enum.Enum OpenCascade.Graphic3D.HorizontalTextAlignment.HorizontalTextAlignment
+ OpenCascade.Graphic3D.HorizontalTextAlignment: instance GHC.Show.Show OpenCascade.Graphic3D.HorizontalTextAlignment.HorizontalTextAlignment
+ OpenCascade.Graphic3D.VerticalTextAlignment: Bottom :: VerticalTextAlignment
+ OpenCascade.Graphic3D.VerticalTextAlignment: Center :: VerticalTextAlignment
+ OpenCascade.Graphic3D.VerticalTextAlignment: Top :: VerticalTextAlignment
+ OpenCascade.Graphic3D.VerticalTextAlignment: TopFirstLine :: VerticalTextAlignment
+ OpenCascade.Graphic3D.VerticalTextAlignment: data VerticalTextAlignment
+ OpenCascade.Graphic3D.VerticalTextAlignment: instance GHC.Enum.Enum OpenCascade.Graphic3D.VerticalTextAlignment.VerticalTextAlignment
+ OpenCascade.Graphic3D.VerticalTextAlignment: instance GHC.Show.Show OpenCascade.Graphic3D.VerticalTextAlignment.VerticalTextAlignment
Files
- CHANGELOG.md +18/−1
- README.md +11/−0
- cpp/hs_Font_BRepFont.cpp +39/−0
- cpp/hs_Font_BRepTextBuilder.cpp +21/−0
- cpp/hs_gp_Ax3.cpp +160/−0
- opencascade-hs.cabal +16/−4
- src/OpenCascade/Font/BRepFont.hs +64/−0
- src/OpenCascade/Font/BRepTextBuilder.hs +32/−0
- src/OpenCascade/Font/FontAspect.hs +5/−0
- src/OpenCascade/Font/Internal/Destructors.hs +11/−0
- src/OpenCascade/Font/Types.hs +5/−0
- src/OpenCascade/GP/Ax3.hs +192/−0
- src/OpenCascade/GP/Internal/Destructors.hs +2/−1
- src/OpenCascade/GP/Types.hs +1/−0
- src/OpenCascade/Graphic3D/HorizontalTextAlignment.hs +8/−0
- src/OpenCascade/Graphic3D/VerticalTextAlignment.hs +6/−0
- src/OpenCascade/TopoDS/Shape.hs +1/−1
CHANGELOG.md view
@@ -8,4 +8,21 @@ ## Unreleased -## 0.0.0.1 - YYYY-MM-DD+## 0.1.0.0 - 2023-12-05 ++### Added ++- Add OpenCascade.Font, including:+ - Add OpenCascade.Font.BRepFont+ - Add OpenCascade.Font.BRepTextBuilder+ - Add OpenCascade.Font.FontAspect+ - Add OpenCascade.Graphic3D.HorizontalTextAlignment+ - Add OpenCascade.Graphic3D.VerticalTextAlignment+- Add OpenCascade.GP.Ax3++### Fixed++- Fix build on MacOS (tested with the homebrew install of OpenCASCADE)+- Fix OpenCascade.TopoDS.Shape.copy++## 0.0.0.1 - 2023-11-29
README.md view
@@ -1,1 +1,12 @@ # OpenCASCADE-hs++A third party Haskell wrapper to [Open CASCADE](https://dev.opencascade.org) ([wiki](https://en.wikipedia.org/wiki/Open_Cascade_Technology)), which is the underlying framework behind [FreeCAD](https://www.freecad.org/).++The API is only partially complete, and largely consists of the modeling functionality (BRep/Boolean Ops/Curves/etc), ignoring the visualization components. ++## Dependencies ++You'll need the main OpenCASCADE libraries/header files installed to use this.++Please see the [main readme](https://github.com/joe-warren/opencascade-hs/#installing-dependencies) on Github for more information.+
+ cpp/hs_Font_BRepFont.cpp view
@@ -0,0 +1,39 @@+#include <Font_BRepFont.hxx>+#include "hs_Font_BRepFont.h"+++Font_BRepFont * hs_new_Font_BRepFont(){+ return new Font_BRepFont();+}++Font_BRepFont * hs_new_Font_BRepFont_fromStringAndSize(char * path, double size){+ return new Font_BRepFont(path, size);+}++void hs_delete_Font_BRepFont(Font_BRepFont * font){+ delete font;+}++bool hs_Font_BRepFont_initPathAndSize(Font_BRepFont * font, char * path, double size){+ return font->Init(path, size, 0);+}++bool hs_Font_BRepFont_initNameAspectAndSize(Font_BRepFont * font, char * name, Font_FontAspect aspect, double size){+ return font->Init(name, aspect, size);+}++double hs_Font_BRepFont_ascender(Font_BRepFont * font){+ return font->Ascender();+}++double hs_Font_BRepFont_descender(Font_BRepFont * font){+ return font->Descender();+}++double hs_Font_BRepFont_lineSpacing(Font_BRepFont * font){+ return font->LineSpacing();+}++double hs_Font_BRepFont_pointSize(Font_BRepFont * font){+ return font->LineSpacing();+}
+ cpp/hs_Font_BRepTextBuilder.cpp view
@@ -0,0 +1,21 @@+#include <Font_BRepTextBuilder.hxx>+#include "hs_Font_BRepTextBuilder.h"++Font_BRepTextBuilder * hs_new_Font_BRepTextBuilder(){+ return new Font_BRepTextBuilder();+}++void hs_delete_Font_BRepTextBuilder(Font_BRepTextBuilder * builder){+ delete builder;+}++TopoDS_Shape * hs_Font_BRepTextBuilder_perform(+ Font_BRepTextBuilder * builder, + Font_BRepFont * font,+ char * theString, + gp_Ax3 * thePenLoc,+ Graphic3d_HorizontalTextAlignment theHAlign,+ Graphic3d_VerticalTextAlignment theVAlign+ ) {+ return new TopoDS_Shape (builder ->Perform(*font, theString, *thePenLoc, theHAlign, theVAlign));+}
+ cpp/hs_gp_Ax3.cpp view
@@ -0,0 +1,160 @@+#include <gp_Ax3.hxx>+#include "hs_gp_Ax3.h"+++gp_Ax3 * hs_new_gp_Ax3(){+ return new gp_Ax3();+}++gp_Ax3 * hs_new_gp_Ax3_fromAx2(gp_Ax2 * ax){+ return new gp_Ax3(*ax);+}+++gp_Ax3 * hs_new_gp_Ax3_fromPntDirAndDir(gp_Pnt * pnt, gp_Dir *n, gp_Dir *v){+ return new gp_Ax3(*pnt, *n, *v);+}++gp_Ax3 * hs_new_gp_Ax3_fromPntAndDir(gp_Pnt * pnt, gp_Dir *n){+ return new gp_Ax3(*pnt, *n);+}++void hs_delete_gp_Ax3(gp_Ax3* axis){+ delete axis;+}++void hs_gp_Ax3_xReverse(gp_Ax3 * axis){+ axis->XReverse();+}++void hs_gp_Ax3_yReverse(gp_Ax3 * axis){+ axis->YReverse();+}++void hs_gp_Ax3_zReverse(gp_Ax3 * axis){+ axis->ZReverse();+}++void hs_gp_Ax3_setAxis(gp_Ax3 * axis, gp_Ax1 * mainAxis){+ axis->SetAxis(*mainAxis);+}++void hs_gp_Ax3_setDirection(gp_Ax3 * axis, gp_Dir * dir){+ axis->SetDirection(*dir);+}++void hs_gp_Ax3_setLocation(gp_Ax3 * axis, gp_Pnt * loc){+ axis->SetLocation(*loc);+}++void hs_gp_Ax3_setXDirection(gp_Ax3 * axis, gp_Dir * dir){+ axis->SetXDirection(*dir);+}++void hs_gp_Ax3_setYDirection(gp_Ax3 * axis, gp_Dir * dir){+ axis->SetYDirection(*dir);+}++double hs_gp_Ax3_angle(gp_Ax3 *axis, gp_Ax3 * other){+ return axis->Angle(*other);+}++gp_Ax1 * hs_gp_Ax3_axis(gp_Ax3 *axis){+ return new gp_Ax1(axis->Axis());+}++gp_Ax2 * hs_gp_Ax3_ax2(gp_Ax3 * axis){+ return new gp_Ax2(axis->Ax2());+}++gp_Dir * hs_gp_Ax3_direction(gp_Ax3 * axis){+ return new gp_Dir(axis->Direction());+}++gp_Pnt * hs_gp_Ax3_location(gp_Ax3 *axis){+ return new gp_Pnt(axis->Location());+}++gp_Dir * hs_gp_Ax3_xDirection(gp_Ax3 * axis){+ return new gp_Dir(axis->XDirection());+}++gp_Dir * hs_gp_Ax3_yDirection(gp_Ax3 * axis){+ return new gp_Dir(axis->YDirection());+}++bool hs_gp_Ax3_direct(gp_Ax3 * axis){+ return axis->Direct();+}++bool hs_gp_Ax3_isCoplanar(gp_Ax3 * axis, gp_Ax3 * other, double linearTolerance, double angularTolerance){+ return axis->IsCoplanar(*other, linearTolerance, angularTolerance);+}++bool hs_gp_Ax3_isCoplanarAx1(gp_Ax3 * axis, gp_Ax1 * other, double linearTolerance, double angularTolerance){+ return axis->IsCoplanar(*other, linearTolerance, angularTolerance);+}++void hs_gp_Ax3_mirror(gp_Ax3 * axis, gp_Ax1 *mirrorAxis){+ axis->Mirror(*mirrorAxis);+}++gp_Ax3* hs_gp_Ax3_mirrored(gp_Ax3 * axis, gp_Ax1 * mirrorAxis){+ return new gp_Ax3(axis->Mirrored(*mirrorAxis));+}++void hs_gp_Ax3_mirror_Ax2(gp_Ax3 * axis, gp_Ax2 *mirrorAxis){+ axis->Mirror(*mirrorAxis);+}++gp_Ax3* hs_gp_Ax3_mirrored_Ax2(gp_Ax3 * axis, gp_Ax2 * mirrorAxis){+ return new gp_Ax3(axis->Mirrored(*mirrorAxis));+}++void hs_gp_Ax3_rotate(gp_Ax3 * axis, gp_Ax1 *rotAxis, double angle){+ axis->Rotate(*rotAxis, angle);+}++gp_Ax3* hs_gp_Ax3_rotated(gp_Ax3 * axis, gp_Ax1 * rotAxis, double angle){+ return new gp_Ax3(axis->Rotated(*rotAxis, angle));+}++void hs_gp_Ax3_scale(gp_Ax3 * axis, gp_Pnt *center, double factor){+ axis->Scale(*center, factor);+}++gp_Ax3* hs_gp_Ax3_scaled(gp_Ax3 * axis, gp_Pnt * center, double factor){+ return new gp_Ax3(axis->Scaled(*center, factor));+}++void hs_gp_Ax3_transform(gp_Ax3 * axis, gp_Trsf *trsf){+ axis->Transform(*trsf);+}++gp_Ax3* hs_gp_Ax3_transformed(gp_Ax3 * axis, gp_Trsf * trsf){+ return new gp_Ax3(axis->Transformed(*trsf));+}++void hs_gp_Ax3_translate(gp_Ax3 * axis, gp_Vec *vec){+ axis->Translate(*vec);+}++gp_Ax3* hs_gp_Ax3_translated(gp_Ax3 * axis, gp_Vec * vec){+ return new gp_Ax3(axis->Translated(*vec));+}+++void hs_gp_Ax3_translateRelative(gp_Ax3 * axis, gp_Pnt *from, gp_Pnt *to){+ axis->Translate(*from, *to);+}++gp_Ax3* hs_gp_Ax3_translatedRelative(gp_Ax3 * axis, gp_Pnt * from, gp_Pnt *to){+ return new gp_Ax3(axis->Translated(*from, *to));+}+++++++
opencascade-hs.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: opencascade-hs-version: 0.0.0.1+version: 0.1.0.0 synopsis: Thin Wrapper for the OpenCASCADE CAD Kernel description: Please see the README on GitHub at <https://github.com/joe-warren/opencascade-hs#readme> category: Graphics,FFI@@ -68,6 +68,11 @@ OpenCascade.BRepTools.Internal.Destructors OpenCascade.BRepTools.Types OpenCascade.BRepTools.WireExplorer+ OpenCascade.Font.BRepFont+ OpenCascade.Font.BRepTextBuilder+ OpenCascade.Font.FontAspect+ OpenCascade.Font.Internal.Destructors+ OpenCascade.Font.Types OpenCascade.GC.MakeArcOfCircle OpenCascade.GC.MakeSegment OpenCascade.Geom@@ -79,6 +84,7 @@ OpenCascade.GP.Ax1 OpenCascade.GP.Ax2 OpenCascade.GP.Ax2d+ OpenCascade.GP.Ax3 OpenCascade.GP.Dir OpenCascade.GP.Dir2d OpenCascade.GP.GTrsf@@ -90,6 +96,8 @@ OpenCascade.GP.Types OpenCascade.GP.Vec OpenCascade.GP.Vec2d+ OpenCascade.Graphic3D.HorizontalTextAlignment+ OpenCascade.Graphic3D.VerticalTextAlignment OpenCascade.Handle OpenCascade.IFSelect.ReturnStatus OpenCascade.Inheritance@@ -139,12 +147,12 @@ hs-source-dirs: src ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints- cc-options: -Werror- cxx-options: -std=c++17+ cc-options: -Werror-implicit-function-declaration+ cxx-options: --std=c++17 include-dirs: cpp /usr/include/opencascade- c-sources:+ cxx-sources: cpp/hs_BRep_Tool.cpp cpp/hs_BRepAlgoAPI_Common.cpp cpp/hs_BRepAlgoAPI_Cut.cpp@@ -165,6 +173,8 @@ cpp/hs_BRepPrimAPI_MakeRevol.cpp cpp/hs_BRepPrimAPI_MakeSphere.cpp cpp/hs_BRepTools_WireExplorer.cpp+ cpp/hs_Font_BRepFont.cpp+ cpp/hs_Font_BRepTextBuilder.cpp cpp/hs_GC_MakeArcOfCircle.cpp cpp/hs_GC_MakeSegment.cpp cpp/hs_Geom_BezierCurve.cpp@@ -174,6 +184,7 @@ cpp/hs_gp_Ax1.cpp cpp/hs_gp_Ax2.cpp cpp/hs_gp_Ax2d.cpp+ cpp/hs_gp_Ax3.cpp cpp/hs_gp_Dir.cpp cpp/hs_gp_Dir2d.cpp cpp/hs_gp_GTrsf.cpp@@ -216,6 +227,7 @@ TKSTEP TKV3d TKMesh+ TKService build-depends: base >=4.7 && <5 , resourcet >=1.2 && <1.4
+ src/OpenCascade/Font/BRepFont.hs view
@@ -0,0 +1,64 @@+{-# LANGUAGE CApiFFI #-}+module OpenCascade.Font.BRepFont +( BRepFont+, new+, fromPathAndSize+, initFromPathAndSize+, initFromNameAspectAndSize+, ascender+, descender+, lineSpacing+, pointSize+) where++import OpenCascade.Font.Types (BRepFont)+import Data.Acquire (Acquire, mkAcquire)+import Foreign.C+import Foreign.Ptr+import OpenCascade.Font.Internal.Destructors (deleteBRepFont)+import Data.Coerce+import OpenCascade.Internal.Bool (cBoolToBool)+import OpenCascade.Font.FontAspect (FontAspect)+++foreign import capi unsafe "hs_Font_BRepFont.h hs_new_Font_BRepFont" rawNew :: IO (Ptr BRepFont)++new :: Acquire (Ptr BRepFont)+new = mkAcquire rawNew deleteBRepFont++foreign import capi unsafe "hs_Font_BRepFont.h hs_new_Font_BRepFont_fromStringAndSize" rawFromPathAndSize :: CString -> CDouble -> IO (Ptr BRepFont)++fromPathAndSize :: FilePath -> Double -> Acquire (Ptr BRepFont)+fromPathAndSize path size = mkAcquire (withCString path $ \str -> rawFromPathAndSize str (coerce size)) deleteBRepFont++foreign import capi unsafe "hs_Font_BRepFont.h hs_Font_BRepFont_initPathAndSize" rawInitFromPathAndSize :: Ptr BRepFont -> CString -> CDouble -> IO CBool++initFromPathAndSize :: Ptr BRepFont -> FilePath -> Double -> IO Bool+initFromPathAndSize font fontPath size = withCString fontPath $ \str -> cBoolToBool <$> rawInitFromPathAndSize font str (coerce size)++foreign import capi unsafe "hs_Font_BRepFont.h hs_Font_BRepFont_initNameAspectAndSize" rawInitFromNameAspectAndSize :: Ptr BRepFont -> CString -> CInt -> CDouble -> IO CBool++initFromNameAspectAndSize :: Ptr BRepFont -> String -> FontAspect -> Double -> IO Bool+initFromNameAspectAndSize font fontname aspect size = + withCString fontname $ \str -> cBoolToBool <$> rawInitFromNameAspectAndSize font str (fromIntegral . fromEnum $ aspect) (coerce size)+++foreign import capi unsafe "hs_Font_BRepFont.h hs_Font_BRepFont_ascender" rawAscender :: Ptr BRepFont -> IO CDouble++ascender :: Ptr BRepFont -> IO Double+ascender = coerce rawAscender++foreign import capi unsafe "hs_Font_BRepFont.h hs_Font_BRepFont_descender" rawDescender :: Ptr BRepFont -> IO CDouble++descender :: Ptr BRepFont -> IO Double+descender = coerce rawDescender++foreign import capi unsafe "hs_Font_BRepFont.h hs_Font_BRepFont_lineSpacing" rawLineSpacing :: Ptr BRepFont -> IO CDouble++lineSpacing :: Ptr BRepFont -> IO Double+lineSpacing = coerce rawLineSpacing++foreign import capi unsafe "hs_Font_BRepFont.h hs_Font_BRepFont_pointSize" rawPointSize :: Ptr BRepFont -> IO CDouble++pointSize :: Ptr BRepFont -> IO Double+pointSize = coerce rawPointSize
+ src/OpenCascade/Font/BRepTextBuilder.hs view
@@ -0,0 +1,32 @@+{-# LANGUAGE CApiFFI #-}+module OpenCascade.Font.BRepTextBuilder+( BRepTextBuilder+, new+, perform+) where++import OpenCascade.Font.Types+import OpenCascade.Font.Internal.Destructors+import Foreign.Ptr+import Foreign.C+import Data.Acquire+import qualified OpenCascade.Graphic3D.VerticalTextAlignment as VTA+import qualified OpenCascade.Graphic3D.HorizontalTextAlignment as HTA+import qualified OpenCascade.TopoDS as TopoDS+import qualified OpenCascade.GP as GP+import OpenCascade.TopoDS.Internal.Destructors (deleteShape)+import Foreign.C (withCString)++foreign import capi unsafe "hs_Font_BRepTextBuilder.h hs_new_Font_BRepTextBuilder" rawNew :: IO (Ptr BRepTextBuilder)++new :: Acquire (Ptr BRepTextBuilder)+new = mkAcquire rawNew deleteBRepTextBuilder+++foreign import capi unsafe "hs_Font_BRepTextBuilder.h hs_Font_BRepTextBuilder_perform" rawPerform :: Ptr BRepTextBuilder -> Ptr BRepFont -> CString -> Ptr GP.Ax3 -> CInt -> CInt -> IO (Ptr TopoDS.Shape)++perform :: Ptr BRepTextBuilder -> Ptr BRepFont -> String -> Ptr GP.Ax3 -> HTA.HorizontalTextAlignment -> VTA.VerticalTextAlignment -> Acquire (Ptr TopoDS.Shape)+perform builder font str axis hAlign vAlign =+ mkAcquire + (withCString str $ \s -> rawPerform builder font s axis (fromIntegral . fromEnum $ hAlign) (fromIntegral . fromEnum $ vAlign)) + deleteShape
+ src/OpenCascade/Font/FontAspect.hs view
@@ -0,0 +1,5 @@+module OpenCascade.Font.FontAspect+( FontAspect (..)+) where++data FontAspect = Undefined | Regular | Bold | Italic | BoldItalic deriving (Enum, Show)
+ src/OpenCascade/Font/Internal/Destructors.hs view
@@ -0,0 +1,11 @@+{-# LANGUAGE CApiFFI #-}+module OpenCascade.Font.Internal.Destructors where+++import OpenCascade.Font.Types++import Foreign.Ptr++foreign import capi unsafe "hs_Font_BRepFont.h hs_delete_Font_BRepFont" deleteBRepFont :: Ptr BRepFont -> IO ()++foreign import capi unsafe "hs_Font_BRepTextBuilder.h hs_delete_Font_BRepTextBuilder" deleteBRepTextBuilder :: Ptr BRepTextBuilder -> IO ()
+ src/OpenCascade/Font/Types.hs view
@@ -0,0 +1,5 @@+{-# LANGUAGE EmptyDataDecls #-}+module OpenCascade.Font.Types where++data BRepFont+data BRepTextBuilder
+ src/OpenCascade/GP/Ax3.hs view
@@ -0,0 +1,192 @@+{-# LANGUAGE CApiFFI #-}+module OpenCascade.GP.Ax3 +( Ax3+, new+, fromAx2+, fromPntDirAndDir+, fromPntAndDir+, xReverse+, yReverse+, zReverse+, setAxis+, setDirection+, setLocation+, setXDirection+, setYDirection+, angle+, axis+, ax2+, direction+, location+, xDirection+, yDirection+, direct+, isCoplanar+, isCoplanarAx1+, mirror+, mirrored+, mirrorAx2+, mirroredAx2+, rotate+, rotated+, scale+, scaled+, transform+, transformed+, translate+, translated+, translateRelative+, translatedRelative+) where+++import OpenCascade.GP.Types+import OpenCascade.GP.Internal.Destructors+import Foreign.Ptr+import Foreign.C.Types+import OpenCascade.Internal.Bool (cBoolToBool)+import Data.Acquire +import Data.Coerce (coerce)++foreign import capi unsafe "hs_gp_Ax3.h hs_new_gp_Ax3" rawNew :: IO (Ptr Ax3)++new :: Acquire (Ptr Ax3)+new = mkAcquire rawNew deleteAx3++foreign import capi unsafe "hs_gp_Ax3.h hs_new_gp_Ax3_fromAx2" rawFromAx2 :: Ptr Ax2 -> IO (Ptr Ax3)++fromAx2 :: Ptr Ax2 -> Acquire (Ptr Ax3)+fromAx2 ax2 = mkAcquire (rawFromAx2 ax2) deleteAx3++foreign import capi unsafe "hs_gp_Ax3.h hs_new_gp_Ax3_fromPntDirAndDir" rawFromPntDirAndDir :: Ptr Pnt -> Ptr Dir -> Ptr Dir -> IO (Ptr Ax3)++fromPntDirAndDir :: Ptr Pnt -> Ptr Dir -> Ptr Dir -> Acquire (Ptr Ax3)+fromPntDirAndDir pnt u v = mkAcquire (rawFromPntDirAndDir pnt u v) deleteAx3 ++foreign import capi unsafe "hs_gp_Ax3.h hs_new_gp_Ax3_fromPntAndDir" rawFromPntAndDir :: Ptr Pnt -> Ptr Dir -> IO (Ptr Ax3)++fromPntAndDir :: Ptr Pnt -> Ptr Dir -> Acquire (Ptr Ax3)+fromPntAndDir pnt dir = mkAcquire (rawFromPntAndDir pnt dir) deleteAx3 ++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_xReverse" xReverse :: Ptr Ax3 -> IO ()++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_yReverse" yReverse :: Ptr Ax3 -> IO ()++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_zReverse" zReverse :: Ptr Ax3 -> IO ()++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_setAxis" setAxis :: Ptr Ax3 -> Ptr Ax1 -> IO ()++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_setDirection" setDirection :: Ptr Ax3 -> Ptr Dir -> IO ()++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_setLocation" setLocation :: Ptr Ax3 -> Ptr Pnt -> IO ()++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_setXDirection" setXDirection :: Ptr Ax3 -> Ptr Dir -> IO ()++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_setYDirection" setYDirection :: Ptr Ax3 -> Ptr Dir -> IO ()++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_angle" rawAngle :: Ptr Ax3 -> Ptr Ax3 -> IO CDouble ++angle :: Ptr Ax3 -> Ptr Ax3 -> IO Double +angle = coerce rawAngle++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_axis" rawAxis :: Ptr Ax3 -> IO (Ptr Ax1)++axis :: Ptr Ax3 -> Acquire (Ptr Ax1)+axis this = mkAcquire (rawAxis this) deleteAx1++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_ax2" rawAx2 :: Ptr Ax3 -> IO (Ptr Ax2)++ax2 :: Ptr Ax3 -> Acquire (Ptr Ax2)+ax2 this = mkAcquire (rawAx2 this) deleteAx2++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_direction" rawDirection :: Ptr Ax3 -> IO (Ptr Dir)++direction :: Ptr Ax3 -> Acquire (Ptr Dir)+direction this = mkAcquire (rawDirection this) deleteDir++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_location" rawLocation :: Ptr Ax3 -> IO (Ptr Pnt)++location :: Ptr Ax3 -> Acquire (Ptr Pnt)+location this = mkAcquire (rawLocation this) deletePnt++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_xDirection" rawXDirection :: Ptr Ax3 -> IO (Ptr Dir)++xDirection :: Ptr Ax3 -> Acquire (Ptr Dir)+xDirection this = mkAcquire (rawXDirection this) deleteDir++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_yDirection" rawYDirection :: Ptr Ax3 -> IO (Ptr Dir)++yDirection :: Ptr Ax3 -> Acquire (Ptr Dir)+yDirection this = mkAcquire (rawYDirection this) deleteDir++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_direct" rawDirect :: Ptr Ax3 -> IO CBool++direct :: Ptr Ax3 -> IO Bool+direct = fmap cBoolToBool . rawDirect++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_isCoplanar" rawIsCoplanar :: Ptr Ax3 -> Ptr Ax3 -> CDouble -> CDouble -> IO CBool++isCoplanar :: Ptr Ax3 -> Ptr Ax3 -> Double -> Double -> IO Bool+isCoplanar a b linearTol angularTol = cBoolToBool <$> rawIsCoplanar a b (coerce linearTol) (coerce angularTol)++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_isCoplanarAx1" rawIsCoplanarAx1 :: Ptr Ax3 -> Ptr Ax1 -> CDouble -> CDouble -> IO CBool++isCoplanarAx1 :: Ptr Ax3 -> Ptr Ax1 -> Double -> Double -> IO Bool+isCoplanarAx1 a b linearTol angularTol = cBoolToBool <$> rawIsCoplanarAx1 a b (coerce linearTol) (coerce angularTol)++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_mirror" mirror:: Ptr Ax3 -> Ptr Ax1 -> IO ()++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_mirrored" rawMirrored:: Ptr Ax3 -> Ptr Ax1 -> IO (Ptr Ax3)++mirrored :: Ptr Ax3 -> Ptr Ax1 -> Acquire (Ptr Ax3)+mirrored axis mirrorAxis = mkAcquire (rawMirrored axis mirrorAxis) deleteAx3++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_mirror_Ax2" mirrorAx2:: Ptr Ax3 -> Ptr Ax2 -> IO ()++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_mirrored_Ax2" rawMirroredAx2 :: Ptr Ax3 -> Ptr Ax2 -> IO (Ptr Ax3)++mirroredAx2 :: Ptr Ax3 -> Ptr Ax2 -> Acquire (Ptr Ax3)+mirroredAx2 axis mirrorAxis = mkAcquire (rawMirroredAx2 axis mirrorAxis) deleteAx3++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_rotate" rawRotate :: Ptr Ax3 -> Ptr Ax1 -> CDouble -> IO ()++rotate :: Ptr Ax3 -> Ptr Ax1 -> Double -> IO ()+rotate = coerce rawRotate++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_rotated" rawRotated :: Ptr Ax3 -> Ptr Ax1 -> CDouble -> IO (Ptr Ax3)++rotated :: Ptr Ax3 -> Ptr Ax1 -> Double -> Acquire (Ptr Ax3)+rotated axis rotAxis angle = mkAcquire (rawRotated axis rotAxis (coerce angle)) deleteAx3++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_scale" rawScale :: Ptr Ax3 -> Ptr Pnt -> CDouble -> IO ()++scale :: Ptr Ax3 -> Ptr Pnt -> Double -> IO ()+scale = coerce rawScale++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_scaled" rawScaled :: Ptr Ax3 -> Ptr Pnt -> CDouble -> IO (Ptr Ax3)++scaled :: Ptr Ax3 -> Ptr Pnt -> Double -> Acquire (Ptr Ax3)+scaled axis origin factor = mkAcquire (rawScaled axis origin (coerce factor)) deleteAx3+++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_transform" transform:: Ptr Ax3 -> Ptr Trsf -> IO ()++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_transformed" rawTransformed :: Ptr Ax3 -> Ptr Trsf -> IO (Ptr Ax3)++transformed :: Ptr Ax3 -> Ptr Trsf -> Acquire (Ptr Ax3)+transformed axis trsf = mkAcquire (rawTransformed axis trsf) deleteAx3+++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_translate" translate :: Ptr Ax3 -> Ptr Vec -> IO ()++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_translated" rawTranslated :: Ptr Ax3 -> Ptr Vec -> IO (Ptr Ax3)++translated :: Ptr Ax3 -> Ptr Vec -> Acquire (Ptr Ax3)+translated axis vec = mkAcquire (rawTranslated axis vec) deleteAx3++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_translateRelative" translateRelative :: Ptr Ax3 -> Ptr Pnt -> Ptr Pnt -> IO ()++foreign import capi unsafe "hs_gp_Ax3.h hs_gp_Ax3_translatedRelative" rawTranslatedRelative :: Ptr Ax3 -> Ptr Pnt -> Ptr Pnt -> IO (Ptr Ax3)++translatedRelative :: Ptr Ax3 -> Ptr Pnt -> Ptr Pnt -> Acquire (Ptr Ax3)+translatedRelative axis from to = mkAcquire (rawTranslatedRelative axis from to) deleteAx3
src/OpenCascade/GP/Internal/Destructors.hs view
@@ -9,7 +9,8 @@ foreign import capi unsafe "hs_gp_Pnt2d.h hs_delete_gp_Pnt2d" deletePnt2d :: Ptr Pnt2d -> IO () foreign import capi unsafe "hs_gp_Ax1.h hs_delete_gp_Ax1" deleteAx1 :: Ptr Ax1 -> IO () foreign import capi unsafe "hs_gp_Ax2.h hs_delete_gp_Ax2" deleteAx2 :: Ptr Ax2 -> IO ()-foreign import capi unsafe "hs_gp_Ax2.h hs_delete_gp_Ax2" deleteAx2d :: Ptr Ax2d -> IO ()+foreign import capi unsafe "hs_gp_Ax2d.h hs_delete_gp_Ax2d" deleteAx2d :: Ptr Ax2d -> IO ()+foreign import capi unsafe "hs_gp_Ax3.h hs_delete_gp_Ax3" deleteAx3 :: Ptr Ax3 -> IO () foreign import capi unsafe "hs_gp_Dir.h hs_delete_gp_Dir" deleteDir :: Ptr Dir -> IO () foreign import capi unsafe "hs_gp_Dir2d.h hs_delete_gp_Dir2d" deleteDir2d :: Ptr Dir2d -> IO () foreign import capi unsafe "hs_gp_Vec.h hs_delete_gp_Vec" deleteVec :: Ptr Vec -> IO ()
src/OpenCascade/GP/Types.hs view
@@ -6,6 +6,7 @@ data Ax1 data Ax2 data Ax2d+data Ax3 data Dir data Dir2d data Vec
+ src/OpenCascade/Graphic3D/HorizontalTextAlignment.hs view
@@ -0,0 +1,8 @@+module OpenCascade.Graphic3D.HorizontalTextAlignment+( HorizontalTextAlignment (..)+) where++import Prelude hiding (Either (..))++-- Should match the order in Graphic3D.HorizontalTextAlignment.hxx+data HorizontalTextAlignment = Left | Center | Right deriving (Enum, Show)
+ src/OpenCascade/Graphic3D/VerticalTextAlignment.hs view
@@ -0,0 +1,6 @@+module OpenCascade.Graphic3D.VerticalTextAlignment+( VerticalTextAlignment (..)+) where++-- Should match the order in Graphic3D.HorizontalTextAlignment.hxx+data VerticalTextAlignment = Bottom | Center | Top | TopFirstLine deriving (Enum, Show)
src/OpenCascade/TopoDS/Shape.hs view
@@ -64,7 +64,7 @@ -- copy -foreign import capi unsafe "hs_TopoDS_Shape.h hs_new_TopoDS_Shape" rawCopy :: Ptr Shape -> IO (Ptr Shape)+foreign import capi unsafe "hs_TopoDS_Shape.h hs_new_TopoDS_Shape_copy" rawCopy :: Ptr Shape -> IO (Ptr Shape) copy :: Ptr Shape -> Acquire (Ptr Shape) copy shape = mkAcquire (rawCopy shape) deleteShape