File: svroptdlg.cpp

package info (click to toggle)
rtklib 2.4.3%2Bdfsg1-2.1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 41,796 kB
  • sloc: cpp: 51,592; ansic: 50,584; fortran: 987; makefile: 861; sh: 45
file content (148 lines) | stat: -rw-r--r-- 4,993 bytes parent folder | download | duplicates (2)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
//---------------------------------------------------------------------------
#include <vcl.h>
#include <FileCtrl.hpp>
#pragma hdrstop

#include "rtklib.h"
#include "refdlg.h"
#include "svroptdlg.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TSvrOptDialog *SvrOptDialog;
//---------------------------------------------------------------------------
static double str2dbl(AnsiString str)
{
	double val=0.0;
	sscanf(str.c_str(),"%lf",&val);
	return val;
}
//---------------------------------------------------------------------------
__fastcall TSvrOptDialog::TSvrOptDialog(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TSvrOptDialog::FormShow(TObject *Sender)
{
	double pos[3];
	AnsiString s;
	DataTimeout->Text=s.sprintf("%d",SvrOpt[0]);
	ConnectInterval->Text=s.sprintf("%d",SvrOpt[1]);
	AvePeriodRate->Text=s.sprintf("%d",SvrOpt[2]);
	SvrBuffSize->Text=s.sprintf("%d",SvrOpt[3]);
	SvrCycle->Text=s.sprintf("%d",SvrOpt[4]);
	NmeaCycle->Text=s.sprintf("%d",SvrOpt[5]);
	FileSwapMarginE->Text=s.sprintf("%d",FileSwapMargin);
	if (norm(AntPos,3)>0.0) {
		ecef2pos(AntPos,pos);
		AntPos1->Text=s.sprintf("%.8f",pos[0]*R2D);
		AntPos2->Text=s.sprintf("%.8f",pos[1]*R2D);
		AntPos3->Text=s.sprintf("%.3f",pos[2]);
	}
	else {
		AntPos1->Text="0.00000000";
		AntPos2->Text="0.00000000";
		AntPos3->Text="0.000";
	}
	TraceLevelS->ItemIndex=TraceLevel;
	NmeaReqT->Checked=NmeaReq;
	LocalDir->Text=LocalDirectory;
	ProxyAddr->Text=ProxyAddress;
	StationId->Text=s.sprintf("%d",StaId);
	StaInfoSel->Checked=StaSel;
	AntInfo->Text=AntType;
	RcvInfo->Text=RcvType;
	AntOff1->Text=s.sprintf("%.4f",AntOff[0]);
	AntOff2->Text=s.sprintf("%.4f",AntOff[1]);
	AntOff3->Text=s.sprintf("%.4f",AntOff[2]);
	
	UpdateEnable();
}
//---------------------------------------------------------------------------
void __fastcall TSvrOptDialog::BtnOkClick(TObject *Sender)
{
	double pos[3];
	SvrOpt[0]=DataTimeout->Text.ToInt();
	SvrOpt[1]=ConnectInterval->Text.ToInt();
	SvrOpt[2]=AvePeriodRate->Text.ToInt();
	SvrOpt[3]=SvrBuffSize->Text.ToInt();
	SvrOpt[4]=SvrCycle->Text.ToInt();
	SvrOpt[5]=NmeaCycle->Text.ToInt();
	FileSwapMargin=FileSwapMarginE->Text.ToInt();
	pos[0]=str2dbl(AntPos1->Text)*D2R;
	pos[1]=str2dbl(AntPos2->Text)*D2R;
	pos[2]=str2dbl(AntPos3->Text);
	if (norm(pos,3)>0.0) {
		pos2ecef(pos,AntPos);
	}
	else {
		for (int i=0;i<3;i++) AntPos[i]=0.0;
	}
	TraceLevel=TraceLevelS->ItemIndex;
	NmeaReq=NmeaReqT->Checked;
	LocalDirectory=LocalDir->Text;
	ProxyAddress=ProxyAddr->Text;
	StaId=(int)str2dbl(StationId->Text);
	StaSel=StaInfoSel->Checked;
	AntType=AntInfo->Text;
	RcvType=RcvInfo->Text;
	AntOff[0]=str2dbl(AntOff1->Text);
	AntOff[1]=str2dbl(AntOff2->Text);
	AntOff[2]=str2dbl(AntOff3->Text);
}
//---------------------------------------------------------------------------
void __fastcall TSvrOptDialog::BtnPosClick(TObject *Sender)
{
	AnsiString s;
	RefDialog->RovPos[0]=str2dbl(AntPos1->Text);
	RefDialog->RovPos[1]=str2dbl(AntPos2->Text);
	RefDialog->RovPos[2]=str2dbl(AntPos3->Text);
	RefDialog->BtnLoad->Enabled=true;
	RefDialog->StaPosFile=StaPosFile;
	if (RefDialog->ShowModal()!=mrOk) return;
	AntPos1->Text=s.sprintf("%.8f",RefDialog->Pos[0]);
	AntPos2->Text=s.sprintf("%.8f",RefDialog->Pos[1]);
	AntPos3->Text=s.sprintf("%.3f",RefDialog->Pos[2]);
	StaPosFile=RefDialog->StaPosFile;
}
//---------------------------------------------------------------------------
void __fastcall TSvrOptDialog::BtnLocalDirClick(TObject *Sender)
{
#ifdef TCPP
    AnsiString dir=LocalDir->Text;
    if (!SelectDirectory("Local Directory","",dir)) return;
    LocalDir->Text=dir;
#else
    UnicodeString dir=LocalDir->Text;
    TSelectDirExtOpts opt=TSelectDirExtOpts()<<sdNewUI<<sdNewFolder;
    if (!SelectDirectory(L"Local Directory",L"",dir,opt)) return;
    LocalDir->Text=dir;
#endif
}
//---------------------------------------------------------------------------
void __fastcall TSvrOptDialog::UpdateEnable(void)
{
	NmeaCycle->Enabled=NmeaReqT->Checked;
	StationId->Enabled=StaInfoSel->Checked;
	AntPos1->Enabled=StaInfoSel->Checked||NmeaReqT->Checked;
	AntPos2->Enabled=StaInfoSel->Checked||NmeaReqT->Checked;
	AntPos3->Enabled=StaInfoSel->Checked||NmeaReqT->Checked;
	BtnPos ->Enabled=StaInfoSel->Checked||NmeaReqT->Checked;
	AntOff1->Enabled=StaInfoSel->Checked;
	AntOff2->Enabled=StaInfoSel->Checked;
	AntOff3->Enabled=StaInfoSel->Checked;
	AntInfo->Enabled=StaInfoSel->Checked;
	RcvInfo->Enabled=StaInfoSel->Checked;
}
//---------------------------------------------------------------------------
void __fastcall TSvrOptDialog::NmeaReqTClick(TObject *Sender)
{
	UpdateEnable();
}
//---------------------------------------------------------------------------
void __fastcall TSvrOptDialog::StaInfoSelClick(TObject *Sender)
{
	UpdateEnable();
}
//---------------------------------------------------------------------------