Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Alexander Lapshin
common
Commits
a05308e7
Commit
a05308e7
authored
Jan 30, 2020
by
Alexander Lapshin
Browse files
Options
Browse Files
Download
Plain Diff
./ Merge branch 'master' of
https://gitlab.ancprotek.ru/alapshin/common
parents
2704d938
d217213d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
59 additions
and
7 deletions
+59
-7
OpticDelayMeasurement.cpp
bnolib/OpticDelayMeasurement.cpp
+1
-1
json_functions.h
json/json_functions.h
+15
-0
PropInfoBase.cpp
utils/PropInfoBase.cpp
+17
-2
PropInfoBase.h
utils/PropInfoBase.h
+11
-2
TimeFunctions.h
utils/TimeFunctions.h
+13
-0
interpolate.cpp
utils/interpolate.cpp
+2
-2
No files found.
bnolib/OpticDelayMeasurement.cpp
View file @
a05308e7
...
...
@@ -19,7 +19,7 @@
//-----------------------------------------------------------------------------
OpticDelayMeasurement
::
OpticDelayMeasurement
()
:
OpticMeasurement
()
{
TimePrec
=
0.01e-
3
;
// По умолчанию назначем точность определения времени
TimePrec
=
0.01e-
4
;
// По умолчанию назначем точность определения времени
// распространения сигнала равной одной сотой секунды
}
...
...
json/json_functions.h
View file @
a05308e7
...
...
@@ -484,6 +484,21 @@ void PutValue(jsonalloc& alc, jsonval& ss, const std::string conName, const std:
ss
.
AddMember
(
jname
,
jsvec
,
alc
);
}
template
<
typename
T
,
typename
TK
>
void
PutMapAsVec
(
jsonalloc
&
alc
,
jsonval
&
ss
,
const
std
::
string
conName
,
const
std
::
map
<
TK
,
T
>&
vec
,
bool
(
*
f
)(
rapidjson
::
Document
::
AllocatorType
&
,
jsonval
&
,
const
T
&
))
{
jsonval
jsvec
(
rapidjson
::
kArrayType
);
for
(
typename
std
::
map
<
TK
,
T
>::
const_iterator
it
=
vec
.
begin
();
it
!=
vec
.
end
();
++
it
)
{
jsonval
child
(
rapidjson
::
kObjectType
);
if
(
f
(
alc
,
child
,
it
->
second
))
{
jsvec
.
PushBack
(
child
,
alc
);
}
}
jsonval
jname
(
conName
,
alc
);
ss
.
AddMember
(
jname
,
jsvec
,
alc
);
}
inline
void
PutValue
(
jsonalloc
&
alc
,
jsonval
&
ss
,
const
std
::
string
&
conName
,
const
std
::
vector
<
size_t
>&
vec
)
{
jsonval
jsvec
(
rapidjson
::
kArrayType
);
...
...
utils/PropInfoBase.cpp
View file @
a05308e7
...
...
@@ -2,14 +2,22 @@
#include <utility>
#include "XMLFunctions.h"
PropInfoBase
::
PropInfoBase
(
std
::
string
lightModel
,
EarthModel
earthModel
,
AtmModel
atmModel
,
const
bool
sun
,
const
bool
moon
,
const
int
type
)
PropInfoBase
::
PropInfoBase
(
std
::
string
lightModel
,
EarthModel
earthModel
,
AtmModel
atmModel
,
const
bool
sun
,
const
bool
moon
,
const
bool
prec_itrf
,
const
int
type
)
:
m_atmModel
(
std
::
move
(
atmModel
)),
m_earthModel
(
std
::
move
(
earthModel
)),
m_lightModel
(
std
::
move
(
lightModel
)),
m_sun
(
sun
),
m_moon
(
moon
),
m_type
(
type
)
m_type
(
type
),
m_prec_itrf
(
prec_itrf
)
{
}
...
...
@@ -37,6 +45,9 @@ bool PropInfoBase::Load(myXML::Contain* parent)
LoadXML
(
con
,
"AtmModel"
,
m_atmModel
,
false
);
LoadXML
(
con
,
"Id"
,
m_id
,
false
,
&
idloaded
);
m_prec_itrf
=
false
;
LoadXML
(
con
,
"prec_itrf"
,
m_prec_itrf
,
false
);
return
true
;
}
...
...
@@ -58,6 +69,9 @@ void PropInfoBase::load(const jsonval& parent)
loadjson
(
parent
,
"light"
,
m_lightModel
);
loadjson
(
parent
,
"earth"
,
m_earthModel
);
loadjson
(
parent
,
"atm"
,
m_atmModel
,
false
);
m_prec_itrf
=
false
;
loadjson
(
parent
,
"prec_itrf"
,
m_prec_itrf
,
false
);
}
std
::
string
PropInfoBase
::
GetAsXML
()
const
...
...
@@ -73,6 +87,7 @@ std::string PropInfoBase::GetAsXML() const
PutValue
(
outs
,
"Sun"
,
m_sun
);
PutValue
(
outs
,
"Moon"
,
m_moon
);
PutValue
(
outs
,
"LightModel"
,
m_lightModel
);
PutValue
(
outs
,
"prec_itrf"
,
m_prec_itrf
);
outs
<<
"<EarthModel>"
;
PutValue
(
outs
,
"Model"
,
m_earthModel
.
GetModel
());
...
...
utils/PropInfoBase.h
View file @
a05308e7
...
...
@@ -21,13 +21,21 @@ public:
PropInfoBase
()
{
};
PropInfoBase
(
std
::
string
lightModel
,
EarthModel
earthModel
,
AtmModel
atmModel
,
bool
sun
,
bool
moon
,
int
type
);
PropInfoBase
(
std
::
string
lightModel
,
EarthModel
earthModel
,
AtmModel
atmModel
,
const
bool
sun
,
const
bool
moon
,
const
bool
prec_itrf
,
const
int
type
);
bool
Load
(
myXML
::
Contain
*
parent
);
void
load
(
const
jsonval
&
parent
);
bool
IsSun
()
const
{
return
m_sun
;
}
bool
IsMoon
()
const
{
return
m_moon
;
}
int
GetType
()
const
{
return
m_type
;
}
bool
is_prec_itrf
()
const
{
return
m_prec_itrf
;
}
const
AtmModel
&
GetAtmModel
()
const
{
return
m_atmModel
;
}
const
EarthModel
&
GetEarthModel
()
const
{
return
m_earthModel
;
}
std
::
string
GetLightModel
()
const
{
return
m_lightModel
;
}
...
...
@@ -35,7 +43,7 @@ public:
void
ToXml
(
std
::
ostream
&
outs
)
const
;
private
:
static
std
::
string
TypeConvert
(
int
value
);
static
std
::
string
TypeConvert
(
int
value
)
;
static
int
TypeConvert
(
const
std
::
string
&
value
);
AtmModel
m_atmModel
;
...
...
@@ -45,6 +53,7 @@ private:
bool
m_moon
;
int
m_type
;
int
m_id
;
bool
m_prec_itrf
{
false
};
};
typedef
std
::
map
<
int
,
PropInfoBase
>
PropInfoBases
;
...
...
utils/TimeFunctions.h
View file @
a05308e7
...
...
@@ -7,6 +7,8 @@
#include <sstream>
#include "globals.h"
#include "TextFunctions.h"
#include <chrono>
#include <ctime>
static
void
GetPrecK
(
int
msprec
,
int
&
k1
,
int
&
k2
)
{
...
...
@@ -480,3 +482,14 @@ static std::string calc_nightid(const TimeJD& date, const double lon_deg)
string_replace
(
str
,
"/"
,
""
);
return
str
;
}
inline
std
::
string
get_current_time
(
const
std
::
string
&
format
)
{
const
auto
now
=
std
::
chrono
::
system_clock
::
now
();
auto
in_time_t
=
std
::
chrono
::
system_clock
::
to_time_t
(
now
);
std
::
stringstream
ss
;
ss
<<
std
::
put_time
(
std
::
gmtime
(
&
in_time_t
),
format
.
c_str
());
return
ss
.
str
();
}
\ No newline at end of file
utils/interpolate.cpp
View file @
a05308e7
...
...
@@ -28,7 +28,7 @@ static double get_step(const SInitOrbit& orbit)
{
const
double
period
=
orbit
.
GetKeplerData
().
GetPeriod
()
*
1000
/
60
;
const
double
ecc
=
orbit
.
GetKeplerData
().
GetEccentricity
();
return
get_step
(
period
,
ecc
);
return
get_step
(
period
,
ecc
)
/
3
;
}
XInterpolator
::
XInterpolator
()
=
default
;
...
...
@@ -198,7 +198,7 @@ Vect6 XInterpolator::get_pos(const TimeJD& date, const bool tks) const
if
(
ircode
!=
0
)
{
throw
Exp
()
<<
"interpolation fail
\n
"
;
}
if
(
!
tks
)
{
return
{
outvec
[
0
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment