14 #include <vtkImageActor.h> 15 #include <vtkImageData.h> 16 #include "vtkRenderWindow.h" 17 #include "vtkRenderer.h" 31 myuid = QString::number(reinterpret_cast<long>(
this));
61 return "ViewRealTime";
88 rep->connectToView(
mSelf.lock());
122 (*it)->disconnectFromView(
mSelf.lock());
131 if (it ==
mReps.end())
136 rep->disconnectFromView(
mSelf.lock());
147 return std::count(
mReps.begin(),
mReps.end(), rep);
158 os << indent <<
"mUid: " <<
mUid << std::endl;
159 os << indent <<
"mName: " <<
mName << std::endl;
160 os << indent <<
"NumberOfReps: " <<
mReps.size() << std::endl;
162 for (
unsigned i = 0; i <
mReps.size(); ++i)
164 os << indent <<
"<Rep child " << i <<
">" << std::endl;
166 os << indent <<
"</Rep child " << i <<
">" << std::endl;
171 os << indent <<
"<RenderWindow>" << std::endl;
173 os << indent <<
"</RenderWindow>" << std::endl;
174 os << indent <<
"<Renderer>" << std::endl;
176 os << indent <<
"</Renderer>" << std::endl;
177 os << indent <<
"<Props>" << std::endl;
178 vtkPropCollection* collection =
mRenderer->GetViewProps();
179 collection->InitTraversal();
180 vtkProp* prop = collection->GetNextProp();
183 os << indent << indent <<
"<Prop>" << std::endl;
184 prop->PrintSelf(os, indent.
getVtkIndent().GetNextIndent().GetNextIndent());
185 os << indent << indent <<
"</Prop>" << std::endl;
186 prop = collection->GetNextProp();
188 os << indent <<
"</Props>" << std::endl;
200 unsigned long hash = 0;
204 vtkPropCollection* props = this->
getRenderer()->GetViewProps();
205 props->InitTraversal();
206 for (vtkProp* prop = props->GetNextProp(); prop != NULL; prop = props->GetNextProp())
208 vtkImageActor* imageActor = vtkImageActor::SafeDownCast(prop);
209 if (imageActor && imageActor->GetInput())
211 hash += imageActor->GetInput()->GetMTime();
213 hash += prop->GetMTime();
214 hash += prop->GetRedrawMTime();
boost::weak_ptr< class View > mSelf
virtual View::Type getType() const
virtual bool hasRep(const RepPtr &rep) const
Checks if the view already have the rep.
virtual QString getTypeString() const
virtual void setModified()
virtual vtkRenderWindowPtr getRenderWindow() const
Get the vtkRenderWindow used by this View.
vtkIndent getVtkIndent() const
vtkSmartPointer< class vtkRenderWindow > vtkRenderWindowPtr
std::vector< RepPtr >::iterator RepsIter
Iterator typedef for the internal rep vector.
virtual std::vector< RepPtr > getReps()
Returns all reps in the view.
virtual void removeReps()
Removes all reps in the view.
virtual void addRep(const RepPtr &rep)
Adds and connects a rep to the view.
bool includeDetails() const
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
virtual void setBackgroundColor(QColor color)
QString mName
The view's name.
vtkRenderWindowPtr mRenderWindow
QString mUid
The view's unique id.
Formatting class for debug printing of the ssc library.
virtual QString getName()
Get a views name.
void print(std::ostream &os)
virtual void removeRep(const RepPtr &rep)
Removes and disconnects the rep from the view.
virtual ~ViewRepCollection()
std::vector< RepPtr > mReps
Storage for internal reps.
ViewRepCollection(vtkRenderWindowPtr renderWindow, const QString &uid, const QString &name="")
constructor
virtual QString getUid()
Get a views unique id.
virtual void clear()
Removes everything in the view, inluding reps.
boost::shared_ptr< class Rep > RepPtr
virtual vtkRendererPtr getRenderer() const
Get the renderer used by this View.
virtual void printSelf(std::ostream &os, Indent indent)
Namespace for all CustusX production code.