mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix creation of the poligon-based lines for the dive planner
This fixes the creation of the poligon-based lines next thing to do is to forbit creation of the next point before the last one. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
364254ed36
commit
b1c526ddb4
2 changed files with 8 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
#include "diveplanner.h"
|
#include "diveplanner.h"
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <boost/graph/graph_concepts.hpp>
|
#include <QDebug>
|
||||||
|
|
||||||
DivePlanner* DivePlanner::instance()
|
DivePlanner* DivePlanner::instance()
|
||||||
{
|
{
|
||||||
|
@ -26,18 +26,22 @@ void DivePlanner::mouseDoubleClickEvent(QMouseEvent* event)
|
||||||
|
|
||||||
if (lines.empty()){
|
if (lines.empty()){
|
||||||
QGraphicsLineItem *first = new QGraphicsLineItem(0,0, mappedPos.x(), mappedPos.y());
|
QGraphicsLineItem *first = new QGraphicsLineItem(0,0, mappedPos.x(), mappedPos.y());
|
||||||
lines << first;
|
lines.push_back(first);
|
||||||
create_deco_stop();
|
create_deco_stop();
|
||||||
scene()->addItem(first);
|
scene()->addItem(first);
|
||||||
}else{
|
}else{
|
||||||
clear_generated_deco();
|
clear_generated_deco();
|
||||||
|
QGraphicsEllipseItem *prevHandle = handles.at( handles.count()-2);
|
||||||
|
QGraphicsLineItem *line = new QGraphicsLineItem(prevHandle->x(), prevHandle->y(), item->x(), item->y());
|
||||||
|
lines.push_back(line);
|
||||||
|
scene()->addItem(line);
|
||||||
create_deco_stop();
|
create_deco_stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePlanner::clear_generated_deco()
|
void DivePlanner::clear_generated_deco()
|
||||||
{
|
{
|
||||||
for(int i = handles.count(); i < lines.count(); i++){
|
for(int i = handles.count(); i <= lines.count(); i++){
|
||||||
scene()->removeItem(lines.last());
|
scene()->removeItem(lines.last());
|
||||||
delete lines.last();
|
delete lines.last();
|
||||||
lines.removeLast();
|
lines.removeLast();
|
||||||
|
|
Loading…
Add table
Reference in a new issue