...
This commit is contained in:
parent
ea99bc721b
commit
78e1a7d71d
76
cxx/mount.h
76
cxx/mount.h
@ -132,6 +132,29 @@ struct MccMountConfig {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* PROHIBITED ZONE CONTEXT BASE CLASS */
|
||||||
|
struct MccProhibitedZoneContext {
|
||||||
|
// type of prohibited zone
|
||||||
|
enum pzgeometry_t {
|
||||||
|
PZ_MINALT, // trivial minimal altitude
|
||||||
|
PZ_MAXALT, // trivial maximal altitude (e.g. near-zenith zone for alt-azimuthal types)
|
||||||
|
PZ_ELLIPSE, // simple circular/elliptical zone
|
||||||
|
PZ_PIER_MERIDIAN, // pier-side or cross-meridian
|
||||||
|
PZ_CONVEXHULL // general convex hull polygonal zone
|
||||||
|
};
|
||||||
|
|
||||||
|
// type of input cordinates
|
||||||
|
enum pzcoords_t {
|
||||||
|
PZCOORD_RADEC, // catalog (FK5, IRCS, etc...)
|
||||||
|
PZCOORD_RADEC_APP, // apparent RA and DEC
|
||||||
|
PZCOORD_HADEC_APP, // apparent HA and DEC
|
||||||
|
PZCOORD_AZZD, // apparent azimuth and zenithal distance
|
||||||
|
};
|
||||||
|
|
||||||
|
pzgeometry_t geometryType;
|
||||||
|
pzcoords_t coordType;
|
||||||
|
};
|
||||||
|
|
||||||
/* MOUNT BASE TEMPLATED CLASS WITH BASIC FUNCTIONALITY */
|
/* MOUNT BASE TEMPLATED CLASS WITH BASIC FUNCTIONALITY */
|
||||||
|
|
||||||
// implements a Finite State Machine Pattern
|
// implements a Finite State Machine Pattern
|
||||||
@ -146,6 +169,12 @@ public:
|
|||||||
|
|
||||||
enum IersDatabaseType { IERS_DB_LEAPSECS, IERS_DB_EARTH_ORIENT };
|
enum IersDatabaseType { IERS_DB_LEAPSECS, IERS_DB_EARTH_ORIENT };
|
||||||
|
|
||||||
|
template <traits::mcc_time_duration_c DT = std::chrono::system_clock::duration>
|
||||||
|
struct pzcheck_result_t {
|
||||||
|
bool inzone{false};
|
||||||
|
DT time_to{DT::max()};
|
||||||
|
DT time_from{DT::min()};
|
||||||
|
};
|
||||||
|
|
||||||
/* Constructors and destructor */
|
/* Constructors and destructor */
|
||||||
|
|
||||||
@ -301,20 +330,51 @@ public:
|
|||||||
return d_t{0};
|
return d_t{0};
|
||||||
}
|
}
|
||||||
|
|
||||||
// above two methods in one call
|
// returns a pzcheck_result_t with:
|
||||||
// returns a std::tuple with elements
|
// .inzone = true - coordinates in zone, false - otherwise
|
||||||
// 0 - boolean: true - coordinates in zone, false - otherwise
|
// .time_to = time duration to reach the zone (0 - if already in the zone, chrono::duration<>::max() if never
|
||||||
// 1 - time duration to reach the zone (0 - if already in the zone, chrono::duration<>::max() if never reach the
|
// reach the zone)
|
||||||
// zone)
|
// .time_from = time duration to exit the zone (0 - if already out of the zone, chrono::duration<>::max() if
|
||||||
// 2 - time duration to exit the zone (0 - if already out of the zone, chrono::duration<>::max() if never
|
// never exit the zone)
|
||||||
// exit the zone)
|
|
||||||
auto pzCheck(const MccCoordinate& xcoord,
|
auto pzCheck(const MccCoordinate& xcoord,
|
||||||
const MccCoordinate& ycoord,
|
const MccCoordinate& ycoord,
|
||||||
|
std::derived_from<MccProhibitedZoneContext> auto const& context,
|
||||||
traits::mcc_systime_c auto const& utc = std::chrono::system_clock::now())
|
traits::mcc_systime_c auto const& utc = std::chrono::system_clock::now())
|
||||||
{
|
{
|
||||||
using d_t = std::remove_cvref_t<decltype(utc)>::duration;
|
using d_t = std::remove_cvref_t<decltype(utc)>::duration;
|
||||||
|
|
||||||
return std::make_tuple(false, d_t::max(), d_t{0});
|
return pzcheck_result_t<d_t>{.inzone = false, .time_to = d_t::max(), .time_from = d_t{0}};
|
||||||
|
}
|
||||||
|
|
||||||
|
// template <std::ranges::output_range<pzcheck_result_t> OR, std::ranges::input_range R1, std::ranges::input_range
|
||||||
|
// R2>
|
||||||
|
template <std::ranges::range OR, std::ranges::input_range R1, std::ranges::input_range R2>
|
||||||
|
auto pzCheckRange(const R1& xcoord,
|
||||||
|
const R2& ycoord,
|
||||||
|
std::derived_from<MccProhibitedZoneContext> auto const& context)
|
||||||
|
requires(std::ranges::output_range<OR, pzcheck_result_t<>> &&
|
||||||
|
std::derived_from<std::ranges::range_value_t<R1>, MccCoordinate> &&
|
||||||
|
std::derived_from<std::ranges::range_value_t<R2>, MccCoordinate>)
|
||||||
|
{
|
||||||
|
OR res;
|
||||||
|
|
||||||
|
for (auto const& [c1, c2] : std::views::zip(xcoord, ycoord)) {
|
||||||
|
auto r = pzCheck(c1, c2, context);
|
||||||
|
std::back_inserter(res) = r;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <std::ranges::input_range R1, std::ranges::input_range R2>
|
||||||
|
auto pzCheckRange(const R1& xcoord,
|
||||||
|
const R2& ycoord,
|
||||||
|
std::derived_from<MccProhibitedZoneContext> auto const& context)
|
||||||
|
requires(std::derived_from<std::ranges::range_value_t<R1>, MccCoordinate> &&
|
||||||
|
std::derived_from<std::ranges::range_value_t<R2>, MccCoordinate>)
|
||||||
|
{
|
||||||
|
return pzCheckRange<std::vector<pzcheck_result_t<>>>(xcoord, ycoord, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
// IERS databases updater
|
// IERS databases updater
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user