913a4c4a |
1 | // Created on: 2011-10-27 |
2 | // Created by: Roman KOZLOV |
3 | // Copyright (c) 2011-2014 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
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. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef __IVTKTOOLS_SHAPEOBJECT_H__ |
17 | #define __IVTKTOOLS_SHAPEOBJECT_H__ |
18 | |
19 | #include <IVtkTools.hxx> |
20 | #include <IVtkOCC_Shape.hxx> |
a9660929 |
21 | |
22 | // prevent disabling some MSVC warning messages by VTK headers |
8e16477b |
23 | #include <Standard_WarningsDisable.hxx> |
913a4c4a |
24 | #include <vtkDataObject.h> |
25 | #include <vtkSetGet.h> |
a2f76b15 |
26 | #include <vtkWeakPointer.h> |
8e16477b |
27 | #include <Standard_WarningsRestore.hxx> |
913a4c4a |
28 | |
29 | class vtkActor; |
30 | class vtkDataSet; |
31 | class vtkInformationObjectBaseKey; |
32 | class IVtkTools_ShapeDataSource; |
33 | |
896faa72 |
34 | #ifdef _MSC_VER |
35 | #pragma warning(push) |
36 | #pragma warning(disable: 4251) // avoid warning C4251: "class needs to have dll-interface..." |
37 | #endif |
38 | |
913a4c4a |
39 | //! @class IVtkTools_ShapeObject |
40 | //! @brief VTK holder class for OCC shapes to pass them through pipelines. |
41 | //! |
3483c644 |
42 | //! It is descendant of vtkObject (data). Logically it is a one of milestones of VTK pipeline. |
913a4c4a |
43 | //! It stores data of OCC shape (the OccShape instance) in vtkInformation object of vtkDataObject. |
44 | //! Then pass it to the actors through pipelines, |
45 | //! so selection logic can access OccShape easily given the actor instance. |
68df8478 |
46 | class Standard_EXPORT IVtkTools_ShapeObject : public vtkDataObject |
913a4c4a |
47 | { |
48 | public: |
e607bd3e |
49 | vtkTypeMacro (IVtkTools_ShapeObject, vtkDataObject) |
913a4c4a |
50 | |
51 | static IVtkTools_ShapeObject* New(); |
52 | |
53 | //! Get OCC shape source from VTK data from actor's information object by key. |
a2f76b15 |
54 | static vtkSmartPointer<IVtkTools_ShapeDataSource> GetShapeSource (vtkActor* theActor); |
913a4c4a |
55 | |
56 | //! Get OCC shape from VTK data from actor's information object by key. |
57 | static IVtkOCC_Shape::Handle GetOccShape (vtkActor* theActor); |
58 | |
59 | //! Static method to set OCC shape source to VTK dataset in information object |
60 | //! with key. |
61 | static void SetShapeSource (IVtkTools_ShapeDataSource* theDataSource, vtkDataSet* theData); |
62 | |
63 | //! Static method to set OCC shape source to VTK actor in information object |
64 | //! with key. |
65 | static void SetShapeSource (IVtkTools_ShapeDataSource* theDataSource, vtkActor* theActor); |
66 | |
67 | typedef vtkInformationObjectBaseKey* KeyPtr; |
68 | |
69 | //! Static method used by shape selection logic in order to establish |
70 | //! a connection from vtkActor to OccShape instance. |
71 | //! @return vtkInformationKey for retrieving OccShape instance from the actor |
72 | static KeyPtr getKey(); |
73 | |
74 | //! OCC shape source setter. |
75 | void SetShapeSource (IVtkTools_ShapeDataSource* theDataSource); |
76 | |
77 | //! OCC shape source getter. |
a2f76b15 |
78 | IVtkTools_ShapeDataSource* GetShapeSource() const; |
913a4c4a |
79 | |
80 | protected: |
81 | IVtkTools_ShapeObject(); |
a2f76b15 |
82 | virtual ~IVtkTools_ShapeObject(); |
913a4c4a |
83 | |
84 | private: // not copyable |
85 | IVtkTools_ShapeObject (const IVtkTools_ShapeObject&); |
86 | IVtkTools_ShapeObject& operator= (const IVtkTools_ShapeObject&); |
87 | |
88 | private: // OCC |
a2f76b15 |
89 | vtkWeakPointer<IVtkTools_ShapeDataSource> myShapeSource; |
913a4c4a |
90 | |
91 | static KeyPtr myKey; |
92 | }; |
93 | |
896faa72 |
94 | #ifdef _MSC_VER |
95 | #pragma warning(pop) |
96 | #endif |
97 | |
913a4c4a |
98 | #endif // __IVTKTOOLS_SHAPEOBJECT_H__ |