-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappendshiptool.cpp
More file actions
45 lines (33 loc) · 1.02 KB
/
appendshiptool.cpp
File metadata and controls
45 lines (33 loc) · 1.02 KB
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
35
36
37
38
39
40
41
42
43
44
45
#include "appendtool.h"
#include "scenarioeditutils.h"
void AppendTool::MouseMove(QMouseEvent *event, QPoint)
{
}
void AppendTool::MousePress(QMouseEvent *event)
{
if (!(event->buttons() & Qt::LeftButton))
{
_main_service->SetDefaultTool();
return;
}
Transformation transformator = _main_service->GetScreenViewService()->GetScreenTransform();
Scenario::scenario_data* scenario = _main_service->GetScenario();
Point new_ship_xy_pos = transformator.ScreenToWorld(event->pos());
Scenario::target new_ship;
DistanceBearing ship_distance_bearing(new_ship_xy_pos);
new_ship.distance = ship_distance_bearing.distance;
new_ship.bearing = ship_distance_bearing.bearing;
new_ship.model_name = "неизвестная модель";
new_ship.course = 0;
new_ship.speed = 0;
new_ship.ownship = false;
new_ship.id = make_new_id(scenario->targets);
scenario->targets.push_back(new_ship);
_main_service->GetProjectService()->AddObject();
}
void AppendTool::onActivate()
{
}
void AppendTool::onDeActivate()
{
}