1 // Created on: 2020-01-25
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2020 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef Convert_Tools_H
17 #define Convert_Tools_H
21 #include <gp_Trsf.hxx>
23 #include <Bnd_Box.hxx>
24 #include <Bnd_OBB.hxx>
25 #include <NCollection_List.hxx>
26 #include <Quantity_Color.hxx>
27 #include <Standard.hxx>
28 #include <Standard_Macro.hxx>
29 #include <TColgp_HArray1OfPnt.hxx>
30 #include <Standard_Dump.hxx>
31 #include <TCollection_AsciiString.hxx>
32 #include <TopLoc_Location.hxx>
33 #include <TopoDS_Shape.hxx>
34 #include <Standard_SStream.hxx>
36 #include <Standard_WarningsDisable.hxx>
39 #include <Standard_WarningsRestore.hxx>
42 class Geom_Transformation;
44 //! \class Convert_Tools
45 //! \brief The tool that gives auxiliary methods for qt elements manipulation.
49 //! Reads Shape using BREP reader
50 //! \param theFileName a file name
51 //! \return shape or NULL
52 Standard_EXPORT static TopoDS_Shape ReadShape (const TCollection_AsciiString& theFileName);
55 //! Creates shape presentations on the stream if possible. Tries to init some OCCT base for a new presentation
56 //! \param theStream source of presentation
57 //! \param thePresentations container to collect new presentations
58 Standard_EXPORT static void ConvertStreamToPresentations (const Standard_SStream& theSStream,
59 const Standard_Integer theStartPos,
60 const Standard_Integer theLastPos,
61 NCollection_List<Handle(Standard_Transient)>& thePresentations);
63 //! Converts stream to color if possible. It processes Quantity_Color, Quantity_ColorRGBA
64 //! \param theStream source of presentation
65 //! \param theColor [out] converted color
66 //! \returns true if done
67 Standard_EXPORT static Standard_Boolean ConvertStreamToColor (const Standard_SStream& theSStream,
68 Quantity_Color& theColor);
71 //! \param theBoundingBox box shape parameters
72 //! \return created shape
73 Standard_EXPORT static Standard_Boolean CreateShape (const Bnd_Box& theBoundingBox, TopoDS_Shape& theShape);
76 //! \param theBoundingBox box shape parameters
77 //! \return created shape
78 Standard_EXPORT static Standard_Boolean CreateShape (const Bnd_OBB& theBoundingBox, TopoDS_Shape& theShape);
81 //! \param thePntMin minimum point on the bounding box
82 //! \param thePntMax maximum point on the bounding box
83 //! \return created shape
84 Standard_EXPORT static Standard_Boolean CreateBoxShape (const gp_Pnt& thePntMin,
85 const gp_Pnt& thePntMax,
86 TopoDS_Shape& theShape);
88 //! Creates presentation AIS_Plane
89 //! \param thePlane source plane
90 //! \param thePresentations container to collect new presentation/s
91 Standard_EXPORT static void CreatePresentation (const Handle(Geom_Plane)& thePlane,
92 NCollection_List<Handle(Standard_Transient)>& thePresentations);
94 //! Creates two presentations base on gp_Trsf: box in initial place and transformed box
95 //! \param thePlane source plane
96 //! \param thePresentations container to collect new presentation/s
97 Standard_EXPORT static void CreatePresentation (const gp_Trsf& theTrsf,
98 NCollection_List<Handle(Standard_Transient)>& thePresentations);