Skip to content

Commit

Permalink
Clear undo stack when invalid (#332 | GRIDEDIT-1130)
Browse files Browse the repository at this point in the history
  • Loading branch information
BillSenior authored Jun 5, 2024
1 parent dd627ed commit a97b161
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace meshkernel
/// @brief A class implementing the curvilinear grid line shift. Line is shifted on the new locations.
/// and the displacement gets distributed on the influence zone, set with SetBlock
///
/// This option provides the possibility to fit the curvilinear grids edges to a land boundary.
/// This option provides the possibility to fit the curvilinear grid's edges to a land boundary.
class CurvilinearGridLineAttractionRepulsion : public CurvilinearGridAlgorithm
{
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace meshkernel
/// @brief A class implementing the curvilinear grid line shift. Line is shifted on the new locations.
/// and the displacement gets distributed on the influence zone, set with SetBlock
///
/// This option provides the possibility to fit the curvilinear grids edges to a land boundary.
/// This option provides the possibility to fit the curvilinear grid's edges to a land boundary.
class CurvilinearGridLineShift : public CurvilinearGridAlgorithm
{
public:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ void meshkernel::CurvilinearGridSnapping::ApplyExpansionToGrid(const Curvilinear

meshkernel::UndoActionPtr meshkernel::CurvilinearGridSnapping::Compute()
{
// probably can reduce storage required. m_lineStartIndex.m_m and m_lineEndIndex
std::unique_ptr<CurvilinearGridBlockUndoAction> undoAction = CurvilinearGridBlockUndoAction::Create(m_grid, {0, 0}, {m_grid.NumN(), m_grid.NumM()});
std::unique_ptr<CurvilinearGridMeshExpansionCalculator> expansionCalculator = AllocateCurvilinearGridMeshExpansionCalculator();

Expand Down
21 changes: 3 additions & 18 deletions libs/MeshKernelApi/include/MeshKernelApi/MeshKernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,18 @@ namespace meshkernelapi
MKERNEL_API int mkernel_allocate_state(int projectionType, int& meshKernelId);

/// @brief Attempt to undo by one undo-action.
/// @param[in] meshKernelId The id of the mesh state.
/// @param[out] undone Indicates if the undo action was actually undone
/// @returns Error code
MKERNEL_API int mkernel_undo_state(int meshKernelId, bool& undone);
MKERNEL_API int mkernel_undo_state(bool& undone);

/// @brief Attempt to redo by one undo-action.
/// @param[in] meshKernelId The id of the mesh state.
/// @param[out] redone Indicates if the redo action was actually redone
/// @returns Error code
MKERNEL_API int mkernel_redo_state(int meshKernelId, bool& redone);
MKERNEL_API int mkernel_redo_state(bool& redone);

/// @brief Clear the undo state.
/// @param[in] meshKernelId The id of the mesh state.
/// @returns Error code
MKERNEL_API int mkernel_clear_undo_state(int meshKernelId);
MKERNEL_API int mkernel_clear_undo_state();

/// @brief Computes 1d-2d contacts, where 1d nodes are connected to the closest 2d faces at the boundary (ggeo_make1D2DRiverLinks_dll)
///
Expand Down Expand Up @@ -1586,18 +1583,6 @@ namespace meshkernelapi
int startIndex,
int endIndex);

/// @brief Attempt to redo by one undo-action.
/// @param[in] meshKernelId The id of the mesh state.
/// @param[out] redone Indicates if the redo action was actually redone
/// @returns Error code
MKERNEL_API int mkernel_redo_state(int meshKernelId, bool& redone);

/// @brief Attempt to undo by one undo-action.
/// @param[in] meshKernelId The id of the mesh state.
/// @param[out] undone Indicates if the undo action was actually undone
/// @returns Error code
MKERNEL_API int mkernel_undo_state(int meshKernelId, bool& undone);

#ifdef __cplusplus
}
#endif
Expand Down
3 changes: 0 additions & 3 deletions libs/MeshKernelApi/include/MeshKernelApi/State.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <MeshKernel/Mesh1D.hpp>
#include <MeshKernel/Mesh2D.hpp>
#include <MeshKernel/OrthogonalizationAndSmoothing.hpp>
#include <MeshKernel/UndoActions/UndoActionStack.hpp>

namespace meshkernelapi
{
Expand Down Expand Up @@ -71,8 +70,6 @@ namespace meshkernelapi

// Exclusively owned state
meshkernel::Projection m_projection{meshkernel::Projection::cartesian}; ///< Projection used by the meshes

meshkernel::UndoActionStack m_undoStack; ///< Stack of undo actions
};

} // namespace meshkernelapi
Loading

0 comments on commit a97b161

Please sign in to comment.