35 #include <vtkImageActor.h>
36 #include <vtkImageData.h>
37 #include "vtkRenderWindow.h"
38 #include "vtkRenderer.h"
52 myuid = QString::number(reinterpret_cast<long>(
this));
82 return "ViewRealTime";
109 rep->connectToView(
mSelf.lock());
110 mReps.push_back(rep);
143 (*it)->disconnectFromView(
mSelf.lock());
152 if (it ==
mReps.end())
157 rep->disconnectFromView(
mSelf.lock());
168 return std::count(
mReps.begin(),
mReps.end(), rep);
179 os << indent <<
"mUid: " <<
mUid << std::endl;
180 os << indent <<
"mName: " <<
mName << std::endl;
181 os << indent <<
"NumberOfReps: " <<
mReps.size() << std::endl;
183 for (
unsigned i = 0; i <
mReps.size(); ++i)
185 os << indent <<
"<Rep child " << i <<
">" << std::endl;
187 os << indent <<
"</Rep child " << i <<
">" << std::endl;
192 os << indent <<
"<RenderWindow>" << std::endl;
194 os << indent <<
"</RenderWindow>" << std::endl;
195 os << indent <<
"<Renderer>" << std::endl;
197 os << indent <<
"</Renderer>" << std::endl;
198 os << indent <<
"<Props>" << std::endl;
199 vtkPropCollection* collection =
mRenderer->GetViewProps();
200 collection->InitTraversal();
201 vtkProp* prop = collection->GetNextProp();
204 os << indent << indent <<
"<Prop>" << std::endl;
205 prop->PrintSelf(os, indent.
getVtkIndent().GetNextIndent().GetNextIndent());
206 os << indent << indent <<
"</Prop>" << std::endl;
207 prop = collection->GetNextProp();
209 os << indent <<
"</Props>" << std::endl;
221 unsigned long hash = 0;
225 vtkPropCollection* props = this->
getRenderer()->GetViewProps();
226 props->InitTraversal();
227 for (vtkProp* prop = props->GetNextProp(); prop != NULL; prop = props->GetNextProp())
229 vtkImageActor* imageActor = vtkImageActor::SafeDownCast(prop);
230 if (imageActor && imageActor->GetInput())
232 hash += imageActor->GetInput()->GetMTime();
234 hash += prop->GetMTime();
235 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)