[mapguide-commits] r1153 - trunk/MgDev/Common/MdfParser
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Mar 5 20:21:27 EST 2007
Author: waltweltonlair
Date: 2007-03-05 20:21:27 -0500 (Mon, 05 Mar 2007)
New Revision: 1153
Added:
trunk/MgDev/Common/MdfParser/IOAreaUsage.cpp
trunk/MgDev/Common/MdfParser/IOAreaUsage.h
trunk/MgDev/Common/MdfParser/IOCompositeRule.cpp
trunk/MgDev/Common/MdfParser/IOCompositeRule.h
trunk/MgDev/Common/MdfParser/IOCompositeSymbolization.cpp
trunk/MgDev/Common/MdfParser/IOCompositeSymbolization.h
trunk/MgDev/Common/MdfParser/IOCompositeTypeStyle.cpp
trunk/MgDev/Common/MdfParser/IOCompositeTypeStyle.h
trunk/MgDev/Common/MdfParser/IOCompoundSymbolDefinition.cpp
trunk/MgDev/Common/MdfParser/IOCompoundSymbolDefinition.h
trunk/MgDev/Common/MdfParser/IOGraphicElement.cpp
trunk/MgDev/Common/MdfParser/IOGraphicElement.h
trunk/MgDev/Common/MdfParser/IOGraphicElementCollection.cpp
trunk/MgDev/Common/MdfParser/IOGraphicElementCollection.h
trunk/MgDev/Common/MdfParser/IOImage.cpp
trunk/MgDev/Common/MdfParser/IOImage.h
trunk/MgDev/Common/MdfParser/IOLineUsage.cpp
trunk/MgDev/Common/MdfParser/IOLineUsage.h
trunk/MgDev/Common/MdfParser/IOOverride.cpp
trunk/MgDev/Common/MdfParser/IOOverride.h
trunk/MgDev/Common/MdfParser/IOOverrideCollection.cpp
trunk/MgDev/Common/MdfParser/IOOverrideCollection.h
trunk/MgDev/Common/MdfParser/IOParameter.cpp
trunk/MgDev/Common/MdfParser/IOParameter.h
trunk/MgDev/Common/MdfParser/IOParameterCollection.cpp
trunk/MgDev/Common/MdfParser/IOParameterCollection.h
trunk/MgDev/Common/MdfParser/IOPath.cpp
trunk/MgDev/Common/MdfParser/IOPath.h
trunk/MgDev/Common/MdfParser/IOPointUsage.cpp
trunk/MgDev/Common/MdfParser/IOPointUsage.h
trunk/MgDev/Common/MdfParser/IOResizeBox.cpp
trunk/MgDev/Common/MdfParser/IOResizeBox.h
trunk/MgDev/Common/MdfParser/IOSimpleSymbol.cpp
trunk/MgDev/Common/MdfParser/IOSimpleSymbol.h
trunk/MgDev/Common/MdfParser/IOSimpleSymbolDefinition.cpp
trunk/MgDev/Common/MdfParser/IOSimpleSymbolDefinition.h
trunk/MgDev/Common/MdfParser/IOSymbolDefinition.cpp
trunk/MgDev/Common/MdfParser/IOSymbolDefinition.h
trunk/MgDev/Common/MdfParser/IOSymbolInstance.cpp
trunk/MgDev/Common/MdfParser/IOSymbolInstance.h
trunk/MgDev/Common/MdfParser/IOSymbolInstanceCollection.cpp
trunk/MgDev/Common/MdfParser/IOSymbolInstanceCollection.h
trunk/MgDev/Common/MdfParser/IOText.cpp
trunk/MgDev/Common/MdfParser/IOText.h
trunk/MgDev/Common/MdfParser/IOTextFrame.cpp
trunk/MgDev/Common/MdfParser/IOTextFrame.h
trunk/MgDev/Common/MdfParser/IOValueList.cpp
trunk/MgDev/Common/MdfParser/IOValueList.h
Modified:
trunk/MgDev/Common/MdfParser/IODrawingLayerDefinition.cpp
trunk/MgDev/Common/MdfParser/IOGridLayerDefinition.cpp
trunk/MgDev/Common/MdfParser/IONameStringPair.cpp
trunk/MgDev/Common/MdfParser/IONameStringPair.h
trunk/MgDev/Common/MdfParser/IOVectorLayerDefinition.cpp
trunk/MgDev/Common/MdfParser/IOVectorScaleRange.cpp
trunk/MgDev/Common/MdfParser/Makefile.am
trunk/MgDev/Common/MdfParser/MdfParser.vcproj
trunk/MgDev/Common/MdfParser/SAX2Parser.cpp
trunk/MgDev/Common/MdfParser/SAX2Parser.h
trunk/MgDev/Common/MdfParser/stdafx.h
Log:
Update MdfParser to support new symbolization (RFC14).
Added: trunk/MgDev/Common/MdfParser/IOAreaUsage.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOAreaUsage.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOAreaUsage.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,84 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOAreaUsage.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOAreaUsage::IOAreaUsage(SimpleSymbolDefinition* symbolDefinition)
+{
+ this->_symbolDefinition = symbolDefinition;
+ this->_areaUsage = NULL;
+}
+
+void IOAreaUsage::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"AreaUsage") // NOXLATE
+ {
+ m_startElemName = name;
+ this->_areaUsage = new AreaUsage();
+ }
+}
+
+void IOAreaUsage::ElementChars(const wchar_t *ch)
+{
+ IF_ENUM_2(m_currElemName, this->_areaUsage, AreaUsage, OriginControl, ch, Global, Centroid)
+ else IF_ENUM_2(m_currElemName, this->_areaUsage, Usage, AngleControl, ch, FromAngle, FromGeometry)
+ else IF_ENUM_2(m_currElemName, this->_areaUsage, AreaUsage, ClippingControl, ch, Clip, Overlap)
+ else IF_STRING_PROPERTY(m_currElemName, this->_areaUsage, OriginX, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_areaUsage, OriginY, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_areaUsage, Angle, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_areaUsage, RepeatX, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_areaUsage, RepeatY, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_areaUsage, BufferWidth, ch)
+}
+
+void IOAreaUsage::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_symbolDefinition->AdoptAreaUsage(this->_areaUsage);
+ this->_symbolDefinition = NULL;
+ this->_areaUsage = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOAreaUsage::Write(MdfStream &fd, AreaUsage *usage)
+{
+ fd << tab() << "<AreaUsage>" << std::endl; // NOXLATE
+ inctab();
+
+ EMIT_ENUM_2(fd, usage, AreaUsage, OriginControl, Global, Centroid, 1) // Global is default
+ EMIT_ENUM_2(fd, usage, Usage, AngleControl, FromAngle, FromGeometry, 1) // FromAngle is default
+ EMIT_ENUM_2(fd, usage, AreaUsage, ClippingControl, Clip, Overlap, 1) // Clip is default
+ EMIT_STRING_PROPERTY(fd, usage, OriginX, true)
+ EMIT_STRING_PROPERTY(fd, usage, OriginY, true)
+ EMIT_STRING_PROPERTY(fd, usage, Angle, true)
+ EMIT_STRING_PROPERTY(fd, usage, RepeatX, true)
+ EMIT_STRING_PROPERTY(fd, usage, RepeatY, true)
+ EMIT_STRING_PROPERTY(fd, usage, BufferWidth, true)
+
+ dectab();
+ fd << tab() << "</AreaUsage>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOAreaUsage.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOAreaUsage.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOAreaUsage.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOAreaUsage.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,47 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOAREAUSAGE_H
+#define _IOAREAUSAGE_H
+
+#include "SAX2ElementHandler.h"
+#include "SimpleSymbolDefinition.h"
+#include "AreaUsage.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOAreaUsage : public SAX2ElementHandler
+{
+ public:
+ IOAreaUsage(SimpleSymbolDefinition* symbolDefinition);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, AreaUsage* areaUsage);
+
+ private:
+ SimpleSymbolDefinition* _symbolDefinition;
+ AreaUsage* _areaUsage;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOAREAUSAGE_H
Property changes on: trunk/MgDev/Common/MdfParser/IOAreaUsage.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOCompositeRule.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOCompositeRule.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOCompositeRule.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,83 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOCompositeRule.h"
+#include "IOCompositeSymbolization.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOCompositeRule::IOCompositeRule(CompositeTypeStyle* compositeTypeStyle)
+{
+ this->_compositeTypeStyle = compositeTypeStyle;
+ this->_compositeRule = NULL;
+}
+
+IOCompositeRule::~IOCompositeRule()
+{
+}
+
+void IOCompositeRule::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"CompositeRule") // NOXLATE
+ {
+ m_startElemName = name;
+ this->_compositeRule = new CompositeRule();
+ }
+ else if (m_currElemName == L"CompositeSymbolization") // NOXLATE
+ {
+ IOCompositeSymbolization* IO = new IOCompositeSymbolization(this->_compositeRule);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+}
+
+void IOCompositeRule::ElementChars(const wchar_t *ch)
+{
+ IF_STRING_PROPERTY(m_currElemName, this->_compositeRule, LegendLabel, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_compositeRule, Filter, ch)
+}
+
+void IOCompositeRule::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_compositeTypeStyle->GetRules()->Adopt(this->_compositeRule);
+ this->_compositeTypeStyle = NULL;
+ this->_compositeRule = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOCompositeRule::Write(MdfStream &fd, CompositeRule* compositeRule)
+{
+ fd << tab() << "<CompositeRule>" << std::endl; // NOXLATE
+ inctab();
+
+ EMIT_STRING_PROPERTY(fd, compositeRule, LegendLabel, false)
+ EMIT_STRING_PROPERTY(fd, compositeRule, Filter, true)
+
+ IOCompositeSymbolization::Write(fd, compositeRule->GetSymbolization());
+
+ dectab();
+ fd << tab() << "</CompositeRule>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOCompositeRule.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOCompositeRule.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOCompositeRule.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOCompositeRule.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,48 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOCOMPOSITERULE_H
+#define _IOCOMPOSITERULE_H
+
+#include "SAX2ElementHandler.h"
+#include "CompositeTypeStyle.h"
+#include "CompositeRule.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOCompositeRule : public SAX2ElementHandler
+{
+ public:
+ IOCompositeRule(CompositeTypeStyle* compositeTypeStyle);
+ ~IOCompositeRule();
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, CompositeRule* compositeRule);
+
+ private:
+ CompositeTypeStyle* _compositeTypeStyle;
+ CompositeRule* _compositeRule;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOCOMPOSITERULE_H
Property changes on: trunk/MgDev/Common/MdfParser/IOCompositeRule.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOCompositeSymbolization.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOCompositeSymbolization.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOCompositeSymbolization.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,86 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOCompositeSymbolization.h"
+#include "IOSymbolInstanceCollection.h"
+#include "IOOverrideCollection.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOCompositeSymbolization::IOCompositeSymbolization(CompositeRule* compositeRule)
+{
+ this->_compositeRule = compositeRule;
+ this->_compositeSymbolization = NULL;
+}
+
+IOCompositeSymbolization::~IOCompositeSymbolization()
+{
+}
+
+void IOCompositeSymbolization::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"CompositeSymbolization") // NOXLATE
+ {
+ m_startElemName = name;
+ this->_compositeSymbolization = new CompositeSymbolization();
+ }
+ else if (m_currElemName == L"SymbolCollection") // NOXLATE
+ {
+ IOSymbolInstanceCollection* IO = new IOSymbolInstanceCollection(this->_compositeSymbolization->GetSymbolCollection());
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+ else if (m_currElemName == L"ParameterOverrides") // NOXLATE
+ {
+ IOOverrideCollection* IO = new IOOverrideCollection(this->_compositeSymbolization->GetParameterOverrides());
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+}
+
+void IOCompositeSymbolization::ElementChars(const wchar_t *ch)
+{
+}
+
+void IOCompositeSymbolization::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_compositeRule->AdoptSymbolization(this->_compositeSymbolization);
+ this->_compositeRule = NULL;
+ this->_compositeSymbolization = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOCompositeSymbolization::Write(MdfStream &fd, CompositeSymbolization* compositeSymbolization)
+{
+ fd << tab() << "<CompositeSymbolization>" << std::endl; // NOXLATE
+ inctab();
+
+ IOSymbolInstanceCollection::Write(fd, compositeSymbolization->GetSymbolCollection());
+ IOOverrideCollection::Write(fd, compositeSymbolization->GetParameterOverrides());
+
+ dectab();
+ fd << tab() << "</CompositeSymbolization>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOCompositeSymbolization.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOCompositeSymbolization.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOCompositeSymbolization.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOCompositeSymbolization.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,48 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOCOMPOSITESYMBOLIZATION_H
+#define _IOCOMPOSITESYMBOLIZATION_H
+
+#include "SAX2ElementHandler.h"
+#include "CompositeRule.h"
+#include "CompositeSymbolization.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOCompositeSymbolization : public SAX2ElementHandler
+{
+ public:
+ IOCompositeSymbolization(CompositeRule* compositeRule);
+ ~IOCompositeSymbolization();
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, CompositeSymbolization* compositeSymbolization);
+
+ private:
+ CompositeRule* _compositeRule;
+ CompositeSymbolization* _compositeSymbolization;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOCOMPOSITESYMBOLIZATION_H
Property changes on: trunk/MgDev/Common/MdfParser/IOCompositeSymbolization.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOCompositeTypeStyle.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOCompositeTypeStyle.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOCompositeTypeStyle.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,88 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOCompositeTypeStyle.h"
+#include "IOCompositeRule.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOCompositeTypeStyle::IOCompositeTypeStyle(VectorScaleRange* vectorScaleRange)
+{
+ this->_vectorScaleRange = vectorScaleRange;
+ this->_compositeTypeStyle = NULL;
+}
+
+IOCompositeTypeStyle::~IOCompositeTypeStyle()
+{
+}
+
+void IOCompositeTypeStyle::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"CompositeTypeStyle") // NOXLATE
+ {
+ m_startElemName = name;
+ this->_compositeTypeStyle = new CompositeTypeStyle();
+ }
+ else if (m_currElemName == L"CompositeRule") // NOXLATE
+ {
+ IOCompositeRule* IO = new IOCompositeRule(this->_compositeTypeStyle);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+}
+
+void IOCompositeTypeStyle::ElementChars(const wchar_t *ch)
+{
+}
+
+void IOCompositeTypeStyle::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_vectorScaleRange->GetFeatureTypeStyles()->Adopt(this->_compositeTypeStyle);
+ this->_vectorScaleRange = NULL;
+ this->_compositeTypeStyle = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOCompositeTypeStyle::Write(MdfStream &fd, CompositeTypeStyle* compositeTypeStyle)
+{
+ // the schema currently requires at least one rule
+ RuleCollection* ruleCollection = compositeTypeStyle->GetRules();
+ int numElements = ruleCollection->GetCount();
+ assert(numElements > 0);
+
+ fd << tab() << "<CompositeTypeStyle>" << std::endl; // NOXLATE
+ inctab();
+
+ for (int i=0; i<numElements; ++i)
+ {
+ CompositeRule* compositeRule = dynamic_cast<CompositeRule*>(ruleCollection->GetAt(i));
+ if (compositeRule)
+ IOCompositeRule::Write(fd, compositeRule);
+ }
+
+ dectab();
+ fd << tab() << "</CompositeTypeStyle>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOCompositeTypeStyle.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOCompositeTypeStyle.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOCompositeTypeStyle.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOCompositeTypeStyle.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,48 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOCOMPOSITETYPESTYLE_H
+#define _IOCOMPOSITETYPESTYLE_H
+
+#include "SAX2ElementHandler.h"
+#include "VectorScaleRange.h"
+#include "CompositeTypeStyle.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOCompositeTypeStyle : public SAX2ElementHandler
+{
+ public:
+ IOCompositeTypeStyle(VectorScaleRange* vectorScaleRange);
+ ~IOCompositeTypeStyle();
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, CompositeTypeStyle* compositeTypeStyle);
+
+ private:
+ VectorScaleRange* _vectorScaleRange;
+ CompositeTypeStyle* _compositeTypeStyle;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOCOMPOSITETYPESTYLE_H
Property changes on: trunk/MgDev/Common/MdfParser/IOCompositeTypeStyle.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOCompoundSymbolDefinition.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOCompoundSymbolDefinition.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOCompoundSymbolDefinition.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,82 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOCompoundSymbolDefinition.h"
+#include "IOSimpleSymbol.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOCompoundSymbolDefinition::IOCompoundSymbolDefinition(CompoundSymbolDefinition* symbol)
+{
+ this->_symbolDefinition = symbol;
+}
+
+void IOCompoundSymbolDefinition::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"CompoundSymbolDefinition") // NOXLATE
+ {
+ m_startElemName = name;
+ }
+ else if (m_currElemName == L"SimpleSymbol") // NOXLATE
+ {
+ IOSimpleSymbol* IO = new IOSimpleSymbol(this->_symbolDefinition->GetSymbols());
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+}
+
+void IOCompoundSymbolDefinition::ElementChars(const wchar_t *ch)
+{
+ IF_STRING_PROPERTY(m_currElemName, this->_symbolDefinition, Name, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_symbolDefinition, Description, ch)
+}
+
+void IOCompoundSymbolDefinition::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_symbolDefinition = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOCompoundSymbolDefinition::Write(MdfStream &fd, CompoundSymbolDefinition* symbolDefinition)
+{
+ // the schema currently requires at least one symbol
+ // TODO: WCW - we should relax this to allow zero symbols
+ SimpleSymbolCollection* symbolCollection = symbolDefinition->GetSymbols();
+ int numElements = symbolCollection->GetCount();
+ assert(numElements > 0);
+
+ fd << tab() << "<CompoundSymbolDefinition>" << std::endl; // NOXLATE
+ inctab();
+
+ EMIT_STRING_PROPERTY(fd, symbolDefinition, Name, false)
+ EMIT_STRING_PROPERTY(fd, symbolDefinition, Description, true)
+
+ for (int i=0; i<numElements; ++i)
+ IOSimpleSymbol::Write(fd, symbolCollection->GetAt(i));
+
+ dectab();
+ fd << tab() << "</CompoundSymbolDefinition>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOCompoundSymbolDefinition.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOCompoundSymbolDefinition.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOCompoundSymbolDefinition.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOCompoundSymbolDefinition.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,45 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOCOMPOUNDSYMBOLDEFINITION_H
+#define _IOCOMPOUNDSYMBOLDEFINITION_H
+
+#include "SAX2ElementHandler.h"
+#include "CompoundSymbolDefinition.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOCompoundSymbolDefinition : public SAX2ElementHandler
+{
+ public:
+ IOCompoundSymbolDefinition(CompoundSymbolDefinition* symbolDefinition);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, CompoundSymbolDefinition* symbolDefinition);
+
+ private:
+ CompoundSymbolDefinition* _symbolDefinition;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOCOMPOUNDSYMBOLDEFINITION_H
Property changes on: trunk/MgDev/Common/MdfParser/IOCompoundSymbolDefinition.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/MgDev/Common/MdfParser/IODrawingLayerDefinition.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IODrawingLayerDefinition.cpp 2007-03-06 01:18:33 UTC (rev 1152)
+++ trunk/MgDev/Common/MdfParser/IODrawingLayerDefinition.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -98,7 +98,7 @@
void IODrawingLayerDefinition::Write(MdfStream &fd, DrawingLayerDefinition *drawingLayer)
{
- fd << tab() << "<LayerDefinition xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xsi:noNamespaceSchemaLocation=\"LayerDefinition-1.0.0.xsd\" version=\"1.0.0\">" << std::endl; // NOXLATE
+ fd << tab() << "<LayerDefinition xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xsi:noNamespaceSchemaLocation=\"LayerDefinition-1.1.0.xsd\" version=\"1.1.0\">" << std::endl; // NOXLATE
inctab();
fd << tab() << "<DrawingLayerDefinition>" << std::endl; // NOXLATE
Added: trunk/MgDev/Common/MdfParser/IOGraphicElement.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOGraphicElement.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOGraphicElement.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,53 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOGraphicElement.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOGraphicElement::IOGraphicElement(GraphicElement* element)
+{
+ this->_element = element;
+}
+
+IOGraphicElement::~IOGraphicElement()
+{
+}
+
+void IOGraphicElement::ElementChars(const wchar_t *ch)
+{
+ IF_ENUM_3(m_currElemName, this->_element, GraphicElement, ResizeControl, ch, ResizeNone, AddToResizeBox, AdjustToResizeBox)
+}
+
+void IOGraphicElement::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_element = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOGraphicElement::Write(MdfStream &fd, GraphicElement* element)
+{
+ EMIT_ENUM_3(fd, element, GraphicElement, ResizeControl, ResizeNone, AddToResizeBox, AdjustToResizeBox, 1) // ResizeNone is default
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOGraphicElement.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOGraphicElement.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOGraphicElement.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOGraphicElement.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,45 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOGRAPHICELEMENT_H
+#define _IOGRAPHICELEMENT_H
+
+#include "SAX2ElementHandler.h"
+#include "GraphicElement.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOGraphicElement : public SAX2ElementHandler
+{
+ public:
+ IOGraphicElement(GraphicElement* element);
+ virtual ~IOGraphicElement();
+
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, GraphicElement* element);
+
+ protected:
+ GraphicElement* _element;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOGRAPHICELEMENT_H
Property changes on: trunk/MgDev/Common/MdfParser/IOGraphicElement.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOGraphicElementCollection.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOGraphicElementCollection.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOGraphicElementCollection.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,125 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOGraphicElementCollection.h"
+#include "IOPath.h"
+#include "IOImage.h"
+#include "IOText.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOGraphicElementCollection::IOGraphicElementCollection(GraphicElementCollection* elementCollection)
+{
+ this->_elementCollection = elementCollection;
+}
+
+IOGraphicElementCollection::~IOGraphicElementCollection()
+{
+}
+
+void IOGraphicElementCollection::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"Graphics") // NOXLATE
+ {
+ m_startElemName = name;
+ }
+ else if (m_currElemName == L"Path") // NOXLATE
+ {
+ Path* path = new Path();
+ this->_elementCollection->Adopt(path);
+ IOPath* IO = new IOPath(path);
+ handlerStack->push(IO);
+ IO->StartPathElement(name, handlerStack);
+ }
+ else if (m_currElemName == L"Image") // NOXLATE
+ {
+ Image* image = new Image();
+ this->_elementCollection->Adopt(image);
+ IOImage* IO = new IOImage(image);
+ handlerStack->push(IO);
+ IO->StartImageElement(name, handlerStack);
+ }
+ else if (m_currElemName == L"Text") // NOXLATE
+ {
+ Text* text = new Text();
+ this->_elementCollection->Adopt(text);
+ IOText* IO = new IOText(text);
+ handlerStack->push(IO);
+ IO->StartTextElement(name, handlerStack);
+ }
+ else
+ ParseUnknownXml(name, handlerStack);
+}
+
+void IOGraphicElementCollection::ElementChars(const wchar_t *ch)
+{
+}
+
+void IOGraphicElementCollection::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_elementCollection = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOGraphicElementCollection::Write(MdfStream &fd, GraphicElementCollection* elementCollection)
+{
+ // the schema currently requires at least one element
+ // TODO: WCW - we should relax this to allow zero elements
+ int numElements = elementCollection->GetCount();
+ assert(numElements > 0);
+
+ fd << tab() << "<Graphics>" << std::endl; // NOXLATE
+ inctab();
+
+ for (int i=0; i<numElements; ++i)
+ {
+ GraphicElement* elem = elementCollection->GetAt(i);
+
+ Path* path = dynamic_cast<Path*>(elem);
+ if (path)
+ {
+ IOPath::Write(fd, path);
+ continue;
+ }
+
+ Image* image = dynamic_cast<Image*>(elem);
+ if (image)
+ {
+ IOImage::Write(fd, image);
+ continue;
+ }
+
+ Text* text = dynamic_cast<Text*>(elem);
+ if (text)
+ {
+ IOText::Write(fd, text);
+ continue;
+ }
+ }
+
+ dectab();
+ fd << tab() << "</Graphics>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOGraphicElementCollection.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOGraphicElementCollection.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOGraphicElementCollection.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOGraphicElementCollection.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,46 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOGRAPHICELEMENTCOLLECTION_H
+#define _IOGRAPHICELEMENTCOLLECTION_H
+
+#include "SAX2ElementHandler.h"
+#include "GraphicElement.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOGraphicElementCollection : public SAX2ElementHandler
+{
+ public:
+ IOGraphicElementCollection(GraphicElementCollection* elementCollection);
+ ~IOGraphicElementCollection();
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, GraphicElementCollection* elementCollection);
+
+ private:
+ GraphicElementCollection* _elementCollection;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOGRAPHICELEMENTCOLLECTION_H
Property changes on: trunk/MgDev/Common/MdfParser/IOGraphicElementCollection.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/MgDev/Common/MdfParser/IOGridLayerDefinition.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOGridLayerDefinition.cpp 2007-03-06 01:18:33 UTC (rev 1152)
+++ trunk/MgDev/Common/MdfParser/IOGridLayerDefinition.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -102,7 +102,7 @@
void IOGridLayerDefinition::Write(MdfStream &fd, GridLayerDefinition *gridLayer)
{
- fd << tab() << "<LayerDefinition xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xsi:noNamespaceSchemaLocation=\"LayerDefinition-1.0.0.xsd\" version=\"1.0.0\">" << std::endl; // NOXLATE
+ fd << tab() << "<LayerDefinition xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xsi:noNamespaceSchemaLocation=\"LayerDefinition-1.1.0.xsd\" version=\"1.1.0\">" << std::endl; // NOXLATE
inctab();
fd << tab() << "<GridLayerDefinition>" << std::endl; // NOXLATE
Added: trunk/MgDev/Common/MdfParser/IOImage.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOImage.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOImage.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,79 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOImage.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOImage::IOImage(Image* image) : IOGraphicElement(image)
+{
+}
+
+void IOImage::StartImageElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ // the element is an image with the supplied name
+ m_currElemName = name;
+ m_startElemName = name;
+}
+
+void IOImage::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+}
+
+void IOImage::ElementChars(const wchar_t *ch)
+{
+ Image* image = static_cast<Image*>(this->_element);
+
+ IF_STRING_PROPERTY(m_currElemName, image, Content, ch)
+ else IF_STRING_PROPERTY(m_currElemName, image, Reference, ch)
+ else IF_STRING_PROPERTY(m_currElemName, image, SizeX, ch)
+ else IF_STRING_PROPERTY(m_currElemName, image, SizeY, ch)
+ else IF_STRING_PROPERTY(m_currElemName, image, PositionX, ch)
+ else IF_STRING_PROPERTY(m_currElemName, image, PositionY, ch)
+ else IF_STRING_PROPERTY(m_currElemName, image, Angle, ch)
+ else IOGraphicElement::ElementChars(ch);
+}
+
+void IOImage::Write(MdfStream &fd, Image* image)
+{
+ // We must emit either the content or a reference, but
+ // not both. It's invalid for both strings to be empty,
+ // but to ensure the XML is valid we still write an empty
+ // reference.
+ assert((image->GetContent().size() > 0) ^ (image->GetReference().size() > 0));
+ bool contentOptional = (image->GetContent().size() == 0);
+
+ fd << tab() << "<Image>" << std::endl; // NOXLATE
+ inctab();
+
+ IOGraphicElement::Write(fd, image);
+
+ EMIT_STRING_PROPERTY(fd, image, Content, contentOptional)
+ EMIT_STRING_PROPERTY(fd, image, Reference, !contentOptional)
+ EMIT_STRING_PROPERTY(fd, image, SizeX, false)
+ EMIT_STRING_PROPERTY(fd, image, SizeY, false)
+ EMIT_STRING_PROPERTY(fd, image, PositionX, true)
+ EMIT_STRING_PROPERTY(fd, image, PositionY, true)
+ EMIT_STRING_PROPERTY(fd, image, Angle, true)
+
+ dectab();
+ fd << tab() << "</Image>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOImage.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOImage.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOImage.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOImage.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,43 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOIMAGE_H
+#define _IOIMAGE_H
+
+#include "IOGraphicElement.h"
+#include "Image.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOImage : public IOGraphicElement
+{
+ public:
+ IOImage(Image* image);
+
+ void StartImageElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+
+ static void Write(MdfStream &fd, Image* image);
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOIMAGE_H
Property changes on: trunk/MgDev/Common/MdfParser/IOImage.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOLineUsage.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOLineUsage.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOLineUsage.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,94 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOLineUsage.h"
+#include "IOPath.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOLineUsage::IOLineUsage(SimpleSymbolDefinition* symbolDefinition)
+{
+ this->_symbolDefinition = symbolDefinition;
+ this->_lineUsage = NULL;
+}
+
+void IOLineUsage::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"LineUsage") // NOXLATE
+ {
+ m_startElemName = name;
+ this->_lineUsage = new LineUsage();
+ }
+ else if (m_currElemName == L"DefaultPath") // NOXLATE
+ {
+ Path* path = new Path();
+ this->_lineUsage->AdoptDefaultPath(path);
+ IOPath* IO = new IOPath(path);
+ handlerStack->push(IO);
+ IO->StartPathElement(name, handlerStack);
+ }
+}
+
+void IOLineUsage::ElementChars(const wchar_t *ch)
+{
+ IF_ENUM_2(m_currElemName, this->_lineUsage, Usage, AngleControl, ch, FromAngle, FromGeometry)
+ else IF_ENUM_2(m_currElemName, this->_lineUsage, LineUsage, UnitsControl, ch, Absolute, Parametric)
+ else IF_ENUM_4(m_currElemName, this->_lineUsage, LineUsage, VertexControl, ch, NoOverlap, OverlapDirect, OverlapNoWrap, OverlapWrap)
+ else IF_STRING_PROPERTY(m_currElemName, this->_lineUsage, Angle, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_lineUsage, StartOffset, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_lineUsage, EndOffset, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_lineUsage, Repeat, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_lineUsage, VertexAngleLimit, ch)
+}
+
+void IOLineUsage::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_symbolDefinition->AdoptLineUsage(this->_lineUsage);
+ this->_symbolDefinition = NULL;
+ this->_lineUsage = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOLineUsage::Write(MdfStream &fd, LineUsage* lineUsage)
+{
+ fd << tab() << "<LineUsage>" << std::endl; // NOXLATE
+ inctab();
+
+ EMIT_ENUM_2(fd, lineUsage, Usage, AngleControl, FromAngle, FromGeometry, 1) // FromAngle is default
+ EMIT_ENUM_2(fd, lineUsage, LineUsage, UnitsControl, Absolute, Parametric, 1) // Absolute is default
+ EMIT_ENUM_4(fd, lineUsage, LineUsage, VertexControl, NoOverlap, OverlapDirect, OverlapNoWrap, OverlapWrap, 4) // OverlapWrap is default
+ EMIT_STRING_PROPERTY(fd, lineUsage, Angle, true)
+ EMIT_STRING_PROPERTY(fd, lineUsage, StartOffset, true)
+ EMIT_STRING_PROPERTY(fd, lineUsage, EndOffset, true)
+ EMIT_STRING_PROPERTY(fd, lineUsage, Repeat, true)
+ EMIT_STRING_PROPERTY(fd, lineUsage, VertexAngleLimit, true)
+
+ if (lineUsage->GetDefaultPath() != NULL)
+ IOPath::Write(fd, lineUsage->GetDefaultPath(), "DefaultPath");
+
+ dectab();
+ fd << tab() << "</LineUsage>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOLineUsage.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOLineUsage.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOLineUsage.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOLineUsage.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,47 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOLINEUSAGE_H
+#define _IOLINEUSAGE_H
+
+#include "SAX2ElementHandler.h"
+#include "SimpleSymbolDefinition.h"
+#include "LineUsage.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOLineUsage : public SAX2ElementHandler
+{
+ public:
+ IOLineUsage(SimpleSymbolDefinition* symbolDefinition);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, LineUsage* lineUsage);
+
+ private:
+ SimpleSymbolDefinition* _symbolDefinition;
+ LineUsage* _lineUsage;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOLINEUSAGE_H
Property changes on: trunk/MgDev/Common/MdfParser/IOLineUsage.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/MgDev/Common/MdfParser/IONameStringPair.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IONameStringPair.cpp 2007-03-06 01:18:33 UTC (rev 1152)
+++ trunk/MgDev/Common/MdfParser/IONameStringPair.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -22,12 +22,6 @@
using namespace MDFMODEL_NAMESPACE;
using namespace MDFPARSER_NAMESPACE;
-CREATE_ELEMENT_MAP;
-ELEM_MAP_ENTRY(1, PropertyMapping);
-ELEM_MAP_ENTRY(2, Parameter);
-ELEM_MAP_ENTRY(3, Name);
-ELEM_MAP_ENTRY(4, Value);
-
IONameStringPair::IONameStringPair()
: _nameStringPair(NULL), layer(NULL), featureSource(NULL)
{
@@ -36,12 +30,12 @@
}
IONameStringPair::IONameStringPair(VectorLayerDefinition *pLayer)
-: _nameStringPair(NULL), layer(pLayer), featureSource(NULL)
+: _nameStringPair(NULL), layer(pLayer), featureSource(NULL), overrides(NULL)
{
}
IONameStringPair::IONameStringPair(FeatureSource *pFeatureSource)
-: _nameStringPair(NULL), layer(NULL), featureSource(pFeatureSource)
+: _nameStringPair(NULL), layer(NULL), featureSource(pFeatureSource), overrides(NULL)
{
}
@@ -52,32 +46,21 @@
void IONameStringPair::StartElement(const wchar_t *name, HandlerStack *handlerStack)
{
m_currElemName = name;
- m_currElemId = _ElementIdFromName(name);
-
- switch (m_currElemId)
+ if (NULL != layer)
{
- case ePropertyMapping:
- if (NULL != layer)
+ if (m_currElemName == L"PropertyMapping") // NOXLATE
{
m_startElemName = name;
this->_nameStringPair = new NameStringPair(L"", L"");
}
- break;
-
- case eParameter:
- if (NULL != featureSource)
+ }
+ else if (NULL != featureSource)
+ {
+ if (m_currElemName == L"Parameter") // NOXLATE
{
m_startElemName = name;
this->_nameStringPair = new NameStringPair(L"", L"");
}
- break;
-
- case eUnknown:
- ParseUnknownXml(name, handlerStack);
- break;
-
- default:
- break;
}
}
@@ -93,9 +76,6 @@
{
if (m_startElemName == name)
{
- if (!UnknownXml().empty())
- this->_nameStringPair->SetUnknownXml(UnknownXml());
-
if (NULL != this->layer)
this->layer->GetPropertyMappings()->Adopt(this->_nameStringPair);
else if (NULL != this->featureSource)
@@ -121,10 +101,4 @@
fd << tab() << "<Value>"; // NOXLATE
fd << EncodeString(nameStringPair->GetValue());
fd << "</Value>" << std::endl; // NOXLATE
-
- // Write any previously found unknown XML
- if (!nameStringPair->GetUnknownXml().empty())
- {
- fd << toCString(nameStringPair->GetUnknownXml());
- }
}
Modified: trunk/MgDev/Common/MdfParser/IONameStringPair.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IONameStringPair.h 2007-03-06 01:18:33 UTC (rev 1152)
+++ trunk/MgDev/Common/MdfParser/IONameStringPair.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -34,6 +34,7 @@
NameStringPair * _nameStringPair;
VectorLayerDefinition * layer;
FeatureSource *featureSource;
+ NameStringPairCollection * overrides;
public:
IONameStringPair();
Added: trunk/MgDev/Common/MdfParser/IOOverride.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOOverride.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOOverride.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,71 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOOverride.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOOverride::IOOverride(OverrideCollection* overrideCollection)
+{
+ this->_overrideCollection = overrideCollection;
+}
+
+void IOOverride::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"Override") // NOXLATE
+ {
+ m_startElemName = name;
+ this->_override = new Override();
+ }
+}
+
+void IOOverride::ElementChars(const wchar_t *ch)
+{
+ IF_STRING_PROPERTY(m_currElemName, this->_override, SymbolName, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_override, ParameterIdentifier, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_override, ParameterValue, ch)
+}
+
+void IOOverride::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_overrideCollection->Adopt(this->_override);
+ this->_overrideCollection = NULL;
+ this->_override = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOOverride::Write(MdfStream &fd, Override* pOverride)
+{
+ fd << tab() << "<Override>" << std::endl; // NOXLATE
+ inctab();
+
+ EMIT_STRING_PROPERTY(fd, pOverride, SymbolName, false)
+ EMIT_STRING_PROPERTY(fd, pOverride, ParameterIdentifier, false)
+ EMIT_STRING_PROPERTY(fd, pOverride, ParameterValue, false)
+
+ dectab();
+ fd << tab() << "</Override>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOOverride.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOOverride.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOOverride.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOOverride.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,46 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOOVERRIDE_H
+#define _IOOVERRIDE_H
+
+#include "SAX2ElementHandler.h"
+#include "Override.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOOverride : public SAX2ElementHandler
+{
+ public:
+ IOOverride(OverrideCollection* overrideCollection);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, Override* pOverride);
+
+ private:
+ Override* _override;
+ OverrideCollection* _overrideCollection;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOOVERRIDE_H
Property changes on: trunk/MgDev/Common/MdfParser/IOOverride.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOOverrideCollection.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOOverrideCollection.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOOverrideCollection.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,77 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOOverrideCollection.h"
+#include "IOOverride.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOOverrideCollection::IOOverrideCollection(OverrideCollection* overrideCollection)
+{
+ this->_overrideCollection = overrideCollection;
+}
+
+void IOOverrideCollection::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"ParameterOverrides") // NOXLATE
+ {
+ m_startElemName = name;
+ }
+ else if (m_currElemName == L"Override") // NOXLATE
+ {
+ IOOverride* IO = new IOOverride(this->_overrideCollection);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+}
+
+void IOOverrideCollection::ElementChars(const wchar_t *ch)
+{
+}
+
+void IOOverrideCollection::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_overrideCollection = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOOverrideCollection::Write(MdfStream &fd, OverrideCollection* overrideCollection)
+{
+ // always write the element, even if it has 0 elements
+ int numElements = overrideCollection->GetCount();
+
+ fd << tab() << "<ParameterOverrides>" << std::endl; // NOXLATE
+ inctab();
+
+ for (int i=0; i<numElements; ++i)
+ {
+ Override* pOverride = overrideCollection->GetAt(i);
+ IOOverride::Write(fd, pOverride);
+ }
+
+ dectab();
+ fd << tab() << "</ParameterOverrides>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOOverrideCollection.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOOverrideCollection.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOOverrideCollection.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOOverrideCollection.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,45 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOOVERRIDECOLLECTION_H
+#define _IOOVERRIDECOLLECTION_H
+
+#include "SAX2ElementHandler.h"
+#include "Override.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOOverrideCollection : public SAX2ElementHandler
+{
+ public:
+ IOOverrideCollection(OverrideCollection* overrideCollection);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, OverrideCollection* overrideCollection);
+
+ private:
+ OverrideCollection* _overrideCollection;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOOVERRIDECOLLECTION_H
Property changes on: trunk/MgDev/Common/MdfParser/IOOverrideCollection.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOParameter.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOParameter.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOParameter.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,87 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOParameter.h"
+#include "IOValueList.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOParameter::IOParameter(ParameterCollection* parameterCollection)
+{
+ this->_parameterCollection = parameterCollection;
+ this->_parameter = NULL;
+}
+
+IOParameter::~IOParameter()
+{
+}
+
+void IOParameter::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"Parameter") // NOXLATE
+ {
+ m_startElemName = name;
+ this->_parameter = new Parameter();
+ }
+ else if (m_currElemName == L"ValueList") // NOXLATE
+ {
+ IOValueList* IO = new IOValueList(this->_parameter->GetValueList());
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+}
+
+void IOParameter::ElementChars(const wchar_t *ch)
+{
+ IF_STRING_PROPERTY(m_currElemName, this->_parameter, Identifier, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_parameter, DefaultValue, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_parameter, DisplayName, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_parameter, Description, ch)
+}
+
+void IOParameter::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_parameterCollection->Adopt(this->_parameter);
+ this->_parameterCollection = NULL;
+ this->_parameter = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOParameter::Write(MdfStream &fd, Parameter* parameter)
+{
+ fd << tab() << "<Parameter>" << std::endl; // NOXLATE
+ inctab();
+
+ EMIT_STRING_PROPERTY(fd, parameter, Identifier, false)
+ EMIT_STRING_PROPERTY(fd, parameter, DefaultValue, false)
+ EMIT_STRING_PROPERTY(fd, parameter, DisplayName, true)
+ EMIT_STRING_PROPERTY(fd, parameter, Description, true)
+
+ IOValueList::Write(fd, parameter->GetValueList());
+
+ dectab();
+ fd << tab() << "</Parameter>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOParameter.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOParameter.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOParameter.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOParameter.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,47 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOPARAMETER_H
+#define _IOPARAMETER_H
+
+#include "SAX2ElementHandler.h"
+#include "Parameter.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOParameter : public SAX2ElementHandler
+{
+ public:
+ IOParameter(ParameterCollection* parameterCollection);
+ ~IOParameter();
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, Parameter* parameter);
+
+ private:
+ Parameter* _parameter;
+ ParameterCollection* _parameterCollection;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOPARAMETER_H
Property changes on: trunk/MgDev/Common/MdfParser/IOParameter.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOParameterCollection.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOParameterCollection.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOParameterCollection.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,77 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOParameterCollection.h"
+#include "IOParameter.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOParameterCollection::IOParameterCollection(ParameterCollection* parameterCollection)
+{
+ this->_parameterCollection = parameterCollection;
+}
+
+void IOParameterCollection::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"ParameterDefinition") // NOXLATE
+ {
+ m_startElemName = name;
+ }
+ else if (m_currElemName == L"Parameter") // NOXLATE
+ {
+ IOParameter* IO = new IOParameter(this->_parameterCollection);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+}
+
+void IOParameterCollection::ElementChars(const wchar_t *ch)
+{
+}
+
+void IOParameterCollection::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_parameterCollection = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOParameterCollection::Write(MdfStream &fd, ParameterCollection* parameterCollection)
+{
+ // always write the element, even if it has 0 elements
+ int numElements = parameterCollection->GetCount();
+
+ fd << tab() << "<ParameterDefinition>" << std::endl; // NOXLATE
+ inctab();
+
+ for (int i=0; i<numElements; ++i)
+ {
+ Parameter* parameter = parameterCollection->GetAt(i);
+ IOParameter::Write(fd, parameter);
+ }
+
+ dectab();
+ fd << tab() << "</ParameterDefinition>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOParameterCollection.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOParameterCollection.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOParameterCollection.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOParameterCollection.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,45 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOPARAMETERCOLLECTION_H
+#define _IOPARAMETERCOLLECTION_H
+
+#include "SAX2ElementHandler.h"
+#include "Parameter.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOParameterCollection : public SAX2ElementHandler
+{
+ public:
+ IOParameterCollection(ParameterCollection* parameterCollection);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, ParameterCollection* parameterCollection);
+
+ private:
+ ParameterCollection* _parameterCollection;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOPARAMETERCOLLECTION_H
Property changes on: trunk/MgDev/Common/MdfParser/IOParameterCollection.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOPath.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOPath.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOPath.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,144 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOPath.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOPath::IOPath(Path* path) : IOGraphicElement(path)
+{
+}
+
+void IOPath::StartPathElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ // the element is a path with the supplied name
+ m_currElemName = name;
+ m_startElemName = name;
+}
+
+void IOPath::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+}
+
+void IOPath::ElementChars(const wchar_t *ch)
+{
+ Path* path = static_cast<Path*>(this->_element);
+
+ IF_STRING_PROPERTY(m_currElemName, path, Geometry, ch)
+ else IF_STRING_PROPERTY(m_currElemName, path, FillColor, ch)
+ else IF_STRING_PROPERTY(m_currElemName, path, LineColor, ch)
+ else IF_STRING_PROPERTY(m_currElemName, path, LineWeight, ch)
+ else IF_STRING_PROPERTY(m_currElemName, path, LineWeightScalable, ch)
+ else IF_STRING_PROPERTY(m_currElemName, path, LineMiterLimit, ch)
+// can't use IF_ENUM_4 since the allowed values don't exactly match the enums
+// else IF_ENUM_4(m_currElemName, path, Path, LineCap, ch, CapNone, CapRound, CapTriangle, CapSquare)
+// else IF_ENUM_4(m_currElemName, path, Path, LineJoin, ch, JoinNone, JoinBevel, JoinRound, JoinMiter)
+ else if (m_currElemName == L"LineCap") // NOXLATE
+ {
+ if (::wcscmp(ch, L"None") == 0) // NOXLATE
+ path->SetLineCap(Path::CapNone);
+ else if (::wcscmp(ch, L"Round") == 0) // NOXLATE
+ path->SetLineCap(Path::CapRound);
+ else if (::wcscmp(ch, L"Triangle") == 0) // NOXLATE
+ path->SetLineCap(Path::CapTriangle);
+ else if (::wcscmp(ch, L"Square") == 0) // NOXLATE
+ path->SetLineCap(Path::CapSquare);
+ }
+ else if (m_currElemName == L"LineJoin")
+ {
+ // can't use IF_ENUM_4 since the allowed values don't exactly match the enums
+ if (::wcscmp(ch, L"None") == 0) // NOXLATE
+ path->SetLineJoin(Path::JoinNone);
+ else if (::wcscmp(ch, L"Bevel") == 0) // NOXLATE
+ path->SetLineJoin(Path::JoinBevel);
+ else if (::wcscmp(ch, L"Round") == 0) // NOXLATE
+ path->SetLineJoin(Path::JoinRound);
+ else if (::wcscmp(ch, L"Miter") == 0) // NOXLATE
+ path->SetLineJoin(Path::JoinMiter);
+ }
+ else IOGraphicElement::ElementChars(ch);
+}
+
+void IOPath::Write(MdfStream &fd, Path* path)
+{
+ IOPath::Write(fd, path, "Path"); // NOXLATE
+}
+
+void IOPath::Write(MdfStream &fd, Path* path, std::string name)
+{
+ fd << tab() << "<" << name << ">" << std::endl;
+ inctab();
+
+ IOGraphicElement::Write(fd, path);
+
+ EMIT_STRING_PROPERTY(fd, path, Geometry, false)
+ EMIT_STRING_PROPERTY(fd, path, FillColor, true)
+ EMIT_STRING_PROPERTY(fd, path, LineColor, true)
+ EMIT_STRING_PROPERTY(fd, path, LineWeight, true)
+ EMIT_STRING_PROPERTY(fd, path, LineWeightScalable, true)
+// can't use EMIT_ENUM_4 since the allowed values don't exactly match the enums
+// EMIT_ENUM_4(fd, path, Path, LineCap, CapNone, CapRound, CapTriangle, CapSquare, 2) // CapRound is default
+// EMIT_ENUM_4(fd, path, Path, LineJoin, JoinNone, JoinBevel, JoinRound, JoinMiter, 3) // JoinRound is default
+ if (path->GetLineCap() != Path::CapRound)
+ {
+ fd << tab() << "<LineCap>"; // NOXLATE
+ switch (path->GetLineCap())
+ {
+ case Path::CapNone:
+ fd << "None"; // NOXLATE
+ break;
+ case Path::CapRound:
+ fd << "Round"; // NOXLATE
+ break;
+ case Path::CapTriangle:
+ fd << "Triangle"; // NOXLATE
+ break;
+ case Path::CapSquare:
+ fd << "Square"; // NOXLATE
+ break;
+ }
+ fd << "</LineCap>" << std::endl; // NOXLATE
+ }
+ if (path->GetLineJoin() != Path::JoinRound)
+ {
+ fd << tab() << "<LineJoin>"; // NOXLATE
+ switch (path->GetLineJoin())
+ {
+ case Path::JoinNone:
+ fd << "None"; // NOXLATE
+ break;
+ case Path::JoinBevel:
+ fd << "Bevel"; // NOXLATE
+ break;
+ case Path::JoinRound:
+ fd << "Round"; // NOXLATE
+ break;
+ case Path::JoinMiter:
+ fd << "Miter"; // NOXLATE
+ break;
+ }
+ fd << "</LineJoin>" << std::endl; // NOXLATE
+ }
+ EMIT_STRING_PROPERTY(fd, path, LineMiterLimit, true)
+
+ dectab();
+ fd << tab() << "</" << name << ">" << std::endl;
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOPath.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOPath.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOPath.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOPath.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,44 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOPATH_H
+#define _IOPATH_H
+
+#include "IOGraphicElement.h"
+#include "Path.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOPath : public IOGraphicElement
+{
+ public:
+ IOPath(Path* path);
+
+ void StartPathElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+
+ static void Write(MdfStream &fd, Path* path);
+ static void Write(MdfStream &fd, Path* path, std::string name);
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOPATH_H
Property changes on: trunk/MgDev/Common/MdfParser/IOPath.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOPointUsage.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOPointUsage.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOPointUsage.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,74 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOPointUsage.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOPointUsage::IOPointUsage(SimpleSymbolDefinition* symbolDefinition)
+{
+ this->_symbolDefinition = symbolDefinition;
+ this->_pointUsage = NULL;
+}
+
+void IOPointUsage::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"PointUsage") // NOXLATE
+ {
+ m_startElemName = name;
+ this->_pointUsage = new PointUsage();
+ }
+}
+
+void IOPointUsage::ElementChars(const wchar_t *ch)
+{
+ IF_ENUM_2(m_currElemName, this->_pointUsage, Usage, AngleControl, ch, FromAngle, FromGeometry)
+ else IF_STRING_PROPERTY(m_currElemName, this->_pointUsage, Angle, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_pointUsage, OriginOffsetX, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_pointUsage, OriginOffsetY, ch)
+}
+
+void IOPointUsage::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_symbolDefinition->AdoptPointUsage(this->_pointUsage);
+ this->_symbolDefinition = NULL;
+ this->_pointUsage = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOPointUsage::Write(MdfStream &fd, PointUsage* pointUsage)
+{
+ fd << tab() << "<PointUsage>" << std::endl; // NOXLATE
+ inctab();
+
+ EMIT_ENUM_2(fd, pointUsage, Usage, AngleControl, FromAngle, FromGeometry, 1) // FromAngle is default
+ EMIT_STRING_PROPERTY(fd, pointUsage, Angle, true)
+ EMIT_STRING_PROPERTY(fd, pointUsage, OriginOffsetX, true)
+ EMIT_STRING_PROPERTY(fd, pointUsage, OriginOffsetY, true)
+
+ dectab();
+ fd << tab() << "</PointUsage>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOPointUsage.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOPointUsage.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOPointUsage.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOPointUsage.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,47 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOPOINTUSAGE_H
+#define _IOPOINTUSAGE_H
+
+#include "SAX2ElementHandler.h"
+#include "SimpleSymbolDefinition.h"
+#include "PointUsage.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOPointUsage : public SAX2ElementHandler
+{
+ public:
+ IOPointUsage(SimpleSymbolDefinition* symbolDefinition);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, PointUsage* pointUsage);
+
+ private:
+ SimpleSymbolDefinition* _symbolDefinition;
+ PointUsage* _pointUsage;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOPOINTUSAGE_H
Property changes on: trunk/MgDev/Common/MdfParser/IOPointUsage.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOResizeBox.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOResizeBox.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOResizeBox.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,80 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOResizeBox.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOResizeBox::IOResizeBox(SimpleSymbolDefinition* symbolDefinition)
+{
+ this->_symbolDefinition = symbolDefinition;
+ this->_resizeBox = NULL;
+}
+
+IOResizeBox::~IOResizeBox()
+{
+}
+
+void IOResizeBox::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"ResizeBox") // NOXLATE
+ {
+ m_startElemName = name;
+ this->_resizeBox = new ResizeBox();
+ }
+}
+
+void IOResizeBox::ElementChars(const wchar_t *ch)
+{
+ IF_STRING_PROPERTY(m_currElemName, this->_resizeBox, PositionX, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_resizeBox, PositionY, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_resizeBox, SizeX, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_resizeBox, SizeY, ch)
+ else IF_ENUM_4(m_currElemName, this->_resizeBox, ResizeBox, GrowControl, ch, GrowInX, GrowInY, GrowInXY, GrowInXYMaintainAspect);
+}
+
+void IOResizeBox::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_symbolDefinition->AdoptResizeBox(this->_resizeBox);
+ this->_symbolDefinition = NULL;
+ this->_resizeBox = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOResizeBox::Write(MdfStream &fd, ResizeBox* resizeBox)
+{
+ fd << tab() << "<ResizeBox>" << std::endl; // NOXLATE
+ inctab();
+
+ EMIT_STRING_PROPERTY(fd, resizeBox, PositionX, false)
+ EMIT_STRING_PROPERTY(fd, resizeBox, PositionY, false)
+ EMIT_STRING_PROPERTY(fd, resizeBox, SizeX, false)
+ EMIT_STRING_PROPERTY(fd, resizeBox, SizeY, false)
+ EMIT_ENUM_4(fd, resizeBox, ResizeBox, GrowControl, GrowInX, GrowInY, GrowInXY, GrowInXYMaintainAspect, 0)
+
+ dectab();
+ fd << tab() << "</ResizeBox>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOResizeBox.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOResizeBox.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOResizeBox.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOResizeBox.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,48 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IORESIZEBOX_H
+#define _IORESIZEBOX_H
+
+#include "SAX2ElementHandler.h"
+#include "SimpleSymbolDefinition.h"
+#include "ResizeBox.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOResizeBox : public SAX2ElementHandler
+{
+ public:
+ IOResizeBox(SimpleSymbolDefinition* symbolDefinition);
+ ~IOResizeBox();
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, ResizeBox* resizeBox);
+
+ private:
+ SimpleSymbolDefinition* _symbolDefinition;
+ ResizeBox* _resizeBox;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IORESIZEBOX_H
Property changes on: trunk/MgDev/Common/MdfParser/IOResizeBox.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOSimpleSymbol.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOSimpleSymbol.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOSimpleSymbol.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,93 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOSimpleSymbol.h"
+#include "IOSimpleSymbolDefinition.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOSimpleSymbol::IOSimpleSymbol(SimpleSymbolCollection* symbolCollection)
+{
+ this->_symbolCollection = symbolCollection;
+ this->_simpleSymbol = NULL;
+}
+
+void IOSimpleSymbol::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"SimpleSymbol") // NOXLATE
+ {
+ m_startElemName = name;
+ this->_simpleSymbol = new SimpleSymbol();
+ }
+ else if (m_currElemName == L"SimpleSymbolDefinition") // NOXLATE
+ {
+ SimpleSymbolDefinition* symbolDefinition = new SimpleSymbolDefinition();
+ this->_simpleSymbol->AdoptSymbolDefinition(symbolDefinition);
+ IOSimpleSymbolDefinition* IO = new IOSimpleSymbolDefinition(symbolDefinition);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+}
+
+void IOSimpleSymbol::ElementChars(const wchar_t *ch)
+{
+// can't use IF_STRING_PROPERTY since the property name doesn't exactly match the element name
+// IF_STRING_PROPERTY(m_currElemName, this->_simpleSymbol, SymbolReference, ch)
+ if (m_currElemName == L"SimpleSymbolReference") // NOXLATE
+ this->_simpleSymbol->SetSymbolReference(ch);
+ else IF_STRING_PROPERTY(m_currElemName, this->_simpleSymbol, RenderingPass, ch)
+}
+
+void IOSimpleSymbol::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_symbolCollection->Adopt(this->_simpleSymbol);
+ this->_symbolCollection = NULL;
+ this->_simpleSymbol = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOSimpleSymbol::Write(MdfStream &fd, SimpleSymbol* simpleSymbol)
+{
+ fd << tab() << "<SimpleSymbol>" << std::endl; // NOXLATE
+ inctab();
+
+ // we must write either a symbol definition or reference, but not both
+ if (simpleSymbol->GetSymbolDefinition())
+ IOSimpleSymbolDefinition::Write(fd, simpleSymbol->GetSymbolDefinition());
+ else
+ {
+// can't use EMIT_STRING_PROPERTY since the property name doesn't exactly match the element name
+// EMIT_STRING_PROPERTY(fd, simpleSymbol, SymbolReference, false)
+ fd << tab() << "<SimpleSymbolReference>"; // NOXLATE
+ fd << EncodeString(simpleSymbol->GetSymbolReference());
+ fd << "</SimpleSymbolReference>" << std::endl; // NOXLATE
+ }
+
+ EMIT_STRING_PROPERTY(fd, simpleSymbol, RenderingPass, true)
+
+ dectab();
+ fd << tab() << "</SimpleSymbol>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOSimpleSymbol.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOSimpleSymbol.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOSimpleSymbol.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOSimpleSymbol.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,46 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOSIMPLESYMBOL_H
+#define _IOSIMPLESYMBOL_H
+
+#include "SAX2ElementHandler.h"
+#include "SimpleSymbol.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOSimpleSymbol : public SAX2ElementHandler
+{
+ public:
+ IOSimpleSymbol(SimpleSymbolCollection* symbolCollection);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, SimpleSymbol* simpleSymbol);
+
+ private:
+ SimpleSymbolCollection* _symbolCollection;
+ SimpleSymbol* _simpleSymbol;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOSIMPLESYMBOL_H
Property changes on: trunk/MgDev/Common/MdfParser/IOSimpleSymbol.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOSimpleSymbolDefinition.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOSimpleSymbolDefinition.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOSimpleSymbolDefinition.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,124 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOSimpleSymbolDefinition.h"
+#include "IOGraphicElementCollection.h"
+#include "IOResizeBox.h"
+#include "IOPointUsage.h"
+#include "IOLineUsage.h"
+#include "IOAreaUsage.h"
+#include "IOParameterCollection.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOSimpleSymbolDefinition::IOSimpleSymbolDefinition(SimpleSymbolDefinition* symbolDefinition)
+{
+ this->_symbolDefinition = symbolDefinition;
+}
+
+void IOSimpleSymbolDefinition::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"SimpleSymbolDefinition") // NOXLATE
+ {
+ m_startElemName = name;
+ }
+ else if (m_currElemName == L"Graphics") // NOXLATE
+ {
+ IOGraphicElementCollection* IO = new IOGraphicElementCollection(this->_symbolDefinition->GetGraphics());
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+ else if (m_currElemName == L"ResizeBox") // NOXLATE
+ {
+ IOResizeBox* IO = new IOResizeBox(this->_symbolDefinition);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+ else if (m_currElemName == L"PointUsage") // NOXLATE
+ {
+ IOPointUsage* IO = new IOPointUsage(this->_symbolDefinition);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+ else if (m_currElemName == L"LineUsage") // NOXLATE
+ {
+ IOLineUsage* IO = new IOLineUsage(this->_symbolDefinition);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+ else if (m_currElemName == L"AreaUsage") // NOXLATE
+ {
+ IOAreaUsage* IO = new IOAreaUsage(this->_symbolDefinition);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+ else if (m_currElemName == L"ParameterDefinition") // NOXLATE
+ {
+ IOParameterCollection* IO = new IOParameterCollection(this->_symbolDefinition->GetParameterDefinition());
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+}
+
+void IOSimpleSymbolDefinition::ElementChars(const wchar_t *ch)
+{
+ IF_STRING_PROPERTY(m_currElemName, this->_symbolDefinition, Name, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_symbolDefinition, Description, ch)
+}
+
+void IOSimpleSymbolDefinition::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_symbolDefinition = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOSimpleSymbolDefinition::Write(MdfStream &fd, SimpleSymbolDefinition* symbolDefinition)
+{
+ fd << tab() << "<SimpleSymbolDefinition>" << std::endl; // NOXLATE
+ inctab();
+
+ EMIT_STRING_PROPERTY(fd, symbolDefinition, Name, false)
+ EMIT_STRING_PROPERTY(fd, symbolDefinition, Description, true)
+
+ IOGraphicElementCollection::Write(fd, symbolDefinition->GetGraphics());
+
+ if (symbolDefinition->GetResizeBox())
+ IOResizeBox::Write(fd, symbolDefinition->GetResizeBox());
+
+ if (symbolDefinition->GetPointUsage())
+ IOPointUsage::Write(fd, symbolDefinition->GetPointUsage());
+
+ if (symbolDefinition->GetLineUsage())
+ IOLineUsage::Write(fd, symbolDefinition->GetLineUsage());
+
+ if (symbolDefinition->GetAreaUsage())
+ IOAreaUsage::Write(fd, symbolDefinition->GetAreaUsage());
+
+ IOParameterCollection::Write(fd, symbolDefinition->GetParameterDefinition());
+
+ dectab();
+ fd << tab() << "</SimpleSymbolDefinition>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOSimpleSymbolDefinition.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOSimpleSymbolDefinition.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOSimpleSymbolDefinition.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOSimpleSymbolDefinition.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,45 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOSIMPLESYMBOLDEFINITION_H
+#define _IOSIMPLESYMBOLDEFINITION_H
+
+#include "SAX2ElementHandler.h"
+#include "SimpleSymbolDefinition.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOSimpleSymbolDefinition : public SAX2ElementHandler
+{
+ public:
+ IOSimpleSymbolDefinition(SimpleSymbolDefinition* symbolDefinition);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, SimpleSymbolDefinition* symbolDefinition);
+
+ private:
+ SimpleSymbolDefinition* _symbolDefinition;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOSIMPLESYMBOLDEFINITION_H
Property changes on: trunk/MgDev/Common/MdfParser/IOSimpleSymbolDefinition.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOSymbolDefinition.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOSymbolDefinition.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOSymbolDefinition.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,95 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOSymbolDefinition.h"
+#include "SimpleSymbolDefinition.h"
+#include "CompoundSymbolDefinition.h"
+#include "IOSimpleSymbolDefinition.h"
+#include "IOCompoundSymbolDefinition.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOSymbolDefinition::IOSymbolDefinition(SymbolInstance* symbolInstance)
+{
+ this->_symbolInstance = symbolInstance;
+ this->_symbolDefinition = NULL;
+}
+
+void IOSymbolDefinition::StartElement(const wchar_t* name, HandlerStack* handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"SymbolDefinition") // NOXLATE
+ {
+ m_startElemName = name;
+ }
+ else if (m_currElemName == L"SimpleSymbolDefinition") // NOXLATE
+ {
+ SimpleSymbolDefinition* simpleSymbol = new SimpleSymbolDefinition();
+ this->_symbolDefinition = simpleSymbol;
+ IOSimpleSymbolDefinition* IO = new IOSimpleSymbolDefinition(simpleSymbol);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+ else if (m_currElemName == L"CompoundSymbolDefinition") // NOXLATE
+ {
+ CompoundSymbolDefinition* compoundSymbol = new CompoundSymbolDefinition();
+ this->_symbolDefinition = compoundSymbol;
+ IOCompoundSymbolDefinition* IO = new IOCompoundSymbolDefinition(compoundSymbol);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+}
+
+void IOSymbolDefinition::ElementChars(const wchar_t *ch)
+{
+}
+
+void IOSymbolDefinition::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_symbolInstance->AdoptSymbolDefinition(this->_symbolDefinition);
+ this->_symbolInstance = NULL;
+ this->_symbolDefinition = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOSymbolDefinition::Write(MdfStream &fd, SymbolDefinition* symbolDefinition, bool writeAsRootElement)
+{
+ if (writeAsRootElement)
+ fd << tab() << "<SymbolDefinition xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xsi:noNamespaceSchemaLocation=\"SymbolDefinition-1.0.0.xsd\">" << std::endl; // NOXLATE
+ else
+ fd << tab() << "<SymbolDefinition>" << std::endl; // NOXLATE
+ inctab();
+
+ SimpleSymbolDefinition* simpleSymbol = dynamic_cast<SimpleSymbolDefinition*>(symbolDefinition);
+ if (simpleSymbol)
+ IOSimpleSymbolDefinition::Write(fd, simpleSymbol);
+
+ CompoundSymbolDefinition* compoundSymbol = dynamic_cast<CompoundSymbolDefinition*>(symbolDefinition);
+ if (compoundSymbol)
+ IOCompoundSymbolDefinition::Write(fd, compoundSymbol);
+
+ dectab();
+ fd << tab() << "</SymbolDefinition>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOSymbolDefinition.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOSymbolDefinition.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOSymbolDefinition.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOSymbolDefinition.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,47 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOSYMBOLDEFINITION_H
+#define _IOSYMBOLDEFINITION_H
+
+#include "SAX2ElementHandler.h"
+#include "SymbolInstance.h"
+#include "SymbolDefinition.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOSymbolDefinition : public SAX2ElementHandler
+{
+ public:
+ IOSymbolDefinition(SymbolInstance* symbolInstance);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, SymbolDefinition* symbolDefinition, bool writeAsRootElement);
+
+ protected:
+ SymbolInstance* _symbolInstance;
+ SymbolDefinition* _symbolDefinition;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOSYMBOLDEFINITION_H
Property changes on: trunk/MgDev/Common/MdfParser/IOSymbolDefinition.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOSymbolInstance.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOSymbolInstance.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOSymbolInstance.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,122 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOSymbolInstance.h"
+#include "IOSymbolDefinition.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOSymbolInstance::IOSymbolInstance(SymbolInstanceCollection* symbolInstanceCollection)
+{
+ this->_symbolInstanceCollection = symbolInstanceCollection;
+}
+
+void IOSymbolInstance::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"SymbolInstance") // NOXLATE
+ {
+ m_startElemName = name;
+ this->_symbolInstance = new SymbolInstance();
+ }
+ else if (m_currElemName == L"SymbolDefinition") // NOXLATE
+ {
+ IOSymbolDefinition* IO = new IOSymbolDefinition(this->_symbolInstance);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+}
+
+void IOSymbolInstance::ElementChars(const wchar_t *ch)
+{
+ IF_STRING_PROPERTY(m_currElemName, this->_symbolInstance, SymbolReference, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_symbolInstance, ScaleX, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_symbolInstance, ScaleY, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_symbolInstance, InsertionOffsetX, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_symbolInstance, InsertionOffsetY, ch)
+// can't use IF_ENUM_2 since the allowed values don't exactly match the enums
+// else IF_ENUM_2(m_currElemName, this->_symbolInstance, MdfModel, SizeContext, ch, DeviceUnits, MappingUnits)
+ else if (m_currElemName == L"SizeContext") // NOXLATE
+ {
+ if (::wcscmp(ch, L"Device") == 0) // NOXLATE
+ this->_symbolInstance->SetSizeContext(MdfModel::DeviceUnits);
+ else if (::wcscmp(ch, L"Mapping") == 0) // NOXLATE
+ this->_symbolInstance->SetSizeContext(MdfModel::MappingUnits);
+ }
+ else IF_STRING_PROPERTY(m_currElemName, this->_symbolInstance, DrawLast, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_symbolInstance, CheckExclusionRegion, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_symbolInstance, AddToExclusionRegion, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_symbolInstance, PositioningAlgorithm, ch)
+}
+
+void IOSymbolInstance::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_symbolInstanceCollection->Adopt(this->_symbolInstance);
+ this->_symbolInstanceCollection = NULL;
+ this->_symbolInstance = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOSymbolInstance::Write(MdfStream &fd, SymbolInstance* symbolInstance)
+{
+ fd << tab() << "<SymbolInstance>" << std::endl; // NOXLATE
+ inctab();
+
+ // we must write either a symbol definition or reference, but not both
+ if (symbolInstance->GetSymbolDefinition())
+ IOSymbolDefinition::Write(fd, symbolInstance->GetSymbolDefinition(), false);
+ else
+ {
+ EMIT_STRING_PROPERTY(fd, symbolInstance, SymbolReference, false)
+ }
+
+ EMIT_STRING_PROPERTY(fd, symbolInstance, ScaleX, true)
+ EMIT_STRING_PROPERTY(fd, symbolInstance, ScaleY, true)
+ EMIT_STRING_PROPERTY(fd, symbolInstance, InsertionOffsetX, true)
+ EMIT_STRING_PROPERTY(fd, symbolInstance, InsertionOffsetY, true)
+// can't use EMIT_ENUM_2 since the allowed values don't exactly match the enums
+// EMIT_ENUM_2(fd, symbolInstance, MdfModel, SizeContext, DeviceUnits, MappingUnits, 1) // DeviceUnits is default
+ if (symbolInstance->GetSizeContext() != MdfModel::DeviceUnits)
+ {
+ fd << tab() << "<SizeContext>"; // NOXLATE
+ switch (symbolInstance->GetSizeContext())
+ {
+ case MdfModel::DeviceUnits:
+ fd << "Device"; // NOXLATE
+ break;
+ case MdfModel::MappingUnits:
+ fd << "Mapping"; // NOXLATE
+ break;
+ }
+ fd << "</SizeContext>" << std::endl; // NOXLATE
+ }
+ EMIT_STRING_PROPERTY(fd, symbolInstance, DrawLast, true)
+ EMIT_STRING_PROPERTY(fd, symbolInstance, CheckExclusionRegion, true)
+ EMIT_STRING_PROPERTY(fd, symbolInstance, AddToExclusionRegion, true)
+ EMIT_STRING_PROPERTY(fd, symbolInstance, PositioningAlgorithm, true)
+
+ dectab();
+ fd << tab() << "</SymbolInstance>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOSymbolInstance.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOSymbolInstance.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOSymbolInstance.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOSymbolInstance.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,46 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOSYMBOLINSTANCE_H
+#define _IOSYMBOLINSTANCE_H
+
+#include "SAX2ElementHandler.h"
+#include "SymbolInstance.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOSymbolInstance : public SAX2ElementHandler
+{
+ public:
+ IOSymbolInstance(SymbolInstanceCollection* symbolInstanceCollection);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, SymbolInstance* symbolInstance);
+
+ private:
+ SymbolInstance* _symbolInstance;
+ SymbolInstanceCollection* _symbolInstanceCollection;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOSYMBOLINSTANCE_H
Property changes on: trunk/MgDev/Common/MdfParser/IOSymbolInstance.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOSymbolInstanceCollection.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOSymbolInstanceCollection.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOSymbolInstanceCollection.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,79 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOSymbolInstanceCollection.h"
+#include "IOSymbolInstance.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOSymbolInstanceCollection::IOSymbolInstanceCollection(SymbolInstanceCollection* instanceCollection)
+{
+ this->_instanceCollection = instanceCollection;
+}
+
+void IOSymbolInstanceCollection::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"SymbolCollection") // NOXLATE
+ {
+ m_startElemName = name;
+ }
+ else if (m_currElemName == L"SymbolInstance") // NOXLATE
+ {
+ IOSymbolInstance* IO = new IOSymbolInstance(this->_instanceCollection);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+}
+
+void IOSymbolInstanceCollection::ElementChars(const wchar_t *ch)
+{
+}
+
+void IOSymbolInstanceCollection::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_instanceCollection = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOSymbolInstanceCollection::Write(MdfStream &fd, SymbolInstanceCollection* instanceCollection)
+{
+ // the schema currently requires at least one instance
+ // TODO: WCW - we should relax this to allow zero instances
+ int numInstances = instanceCollection->GetCount();
+ assert(numInstances > 0);
+
+ fd << tab() << "<SymbolCollection>" << std::endl; // NOXLATE
+ inctab();
+
+ for (int i=0; i<numInstances; ++i)
+ {
+ SymbolInstance* instance = instanceCollection->GetAt(i);
+ IOSymbolInstance::Write(fd, instance);
+ }
+
+ dectab();
+ fd << tab() << "</SymbolCollection>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOSymbolInstanceCollection.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOSymbolInstanceCollection.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOSymbolInstanceCollection.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOSymbolInstanceCollection.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,45 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOSYMBOLINSTANCECOLLECTION_H
+#define _IOSYMBOLINSTANCECOLLECTION_H
+
+#include "SAX2ElementHandler.h"
+#include "SymbolInstance.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOSymbolInstanceCollection : public SAX2ElementHandler
+{
+ public:
+ IOSymbolInstanceCollection(SymbolInstanceCollection* instanceCollection);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, SymbolInstanceCollection* instanceCollection);
+
+ private:
+ SymbolInstanceCollection* _instanceCollection;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOSYMBOLINSTANCECOLLECTION_H
Property changes on: trunk/MgDev/Common/MdfParser/IOSymbolInstanceCollection.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOText.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOText.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOText.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,99 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOText.h"
+#include "IOTextFrame.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOText::IOText(Text* text) : IOGraphicElement(text)
+{
+}
+
+void IOText::StartTextElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ // the element is a text with the supplied name
+ m_currElemName = name;
+ m_startElemName = name;
+}
+
+void IOText::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"Frame") // NOXLATE
+ {
+ Text* text = static_cast<Text*>(this->_element);
+ IOTextFrame* IO = new IOTextFrame(text);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+}
+
+void IOText::ElementChars(const wchar_t *ch)
+{
+ Text* text = static_cast<Text*>(this->_element);
+
+ IF_STRING_PROPERTY(m_currElemName, text, String, ch)
+ else IF_STRING_PROPERTY(m_currElemName, text, FontName, ch)
+ else IF_STRING_PROPERTY(m_currElemName, text, Bold, ch)
+ else IF_STRING_PROPERTY(m_currElemName, text, Italic, ch)
+ else IF_STRING_PROPERTY(m_currElemName, text, Underlined, ch)
+ else IF_STRING_PROPERTY(m_currElemName, text, Height, ch)
+ else IF_STRING_PROPERTY(m_currElemName, text, PositionX, ch)
+ else IF_STRING_PROPERTY(m_currElemName, text, PositionY, ch)
+ else IF_STRING_PROPERTY(m_currElemName, text, Angle, ch)
+ else IF_STRING_PROPERTY(m_currElemName, text, LineSpacing, ch)
+ else IF_STRING_PROPERTY(m_currElemName, text, TextColor, ch)
+ else IF_STRING_PROPERTY(m_currElemName, text, GhostColor, ch)
+ else IF_STRING_PROPERTY(m_currElemName, text, HorizontalAlignment, ch)
+ else IF_STRING_PROPERTY(m_currElemName, text, VerticalAlignment, ch)
+ else IF_STRING_PROPERTY(m_currElemName, text, Justification, ch)
+ else IOGraphicElement::ElementChars(ch);
+}
+
+void IOText::Write(MdfStream &fd, Text* text)
+{
+ fd << tab() << "<Text>" << std::endl; // NOXLATE
+ inctab();
+
+ IOGraphicElement::Write(fd, text);
+
+ EMIT_STRING_PROPERTY(fd, text, String, false)
+ EMIT_STRING_PROPERTY(fd, text, FontName, false)
+ EMIT_STRING_PROPERTY(fd, text, Bold, true)
+ EMIT_STRING_PROPERTY(fd, text, Italic, true)
+ EMIT_STRING_PROPERTY(fd, text, Underlined, true)
+ EMIT_STRING_PROPERTY(fd, text, Height, true)
+ EMIT_STRING_PROPERTY(fd, text, PositionX, true)
+ EMIT_STRING_PROPERTY(fd, text, PositionY, true)
+ EMIT_STRING_PROPERTY(fd, text, Angle, true)
+ EMIT_STRING_PROPERTY(fd, text, HorizontalAlignment, true)
+ EMIT_STRING_PROPERTY(fd, text, VerticalAlignment, true)
+ EMIT_STRING_PROPERTY(fd, text, Justification, true)
+ EMIT_STRING_PROPERTY(fd, text, LineSpacing, true)
+ EMIT_STRING_PROPERTY(fd, text, TextColor, true)
+ EMIT_STRING_PROPERTY(fd, text, GhostColor, true)
+
+ if (text->GetFrame() != NULL)
+ IOTextFrame::Write(fd, text->GetFrame());
+
+ dectab();
+ fd << tab() << "</Text>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOText.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOText.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOText.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOText.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,43 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOTEXT_H
+#define _IOTEXT_H
+
+#include "IOGraphicElement.h"
+#include "Text.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOText : public IOGraphicElement
+{
+ public:
+ IOText(Text* text);
+
+ void StartTextElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+
+ static void Write(MdfStream &fd, Text* text);
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOTEXT_H
Property changes on: trunk/MgDev/Common/MdfParser/IOText.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOTextFrame.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOTextFrame.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOTextFrame.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,78 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOTextFrame.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOTextFrame::IOTextFrame(Text* text)
+{
+ this->_text = text;
+ this->_textFrame = NULL;
+}
+
+IOTextFrame::~IOTextFrame()
+{
+}
+
+void IOTextFrame::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+ if (m_currElemName == L"Frame") // NOXLATE
+ {
+ m_startElemName = name;
+ this->_textFrame = new TextFrame();
+ }
+}
+
+void IOTextFrame::ElementChars(const wchar_t *ch)
+{
+ IF_STRING_PROPERTY(m_currElemName, this->_textFrame, LineColor, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_textFrame, FillColor, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_textFrame, OffsetX, ch)
+ else IF_STRING_PROPERTY(m_currElemName, this->_textFrame, OffsetY, ch)
+}
+
+void IOTextFrame::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ this->_text->AdoptFrame(this->_textFrame);
+ this->_text = NULL;
+ this->_textFrame = NULL;
+ m_startElemName = L"";
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOTextFrame::Write(MdfStream &fd, TextFrame* textFrame)
+{
+ fd << tab() << "<Frame>" << std::endl; // NOXLATE
+ inctab();
+
+ EMIT_STRING_PROPERTY(fd, textFrame, LineColor, true)
+ EMIT_STRING_PROPERTY(fd, textFrame, FillColor, true)
+ EMIT_STRING_PROPERTY(fd, textFrame, OffsetX, true)
+ EMIT_STRING_PROPERTY(fd, textFrame, OffsetY, true)
+
+ dectab();
+ fd << tab() << "</Frame>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOTextFrame.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOTextFrame.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOTextFrame.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOTextFrame.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,48 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOTEXTFRAME_H
+#define _IOTEXTFRAME_H
+
+#include "SAX2ElementHandler.h"
+#include "Text.h"
+#include "TextFrame.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOTextFrame : public SAX2ElementHandler
+{
+ public:
+ IOTextFrame(Text* text);
+ ~IOTextFrame();
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, TextFrame* textFrame);
+
+ private:
+ Text* _text;
+ TextFrame* _textFrame;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOTEXTFRAME_H
Property changes on: trunk/MgDev/Common/MdfParser/IOTextFrame.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOValueList.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOValueList.cpp (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOValueList.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,76 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "stdafx.h"
+#include "IOValueList.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+using namespace MDFPARSER_NAMESPACE;
+
+IOValueList::IOValueList(ValueList* valueList)
+{
+ this->_valueList = valueList;
+}
+
+void IOValueList::StartElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ m_currElemName = name;
+
+ if (m_currElemName == L"ValueList") // NOXLATE
+ {
+ m_startElemName = name;
+ }
+}
+
+void IOValueList::ElementChars(const wchar_t *ch)
+{
+ if (m_currElemName == L"Value") // NOXLATE
+ {
+ MdfString* sValue = new MdfString(ch);
+ this->_valueList->Adopt(sValue);
+ }
+}
+
+void IOValueList::EndElement(const wchar_t *name, HandlerStack *handlerStack)
+{
+ if (m_startElemName == name)
+ {
+ handlerStack->pop();
+ delete this;
+ }
+}
+
+void IOValueList::Write(MdfStream &fd, ValueList* valueList)
+{
+ // don't output the list if it's empty - the schema requires this
+ int numElements = valueList->GetCount();
+ if (numElements == 0)
+ return;
+
+ fd << tab() << "<ValueList>" << std::endl; // NOXLATE
+ inctab();
+
+ for (int i=0; i<numElements; ++i)
+ {
+ MdfString* sValue = valueList->GetAt(i);
+ fd << tab() << "<Value>" << EncodeString(*sValue) << "</Value>" << std::endl; // NOXLATE
+ }
+
+ dectab();
+ fd << tab() << "</ValueList>" << std::endl; // NOXLATE
+}
Property changes on: trunk/MgDev/Common/MdfParser/IOValueList.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/MgDev/Common/MdfParser/IOValueList.h
===================================================================
--- trunk/MgDev/Common/MdfParser/IOValueList.h (rev 0)
+++ trunk/MgDev/Common/MdfParser/IOValueList.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -0,0 +1,45 @@
+//
+// Copyright (C) 2007 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _IOVALUELIST_H
+#define _IOVALUELIST_H
+
+#include "SAX2ElementHandler.h"
+#include "Parameter.h"
+
+using namespace XERCES_CPP_NAMESPACE;
+using namespace MDFMODEL_NAMESPACE;
+
+BEGIN_NAMESPACE_MDFPARSER
+
+class IOValueList : public SAX2ElementHandler
+{
+ public:
+ IOValueList(ValueList* valueList);
+
+ virtual void StartElement(const wchar_t *name, HandlerStack *handlerStack);
+ virtual void ElementChars(const wchar_t *ch);
+ virtual void EndElement(const wchar_t *name, HandlerStack *handlerStack);
+
+ static void Write(MdfStream &fd, ValueList* valueList);
+
+ private:
+ ValueList* _valueList;
+};
+
+END_NAMESPACE_MDFPARSER
+#endif // _IOVALUELIST_H
Property changes on: trunk/MgDev/Common/MdfParser/IOValueList.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/MgDev/Common/MdfParser/IOVectorLayerDefinition.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOVectorLayerDefinition.cpp 2007-03-06 01:18:33 UTC (rev 1152)
+++ trunk/MgDev/Common/MdfParser/IOVectorLayerDefinition.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -147,7 +147,7 @@
void IOVectorLayerDefinition::Write(MdfStream &fd, VectorLayerDefinition *featureLayer)
{
- fd << tab() << "<LayerDefinition xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xsi:noNamespaceSchemaLocation=\"LayerDefinition-1.0.0.xsd\" version=\"1.0.0\">" << std::endl; // NOXLATE
+ fd << tab() << "<LayerDefinition xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xsi:noNamespaceSchemaLocation=\"LayerDefinition-1.1.0.xsd\" version=\"1.1.0\">" << std::endl; // NOXLATE
inctab();
fd << tab() << startStr(sVectorLayerDefinition) << std::endl;
Modified: trunk/MgDev/Common/MdfParser/IOVectorScaleRange.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/IOVectorScaleRange.cpp 2007-03-06 01:18:33 UTC (rev 1152)
+++ trunk/MgDev/Common/MdfParser/IOVectorScaleRange.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -20,6 +20,7 @@
#include "IOAreaTypeStyle.h"
#include "IOLineTypeStyle.h"
#include "IOPointTypeStyle.h"
+#include "IOCompositeTypeStyle.h"
#include "IFeatureTypeStyleVisitor.h"
using namespace XERCES_CPP_NAMESPACE;
@@ -31,8 +32,9 @@
ELEM_MAP_ENTRY(2, AreaTypeStyle);
ELEM_MAP_ENTRY(3, LineTypeStyle);
ELEM_MAP_ENTRY(4, PointTypeStyle);
-ELEM_MAP_ENTRY(5, MinScale);
-ELEM_MAP_ENTRY(6, MaxScale);
+ELEM_MAP_ENTRY(5, CompositeTypeStyle);
+ELEM_MAP_ENTRY(6, MinScale);
+ELEM_MAP_ENTRY(7, MaxScale);
IOVectorScaleRange::IOVectorScaleRange()
{
@@ -86,6 +88,14 @@
}
break;
+ case eCompositeTypeStyle:
+ {
+ IOCompositeTypeStyle *IO = new IOCompositeTypeStyle(this->_scaleRange);
+ handlerStack->push(IO);
+ IO->StartElement(name, handlerStack);
+ }
+ break;
+
case eUnknown:
ParseUnknownXml(name, handlerStack);
break;
@@ -111,10 +121,10 @@
this->_scaleRange->SetUnknownXml(UnknownXml());
this->layer->GetScaleRanges()->Adopt(this->_scaleRange);
- handlerStack->pop();
this->layer = NULL;
this->_scaleRange = NULL;
m_startElemName = L"";
+ handlerStack->pop();
delete this;
}
}
@@ -161,12 +171,16 @@
IO->Write(fd, dynamic_cast<PointTypeStyle*>(scaleRange->GetFeatureTypeStyles()->GetAt(x)));
delete IO;
}
+ else if (dynamic_cast<CompositeTypeStyle*>(scaleRange->GetFeatureTypeStyles()->GetAt(x)) != 0)
+ {
+ IOCompositeTypeStyle::Write(fd, dynamic_cast<CompositeTypeStyle*>(scaleRange->GetFeatureTypeStyles()->GetAt(x)));
+ }
}
// Write any previously found unknown XML
if (!scaleRange->GetUnknownXml().empty())
{
- fd << toCString(scaleRange->GetUnknownXml());
+ fd << toCString(scaleRange->GetUnknownXml());
}
dectab();
Modified: trunk/MgDev/Common/MdfParser/Makefile.am
===================================================================
--- trunk/MgDev/Common/MdfParser/Makefile.am 2007-03-06 01:18:33 UTC (rev 1152)
+++ trunk/MgDev/Common/MdfParser/Makefile.am 2007-03-06 01:21:27 UTC (rev 1153)
@@ -13,6 +13,7 @@
IOAreaRule.cpp \
IOAreaSymbolization2D.cpp \
IOAreaTypeStyle.cpp \
+ IOAreaUsage.cpp \
IOAttributeRelate.cpp \
IOBaseMapDefinition.cpp \
IOBaseMapLayer.cpp \
@@ -20,12 +21,18 @@
IOBlockSymbol.cpp \
IOCalculatedProperty.cpp \
IOChannelBand.cpp \
+ IOCompositeRule.cpp \
+ IOCompositeSymbolization.cpp \
+ IOCompositeTypeStyle.cpp \
+ IOCompoundSymbolDefinition.cpp \
IODrawingLayerDefinition.cpp \
IOExtension.cpp \
IOExtra.cpp \
IOFeatureSource.cpp \
IOFill.cpp \
IOFontSymbol.cpp \
+ IOGraphicElement.cpp \
+ IOGraphicElementCollection.cpp \
IOGridColor.cpp \
IOGridColorBands.cpp \
IOGridColorRule.cpp \
@@ -34,11 +41,13 @@
IOGridScaleRange.cpp \
IOGridSurfaceStyle.cpp \
IOHillShade.cpp \
+ IOImage.cpp \
IOImageSymbol.cpp \
IOLabel.cpp \
IOLineRule.cpp \
IOLineSymbolization2D.cpp \
IOLineTypeStyle.cpp \
+ IOLineUsage.cpp \
IOMapDefinition.cpp \
IOMapLayer.cpp \
IOMapLayerCommon.cpp \
@@ -46,16 +55,31 @@
IOMapLayerGroupCommon.cpp \
IOMarkSymbol.cpp \
IONameStringPair.cpp \
+ IOOverride.cpp \
+ IOOverrideCollection.cpp \
+ IOParameter.cpp \
+ IOParameterCollection.cpp \
+ IOPath.cpp \
IOPointRule.cpp \
IOPointSymbolization2D.cpp \
IOPointTypeStyle.cpp \
+ IOPointUsage.cpp \
IORelateProperty.cpp \
+ IOResizeBox.cpp \
IOResourceRef.cpp \
+ IOSimpleSymbol.cpp \
+ IOSimpleSymbolDefinition.cpp \
IOStroke.cpp \
IOSupplementalSpatialContextInfo.cpp \
IOSymbol.cpp \
+ IOSymbolDefinition.cpp \
+ IOSymbolInstance.cpp \
+ IOSymbolInstanceCollection.cpp \
+ IOText.cpp \
+ IOTextFrame.cpp \
IOUnknown.cpp \
IOUtil.cpp \
+ IOValueList.cpp \
IOVectorLayerDefinition.cpp \
IOVectorScaleRange.cpp \
IOW2DSymbol.cpp \
@@ -68,6 +92,7 @@
IOAreaRule.h \
IOAreaSymbolization2D.h \
IOAreaTypeStyle.h \
+ IOAreaUsage.h \
IOAttributeRelate.h \
IOBaseMapDefinition.h \
IOBaseMapLayer.h \
@@ -75,12 +100,18 @@
IOBlockSymbol.h \
IOCalculatedProperty.h \
IOChannelBand.h \
+ IOCompositeRule.h \
+ IOCompositeSymbolization.h \
+ IOCompositeTypeStyle.h \
+ IOCompoundSymbolDefinition.h \
IODrawingLayerDefinition.h \
IOExtension.h \
IOExtra.h \
IOFeatureSource.h \
IOFill.h \
IOFontSymbol.h \
+ IOGraphicElement.h \
+ IOGraphicElementCollection.h \
IOGridColor.h \
IOGridColorRule.h \
IOGridColorStyle.h \
@@ -88,11 +119,13 @@
IOGridScaleRange.h \
IOGridSurfaceStyle.h \
IOHillShade.h \
+ IOImage.h \
IOImageSymbol.h \
IOLabel.h \
IOLineRule.h \
IOLineSymbolization2D.h \
IOLineTypeStyle.h \
+ IOLineUsage.h \
IOMapDefinition.h \
IOMapLayer.h \
IOMapLayerCommon.h \
@@ -100,16 +133,31 @@
IOMapLayerGroupCommon.h \
IOMarkSymbol.h \
IONameStringPair.h \
+ IOOverride.h \
+ IOOverrideCollection.h \
+ IOParameter.h \
+ IOParameterCollection.h \
+ IOPath.h \
IOPointRule.h \
IOPointSymbolization2D.h \
IOPointTypeStyle.h \
+ IOPointUsage.h \
IORelateProperty.h \
+ IOResizeBox.h \
IOResourceRef.h \
+ IOSimpleSymbol.h \
+ IOSimpleSymbolDefinition.h \
IOStroke.h \
IOSupplementalSpatialContextInfo.h \
IOSymbol.h \
+ IOSymbolDefinition.h \
+ IOSymbolInstance.h \
+ IOSymbolInstanceCollection.h \
+ IOText.h \
+ IOTextFrame.h \
IOUnknown.h \
IOUtil.h \
+ IOValueList.h \
IOVectorLayerDefinition.h \
IOVectorScaleRange.h \
IOW2DSymbol.h \
Modified: trunk/MgDev/Common/MdfParser/MdfParser.vcproj
===================================================================
--- trunk/MgDev/Common/MdfParser/MdfParser.vcproj 2007-03-06 01:18:33 UTC (rev 1152)
+++ trunk/MgDev/Common/MdfParser/MdfParser.vcproj 2007-03-06 01:21:27 UTC (rev 1153)
@@ -216,6 +216,14 @@
>
</File>
<File
+ RelativePath=".\IOAreaUsage.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOAreaUsage.h"
+ >
+ </File>
+ <File
RelativePath=".\IOAttributeRelate.cpp"
>
</File>
@@ -272,6 +280,38 @@
>
</File>
<File
+ RelativePath=".\IOCompositeRule.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOCompositeRule.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IOCompositeSymbolization.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOCompositeSymbolization.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IOCompositeTypeStyle.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOCompositeTypeStyle.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IOCompoundSymbolDefinition.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOCompoundSymbolDefinition.h"
+ >
+ </File>
+ <File
RelativePath=".\IODrawingLayerDefinition.cpp"
>
</File>
@@ -320,6 +360,22 @@
>
</File>
<File
+ RelativePath=".\IOGraphicElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOGraphicElement.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IOGraphicElementCollection.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOGraphicElementCollection.h"
+ >
+ </File>
+ <File
RelativePath=".\IOGridColor.cpp"
>
</File>
@@ -380,6 +436,14 @@
>
</File>
<File
+ RelativePath=".\IOImage.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOImage.h"
+ >
+ </File>
+ <File
RelativePath=".\IOImageSymbol.cpp"
>
</File>
@@ -420,6 +484,14 @@
>
</File>
<File
+ RelativePath=".\IOLineUsage.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOLineUsage.h"
+ >
+ </File>
+ <File
RelativePath=".\IOMapDefinition.cpp"
>
</File>
@@ -476,6 +548,46 @@
>
</File>
<File
+ RelativePath=".\IOOverride.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOOverride.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IOOverrideCollection.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOOverrideCollection.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IOParameter.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOParameter.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IOParameterCollection.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOParameterCollection.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IOPath.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOPath.h"
+ >
+ </File>
+ <File
RelativePath=".\IOPointRule.cpp"
>
</File>
@@ -500,6 +612,14 @@
>
</File>
<File
+ RelativePath=".\IOPointUsage.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOPointUsage.h"
+ >
+ </File>
+ <File
RelativePath=".\IORelateProperty.cpp"
>
</File>
@@ -508,6 +628,14 @@
>
</File>
<File
+ RelativePath=".\IOResizeBox.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOResizeBox.h"
+ >
+ </File>
+ <File
RelativePath=".\IOResourceRef.cpp"
>
</File>
@@ -516,6 +644,22 @@
>
</File>
<File
+ RelativePath=".\IOSimpleSymbol.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOSimpleSymbol.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IOSimpleSymbolDefinition.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOSimpleSymbolDefinition.h"
+ >
+ </File>
+ <File
RelativePath="IOStroke.cpp"
>
</File>
@@ -540,6 +684,46 @@
>
</File>
<File
+ RelativePath=".\IOSymbolDefinition.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOSymbolDefinition.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IOSymbolInstance.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOSymbolInstance.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IOSymbolInstanceCollection.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOSymbolInstanceCollection.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IOText.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOText.h"
+ >
+ </File>
+ <File
+ RelativePath=".\IOTextFrame.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOTextFrame.h"
+ >
+ </File>
+ <File
RelativePath=".\IOUnknown.cpp"
>
</File>
@@ -556,6 +740,14 @@
>
</File>
<File
+ RelativePath=".\IOValueList.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\IOValueList.h"
+ >
+ </File>
+ <File
RelativePath=".\IOVectorLayerDefinition.cpp"
>
</File>
Modified: trunk/MgDev/Common/MdfParser/SAX2Parser.cpp
===================================================================
--- trunk/MgDev/Common/MdfParser/SAX2Parser.cpp 2007-03-06 01:18:33 UTC (rev 1152)
+++ trunk/MgDev/Common/MdfParser/SAX2Parser.cpp 2007-03-06 01:21:27 UTC (rev 1153)
@@ -18,10 +18,13 @@
#include "stdafx.h"
#include "SAX2Parser.h"
#include <assert.h>
+#include "IOMapDefinition.h"
+#include "IOVectorLayerDefinition.h"
#include "IODrawingLayerDefinition.h"
-#include "IOVectorLayerDefinition.h"
#include "IOGridLayerDefinition.h"
-#include "IOMapDefinition.h"
+#include "IOSymbolDefinition.h"
+#include "IOSimpleSymbolDefinition.h"
+#include "IOCompoundSymbolDefinition.h"
#include "UnicodeString.h"
using namespace XERCES_CPP_NAMESPACE;
@@ -70,6 +73,10 @@
delete m_dLayer;
if (m_gLayer != NULL)
delete m_gLayer;
+ if (m_sSymbol != NULL)
+ delete m_sSymbol;
+ if (m_cSymbol != NULL)
+ delete m_cSymbol;
}
@@ -79,6 +86,8 @@
m_vLayer = NULL;
m_dLayer = NULL;
m_gLayer = NULL;
+ m_sSymbol = NULL;
+ m_cSymbol = NULL;
m_succeeded = false;
}
@@ -120,7 +129,7 @@
}
-// Returns a reference to the parser's feature layer definition
+// Returns a reference to the parser's vector layer definition
// After this call the parser no longer owns the object.
VectorLayerDefinition* SAX2Parser::DetachVectorLayerDefinition()
{
@@ -150,32 +159,57 @@
}
-// Returns a reference to the parser's grid layer definition
+// Returns a reference to the parser's layer definition
// After this call the parser no longer owns the object.
LayerDefinition* SAX2Parser::DetachLayerDefinition()
{
- LayerDefinition* ldef = NULL;
-
if (m_vLayer)
- {
- ldef = m_vLayer;
- m_vLayer = NULL;
- }
- else if (m_gLayer)
- {
- ldef = m_gLayer;
- m_gLayer = NULL;
- }
- else if (m_dLayer)
- {
- ldef = m_dLayer;
- m_dLayer = NULL;
- }
+ return DetachVectorLayerDefinition();
- return ldef;
+ if (m_dLayer)
+ return DetachDrawingLayerDefinition();
+
+ if (m_gLayer)
+ return DetachGridLayerDefinition();
+
+ return NULL;
}
+// Returns a reference to the parser's simple symbol definition
+// After this call the parser no longer owns the object.
+SimpleSymbolDefinition* SAX2Parser::DetachSimpleSymbolDefinition()
+{
+ SimpleSymbolDefinition* ret = m_sSymbol;
+ m_sSymbol= NULL;
+ return ret;
+}
+
+
+// Returns a reference to the parser's compound symbol definition
+// After this call the parser no longer owns the object.
+CompoundSymbolDefinition* SAX2Parser::DetachCompoundSymbolDefinition()
+{
+ CompoundSymbolDefinition* ret = m_cSymbol;
+ m_cSymbol= NULL;
+ return ret;
+}
+
+
+// Returns a reference to the parser's symbol definition
+// After this call the parser no longer owns the object.
+SymbolDefinition* SAX2Parser::DetachSymbolDefinition()
+{
+ if (m_sSymbol)
+ return DetachSimpleSymbolDefinition();
+
+ if (m_cSymbol)
+ return DetachCompoundSymbolDefinition();
+
+ return NULL;
+}
+
+
bool SAX2Parser::GetSucceeded()
{
return m_succeeded;
@@ -252,14 +286,41 @@
if(fd.is_open())
{
zerotab();
- fd << tab() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl << std::endl; // NOXLATE
- inctab();
+ fd << tab() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl; // NOXLATE
WriteDefinition(fd, map, vLayer, dLayer, gLayer);
}
fd.close();
}
+void SAX2Parser::WriteToFile(std::string name, SymbolDefinition* pSymbol)
+{
+ std::ofstream fd;
+ fd.open(name.c_str());
+ if(fd.is_open())
+ {
+ zerotab();
+ fd << tab() << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl; // NOXLATE
+ IOSymbolDefinition::Write(fd, pSymbol, true);
+ }
+ fd.close();
+}
+
+
+std::string SAX2Parser::SerializeToXML(MapDefinition *pMap)
+{
+ MdfStringStream fd;
+
+ if (NULL != pMap)
+ {
+ std::auto_ptr<IOMapDefinition> spIO(new IOMapDefinition());
+ spIO->Write(fd, pMap);
+ }
+
+ return fd.str();
+}
+
+
std::string SAX2Parser::SerializeToXML(LayerDefinition *pLayer)
{
MdfStringStream fd;
@@ -287,19 +348,23 @@
return fd.str();
}
-std::string SAX2Parser::SerializeToXML(MapDefinition *pMap)
+
+std::string SAX2Parser::SerializeToXML(SymbolDefinition *pSymbol)
{
MdfStringStream fd;
- if (NULL != pMap)
- {
- std::auto_ptr<IOMapDefinition> spIO(new IOMapDefinition());
- spIO->Write(fd, pMap);
- }
+ SimpleSymbolDefinition* pSimpleSymbol = dynamic_cast<SimpleSymbolDefinition*>(pSymbol);
+ CompoundSymbolDefinition* pCompoundSymbol = dynamic_cast<CompoundSymbolDefinition*>(pSymbol);
+ if (NULL != pSimpleSymbol)
+ IOSimpleSymbolDefinition::Write(fd, pSimpleSymbol);
+ else if (NULL != pCompoundSymbol)
+ IOCompoundSymbolDefinition::Write(fd, pCompoundSymbol);
+
return fd.str();
}
+
void SAX2Parser::WriteDefinition(MdfStream &fd,
MapDefinition* map,
VectorLayerDefinition* vLayer,
@@ -352,7 +417,7 @@
if (str == L"MapDefinition") // NOXLATE
{
assert(m_Map == NULL); // otherwise we leak
- m_Map = new MapDefinition(L"", L""); // NOXLATE
+ m_Map = new MapDefinition(L"", L"");
IOMapDefinition* IO = new IOMapDefinition(m_Map);
m_HandlerStack->push(IO);
IO->StartElement(str.c_str(), m_HandlerStack);
@@ -360,10 +425,10 @@
else if (str == L"VectorLayerDefinition") // NOXLATE
{
assert(m_vLayer == NULL); // otherwise we leak
- m_vLayer = new VectorLayerDefinition(L"", L""); // NOXLATE
+ m_vLayer = new VectorLayerDefinition(L"", L"");
IOVectorLayerDefinition* IO = new IOVectorLayerDefinition(m_vLayer);
m_HandlerStack->push(IO);
- IO->StartElement(str.c_str(), m_HandlerStack); // NOXLATE
+ IO->StartElement(str.c_str(), m_HandlerStack);
}
else if (str == L"DrawingLayerDefinition") // NOXLATE
{
@@ -375,11 +440,28 @@
}
else if (str == L"GridLayerDefinition") // NOXLATE
{
+ assert(m_gLayer == NULL); // otherwise we leak
m_gLayer = new GridLayerDefinition(L"");
- IOGridLayerDefinition * IO = new IOGridLayerDefinition(m_gLayer);
+ IOGridLayerDefinition* IO = new IOGridLayerDefinition(m_gLayer);
m_HandlerStack->push(IO);
IO->StartElement(str.c_str(), m_HandlerStack);
}
+ else if (str == L"SimpleSymbolDefinition") // NOXLATE
+ {
+ assert(m_sSymbol == NULL); // otherwise we leak
+ m_sSymbol = new SimpleSymbolDefinition();
+ IOSimpleSymbolDefinition* IO = new IOSimpleSymbolDefinition(m_sSymbol);
+ m_HandlerStack->push(IO);
+ IO->StartElement(str.c_str(), m_HandlerStack);
+ }
+ else if (str == L"CompoundSymbolDefinition") // NOXLATE
+ {
+ assert(m_cSymbol == NULL); // otherwise we leak
+ m_cSymbol = new CompoundSymbolDefinition();
+ IOCompoundSymbolDefinition* IO = new IOCompoundSymbolDefinition(m_cSymbol);
+ m_HandlerStack->push(IO);
+ IO->StartElement(str.c_str(), m_HandlerStack);
+ }
}
// Otherwise, if the stack has items on it, just pass the event through.
else
@@ -423,6 +505,7 @@
return this->m_strParserError;
}
+
LayerDefinition* SAX2Parser::GetLayerDefinition() const
{
if (NULL != m_vLayer)
@@ -435,6 +518,21 @@
return NULL;
}
+
+MapDefinition* SAX2Parser::CreateClone(MapDefinition *pSourceMD)
+{
+ _ASSERT(NULL != pSourceMD);
+ if (NULL == pSourceMD)
+ return NULL;
+
+ SAX2Parser parser;
+ std::string xmlOfMD = parser.SerializeToXML(pSourceMD);
+ parser.ParseString(xmlOfMD.c_str(), xmlOfMD.size());
+
+ return parser.DetachMapDefinition();
+}
+
+
LayerDefinition* SAX2Parser::CreateClone(LayerDefinition *pSourceLD)
{
_ASSERT(NULL != pSourceLD);
@@ -442,23 +540,22 @@
return NULL;
SAX2Parser parser;
-
std::string xmlOfLD = parser.SerializeToXML(pSourceLD);
parser.ParseString(xmlOfLD.c_str(), xmlOfLD.size());
return parser.DetachLayerDefinition();
}
-MapDefinition* SAX2Parser::CreateClone(MapDefinition *pSourceMD)
+
+SymbolDefinition* SAX2Parser::CreateClone(SymbolDefinition *pSourceSD)
{
- _ASSERT(NULL != pSourceMD);
- if (NULL == pSourceMD)
+ _ASSERT(NULL != pSourceSD);
+ if (NULL == pSourceSD)
return NULL;
SAX2Parser parser;
+ std::string xmlOfSD = parser.SerializeToXML(pSourceSD);
+ parser.ParseString(xmlOfSD.c_str(), xmlOfSD.size());
- std::string xmlOfMD = parser.SerializeToXML(pSourceMD);
- parser.ParseString(xmlOfMD.c_str(), xmlOfMD.size());
-
- return parser.DetachMapDefinition();
+ return parser.DetachSymbolDefinition();
}
Modified: trunk/MgDev/Common/MdfParser/SAX2Parser.h
===================================================================
--- trunk/MgDev/Common/MdfParser/SAX2Parser.h 2007-03-06 01:18:33 UTC (rev 1152)
+++ trunk/MgDev/Common/MdfParser/SAX2Parser.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -22,6 +22,8 @@
#include "VectorLayerDefinition.h"
#include "DrawingLayerDefinition.h"
#include "GridLayerDefinition.h"
+#include "SimpleSymbolDefinition.h"
+#include "CompoundSymbolDefinition.h"
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/TransService.hpp>
#include <xercesc/sax2/SAX2XMLReader.hpp>
@@ -52,6 +54,8 @@
VectorLayerDefinition* m_vLayer;
DrawingLayerDefinition* m_dLayer;
GridLayerDefinition* m_gLayer;
+ SimpleSymbolDefinition* m_sSymbol;
+ CompoundSymbolDefinition* m_cSymbol;
// Succeeded is true if the parse has succeeded. As of now,
// there are very loose constraints on this boolean.
@@ -100,9 +104,11 @@
VectorLayerDefinition *vLayer,
DrawingLayerDefinition *dLayer,
GridLayerDefinition *gLayer);
+ void WriteToFile(std::string name, SymbolDefinition* pSymbol);
+ std::string SerializeToXML(MapDefinition *pMap);
std::string SerializeToXML(LayerDefinition *pLayer);
- std::string SerializeToXML(MapDefinition *pMap);
+ std::string SerializeToXML(SymbolDefinition *pSymbol);
// there are two modes for retrieving objects created by parsing:
@@ -114,6 +120,9 @@
DrawingLayerDefinition* DetachDrawingLayerDefinition();
GridLayerDefinition* DetachGridLayerDefinition();
LayerDefinition* DetachLayerDefinition();
+ SimpleSymbolDefinition* DetachSimpleSymbolDefinition();
+ CompoundSymbolDefinition* DetachCompoundSymbolDefinition();
+ SymbolDefinition* DetachSymbolDefinition();
// DEPRECATED - these methods should not be used and should be removed.
// they return the last parsed object of a given type, but ownership of
@@ -124,10 +133,11 @@
DrawingLayerDefinition *GetDrawingLayerDefinition() { return this->m_dLayer; }
GridLayerDefinition *GetGridLayerDefinition() { return this->m_gLayer; }
- // creates a clone of the given map/layer definition.
+ // creates a clone of the given map/layer/symbol definition.
// the definition is serialized and parsed into a new object, which is returned.
+ static MapDefinition* CreateClone(MapDefinition *pSourceMD);
static LayerDefinition* CreateClone(LayerDefinition *pSourceLD);
- static MapDefinition* CreateClone(MapDefinition *pSourceMD);
+ static SymbolDefinition* CreateClone(SymbolDefinition *pSourceSD);
bool GetSucceeded();
@@ -144,7 +154,7 @@
const XMLCh* const localname,
const XMLCh* const qname);
- // Occurs when the characters in between XML tags is encountered.
+ // Occurs when characters in between XML tags are encountered.
void characters(const XMLCh* const chars, const unsigned int length);
// get error info
Modified: trunk/MgDev/Common/MdfParser/stdafx.h
===================================================================
--- trunk/MgDev/Common/MdfParser/stdafx.h 2007-03-06 01:18:33 UTC (rev 1152)
+++ trunk/MgDev/Common/MdfParser/stdafx.h 2007-03-06 01:21:27 UTC (rev 1153)
@@ -51,4 +51,226 @@
#include "MdfParser.h"
#include "IOUtil.h"
+#define EMIT_STRING_PROPERTY(stream, object, prop, optional) \
+ if (!optional || object->Get##prop().size() > 0) \
+ { \
+ stream << tab() << "<" #prop ">"; \
+ stream << EncodeString(object->Get##prop()); \
+ stream << "</" #prop ">" << std::endl; \
+ }
+
+#define EMIT_DOUBLE_PROPERTY(stream, object, prop) \
+ stream << tab() << "<" #prop ">"; \
+ stream << DoubleToStr(object->Get##prop()); \
+ stream << "</" #prop ">" << std::endl;
+
+#define EMIT_INTEGER_PROPERTY(stream, object, prop) \
+ stream << tab() << "<" #prop ">"; \
+ stream << IntToStr(object->Get##prop()); \
+ stream << "</" #prop ">" << std::endl;
+
+#define EMIT_ENUM_2(stream, object, enumtype, prop, e1, e2, optIdx) \
+ enumtype::prop propVal##prop = object->Get##prop(); \
+ bool emit##prop = true; \
+ switch (optIdx) \
+ { \
+ case 1: \
+ emit##prop = (propVal##prop != enumtype::e1); \
+ break; \
+ case 2: \
+ emit##prop = (propVal##prop != enumtype::e2); \
+ break; \
+ } \
+ if (emit##prop) \
+ { \
+ stream << tab() << "<" #prop ">"; \
+ switch (propVal##prop) \
+ { \
+ case enumtype::e1: \
+ stream << #e1; \
+ break; \
+ case enumtype::e2: \
+ stream << #e2; \
+ break; \
+ } \
+ stream << "</" #prop ">" << std::endl; \
+ }
+
+#define EMIT_ENUM_3(stream, object, enumtype, prop, e1, e2, e3, optIdx) \
+ enumtype::prop propVal##prop = object->Get##prop(); \
+ bool emit##prop = true; \
+ switch (optIdx) \
+ { \
+ case 1: \
+ emit##prop = (propVal##prop != enumtype::e1); \
+ break; \
+ case 2: \
+ emit##prop = (propVal##prop != enumtype::e2); \
+ break; \
+ case 3: \
+ emit##prop = (propVal##prop != enumtype::e3); \
+ break; \
+ } \
+ if (emit##prop) \
+ { \
+ stream << tab() << "<" #prop ">"; \
+ switch (propVal##prop) \
+ { \
+ case enumtype::e1: \
+ stream << #e1; \
+ break; \
+ case enumtype::e2: \
+ stream << #e2; \
+ break; \
+ case enumtype::e3: \
+ stream << #e3; \
+ break; \
+ } \
+ stream << "</" #prop ">" << std::endl; \
+ }
+
+#define EMIT_ENUM_4(stream, object, enumtype, prop, e1, e2, e3, e4, optIdx) \
+ enumtype::prop propVal##prop = object->Get##prop(); \
+ bool emit##prop = true; \
+ switch (optIdx) \
+ { \
+ case 1: \
+ emit##prop = (propVal##prop != enumtype::e1); \
+ break; \
+ case 2: \
+ emit##prop = (propVal##prop != enumtype::e2); \
+ break; \
+ case 3: \
+ emit##prop = (propVal##prop != enumtype::e3); \
+ break; \
+ case 4: \
+ emit##prop = (propVal##prop != enumtype::e4); \
+ break; \
+ } \
+ if (emit##prop) \
+ { \
+ stream << tab() << "<" #prop ">"; \
+ switch (propVal##prop) \
+ { \
+ case enumtype::e1: \
+ stream << #e1; \
+ break; \
+ case enumtype::e2: \
+ stream << #e2; \
+ break; \
+ case enumtype::e3: \
+ stream << #e3; \
+ break; \
+ case enumtype::e4: \
+ stream << #e4; \
+ break; \
+ } \
+ stream << "</" #prop ">" << std::endl; \
+ }
+
+#define EMIT_ENUM_5(stream, object, enumtype, prop, e1, e2, e3, e4, e5, optIdx) \
+ enumtype::prop propVal##prop = object->Get##prop(); \
+ bool emit##prop = true; \
+ switch (optIdx) \
+ { \
+ case 1: \
+ emit##prop = (propVal##prop != enumtype::e1); \
+ break; \
+ case 2: \
+ emit##prop = (propVal##prop != enumtype::e2); \
+ break; \
+ case 3: \
+ emit##prop = (propVal##prop != enumtype::e3); \
+ break; \
+ case 4: \
+ emit##prop = (propVal##prop != enumtype::e4); \
+ break; \
+ case 5: \
+ emit##prop = (propVal##prop != enumtype::e5); \
+ break; \
+ } \
+ if (emit##prop) \
+ { \
+ stream << tab() << "<" #prop ">"; \
+ switch (propVal##prop) \
+ { \
+ case enumtype::e1: \
+ stream << #e1; \
+ break; \
+ case enumtype::e2: \
+ stream << #e2; \
+ break; \
+ case enumtype::e3: \
+ stream << #e3; \
+ break; \
+ case enumtype::e4: \
+ stream << #e4; \
+ break; \
+ case enumtype::e5: \
+ stream << #e5; \
+ break; \
+ } \
+ stream << "</" #prop ">" << std::endl; \
+ }
+
+#define IF_STRING_PROPERTY(curprop, object, prop, value) \
+ if (curprop == L###prop) \
+ object->Set##prop(value);
+
+#define IF_DOUBLE_PROPERTY(curprop, object, prop, value) \
+ if (curprop == L###prop) \
+ object->Set##prop(wstrToDouble(value));
+
+#define IF_INTEGER_PROPERTY(curprop, object, prop, value) \
+ if (curprop == L###prop) \
+ object->Set##prop(wstrToInt(value));
+
+#define IF_ENUM_2(curprop, object, enumtype, prop, value, e1, e2) \
+ if (curprop == L###prop) \
+ { \
+ if (::wcscmp(value, L###e1) == 0) \
+ object->Set##prop(enumtype::e1); \
+ else if (::wcscmp(value, L###e2) == 0) \
+ object->Set##prop(enumtype::e2); \
+ }
+
+#define IF_ENUM_3(curprop, object, enumtype, prop, value, e1, e2, e3) \
+ if (curprop == L###prop) \
+ { \
+ if (::wcscmp(value, L###e1) == 0) \
+ object->Set##prop(enumtype::e1); \
+ else if (::wcscmp(value, L###e2) == 0) \
+ object->Set##prop(enumtype::e2); \
+ else if (::wcscmp(value, L###e3) == 0) \
+ object->Set##prop(enumtype::e3); \
+ }
+
+#define IF_ENUM_4(curprop, object, enumtype, prop, value, e1, e2, e3, e4) \
+ if (curprop == L###prop) \
+ { \
+ if (::wcscmp(value, L###e1) == 0) \
+ object->Set##prop(enumtype::e1); \
+ else if (::wcscmp(value, L###e2) == 0) \
+ object->Set##prop(enumtype::e2); \
+ else if (::wcscmp(value, L###e3) == 0) \
+ object->Set##prop(enumtype::e3); \
+ else if (::wcscmp(value, L###e4) == 0) \
+ object->Set##prop(enumtype::e4); \
+ }
+
+#define IF_ENUM_5(curprop, object, enumtype, prop, value, e1, e2, e3, e4, e5) \
+ if (curprop == L###prop) \
+ { \
+ if (::wcscmp(value, L###e1) == 0) \
+ object->Set##prop(enumtype::e1); \
+ else if (::wcscmp(value, L###e2) == 0) \
+ object->Set##prop(enumtype::e2); \
+ else if (::wcscmp(value, L###e3) == 0) \
+ object->Set##prop(enumtype::e3); \
+ else if (::wcscmp(value, L###e4) == 0) \
+ object->Set##prop(enumtype::e4); \
+ else if (::wcscmp(value, L###e5) == 0) \
+ object->Set##prop(enumtype::e5); \
+ }
+
#endif
More information about the mapguide-commits
mailing list