Changes in / [7f1b51:b73545]
- Files:
-
- 2 added
- 11 deleted
- 75 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Action.cpp
r7f1b51 rb73545 127 127 128 128 Dialog * Action::createDialog(){ 129 Dialog *dialog = UIFactory::getInstance().makeDialog( Traits.getName());129 Dialog *dialog = UIFactory::getInstance().makeDialog(); 130 130 return fillDialog(dialog); 131 131 } -
src/Actions/ActionQueue.cpp
r7f1b51 rb73545 55 55 using namespace MoleCuilder; 56 56 57 const Action* ActionQueue::_lastchangedaction = NULL;58 59 57 ActionQueue::ActionQueue() : 60 Observable("ActionQueue"),61 58 AR(new ActionRegistry()), 62 59 history(new ActionHistory), … … 69 66 run_thread_isIdle(true) 70 67 #endif 71 { 72 // channels of observable 73 Channels *OurChannel = new Channels; 74 NotificationChannels.insert( std::make_pair(static_cast<Observable *>(this), OurChannel) ); 75 // add instance for each notification type 76 for (size_t type = 0; type < NotificationType_MAX; ++type) 77 OurChannel->addChannel(type); 78 } 68 {} 79 69 80 70 ActionQueue::~ActionQueue() … … 98 88 void ActionQueue::queueAction(const Action * const _action, enum Action::QueryOptions state) 99 89 { 100 OBSERVE;101 NOTIFY(ActionQueued);102 90 Action *newaction = _action->clone(state); 103 91 newaction->prepare(state); … … 130 118 mtx_queue.unlock(); 131 119 #endif 132 _lastchangedaction = newaction;133 120 } 134 121 -
src/Actions/ActionQueue.hpp
r7f1b51 rb73545 16 16 #include "CodePatterns/Singleton.hpp" 17 17 18 #include "CodePatterns/Observer/Channels.hpp"19 #include "CodePatterns/Observer/Observable.hpp"20 18 21 19 #ifdef HAVE_ACTION_THREAD … … 40 38 class ActionRegistry; 41 39 class ActionTrait; 42 43 namespace Queuedetail {44 template <class T> const T* lastChanged()45 {46 ASSERT(0, "Queuedetail::lastChanged() - only specializations may be used.");47 return NULL;48 }49 }50 40 51 41 /** This class combines the whole handling of Actions into a single class. … … 54 44 * automatically queued and placed into a History after execution. 55 45 */ 56 class ActionQueue : public Singleton<ActionQueue> , public Observable46 class ActionQueue : public Singleton<ActionQueue> 57 47 { 58 48 friend class Singleton<ActionQueue>; … … 61 51 typedef std::vector< Action * > ActionQueue_t; 62 52 63 //!> channels for this observable64 enum NotificationType {65 ActionQueued, // new action was queued66 NotificationType_MAX // denotes the maximum of available notification types67 };68 69 //>! access to last changed element (atom or molecule)70 template <class T> const T* lastChanged() const71 { return Queuedetail::lastChanged<T>(); }72 73 53 /** Queues the Action with \a name to be called. 74 54 * … … 242 222 ~ActionQueue(); 243 223 244 private:245 friend const Action *Queuedetail::lastChanged<Action>();246 static const Action *_lastchangedaction;247 248 224 //!> ActionRegistry to spawn new actions 249 225 ActionRegistry *AR; … … 284 260 ActionStatusList StatusList; 285 261 }; 286 namespace Queuedetail {287 template <> inline const Action* lastChanged<Action>() { return ActionQueue::_lastchangedaction; }288 }289 262 290 263 }; -
src/Actions/Action_impl_pre.hpp
r7f1b51 rb73545 111 111 ) 112 112 #endif 113 #ifdef paramdescriptions114 BOOST_PP_ASSERT_MSG(BOOST_PP_EQUAL(MAXPARAMTYPES, BOOST_PP_SEQ_SIZE(paramdescriptions)),\115 ERROR: There are not the same number of "paramtokens" and "paramdescriptions" in: __FILE__ \116 )117 #endif118 113 119 114 #ifdef statetypes … … 148 143 ,\ 149 144 BOOST_PP_SEQ_ELEM(n, paramtokens)\ 150 ,\ 151 BOOST_PP_SEQ_ELEM(n, paramdescriptions)\ 145 , Traits.getDescription()\ 152 146 ); 153 147 -
src/Actions/CommandAction/BondLengthTableAction.def
r7f1b51 rb73545 10 10 #include "Graph/BondGraph.hpp" 11 11 12 #include "Parameters/Validators/Ops_Validator.hpp"13 12 #include "Parameters/Validators/Specific/FilePresentValidator.hpp" 14 #include "Parameters/Validators/Specific/FileSuffixValidator.hpp"15 13 16 14 // i.e. there is an integer with variable name Z that can be found in … … 23 21 #define paramreferences (BondGraphFileName) 24 22 #define paramvalids \ 25 (FilePresentValidator() && (FileSuffixValidator("dat") || FileSuffixValidator("db")))23 (FilePresentValidator()) 26 24 27 25 #define statetypes (std::string) -
src/Actions/CommandAction/ElementDbAction.def
r7f1b51 rb73545 9 9 #include <sstream> 10 10 11 #include "Parameters/Validators/Ops_Validator.hpp"12 11 #include "Parameters/Validators/Specific/FilePresentValidator.hpp" 13 12 -
src/Actions/CommandAction/LoadSessionAction.def
r7f1b51 rb73545 9 9 #include <boost/filesystem/path.hpp> 10 10 11 #include "Parameters/Validators/Ops_Validator.hpp"12 11 #include "Parameters/Validators/Specific/FilePresentValidator.hpp" 13 #include "Parameters/Validators/Specific/FileSuffixValidator.hpp"14 12 15 13 // i.e. there is an integer with variable name Z that can be found in … … 22 20 #define paramreferences (filename) 23 21 #define paramvalids \ 24 (FilePresentValidator() && FileSuffixValidator("py"))22 (FilePresentValidator()) 25 23 26 24 #undef statetypes -
src/Actions/CommandAction/StoreSessionAction.def
r7f1b51 rb73545 11 11 12 12 #include "Parameters/Validators/DummyValidator.hpp" 13 #include "Parameters/Validators/Ops_Validator.hpp"14 #include "Parameters/Validators/Specific/FileSuffixValidator.hpp"15 13 #include "Parameters/Validators/Specific/SessionTypeValidator.hpp" 16 14 … … 24 22 #define paramreferences (filename)(sessiontype) 25 23 #define paramvalids \ 26 ( FileSuffixValidator("py") || FileSuffixValidator("sh") || FileSuffixValidator("bat")) \24 (DummyValidator< boost::filesystem::path >()) \ 27 25 (SessionTypeValidator()) 28 26 -
src/Actions/FragmentationAction/ClearFragmentationResultsAction.def
r7f1b51 rb73545 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include <boost/filesystem/path.hpp> 10 #include <vector> 11 12 #include "Parameters/Validators/RangeValidator.hpp" 13 #include "Parameters/Validators/Ops_Validator.hpp" 14 #include "Parameters/Validators/STLVectorValidator.hpp" 15 #include "Parameters/Validators/Specific/ParserFileValidator.hpp" 16 #include "Parameters/Validators/Specific/FilePresentValidator.hpp" 9 17 10 18 // i.e. there is an integer with variable name Z that can be found in -
src/Actions/FragmentationAction/MolecularDynamicsAction.cpp
r7f1b51 rb73545 65 65 actions.addAction(AR.getActionByName(std::string("output"))); 66 66 actions.addAction(AR.getActionByName(std::string("clear-fragment-results"))); 67 actions.addAction(AR.getActionByName(std::string("destroy-adjacency")));68 actions.addAction(AR.getActionByName(std::string("create-adjacency")));69 actions.addAction(AR.getActionByName(std::string("update-molecules")));70 67 actions.addAction(AR.getActionByName(std::string("fragment-molecule"))); 71 68 actions.addAction(AR.getActionByName(std::string("fragment-automation"))); … … 94 91 "FragmentationMolecularDynamicsAction::performCall() - output not found in ActionSequence."); 95 92 } 96 // don't recreate bond graph if not desired97 if (params.DontCreateGraphEachStep.get()) {98 #ifndef NDEBUG99 bool status = true;100 status &=101 #endif102 removeAction(std::string("destroy-adjacency"));103 104 #ifndef NDEBUG105 status &=106 #endif107 removeAction(std::string("create-adjacency"));108 109 #ifndef NDEBUG110 status &=111 #endif112 removeAction(std::string("update-molecules"));113 ASSERT( status,114 "FragmentationStructuralOptimizationAction::performCall() - at least one graph action not found in ActionSequence.");115 }116 93 // and call 117 94 ActionState::ptr state(MakroAction::performCall()); -
src/Actions/FragmentationAction/MolecularDynamicsAction.def
r7f1b51 rb73545 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 13 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 14 #define paramtypes (unsigned int)(bool) (bool)15 #define paramtokens ("steps")("output-every-step") ("keep-bondgraph")16 #define paramdescriptions ("numer of MD steps to perform")("whether World should be written after every step, useful if integration might hang") ("whether the bond graph should be kept the same during each step and not updated")17 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT("0")) (PARAM_DEFAULT("0"))18 #define paramreferences (steps)(DoOutput) (DontCreateGraphEachStep)14 #define paramtypes (unsigned int)(bool) 15 #define paramtokens ("steps")("output-every-step") 16 #define paramdescriptions ("numer of MD steps to perform")("whether World should be written after every step, useful if integration might hang") 17 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT("0")) 18 #define paramreferences (steps)(DoOutput) 19 19 #define paramvalids \ 20 20 (NotZeroValidator< unsigned int >()) \ 21 (DummyValidator<bool>()) \22 21 (DummyValidator<bool>()) 23 22 -
src/Actions/FragmentationAction/StructuralOptimizationAction.cpp
r7f1b51 rb73545 62 62 // present. If not, we still copy the position cleanly into a new step where then 63 63 // forces are set according to summed fragmentary contributions. This is much cleaner. 64 actions.addAction(AR.getActionByName(std::string("destroy-adjacency")));65 actions.addAction(AR.getActionByName(std::string("create-adjacency")));66 actions.addAction(AR.getActionByName(std::string("update-molecules")));67 64 actions.addAction(AR.getActionByName(std::string("fragment-molecule"))); 68 65 actions.addAction(AR.getActionByName(std::string("fragment-automation"))); … … 94 91 "FragmentationStructuralOptimizationAction::performCall() - output not found in ActionSequence."); 95 92 } 96 // don't recreate bond graph if not desired97 if (params.DontCreateGraphEachStep.get()) {98 #ifndef NDEBUG99 bool status = true;100 status &=101 #endif102 removeAction(std::string("destroy-adjacency"));103 104 #ifndef NDEBUG105 status &=106 #endif107 removeAction(std::string("create-adjacency"));108 109 #ifndef NDEBUG110 status &=111 #endif112 removeAction(std::string("update-molecules"));113 ASSERT( status,114 "FragmentationStructuralOptimizationAction::performCall() - at least one graph action not found in ActionSequence.");115 }116 93 // and call 117 94 ActionState::ptr state(MakroAction::performCall()); -
src/Actions/FragmentationAction/StructuralOptimizationAction.def
r7f1b51 rb73545 12 12 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 13 13 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 14 #define paramtypes (unsigned int)(bool) (bool)15 #define paramtokens ("steps")("output-every-step") ("keep-bondgraph")16 #define paramdescriptions ("numer of MD steps to perform")("whether we should update the timestep in each descent step sp as to visualize the minimisation") ("whether the bond graph should be kept the same during each step and not updated")17 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT("0")) (PARAM_DEFAULT("0"))18 #define paramreferences (steps)(DoOutput) (DontCreateGraphEachStep)14 #define paramtypes (unsigned int)(bool) 15 #define paramtokens ("steps")("output-every-step") 16 #define paramdescriptions ("numer of MD steps to perform")("whether we should update the timestep in each descent step sp as to visualize the minimisation") 17 #define paramdefaults (NOPARAM_DEFAULT)(PARAM_DEFAULT("0")) 18 #define paramreferences (steps)(DoOutput) 19 19 #define paramvalids \ 20 20 (NotZeroValidator< unsigned int >()) \ 21 (DummyValidator<bool>()) \22 21 (DummyValidator<bool>()) 23 22 -
src/Actions/GraphAction/CorrectBondDegreeAction.cpp
r7f1b51 rb73545 106 106 BG->CorrectBondDegree(Set); 107 107 108 // give info 109 size_t BondCount = 0; 110 std::vector<molecule *> molecules = World::getInstance().getAllMolecules(); 111 for (std::vector<molecule *>::const_iterator iter = molecules.begin(); 112 iter != molecules.end(); ++iter) 113 BondCount += (*iter)->getBondCount(); 114 LOG(0, "STATUS: Recognized " << BondCount << " bonds."); 115 108 116 return ActionState::ptr(UndoState); 109 117 } -
src/Actions/MoleculeAction/ForceAnnealingAction.def
r7f1b51 rb73545 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include <boost/filesystem/path.hpp>10 11 9 #include "Parameters/Validators/DummyValidator.hpp" 12 10 #include "Parameters/Validators/GenericValidators.hpp" 13 11 #include "Parameters/Validators/Ops_Validator.hpp" 12 #include "Parameters/Validators/Specific/FilePresentValidator.hpp" 14 13 15 14 // i.e. there is an integer with variable name Z that can be found in -
src/Actions/MoleculeAction/VerletIntegrationAction.def
r7f1b51 rb73545 8 8 // all includes and forward declarations necessary for non-integral types below 9 9 #include "LinearAlgebra/Vector.hpp" 10 #include <boost/filesystem/path.hpp>11 10 #include <vector> 12 11 typedef std::vector<Vector> Vectors_t; … … 15 14 #include "Parameters/Validators/GenericValidators.hpp" 16 15 #include "Parameters/Validators/Ops_Validator.hpp" 16 #include "Parameters/Validators/Specific/FilePresentValidator.hpp" 17 17 18 18 // i.e. there is an integer with variable name Z that can be found in -
src/Actions/PotentialAction/FitPotentialAction.def
r7f1b51 rb73545 18 18 #include "Parameters/Validators/Specific/ElementValidator.hpp" 19 19 #include "Parameters/Validators/Specific/EmptyStringValidator.hpp" 20 #include "Parameters/Validators/Specific/FileSuffixValidator.hpp"21 20 #include "Parameters/Validators/Specific/FilePresentValidator.hpp" 22 21 #include "Parameters/Validators/Specific/PotentialTypeValidator.hpp" … … 27 26 #define paramtypes (boost::filesystem::path)(std::string)(boost::filesystem::path)(std::vector<const element *>)(std::vector<const element *>)(unsigned int)(double) 28 27 #define paramtokens ("training-file")("potential-type")("potential-file")("potential-charges")("fragment-charges")("take-best-of")("set-threshold") 29 #define paramdescriptions ("optional file to write training data to")("potential type to fit")(" optionalpotential file specifying multiple potentials to fit")("charges specifying the potential")("charges specifying the fragment")("take the best among this many approximations")("Require L2 error to be smaller than threshold, overrides number of attempts")28 #define paramdescriptions ("optional file to write training data to")("potential type to fit")("potential file specifying multiple potentials to fit")("charges specifying the potential")("charges specifying the fragment")("take the best among this many approximations")("Require L2 error to be smaller than threshold, overrides number of attempts") 30 29 #define paramdefaults (PARAM_DEFAULT(""))(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT(3))(PARAM_DEFAULT(1.)) 31 30 #define paramreferences (training_file)(potentialtype)(potential_file)(charges)(fragment)(best_of_howmany)(threshold) … … 33 32 (DummyValidator<boost::filesystem::path>()) \ 34 33 (EmptyStringValidator() || PotentialTypeValidator()) \ 35 ( !FilePresentValidator() || FileSuffixValidator("potentials")) \34 (DummyValidator<boost::filesystem::path>()) \ 36 35 (STLVectorValidator< std::vector<const element *> >(0,99, ElementValidator())) \ 37 36 (STLVectorValidator< std::vector<const element *> >(1,99, ElementValidator())) \ -
src/Actions/unittests/stubs/DummyUI.hpp
r7f1b51 rb73545 21 21 { 22 22 public: 23 DummyDialog(const std::string &_title) : 24 Dialog(_title) 25 {} 23 DummyDialog(){} 26 24 virtual ~DummyDialog(){} 27 25 … … 55 53 virtual ~DummyUIFactory(){} 56 54 57 virtual Dialog* makeDialog( const std::string &_title){return new DummyDialog(_title);}55 virtual Dialog* makeDialog(){return new DummyDialog;} 58 56 virtual MainWindow* makeMainWindow(){return 0;} 59 57 -
src/Graph/BondGraph.hpp
r7f1b51 rb73545 355 355 // remove every bond from the list 356 356 for(iterator_type AtomRunner = Set.begin(); AtomRunner != Set.end(); ++AtomRunner) { 357 (*AtomRunner)->removeAllBonds(WorldTime::getTime()); 357 (*AtomRunner)->removeAllBonds(); 358 // BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 359 // for(BondList::iterator BondRunner = ListOfBonds.begin(); 360 // !ListOfBonds.empty(); 361 // BondRunner = ListOfBonds.begin()) { 362 // ASSERT((*BondRunner)->Contains(*AtomRunner), 363 // "BondGraph::cleanAdjacencyList() - "+ 364 // toString(*BondRunner)+" does not contain "+ 365 // toString(*AtomRunner)+"."); 366 // delete((*BondRunner)); 367 // } 358 368 } 359 369 } -
src/Parameters/Makefile.am
r7f1b51 rb73545 4 4 5 5 PARAMETERSOURCE = \ 6 Parameters/Specifics/Value_atom.cpp \7 Parameters/Specifics/Value_element.cpp \8 Parameters/Specifics/Value_molecule.cpp \9 Parameters/Specifics/Value_string.cpp \10 6 Parameters/Validators/Specific/ActionNameValidator.cpp \ 11 7 Parameters/Validators/Specific/AtomDataValidator.cpp \ … … 30 26 Parameters/Validators/Specific/VectorNotZeroValidator.cpp \ 31 27 Parameters/Validators/Specific/VectorPositiveComponentsValidator.cpp \ 32 Parameters/Validators/Specific/VectorZeroOneComponentsValidator.cpp 28 Parameters/Validators/Specific/VectorZeroOneComponentsValidator.cpp \ 29 Parameters/Value_string.cpp 33 30 34 31 PARAMETERHEADER = \ … … 37 34 Parameters/ParameterInterface.hpp \ 38 35 Parameters/StreamOperators.hpp \ 39 Parameters/ContinuousValue.hpp \40 Parameters/ContinuousValue_impl.hpp \41 Parameters/Value.hpp \42 Parameters/Value_impl.hpp \43 Parameters/ValueAsString.hpp \44 Parameters/ValueInterface.hpp \45 Parameters/Specifics/Value_atom.hpp \46 Parameters/Specifics/Value_element.hpp \47 Parameters/Specifics/Value_molecule.hpp \48 Parameters/Specifics/Value_string.hpp \49 36 Parameters/Validators/DiscreteValidator.hpp \ 50 37 Parameters/Validators/DiscreteValidator_impl.hpp \ … … 52 39 Parameters/Validators/GenericValidators.hpp \ 53 40 Parameters/Validators/GenericValidators_impl.hpp \ 54 Parameters/Validators/getFlatListFromHierarchyOfValidators.hpp \55 41 Parameters/Validators/Ops_Validator.hpp \ 56 42 Parameters/Validators/Ops_Validator_impl.hpp \ … … 86 72 Parameters/Validators/Specific/VectorNotZeroValidator.hpp \ 87 73 Parameters/Validators/Specific/VectorPositiveComponentsValidator.hpp \ 88 Parameters/Validators/Specific/VectorZeroOneComponentsValidator.hpp 74 Parameters/Validators/Specific/VectorZeroOneComponentsValidator.hpp \ 75 Parameters/ContinuousValue.hpp \ 76 Parameters/ContinuousValue_impl.hpp \ 77 Parameters/Value.hpp \ 78 Parameters/Value_impl.hpp \ 79 Parameters/Value_string.hpp \ 80 Parameters/ValueAsString.hpp \ 81 Parameters/ValueInterface.hpp 89 82 90 83 if CONDLEVMAR -
src/Parameters/Validators/Ops_Validator_impl.hpp
r7f1b51 rb73545 52 52 Validator<T> *getA(){ return a; } 53 53 Validator<T> *getB(){ return b; } 54 const Validator<T> *getA() const { return a; }55 const Validator<T> *getB() const { return b; }56 54 57 55 private: … … 92 90 } 93 91 94 Validator<T> *getA(){ return a; }95 Validator<T> *getB(){ return b; }96 const Validator<T> *getA() const { return a; }97 const Validator<T> *getB() const { return b; }98 99 92 private: 100 93 Validator<T> *a; … … 133 126 } 134 127 135 Validator<T> *getA(){ return a; }136 const Validator<T> *getA() const { return a; }137 138 128 private: 139 129 Validator<T> *a; -
src/Parameters/Validators/Specific/FileSuffixValidator.hpp
r7f1b51 rb73545 33 33 Validator< boost::filesystem::path >* clone() const; 34 34 35 const std::string & getSuffix() const36 { return suffix; }37 38 35 private: 39 36 std::string suffix; -
src/Parameters/Validators/Specific/ParserFileValidator.cpp
r7f1b51 rb73545 72 72 } 73 73 74 std::vector<std::string> ParserFileValidator::getSuffixes() const75 {76 std::vector<std::string> suffixes;77 for (ParserTypes t = ParserTypes_begin; t < ParserTypes_end; ++ t){78 suffixes.push_back(79 FormatParserStorage::getInstance().getSuffixFromType(t));80 }81 return suffixes;82 }83 74 84 75 76 -
src/Parameters/Validators/Specific/ParserFileValidator.hpp
r7f1b51 rb73545 27 27 bool operator==(const Validator<boost::filesystem::path> &_instance) const; 28 28 Validator< boost::filesystem::path >* clone() const; 29 30 public:31 std::vector<std::string> getSuffixes() const;32 29 }; 33 30 -
src/Parameters/Validators/Validator.hpp
r7f1b51 rb73545 35 35 }; 36 36 37 37 38 #endif /* VALIDATOR_HPP_ */ -
src/Parameters/Value.hpp
r7f1b51 rb73545 119 119 #include "Value_impl.hpp" 120 120 121 #include "Specifics/Value_atom.hpp" 122 #include "Specifics/Value_element.hpp" 123 #include "Specifics/Value_molecule.hpp" 124 #include "Specifics/Value_string.hpp" 121 #include "Value_string.hpp" 125 122 126 123 #endif /* VALUE_HPP_ */ -
src/Tesselation/tesselation.cpp
r7f1b51 rb73545 115 115 LinkedCell_deprecated *LinkedList = new LinkedCell_deprecated(cloud, 2.*SPHERERADIUS); 116 116 117 // check for at least three points118 {119 bool ThreePointsFound = true;120 cloud.GoToFirst();121 for (size_t i=0;i<3;++i, cloud.GoToNext())122 ThreePointsFound &= (!cloud.IsEnd());123 cloud.GoToFirst();124 if (ThreePointsFound == false) {125 ELOG(2, "Less than 3 points in cloud, not enough for tesselation.");126 return;127 }128 }129 130 // find a starting triangle131 117 FindStartingTriangle(SPHERERADIUS, LinkedList); 132 118 -
src/UIElements/CommandLineUI/CommandLineDialog.cpp
r7f1b51 rb73545 42 42 43 43 44 CommandLineDialog::CommandLineDialog(const std::string &_title) : 45 Dialog(_title) 44 CommandLineDialog::CommandLineDialog() 46 45 { 47 46 } -
src/UIElements/CommandLineUI/CommandLineDialog.hpp
r7f1b51 rb73545 30 30 { 31 31 public: 32 CommandLineDialog( const std::string &_title);32 CommandLineDialog(); 33 33 virtual ~CommandLineDialog(); 34 34 -
src/UIElements/CommandLineUI/CommandLineUIFactory.cpp
r7f1b51 rb73545 52 52 53 53 54 Dialog* CommandLineUIFactory::makeDialog( const std::string &_title) {55 return new CommandLineDialog( _title);54 Dialog* CommandLineUIFactory::makeDialog() { 55 return new CommandLineDialog(); 56 56 } 57 57 -
src/UIElements/CommandLineUI/CommandLineUIFactory.hpp
r7f1b51 rb73545 48 48 virtual ~CommandLineUIFactory(); 49 49 50 virtual Dialog* makeDialog( const std::string &_title);50 virtual Dialog* makeDialog(); 51 51 virtual MainWindow* makeMainWindow(); 52 52 -
src/UIElements/Dialog.cpp
r7f1b51 rb73545 50 50 using namespace std; 51 51 52 Dialog::Dialog( const std::string &_title)52 Dialog::Dialog() 53 53 { 54 54 } … … 120 120 121 121 bool Dialog::hasQueries(){ 122 list<Query*>::iterator iter; 123 size_t nonemptyQueries = 0; 124 for(iter=queries.begin(); iter!=queries.end(); iter++) { 125 // count all queries that not EmptyQuery 126 if (dynamic_cast<Dialog::EmptyQuery *>(*iter) == NULL) 127 ++nonemptyQueries; 128 } 129 return nonemptyQueries != 0; 122 return queries.size(); 130 123 } 131 124 -
src/UIElements/Dialog.hpp
r7f1b51 rb73545 153 153 { 154 154 public: 155 Dialog( const std::string &_title);155 Dialog(); 156 156 virtual ~Dialog(); 157 157 -
src/UIElements/Makefile.am
r7f1b51 rb73545 179 179 UIElements/Views/Qt4/QtTimeLine.cpp \ 180 180 UIElements/Views/Qt4/QtToolBar.cpp \ 181 UIElements/Views/Qt4/QtToolBar_QtFavoriteActions.cpp \182 181 UIElements/Views/Qt4/Qt3D/GLWorldView.cpp \ 183 182 UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp \ … … 193 192 UIElements/Qt4/QtMainWindow.hpp \ 194 193 UIElements/Qt4/Query/QtQuery.hpp \ 195 UIElements/Menu/Qt4/QMenu_tooltip.hpp \196 194 UIElements/Menu/Qt4/QtMenuPipe.hpp \ 197 195 UIElements/Views/Qt4/QDebugStream.hpp \ -
src/UIElements/Menu/Menu.cpp
r7f1b51 rb73545 130 130 if (MenuName == name) { 131 131 const std::string &ActionName = *iter; 132 const std::string &ActionDescription = CurrentTrait.getDescription(); 133 Menu::addAction(ActionName, ActionDescription); 132 Menu::addAction(ActionName); 134 133 } 135 134 } 136 135 } 137 136 138 void Menu::addAction(const std::string &ActionName , const std::string &ActionDescription)137 void Menu::addAction(const std::string &ActionName) 139 138 { 140 139 LastItem = ActionItem; 141 addActionItem(ActionName, Action Description);140 addActionItem(ActionName, ActionName); 142 141 } 143 142 -
src/UIElements/Menu/Menu.hpp
r7f1b51 rb73545 61 61 62 62 protected: 63 // !>Unique name of the menu for identification.63 // Unique name of the menu for identification. 64 64 const std::string name; 65 65 66 /** populater function that adds all menu items. 67 * 68 */ 66 // populater function that adds all menu items 69 67 void populate(); 70 71 /** Populater function for all Actions in this menu.72 *73 */74 68 void populateActions(); 75 69 76 70 private: 77 /** Adds an action to this menu. 78 * 79 * @param ActionName name of action 80 * @param ActionDescription of the action (e.g. for tooltips) 81 */ 82 void addAction(const std::string &ActionName, const std::string &ActionDescription); 83 84 /** Adds a separator (e.g. horizontal line) to menu. 85 * 86 */ 71 void addAction(const std::string &ActionName); 87 72 void addSeparator(); 88 89 /** Adds a submenu to this menu.90 *91 * @param MenuName name of submenu92 * @param MenuPosition position in sequence of items of submenu93 */94 73 void addSubmenu(const std::string &MenuName, const int MenuPosition); 95 96 /** Checks whether an item named \a token exists in this menu.97 *98 * @param token name of action of submenu99 * @return true - item exists, false - item does not exist in this menu100 */101 74 bool isPresent(const std::string &token); 102 75 103 //!> enumeration of all valid item types104 76 enum ItemType {ActionItem, MenuItem, SeparatorItem, NoItem}; 105 77 106 //!> current position to add 107 int TopPosition; 108 //!> check whether separator followed separator 109 enum ItemType LastItem; 110 //!> is used to check for duplicates 111 std::set <std::string> DuplicatesList; 78 int TopPosition; // current position to add 79 enum ItemType LastItem; // check whether separator followed separator 80 std::set <std::string> DuplicatesList; // is used to check for duplicates 112 81 }; 113 82 -
src/UIElements/Menu/Qt4/QtMenu.hpp
r7f1b51 rb73545 16 16 17 17 #include <Qt/qaction.h> 18 19 #include "Menu/Qt4/QMenu_tooltip.hpp"20 18 21 19 #include <iostream> … … 105 103 virtual void addActionItem(const std::string &token, const std::string &description) 106 104 { 107 QAction *action = MenuInstance->addAction(QString(getNameWithAccelerator(token).c_str())); 108 action->setToolTip(QString(description.c_str())); 109 action->setWhatsThis(QString(description.c_str())); 105 QAction *action = MenuInstance->addAction(QString(getNameWithAccelerator(description).c_str())); 110 106 QtMenuPipe *pipe = new QtMenuPipe(token,action); 111 107 QObject::connect(action, SIGNAL(triggered()),pipe,SLOT(called())); … … 120 116 virtual void addSubmenuItem(const std::string &token, const std::string &description) 121 117 { 122 QMenu_tooltip *Menu = new QMenu_tooltip(QString(token.c_str())); 123 MenuInstance->addMenu(Menu); 124 QtMenu<QMenu_tooltip> *NewMenu = new QtMenu<QMenu_tooltip>(Menu, token); 118 QMenu *Menu = MenuInstance->addMenu(QString(token.c_str())); 119 QtMenu<QMenu> *NewMenu = new QtMenu<QMenu>(Menu, token); 125 120 NewMenu->init(); 126 121 } -
src/UIElements/Qt4/QtDialog.cpp
r7f1b51 rb73545 45 45 using namespace std; 46 46 47 QtDialog::QtDialog(const std::string &_title) : 48 QDialog(0), 49 Dialog(_title) 50 { 51 setWindowTitle(QString(_title.c_str())); 47 QtDialog::QtDialog() : 48 QDialog(0) 49 { 52 50 // creating and filling of the Dialog window 53 51 mainLayout = new QVBoxLayout(); -
src/UIElements/Qt4/QtDialog.hpp
r7f1b51 rb73545 30 30 Q_OBJECT 31 31 public: 32 QtDialog( const std::string &_title);32 QtDialog(); 33 33 virtual ~QtDialog(); 34 34 -
src/UIElements/Qt4/QtMainWindow.cpp
r7f1b51 rb73545 116 116 toolbar = new QtToolBar(this); 117 117 glWorldView->addToolBarActions(toolbar); 118 toolbar->addFavoriteActionItems(20);119 118 addToolBar(toolbar); 120 119 -
src/UIElements/Qt4/QtUIFactory.cpp
r7f1b51 rb73545 67 67 } 68 68 69 Dialog* QtUIFactory::makeDialog( const std::string &_title) {70 return new QtDialog( _title);69 Dialog* QtUIFactory::makeDialog() { 70 return new QtDialog(); 71 71 } 72 72 -
src/UIElements/Qt4/QtUIFactory.hpp
r7f1b51 rb73545 26 26 virtual ~QtUIFactory(); 27 27 28 virtual Dialog* makeDialog( const std::string &_title);28 virtual Dialog* makeDialog(); 29 29 virtual MainWindow* makeMainWindow(); 30 30 -
src/UIElements/Qt4/Query/AtomsQtQuery.cpp
r7f1b51 rb73545 47 47 QtQueryList<const atom *>(_param, _parent, _dialog, temp) 48 48 { 49 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this , _title);49 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this); 50 50 subQuery = new AtomQtQuery(*subParam, _title, _description, thisVLayout, subDialog); 51 51 subDialog->setSubQuery(subQuery); -
src/UIElements/Qt4/Query/DoublesQtQuery.cpp
r7f1b51 rb73545 47 47 QtQueryList<double>(_param, _parent, _dialog, temp) 48 48 { 49 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this , _title);49 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this); 50 50 subQuery = new DoubleQtQuery(*subParam, _title, _description, thisVLayout, subDialog); 51 51 subDialog->setSubQuery(subQuery); -
src/UIElements/Qt4/Query/ElementsQtQuery.cpp
r7f1b51 rb73545 48 48 QtQueryList<const element *>(_param, _parent, _dialog, temp) 49 49 { 50 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this , _title);50 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this); 51 51 subQuery = new ElementQtQuery(*subParam, _title, _description, thisVLayout, subDialog); 52 52 subDialog->setSubQuery(subQuery); -
src/UIElements/Qt4/Query/FileQtQuery.cpp
r7f1b51 rb73545 45 45 #include "UIElements/Qt4/Query/QtQuery.hpp" 46 46 47 #include <algorithm>48 #include <boost/filesystem.hpp>49 50 #include "Parameters/Validators/getFlatListFromHierarchyOfValidators.hpp"51 #include "Parameters/Validators/Validator.hpp"52 #include "Parameters/Validators/Specific/FilePresentValidator.hpp"53 #include "Parameters/Validators/Specific/FileSuffixValidator.hpp"54 #include "Parameters/Validators/Specific/ParserFileValidator.hpp"55 47 #include "Parser/ParserTypes.hpp" 56 48 #include "Parser/FormatParserStorage.hpp" … … 59 51 QtQuery<boost::filesystem::path>(_param, _title, _description), 60 52 parent(_parent), 61 dialog(_dialog), 62 mustBePresent(false) 53 dialog(_dialog) 63 54 { 64 55 filenameLineEdit = new QLineEdit(); … … 66 57 filenameLineEdit->setReadOnly(true); 67 58 68 filenameLabel = new QLabel(QString( _title.c_str()));59 filenameLabel = new QLabel(QString("Input file:")); 69 60 filenameLabel->setBuddy(filenameLineEdit); 70 61 filenameLabel->setToolTip(QString(getDescription().c_str())); … … 80 71 81 72 QObject::connect(filedialogButton,SIGNAL(clicked()),this,SLOT(showFileDialog())); 82 83 // fill list of suffixes84 const Validator<boost::filesystem::path> &validator =85 _param.getValidator();86 typedef std::vector<std::pair<const Validator<boost::filesystem::path> *, bool> > validators_t;87 const validators_t validators =88 getFlatListFromHierarchyOfValidators<boost::filesystem::path>(validator);89 for (validators_t::const_iterator iter = validators.begin();90 iter != validators.end(); ++iter) {91 const Validator< boost::filesystem::path > ¤tvalidator = *iter->first;92 if (dynamic_cast<const FileSuffixValidator * const>(¤tvalidator) != NULL)93 suffixes.push_back(dynamic_cast<const FileSuffixValidator &>(currentvalidator).getSuffix());94 if (dynamic_cast<const ParserFileValidator * const>(¤tvalidator) != NULL) {95 const std::vector<std::string> moresuffixes =96 dynamic_cast<const ParserFileValidator &>(currentvalidator).getSuffixes();97 suffixes.insert(suffixes.end(), moresuffixes.begin(), moresuffixes.end());98 }99 if (dynamic_cast<const FilePresentValidator * const>(¤tvalidator) != NULL)100 mustBePresent = iter->second;101 }102 std::sort(suffixes.begin(), suffixes.end());103 73 } 104 74 … … 123 93 // gather all possible suffixes 124 94 QStringList filters; 125 std::stringstream filter_string; 126 if (!suffixes.empty()) { 127 filter_string << "Valid files ("; 128 for (std::vector<std::string>::const_iterator iter = suffixes.begin(); 129 iter != suffixes.end(); ++iter) 130 filter_string << (iter == suffixes.begin() ? "*." : " *.") << *iter << " "; 131 filter_string << ")"; 132 filters << tr(filter_string.str().c_str()); 95 std::stringstream parsersuffixes; 96 parsersuffixes << std::string("Config files ("); 97 for (ParserTypes t = ParserTypes_begin; t < ParserTypes_end; ++t){ 98 if (t != ParserTypes_begin) 99 parsersuffixes << std::string(" "); 100 parsersuffixes << std::string("*.") << 101 FormatParserStorage::getInstance().getSuffixFromType(t); 133 102 } 103 parsersuffixes << std::string(")"); 104 filters << tr(parsersuffixes.str().c_str()); 105 filters << tr("Data files (*.dat)"); 134 106 filters << tr("Any files (*)"); 135 107 theFileDialog->setNameFilters(filters); -
src/UIElements/Qt4/Query/FilesQtQuery.cpp
r7f1b51 rb73545 48 48 QtQueryList<boost::filesystem::path>(_param, _parent, _dialog, temp) 49 49 { 50 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this , _title);50 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this); 51 51 subQuery = new FileQtQuery(*subParam, _title, _description, thisVLayout, subDialog); 52 52 subDialog->setSubQuery(subQuery); -
src/UIElements/Qt4/Query/IntsQtQuery.cpp
r7f1b51 rb73545 47 47 QtQueryList<int>(_param, _parent, _dialog, temp) 48 48 { 49 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this , _title);49 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this); 50 50 subQuery = new IntQtQuery(*subParam, _title, _description, thisVLayout, subDialog); 51 51 subDialog->setSubQuery(subQuery); -
src/UIElements/Qt4/Query/MoleculesQtQuery.cpp
r7f1b51 rb73545 47 47 QtQueryList<const molecule *>(_param, _parent, _dialog, temp) 48 48 { 49 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this , _title);49 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this); 50 50 subQuery = new MoleculeQtQuery(*subParam, _title, _description, thisVLayout, subDialog); 51 51 subDialog->setSubQuery(subQuery); -
src/UIElements/Qt4/Query/QtQuery.hpp
r7f1b51 rb73545 211 211 QFileDialog *theFileDialog; 212 212 Dialog *dialog; 213 std::vector<std::string> suffixes;214 bool mustBePresent;215 213 }; 216 214 -
src/UIElements/Qt4/Query/QtQueryList.hpp
r7f1b51 rb73545 107 107 { 108 108 public: 109 ListQuerySubDialog(QtQueryListUntyped *_parent, const std::string &_title) : 110 Dialog(_title), 111 parent(_parent), 112 sub(NULL) 113 {} 109 ListQuerySubDialog(QtQueryListUntyped *_parent) : parent(_parent), sub(NULL){} 114 110 virtual void update() 115 111 { -
src/UIElements/Qt4/Query/StringsQtQuery.cpp
r7f1b51 rb73545 47 47 QtQueryList<std::string>(_param, _parent, _dialog, temp) 48 48 { 49 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this , _title);49 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this); 50 50 subQuery = new StringQtQuery(*subParam, _title, _description, thisVLayout, subDialog); 51 51 subDialog->setSubQuery(subQuery); -
src/UIElements/Qt4/Query/UnsignedIntsQtQuery.cpp
r7f1b51 rb73545 47 47 QtQueryList<unsigned int>(_param, _parent, _dialog, temp) 48 48 { 49 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this , _title);49 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this); 50 50 subQuery = new UnsignedIntQtQuery(*subParam, _title, _description, thisVLayout, subDialog); 51 51 subDialog->setSubQuery(subQuery); -
src/UIElements/Qt4/Query/VectorsQtQuery.cpp
r7f1b51 rb73545 48 48 QtQueryList<Vector>(_param, _parent, _dialog, temp) 49 49 { 50 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this , _title);50 ListQuerySubDialog *subDialog = new ListQuerySubDialog(this); 51 51 subQuery = new VectorQtQuery(*subParam, _title, _description, thisVLayout, subDialog); 52 52 subDialog->setSubQuery(subQuery); -
src/UIElements/TextUI/TextDialog.cpp
r7f1b51 rb73545 41 41 42 42 43 TextDialog::TextDialog(const std::string &_title) : 44 Dialog(_title) 43 TextDialog::TextDialog() 45 44 { 46 45 } -
src/UIElements/TextUI/TextDialog.hpp
r7f1b51 rb73545 28 28 { 29 29 public: 30 TextDialog( const std::string &_title);30 TextDialog(); 31 31 virtual ~TextDialog(); 32 32 -
src/UIElements/TextUI/TextUIFactory.cpp
r7f1b51 rb73545 46 46 47 47 48 Dialog* TextUIFactory::makeDialog( const std::string &_title) {49 return new TextDialog( _title);48 Dialog* TextUIFactory::makeDialog() { 49 return new TextDialog(); 50 50 } 51 51 -
src/UIElements/TextUI/TextUIFactory.hpp
r7f1b51 rb73545 24 24 virtual ~TextUIFactory(); 25 25 26 virtual Dialog* makeDialog( const std::string &_title);26 virtual Dialog* makeDialog(); 27 27 virtual MainWindow* makeMainWindow(); 28 28 -
src/UIElements/UIFactory.hpp
r7f1b51 rb73545 56 56 * Again the type is determined upon factory creation. 57 57 */ 58 virtual Dialog* makeDialog( const std::string &_title)=0;58 virtual Dialog* makeDialog()=0; 59 59 60 60 protected: -
src/UIElements/Views/Qt4/Plotting/QSeisPlot.cpp
r7f1b51 rb73545 43 43 ASSERT(m_plottype != NULL, 44 44 "QSeisPlot::QSeisPlot() - could not find desired plottype by name "+type.toStdString()+"."); 45 //std::cout << "Type is " << type.toStdString() << ", " << m_plottype << std::endl;45 std::cout << "Type is " << type.toStdString() << ", " << m_plottype << std::endl; 46 46 47 47 //label axes -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.cpp
r7f1b51 rb73545 69 69 } 70 70 World::getInstance().signOn(this, World::SelectionChanged); 71 WorldTime::getInstance().signOn(this, WorldTime::TimeChanged); 71 72 72 73 // set the object's id … … 88 89 } 89 90 World::getInstance().signOff(this, World::SelectionChanged); 91 WorldTime::getInstance().signOff(this, WorldTime::TimeChanged); 90 92 } 91 93 … … 228 230 break; 229 231 } 232 } else { 233 // notification from world 234 #ifdef LOG_OBSERVER 235 observerLog().addMessage() << "++ Update of Observer "<< observerLog().getName(static_cast<Observer *>(this)) 236 << " received notification from Worldtime for channel " 237 << notification->getChannelNo() << "."; 238 #endif 239 switch (notification->getChannelNo()) { 240 case WorldTime::TimeChanged: 241 resetPosition(); 242 emit changed(); 243 break; 244 default: 245 break; 246 } 230 247 } 231 248 } -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_atom.hpp
r7f1b51 rb73545 22 22 #include "types.hpp" 23 23 24 class GLWorldScene;25 26 24 class GLMoleculeObject_atom : public GLMoleculeObject, public Observer 27 25 { … … 44 42 void indexChanged(GLMoleculeObject_atom *ob, int oldId, int newId); 45 43 46 private: 47 //!> grant GLWorldScene acess to reset functions 48 friend class GLWorldScene; 49 44 public: 50 45 void resetPosition(); 51 46 -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_bond.hpp
r7f1b51 rb73545 23 23 class atom; 24 24 25 class GLWorldScene;26 27 25 class GLMoleculeObject_bond : public GLMoleculeObject, public Observer 28 26 { … … 43 41 44 42 private: 45 //!> grant WorldScene access to reset functions46 friend class GLWorldScene;47 48 43 /** Recalculates the position of the cylinder representing the bond. 49 44 * -
src/UIElements/Views/Qt4/Qt3D/GLMoleculeObject_shape.cpp
r7f1b51 rb73545 80 80 std::vector<Vector> points = shape.getHomogeneousPointsOnSurface(NumPointsonSurface); 81 81 82 // Fill the points into a tesselate-able container. 83 TesselPointSTLList Corners; 84 for (size_t i=0;i<points.size();++i){ 85 TesselPoint *Walker = new TesselPoint; 86 Walker->setPosition(points[i]); 87 Walker->setName(toString(i)); 88 Walker->setNr(i); 89 Corners.push_back(Walker); 90 } 91 92 // Tesselate the points. 93 Tesselation *T = new Tesselation; 94 PointCloudAdaptor<TesselPointSTLList> cloud(&Corners, "TesselPointSTLList"); 95 (*T)(cloud, minradius); 96 97 // Fill the points into a Qt geometry. 82 98 QGeometryData geo; 83 // we need at least three points for tesselation 84 if (points.size() >= 3) { 85 // Fill the points into a tesselate-able container. 86 TesselPointSTLList Corners; 87 for (size_t i=0;i<points.size();++i){ 88 TesselPoint *Walker = new TesselPoint; 89 Walker->setPosition(points[i]); 90 Walker->setName(toString(i)); 91 Walker->setNr(i); 92 Corners.push_back(Walker); 93 } 94 95 // Tesselate the points. 96 Tesselation T; 97 PointCloudAdaptor<TesselPointSTLList> cloud(&Corners, "TesselPointSTLList"); 98 T(cloud, minradius); 99 100 // Fill the points into a Qt geometry. 101 LinkedCell_deprecated LinkedList(cloud, minradius); 102 std::vector<Vector> normals; 103 normals.resize(points.size(), zeroVec); 104 for(size_t i=0;i<points.size();++i){ 105 // add data to the primitive 106 geo.appendVertex(QVector3D(points[i][0], points[i][1], points[i][2])); 107 if (ShapeFactory::getInstance().isSimpleShape(shape.getType())) 108 normals[i] = shape.getNormal(points[i]); 109 else 110 normals[i] = T.getNormal(points[i], &LinkedList); 111 geo.appendNormal(QVector3D(normals[i][0], normals[i][1], normals[i][2])); 112 geo.appendColor(QColor(1, 1, 1, 1)); 113 geo.appendTexCoord(QVector2D(0, 0)); 114 } 115 116 // Fill the tesselated triangles into the geometry. 117 for (TriangleMap::const_iterator runner = T.TrianglesOnBoundary.begin(); runner != T.TrianglesOnBoundary.end(); runner++) { 118 int v[3]; 119 for (size_t i=0; i<3; ++i) 120 v[i] = runner->second->endpoints[i]->node->getNr(); 121 122 // Sort the vertices so the triangle is clockwise (relative to the normal vector). 123 Vector cross = points[v[1]] - points[v[0]]; 124 cross.VectorProduct(points[v[2]] - points[v[0]]); 125 if (cross.ScalarProduct(normals[v[0]] + normals[v[1]] + normals[v[2]]) > 0) 126 geo.appendIndices(v[0], v[1], v[2]); 127 else 128 geo.appendIndices(v[0], v[2], v[1]); 129 } 99 LinkedCell_deprecated LinkedList(cloud, minradius); 100 std::vector<Vector> normals; 101 normals.resize(points.size(), zeroVec); 102 for(size_t i=0;i<points.size();++i){ 103 // add data to the primitive 104 geo.appendVertex(QVector3D(points[i][0], points[i][1], points[i][2])); 105 if (ShapeFactory::getInstance().isSimpleShape(shape.getType())) 106 normals[i] = shape.getNormal(points[i]); 107 else 108 normals[i] = T->getNormal(points[i], &LinkedList); 109 geo.appendNormal(QVector3D(normals[i][0], normals[i][1], normals[i][2])); 110 geo.appendColor(QColor(1, 1, 1, 1)); 111 geo.appendTexCoord(QVector2D(0, 0)); 112 } 113 114 // Fill the tesselated triangles into the geometry. 115 for (TriangleMap::const_iterator runner = T->TrianglesOnBoundary.begin(); runner != T->TrianglesOnBoundary.end(); runner++) { 116 int v[3]; 117 for (size_t i=0; i<3; ++i) 118 v[i] = runner->second->endpoints[i]->node->getNr(); 119 120 // Sort the vertices so the triangle is clockwise (relative to the normal vector). 121 Vector cross = points[v[1]] - points[v[0]]; 122 cross.VectorProduct(points[v[2]] - points[v[0]]); 123 if (cross.ScalarProduct(normals[v[0]] + normals[v[1]] + normals[v[2]]) > 0) 124 geo.appendIndices(v[0], v[1], v[2]); 125 else 126 geo.appendIndices(v[0], v[2], v[1]); 130 127 } 131 128 -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.cpp
r7f1b51 rb73545 94 94 } 95 95 96 connect(this, SIGNAL(updated()), this, SLOT(update()));97 98 96 setSelectionMode(SelectAtom); 99 97 … … 112 110 void GLWorldScene::init() 113 111 { 114 const std::vector<atom*> &atoms = World::getInstance().getAllAtoms(); 115 116 if (atoms.size() > 0) { 117 for (std::vector<atom*>::const_iterator atomiter = atoms.begin(); 118 atomiter != atoms.end(); 119 atomiter++) { 120 // create atom objects in scene 121 atomInserted((*atomiter)->getId()); 122 123 // create bond objects in scene 124 const BondList &bondlist = (*atomiter)->getListOfBonds(); 125 for (BondList::const_iterator bonditer = bondlist.begin(); 126 bonditer != bondlist.end(); 127 ++bonditer) { 128 const bond::ptr _bond = *bonditer; 129 const GLMoleculeObject_bond::SideOfBond side = (_bond->leftatom == *atomiter) ? 130 GLMoleculeObject_bond::left : GLMoleculeObject_bond::right; 131 bondInserted(_bond, side); 132 } 133 } 134 } 135 } 136 137 /** Update the WorldScene with molecules and atoms from World. 138 * 139 * This function should be called after e.g. WorldTime::TimeChanged was 140 * received or after another molecule has been loaded. 141 * 142 */ 143 void GLWorldScene::update() 144 { 145 const std::vector<atom*> &atoms = World::getInstance().getAllAtoms(); 146 147 if (atoms.size() > 0) { 148 for (std::vector<atom*>::const_iterator atomiter = atoms.begin(); 149 atomiter != atoms.end(); 150 atomiter++) { 151 // check whether atom already exists 152 const atomId_t atomid = (*atomiter)->getId(); 153 const bool atom_present = AtomsinSceneMap.count(atomid); 154 if (!atom_present) 112 const std::vector<molecule*> &molecules = World::getInstance().getAllMolecules(); 113 114 if (molecules.size() > 0) { 115 for (std::vector<molecule*>::const_iterator Runner = molecules.begin(); 116 Runner != molecules.end(); 117 Runner++) { 118 119 for (molecule::const_iterator atomiter = (*Runner)->begin(); 120 atomiter != (*Runner)->end(); 121 ++atomiter) { 122 // create atom objects in scene 155 123 atomInserted((*atomiter)->getId()); 156 else 157 AtomsinSceneMap[atomid]->resetPosition(); 158 159 160 // create bond objects in scene 161 const BondList &bondlist = (*atomiter)->getListOfBonds(); 162 for (BondList::const_iterator bonditer = bondlist.begin(); 163 bonditer != bondlist.end(); 164 ++bonditer) { 165 const bond::ptr _bond = *bonditer; 166 const GLMoleculeObject_bond::SideOfBond side = (_bond->leftatom == *atomiter) ? 167 GLMoleculeObject_bond::left : GLMoleculeObject_bond::right; 168 bool bond_present = false; 169 const BondIds ids = getBondIds(_bond,side); 170 if (atom_present) { 171 // check whether bond is not present already 172 bond_present = BondsinSceneMap.count(ids); 173 } 174 if (!bond_present) 124 125 // create bond objects in scene 126 const BondList &bondlist = (*atomiter)->getListOfBonds(); 127 for (BondList::const_iterator bonditer = bondlist.begin(); 128 bonditer != bondlist.end(); 129 ++bonditer) { 130 const bond::ptr _bond = *bonditer; 131 const GLMoleculeObject_bond::SideOfBond side = (_bond->leftatom == *atomiter) ? 132 GLMoleculeObject_bond::left : GLMoleculeObject_bond::right; 175 133 bondInserted(_bond, side); 176 else {177 BondsinSceneMap[ids]->resetPosition();178 BondsinSceneMap[ids]->resetWidth();179 134 } 180 135 } … … 291 246 } 292 247 293 /** Helper function to get bond ids in the correct order for BondNodeMap. 294 * 295 * \return pair of ids in correct order. 296 */ 297 GLWorldScene::BondIds GLWorldScene::getBondIds( 298 const bond::ptr _bond, 299 const enum GLMoleculeObject_bond::SideOfBond _side) const 300 { 248 /** Adds a bond to the scene. 249 * 250 * @param _bond bond to add 251 * @param side which side of the bond (left or right) 252 */ 253 void GLWorldScene::bondInserted(const bond::ptr _bond, const enum GLMoleculeObject_bond::SideOfBond side) 254 { 255 LOG(3, "INFO: GLWorldScene::bondInserted() - Adding bond "+toString(*_bond)+"."); 256 //LOG(4, "INFO: Currently present bonds " << BondsinSceneMap << "."); 257 301 258 BondIds ids; 302 switch ( _side) {259 switch (side) { 303 260 case GLMoleculeObject_bond::left: 304 261 ids = std::make_pair(_bond->leftatom->getId(), _bond->rightatom->getId()); … … 308 265 break; 309 266 } 310 return ids; 311 } 312 313 /** Adds a bond to the scene. 314 * 315 * @param _bond bond to add 316 * @param side which side of the bond (left or right) 317 */ 318 void GLWorldScene::bondInserted(const bond::ptr _bond, const enum GLMoleculeObject_bond::SideOfBond _side) 319 { 320 LOG(3, "INFO: GLWorldScene::bondInserted() - Adding bond "+toString(*_bond)+"."); 321 //LOG(4, "INFO: Currently present bonds " << BondsinSceneMap << "."); 322 323 const BondIds ids = getBondIds(_bond, _side); 267 #ifndef NDEBUG 324 268 BondNodeMap::iterator iter = BondsinSceneMap.find(ids); 325 if (iter == BondsinSceneMap.end()) { 326 GLMoleculeObject_bond * bondObject = 327 new GLMoleculeObject_bond(meshCylinder, this, _bond, _side); 328 connect ( 329 bondObject, SIGNAL(BondRemoved(const atomId_t, const atomId_t)), 330 this, SLOT(bondRemoved(const atomId_t, const atomId_t))); 331 connect (bondObject, SIGNAL(changed()), this, SIGNAL(changed())); 332 BondsinSceneMap.insert( make_pair(ids, bondObject) ); 333 // BondIdsinSceneMap.insert( Leftids ); 334 } else { 335 iter->second->resetPosition(); 336 iter->second->resetWidth(); 337 } 269 ASSERT(iter == BondsinSceneMap.end(), 270 "GLWorldScene::bondAdded() - same left-sided bond "+toString(*_bond)+" added again."); 271 #endif 272 GLMoleculeObject_bond * bondObject = 273 new GLMoleculeObject_bond(meshCylinder, this, _bond, side); 274 connect ( 275 bondObject, SIGNAL(BondRemoved(const atomId_t, const atomId_t)), 276 this, SLOT(bondRemoved(const atomId_t, const atomId_t))); 277 connect (bondObject, SIGNAL(changed()), this, SIGNAL(changed())); 278 BondsinSceneMap.insert( make_pair(ids, bondObject) ); 279 // BondIdsinSceneMap.insert( Leftids ); 338 280 emit changeOccured(); 339 281 } -
src/UIElements/Views/Qt4/Qt3D/GLWorldScene.hpp
r7f1b51 rb73545 68 68 signals: 69 69 void changed(); 70 void updated();71 70 void changeOccured(); 72 71 void pressed(); … … 91 90 void addShape(); 92 91 void removeShape(); 93 void update();94 92 95 93 public: … … 102 100 typedef std::pair< atomId_t, atomId_t> BondIds; 103 101 friend std::ostream &operator<<(std::ostream &ost, const BondIds &t); 104 105 BondIds getBondIds(106 const bond::ptr _bond,107 const enum GLMoleculeObject_bond::SideOfBond side) const;108 102 109 103 typedef std::map< atomId_t, GLMoleculeObject_atom* > AtomNodeMap; -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.cpp
r7f1b51 rb73545 82 82 connect(this, SIGNAL(ShapeAdded()), worldscene, SLOT(addShape())); 83 83 connect(this, SIGNAL(ShapeRemoved()), worldscene, SLOT(removeShape())); 84 connect(this, SIGNAL(TimeChanged()), worldscene, SIGNAL(updated()));85 84 connect(worldscene, SIGNAL(changeOccured()), this, SLOT(changeSignalled())); 86 85 connect(worldscene, SIGNAL(changed()), this, SIGNAL(changed())); … … 394 393 #endif 395 394 emit changed(); 396 emit TimeChanged();397 395 break; 398 396 } -
src/UIElements/Views/Qt4/Qt3D/GLWorldView.hpp
r7f1b51 rb73545 57 57 signals: 58 58 void changed(); 59 void TimeChanged();60 59 void atomInserted(const atomicNumber_t _id); 61 60 void atomRemoved(const atomicNumber_t _id); -
src/UIElements/Views/Qt4/QtHomologyList.cpp
r7f1b51 rb73545 41 41 #include <QtGui/QTreeWidget> 42 42 #include <QtGui/QTabWidget> 43 #include <Qt/qsplitter.h> 44 #include <Qt/qboxlayout.h> 43 #include<Qt/qsplitter.h> 45 44 46 45 #include "CodePatterns/MemDebug.hpp" … … 74 73 potentialregistry_enabled(false) 75 74 { 76 QVBoxLayout* layout = new QVBoxLayout(this);77 75 QSplitter *splitter = new QSplitter (Qt::Horizontal, this ); 78 layout->addWidget(splitter);79 80 // tree widget81 76 treewidget = new QTreeWidget (splitter); 82 treewidget->setSelectionMode( QTreeWidget::SingleSelection );83 treewidget->setColumnCount(COLUMNCOUNT);84 QStringList header;85 for(int i=0; i<COLUMNCOUNT;++i)86 header << COLUMNNAMES[i];87 treewidget->setHeaderLabels(header);88 77 splitter->addWidget(treewidget); 89 78 90 // plot widget91 79 #ifdef HAVE_QWT 92 80 widget = new QSeisPlotPage ("energy", splitter); … … 96 84 #endif 97 85 splitter->addWidget(widget); 86 // splitter->setStretchFactor(10, 1); 87 88 treewidget->setSelectionMode( QTreeWidget::SingleSelection ); 89 90 treewidget->setColumnCount(COLUMNCOUNT); 91 QStringList header; 92 for(int i=0; i<COLUMNCOUNT;++i) 93 header << COLUMNNAMES[i]; 94 treewidget->setHeaderLabels(header); 98 95 99 96 dirty = true; … … 201 198 const EmpiricalPotential &potential = dynamic_cast<const EmpiricalPotential &>(**potiter); 202 199 const std::string potentialname = potential.getName(); 203 const FunctionModel::filter_t filter = potential.getSpecificFilter();204 200 Coordinator::ptr coordinator = potential.getCoordinator(); 205 201 // then we need to sample the potential 206 202 xvalues.clear(); 207 203 for (TrainingData::InputVector_t::const_iterator inputiter = inputs.begin(); 208 inputiter != inputs.end(); ++inputiter) { 209 const FunctionModel::list_of_arguments_t specificargs = filter(*inputiter); 210 double average = 0.; 211 for (FunctionModel::list_of_arguments_t::const_iterator argiter = specificargs.begin(); 212 argiter != specificargs.end(); ++argiter) { 213 const FunctionModel::arguments_t args = *argiter; 214 average += (*coordinator)(args); 215 } 216 if (specificargs.size() > 1) { 217 const size_t index = xvalues.size(); 218 xvalues.push_back(average/(double)specificargs.size()); 219 yvalues[index] *= 1./(double)specificargs.size(); 220 } 221 } 222 223 // We need to sort the xvalues (and associated yvalues also) 204 inputiter != inputs.end(); ++inputiter) 205 xvalues.push_back((*coordinator)(*inputiter)); 206 207 // We need to sort the xvalues (and yvalues also) 224 208 std::vector<double>::const_iterator xiter = xvalues.begin(); 225 209 std::vector<double>::const_iterator yiter = yvalues.begin(); -
src/UIElements/Views/Qt4/QtMoleculeList.cpp
r7f1b51 rb73545 128 128 formula.push_back((*iter)->getFormula()); 129 129 groupItem = new QTreeWidgetItem(this); 130 groupItem->setText(0, QString( "default"));131 groupItem->setText(1, QString::number( 0));132 groupItem->setText(2, QString( ""));130 groupItem->setText(0, QString((*iter)->getName().c_str())); 131 groupItem->setText(1, QString::number((*iter)->getAtomCount())); 132 groupItem->setText(2, QString((*iter)->getFormula().toString().c_str())); 133 133 groupItem->setText(3, "0"); 134 134 groupItem->setData(0, Qt::UserRole, QVariant(-1)); -
src/UIElements/Views/Qt4/QtToolBar.cpp
r7f1b51 rb73545 44 44 QToolBar(_parent) 45 45 { 46 addActionItem("undo", "undo the last Action", "edit-undo");47 addActionItem("redo", "redo the last Action", "edit-redo");46 addActionItem("undo", "undo", "edit-undo"); 47 addActionItem("redo", "redo", "edit-redo"); 48 48 } 49 49 … … 57 57 { 58 58 QAction *action = addAction(QString(description.c_str())); 59 action->setIcon(FavActions.getIcon(token, icon_name)); 60 action->setToolTip(QString(description.c_str())); 59 action->setIcon(QIcon::fromTheme(QString(icon_name.c_str()))); 61 60 QtMenuPipe *pipe = new QtMenuPipe(token,action); 62 61 QObject::connect(action, SIGNAL(triggered()),pipe,SLOT(called())); 63 62 plumbing.push_back(pipe); 64 present_actions.insert( token );65 63 } 66 67 void QtToolBar::addFavoriteActionItems(const unsigned int _max)68 {69 // separate favorite actions70 addSeparator();71 FavActions.addToolBarActions(*this, _max);72 }73 -
src/UIElements/Views/Qt4/QtToolBar.hpp
r7f1b51 rb73545 20 20 #include "Menu/Qt4/QtMenuPipe.hpp" 21 21 22 #include <map>23 #include <set>24 #include <string>25 26 #include "CodePatterns/Observer/Observer.hpp"27 28 22 29 23 class QtToolBar : public QToolBar … … 34 28 virtual ~QtToolBar(); 35 29 36 /** Adds an action named \a token to the toolbar.37 *38 * @param token token of Action39 * @param description description to appear as tooltip40 * @param icon_name name of icon41 */42 void addActionItem(const std::string &token, const std::string &description, const std::string &icon_name);43 44 /** Function to add a set of favorite actions.45 *46 * @param _max maximum number of actions to add47 */48 void addFavoriteActionItems(const unsigned int _max);49 50 //!> typedef for a set of action tokens51 typedef std::set<std::string> present_actions_t;52 53 /** Getter for current set of present action on this toolbar.54 *55 * @return set of action tokens56 */57 const present_actions_t & getPresentActions() const58 { return present_actions; }59 60 30 private: 61 31 std::list<QtMenuPipe*> plumbing; 62 32 63 /** This class knows about all Actions being called and stores their frequency. 64 * 65 * This is used to know about the topmost used Actions and creating placeholder 66 * toolbar icons for these on program launch. 67 * 68 */ 69 class QtFavoriteActions : public Observer 70 { 71 public: 72 QtFavoriteActions(); 73 ~QtFavoriteActions(); 33 void addActionItem(const std::string &token, const std::string &description, const std::string &icon_name); 74 34 75 void addToolBarActions(76 QtToolBar &_toolbar,77 const unsigned int _max) const;78 79 void update(Observable *publisher);80 void subjectKilled(Observable *publisher);81 void recieveNotification(Observable *publisher, Notification_ptr notification);82 83 QIcon getIcon(84 const std::string &_token,85 const std::string &_icon_name86 ) const;87 88 private:89 QIcon createIconPlaceholder(90 const std::string &_token91 ) const;92 93 private:94 //!> typedef for the action counts95 typedef std::map<std::string, unsigned int> ActionCounts_t;96 //!> map counts how often each action has been called97 ActionCounts_t ActionCounts;98 //!> sign in to ActionQueue?99 bool ActionQueue_observing;100 };101 102 //!> instance dealing with favorite action icons103 QtFavoriteActions FavActions;104 105 //!> set of already present action icons106 present_actions_t present_actions;107 35 }; 108 36 -
src/World.cpp
r7f1b51 rb73545 194 194 } 195 195 196 bool areBondsPresent(const unsigned int _step)197 {198 bool status = false;199 200 for (World::AtomConstIterator iter = const_cast<const World &>(World::getInstance()).getAtomIter();201 (!status) && (iter != const_cast<const World &>(World::getInstance()).atomEnd()); ++iter) {202 const atom * const Walker = *iter;203 status |= !Walker->getListOfBondsAtStep(_step).empty();204 }205 206 return status;207 }208 209 void copyBondgraph(const unsigned int _srcstep, const unsigned int _deststep)210 {211 // gather all bonds from _srcstep212 std::set<bond *> SetOfBonds;213 for (World::AtomConstIterator iter = const_cast<const World &>(World::getInstance()).getAtomIter();214 iter != const_cast<const World &>(World::getInstance()).atomEnd(); ++iter) {215 const atom * const Walker = *iter;216 const BondList bonds = Walker->getListOfBondsAtStep(_srcstep);217 BOOST_FOREACH( bond::ptr bondptr, bonds) {218 SetOfBonds.insert(bondptr.get());219 }220 }221 LOG(4, "DEBUG: We gathered " << SetOfBonds.size() << " bonds in total.");222 223 // copy bond to new time step224 for (std::set<bond *>::const_iterator bonditer = SetOfBonds.begin();225 bonditer != SetOfBonds.end(); ++bonditer) {226 const atom * const Walker = (*bonditer)->leftatom;227 const atom * const OtherWalker = (*bonditer)->rightatom;228 const_cast<atom *>(Walker)->addBond(_deststep, const_cast<atom *>(OtherWalker));229 }230 }231 232 196 void World::setTime(const unsigned int _step) 233 197 { 234 198 if (_step != WorldTime::getTime()) { 235 const unsigned int oldstep = WorldTime::getTime();236 199 // set new time 237 200 WorldTime::getInstance().setTime(_step); … … 244 207 destroyMolecule(*iter); 245 208 } 246 // 2. copy bond graph 247 if (!areBondsPresent(_step)) { 248 // AtomComposite Set = getAllAtoms(); 249 // BG->cleanAdjacencyList(Set); 250 copyBondgraph(oldstep, _step); 251 } 209 // 2. (re-)create bondgraph 210 AtomComposite Set = getAllAtoms(); 211 BG->CreateAdjacency(Set); 252 212 253 213 // 3. scan for connected subgraphs => molecules -
tests/Python/AllActions/options.dat
r7f1b51 rb73545 91 91 interpolation-degree "5" 92 92 interpolation-steps "9" 93 keep-bondgraph "1"94 93 keep-fixed-CenterOfMass "0" 95 94 load "test.data" -
tests/regression/Options/Warranty/testsuite-options-warranty.at
r7f1b51 rb73545 21 21 AT_KEYWORDS([options warranty]) 22 22 AT_CHECK([../../molecuilder --warranty], 0, [stdout], [ignore]) 23 AT_CHECK([fgrep "statement concerning warranty" stdout], 0, [ignore], [ignore]) 23 24 AT_CHECK([fgrep "WITHOUT ANY WARRANTY" stdout], 0, [ignore], [ignore]) 24 25 AT_CLEANUP
Note:
See TracChangeset
for help on using the changeset viewer.