00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef _VTK_POINT_SET_XML_READER__H_ 00019 #define _VTK_POINT_SET_XML_READER__H_ 00020 00021 #include <mitkPointSet.h> 00022 #include <vtkXMLParser.h> 00023 #include <stack> 00024 #include <list> 00025 #include <string> 00026 00027 00028 namespace mitk 00029 { 00030 00039 class MITK_CORE_EXPORT vtkPointSetXMLParser : public vtkXMLParser 00040 { 00041 public: 00042 vtkTypeMacro(vtkPointSetXMLParser,vtkXMLParser); 00043 00044 static vtkPointSetXMLParser* New(); 00045 00046 typedef mitk::PointSet PointSetType; 00047 00048 typedef std::stack< std::string > ParseStack; 00049 00050 typedef std::list< PointSetType::Pointer > PointSetList; 00051 00052 typedef PointSetType::DataType::PointIdentifier PointIdentifier; 00053 00054 typedef PointSetType::PointType PointType; 00055 00056 virtual int InitializeParser(); 00057 virtual int CleanupParser(); 00062 virtual void StartElement (const char *name, const char **atts); 00063 00068 virtual void EndElement (const char *name); 00069 00076 virtual void CharacterDataHandler (const char *inData, int inLength); 00077 00081 virtual mitk::ScalarType ParseScalarType(const std::string &data); 00082 00086 virtual PointIdentifier ParsePointIdentifier(const std::string &data); 00087 00092 virtual PointSetList GetParsedPointSets(); 00093 00094 protected: 00095 vtkPointSetXMLParser(); 00096 virtual ~vtkPointSetXMLParser(); 00097 00103 ParseStack m_ParseStack; 00104 00108 PointSetList m_PointSetList; 00109 00114 PointSetType::Pointer m_CurrentPointSet; 00115 00120 PointType m_CurrentPoint; 00121 00122 std::string m_CurId; 00123 std::string m_CurXString; 00124 std::string m_CurYString; 00125 std::string m_CurZString; 00126 00131 PointIdentifier m_CurrentPointId; 00132 00133 std::locale m_PreviousLocale; 00134 00135 }; 00136 } 00137 #endif // _VTK_POINT_SET_XML_READER__H_