#include "commands.hpp" #include #include #include #include "editmode.hpp" #include "terrainselection.hpp" #include "terrainshapemode.hpp" #include "terraintexturemode.hpp" #include "worldspacewidget.hpp" CSVRender::DrawTerrainSelectionCommand::DrawTerrainSelectionCommand(WorldspaceWidget* worldspaceWidget, QUndoCommand* parent) : mWorldspaceWidget(worldspaceWidget) { } void CSVRender::DrawTerrainSelectionCommand::redo() { if (mWorldspaceWidget) { if (CSVRender::TerrainShapeMode* terrainMode = dynamic_cast (mWorldspaceWidget->getEditMode()) ) { terrainMode->getTerrainSelection()->update(); return; } else { Log(Debug::Verbose) << "Can't update terrain selection in current EditMode"; return; } } else Log(Debug::Verbose) << "Can't update terrain selection, no WorldspaceWidget found!"; } void CSVRender::DrawTerrainSelectionCommand::undo() { if (mWorldspaceWidget) { if (CSVRender::TerrainShapeMode* terrainMode = dynamic_cast (mWorldspaceWidget->getEditMode()) ) { terrainMode->getTerrainSelection()->update(); return; } else { Log(Debug::Verbose) << "Can't undo terrain selection in current EditMode"; return; } } else Log(Debug::Verbose) << "Can't undo terrain selection, no WorldspaceWidget found!"; }