MCPcopy Create free account
hub / github.com/Kitware/VTK / AddRepresentation

Method AddRepresentation

Views/Core/vtkView.cxx:166–195  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

164
165//------------------------------------------------------------------------------
166void vtkView::AddRepresentation(vtkDataRepresentation* rep)
167{
168 if (rep != nullptr && !this->IsRepresentationPresent(rep))
169 {
170 // We add the representation to the internal data-structure before calling
171 // AddToView(). This ensures that if the `rep` itself calls
172 // AddRepresentation() for an internal representation, the internal
173 // representation gets added after the `rep` which makes more sense as it
174 // preserves the order for representations in which AddRepresentation() was
175 // called.
176 size_t index = this->Implementation->Representations.size();
177 this->Implementation->Representations.emplace_back(rep);
178 if (rep->AddToView(this))
179 {
180 rep->AddObserver(vtkCommand::SelectionChangedEvent, this->GetObserver());
181
182 // UpdateEvent is called from push pipeline executions from
183 // vtkExecutionScheduler. We want to automatically render the view
184 // when one of our representations is updated.
185 rep->AddObserver(vtkCommand::UpdateEvent, this->GetObserver());
186
187 this->AddRepresentationInternal(rep);
188 }
189 else
190 {
191 this->Implementation->Representations.erase(
192 this->Implementation->Representations.begin() + index);
193 }
194 }
195}
196
197//------------------------------------------------------------------------------
198void vtkView::SetRepresentation(vtkDataRepresentation* rep)

Callers 3

SetRepresentationMethod · 0.95
TestRenderViewFunction · 0.80

Calls 9

GetObserverMethod · 0.95
sizeMethod · 0.45
emplace_backMethod · 0.45
AddToViewMethod · 0.45
AddObserverMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45

Tested by 1

TestRenderViewFunction · 0.64