-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeleteobject.cpp
More file actions
34 lines (29 loc) · 1021 Bytes
/
Copy pathdeleteobject.cpp
File metadata and controls
34 lines (29 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "deleteobject.h"
deleteobject::deleteobject(ApplicationManager* pApp): Action(pApp)
{
}
void deleteobject::ReadActionParameters()
{
deletegrid = pManager->GetGrid();
Output* pOut = deletegrid->GetOutput();
Input* pIn = deletegrid->GetInput();
pOut->PrintMessage("click at object to delete them");
deleteposition = pIn->GetCellClicked();
pOut->ClearStatusBar();
}
void deleteobject::Execute()
{
ReadActionParameters();
if (dynamic_cast<Flag*>(deletegrid->Getobjectfromcelllist(deleteposition))) //check cell have flag
{
AddFlagAction::resetisflag(); //reset the static isflag so that we can paste or add new flag
}
if (dynamic_cast<Antenna*>(deletegrid->Getobjectfromcelllist(deleteposition))) //check cell have antenna
{
AddAntennaAction::resetisantenna(); //reset the static isantenna so that we can paste or add new antenna
}
deletegrid->RemoveObjectFromCell(deleteposition);//delete any objects are setting in cell
}
deleteobject::~deleteobject()
{
}