MCPcopy Create free account
hub / github.com/MITK/MITK / MoveNodeDown

Method MoveNodeDown

Modules/QtWidgets/src/mitkRenderWindowLayerController.cpp:276–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276bool mitk::RenderWindowLayerController::MoveNodeDown(DataNode* dataNode, const BaseRenderer* renderer /*= nullptr*/)
277{
278 if (nullptr == dataNode)
279 {
280 return false;
281 }
282
283 // get the layer stack of the current renderer
284 RenderWindowLayerUtilities::LayerStack stackedLayers = RenderWindowLayerUtilities::GetLayerStack(m_DataStorage, renderer);
285 if (!stackedLayers.empty())
286 {
287 // get the current layer value of the given data node
288 int currentLayer;
289 bool wasFound = dataNode->GetIntProperty("layer", currentLayer, renderer);
290 if (wasFound)
291 {
292 // get the current layer in the map of stacked layers
293 RenderWindowLayerUtilities::LayerStack::const_iterator layerStackIterator = stackedLayers.find(currentLayer);
294 if (layerStackIterator != stackedLayers.end())
295 {
296 // found the element in the map ...
297 RenderWindowLayerUtilities::LayerStack::const_iterator nextLayerStackIterator = std::next(layerStackIterator);
298 if (nextLayerStackIterator != stackedLayers.end())
299 {
300 // ... and found a successor ->
301 // current node is not on the lowermost layer and therefore can be moved one layer down
302 // swap the layers of the dataNode and the dataNode on the next lower layer (next map element)
303 dataNode->SetIntProperty("layer", nextLayerStackIterator->first, renderer);
304 nextLayerStackIterator->second->SetIntProperty("layer", currentLayer, renderer);
305 dataNode->Modified();
306 mitk::RenderingManager::GetInstance()->RequestUpdate(renderer->GetRenderWindow());
307 return true;
308 }
309 // else: data node is already the lowermost layer node
310 }
311 // else: layer stack does not contain a layer with the 'currentLayer'
312 }
313 // else: data node has no layer information
314 }
315 // else: do not work with empty layer stack
316 return false;
317}

Callers

nothing calls this directly

Calls 8

emptyMethod · 0.45
GetIntPropertyMethod · 0.45
findMethod · 0.45
endMethod · 0.45
SetIntPropertyMethod · 0.45
ModifiedMethod · 0.45
RequestUpdateMethod · 0.45
GetRenderWindowMethod · 0.45

Tested by

no test coverage detected