Index: src/Actions/AnalysisAction/PairCorrelationAction.cpp
===================================================================
--- src/Actions/AnalysisAction/PairCorrelationAction.cpp	(revision 0c9cc3712a5c382c45c76450228053bec2bc4637)
+++ src/Actions/AnalysisAction/PairCorrelationAction.cpp	(revision d02e07dab3e4ea3de415734aa0c09a9055b903bf)
@@ -38,6 +38,33 @@
 {}
 
+Dialog* AnalysisPairCorrelationAction::createDialog() {
+  Dialog *dialog = UIFactory::getInstance().makeDialog();
+  int ranges[3] = {1, 1, 1};
+  double BinEnd = 0.;
+  double BinStart = 0.;
+  double BinWidth = 0.;
+  molecule *Boundary = NULL;
+  string outputname;
+  string binoutputname;
+  bool periodic;
+  ofstream output;
+  ofstream binoutput;
+  std::vector< element *> elements;
+  string type;
+  Vector Point;
+  BinPairMap *binmap = NULL;
+
+  dialog->queryElement("elements", &elements, MapOfActions::getInstance().getDescription("elements"));
+  dialog->queryDouble("bin-start", &BinStart, MapOfActions::getInstance().getDescription("bin-start"));
+  dialog->queryDouble("bin-width", &BinWidth, MapOfActions::getInstance().getDescription("bin-width"));
+  dialog->queryDouble("bin-end", &BinEnd, MapOfActions::getInstance().getDescription("bin-end"));
+  dialog->queryString("output-file", &outputname, MapOfActions::getInstance().getDescription("output-file"));
+  dialog->queryString("bin-output-file", &binoutputname, MapOfActions::getInstance().getDescription("bin-output-file"));
+  dialog->queryBoolean("periodic", &periodic, MapOfActions::getInstance().getDescription("periodic"));
+
+  return dialog;
+}
+
 Action::state_ptr AnalysisPairCorrelationAction::performCall() {
-  Dialog *dialog = UIFactory::getInstance().makeDialog();
   int ranges[3] = {1, 1, 1};
   double BinEnd = 0.;
@@ -56,135 +83,45 @@
   MoleculeListClass *molecules = World::getInstance().getMolecules();
 
-  // first dialog: Obtain which type of correlation
-  dialog->queryString(NAME, &type, MapOfActions::getInstance().getDescription(NAME));
-  if(dialog->display()) {
-    delete dialog;
-  } else {
-    delete dialog;
-    return Action::failure;
-  }
+  // obtain information
+  MapOfActions::getInstance().queryCurrentValue("elements", elements);
+  MapOfActions::getInstance().queryCurrentValue("bin-start", BinStart);
+  MapOfActions::getInstance().queryCurrentValue("bin-width", BinWidth);
+  MapOfActions::getInstance().queryCurrentValue("bin-end", BinEnd);
+  MapOfActions::getInstance().queryCurrentValue("output-file", outputname);
+  MapOfActions::getInstance().queryCurrentValue("bin-output-file", binoutputname);
+  MapOfActions::getInstance().queryCurrentValue("periodic", periodic);
 
-  // second dialog: Obtain parameters specific to this type
-  dialog = UIFactory::getInstance().makeDialog();
-  if (type == "P")
-    dialog->queryVector("position", &Point, false, MapOfActions::getInstance().getDescription("position"));
-  if (type == "S")
-    dialog->queryMolecule("molecule-by-id", &Boundary, MapOfActions::getInstance().getDescription("molecule-by-id"));
-  dialog->queryElement("elements", &elements, MapOfActions::getInstance().getDescription("elements"));
-  dialog->queryDouble("bin-start", &BinStart, MapOfActions::getInstance().getDescription("bin-start"));
-  dialog->queryDouble("bin-width", &BinWidth, MapOfActions::getInstance().getDescription("bin-width"));
-  dialog->queryDouble("bin-end", &BinEnd, MapOfActions::getInstance().getDescription("bin-end"));
-  dialog->queryString("output-file", &outputname, MapOfActions::getInstance().getDescription("output-file"));
-  dialog->queryString("bin-output-file", &binoutputname, MapOfActions::getInstance().getDescription("bin-output-file"));
-  dialog->queryBoolean("periodic", &periodic, MapOfActions::getInstance().getDescription("periodic"));
-
-  if(dialog->display()) {
-    output.open(outputname.c_str());
-    binoutput.open(binoutputname.c_str());
-    if (type == "E") {
-      PairCorrelationMap *correlationmap = NULL;
-      if (periodic)
-        correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elements, ranges);
-      else
-        correlationmap = PairCorrelation(World::getInstance().getMolecules(), elements);
-      OutputPairCorrelation(&output, correlationmap);
-      binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd );
-      OutputCorrelation ( &binoutput, binmap );
-      delete(binmap);
-      delete(correlationmap);
-    } else if (type == "P")  {
-      cout << "Point to correlate to is  " << Point << endl;
-      CorrelationToPointMap *correlationmap = NULL;
-      if (periodic)
-        correlationmap  = PeriodicCorrelationToPoint(molecules, elements, &Point, ranges);
-      else
-        correlationmap = CorrelationToPoint(molecules, elements, &Point);
-      OutputCorrelationToPoint(&output, correlationmap);
-      binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd );
-      OutputCorrelation ( &binoutput, binmap );
-      delete(binmap);
-      delete(correlationmap);
-    } else if (type == "S") {
-      ASSERT(Boundary != NULL, "No molecule specified for SurfaceCorrelation.");
-      const double radius = 4.;
-      double LCWidth = 20.;
-      if (BinEnd > 0) {
-        if (BinEnd > 2.*radius)
-          LCWidth = BinEnd;
-        else
-          LCWidth = 2.*radius;
-      }
-
-      // get the boundary
-      class Tesselation *TesselStruct = NULL;
-      const LinkedCell *LCList = NULL;
-      // find biggest molecule
-      int counter  = molecules->ListOfMolecules.size();
-      bool *Actives = new bool[counter];
-      counter = 0;
-      for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
-        Actives[counter++] = (*BigFinder)->ActiveFlag;
-        (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;
-      }
-      LCList = new LinkedCell(Boundary, LCWidth);
-      FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
-      CorrelationToSurfaceMap *surfacemap = NULL;
-      if (periodic)
-        surfacemap = PeriodicCorrelationToSurface( molecules, elements, TesselStruct, LCList, ranges);
-      else
-        surfacemap = CorrelationToSurface( molecules, elements, TesselStruct, LCList);
-      delete LCList;
-      OutputCorrelationToSurface(&output, surfacemap);
-      // re-set ActiveFlag
-      counter = 0;
-      for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
-        (*BigFinder)->ActiveFlag = Actives[counter++];
-      }
-      delete[] Actives;
-      // check whether radius was appropriate
-      {
-        double start; double end;
-        GetMinMax( surfacemap, start, end);
-        if (LCWidth < end)
-          DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell width is smaller than the found range of values! Bins can only be correct up to: " << radius << "." << endl);
-      }
-      binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd );
-      OutputCorrelation ( &binoutput, binmap );
-      delete TesselStruct;  // surfacemap contains refs to triangles! delete here, not earlier!
-      delete(binmap);
-      delete(surfacemap);
-    } else {
-      return Action::failure;
-    }
-    output.close();
-    binoutput.close();
-    delete dialog;
-    return Action::success;
-  } else {
-    delete dialog;
-    return Action::failure;
-  }
+  // execute action
+  output.open(outputname.c_str());
+  binoutput.open(binoutputname.c_str());
+  PairCorrelationMap *correlationmap = NULL;
+  if (periodic)
+    correlationmap = PeriodicPairCorrelation(World::getInstance().getMolecules(), elements, ranges);
+  else
+    correlationmap = PairCorrelation(World::getInstance().getMolecules(), elements);
+  OutputPairCorrelation(&output, correlationmap);
+  binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd );
+  OutputCorrelation ( &binoutput, binmap );
+  delete(binmap);
+  delete(correlationmap);
+  output.close();
+  binoutput.close();
+  return Action::success;
 }
 
 Action::state_ptr AnalysisPairCorrelationAction::performUndo(Action::state_ptr _state) {
-//  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
-
-  return Action::failure;
-//  string newName = state->mol->getName();
-//  state->mol->setName(state->lastName);
-//
-//  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
+  return Action::success;
 }
 
 Action::state_ptr AnalysisPairCorrelationAction::performRedo(Action::state_ptr _state){
-  return Action::failure;
+  return Action::success;
 }
 
 bool AnalysisPairCorrelationAction::canUndo() {
-  return false;
+  return true;
 }
 
 bool AnalysisPairCorrelationAction::shouldUndo() {
-  return false;
+  return true;
 }
 
Index: src/Actions/AnalysisAction/PairCorrelationAction.hpp
===================================================================
--- src/Actions/AnalysisAction/PairCorrelationAction.hpp	(revision 0c9cc3712a5c382c45c76450228053bec2bc4637)
+++ src/Actions/AnalysisAction/PairCorrelationAction.hpp	(revision d02e07dab3e4ea3de415734aa0c09a9055b903bf)
@@ -21,4 +21,5 @@
   virtual const std::string getName();
 private:
+  virtual Dialog * createDialog();
   virtual Action::state_ptr performCall();
   virtual Action::state_ptr performUndo(Action::state_ptr);
Index: src/Actions/AnalysisAction/PointCorrelationAction.cpp
===================================================================
--- src/Actions/AnalysisAction/PointCorrelationAction.cpp	(revision d02e07dab3e4ea3de415734aa0c09a9055b903bf)
+++ src/Actions/AnalysisAction/PointCorrelationAction.cpp	(revision d02e07dab3e4ea3de415734aa0c09a9055b903bf)
@@ -0,0 +1,133 @@
+/*
+ * PointCorrelationAction.cpp
+ *
+ *  Created on: May 9, 2010
+ *      Author: heber
+ */
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/AnalysisAction/PointCorrelationAction.hpp"
+#include "analysis_correlation.hpp"
+#include "boundary.hpp"
+#include "linkedcell.hpp"
+#include "verbose.hpp"
+#include "log.hpp"
+#include "element.hpp"
+#include "molecule.hpp"
+#include "periodentafel.hpp"
+#include "vector.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "UIElements/UIFactory.hpp"
+#include "UIElements/Dialog.hpp"
+#include "Actions/MapOfActions.hpp"
+
+const char AnalysisPointCorrelationAction::NAME[] = "point-correlation";
+
+AnalysisPointCorrelationAction::AnalysisPointCorrelationAction() :
+  Action(NAME)
+{}
+
+AnalysisPointCorrelationAction::~AnalysisPointCorrelationAction()
+{}
+
+Dialog* AnalysisPointCorrelationAction::createDialog() {
+  Dialog *dialog = UIFactory::getInstance().makeDialog();
+  int ranges[3] = {1, 1, 1};
+  double BinEnd = 0.;
+  double BinStart = 0.;
+  double BinWidth = 0.;
+  molecule *Boundary = NULL;
+  string outputname;
+  string binoutputname;
+  bool periodic;
+  ofstream output;
+  ofstream binoutput;
+  std::vector< element *> elements;
+  string type;
+  Vector Point;
+  BinPairMap *binmap = NULL;
+
+  dialog->queryVector("position", &Point, false, MapOfActions::getInstance().getDescription("position"));
+  dialog->queryElement("elements", &elements, MapOfActions::getInstance().getDescription("elements"));
+  dialog->queryDouble("bin-start", &BinStart, MapOfActions::getInstance().getDescription("bin-start"));
+  dialog->queryDouble("bin-width", &BinWidth, MapOfActions::getInstance().getDescription("bin-width"));
+  dialog->queryDouble("bin-end", &BinEnd, MapOfActions::getInstance().getDescription("bin-end"));
+  dialog->queryString("output-file", &outputname, MapOfActions::getInstance().getDescription("output-file"));
+  dialog->queryString("bin-output-file", &binoutputname, MapOfActions::getInstance().getDescription("bin-output-file"));
+  dialog->queryBoolean("periodic", &periodic, MapOfActions::getInstance().getDescription("periodic"));
+
+  return dialog;
+}
+
+Action::state_ptr AnalysisPointCorrelationAction::performCall() {
+  int ranges[3] = {1, 1, 1};
+  double BinEnd = 0.;
+  double BinStart = 0.;
+  double BinWidth = 0.;
+  molecule *Boundary = NULL;
+  string outputname;
+  string binoutputname;
+  bool periodic;
+  ofstream output;
+  ofstream binoutput;
+  std::vector< element *> elements;
+  string type;
+  Vector Point;
+  BinPairMap *binmap = NULL;
+  MoleculeListClass *molecules = World::getInstance().getMolecules();
+
+  // obtain information
+  MapOfActions::getInstance().queryCurrentValue("position", Point);
+  MapOfActions::getInstance().queryCurrentValue("elements", elements);
+  MapOfActions::getInstance().queryCurrentValue("bin-start", BinStart);
+  MapOfActions::getInstance().queryCurrentValue("bin-width", BinWidth);
+  MapOfActions::getInstance().queryCurrentValue("bin-end", BinEnd);
+  MapOfActions::getInstance().queryCurrentValue("output-file", outputname);
+  MapOfActions::getInstance().queryCurrentValue("bin-output-file", binoutputname);
+  MapOfActions::getInstance().queryCurrentValue("periodic", periodic);
+
+  // execute action
+  output.open(outputname.c_str());
+  binoutput.open(binoutputname.c_str());
+  cout << "Point to correlate to is  " << Point << endl;
+  CorrelationToPointMap *correlationmap = NULL;
+  if (periodic)
+    correlationmap  = PeriodicCorrelationToPoint(molecules, elements, &Point, ranges);
+  else
+    correlationmap = CorrelationToPoint(molecules, elements, &Point);
+  OutputCorrelationToPoint(&output, correlationmap);
+  binmap = BinData( correlationmap, BinWidth, BinStart, BinEnd );
+  OutputCorrelation ( &binoutput, binmap );
+  delete(binmap);
+  delete(correlationmap);
+  output.close();
+  binoutput.close();
+  return Action::success;
+}
+
+Action::state_ptr AnalysisPointCorrelationAction::performUndo(Action::state_ptr _state) {
+  return Action::success;
+}
+
+Action::state_ptr AnalysisPointCorrelationAction::performRedo(Action::state_ptr _state){
+  return Action::success;
+}
+
+bool AnalysisPointCorrelationAction::canUndo() {
+  return true;
+}
+
+bool AnalysisPointCorrelationAction::shouldUndo() {
+  return true;
+}
+
+const string AnalysisPointCorrelationAction::getName() {
+  return NAME;
+}
Index: src/Actions/AnalysisAction/PointCorrelationAction.hpp
===================================================================
--- src/Actions/AnalysisAction/PointCorrelationAction.hpp	(revision d02e07dab3e4ea3de415734aa0c09a9055b903bf)
+++ src/Actions/AnalysisAction/PointCorrelationAction.hpp	(revision d02e07dab3e4ea3de415734aa0c09a9055b903bf)
@@ -0,0 +1,31 @@
+/*
+ * PointCorrelationAction.hpp
+ *
+ *  Created on: May 9, 2010
+ *      Author: heber
+ */
+
+#ifndef POINTCORRELATIONACTION_HPP_
+#define POINTCORRELATIONACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class AnalysisPointCorrelationAction : public Action {
+public:
+  AnalysisPointCorrelationAction();
+  virtual ~AnalysisPointCorrelationAction();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+private:
+  virtual Dialog * createDialog();
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#endif /* POINTCORRELATIONACTION_HPP_ */
Index: src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp
===================================================================
--- src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp	(revision d02e07dab3e4ea3de415734aa0c09a9055b903bf)
+++ src/Actions/AnalysisAction/SurfaceCorrelationAction.cpp	(revision d02e07dab3e4ea3de415734aa0c09a9055b903bf)
@@ -0,0 +1,170 @@
+/*
+ * SurfaceCorrelationAction.cpp
+ *
+ *  Created on: May 9, 2010
+ *      Author: heber
+ */
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/AnalysisAction/SurfaceCorrelationAction.hpp"
+#include "analysis_correlation.hpp"
+#include "boundary.hpp"
+#include "linkedcell.hpp"
+#include "verbose.hpp"
+#include "log.hpp"
+#include "element.hpp"
+#include "molecule.hpp"
+#include "periodentafel.hpp"
+#include "vector.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "UIElements/UIFactory.hpp"
+#include "UIElements/Dialog.hpp"
+#include "Actions/MapOfActions.hpp"
+
+const char AnalysisSurfaceCorrelationAction::NAME[] = "surface-correlation";
+
+AnalysisSurfaceCorrelationAction::AnalysisSurfaceCorrelationAction() :
+  Action(NAME)
+{}
+
+AnalysisSurfaceCorrelationAction::~AnalysisSurfaceCorrelationAction()
+{}
+
+Dialog* AnalysisSurfaceCorrelationAction::createDialog() {
+  Dialog *dialog = UIFactory::getInstance().makeDialog();
+  int ranges[3] = {1, 1, 1};
+  double BinEnd = 0.;
+  double BinStart = 0.;
+  double BinWidth = 0.;
+  molecule *Boundary = NULL;
+  string outputname;
+  string binoutputname;
+  bool periodic;
+  ofstream output;
+  ofstream binoutput;
+  std::vector< element *> elements;
+  string type;
+  Vector Point;
+  BinPairMap *binmap = NULL;
+
+  dialog->queryMolecule("molecule-by-id", &Boundary, MapOfActions::getInstance().getDescription("molecule-by-id"));
+  dialog->queryElement("elements", &elements, MapOfActions::getInstance().getDescription("elements"));
+  dialog->queryDouble("bin-start", &BinStart, MapOfActions::getInstance().getDescription("bin-start"));
+  dialog->queryDouble("bin-width", &BinWidth, MapOfActions::getInstance().getDescription("bin-width"));
+  dialog->queryDouble("bin-end", &BinEnd, MapOfActions::getInstance().getDescription("bin-end"));
+  dialog->queryString("output-file", &outputname, MapOfActions::getInstance().getDescription("output-file"));
+  dialog->queryString("bin-output-file", &binoutputname, MapOfActions::getInstance().getDescription("bin-output-file"));
+  dialog->queryBoolean("periodic", &periodic, MapOfActions::getInstance().getDescription("periodic"));
+
+  return dialog;
+}
+
+Action::state_ptr AnalysisSurfaceCorrelationAction::performCall() {
+  int ranges[3] = {1, 1, 1};
+  double BinEnd = 0.;
+  double BinStart = 0.;
+  double BinWidth = 0.;
+  molecule *Boundary = NULL;
+  string outputname;
+  string binoutputname;
+  bool periodic;
+  ofstream output;
+  ofstream binoutput;
+  std::vector< element *> elements;
+  string type;
+  Vector Point;
+  BinPairMap *binmap = NULL;
+  MoleculeListClass *molecules = World::getInstance().getMolecules();
+
+  // obtain information
+  MapOfActions::getInstance().queryCurrentValue("molecule-by-id", Boundary);
+  MapOfActions::getInstance().queryCurrentValue("elements", elements);
+  MapOfActions::getInstance().queryCurrentValue("bin-start", BinStart);
+  MapOfActions::getInstance().queryCurrentValue("bin-width", BinWidth);
+  MapOfActions::getInstance().queryCurrentValue("bin-end", BinEnd);
+  MapOfActions::getInstance().queryCurrentValue("output-file", outputname);
+  MapOfActions::getInstance().queryCurrentValue("bin-output-file", binoutputname);
+  MapOfActions::getInstance().queryCurrentValue("periodic", periodic);
+
+  // execute action
+  output.open(outputname.c_str());
+  binoutput.open(binoutputname.c_str());
+  ASSERT(Boundary != NULL, "No molecule specified for SurfaceCorrelation.");
+  const double radius = 4.;
+  double LCWidth = 20.;
+  if (BinEnd > 0) {
+    if (BinEnd > 2.*radius)
+      LCWidth = BinEnd;
+    else
+      LCWidth = 2.*radius;
+  }
+
+  // get the boundary
+  class Tesselation *TesselStruct = NULL;
+  const LinkedCell *LCList = NULL;
+  // find biggest molecule
+  int counter  = molecules->ListOfMolecules.size();
+  bool *Actives = new bool[counter];
+  counter = 0;
+  for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
+    Actives[counter++] = (*BigFinder)->ActiveFlag;
+    (*BigFinder)->ActiveFlag = (*BigFinder == Boundary) ? false : true;
+  }
+  LCList = new LinkedCell(Boundary, LCWidth);
+  FindNonConvexBorder(Boundary, TesselStruct, LCList, radius, NULL);
+  CorrelationToSurfaceMap *surfacemap = NULL;
+  if (periodic)
+    surfacemap = PeriodicCorrelationToSurface( molecules, elements, TesselStruct, LCList, ranges);
+  else
+    surfacemap = CorrelationToSurface( molecules, elements, TesselStruct, LCList);
+  delete LCList;
+  OutputCorrelationToSurface(&output, surfacemap);
+  // re-set ActiveFlag
+  counter = 0;
+  for (MoleculeList::iterator BigFinder = molecules->ListOfMolecules.begin(); BigFinder != molecules->ListOfMolecules.end(); BigFinder++) {
+    (*BigFinder)->ActiveFlag = Actives[counter++];
+  }
+  delete[] Actives;
+  // check whether radius was appropriate
+  {
+    double start; double end;
+    GetMinMax( surfacemap, start, end);
+    if (LCWidth < end)
+      DoeLog(1) && (eLog()<< Verbose(1) << "Linked Cell width is smaller than the found range of values! Bins can only be correct up to: " << radius << "." << endl);
+  }
+  binmap = BinData( surfacemap, BinWidth, BinStart, BinEnd );
+  OutputCorrelation ( &binoutput, binmap );
+  delete TesselStruct;  // surfacemap contains refs to triangles! delete here, not earlier!
+  delete(binmap);
+  delete(surfacemap);
+  output.close();
+  binoutput.close();
+  return Action::success;
+}
+
+Action::state_ptr AnalysisSurfaceCorrelationAction::performUndo(Action::state_ptr _state) {
+  return Action::success;
+}
+
+Action::state_ptr AnalysisSurfaceCorrelationAction::performRedo(Action::state_ptr _state){
+  return Action::success;
+}
+
+bool AnalysisSurfaceCorrelationAction::canUndo() {
+  return true;
+}
+
+bool AnalysisSurfaceCorrelationAction::shouldUndo() {
+  return true;
+}
+
+const string AnalysisSurfaceCorrelationAction::getName() {
+  return NAME;
+}
Index: src/Actions/AnalysisAction/SurfaceCorrelationAction.hpp
===================================================================
--- src/Actions/AnalysisAction/SurfaceCorrelationAction.hpp	(revision d02e07dab3e4ea3de415734aa0c09a9055b903bf)
+++ src/Actions/AnalysisAction/SurfaceCorrelationAction.hpp	(revision d02e07dab3e4ea3de415734aa0c09a9055b903bf)
@@ -0,0 +1,31 @@
+/*
+ * SurfaceCorrelationAction.hpp
+ *
+ *  Created on: May 9, 2010
+ *      Author: heber
+ */
+
+#ifndef SURFACECORRELATIONACTION_HPP_
+#define SURFACECORRELATIONACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class AnalysisSurfaceCorrelationAction : public Action {
+public:
+  AnalysisSurfaceCorrelationAction();
+  virtual ~AnalysisSurfaceCorrelationAction();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+private:
+  virtual Dialog * createDialog();
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#endif /* SURFACECORRELATIONACTION_HPP_ */
Index: src/Actions/Makefile.am
===================================================================
--- src/Actions/Makefile.am	(revision 0c9cc3712a5c382c45c76450228053bec2bc4637)
+++ src/Actions/Makefile.am	(revision d02e07dab3e4ea3de415734aa0c09a9055b903bf)
@@ -36,9 +36,13 @@
   AnalysisAction/MolecularVolumeAction.cpp \
   AnalysisAction/PairCorrelationAction.cpp \
-  AnalysisAction/PrincipalAxisSystemAction.cpp
+  AnalysisAction/PointCorrelationAction.cpp \
+  AnalysisAction/PrincipalAxisSystemAction.cpp \
+  AnalysisAction/SurfaceCorrelationAction.cpp
 ANALYSISACTIONHEADER = \
   AnalysisAction/MolecularVolumeAction.hpp \
   AnalysisAction/PairCorrelationAction.hpp \
-  AnalysisAction/PrincipalAxisSystemAction.hpp
+  AnalysisAction/PointCorrelationAction.hpp \
+  AnalysisAction/PrincipalAxisSystemAction.hpp \
+  AnalysisAction/SurfaceCorrelationAction.hpp
 
 ATOMACTIONSOURCE = \
Index: src/Actions/MapOfActions.cpp
===================================================================
--- src/Actions/MapOfActions.cpp	(revision 0c9cc3712a5c382c45c76450228053bec2bc4637)
+++ src/Actions/MapOfActions.cpp	(revision d02e07dab3e4ea3de415734aa0c09a9055b903bf)
@@ -10,6 +10,8 @@
 using namespace std;
 
+#include "Actions/MapOfActions.hpp"
+#include "Descriptors/AtomIdDescriptor.hpp"
+#include "Descriptors/MoleculeIdDescriptor.hpp"
 #include "Patterns/Singleton_impl.hpp"
-#include "Actions/MapOfActions.hpp"
 #include "Helpers/Assert.hpp"
 
@@ -21,8 +23,12 @@
 
 #include "atom.hpp"
+#include "Box.hpp"
 #include "CommandLineParser.hpp"
 #include "element.hpp"
 #include "log.hpp"
+#include "Matrix.hpp"
 #include "molecule.hpp"
+#include "periodentafel.hpp"
+#include "vector.hpp"
 #include "verbose.hpp"
 
@@ -30,5 +36,7 @@
 #include "Actions/AnalysisAction/MolecularVolumeAction.hpp"
 #include "Actions/AnalysisAction/PairCorrelationAction.hpp"
+#include "Actions/AnalysisAction/PointCorrelationAction.hpp"
 #include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp"
+#include "Actions/AnalysisAction/SurfaceCorrelationAction.hpp"
 #include "Actions/AtomAction/AddAction.hpp"
 #include "Actions/AtomAction/ChangeElementAction.hpp"
@@ -497,4 +505,154 @@
 }
 
+void MapOfActions::queryCurrentValue(const char * name, class atom * &_T)
+{
+  int atomID = -1;
+  if (typeid( atom ) == *TypeMap[name])
+    atomID = lexical_cast<int>(CurrentValue[name].c_str());
+  else
+    throw IllegalTypeException(__FILE__,__LINE__);
+  _T = World::getInstance().getAtom(AtomById(atomID));
+}
+
+void MapOfActions::queryCurrentValue(const char * name, class element * &_T)  {
+  int Z = -1;
+  if (typeid( element ) == *TypeMap[name])
+    Z = lexical_cast<int>(CurrentValue[name].c_str());
+  else
+    throw IllegalTypeException(__FILE__,__LINE__);
+  _T = World::getInstance().getPeriode()->FindElement(Z);
+}
+
+void MapOfActions::queryCurrentValue(const char * name, class molecule * &_T) {
+  int molID = -1;
+  if (typeid( molecule ) == *TypeMap[name])
+    molID = lexical_cast<int>(CurrentValue[name].c_str());
+  else
+    throw IllegalTypeException(__FILE__,__LINE__);
+  _T = World::getInstance().getMolecule(MoleculeById(molID));
+}
+
+void MapOfActions::queryCurrentValue(const char * name, class Box &_T) {
+  Matrix M;
+  double tmp;
+  if (typeid( BoxValue ) == *TypeMap[name]) {
+    std::istringstream stream(CurrentValue[name]);
+    stream >> tmp;
+    M.set(0,0,tmp);
+    stream >> tmp;
+    M.set(0,1,tmp);
+    M.set(1,0,tmp);
+    stream >> tmp;
+    M.set(0,2,tmp);
+    M.set(2,0,tmp);
+    stream >> tmp;
+    M.set(1,1,tmp);
+    stream >> tmp;
+    M.set(1,2,tmp);
+    M.set(2,1,tmp);
+    stream >> tmp;
+    M.set(2,2,tmp);
+  } else
+    throw IllegalTypeException(__FILE__,__LINE__);
+}
+
+void MapOfActions::queryCurrentValue(const char * name, class Vector &_T) {
+  if (typeid( VectorValue ) == *TypeMap[name]) {
+    std::istringstream stream(CurrentValue[name]);
+    stream >> _T[0];
+    stream >> _T[1];
+    stream >> _T[2];
+  } else
+    throw IllegalTypeException(__FILE__,__LINE__);
+}
+
+void MapOfActions::queryCurrentValue(const char * name, std::vector<element *>&_T)
+{
+  int Z = -1;
+  element *elemental = NULL;
+  if (typeid( std::vector<element *> ) == *TypeMap[name]) {
+    std::istringstream stream(CurrentValue[name]);
+    while (!stream.fail()) {
+      stream >> Z;
+      elemental = World::getInstance().getPeriode()->FindElement(Z);
+      if (elemental != NULL)
+        _T.push_back(elemental);
+    }
+  } else
+    throw IllegalTypeException(__FILE__,__LINE__);
+}
+
+
+void MapOfActions::setCurrentValue(const char * name, class atom * &_T)
+{
+  if (typeid( atom ) == *TypeMap[name]) {
+    std::ostringstream stream;
+    stream << _T->getId();
+    CurrentValue[name] = stream.str();
+  } else
+    throw IllegalTypeException(__FILE__,__LINE__);
+}
+
+void MapOfActions::setCurrentValue(const char * name, class element * &_T)
+{
+  if (typeid( element ) == *TypeMap[name]) {
+    std::ostringstream stream;
+    stream << _T->Z;
+    CurrentValue[name] = stream.str();
+  } else
+    throw IllegalTypeException(__FILE__,__LINE__);
+}
+
+void MapOfActions::setCurrentValue(const char * name, class molecule * &_T)
+{
+  if (typeid( molecule ) == *TypeMap[name]) {
+    std::ostringstream stream;
+    stream << _T->getId();
+    CurrentValue[name] = stream.str();
+  } else
+    throw IllegalTypeException(__FILE__,__LINE__);
+}
+
+void MapOfActions::setCurrentValue(const char * name, class Box &_T)
+{
+  const Matrix &M = _T.getM();
+  if (typeid( Box ) == *TypeMap[name]) {
+    std::ostringstream stream;
+    stream << M.at(0,0) << " ";
+    stream << M.at(0,1) << " ";
+    stream << M.at(0,2) << " ";
+    stream << M.at(1,1) << " ";
+    stream << M.at(1,2) << " ";
+    stream << M.at(2,2) << " ";
+    CurrentValue[name] = stream.str();
+  } else
+    throw IllegalTypeException(__FILE__,__LINE__);
+}
+
+void MapOfActions::setCurrentValue(const char * name, class Vector &_T)
+{
+  if (typeid( Vector ) == *TypeMap[name]){
+    std::ostringstream stream;
+    stream << _T[0] << " ";
+    stream << _T[1] << " ";
+    stream << _T[2] << " ";
+    CurrentValue[name] = stream.str();
+  } else
+    throw IllegalTypeException(__FILE__,__LINE__);
+}
+
+void MapOfActions::setCurrentValue(const char * name, std::vector<element *>&_T)
+{
+  if (typeid( std::vector<element *> ) == *TypeMap[name]) {
+    std::ostringstream stream;
+    for (std::vector<element *>::iterator iter = _T.begin(); iter != _T.end(); ++iter) {
+      stream << (*iter)->Z;
+    }
+    CurrentValue[name] = stream.str();
+  } else
+    throw IllegalTypeException(__FILE__,__LINE__);
+}
+
+
 
 void MapOfActions::populateActions()
@@ -502,5 +660,7 @@
   new AnalysisMolecularVolumeAction();
   new AnalysisPairCorrelationAction();
+  new AnalysisPointCorrelationAction();
   new AnalysisPrincipalAxisSystemAction();
+  new AnalysisSurfaceCorrelationAction();
 
   new AtomAddAction();
Index: src/Actions/MapOfActions.hpp
===================================================================
--- src/Actions/MapOfActions.hpp	(revision 0c9cc3712a5c382c45c76450228053bec2bc4637)
+++ src/Actions/MapOfActions.hpp	(revision d02e07dab3e4ea3de415734aa0c09a9055b903bf)
@@ -14,4 +14,5 @@
 #include <map>
 #include <set>
+#include <vector>
 #include <typeinfo>
 
@@ -20,4 +21,10 @@
 #include "Exceptions/IllegalTypeException.hpp"
 #include "Patterns/Singleton.hpp"
+
+class Box;
+class atom;
+class element;
+class molecule;
+class Vector;
 
 namespace po = boost::program_options;
@@ -154,4 +161,10 @@
   void populateActions();
 
+  void queryCurrentValue(const char * name, class atom * &_T);
+  void queryCurrentValue(const char * name, class element * &_T);
+  void queryCurrentValue(const char * name, class molecule * &_T);
+  void queryCurrentValue(const char * name, class Box &_T);
+  void queryCurrentValue(const char * name, class Vector &_T);
+  void queryCurrentValue(const char * name, std::vector<element *>&_T);
   template<typename T> void queryCurrentValue(const char * name, T &_T)
   {
@@ -162,4 +175,10 @@
   }
 
+  void setCurrentValue(const char * name, class atom * &_T);
+  void setCurrentValue(const char * name, class element * &_T);
+  void setCurrentValue(const char * name, class molecule * &_T);
+  void setCurrentValue(const char * name, class Box &_T);
+  void setCurrentValue(const char * name, class Vector &_T);
+  void setCurrentValue(const char * name, std::vector<element *>&_T);
   template<class T> void setCurrentValue(const char * name, T &_T)
   {
