This commit is contained in:
2025-04-18 12:15:32 +03:00
parent 78e1a7d71d
commit 3205db3ee1
4 changed files with 164 additions and 11 deletions

View File

@@ -155,6 +155,28 @@ struct MccProhibitedZoneContext {
pzcoords_t coordType;
};
struct MccProhibitedZone1 {
// type of prohibited zone
enum pztype_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
};
pztype_t type;
struct pzminalt_t {
double minalt{0.0};
};
union {
} geometry;
};
/* MOUNT BASE TEMPLATED CLASS WITH BASIC FUNCTIONALITY */
// implements a Finite State Machine Pattern
@@ -337,18 +359,15 @@ public:
// .time_from = time duration to exit the zone (0 - if already out of the zone, chrono::duration<>::max() if
// never exit the zone)
auto pzCheck(const MccCoordinate& xcoord,
auto pzCheck(this auto&& self,
const MccCoordinate& xcoord,
const MccCoordinate& ycoord,
std::derived_from<MccProhibitedZoneContext> auto const& context,
traits::mcc_systime_c auto const& utc = std::chrono::system_clock::now())
{
using d_t = std::remove_cvref_t<decltype(utc)>::duration;
return pzcheck_result_t<d_t>{.inzone = false, .time_to = d_t::max(), .time_from = d_t{0}};
return std::forward<decltype(self)>(self).pzCheckImpl(xcoord, ycoord, context, utc);
}
// 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,
@@ -424,6 +443,17 @@ protected:
std::atomic<MccMountSiteInfo> _geoLocation;
std::atomic<MccMountMeteo> _currentMeteo;
// default implementation
auto pzCheckImpl(const MccCoordinate& xcoord,
const MccCoordinate& ycoord,
std::derived_from<MccProhibitedZoneContext> auto const& context,
traits::mcc_systime_c auto const& utc = std::chrono::system_clock::now())
{
using d_t = std::remove_cvref_t<decltype(utc)>::duration;
return pzcheck_result_t<d_t>{.inzone = false, .time_to = d_t::max(), .time_from = d_t{0}};
}
};
} // namespace mcc