13 #include <sbml/packages/render/sbml/RenderGroup.h>
14 #include <sbml/packages/render/sbml/Rectangle.h>
15 #include <sbml/packages/render/sbml/Ellipse.h>
16 #include <sbml/packages/render/sbml/Transformation2D.h>
17 #include <sbml/packages/render/sbml/RenderCurve.h>
18 #include <sbml/packages/render/sbml/Polygon.h>
19 #include <sbml/packages/render/sbml/Image.h>
21 #define sbmlEllipse Ellipse
22 #define sbmlPolygon Polygon
23 #define sbmlRectangle Rectangle
46 mFontSize(
CLRelAbsVector(std::numeric_limits<double>::quiet_NaN(), std::numeric_limits<double>::quiet_NaN())),
47 mFontWeight(
CLText::WEIGHT_UNSET),
48 mFontStyle(
CLText::STYLE_UNSET),
49 mTextAnchor(
CLText::ANCHOR_UNSET),
50 mVTextAnchor(
CLText::ANCHOR_UNSET),
53 mElements(
"GroupElements", this),
65 mFontFamily(source.mFontFamily),
66 mFontSize(source.mFontSize),
67 mFontWeight(source.mFontWeight),
68 mFontStyle(source.mFontStyle),
69 mTextAnchor(source.mTextAnchor),
70 mVTextAnchor(source.mVTextAnchor),
71 mStartHead(source.mStartHead),
72 mEndHead(source.mEndHead),
73 mElements(
"GroupElements", this),
81 for (i = 0; i < iMax; ++i)
85 if (dynamic_cast<const CLRectangle*>(pChild))
89 else if (dynamic_cast<const CLEllipse*>(pChild))
93 else if (dynamic_cast<const CLRenderCurve*>(pChild))
97 else if (dynamic_cast<const CLPolygon*>(pChild))
101 else if (dynamic_cast<const CLText*>(pChild))
105 else if (dynamic_cast<const CLImage*>(pChild))
109 else if (dynamic_cast<const CLGroup*>(pChild))
122 mFontFamily(source.getFontFamily()),
123 mFontSize(source.getFontSize()),
124 mStartHead(source.getStartHead()),
125 mEndHead(source.getEndHead()),
126 mElements(
"GroupElements", this),
132 switch (source.getFontWeight())
134 case Text::WEIGHT_UNSET:
138 case Text::WEIGHT_BOLD:
147 switch (source.getFontStyle())
149 case Text::STYLE_UNSET:
153 case Text::STYLE_ITALIC:
162 switch (source.getTextAnchor())
164 case Text::ANCHOR_UNSET:
168 case Text::ANCHOR_END:
172 case Text::ANCHOR_MIDDLE:
181 switch (source.getVTextAnchor())
183 case Text::ANCHOR_UNSET:
187 case Text::ANCHOR_BOTTOM:
191 case Text::ANCHOR_MIDDLE:
200 size_t i, iMax = source.getNumElements();
201 const Transformation2D* pChild = NULL;
203 for (i = 0; i < iMax; ++i)
205 pChild =
dynamic_cast<const Transformation2D*
>(source.getElement((
unsigned int) i));
207 if (dynamic_cast<const Rectangle*>(pChild))
211 else if (dynamic_cast<const Ellipse*>(pChild))
215 else if (dynamic_cast<const RenderCurve*>(pChild))
219 else if (dynamic_cast<const Polygon*>(pChild))
223 else if (dynamic_cast<const Text*>(pChild))
227 else if (dynamic_cast<const Image*>(pChild))
231 else if (dynamic_cast<const RenderGroup*>(pChild))
519 if (dynamic_cast<const CLRectangle*>(pChild))
523 else if (dynamic_cast<const CLEllipse*>(pChild))
527 else if (dynamic_cast<const CLRenderCurve*>(pChild))
531 else if (dynamic_cast<const CLPolygon*>(pChild))
535 else if (dynamic_cast<const CLText*>(pChild))
539 else if (dynamic_cast<const CLImage*>(pChild))
543 else if (dynamic_cast<const CLGroup*>(pChild))
801 RenderGroup* pGroup =
new RenderGroup(level, version);
806 pGroup->setFontSize(*pV);
813 pGroup->setFontWeight(Text::WEIGHT_UNSET);
817 pGroup->setFontWeight(Text::WEIGHT_BOLD);
821 pGroup->setFontWeight(Text::WEIGHT_NORMAL);
828 pGroup->setFontStyle(Text::STYLE_UNSET);
832 pGroup->setFontStyle(Text::STYLE_ITALIC);
836 pGroup->setFontStyle(Text::STYLE_NORMAL);
843 pGroup->setTextAnchor(Text::ANCHOR_UNSET);
847 pGroup->setTextAnchor(Text::ANCHOR_END);
851 pGroup->setTextAnchor(Text::ANCHOR_MIDDLE);
855 pGroup->setTextAnchor(Text::ANCHOR_START);
862 pGroup->setVTextAnchor(Text::ANCHOR_UNSET);
866 pGroup->setVTextAnchor(Text::ANCHOR_BOTTOM);
870 pGroup->setVTextAnchor(Text::ANCHOR_MIDDLE);
874 pGroup->setVTextAnchor(Text::ANCHOR_TOP);
881 for (i = 0; i < iMax; ++i)
883 const Transformation2D* pChild = NULL;
886 if (dynamic_cast<const CLRectangle*>(pObject))
890 else if (dynamic_cast<const CLEllipse*>(pObject))
892 pChild =
static_cast<const CLEllipse*
>(pObject)->
toSBML(level, version);
894 else if (dynamic_cast<const CLRenderCurve*>(pObject))
898 else if (dynamic_cast<const CLPolygon*>(pObject))
900 pChild =
static_cast<const CLPolygon*
>(pObject)->
toSBML(level, version);
902 else if (dynamic_cast<const CLText*>(pObject))
904 pChild =
static_cast<const CLText*
>(pObject)->
toSBML(level, version);
906 else if (dynamic_cast<const CLImage*>(pObject))
908 pChild =
static_cast<const CLImage*
>(pObject)->
toSBML(level, version);
910 else if (dynamic_cast<const CLGroup*>(pObject))
912 pChild =
static_cast<const CLGroup*
>(pObject)->
toSBML(level, version);
915 result = pGroup->addChildElement(pChild);
916 assert(result == LIBSBML_OPERATION_SUCCESS);
bool remove(const std::string &key)
CLText::FONT_STYLE mFontStyle
void setTextAnchor(CLText::TEXT_ANCHOR anchor)
void setFontFamily(const std::string &family)
CCopasiVector< CCopasiObject > mElements
bool isSetFontWeight() const
virtual size_t size() const
bool isSetEndHead() const
bool isSetFontFamily() const
bool isSetStartHead() const
bool isSetFontSize() const
double getRelativeValue() const
const std::string & getKey() const
const std::string & getFontFamily() const
CLText::TEXT_ANCHOR mTextAnchor
const CCopasiVector< CCopasiObject > * getListOfElements() const
CLRelAbsVector & getFontSize()
void setFontWeight(CLText::FONT_WEIGHT weight)
const std::string & getStartHead() const
void setVTextAnchor(CLText::TEXT_ANCHOR anchor)
RelAbsVector * toSBML() const
CCopasiObject * getElement(size_t n)
virtual bool add(const CType &src)
virtual void addSBMLAttributes(GraphicalPrimitive2D *pPrimitive) const
CLGroup(CCopasiContainer *pParent=NULL)
bool isSetTextAnchor() const
void setEndHead(const std::string &key)
void setFontSize(const CLRelAbsVector &size)
const std::string & getEndHead() const
std::string add(const std::string &prefix, CCopasiObject *pObject)
bool isSetFontStyle() const
CLText::FONT_STYLE getFontStyle() const
CLText::FONT_WEIGHT getFontWeight() const
CLText::TEXT_ANCHOR getVTextAnchor() const
double getAbsoluteValue() const
static CKeyFactory * getKeyFactory()
CLRenderCurve * createCurve()
CLText::FONT_WEIGHT mFontWeight
void setStartHead(const std::string &key)
CLText::TEXT_ANCHOR mVTextAnchor
CLRectangle * createRectangle()
void setFontStyle(CLText::FONT_STYLE style)
CLText::TEXT_ANCHOR getTextAnchor() const
CLEllipse * createEllipse()
RenderGroup * toSBML(unsigned int level, unsigned int version) const
size_t getNumElements() const
bool isSetVTextAnchor() const
void addChildElement(const CLTransformation2D *pChild)
CLPolygon * createPolygon()