General Purpose Geodetic Library
NsScrPrx4SessionHandler.cpp
Go to the documentation of this file.
1 /*
2  *
3  * This file is a part of nuSolve. nuSolve is a part of CALC/SOLVE system
4  * and is designed to perform data analyis of a geodetic VLBI session.
5  * Copyright (C) 2017-2020 Sergei Bolotin.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 
23 #include <iostream>
24 #include <stdlib.h>
25 
26 #include <QtCore/QRegExp>
27 
29 #include "NsScrPrx4Session.h"
30 
31 
32 const QString str_OT_DBH("DBH");
33 const QString str_OT_VDB("VDB");
34 const QString str_OT_VDA("VDA");
35 const QString str_OT_UND("---");
36 
37 
38 /*=======================================================================================================
39 *
40 * METHODS:
41 *
42 *======================================================================================================*/
44  : guessedSessionName_("")
45 {
46  handler_ = &handler;
47  sessionProxy_ = NULL;
48 };
49 
50 
51 
52 //
54 {
55  //
56  handler_ = NULL;
57  sessionProxy_ = NULL;
58 };
59 
60 
61 
62 //
64 {
66  return str_OT_DBH;
68  return str_OT_VDB;
70  return str_OT_VDA;
71  else
72  return str_OT_UND;
73 };
74 
75 
76 
77 //
78 void NsScrPrx4SessionHandler::setInputType(const QString& inputType)
79 {
80  if (inputType == str_OT_DBH)
82  else if (inputType == str_OT_VDB)
84  else if (inputType == str_OT_VDA)
86  else
88 };
89 
90 
91 
92 //
94 {
95  bool isOk;
96  if ((isOk=handler_->importSession(false)))
98  sessionProxy_->setIsOk(isOk);
99  return isOk;
100 };
101 
102 
103 
104 //
106 {
107  bool isOk(false);
109  isOk = handler_->exportDataIntoDbh();
111  isOk = handler_->exportDataIntoVgosDb();
113  isOk = handler_->exportDataIntoVgosDa();
114  return isOk;
115 };
116 
117 
118 
119 //
121 {
122  guessedSessionName_ = "undefined";
123  const QString fName(handler_->getFileName());
124  int idx;
125  QRegExp reSnV(".*([0-9]{2}[A-Z]{3}[0-9]{2}[A-Z0-9]{1,2})_V([0-9]{3}).*");
126  QRegExp reSn (".*([0-9]{2}[A-Z]{3}[0-9]{2}[A-Z0-9]{1,2}).*");
127  if (-1 < reSnV.indexIn(fName))
128  guessedSessionName_ = reSnV.cap(1);// + "_V" + reSnV.cap(2);
129  else if (-1 < reSn.indexIn(fName))
130  guessedSessionName_ = reSn.cap(1);
131  else if ((idx=fName.lastIndexOf("/")) != -1)
132  guessedSessionName_ = fName.mid(idx + 1);
133 };
134 /*=====================================================================================================*/
135 
136 
137 
138 
139 
140 
141 /*=====================================================================================================*/
const QString str_OT_VDA("VDA")
const QString str_OT_VDB("VDB")
const QString str_OT_DBH("DBH")
const QString str_OT_UND("---")
void setInputType(const QString &)
NsScrPrx4SessionHandler(NsSessionHandler &)
const QString & getInputType() const
void setIsOk(bool is)
void setOtype(SgVlbiSessionInfo::OriginType ot)
const QString & getFileName() const
bool importSession(bool guiExpected)
bool exportDataIntoVgosDb(QString output=QString(""))
SgVlbiSessionInfo::OriginType getOtype() const
bool exportDataIntoVgosDa(QString output=QString(""))
@ OT_DBH
observations are from database files provided by correlators;
@ OT_AGV
observations are in AGV format;
@ OT_VDB
observations are from vgosDb data tree;
@ OT_UNKNOWN
unknown (=all others) source of import;