Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

command.h

Go to the documentation of this file.
00001 // command.h
00002 //
00003 // Copyright (C) 2001 Chris Laurel <claurel@shatters.net>
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 
00010 #ifndef _COMMAND_H_
00011 #define _COMMAND_H_
00012 
00013 #include <iostream>
00014 #include <celutil/color.h>
00015 #include <celengine/execenv.h>
00016 #include <celengine/astro.h>
00017 
00018 
00019 class Command
00020 {
00021  public:
00022     Command() {};
00023     virtual ~Command() {};
00024     virtual void process(ExecutionEnvironment&, double t, double dt) = 0;
00025     virtual double getDuration() const = 0;
00026 };
00027 
00028 typedef std::vector<Command*> CommandSequence;
00029 
00030 
00031 class InstantaneousCommand : public Command
00032 {
00033  public:
00034     InstantaneousCommand() {};
00035     virtual ~InstantaneousCommand() {};
00036     virtual double getDuration() const { return 0.0; };
00037     virtual void process(ExecutionEnvironment&) = 0;
00038     void process(ExecutionEnvironment& env, double t, double dt)
00039     {
00040         process(env);
00041     };
00042 };
00043 
00044 
00045 class TimedCommand : public Command
00046 {
00047  public:
00048     TimedCommand(double _duration) : duration(_duration) {};
00049     virtual ~TimedCommand() {};
00050     double getDuration() const { return duration; };
00051 
00052  private:
00053     double duration;
00054 };
00055 
00056 
00057 class CommandWait : public TimedCommand
00058 {
00059  public:
00060     CommandWait(double _duration);
00061     ~CommandWait();
00062     void process(ExecutionEnvironment&, double t, double dt);
00063 };
00064 
00065 
00066 class CommandSelect : public InstantaneousCommand
00067 {
00068  public:
00069     CommandSelect(std::string _target);
00070     ~CommandSelect();
00071     void process(ExecutionEnvironment&);
00072 
00073  private:
00074     std::string target;
00075 };
00076 
00077 
00078 class CommandGoto : public InstantaneousCommand
00079 {
00080  public:
00081     CommandGoto(double t, double dist,
00082                 Vec3f _up, astro::CoordinateSystem _upFrame);
00083     ~CommandGoto();
00084     void process(ExecutionEnvironment&);
00085 
00086  private:
00087     double gotoTime;
00088     double distance;
00089     Vec3f up;
00090     astro::CoordinateSystem upFrame;
00091 };
00092 
00093 
00094 class CommandGotoLongLat : public InstantaneousCommand
00095 {
00096  public:
00097     CommandGotoLongLat::CommandGotoLongLat(double t,
00098                                            double dist,
00099                                            float _longitude, float _latitude,
00100                                            Vec3f _up);
00101     ~CommandGotoLongLat();
00102     void process(ExecutionEnvironment&);
00103 
00104  private:
00105     double gotoTime;
00106     double distance;
00107     float longitude;
00108     float latitude;
00109     Vec3f up;
00110 };
00111 
00112 
00113 class CommandGotoLocation : public InstantaneousCommand
00114 {
00115  public:
00116     CommandGotoLocation(double t,
00117                         const Point3d& translation, const Quatf& rotation);
00118     ~CommandGotoLocation();
00119     void process(ExecutionEnvironment&);
00120 
00121  private:
00122     double gotoTime;
00123     Point3d translation;
00124     Quatf rotation;
00125 };
00126 
00127 class CommandSetUrl : public InstantaneousCommand
00128 {
00129  public:
00130     CommandSetUrl(const std::string& _url);
00131     void process(ExecutionEnvironment&);
00132 
00133  private:
00134     std::string url;
00135 };
00136 
00137 
00138 class CommandCenter : public InstantaneousCommand
00139 {
00140  public:
00141     CommandCenter(double t);
00142     ~CommandCenter();
00143     void process(ExecutionEnvironment&);
00144 
00145  private:
00146     double centerTime;
00147 };
00148 
00149 
00150 class CommandFollow : public InstantaneousCommand
00151 {
00152  public:
00153     CommandFollow();
00154     void process(ExecutionEnvironment&);
00155 
00156  private:
00157     int dummy;   // Keep the class from having zero size
00158 };
00159 
00160 
00161 class CommandSynchronous : public InstantaneousCommand
00162 {
00163  public:
00164     CommandSynchronous();
00165     void process(ExecutionEnvironment&);
00166 
00167  private:
00168     int dummy;   // Keep the class from having zero size
00169 };
00170 
00171 
00172 class CommandLock : public InstantaneousCommand
00173 {
00174  public:
00175     CommandLock();
00176     void process(ExecutionEnvironment&);
00177 
00178  private:
00179     int dummy;
00180 };
00181 
00182 
00183 class CommandChase : public InstantaneousCommand
00184 {
00185  public:
00186     CommandChase();
00187     void process(ExecutionEnvironment&);
00188 
00189  private:
00190     int dummy;
00191 };
00192 
00193 
00194 class CommandTrack : public InstantaneousCommand
00195 {
00196  public:
00197     CommandTrack();
00198     void process(ExecutionEnvironment&);
00199 
00200  private:
00201     int dummy;
00202 };
00203 
00204 
00205 class CommandSetFrame : public InstantaneousCommand
00206 {
00207  public:
00208     CommandSetFrame(astro::CoordinateSystem,
00209                     const std::string&, const std::string&);
00210     void process(ExecutionEnvironment&);
00211 
00212  private:
00213     astro::CoordinateSystem coordSys;
00214     std::string refObjectName;
00215     std::string targetObjectName;
00216 };
00217 
00218 
00219 class CommandSetSurface : public InstantaneousCommand
00220 {
00221  public:
00222     CommandSetSurface(const std::string&);
00223     void process(ExecutionEnvironment&);
00224 
00225  private:
00226     std::string surfaceName;
00227 };
00228 
00229 
00230 class CommandCancel : public InstantaneousCommand
00231 {
00232  public:
00233     CommandCancel();
00234     void process(ExecutionEnvironment&);
00235 
00236  private:
00237     int dummy;   // Keep the class from having zero size
00238 };
00239 
00240 
00241 class CommandExit : public InstantaneousCommand
00242 {
00243  public:
00244     CommandExit();
00245     void process(ExecutionEnvironment&);
00246 
00247  private:
00248     int dummy;   // Keep the class from having zero size
00249 };
00250 
00251 
00252 class CommandPrint : public InstantaneousCommand
00253 {
00254  public:
00255     CommandPrint(std::string, int horig, int vorig, int hoff, int voff,
00256                  double duration);
00257     void process(ExecutionEnvironment&);
00258 
00259  private:
00260     std::string text;
00261     int hOrigin;
00262     int vOrigin;
00263     int hOffset;
00264     int vOffset;
00265     double duration;
00266 };
00267 
00268 
00269 class CommandClearScreen : public InstantaneousCommand
00270 {
00271  public:
00272     CommandClearScreen();
00273     void process(ExecutionEnvironment&);
00274 
00275  private:
00276     int dummy;   // Keep the class from having zero size
00277 };
00278 
00279 
00280 class CommandSetTime : public InstantaneousCommand
00281 {
00282  public:
00283     CommandSetTime(double _jd);
00284     void process(ExecutionEnvironment&);
00285 
00286  private:
00287     double jd;
00288 };
00289 
00290 
00291 class CommandSetTimeRate : public InstantaneousCommand
00292 {
00293  public:
00294     CommandSetTimeRate(double);
00295     void process(ExecutionEnvironment&);
00296 
00297  private:
00298     double rate;
00299 };
00300 
00301 
00302 class CommandChangeDistance : public TimedCommand
00303 {
00304  public:
00305     CommandChangeDistance(double duration, double rate);
00306     void process(ExecutionEnvironment&, double t, double dt);
00307 
00308  private:
00309     double rate;
00310 };
00311 
00312 
00313 class CommandOrbit : public TimedCommand
00314 {
00315  public:
00316     CommandOrbit(double _duration, const Vec3f& axis, float rate);
00317     void process(ExecutionEnvironment&, double t, double dt);
00318 
00319  private:
00320     Vec3f spin;
00321 };
00322 
00323 
00324 class CommandRotate : public TimedCommand
00325 {
00326  public:
00327     CommandRotate(double _duration, const Vec3f& axis, float rate);
00328     void process(ExecutionEnvironment&, double t, double dt);
00329 
00330  private:
00331     Vec3f spin;
00332 };
00333 
00334 
00335 class CommandMove : public TimedCommand
00336 {
00337  public:
00338     CommandMove(double _duration, const Vec3d& _velocity);
00339     void process(ExecutionEnvironment&, double t, double dt);
00340 
00341  private:
00342     Vec3d velocity;
00343 };
00344 
00345 
00346 class CommandSetPosition : public InstantaneousCommand
00347 {
00348  public:
00349     CommandSetPosition(const UniversalCoord&);
00350     void process(ExecutionEnvironment&);
00351 
00352  private:
00353     UniversalCoord pos;
00354 };
00355 
00356 
00357 class CommandSetOrientation : public InstantaneousCommand
00358 {
00359  public:
00360     CommandSetOrientation(const Vec3f&, float);
00361     void process(ExecutionEnvironment&);
00362 
00363  private:
00364     Vec3f axis;
00365     float angle;
00366 };
00367 
00368 class CommandLookBack : public InstantaneousCommand
00369 {
00370  public:
00371     CommandLookBack();
00372     void process(ExecutionEnvironment&);
00373 
00374  private:
00375     int dummy;   // Keep the class from having zero size
00376 };
00377 
00378 
00379 class CommandRenderFlags : public InstantaneousCommand
00380 {
00381  public:
00382     CommandRenderFlags(int _setFlags, int _clearFlags);
00383     void process(ExecutionEnvironment&);
00384 
00385  private:
00386     int setFlags;
00387     int clearFlags;
00388 };
00389 
00390 
00391 class CommandLabels : public InstantaneousCommand
00392 {
00393  public:
00394     CommandLabels(int _setFlags, int _clearFlags);
00395     void process(ExecutionEnvironment&);
00396 
00397  private:
00398     int setFlags;
00399     int clearFlags;
00400 };
00401 
00402 
00403 class CommandOrbitFlags : public InstantaneousCommand
00404 {
00405  public:
00406     CommandOrbitFlags(int _setFlags, int _clearFlags);
00407     void process(ExecutionEnvironment&);
00408 
00409  private:
00410     int setFlags;
00411     int clearFlags;
00412 };
00413 
00414 
00415 class CommandSetVisibilityLimit : public InstantaneousCommand
00416 {
00417  public:
00418     CommandSetVisibilityLimit(double);
00419     void process(ExecutionEnvironment&);
00420 
00421  private:
00422     double magnitude;
00423 };
00424 
00425 class CommandSetFaintestAutoMag45deg : public InstantaneousCommand
00426 {
00427  public:
00428     CommandSetFaintestAutoMag45deg(double);
00429     void process(ExecutionEnvironment&);
00430 
00431  private:
00432     double magnitude;
00433 };
00434 
00435 class CommandSetAmbientLight : public InstantaneousCommand
00436 {
00437  public:
00438     CommandSetAmbientLight(float);
00439     void process(ExecutionEnvironment&);
00440 
00441  private:
00442     float lightLevel;
00443 };
00444 
00445 
00446 class CommandSet : public InstantaneousCommand
00447 {
00448  public:
00449     CommandSet(const std::string&, double);
00450     void process(ExecutionEnvironment&);
00451 
00452  private:
00453     std::string name;
00454     double value;
00455 };
00456 
00457 
00458 class CommandPreloadTextures : public InstantaneousCommand
00459 {
00460  public:
00461     CommandPreloadTextures(const std::string&);
00462     void process(ExecutionEnvironment&);
00463 
00464  private:
00465     std::string name;
00466 };
00467 
00468 
00469 class CommandMark : public InstantaneousCommand
00470 {
00471  public:
00472     CommandMark(const std::string&, Color, float, Marker::Symbol);
00473     void process(ExecutionEnvironment&);
00474 
00475  private:
00476     std::string target;
00477     Color color;
00478     float size;
00479     Marker::Symbol symbol;
00480 };
00481 
00482 
00483 class CommandUnmark : public InstantaneousCommand
00484 {
00485  public:
00486     CommandUnmark(const std::string&);
00487     void process(ExecutionEnvironment&);
00488 
00489  private:
00490     std::string target;
00491 };
00492 
00493 
00494 class CommandUnmarkAll : public InstantaneousCommand
00495 {
00496  public:
00497     CommandUnmarkAll();
00498     void process(ExecutionEnvironment&);
00499 
00500  private:
00501     int dummy;   // Keep the class from having zero size
00502 };
00503 
00504 
00505 class CommandCapture : public InstantaneousCommand
00506 {
00507  public:
00508     CommandCapture(const std::string&, const std::string&);
00509     void process(ExecutionEnvironment&);
00510 
00511  private:
00512     std::string type;
00513     std::string filename;
00514 };
00515 
00516 
00517 class CommandRenderPath : public InstantaneousCommand
00518 {
00519  public:
00520     CommandRenderPath(GLContext::GLRenderPath);
00521     void process(ExecutionEnvironment&);
00522 
00523  private:
00524     GLContext::GLRenderPath path;
00525 };
00526 
00527 
00528 class Execution;
00529 
00530 class RepeatCommand : public Command
00531 {
00532  public:
00533     RepeatCommand(CommandSequence* _body, int _repeatCount);
00534     ~RepeatCommand();
00535     void process(ExecutionEnvironment&, double t, double dt) = 0;
00536     double getDuration();
00537 
00538  private:
00539     CommandSequence* body;
00540     double bodyDuration;
00541     int repeatCount;
00542     Execution* execution;
00543 };
00544 
00545 
00546 
00547 #endif // _COMMAND_H_

Generated on Sat Jan 14 22:30:27 2006 for Celestia by  doxygen 1.4.1