Changes in src/Actions/MapOfActions.cpp [83f176:446bc1]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MapOfActions.cpp
r83f176 r446bc1 1 /*2 * Project: MoleCuilder3 * Description: creates and alters molecular systems4 * Copyright (C) 2010 University of Bonn. All rights reserved.5 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.6 */7 8 1 /* 9 2 * MapOfActions.cpp … … 12 5 * Author: heber 13 6 */ 14 15 // include config.h16 #ifdef HAVE_CONFIG_H17 #include <config.h>18 #endif19 7 20 8 #include "Helpers/MemDebug.hpp" … … 79 67 #include "Actions/ParserAction/SaveXyzAction.hpp" 80 68 #include "Actions/SelectionAction/AllAtomsAction.hpp" 81 #include "Actions/SelectionAction/AllAtomsInsideCuboidAction.hpp"82 #include "Actions/SelectionAction/AllAtomsInsideSphereAction.hpp"83 69 #include "Actions/SelectionAction/AllAtomsOfMoleculeAction.hpp" 84 70 #include "Actions/SelectionAction/AllMoleculesAction.hpp" 85 #include "Actions/SelectionAction/AtomByElementAction.hpp"86 71 #include "Actions/SelectionAction/AtomByIdAction.hpp" 87 72 #include "Actions/SelectionAction/ClearAllAtomsAction.hpp" 88 73 #include "Actions/SelectionAction/ClearAllMoleculesAction.hpp" 89 #include "Actions/SelectionAction/MoleculeByFormulaAction.hpp"90 74 #include "Actions/SelectionAction/MoleculeByIdAction.hpp" 91 75 #include "Actions/SelectionAction/MoleculeOfAtomAction.hpp" 92 76 #include "Actions/SelectionAction/NotAllAtomsAction.hpp" 93 #include "Actions/SelectionAction/NotAllAtomsInsideCuboidAction.hpp"94 #include "Actions/SelectionAction/NotAllAtomsInsideSphereAction.hpp"95 77 #include "Actions/SelectionAction/NotAllAtomsOfMoleculeAction.hpp" 96 78 #include "Actions/SelectionAction/NotAllMoleculesAction.hpp" 97 #include "Actions/SelectionAction/NotAtomByElementAction.hpp"98 79 #include "Actions/SelectionAction/NotAtomByIdAction.hpp" 99 #include "Actions/SelectionAction/NotMoleculeByFormulaAction.hpp"100 80 #include "Actions/SelectionAction/NotMoleculeByIdAction.hpp" 101 81 #include "Actions/SelectionAction/NotMoleculeOfAtomAction.hpp" … … 109 89 #include "Actions/WorldAction/InputAction.hpp" 110 90 #include "Actions/WorldAction/OutputAction.hpp" 91 #include "Actions/WorldAction/RemoveSphereOfAtomsAction.hpp" 111 92 #include "Actions/WorldAction/RepeatBoxAction.hpp" 112 93 #include "Actions/WorldAction/ScaleBoxAction.hpp" … … 231 212 DescriptionMap["redo"] = "redo last action"; 232 213 DescriptionMap["remove-atom"] = "remove a specified atom"; 214 DescriptionMap["remove-sphere"] = "remove sphere of atoms of around a specified atom"; 233 215 DescriptionMap["repeat-box"] = "create periodic copies of the simulation box per axis"; 234 216 DescriptionMap["rotate-origin"] = "rotate selected atoms by a specific angle around origin"; … … 242 224 DescriptionMap["select-all-atoms"] = "select all atoms"; 243 225 DescriptionMap["select-all-molecules"] = "select all molecules"; 244 DescriptionMap["select-atom-by-element"] = "select an atom by element";245 226 DescriptionMap["select-atom-by-id"] = "select an atom by index"; 246 DescriptionMap["select-atoms-inside-cuboid"] = "select all atoms inside a cuboid";247 DescriptionMap["select-atoms-inside-sphere"] = "select all atoms inside a sphere";248 227 DescriptionMap["select-molecule-by-id"] = "select a molecule by index"; 249 DescriptionMap["select-molecule-by-formula"] = "select a molecule by chemical formula";250 228 DescriptionMap["select-molecule-of-atom"] = "select a molecule to which a given atom belongs"; 251 229 DescriptionMap["select-molecules-atoms"] = "select all atoms of a molecule"; … … 259 237 DescriptionMap["unselect-all-atoms"] = "unselect all atoms"; 260 238 DescriptionMap["unselect-all-molecules"] = "unselect all molecules"; 261 DescriptionMap["unselect-atom-by-element"] = "unselect an atom by element";262 239 DescriptionMap["unselect-atom-by-id"] = "unselect an atom by index"; 263 DescriptionMap["unselect-atoms-inside-cuboid"] = "unselect all atoms inside a cuboid";264 DescriptionMap["unselect-atoms-inside-sphere"] = "unselect all atoms inside a sphere";265 DescriptionMap["unselect-molecule-by-formula"] = "unselect a molecule by chemical formula";266 240 DescriptionMap["unselect-molecule-by-id"] = "unselect a molecule by index"; 267 241 DescriptionMap["unselect-molecule-of-atom"] = "unselect a molecule to which a given atom belongs"; … … 271 245 DescriptionMap["version"] = "show version"; 272 246 // keys for values 273 DescriptionMap["angle-x"] = "angle of a rotation around x axis";274 DescriptionMap["angle-y"] = "angle of a rotation around y axis";275 DescriptionMap["angle-z"] = "angle of a rotation around z axis";276 247 DescriptionMap["bin-output-file"] = "name of the bin output file"; 277 248 DescriptionMap["bin-end"] = "start of the last bin"; … … 322 293 ShortFormMap["parse-xyz"] = "p"; 323 294 ShortFormMap["remove-atom"] = "r"; 295 ShortFormMap["remove-sphere"] = "R"; 324 296 ShortFormMap["repeat-box"] = "d"; 325 297 ShortFormMap["rotate-to-pas"] = "m"; … … 338 310 339 311 // value types for the actions 340 TypeMap["add-atom"] = &typeid( constelement);312 TypeMap["add-atom"] = &typeid(element); 341 313 TypeMap["bond-file"] = &typeid(std::string); 342 314 TypeMap["bond-table"] = &typeid(std::string); … … 344 316 TypeMap["center-in-box"] = &typeid(BoxValue); 345 317 TypeMap["change-box"] = &typeid(BoxValue); 346 TypeMap["change-element"] = &typeid( constelement);318 TypeMap["change-element"] = &typeid(element); 347 319 TypeMap["change-molname"] = &typeid(std::string); 348 320 TypeMap["clear-atom-selection"] = &typeid(void); … … 366 338 TypeMap["redo"] = &typeid(void); 367 339 TypeMap["remove-atom"] = &typeid(void); 340 TypeMap["remove-sphere"] = &typeid(double); 368 341 TypeMap["repeat-box"] = &typeid(VectorValue); 369 342 TypeMap["rotate-origin"] = &typeid(double); … … 376 349 TypeMap["select-all-atoms"] = &typeid(void); 377 350 TypeMap["select-all-molecules"] = &typeid(void); 378 TypeMap["select-atom-by-element"] = &typeid(const element);379 351 TypeMap["select-atom-by-id"] = &typeid(atom); 380 TypeMap["select-atoms-inside-cuboid"] = &typeid(VectorValue);381 TypeMap["select-atoms-inside-sphere"] = &typeid(double);382 TypeMap["select-molecule-by-formula"] = &typeid(std::string);383 352 TypeMap["select-molecule-by-id"] = &typeid(molecule); 384 353 TypeMap["select-molecule-of-atom"] = &typeid(atom); … … 393 362 TypeMap["unselect-all-atoms"] = &typeid(void); 394 363 TypeMap["unselect-all-molecules"] = &typeid(void); 395 TypeMap["unselect-atom-by-element"] = &typeid(const element);396 364 TypeMap["unselect-atom-by-id"] = &typeid(atom); 397 TypeMap["unselect-atoms-inside-cuboid"] = &typeid(VectorValue);398 TypeMap["unselect-atoms-inside-sphere"] = &typeid(double);399 TypeMap["unselect-molecule-by-formula"] = &typeid(std::string);400 365 TypeMap["unselect-molecule-by-id"] = &typeid(molecule); 401 366 TypeMap["unselect-molecule-of-atom"] = &typeid(atom); … … 405 370 406 371 // value types for the values 407 TypeMap["angle-x"] = &typeid(double);408 TypeMap["angle-y"] = &typeid(double);409 TypeMap["angle-z"] = &typeid(double);410 372 TypeMap["bin-output-file"] = &typeid(std::string); 411 373 TypeMap["bin-end"] = &typeid(double); … … 416 378 TypeMap["distances"] = &typeid(VectorValue); 417 379 TypeMap["DoRotate"] = &typeid(bool); 418 TypeMap["element"] = &typeid( constelement);419 TypeMap["elements"] = &typeid(std::vector< constelement *>);380 TypeMap["element"] = &typeid(element); 381 TypeMap["elements"] = &typeid(std::vector<element *>); 420 382 TypeMap["end-step"] = &typeid(int); 421 383 TypeMap["id-mapping"] = &typeid(bool); … … 446 408 TypeEnumMap[&typeid(atom)] = Atom; 447 409 TypeEnumMap[&typeid(std::vector<atom *>)] = ListOfAtoms; 448 TypeEnumMap[&typeid( constelement)] = Element;449 TypeEnumMap[&typeid(std::vector< constelement *>)] = ListOfElements;410 TypeEnumMap[&typeid(element)] = Element; 411 TypeEnumMap[&typeid(std::vector<element *>)] = ListOfElements; 450 412 451 413 // default values for any action that needs one (always string!) … … 506 468 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-all-atoms") ); 507 469 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-all-molecules") ); 508 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-atom-by-element") );509 470 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-atom-by-id") ); 510 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-atoms-inside-cuboid") );511 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-atoms-inside-sphere") );512 471 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-molecule-by-id") ); 513 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-molecule-by-formula") );514 472 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-molecule-of-atom") ); 515 473 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "select-molecules-atoms") ); 516 474 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-all-atoms") ); 517 475 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-all-molecules") ); 518 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-atom-by-element") );519 476 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-atom-by-id") ); 520 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-atoms-inside-cuboid") );521 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-atoms-inside-sphere") );522 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-molecule-by-formula") );523 477 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-molecule-by-id") ); 524 478 MenuContainsActionMap.insert( pair<std::string, std::string> ("selection", "unselect-molecule-of-atom") ); … … 535 489 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "input") ); 536 490 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "output") ); 491 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "remove-sphere") ); 537 492 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "repeat-box") ); 538 493 MenuContainsActionMap.insert( pair<std::string, std::string> ("world", "scale-box") ); … … 573 528 generic.insert("redo"); 574 529 generic.insert("remove-atom"); 530 generic.insert("remove-sphere"); 575 531 generic.insert("repeat-box"); 576 532 generic.insert("rotate-origin"); … … 583 539 generic.insert("select-all-atoms"); 584 540 generic.insert("select-all-molecules"); 585 generic.insert("select-atom-by-element");586 541 generic.insert("select-atom-by-id"); 587 generic.insert("select-atoms-inside-cuboid");588 generic.insert("select-atoms-inside-sphere");589 542 generic.insert("select-molecule-by-id"); 590 generic.insert("select-molecule-by-formula");591 543 generic.insert("select-molecule-of-atom"); 592 544 generic.insert("select-molecules-atoms"); … … 600 552 generic.insert("unselect-all-atoms"); 601 553 generic.insert("unselect-all-molecules"); 602 generic.insert("unselect-atom-by-element");603 554 generic.insert("unselect-atom-by-id"); 604 generic.insert("unselect-atoms-inside-cuboid");605 generic.insert("unselect-atoms-inside-sphere");606 generic.insert("unselect-molecule-by-formula");607 555 generic.insert("unselect-molecule-by-id"); 608 556 generic.insert("unselect-molecule-of-atom"); … … 616 564 617 565 // hidden arguments 618 hidden.insert("angle-x");619 hidden.insert("angle-y");620 hidden.insert("angle-z");621 566 hidden.insert("bin-end"); 622 567 hidden.insert("bin-output-file"); … … 650 595 } 651 596 652 bool MapOfActions::isCurrentValuePresent(const char *name) const653 {654 return (CurrentValue.find(name) != CurrentValue.end());655 }656 657 597 void MapOfActions::queryCurrentValue(const char * name, class atom * &_T) 658 598 { … … 668 608 } 669 609 670 void MapOfActions::queryCurrentValue(const char * name, c onstelement * &_T) {610 void MapOfActions::queryCurrentValue(const char * name, class element * &_T) { 671 611 int Z = -1; 672 if (typeid( constelement ) == *TypeMap[name]) {612 if (typeid( element ) == *TypeMap[name]) { 673 613 if (CurrentValue.find(name) == CurrentValue.end()) 674 614 throw MissingValueException(__FILE__, __LINE__); … … 752 692 } 753 693 754 void MapOfActions::queryCurrentValue(const char * name, std::vector< constelement *>&_T)694 void MapOfActions::queryCurrentValue(const char * name, std::vector<element *>&_T) 755 695 { 756 696 int Z = -1; 757 constelement *elemental = NULL;758 if (typeid( std::vector< constelement *> ) == *TypeMap[name]) {697 element *elemental = NULL; 698 if (typeid( std::vector<element *> ) == *TypeMap[name]) { 759 699 if (CurrentValue.find(name) == CurrentValue.end()) 760 700 throw MissingValueException(__FILE__, __LINE__); … … 804 744 } 805 745 806 void MapOfActions::setCurrentValue(const char * name, c onstelement * &_T)807 { 808 if (typeid( constelement ) == *TypeMap[name]) {746 void MapOfActions::setCurrentValue(const char * name, class element * &_T) 747 { 748 if (typeid( element ) == *TypeMap[name]) { 809 749 std::ostringstream stream; 810 stream << _T-> getAtomicNumber();750 stream << _T->Z; 811 751 CurrentValue[name] = stream.str(); 812 752 } else … … 864 804 } 865 805 866 void MapOfActions::setCurrentValue(const char * name, std::vector< constelement *>&_T)867 { 868 if (typeid( std::vector< constelement *> ) == *TypeMap[name]) {806 void MapOfActions::setCurrentValue(const char * name, std::vector<element *>&_T) 807 { 808 if (typeid( std::vector<element *> ) == *TypeMap[name]) { 869 809 std::ostringstream stream; 870 for (std::vector< constelement *>::iterator iter = _T.begin(); iter != _T.end(); ++iter) {871 stream << (*iter)-> getAtomicNumber()<< " ";810 for (std::vector<element *>::iterator iter = _T.begin(); iter != _T.end(); ++iter) { 811 stream << (*iter)->Z << " "; 872 812 } 873 813 CurrentValue[name] = stream.str(); … … 933 873 new SelectionClearAllMoleculesAction(); 934 874 new SelectionAllAtomsAction(); 935 new SelectionAllAtomsInsideCuboidAction();936 new SelectionAllAtomsInsideSphereAction();937 875 new SelectionAllAtomsOfMoleculeAction(); 938 876 new SelectionAllMoleculesAction(); 939 new SelectionAtomByElementAction();940 877 new SelectionAtomByIdAction(); 941 878 new SelectionMoleculeByIdAction(); 942 new SelectionMoleculeByFormulaAction();943 879 new SelectionMoleculeOfAtomAction(); 944 880 new SelectionNotAllAtomsAction(); 945 new SelectionNotAllAtomsInsideCuboidAction();946 new SelectionNotAllAtomsInsideSphereAction();947 881 new SelectionNotAllAtomsOfMoleculeAction(); 948 882 new SelectionNotAllMoleculesAction(); 949 new SelectionNotAtomByElementAction();950 883 new SelectionNotAtomByIdAction(); 951 new SelectionNotMoleculeByFormulaAction();952 884 new SelectionNotMoleculeByIdAction(); 953 885 new SelectionNotMoleculeOfAtomAction(); … … 963 895 new WorldInputAction(); 964 896 new WorldOutputAction(); 897 new WorldRemoveSphereOfAtomsAction(); 965 898 new WorldRepeatBoxAction(); 966 899 new WorldScaleBoxAction();
Note:
See TracChangeset
for help on using the changeset viewer.