| 1 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 | |
| 3 | Header: FGWaypoint.h |
| 4 | Author: Jon Berndt |
| 5 | Date started: 6/2013 |
| 6 | |
| 7 | ------------- Copyright (C) 2013 Jon S. Berndt ([email protected]) ------------- |
| 8 | |
| 9 | This program is free software; you can redistribute it and/or modify it under |
| 10 | the terms of the GNU Lesser General Public License as published by the Free |
| 11 | Software Foundation; either version 2 of the License, or (at your option) any |
| 12 | later version. |
| 13 | |
| 14 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 15 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 16 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
| 17 | details. |
| 18 | |
| 19 | You should have received a copy of the GNU Lesser General Public License along |
| 20 | with this program; if not, write to the Free Software Foundation, Inc., 59 |
| 21 | Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 22 | |
| 23 | Further information about the GNU Lesser General Public License can also be |
| 24 | found on the world wide web at http://www.gnu.org. |
| 25 | |
| 26 | HISTORY |
| 27 | -------------------------------------------------------------------------------- |
| 28 | |
| 29 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 30 | SENTRY |
| 31 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 32 | |
| 33 | #ifndef FGWAYPOINT_H |
| 34 | #define FGWAYPOINT_H |
| 35 | |
| 36 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 37 | INCLUDES |
| 38 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 39 | |
| 40 | #include <memory> |
| 41 | |
| 42 | #include "FGFCSComponent.h" |
| 43 | #include "math/FGLocation.h" |
| 44 | |
| 45 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 46 | FORWARD DECLARATIONS |
| 47 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 48 | |
| 49 | namespace JSBSim { |
| 50 | |
| 51 | class FGFCS; |
| 52 | class Element; |
| 53 | |
| 54 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 55 | CLASS DOCUMENTATION |
| 56 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 57 | |
| 58 | /** Models a Waypoint object. |
| 59 | The waypoint_heading component returns the heading to a specified waypoint |
| 60 | lat/long from another specified point. |
| 61 | The waypoint_distance component returns the distance between |
| 62 | |
| 63 | @code |
| 64 | <waypoint_heading name="component_name" unit="DEG|RAD"> |
| 65 | <target_latitude unit="DEG|RAD"> property_name </target_latitude> |
| 66 | <target_longitude unit="DEG|RAD"> property_name </target_longitude> |
| 67 | <source_latitude unit="DEG|RAD"> property_name </source_latitude> |
| 68 | <source_longitude unit="DEG|RAD"> property_name </source_longitude> |
| 69 | [<clipto> |
| 70 | <min> {[-]property name | value} </min> |
| 71 | <max> {[-]property name | value} </max> |
| 72 | </clipto>] |
| 73 | [<output> {property} </output>] |
| 74 | </waypoint_heading> |
| 75 | |
| 76 | <waypoint_distance name="component_name" unit="FT|M"> |
| 77 | <target_latitude unit="DEG|RAD"> property_name </target_latitude> |
| 78 | <target_longitude unit="DEG|RAD"> property_name </target_longitude> |
| 79 | <source_latitude unit="DEG|RAD"> property_name </source_latitude> |
| 80 | <source_longitude unit="DEG|RAD"> property_name </source_longitude> |
| 81 | [<radius> {value} </radius>] |
| 82 | [<clipto> |
| 83 | <min> {[-]property name | value} </min> |
| 84 | <max> {[-]property name | value} </max> |
| 85 | </clipto>] |
| 86 | [<output> {property} </output>] |
| 87 | </waypoint_distance> |
| 88 | @endcode |
| 89 | |
| 90 | @author Jon S. Berndt |
| 91 | */ |
| 92 | |
| 93 | /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 94 | CLASS DECLARATION |
| 95 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ |
| 96 | |
| 97 | class FGWaypoint : public FGFCSComponent |
| 98 | { |
| 99 | public: |
| 100 | FGWaypoint(FGFCS* fcs, Element* element); |
| 101 | ~FGWaypoint(); |
| 102 | |
| 103 | bool Run(void) override; |
| 104 | |
| 105 | private: |
| 106 | FGLocation source; |
| 107 | std::unique_ptr<FGPropertyValue> target_latitude; |
| 108 | std::unique_ptr<FGPropertyValue> target_longitude; |
| 109 | std::unique_ptr<FGPropertyValue> source_latitude; |
| 110 | std::unique_ptr<FGPropertyValue> source_longitude; |
| 111 | double target_latitude_unit; |
| 112 | double target_longitude_unit; |
| 113 | double source_latitude_unit; |
| 114 | double source_longitude_unit; |
| 115 | double radius; |
| 116 | std::string unit; |
| 117 | enum {eNone=0, eDeg, eRad, eFeet, eMeters} eUnit; |
| 118 | enum {eNoType=0, eHeading, eDistance} WaypointType; |
| 119 | |
| 120 | void Debug(int from) override; |
| 121 | }; |
| 122 | } |
| 123 | //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 124 | |
| 125 | #endif |