// curveact.hpp -- curve actions // // Written by Frederic Bouvier, started June 2002. // // Copyright (C) 2002 Frederic Bouvier - fredb@users.sourceforge.net // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as // published by the Free Software Foundation; either version 2 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // // $Id: curveact.hpp,v 1.8 2003/04/01 22:04:16 fredb2 Exp $ #ifndef _curveact_hpp_ #define _curveact_hpp_ #include #include "action.hpp" #include "curve.hpp" class FGSD_AddCurveAction : public FGSD_Action { public: FGSD_AddCurveAction(); FGSD_AddCurveAction( double __lon, double __lat ); bool undo(); bool redo( bool __step = false ); std::string name() const; std::string description() const; FGSD_ActionID type() const; void *convertTo( FGSD_ActionID __id ); FGSD_Action *clone() const; bool getPosition( bool undo, double &lon, double &lat ) const; bool savable() const; bool save( const char *__project, SGPropertyNode *__node ); bool load( const char *__project, SGPropertyNode *__node ); static FGSD_ActionID _id; private: double _lon; double _lat; }; class FGSD_RemoveCurveAction : public FGSD_Action { public: typedef std::vector NameList; FGSD_RemoveCurveAction(); FGSD_RemoveCurveAction( const FGSD_Curve &__curve ); bool undo(); bool redo( bool __step = false ); std::string name() const; std::string description() const; FGSD_ActionID type() const; void *convertTo( FGSD_ActionID __id ); FGSD_Action *clone() const; bool getPosition( bool undo, double &lon, double &lat ) const; bool savable() const; bool save( const char *__project, SGPropertyNode *__node ); bool load( const char *__project, SGPropertyNode *__node ); static FGSD_ActionID _id; private: FGSD_Curve::PointList _pointList; bool _opened; size_t _current; }; class FGSD_AddCurvePointAction : public FGSD_Action { public: FGSD_AddCurvePointAction(); FGSD_AddCurvePointAction( double __lon, double __lat, size_t __index, double __pLon, double __pLat ); bool undo(); bool redo( bool __step = false ); std::string name() const; std::string description() const; FGSD_ActionID type() const; void *convertTo( FGSD_ActionID __id ); FGSD_Action *clone() const; bool getPosition( bool undo, double &lon, double &lat ) const; bool savable() const; bool save( const char *__project, SGPropertyNode *__node ); bool load( const char *__project, SGPropertyNode *__node ); static FGSD_ActionID _id; private: double _lon; double _lat; size_t _index; double _pLon; double _pLat; }; class FGSD_RemoveCurvePointAction : public FGSD_Action { public: FGSD_RemoveCurvePointAction(); FGSD_RemoveCurvePointAction( double __lon, double __lat, size_t __index, double __pLon, double __pLat, bool __last ); bool undo(); bool redo( bool __step = false ); std::string name() const; std::string description() const; FGSD_ActionID type() const; void *convertTo( FGSD_ActionID __id ); FGSD_Action *clone() const; bool getPosition( bool undo, double &lon, double &lat ) const; bool savable() const; bool save( const char *__project, SGPropertyNode *__node ); bool load( const char *__project, SGPropertyNode *__node ); static FGSD_ActionID _id; private: double _lon; double _lat; size_t _index; double _pLon; double _pLat; bool _last; }; class FGSD_MoveCurvePointAction : public FGSD_Action { public: FGSD_MoveCurvePointAction(); FGSD_MoveCurvePointAction( double __lon, double __lat, size_t __index, double __xdepl, double __ydepl ); bool undo(); bool redo( bool __step = false ); std::string name() const; std::string description() const; bool combine( FGSD_Action *__action ); FGSD_ActionID type() const; void *convertTo( FGSD_ActionID __id ); FGSD_Action *clone() const; bool getPosition( bool undo, double &lon, double &lat ) const; bool savable() const; bool save( const char *__project, SGPropertyNode *__node ); bool load( const char *__project, SGPropertyNode *__node ); static FGSD_ActionID _id; private: double _lon; double _lat; size_t _index; double _xdepl; double _ydepl; }; class FGSD_CurvePropertiesAction : public FGSD_Action { public: FGSD_CurvePropertiesAction(); FGSD_CurvePropertiesAction( const FGSD_Curve &__curve, FGSD_Curve::CurveType __type, double __height, const char *__material, bool __water ); bool undo(); bool redo( bool __step = false ); std::string name() const; std::string description() const; FGSD_ActionID type() const; void *convertTo( FGSD_ActionID __id ); FGSD_Action *clone() const; bool getPosition( bool undo, double &lon, double &lat ) const; bool savable() const; bool save( const char *__project, SGPropertyNode *__node ); bool load( const char *__project, SGPropertyNode *__node ); static FGSD_ActionID _id; private: double _lon; double _lat; FGSD_Curve::CurveType _oldType, _newType; double _oldHeight, _newHeight; std::string _oldMaterial, _newMaterial; bool _oldWater, _newWater; }; class FGSD_EmbedCurveAction : public FGSD_Action { public: FGSD_EmbedCurveAction(); FGSD_EmbedCurveAction( double __lon, double __lat ); bool undo(); bool redo( bool __step = false ); std::string name() const; std::string description() const; FGSD_ActionID type() const; void *convertTo( FGSD_ActionID __id ); FGSD_Action *clone() const; bool getPosition( bool undo, double &lon, double &lat ) const; bool savable() const; bool save( const char *__project, SGPropertyNode *__node ); bool load( const char *__project, SGPropertyNode *__node ); static FGSD_ActionID _id; private: double _lon; double _lat; }; #endif