-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrajedtdlg.cpp
75 lines (61 loc) · 1.5 KB
/
trajedtdlg.cpp
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "trajedtdlg.h"
TrajEdtDlg::TrajEdtDlg( QWidget *parent, ToolEditTrackMark *editTool )
: QDialog( parent )
{
setupUi(this);
mTrajEditTool = editTool;
connect( mBtSave, SIGNAL( pressed() ), this, SLOT(actSave()) );
connect( mBtCancel, SIGNAL( pressed() ), this, SLOT(actCancel()) );
mCmbBikeType->addItem( "Bicycle" );
mCmbBikeType->addItem( "E-bicycle" );
}
TrajEdtDlg::~TrajEdtDlg(void)
{
}
void TrajEdtDlg::setBikeType( int bikeType )
{
if (bikeType==1)
{
mCmbBikeType->setCurrentIndex( mCmbBikeType->findText("Bicycle") );
} else if ( bikeType==2 )
{
mCmbBikeType->setCurrentIndex( mCmbBikeType->findText("E-bicycle") );
}
}
int TrajEdtDlg::getBikeType()
{
if (mCmbBikeType->currentText()=="Bicycle")
{
return(1);
} else if (mCmbBikeType->currentText()=="E-bicycle")
{
return(2);
}
return(-1);
}
void TrajEdtDlg::actSave()
{
if ( mTrajEditTool->mNearPt.first != NULL )
{
// change point data
mTrajEditTool->mNearPt.first->bikeType( getBikeType() );
mTrajEditTool->mNearPt.first->bikeID( mSpinID->value() );
// unselect the current point
mTrajEditTool->mNearPt.first->clearSelected();
}
// change label text
if ( mTrajEditTool->mNearPt.second!=NULL )
{
mTrajEditTool->mNearPt.second->setPlainText( QString("%1").arg( mSpinID->value() ) );
}
this->hide();
}
void TrajEdtDlg::actCancel()
{
// change label text
if ( mTrajEditTool->mNearPt.second!=NULL )
{
mTrajEditTool->mNearPt.second->setPlainText( QString("%1").arg( mSpinID->value() ) );
}
this->hide();
}