1 // Created on: 2017-06-16
2 // Created by: Natalia ERMOLAEVA
3 // Copyright (c) 2017 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 DFBrowserPane_HelperExport_H
17 #define DFBrowserPane_HelperExport_H
19 #include <TopoDS_Shape.hxx>
21 #include <Standard_WarningsDisable.hxx>
23 #include <QModelIndex>
24 #include <Standard_WarningsRestore.hxx>
26 //! \class DFBrowserPane_HelperExport
27 //! \brief It performs export to BREP of a shape by button is pressed
28 //! It contains a conainer of shapes for model indices. If button is pressed for index where the
29 //! shape exists, this shape is exported to BREP file.
30 //! It contains a container of shapes, it is important to clear this helper after using.
31 class DFBrowserPane_HelperExport : public QObject
36 DFBrowserPane_HelperExport (QObject* theParent) { (void)theParent; }
39 virtual ~DFBrowserPane_HelperExport() Standard_OVERRIDE {}
41 //! Clears current shapes
42 void Clear() { myShapes.clear(); }
44 //! Append a shape to be exported if pressed button on item from the given list
45 //! \param theShape a shape
46 //! \param theIndicies a list of indices for this shape
47 void AddShape (const TopoDS_Shape& theShape, const QModelIndexList& theIndices);
49 //! Returns whether the map of shapes contains a shape for the index
50 //! \param theIndex a model index
51 //! \return true if the map contains shape
52 bool HasShape (const QModelIndex& theIndex) const { return myShapes.contains (theIndex); }
54 //! Returns shape for the index
55 //! \param theIndex a model view index
56 //! \return a cached shape
57 const TopoDS_Shape& Shape (const QModelIndex& theIndex) { return myShapes[theIndex]; }
61 //! Slot that processing button press for the model index
62 //! \param theIndex a model index
63 void OnButtonPressed (const QModelIndex& theIndex);
67 #pragma warning(push, 0) // 4251: class 'QMap<QModelIndex,TopoDS_Shape>' needs to have dll-interface...
69 QMap<QModelIndex, TopoDS_Shape> myShapes; //!< a container of shapes