VR-Forces 4.0.4 Class Documentation
examples/guiThreadVrfRemoteController/remoteControlCommands.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2012 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: remoteControlCommands.h,v $ $Revision: 1.2 $ $State: Exp $
00007 ******************************************************************************/
00008 //\file remoteControlCommands.h
00009 
00010 #pragma once
00011 
00012 #include <vrvUtil/signalslib.h>
00013 #include <vlpi/entityType.h>
00014 
00015 #include <QtCore/QStringList>
00016 
00017 namespace makVrv
00018 {
00019    class DtDe;
00020 }
00021 
00022 class QString;
00023 class DtEntityIdentifier;
00024 
00025 //These classes will represent commands that can be executed by using the
00026 //DtVrossThreadVrfRemoteControl class.
00027 
00028 class DtRemoteControlCommand
00029 {
00030 public:
00031    virtual bool execute(makVrv::DtDe&, const QString& command) = 0;
00032    virtual DtRemoteControlCommand* clone() const = 0;
00033 
00034    QString help() const
00035    {
00036       return myHelp;
00037    }
00038 
00039    QString command() const
00040    {
00041       return myCommand;
00042    }
00043 
00044    boost::signal<void (const QString&, DtRemoteControlCommand*)> signal_commandComplete;
00045 
00046 protected:
00047    //Parse out the string.  All tokens are separated by spaces or enclosed in quotes or
00048    //parens
00049    virtual QStringList tokenize(const QString&, char delim = ' ') const;
00050 
00051    //Parses a point of the form x,y,z
00052    bool parsePoint(const QString&, DtVector&) const;
00053 
00054 protected:
00055    DtRemoteControlCommand(const QString& command, const QString& help);
00056    DtRemoteControlCommand(const DtRemoteControlCommand&);
00057 
00058 protected:
00059    QString myCommand;
00060    QString myHelp;
00061 };
00062 
00063 //This command will create a single point object (entity, waypoint, aggregate) and will notify the user
00064 //when the command has been completed
00065 class DtRemoteControlCreateCommand : public DtRemoteControlCommand
00066 {
00067 public:
00068    DtRemoteControlCreateCommand();
00069 
00070    virtual ~DtRemoteControlCreateCommand();
00071 
00072    virtual bool execute(makVrv::DtDe&, const QString& command);
00073    virtual DtRemoteControlCommand* clone() const;
00074 
00075    //Convert string to entity type either by name or by actual type
00076    DtEntityType entityToCreate(const QString& c, makVrv::DtDe& de) const;
00077 
00078    //Returns the currently selected simulation address
00079    DtSimulationAddress simulationAddress(makVrv::DtDe&) const;
00080 
00081 protected:
00082    //Called when the object is created, will signal complete with the name and the object id
00083    void objectCreated(DtString, const DtEntityIdentifier&);
00084 };
00085 
00086 //Loads the specified scenario into the simulation
00087 
00088 class DtRemoteControlLoadScenarioCommand : public DtRemoteControlCommand
00089 {
00090 public:
00091    DtRemoteControlLoadScenarioCommand();
00092    virtual ~DtRemoteControlLoadScenarioCommand();
00093 
00094    virtual bool execute(makVrv::DtDe&, const QString& command);
00095    virtual DtRemoteControlCommand* clone() const;
00096 };
00097 
00098 //Loads a new scenario into the system
00099 
00100 class DtRemoteControlNewScenarioCommand : public DtRemoteControlCommand
00101 {
00102 public:
00103    DtRemoteControlNewScenarioCommand();
00104    virtual ~DtRemoteControlNewScenarioCommand();
00105 
00106    virtual bool execute(makVrv::DtDe&, const QString& command);
00107    virtual DtRemoteControlCommand* clone() const;
00108 };
00109 
00110 //Rewinds the current scenario
00111 
00112 class DtRemoteControlRewindScenarioCommand : public DtRemoteControlCommand
00113 {
00114 public:
00115    DtRemoteControlRewindScenarioCommand();
00116    virtual ~DtRemoteControlRewindScenarioCommand();
00117 
00118    virtual bool execute(makVrv::DtDe&, const QString& command);
00119    virtual DtRemoteControlCommand* clone() const;
00120 };
00121 
00122 //Pauses the current scenario
00123 
00124 class DtRemoteControlPauseScenarioCommand : public DtRemoteControlCommand
00125 {
00126 public:
00127    DtRemoteControlPauseScenarioCommand();
00128    virtual ~DtRemoteControlPauseScenarioCommand();
00129 
00130    virtual bool execute(makVrv::DtDe&, const QString& command);
00131    virtual DtRemoteControlCommand* clone() const;
00132 };
00133 
00134 //Plays the current scenario
00135 
00136 class DtRemoteControlPlayScenarioCommand : public DtRemoteControlCommand
00137 {
00138 public:
00139    DtRemoteControlPlayScenarioCommand();
00140    virtual ~DtRemoteControlPlayScenarioCommand();
00141 
00142    virtual bool execute(makVrv::DtDe&, const QString& command);
00143    virtual DtRemoteControlCommand* clone() const;
00144 };
00145 
00146 //Saves the current scenario
00147 
00148 class DtRemoteControlSaveScenarioCommand : public DtRemoteControlCommand
00149 {
00150 public:
00151    DtRemoteControlSaveScenarioCommand();
00152    virtual ~DtRemoteControlSaveScenarioCommand();
00153 
00154    virtual bool execute(makVrv::DtDe&, const QString& command);
00155    virtual DtRemoteControlCommand* clone() const;
00156 };

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)