| 1 | // tide.hxx -- interface for tidal movement |
| 2 | // |
| 3 | // Written by Erik Hofman, Octover 2020 |
| 4 | // |
| 5 | // Copyright (C) 2020 Erik Hofman <[email protected]> |
| 6 | // |
| 7 | // This program is free software; you can redistribute it and/or |
| 8 | // modify it under the terms of the GNU General Public License as |
| 9 | // published by the Free Software Foundation; either version 2 of the |
| 10 | // License, or (at your option) any later version. |
| 11 | // |
| 12 | // This program is distributed in the hope that it will be useful, but |
| 13 | // WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | // 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, write to the Free Software |
| 19 | // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 20 | // |
| 21 | |
| 22 | #ifndef __FGTIDE_HXX |
| 23 | #define __FGTIDE_HXX |
| 24 | |
| 25 | #ifndef __cplusplus |
| 26 | # error This library requires C++ |
| 27 | #endif |
| 28 | |
| 29 | |
| 30 | #ifdef HAVE_CONFIG_H |
| 31 | # include <config.h> |
| 32 | #endif |
| 33 | |
| 34 | #include <simgear/structure/subsystem_mgr.hxx> |
| 35 | #include <simgear/props/tiedpropertylist.hxx> |
| 36 | |
| 37 | class FGTide : public SGSubsystem |
| 38 | { |
| 39 | public: |
| 40 | FGTide() = default; |
| 41 | virtual ~FGTide() = default; |
| 42 | |
| 43 | // Subsystem API. |
| 44 | void bind() override; |
| 45 | void reinit() override; |
| 46 | void unbind() override; |
| 47 | void update(double dt) override; |
| 48 | |
| 49 | // Subsystem identification. |
| 50 | static const char* staticSubsystemClassId() { return "tides"; } |
| 51 | |
| 52 | private: |
| 53 | double _prev_moon_lon = -9999.0; |
| 54 | double _tide_level = 0; |
| 55 | |
| 56 | SGPropertyNode_ptr viewLon; |
| 57 | SGPropertyNode_ptr viewLat; |
| 58 | SGPropertyNode_ptr _tideLevelNorm; |
| 59 | SGPropertyNode_ptr _tideAnimation; |
| 60 | }; |
| 61 | |
| 62 | #endif // __FGTIDE_HXX |