| 145 | } |
| 146 | |
| 147 | void mitk::ContourModel::UpdateContour(const ContourModel* sourceModel, TimeStepType destinationTimeStep, TimeStepType sourceTimeStep) |
| 148 | { |
| 149 | if (nullptr == sourceModel) |
| 150 | { |
| 151 | mitkThrow() << "Cannot update contour. Passed source model is invalid."; |
| 152 | } |
| 153 | |
| 154 | if (!sourceModel->GetTimeGeometry()->IsValidTimeStep(sourceTimeStep)) |
| 155 | { |
| 156 | mitkThrow() << "Cannot update contour. Source contour time geometry does not support passed time step. Invalid time step: " << sourceTimeStep; |
| 157 | } |
| 158 | |
| 159 | if (!this->GetTimeGeometry()->IsValidTimeStep(destinationTimeStep)) |
| 160 | { |
| 161 | MITK_WARN << "Cannot update contour. Contour time geometry does not support passed time step. Invalid time step: " << destinationTimeStep; |
| 162 | return; |
| 163 | } |
| 164 | |
| 165 | this->Clear(destinationTimeStep); |
| 166 | |
| 167 | std::for_each(sourceModel->Begin(sourceTimeStep), sourceModel->End(sourceTimeStep), [this, destinationTimeStep](ContourElement::VertexType* vertex) { |
| 168 | this->m_ContourSeries[destinationTimeStep]->AddVertex(vertex->Coordinates, vertex->IsControlPoint); |
| 169 | }); |
| 170 | |
| 171 | this->InvokeEvent(ContourModelSizeChangeEvent()); |
| 172 | this->Modified(); |
| 173 | this->m_UpdateBoundingBox = true; |
| 174 | } |
| 175 | |
| 176 | bool mitk::ContourModel::IsEmpty(TimeStepType timestep) const |
| 177 | { |