0022651: Impossible to build OCC as static library due to using Standard_EXPORT inste...
[occt.git] / src / IVtkTools / IVtkTools_ShapeObject.hxx
CommitLineData
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
23#ifdef _MSC_VER
24#pragma warning(push)
25#endif
913a4c4a 26#include <vtkDataObject.h>
27#include <vtkSetGet.h>
a2f76b15 28#include <vtkWeakPointer.h>
a9660929 29#ifdef _MSC_VER
30#pragma warning(pop)
31#endif
913a4c4a 32
33class vtkActor;
34class vtkDataSet;
35class vtkInformationObjectBaseKey;
36class IVtkTools_ShapeDataSource;
37
896faa72 38#ifdef _MSC_VER
39#pragma warning(push)
40#pragma warning(disable: 4251) // avoid warning C4251: "class needs to have dll-interface..."
41#endif
42
913a4c4a 43//! @class IVtkTools_ShapeObject
44//! @brief VTK holder class for OCC shapes to pass them through pipelines.
45//!
46//! It is descendent of vtkObject (data). Logically it is a one of milestones of VTK pipeline.
47//! It stores data of OCC shape (the OccShape instance) in vtkInformation object of vtkDataObject.
48//! Then pass it to the actors through pipelines,
49//! so selection logic can access OccShape easily given the actor instance.
68df8478 50class Standard_EXPORT IVtkTools_ShapeObject : public vtkDataObject
913a4c4a 51{
52public:
68858c7d 53 vtkTypeMacro (IVtkTools_ShapeObject, vtkObject)
913a4c4a 54
55 static IVtkTools_ShapeObject* New();
56
57 //! Get OCC shape source from VTK data from actor's information object by key.
a2f76b15 58 static vtkSmartPointer<IVtkTools_ShapeDataSource> GetShapeSource (vtkActor* theActor);
913a4c4a 59
60 //! Get OCC shape from VTK data from actor's information object by key.
61 static IVtkOCC_Shape::Handle GetOccShape (vtkActor* theActor);
62
63 //! Static method to set OCC shape source to VTK dataset in information object
64 //! with key.
65 static void SetShapeSource (IVtkTools_ShapeDataSource* theDataSource, vtkDataSet* theData);
66
67 //! Static method to set OCC shape source to VTK actor in information object
68 //! with key.
69 static void SetShapeSource (IVtkTools_ShapeDataSource* theDataSource, vtkActor* theActor);
70
71 typedef vtkInformationObjectBaseKey* KeyPtr;
72
73 //! Static method used by shape selection logic in order to establish
74 //! a connection from vtkActor to OccShape instance.
75 //! @return vtkInformationKey for retrieving OccShape instance from the actor
76 static KeyPtr getKey();
77
78 //! OCC shape source setter.
79 void SetShapeSource (IVtkTools_ShapeDataSource* theDataSource);
80
81 //! OCC shape source getter.
a2f76b15 82 IVtkTools_ShapeDataSource* GetShapeSource() const;
913a4c4a 83
84protected:
85 IVtkTools_ShapeObject();
a2f76b15 86 virtual ~IVtkTools_ShapeObject();
913a4c4a 87
88private: // not copyable
89 IVtkTools_ShapeObject (const IVtkTools_ShapeObject&);
90 IVtkTools_ShapeObject& operator= (const IVtkTools_ShapeObject&);
91
92private: // OCC
a2f76b15 93 vtkWeakPointer<IVtkTools_ShapeDataSource> myShapeSource;
913a4c4a 94
95 static KeyPtr myKey;
96};
97
896faa72 98#ifdef _MSC_VER
99#pragma warning(pop)
100#endif
101
913a4c4a 102#endif // __IVTKTOOLS_SHAPEOBJECT_H__