Ignore:
Timestamp:
May 8, 2017, 1:54:50 PM (8 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
ForceAnnealing_goodresults, ForceAnnealing_tocheck
Children:
d7bd62
Parents:
a443e1
git-author:
Frederik Heber <heber@…> (03/30/17 21:59:00)
git-committer:
Frederik Heber <frederik.heber@…> (05/08/17 13:54:50)
Message:

Vector(s) are now stored as strings in Querys intermediately.

  • they get evaluated first after being stored in a Parameter/Value on request via get().
  • Needed to change all Vector(s)..Query's of all UIs and also the general base classes inside Dialog.
  • QtQueryList need to be specialized in order to allow a QtQueryList<Vector> to actually store a vector of strings.
  • we may use setAsString() in order to set the Parameter thankfully.
  • TESTS: All regression tests on Geometry Actions are now working.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/UIElements/TextUI/Query/VectorsTextQuery.cpp

    ra443e1 rcb5231  
    4141#include "CodePatterns/Log.hpp"
    4242#include "CodePatterns/Verbose.hpp"
     43#include "Geometry/GeometryRegistry.hpp"
    4344#include "LinearAlgebra/Vector.hpp"
    4445#include "LinearAlgebra/RealSpaceMatrix.hpp"
     
    5455
    5556bool TextDialog::VectorsTextQuery::handle() {
     57  std::stringstream output;
    5658  std::cout << getDescription() << std::endl;
    5759  char coords[3] = {'x', 'y', 'z'};
    5860  const RealSpaceMatrix &M = World::getInstance().getDomain().getM();
    59   for (int i=0;i<3;i++)
    60     std::cout << coords[i] << "[0.." << M.at(i,i) << ( (i!=2) ? "], " : "]: ");
     61  std::cout << "Enter three comma-separated coordinates, vector name, ? for list or empty for end." << std::endl;
     62  while (true) {
     63    for (int i=0;i<3;i++)
     64      std::cout << coords[i] << "[0.." << M.at(i,i) << ( (i!=2) ? "], " : "]: ");
    6165
    62   std::string line;
    63   getline(std::cin,line);
     66    std::string line;
     67    getline(std::cin,line);
    6468
    65   // dissect by ","
    66   double coord = 0.;
    67   std::string::iterator olditerspace = line.begin();
    68   std::string::iterator olditercomma = line.begin();
    69   int counter = 0;
    70   Vector temp_element;
    71   for(std::string::iterator vectoriter = line.begin(); vectoriter != line.end(); ++vectoriter) {
    72     if (*vectoriter == ',')
    73       counter++;
    74     if ((*vectoriter == ' ') && (counter == 2)) {
    75       counter = 0;
    76       for(std::string::iterator componentiter = olditerspace; (componentiter != vectoriter) && (counter !=3); ++componentiter) {
    77         if (*componentiter == ',') {
    78           std::istringstream stream(std::string(componentiter, olditercomma));
    79           stream >> coord;
    80           temp_element[counter++] = coord;
    81           olditercomma = componentiter;
    82         }
     69    if (line == "?") {
     70      GeometryRegistry &reg = GeometryRegistry::getInstance();
     71
     72      GeometryRegistry::const_iterator iter;
     73      for (iter = reg.getBeginIter(); iter != reg.getEndIter(); iter ++){
     74        GeometryObject *v = iter->second;
     75        std::cout << "\t" << *v << std::endl;
    8376      }
    84       if ((olditercomma != line.begin()) && (counter != 3)) { // insert last part also
    85         std::istringstream stream(std::string(olditercomma, vectoriter));
    86         stream >> coord;
    87         temp_element[counter++] = coord;
    88       }
    89       temp.push_back(temp_element);
    90       olditerspace = vectoriter;
     77    } else if (line.empty()) {
     78      break;
     79    } else {
     80      // simply append with white-space delimiter
     81      temp.push_back(line);
    9182    }
    9283  }
Note: See TracChangeset for help on using the changeset viewer.