LoadWalkControl.h
Go to the documentation of this file.00001
00002 #ifndef INCLUDED_LoadWalkControl_h
00003 #define INCLUDED_LoadWalkControl_h
00004
00005 #include "FileBrowserControl.h"
00006 #include "Motion/WalkMC.h"
00007 #include "Shared/Config.h"
00008 #include <string>
00009
00010
00011 class LoadWalkControl : public FileBrowserControl {
00012 public:
00013
00014 LoadWalkControl(const std::string& n, MC_ID w)
00015 : FileBrowserControl(n,"Loads a set of walk parameters from a file specified by user",config->motion.root), walk_id(w), thewalk(NULL)
00016 {
00017 setFilter("*.prm");
00018 }
00019
00020
00021 LoadWalkControl(const std::string& n, WalkMC * awalk)
00022 : FileBrowserControl(n,"Loads a set of walk parameters from a file specified by user",config->portPath(config->motion.root)), walk_id(invalid_MC_ID), thewalk(awalk)
00023 {
00024 setFilter("*.prm");
00025 }
00026
00027
00028 virtual ~LoadWalkControl() {}
00029
00030 protected:
00031
00032 virtual ControlBase* selectedFile(const std::string& f) {
00033 MC_ID id = thewalk==NULL?walk_id:thewalk->getID();
00034 WalkMC* walk=thewalk;
00035 if(id!=invalid_MC_ID)
00036 walk = (WalkMC*)motman->checkoutMotion(id);
00037 if(walk==NULL)
00038 serr->printf("Invalid walk for loading\n");
00039 else {
00040 walk->loadFile(f.c_str());
00041 if(id!=invalid_MC_ID)
00042 motman->checkinMotion(id);
00043 }
00044 return NULL;
00045 }
00046
00047 MC_ID walk_id;
00048 WalkMC * thewalk;
00049
00050 private:
00051 LoadWalkControl(const LoadWalkControl&);
00052 LoadWalkControl operator=(const LoadWalkControl&);
00053 };
00054
00055
00056
00057
00058
00059
00060 #endif