Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/TesselationAction/ConvexEnvelopeAction.cpp

    rf6bd32 r047878  
    66 */
    77
     8#include "Helpers/MemDebug.hpp"
     9
    810#include "Actions/TesselationAction/ConvexEnvelopeAction.hpp"
     11#include "Actions/ActionRegistry.hpp"
     12#include "boundary.hpp"
     13#include "config.hpp"
     14#include "linkedcell.hpp"
     15#include "log.hpp"
     16#include "molecule.hpp"
     17#include "verbose.hpp"
     18#include "World.hpp"
    919
    1020#include <iostream>
     
    1525#include "UIElements/UIFactory.hpp"
    1626#include "UIElements/Dialog.hpp"
    17 #include "Actions/MapOfActions.hpp"
    18 
    19 #include "atom.hpp"
    20 #include "boundary.hpp"
    21 #include "config.hpp"
    22 #include "linkedcell.hpp"
    23 #include "log.hpp"
    24 #include "molecule.hpp"
    25 #include "verbose.hpp"
    26 #include "World.hpp"
     27#include "UIElements/ValueStorage.hpp"
    2728
    2829/****** TesselationConvexEnvelopeAction *****/
     
    4950{}
    5051
     52void TesselationConvexEnvelope(std::string &filenameConvex, std::string &filenameNonConvex) {
     53  ValueStorage::getInstance().setCurrentValue("convex-file", filenameConvex);
     54  ValueStorage::getInstance().setCurrentValue("nonconvex-file", filenameConvex);
     55  ActionRegistry::getInstance().getActionByName(TesselationConvexEnvelopeAction::NAME)->call(Action::NonInteractive);
     56};
     57
     58Dialog* TesselationConvexEnvelopeAction::fillDialog(Dialog *dialog) {
     59  ASSERT(dialog,"No Dialog given when filling action dialog");
     60
     61  dialog->queryEmpty(NAME, ValueStorage::getInstance().getDescription(NAME));
     62  dialog->queryString("convex-file", ValueStorage::getInstance().getDescription("convex-file"));
     63  dialog->queryString("nonconvex-file", ValueStorage::getInstance().getDescription("nonconvex-file"));
     64
     65  return dialog;
     66}
     67
    5168Action::state_ptr TesselationConvexEnvelopeAction::performCall() {
    5269  string filenameConvex;
    5370  string filenameNonConvex;
    54   Dialog *dialog = UIFactory::getInstance().makeDialog();
    5571  molecule * mol = NULL;
    56   bool Success = false;
     72  bool Success = true;
    5773  config *configuration = World::getInstance().getConfig();
    5874
    59   dialog->queryMolecule(NAME, &mol, MapOfActions::getInstance().getDescription(NAME));
    60   dialog->queryString("convex-file", &filenameConvex, MapOfActions::getInstance().getDescription("convex-file"));
    61   dialog->queryString("nonconvex-file", &filenameNonConvex, MapOfActions::getInstance().getDescription("nonconvex-file"));
     75  ValueStorage::getInstance().queryCurrentValue("convex-file", filenameConvex);
     76  ValueStorage::getInstance().queryCurrentValue("nonconvex-file", filenameNonConvex);
    6277
    63   if(dialog->display()) {
     78  for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) {
     79    mol = iter->second;
    6480    class Tesselation *TesselStruct = NULL;
    6581    const LinkedCell *LCList = NULL;
     
    6884    DoLog(1) && (Log() << Verbose(1) << "Storing tecplot non-convex data in " << filenameNonConvex << "." << endl);
    6985    LCList = new LinkedCell(mol, 100.);
    70     //FindConvexBorder(mol, LCList, argv[argptr]);
     86    Boundaries *BoundaryPoints = NULL;
     87    //FindConvexBorder(mol, BoundaryPoints, TesselStruct, LCList, argv[argptr]);
    7188    // TODO: Beide Funktionen sollten streams anstelle des Filenamen benutzen, besser fuer unit tests
    7289    FindNonConvexBorder(mol, TesselStruct, LCList, 50., filenameNonConvex.c_str());
     
    7895    delete(TesselStruct);
    7996    delete(LCList);
    80     delete dialog;
    81     if (Success)
    82       return Action::success;
    83     else
    84       return Action::failure;
    8597  }
    86   delete dialog;
    87   return Action::failure;
     98  if (Success)
     99    return Action::success;
     100  else
     101    return Action::failure;
    88102}
    89103
Note: See TracChangeset for help on using the changeset viewer.