COPASI API  4.16.103
CLGroup.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 #include <limits>
7 #include <sstream>
8 #include <assert.h>
9 
10 #define USE_LAYOUT 1
11 #define USE_RENDER 1
12 
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>
20 
21 #define sbmlEllipse Ellipse
22 #define sbmlPolygon Polygon
23 #define sbmlRectangle Rectangle
24 
25 #include "CLGroup.h"
26 
27 #include "CLRenderCurve.h"
28 #include "CLPolygon.h"
29 #include "CLEllipse.h"
30 #include "CLRectangle.h"
31 #include "CLText.h"
32 #include "CLImage.h"
33 #include "CLRenderPoint.h"
34 #include "CLRenderCubicBezier.h"
35 
38 
39 /**
40  * Constructor.
41  */
44  CCopasiContainer("RenderGroup", pParent),
45  mFontFamily(""),
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),
51  mStartHead(""),
52  mEndHead(""),
53  mElements("GroupElements", this),
54  mKey("")
55 {
56  this->mKey = CCopasiRootContainer::getKeyFactory()->add("RenderGroup", this);
57 }
58 
59 /**
60  * Copy constructor.
61  */
62 CLGroup::CLGroup(const CLGroup& source, CCopasiContainer* pParent):
63  CLGraphicalPrimitive2D(source),
64  CCopasiContainer(source, pParent),
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),
74  mKey("")
75 {
76  this->mKey = CCopasiRootContainer::getKeyFactory()->add("RenderGroup", this);
77  // copy the elements
78  size_t i, iMax = source.mElements.size();
79  CCopasiObject* pChild = NULL;
80 
81  for (i = 0; i < iMax; ++i)
82  {
83  pChild = source.mElements[i];
84 
85  if (dynamic_cast<const CLRectangle*>(pChild))
86  {
87  this->mElements.add(new CLRectangle(*static_cast<const CLRectangle*>(pChild), this), true);
88  }
89  else if (dynamic_cast<const CLEllipse*>(pChild))
90  {
91  this->mElements.add(new CLEllipse(*static_cast<const CLEllipse*>(pChild), this), true);
92  }
93  else if (dynamic_cast<const CLRenderCurve*>(pChild))
94  {
95  this->mElements.add(new CLRenderCurve(*static_cast<const CLRenderCurve*>(pChild), this), true);
96  }
97  else if (dynamic_cast<const CLPolygon*>(pChild))
98  {
99  this->mElements.add(new CLPolygon(*static_cast<const CLPolygon*>(pChild), this), true);
100  }
101  else if (dynamic_cast<const CLText*>(pChild))
102  {
103  this->mElements.add(new CLText(*static_cast<const CLText*>(pChild), this), true);
104  }
105  else if (dynamic_cast<const CLImage*>(pChild))
106  {
107  this->mElements.add(new CLImage(*static_cast<const CLImage*>(pChild), this), true);
108  }
109  else if (dynamic_cast<const CLGroup*>(pChild))
110  {
111  this->mElements.add(new CLGroup(*static_cast<const CLGroup*>(pChild), this), true);
112  }
113  }
114 }
115 
116 /**
117  * Constructor to generate object from the corresponding SBML object.
118  */
119 CLGroup::CLGroup(const RenderGroup& source, CCopasiContainer* pParent):
120  CLGraphicalPrimitive2D(source),
121  CCopasiContainer("RenderGroup", pParent),
122  mFontFamily(source.getFontFamily()),
123  mFontSize(source.getFontSize()),
124  mStartHead(source.getStartHead()),
125  mEndHead(source.getEndHead()),
126  mElements("GroupElements", this),
127  mKey("")
128 {
129  this->mKey = CCopasiRootContainer::getKeyFactory()->add("RenderGroup", this);
130 
131  // copy the elements
132  switch (source.getFontWeight())
133  {
134  case Text::WEIGHT_UNSET:
136  break;
137 
138  case Text::WEIGHT_BOLD:
140  break;
141 
142  default:
144  break;
145  }
146 
147  switch (source.getFontStyle())
148  {
149  case Text::STYLE_UNSET:
151  break;
152 
153  case Text::STYLE_ITALIC:
155  break;
156 
157  default:
159  break;
160  }
161 
162  switch (source.getTextAnchor())
163  {
164  case Text::ANCHOR_UNSET:
166  break;
167 
168  case Text::ANCHOR_END:
170  break;
171 
172  case Text::ANCHOR_MIDDLE:
174  break;
175 
176  default:
178  break;
179  }
180 
181  switch (source.getVTextAnchor())
182  {
183  case Text::ANCHOR_UNSET:
185  break;
186 
187  case Text::ANCHOR_BOTTOM:
189  break;
190 
191  case Text::ANCHOR_MIDDLE:
193  break;
194 
195  default:
197  break;
198  }
199 
200  size_t i, iMax = source.getNumElements();
201  const Transformation2D* pChild = NULL;
202 
203  for (i = 0; i < iMax; ++i)
204  {
205  pChild = dynamic_cast<const Transformation2D*>(source.getElement((unsigned int) i));
206 
207  if (dynamic_cast<const Rectangle*>(pChild))
208  {
209  this->mElements.add(new CLRectangle(*static_cast<const Rectangle*>(pChild), this), true);
210  }
211  else if (dynamic_cast<const Ellipse*>(pChild))
212  {
213  this->mElements.add(new CLEllipse(*static_cast<const Ellipse*>(pChild), this), true);
214  }
215  else if (dynamic_cast<const RenderCurve*>(pChild))
216  {
217  this->mElements.add(new CLRenderCurve(*static_cast<const RenderCurve*>(pChild), this), true);
218  }
219  else if (dynamic_cast<const Polygon*>(pChild))
220  {
221  this->mElements.add(new CLPolygon(*static_cast<const Polygon*>(pChild), this), true);
222  }
223  else if (dynamic_cast<const Text*>(pChild))
224  {
225  this->mElements.add(new CLText(*static_cast<const Text*>(pChild), this), true);
226  }
227  else if (dynamic_cast<const Image*>(pChild))
228  {
229  this->mElements.add(new CLImage(*static_cast<const Image*>(pChild), this), true);
230  }
231  else if (dynamic_cast<const RenderGroup*>(pChild))
232  {
233  this->mElements.add(new CLGroup(*static_cast<const RenderGroup*>(pChild), this), true);
234  }
235  }
236 }
237 /**
238  * Destructor
239  */
241 {
243 }
244 
245 /**
246  * Sets the font family.
247  */
248 void CLGroup::setFontFamily(const std::string& family)
249 {
250  this->mFontFamily = family;
251 }
252 
253 /**
254  * Sets the font size.
255  */
257 {
258  this->mFontSize = size;
259 }
260 
261 /**
262  * Sets the font weight.
263  */
265 {
266  this->mFontWeight = weight;
267 }
268 
269 /**
270  * Sets the font style.
271  */
273 {
274  this->mFontStyle = style;
275 }
276 
277 /**
278  * Sets the text anchor.
279  */
281 {
282  this->mTextAnchor = anchor;
283 }
284 
285 /**
286  * Sets the vertical text anchor.
287  */
289 {
290  this->mVTextAnchor = anchor;
291 }
292 
293 /**
294  * Sets the start head id.
295  */
296 void CLGroup::setStartHead(const std::string& key)
297 {
298  this->mStartHead = key;
299 }
300 
301 /**
302  * Sets the end head id.
303  */
304 void CLGroup::setEndHead(const std::string& key)
305 {
306  this->mEndHead = key;
307 }
308 
309 /**
310  * Returns the font family.
311  */
312 const std::string& CLGroup::getFontFamily() const
313 {
314  return this->mFontFamily;
315 }
316 
317 /**
318  * Returns the font size.
319  */
321 {
322  return this->mFontSize;
323 }
324 
325 /**
326  * Returns the font size.
327  */
329 {
330  return this->mFontSize;
331 }
332 
333 /**
334  * Returns the font weight.
335  */
337 {
338  return this->mFontWeight;
339 }
340 
341 /**
342  * Returns the font style.
343  */
345 {
346  return this->mFontStyle;
347 }
348 
349 /**
350  * Returns the text anchor.
351  */
353 {
354  return this->mTextAnchor;
355 }
356 
357 /**
358  * Returns the vertical text anchor.
359  */
361 {
362  return this->mVTextAnchor;
363 }
364 
365 /**
366  * Returns the start head id.
367  */
368 const std::string& CLGroup::getStartHead() const
369 {
370  return this->mStartHead;
371 }
372 
373 /**
374  * Returns the end head id.
375  */
376 const std::string& CLGroup::getEndHead() const
377 {
378  return this->mEndHead;
379 }
380 
381 /**
382  * Returns the number of elements in the group.
383  */
385 {
386  return this->mElements.size();
387 }
388 
389 /**
390  * Returns the list of elements.
391  */
393 {
394  return &this->mElements;
395 }
396 
397 /**
398  * Returns the list of elements.
399  */
401 {
402  return &this->mElements;
403 }
404 
405 /**
406  * Returns element with index n.
407  * If there is no such element, NULL is returned.
408  */
410 {
411  if (n < this->mElements.size())
412  {
413  return this->mElements[n];
414  }
415  else
416  {
417  return NULL;
418  }
419 }
420 
421 /**
422  * Returns element with index n.
423  * If there is no such element, NULL is returned.
424  */
425 const CCopasiObject* CLGroup::getElement(size_t n) const
426 {
427  if (n < this->mElements.size())
428  {
429  return this->mElements[n];
430  }
431  else
432  {
433  return NULL;
434  }
435 }
436 
437 /**
438  * Creates an image object and adds it to the end of the list of child
439  * elements.
440  */
442 {
443  CLImage* pCLImage = new CLImage(this);
444  this->mElements.add(pCLImage, true);
445  return pCLImage;
446 }
447 
448 /**
449  * Creates an image object and adds it to the end of the list of child
450  * elements.
451  */
453 {
454  CLGroup* pCLGroup = new CLGroup(this);
455  this->mElements.add(pCLGroup, true);
456  return pCLGroup;
457 }
458 
459 /**
460  * Creates a rectangle object and adds it to the end of the list of child
461  * elements.
462  */
464 {
465  CLRectangle* pCLRectangle = new CLRectangle(this);
466  this->mElements.add(pCLRectangle, true);
467  return pCLRectangle;
468 }
469 
470 /**
471  * Creates an ellipse object and adds it to the end of the list of child
472  * elements.
473  */
475 {
476  CLEllipse* pCLEllipse = new CLEllipse(this);
477  this->mElements.add(pCLEllipse, true);
478  return pCLEllipse;
479 }
480 
481 /**
482  * Creates a curve object and adds it to the end of the list of child
483  * elements.
484  */
486 {
487  CLRenderCurve* pCurve = new CLRenderCurve(this);
488  this->mElements.add(pCurve, true);
489  return pCurve;
490 }
491 
492 /**
493  * Creates a polygon object and adds it to the end of the list of child
494  * elements.
495  */
497 {
498  CLPolygon* pCLPolygon = new CLPolygon(this);
499  this->mElements.add(pCLPolygon, true);
500  return pCLPolygon;
501 }
502 
503 /**
504  * Creates a text object and adds it to the end of the list of child
505  * elements.
506  */
508 {
509  CLText* pCLText = new CLText(this);
510  this->mElements.add(pCLText, true);
511  return pCLText;
512 }
513 
514 /**
515  * Adds a copy of the given element to the end of the list of children elements.
516  */
518 {
519  if (dynamic_cast<const CLRectangle*>(pChild))
520  {
521  this->mElements.add(new CLRectangle(*static_cast<const CLRectangle*>(pChild), this), true);
522  }
523  else if (dynamic_cast<const CLEllipse*>(pChild))
524  {
525  this->mElements.add(new CLEllipse(*static_cast<const CLEllipse*>(pChild), this), true);
526  }
527  else if (dynamic_cast<const CLRenderCurve*>(pChild))
528  {
529  this->mElements.add(new CLRenderCurve(*static_cast<const CLRenderCurve*>(pChild), this), true);
530  }
531  else if (dynamic_cast<const CLPolygon*>(pChild))
532  {
533  this->mElements.add(new CLPolygon(*static_cast<const CLPolygon*>(pChild), this), true);
534  }
535  else if (dynamic_cast<const CLText*>(pChild))
536  {
537  this->mElements.add(new CLText(*static_cast<const CLText*>(pChild), this), true);
538  }
539  else if (dynamic_cast<const CLImage*>(pChild))
540  {
541  this->mElements.add(new CLImage(*static_cast<const CLImage*>(pChild), this), true);
542  }
543  else if (dynamic_cast<const CLGroup*>(pChild))
544  {
545  this->mElements.add(new CLGroup(*static_cast<const CLGroup*>(pChild), this), true);
546  }
547 }
548 
549 /**
550  * Returns true if the start head is set or false otherwise.
551  */
553 {
554  return (!this->mStartHead.empty() && this->mStartHead != "none");
555 }
556 
557 /**
558  * Returns true if the start head is set or false otherwise.
559  */
561 {
562  return (!this->mEndHead.empty() && this->mEndHead != "none");
563 }
564 
565 /**
566  * Returns true if the font family has been set or false otherwise.
567  */
569 {
570  return !this->mFontFamily.empty();
571 }
572 
573 /**
574  * Returns true if the font size has been set or false otherwise.
575  */
577 {
579 }
580 
581 /**
582  * Returns true if the font weight has been set or false otherwise.
583  */
585 {
586  return (this->mFontWeight != CLText::WEIGHT_UNSET);
587 }
588 
589 /**
590  * Returns true if the font style has been set or false otherwise.
591  */
593 {
594  return (this->mFontStyle != CLText::STYLE_UNSET);
595 }
596 
597 /**
598  * This methods imports a curve in the old format into the new format.
599  * Since the old curves could have gaps, the original curve might have to be
600  * split into several new curves.
601 void CLGroup::importOldCurve(const XMLNode& node)
602 {
603  const XMLAttributes& curveAttributes=node.getAttributes();
604  const XMLNode* child;
605  size_t n=0,nMax = node.getNumChildren();
606  const XMLNode* pOrigAnnotation=NULL;
607  const XMLNode* pOrigNotes=NULL;
608  while(n<nMax)
609  {
610  child=&node.getChild(n);
611  std::string childName=child->getName();
612  if(childName=="listOfCurveSegments")
613  {
614  size_t i,iMax=child->getNumChildren();
615  const XMLNode* child2=NULL;
616  CLRenderPoint start;
617  CLRenderPoint end;
618  CLRenderPoint lastEnd;
619  CLRenderPoint bp1;
620  CLRenderPoint bp2;
621  bool startSet=false;
622  bool endSet=false;
623  bool bp1Set=false;
624  bool bp2Set=false;
625  std::string childName2;
626  CLRenderCurve* pCurve=new CLRenderCurve();
627  // read the attributes
628  pCurve->Transformation2D::readAttributes(curveAttributes);
629  pCurve->GraphicalPrimitive1D::readAttributes(curveAttributes);
630  pCurve->readAttributes(curveAttributes);
631  for(i=0;i<iMax;++i)
632  {
633  child2=&child->getChild(i);
634  childName2=child2->getName();
635  if(childName2=="curveSegment")
636  {
637  startSet=false;
638  endSet=false;
639  bp1Set=false;
640  bp2Set=false;
641  const XMLAttributes& innerAttributes=child2->getAttributes();
642  int typeIndex=innerAttributes.getIndex("type");
643  if(typeIndex==-1 || innerAttributes.getURI(typeIndex)!="http://www.w3.org/2001/XMLSchema-instance")
644  {
645  continue;
646  }
647  size_t j,jMax=child2->getNumChildren();
648  for(j=0;j<jMax;++j)
649  {
650  const XMLNode* child3=&child2->getChild(j);
651  std::string childName3=child3->getName();
652  if(childName3=="start")
653  {
654  start=CLRenderPoint(*child3);
655  startSet=true;
656  }
657  // add the basepoints and the endpoint
658  else if(childName3=="end")
659  {
660  end=CLRenderPoint(*child3);
661  endSet=true;
662  }
663  else if(innerAttributes.getValue(typeIndex)=="CubicBezier" && childName3=="basePoint1")
664  {
665  bp1=CLRenderPoint(*child3);
666  bp1Set=true;
667  }
668  else if(innerAttributes.getValue(typeIndex)=="CubicBezier" && childName3=="basePoint2")
669  {
670  bp2=CLRenderPoint(*child3);
671  bp2Set=true;
672  }
673  }
674  if(!startSet || !endSet)
675  {
676  // skip this point
677  // TODO this is an error
678  continue;
679  }
680  if(pCurve->getNumElements()==0)
681  {
682  // add the start point
683  pCurve->addCurveElement(&start);
684  }
685  else
686  {
687  // check if start is identical to lastEnd
688  // if not, we have to start a new curve
689  if(!(start == lastEnd))
690  {
691  if(pCurve->getNumElements() > 1)
692  {
693  // add the curve to the goup
694  this->mElements.add(pCurve,true);
695  }
696  else
697  {
698  delete pCurve;
699  }
700  // we have do clear the endHead on the
701  // preceeding curve
702  pCurve->setEndHead("none");
703  pCurve=new CLRenderCurve();
704  // read the attributes
705  pCurve->Transformation2D::readAttributes(curveAttributes);
706  pCurve->GraphicalPrimitive1D::readAttributes(curveAttributes);
707  pCurve->readAttributes(curveAttributes);
708  // we have to clear the start head on this
709  // curve
710  pCurve->setStartHead("none");
711  pCurve->addCurveElement(&start);
712  }
713  }
714  if(innerAttributes.getValue(typeIndex)=="CubicBezier")
715  {
716  if(!bp1Set)
717  {
718  if(bp2Set)
719  {
720  // basepoint1 is the same as basepoint2
721  bp1=bp2;
722  }
723  else
724  {
725  bp1=CLRenderPoint(CLRelAbsVector((start.x().getAbsoluteValue()+end.x().getAbsoluteValue())/2.0,(start.x().getRelativeValue()+end.x().getRelativeValue())/2.0)
726  ,CLRelAbsVector((start.y().getAbsoluteValue()+end.y().getAbsoluteValue())/2.0,(start.y().getRelativeValue()+end.y().getRelativeValue())/2.0)
727  ,CLRelAbsVector((start.z().getAbsoluteValue()+end.z().getAbsoluteValue())/2.0,(start.z().getRelativeValue()+end.z().getRelativeValue())/2.0)
728  );
729  bp1Set=true;
730  }
731  }
732  if(!bp2Set)
733  {
734  // at this time bp1 has to be set
735  bp2=bp1;
736  }
737  // add the cubic bezier element
738  CLRenderCubicBezier* pBezier=new CLRenderCubicBezier(bp1.x(),bp1.y(),bp1.z(),
739  bp2.x(),bp2.y(),bp2.z(),
740  end.x(),end.y(),end.z());
741  pCurve->addCurveElement(pBezier);
742  delete pBezier;
743  lastEnd=end;
744  }
745  else
746  {
747  // add the end point
748  pCurve->addCurveElement(&end);
749  lastEnd=end;
750  }
751  }
752  }
753  if(pCurve->getNumElements() > 1)
754  {
755  // add the curve to the goup
756  this->mElements.add(pCurve,true);
757  }
758  }
759  else if(childName=="annotation")
760  {
761  pOrigAnnotation=child;
762  }
763  else if(childName=="notes")
764  {
765  pOrigNotes=child;
766  }
767  ++n;
768  }
769 }
770  */
771 
772 /**
773  * Returns true if the horizonal alignment attribute has been set.
774  */
776 {
777  return this->mTextAnchor != CLText::ANCHOR_UNSET;
778 }
779 
780 /**
781  * Returns true if the vertical alignment attribute has been set.
782  */
784 {
785  return this->mVTextAnchor != CLText::ANCHOR_UNSET;
786 }
787 
788 /**
789  * Returns the key of the color definition.
790  */
791 const std::string& CLGroup::getKey() const
792 {
793  return this->mKey;
794 }
795 
796 /**
797  * Converts this object to the corresponding SBML object.
798  */
799 RenderGroup* CLGroup::toSBML(unsigned int level, unsigned int version) const
800 {
801  RenderGroup* pGroup = new RenderGroup(level, version);
802  this->addSBMLAttributes(pGroup);
803  pGroup->setStartHead(this->mStartHead);
804  pGroup->setEndHead(this->mEndHead);
805  RelAbsVector* pV = this->getFontSize().toSBML();
806  pGroup->setFontSize(*pV);
807  delete pV;
808  pGroup->setFontFamily(this->getFontFamily());
809 
810  switch (this->getFontWeight())
811  {
813  pGroup->setFontWeight(Text::WEIGHT_UNSET);
814  break;
815 
816  case CLText::WEIGHT_BOLD:
817  pGroup->setFontWeight(Text::WEIGHT_BOLD);
818  break;
819 
820  default:
821  pGroup->setFontWeight(Text::WEIGHT_NORMAL);
822  break;
823  }
824 
825  switch (this->getFontStyle())
826  {
827  case CLText::STYLE_UNSET:
828  pGroup->setFontStyle(Text::STYLE_UNSET);
829  break;
830 
832  pGroup->setFontStyle(Text::STYLE_ITALIC);
833  break;
834 
835  default:
836  pGroup->setFontStyle(Text::STYLE_NORMAL);
837  break;
838  }
839 
840  switch (this->getTextAnchor())
841  {
843  pGroup->setTextAnchor(Text::ANCHOR_UNSET);
844  break;
845 
846  case CLText::ANCHOR_END:
847  pGroup->setTextAnchor(Text::ANCHOR_END);
848  break;
849 
851  pGroup->setTextAnchor(Text::ANCHOR_MIDDLE);
852  break;
853 
854  default:
855  pGroup->setTextAnchor(Text::ANCHOR_START);
856  break;
857  }
858 
859  switch (this->getVTextAnchor())
860  {
862  pGroup->setVTextAnchor(Text::ANCHOR_UNSET);
863  break;
864 
866  pGroup->setVTextAnchor(Text::ANCHOR_BOTTOM);
867  break;
868 
870  pGroup->setVTextAnchor(Text::ANCHOR_MIDDLE);
871  break;
872 
873  default:
874  pGroup->setVTextAnchor(Text::ANCHOR_TOP);
875  break;
876  }
877 
878  size_t i, iMax = this->mElements.size();
879  int result;
880 
881  for (i = 0; i < iMax; ++i)
882  {
883  const Transformation2D* pChild = NULL;
884  const CCopasiObject* pObject = this->mElements[i];
885 
886  if (dynamic_cast<const CLRectangle*>(pObject))
887  {
888  pChild = static_cast<const CLRectangle*>(pObject)->toSBML(level, version);
889  }
890  else if (dynamic_cast<const CLEllipse*>(pObject))
891  {
892  pChild = static_cast<const CLEllipse*>(pObject)->toSBML(level, version);
893  }
894  else if (dynamic_cast<const CLRenderCurve*>(pObject))
895  {
896  pChild = static_cast<const CLRenderCurve*>(pObject)->toSBML(level, version);
897  }
898  else if (dynamic_cast<const CLPolygon*>(pObject))
899  {
900  pChild = static_cast<const CLPolygon*>(pObject)->toSBML(level, version);
901  }
902  else if (dynamic_cast<const CLText*>(pObject))
903  {
904  pChild = static_cast<const CLText*>(pObject)->toSBML(level, version);
905  }
906  else if (dynamic_cast<const CLImage*>(pObject))
907  {
908  pChild = static_cast<const CLImage*>(pObject)->toSBML(level, version);
909  }
910  else if (dynamic_cast<const CLGroup*>(pObject))
911  {
912  pChild = static_cast<const CLGroup*>(pObject)->toSBML(level, version);
913  }
914 
915  result = pGroup->addChildElement(pChild);
916  assert(result == LIBSBML_OPERATION_SUCCESS);
917  delete pChild;
918  }
919 
920  return pGroup;
921 }
bool remove(const std::string &key)
CLText::FONT_STYLE mFontStyle
Definition: CLGroup.h:43
void setTextAnchor(CLText::TEXT_ANCHOR anchor)
Definition: CLGroup.cpp:280
Definition: CLText.h:27
void setFontFamily(const std::string &family)
Definition: CLGroup.cpp:248
CCopasiVector< CCopasiObject > mElements
Definition: CLGroup.h:48
CLImage * createImage()
Definition: CLGroup.cpp:441
bool isSetFontWeight() const
Definition: CLGroup.cpp:584
CLText * createText()
Definition: CLGroup.cpp:507
virtual size_t size() const
bool isSetEndHead() const
Definition: CLGroup.cpp:560
bool isSetFontFamily() const
Definition: CLGroup.cpp:568
bool isSetStartHead() const
Definition: CLGroup.cpp:552
bool isSetFontSize() const
Definition: CLGroup.cpp:576
double getRelativeValue() const
const std::string & getKey() const
Definition: CLGroup.cpp:791
std::string mFontFamily
Definition: CLGroup.h:40
const std::string & getFontFamily() const
Definition: CLGroup.cpp:312
CLText::TEXT_ANCHOR mTextAnchor
Definition: CLGroup.h:44
const CCopasiVector< CCopasiObject > * getListOfElements() const
Definition: CLGroup.cpp:392
CLRelAbsVector & getFontSize()
Definition: CLGroup.cpp:320
CLRelAbsVector mFontSize
Definition: CLGroup.h:41
void setFontWeight(CLText::FONT_WEIGHT weight)
Definition: CLGroup.cpp:264
FONT_STYLE
Definition: CLText.h:41
~CLGroup()
Definition: CLGroup.cpp:240
const std::string & getStartHead() const
Definition: CLGroup.cpp:368
void setVTextAnchor(CLText::TEXT_ANCHOR anchor)
Definition: CLGroup.cpp:288
RelAbsVector * toSBML() const
CCopasiObject * getElement(size_t n)
Definition: CLGroup.cpp:409
virtual bool add(const CType &src)
std::string mStartHead
Definition: CLGroup.h:46
CLGroup * createGroup()
Definition: CLGroup.cpp:452
virtual void addSBMLAttributes(GraphicalPrimitive2D *pPrimitive) const
CLGroup(CCopasiContainer *pParent=NULL)
Definition: CLGroup.cpp:42
bool isSetTextAnchor() const
Definition: CLGroup.cpp:775
void setEndHead(const std::string &key)
Definition: CLGroup.cpp:304
void setFontSize(const CLRelAbsVector &size)
Definition: CLGroup.cpp:256
const std::string & getEndHead() const
Definition: CLGroup.cpp:376
std::string add(const std::string &prefix, CCopasiObject *pObject)
bool isSetFontStyle() const
Definition: CLGroup.cpp:592
CLText::FONT_STYLE getFontStyle() const
Definition: CLGroup.cpp:344
CLText::FONT_WEIGHT getFontWeight() const
Definition: CLGroup.cpp:336
CLText::TEXT_ANCHOR getVTextAnchor() const
Definition: CLGroup.cpp:360
double getAbsoluteValue() const
static CKeyFactory * getKeyFactory()
TEXT_ANCHOR
Definition: CLText.h:48
CLRenderCurve * createCurve()
Definition: CLGroup.cpp:485
CLText::FONT_WEIGHT mFontWeight
Definition: CLGroup.h:42
std::string mKey
Definition: CLGroup.h:53
void setStartHead(const std::string &key)
Definition: CLGroup.cpp:296
CLText::TEXT_ANCHOR mVTextAnchor
Definition: CLGroup.h:45
CLRectangle * createRectangle()
Definition: CLGroup.cpp:463
void setFontStyle(CLText::FONT_STYLE style)
Definition: CLGroup.cpp:272
CLText::TEXT_ANCHOR getTextAnchor() const
Definition: CLGroup.cpp:352
std::string mEndHead
Definition: CLGroup.h:47
CLEllipse * createEllipse()
Definition: CLGroup.cpp:474
RenderGroup * toSBML(unsigned int level, unsigned int version) const
Definition: CLGroup.cpp:799
size_t getNumElements() const
Definition: CLGroup.cpp:384
FONT_WEIGHT
Definition: CLText.h:34
bool isSetVTextAnchor() const
Definition: CLGroup.cpp:783
void addChildElement(const CLTransformation2D *pChild)
Definition: CLGroup.cpp:517
CLPolygon * createPolygon()
Definition: CLGroup.cpp:496