summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Config.cpp12
-rw-r--r--src/VolumeGeometry2D.cpp20
-rw-r--r--src/VolumeGeometry3D.cpp23
-rw-r--r--src/XMLDocument.cpp8
4 files changed, 62 insertions, 1 deletions
diff --git a/src/Config.cpp b/src/Config.cpp
index 3a3cb53..653935e 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -54,12 +54,24 @@ Config::Config(XMLNode* _self)
self = _self;
}
+//-----------------------------------------------------------------------------
Config::~Config()
{
delete self;
self = 0;
}
+//-----------------------------------------------------------------------------
+void Config::initialize(std::string rootname)
+{
+ if (self == 0) {
+ XMLDocument* doc = XMLDocument::createDocument(rootname);
+ self = doc->getRootNode();
+ }
+}
+
+
+//-----------------------------------------------------------------------------
template <class T>
ConfigStackCheck<T>::ConfigStackCheck(const char *_name, T* _obj, const Config& _cfg)
: object(_obj), cfg(&_cfg), name(_name)
diff --git a/src/VolumeGeometry2D.cpp b/src/VolumeGeometry2D.cpp
index 19aa905..d412914 100644
--- a/src/VolumeGeometry2D.cpp
+++ b/src/VolumeGeometry2D.cpp
@@ -152,7 +152,7 @@ CVolumeGeometry2D* CVolumeGeometry2D::clone()
}
//----------------------------------------------------------------------------------------
-// Initialization witha COnfig object
+// Initialization witha Config object
bool CVolumeGeometry2D::initialize(const Config& _cfg)
{
ASTRA_ASSERT(_cfg.self);
@@ -277,6 +277,24 @@ bool CVolumeGeometry2D::isEqual(CVolumeGeometry2D* _pGeom2) const
return true;
}
+
+//----------------------------------------------------------------------------------------
+// Get the configuration object
+Config* CVolumeGeometry2D::getConfiguration() const
+{
+ Config* cfg = new Config();
+ cfg->initialize("VolumeGeometry2D");
+
+ cfg->self->addChildNode("GridColCount", m_iGridColCount);
+ cfg->self->addChildNode("GridRowCount", m_iGridRowCount);
+
+ cfg->self->addOption("WindowMinX", m_fWindowMinX);
+ cfg->self->addOption("WindowMaxX", m_fWindowMaxX);
+ cfg->self->addOption("WindowMinY", m_fWindowMinY);
+ cfg->self->addOption("WindowMaxY", m_fWindowMaxY);
+
+ return cfg;
+}
//----------------------------------------------------------------------------------------
} // namespace astra
diff --git a/src/VolumeGeometry3D.cpp b/src/VolumeGeometry3D.cpp
index d7a93a9..66e6f0c 100644
--- a/src/VolumeGeometry3D.cpp
+++ b/src/VolumeGeometry3D.cpp
@@ -380,5 +380,28 @@ CVolumeGeometry2D * CVolumeGeometry3D::createVolumeGeometry2D() const
}
//----------------------------------------------------------------------------------------
+// Get the configuration object
+Config* CVolumeGeometry3D::getConfiguration() const
+{
+ Config* cfg = new Config();
+ cfg->initialize("VolumeGeometry3D");
+
+ cfg->self->addChildNode("GridColCount", m_iGridColCount);
+ cfg->self->addChildNode("GridRowCount", m_iGridRowCount);
+ cfg->self->addChildNode("GridSliceCount", m_iGridSliceCount);
+
+ cfg->self->addOption("WindowMinX", m_fWindowMinX);
+ cfg->self->addOption("WindowMaxX", m_fWindowMaxX);
+ cfg->self->addOption("WindowMinY", m_fWindowMinY);
+ cfg->self->addOption("WindowMaxY", m_fWindowMaxY);
+ cfg->self->addOption("WindowMinZ", m_fWindowMinZ);
+ cfg->self->addOption("WindowMaxZ", m_fWindowMaxZ);
+
+ return cfg;
+}
+//----------------------------------------------------------------------------------------
+
+
+//----------------------------------------------------------------------------------------
} // namespace astra
diff --git a/src/XMLDocument.cpp b/src/XMLDocument.cpp
index b39875b..406564f 100644
--- a/src/XMLDocument.cpp
+++ b/src/XMLDocument.cpp
@@ -109,4 +109,12 @@ void XMLDocument::saveToFile(string sFilename)
}
//-----------------------------------------------------------------------------
+std::string XMLDocument::toString()
+{
+ std::stringstream ss;
+ ss << *fDOMDocument->first_node();
+ return ss.str();
+}
+
+//-----------------------------------------------------------------------------