📄 fetchmap.cpp
字号:
mapView->update();
}
/*RemoveMapDialog::RemoveMapDialog(QSortedList <MapBase>*maps, QWidget *parent=0,
const char *name=0, bool modal=FALSE,WFlags f=0):
QDialog(parent,name,modal,f)
{
vBox = new QVBox(this);
mapSelect = new QComboBox(FALSE, vBox);
bg = new QVButtonGroup("",vBox);
remMap = new QRadioButton("remove map entry",bg);
delMap = new QRadioButton("delete map image",bg);
bg->setButton(0);
MapBase *aMap;
for (aMap = maps->first (); aMap != 0; aMap = maps->next ())
mapNames.append(aMap->name);
mapSelect->insertStringList(mapNames);
resize(parent->geometry().size());
vBox->resize(geometry().size());
}*/
RemoveMapDialog::RemoveMapDialog(MapBase *map, QWidget *parent,
const char *name, bool modal,WFlags f) : QDialog(parent,name,modal,f)
{
vBox = new QVBox(this);
mapNameL = new QLabel(map->name(), vBox);
mapNameL->setAlignment(Qt::AlignHCenter);
QPalette pal=mapNameL->palette();
pal.setColor(QColorGroup::Foreground, red);
mapNameL->setPalette(pal);
textL = new QLabel(tr("Warning!\nYou are about to remove this map from qpeGPS."), vBox);
textL->setAlignment(Qt::AlignHCenter);
deleteCB = new QCheckBox(tr("Delete map image file from storage"), vBox);
resize(parent->geometry().size().width(),100);
vBox->resize(geometry().size());
}
RemoveMapDialog::~RemoveMapDialog(){};
ChangeMapParDialog::ChangeMapParDialog(MapSelector *maps, QWidget *parent=0,
const char *name=0, bool modal=FALSE,WFlags f=0):
QDialog(parent,name,modal,f)
{
vBox = new QVBox(this);
mapSelect = new QComboBox(FALSE, vBox);
MapBase *aMap;
for (aMap = maps->first (); aMap != 0; aMap = maps->next ())
mapNames.append(aMap->name());
mapSelect->insertStringList(mapNames);
resize(parent->geometry().size());
vBox->resize(geometry().size());
}
ChangeMapParDialog::~ChangeMapParDialog(){};
void DownloadAreaWidget::setDownloadSpecification(DownloadAreaSpecification *dlSpec)
{
spec = dlSpec;
QString string;
latitudeLE->setText(string.setNum (spec->latitude));
longitudeLE->setText(string.setNum (spec->longitude));
slatitudeLE->setText(string.setNum (spec->slatitude));
slongitudeLE->setText(string.setNum (spec->slongitude));
elatitudeLE->setText(string.setNum (spec->elatitude));
elongitudeLE->setText(string.setNum (spec->elongitude));
areaxLE->setText(string.setNum (spec->areax));
areayLE->setText(string.setNum (spec->areay));
}
DownloadAreaSpecification::~DownloadAreaSpecification(){}
DownloadAreaSpecification::DownloadAreaSpecification(Position &pos)
{
// default to current position from map info page
longitude = pos.lon;
latitude = pos.lat;
slongitude = slatitude = elongitude = elatitude = 0;
areax=areay=200;
prefix="";
IsArea=1;
dir="";
res=0;
scale = 200000;
}
DownLoadAreaDialog::DownLoadAreaDialog(Qpegps *application, DownloadAreaSpecification *spec, QWidget *parent,
const char *name, bool modal,WFlags f):
QDialog(parent,name,modal,f)
{
QVBox *vBox;
vBox = new QVBox(this);
dlSpecW = new DownloadAreaWidget(application, spec, vBox);
resize(parent->geometry().size());
vBox->resize(parent->geometry().size());
}
void DownLoadAreaDialog::accept()
{
if (dlSpecW->accept()) {
QDialog::accept();
}
}
DownLoadAreaDialog::~DownLoadAreaDialog(){}
DownloadAreaWidget::~DownloadAreaWidget(){}
DownloadAreaWidget::DownloadAreaWidget(Qpegps *appl, DownloadAreaSpecification *spec, QWidget *parent, const char *name)
: QVBox(parent,name)
{
QHBox *hBox;
application=appl;
detailsGB = new QVGroupBox(this);
//#define detailsGB this
// detailsGB = new QVBox(this);
hBox = new QHBox(detailsGB);
latitudeL = new QLabel(tr("Lat. (D.d):"),hBox);
latitudeLE = new QLineEdit(hBox);
latitudeLE->setValidator(new QDoubleValidator(-1000,1000,10,latitudeLE));
longitudeL = new QLabel(tr(" Long.(D.d):"),hBox);
longitudeLE = new QLineEdit(hBox);
longitudeLE->setValidator(new QDoubleValidator(-1000,1000,10,longitudeLE));
slatitudeL = new QLabel(tr("Start Lat. (D.d):"),hBox);
slatitudeLE = new QLineEdit(hBox);
slatitudeLE->setValidator(new QDoubleValidator(-1000,1000,10,latitudeLE));
slongitudeL = new QLabel(tr("Start Long.(D.d):"),hBox);
slongitudeLE = new QLineEdit(hBox);
slongitudeLE->setValidator(new QDoubleValidator(-1000,1000,10,longitudeLE));
hBox = new QHBox(detailsGB);
PlacePB = new QPushButton( "Select Cental Point",hBox,"Select Cental Point");
connect( PlacePB, SIGNAL( clicked() ), this, SLOT( PlaceSelC() ) );
// hBox = new QHBox(detailsGB);
// hBox = new QHBox(detailsGB);
PlaceLBPB = new QPushButton( "Select Left Buttom point coordinates",hBox,"Select Left Buttom point coordinates");
connect( PlaceLBPB, SIGNAL( clicked() ), this, SLOT( PlaceSelLB() ) );
hBox = new QHBox(detailsGB);
elatitudeL = new QLabel(tr("End Lat. (D.d):"),hBox);
elatitudeLE = new QLineEdit(hBox);
elatitudeLE->setValidator(new QDoubleValidator(-1000,1000,10,latitudeLE));
elongitudeL = new QLabel(tr(" End Long.(D.d):"),hBox);
elongitudeLE = new QLineEdit(hBox);
elongitudeLE->setValidator(new QDoubleValidator(-1000,1000,10,longitudeLE));
areaxL = new QLabel(tr(" East-West area size (km):"),hBox);
areaxLE = new QLineEdit(hBox);
areaxLE->setValidator(new QDoubleValidator(-20000,20000,10,longitudeLE));
hBox = new QHBox(detailsGB);
PlaceRTPB = new QPushButton( "Select Right Top point coordinates",hBox,"Select Right Top point coordinates");
connect( PlaceRTPB, SIGNAL( clicked() ), this, SLOT( PlaceSelRT() ) );
// hBox = new QHBox(detailsGB);
areayL = new QLabel(tr(" North-South area size (km):"),hBox);
areayLE = new QLineEdit(hBox);
areayLE->setValidator(new QDoubleValidator(-20000,20000,10,longitudeLE));
hBox = new QHBox(detailsGB);
scaleL = new QLabel(tr("Scale:"),hBox);
scaleCB = new QComboBox(TRUE,hBox);
scaleCB->setValidator(new QIntValidator(1000,100000000,scaleCB));
scaleCB->insertItem("4000"); scaleCB->insertItem("10000"); scaleCB->insertItem("20000"); scaleCB->insertItem("30000");
scaleCB->insertItem("50000"); scaleCB->insertItem("100000"); scaleCB->insertItem("200000"); scaleCB->insertItem("500000");
scaleCB->insertItem("3000000"); scaleCB->insertItem("10000000"); scaleCB->insertItem("30000000");
scaleCB->setEditable(TRUE);
scaleCB->setCurrentItem(5);
resL = new QLabel(tr(" Resolution:"),hBox);
resCB = new QComboBox(TRUE,hBox);
resCB->insertItem("1332x1332"); resCB->insertItem("1998x1998");
resCB->setEditable(FALSE);
resCB->setCurrentItem(1);
SE_ABG= new QButtonGroup(2,Qt::Horizontal,detailsGB);
ASB= new QRadioButton("Area size",SE_ABG);
connect( ASB, SIGNAL( toggled(bool) ), this, SLOT( toggledASB(bool) ) );
SEB= new QRadioButton("Start-End coordinates",SE_ABG);
connect( SEB, SIGNAL( toggled(bool) ), this, SLOT( toggledSEB(bool) ) );
ASB->setChecked(TRUE);
hBox = new QHBox(detailsGB);
dirL = new QLabel(tr("Download dir:"),hBox);
dirCB = new QComboBox(TRUE,hBox);
dirCB->insertItem(appl->mapSelector->mapPathStr());
QString s;
s=appl->mapSelector->mapPathStr();
s.replace(QRegExp("/+"),"/");
if (s != "/home/QtPalmtop/qpegps/maps/") dirCB->insertItem("/home/QtPalmtop/qpegps/maps/");
dirCB->insertItem("/home/samba/Main_Memory/map_");
dirCB->insertItem("/home/samba/SD_Card/map_");
dirCB->insertItem("/home/samba/CF_Card/map_");
dirCB->setEditable(TRUE);
dirCB->setCurrentItem(0);
hBox = new QHBox(detailsGB);
paramL = new QLabel(tr("Params:"),hBox);
paramLE = new QLineEdit(hBox);
setDownloadSpecification(spec);
}
void DownloadAreaWidget::PlaceSelC()
{
double PointLat, PointLong;
PlaceSel(&PointLat, &PointLong);
QString string;
latitudeLE->setText(string.setNum(PointLat));
longitudeLE->setText(string.setNum(PointLong));
}
void DownloadAreaWidget::PlaceSelLB()
{
double PointLat, PointLong;
PlaceSel(&PointLat, &PointLong);
QString string;
slatitudeLE->setText(string.setNum(PointLat));
slongitudeLE->setText(string.setNum(PointLong));
}
void DownloadAreaWidget::PlaceSelRT()
{
double PointLat, PointLong;
PlaceSel(&PointLat, &PointLong);
QString string;
elatitudeLE->setText(string.setNum(PointLat));
elongitudeLE->setText(string.setNum(PointLong));
}
void DownloadAreaWidget::PlaceSel(double *PointLat, double *PointLong)
{
MapCoordEditorDialog mDialog(/*application->gpsData, */application->places,this, "edit map coord", TRUE, 0);
*PointLat=*PointLong=0;
mDialog.setCaption(tr("Select Central Point"));
if (mDialog.exec()!=0 ) {
if (mDialog.mapLatLonCB->currentItem()) {
int i = mDialog.mapLatLonCB->currentItem();
Place *place = application->places->at(i);
*PointLat = place->pos.lat;
*PointLong = place->pos.lon;
} else {
double g,m,s;
g=mDialog.LatiLEd->text().toDouble();
m=copysign(mDialog.LatiLEm->text().toDouble(),g);
s=copysign(mDialog.LatiLEs->text().toDouble(),g);
*PointLat=(g + m/60 + s/3600 );
g=mDialog.LonLEd->text().toDouble();
m=copysign(mDialog.LonLEm->text().toDouble(),g);
s=copysign(mDialog.LonLEs->text().toDouble(),g);
*PointLong = (g + m/60 + s/3600);
}
}
}
void DownloadAreaWidget::toggledSEB(bool state)
{
if (state) {
IsArea=0;
latitudeL->hide();
latitudeLE->hide();
longitudeL->hide();
longitudeLE->hide();
areaxL->hide();
areaxLE->hide();
areayL->hide();
areayLE->hide();
PlacePB->hide();
slatitudeL->show();
slatitudeLE->show();
slongitudeL->show();
slongitudeLE->show();
elatitudeL->show();
elatitudeLE->show();
elongitudeL->show();
elongitudeLE->show();;
PlaceLBPB->show();
PlaceRTPB->show();
repaint();
}
}
void DownloadAreaWidget::toggledASB(bool state)
{
if (state) {
IsArea=1;
latitudeL->show();
latitudeLE->show();
longitudeL->show();
longitudeLE->show();
areaxL->show();
areaxLE->show();
areayL->show();
areayLE->show();
PlacePB->show();
slatitudeL->hide();
slatitudeLE->hide();
slongitudeL->hide();
slongitudeLE->hide();
elatitudeL->hide();
elatitudeLE->hide();
elongitudeL->hide();
elongitudeLE->hide();;
PlaceLBPB->hide();
PlaceRTPB->hide();
repaint();
}
}
bool DownloadAreaWidget::accept()
{
spec->latitude = latitudeLE->text().toDouble();
spec->longitude = longitudeLE->text().toDouble();
spec->slatitude = slatitudeLE->text().toDouble();
spec->slongitude = slongitudeLE->text().toDouble();
spec->elatitude = elatitudeLE->text().toDouble();
spec->elongitude = elongitudeLE->text().toDouble();
spec->areax = areaxLE->text().toDouble();
spec->areay = areayLE->text().toDouble();
spec->scale = scaleCB->currentText().toULong();
spec->IsArea = IsArea;
spec->dir = dirCB->currentText();
spec->param = paramLE->text();
spec->res=resCB->currentItem();
return 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -