COPASI API  4.16.103
CQRenderConverter.cpp
Go to the documentation of this file.
1 // Copyright (C) 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 <QtGui/QGraphicsItem>
7 #include <QtCore/QSharedPointer>
8 #include <QtGui/QPen>
9 #include <QtGui/QFont>
10 #include <QtGui/QFontMetrics>
11 #include <QtGui/QPixmap>
12 #include <QtCore/QFile>
13 #include <QtGui/QGraphicsScene>
14 
16 #include <qlayout/CQRoundedRect.h>
17 #include <layout/CLStyle.h>
18 #include <layout/CLEllipse.h>
19 #include <layout/CLRectangle.h>
20 #include <layout/CLImage.h>
21 #include <layout/CLPolygon.h>
22 #include <layout/CLText.h>
23 #include <layout/CLCurve.h>
24 #include <layout/CLRenderCurve.h>
26 #include <layout/CLRenderPoint.h>
33 
34 #include <math.h>
35 
36 void transform(QGraphicsItem *item, const CLTransformation2D* trans, const CLGroup* group)
37 {
38  if (trans != NULL && trans->isSetMatrix())
39  {
40  QRectF pathRect = item->boundingRect();
41  QTransform transform(
42  trans->getMatrix2D()[0],
43  trans->getMatrix2D()[1],
44  trans->getMatrix2D()[2],
45  trans->getMatrix2D()[3],
46  trans->getMatrix2D()[4],
47  trans->getMatrix2D()[5]
48  );
49 
50  QTransform matrix;
51  matrix = matrix.translate(pathRect.x(), pathRect.y());
52  matrix = matrix.inverted();
53  matrix = matrix * transform;
54 
55  QTransform translate;
56  translate = translate.translate(pathRect.x(), pathRect.y());
57  matrix = matrix * translate;
58  item->setTransform(matrix, true);
59  }
60  else if (group != NULL && group->isSetMatrix())
61  {
62  QRectF pathRect = item->boundingRect();
63  QTransform transform(
64  group->getMatrix2D()[0],
65  group->getMatrix2D()[1],
66  group->getMatrix2D()[2],
67  group->getMatrix2D()[3],
68  group->getMatrix2D()[4],
69  group->getMatrix2D()[5]
70  );
71 
72  QTransform matrix;
73  matrix = matrix.translate(pathRect.x(), pathRect.y());
74  matrix = matrix.inverted();
75  matrix = matrix * transform;
76 
77  QTransform translate;
78  translate = translate.translate(pathRect.x(), pathRect.y());
79  matrix = matrix * translate;
80  item->setTransform(matrix, true);
81  }
82 }
83 
84 QColor getColor(const CLColorDefinition* cd)
85 {
86  if (cd == NULL) return QColor();
87 
88  return QColor::fromRgb(cd->getRed(), cd->getGreen(), cd->getBlue(), cd->getAlpha());
89 }
90 
91 QColor getColor(const std::string& color, const CLRenderResolver* resolver)
92 {
93  if (color == "none")
94  return QColor(Qt::transparent);
95 
96  if (resolver->getColorDefinition(color) == NULL && resolver->getGradientBase(color) == NULL)
97  {
98  CLColorDefinition cd; cd.setColorValue(color);
99  return getColor(&cd);
100  }
101 
102  return getColor(resolver->getColorDefinition(color));
103 }
104 
105 QSharedPointer<QLinearGradient> getLinearGradient(const CLLinearGradient* linear, const CLBoundingBox* bounds, const CLRenderResolver* resolver)
106 {
107  double x1 = bounds->getPosition().getX() + linear->getXPoint1().getAbsoluteValue() + (linear->getXPoint1().getRelativeValue() / 100.0 * bounds->getDimensions().getWidth());
108  double y1 = bounds->getPosition().getY() + linear->getYPoint1().getAbsoluteValue() + (linear->getYPoint1().getRelativeValue() / 100.0 * bounds->getDimensions().getHeight());
109  double x2 = bounds->getPosition().getX() + linear->getXPoint2().getAbsoluteValue() + (linear->getXPoint2().getRelativeValue() / 100.0 * bounds->getDimensions().getWidth());
110  double y2 = bounds->getPosition().getY() + linear->getYPoint2().getAbsoluteValue() + (linear->getYPoint2().getRelativeValue() / 100.0 * bounds->getDimensions().getHeight());
111 
112  QSharedPointer<QLinearGradient> result = QSharedPointer<QLinearGradient>(new QLinearGradient(x1, y1, x2, y2));
113 
114  switch (linear->getSpreadMethod())
115  {
117  result->setSpread(QGradient::ReflectSpread);
118  break;
119 
121  result->setSpread(QGradient::RepeatSpread);
122  break;
123 
124  case CLGradientBase::PAD:
125  result->setSpread(QGradient::PadSpread);
126  break;
127 
128  default:
129  break;
130  }
131 
132  for (size_t i = 0; i < linear->getNumGradientStops(); ++i)
133  {
134  const CLGradientStop* stop = linear->getGradientStop(i);
135  result->setColorAt(stop->getOffset().getAbsoluteValue() + stop->getOffset().getRelativeValue() / 100.0, getColor(stop->getStopColor(), resolver));
136  }
137 
138  return result;
139 }
140 
141 QSharedPointer<QRadialGradient> getRadialGradient(const CLRadialGradient* radial, const CLBoundingBox* bounds, const CLRenderResolver* resolver)
142 {
143  double cx = bounds->getPosition().getX() + radial->getCenterX().getAbsoluteValue() + radial->getCenterX().getRelativeValue() / 100.0 * bounds->getDimensions().getWidth();
144  double cy = bounds->getPosition().getY() + radial->getCenterY().getAbsoluteValue() + radial->getCenterY().getRelativeValue() / 100.0 * bounds->getDimensions().getHeight();
145  double fx = bounds->getPosition().getX() + radial->getFocalPointX().getAbsoluteValue() + radial->getFocalPointX().getRelativeValue() / 100.0 * bounds->getDimensions().getWidth();
146  double fy = bounds->getPosition().getY() + radial->getFocalPointY().getAbsoluteValue() + radial->getFocalPointY().getRelativeValue() / 100.0 * bounds->getDimensions().getHeight();
147  double r = radial->getRadius().getAbsoluteValue() + radial->getRadius().getRelativeValue() / 100.0 * bounds->getDimensions().getWidth();
148 
149  QSharedPointer<QRadialGradient> result = QSharedPointer<QRadialGradient>(new QRadialGradient(cx, cy, r, fx, fy));
150 
151  switch (radial->getSpreadMethod())
152  {
154  result->setSpread(QGradient::ReflectSpread);
155  break;
156 
158  result->setSpread(QGradient::RepeatSpread);
159  break;
160 
161  case CLGradientBase::PAD:
162  result->setSpread(QGradient::PadSpread);
163  break;
164 
165  default:
166  break;
167  }
168 
169  for (size_t i = 0; i < radial->getNumGradientStops(); ++i)
170  {
171  const CLGradientStop* stop = radial->getGradientStop(i);
172  result->setColorAt(stop->getOffset().getAbsoluteValue() + stop->getOffset().getRelativeValue() / 100.0, getColor(stop->getStopColor(), resolver));
173  }
174 
175  return result;
176 }
177 
178 QSharedPointer<QGradient> getGradient(const CLGradientBase* base, const CLBoundingBox* bounds, const CLRenderResolver* resolver)
179 {
180  const CLLinearGradient* linear = dynamic_cast<const CLLinearGradient*>(base);
181 
182  if (linear != NULL)
183  return getLinearGradient(linear, bounds, resolver);
184 
185  const CLRadialGradient* radial = dynamic_cast<const CLRadialGradient*>(base);
186 
187  if (radial != NULL)
188  return getRadialGradient(radial, bounds, resolver);
189 
190  return QSharedPointer<QGradient>();
191 }
192 
193 QSharedPointer<QFont> getFont(const CLText *item, const CLGroup *group, const CLRenderResolver* /*resolver*/, const CLBoundingBox *pBB)
194 {
195  QString font("Verdana"); double fontSize = 10, weight = 50; bool italic = false;
196 
197  if (item != NULL && item->isSetFontFamily())
198  font = item->getFontFamily().c_str();
199  else if (group != NULL && group->isSetFontFamily())
200  font = group->getFontFamily().c_str();
201 
202  if (item != NULL && item->isSetFontSize())
203  fontSize = item->getFontSize().getAbsoluteValue() + item->getFontSize().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
204  else if (group != NULL && group->isSetFontSize())
205  fontSize = group->getFontSize().getAbsoluteValue() + group->getFontSize().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
206 
207  if (item != NULL && item->isSetFontWeight())
208  switch (item->getFontWeight())
209  {
210  case CLText::WEIGHT_BOLD:
211  weight = QFont::Bold;
212  break;
213 
215  default:
216  weight = QFont::Normal;
217  break;
218  }
219  else if (group != NULL && group->isSetFontWeight())
220  switch (group->getFontWeight())
221  {
222  case CLText::WEIGHT_BOLD:
223  weight = QFont::Bold;
224  break;
225 
227  default:
228  weight = QFont::Normal;
229  break;
230  }
231 
232  if (item != NULL && item->isSetFontStyle())
233  switch (item->getFontStyle())
234  {
236  italic = true;
237  break;
238 
239  default:
240  break;
241  }
242  else if (group != NULL && group->isSetFontStyle())
243  switch (group->getFontStyle())
244  {
246  italic = true;
247  break;
248 
249  default:
250  break;
251  }
252 
253  QSharedPointer<QFont> result = QSharedPointer<QFont>(new QFont(font, -1, weight, italic));
254  result->setPixelSize(fontSize);
255 
256  if (font == "serif")
257  {
258  result->setStyleHint(QFont::Serif);
259  }
260  else if (font == "sans-serif" || font == "sans")
261  {
262  result->setStyleHint(QFont::SansSerif);
263  }
264  else if (font == "monospace")
265  {
266  result->setStyleHint(QFont::Monospace);
267  }
268 
269  return result;
270 }
271 
272 QSharedPointer<QBrush> getBrush(const CLGraphicalPrimitive2D *item, const CLGroup *group, const CLRenderResolver* resolver, const CLBoundingBox *pBB)
273 {
274  QColor color;
275 
276  if (item != NULL && item->isSetFill())
277  {
278  const CLGradientBase* base = resolver->getGradientBase(item->getFillColor());
279 
280  if (base != NULL)
281  {
282  return QSharedPointer<QBrush>(new QBrush(*getGradient(base, pBB, resolver)));
283  }
284 
285  return QSharedPointer<QBrush>(new QBrush(getColor(item->getFillColor(), resolver)));
286  }
287  else if (group != NULL && group->isSetFill())
288  {
289  const CLGradientBase* base = resolver->getGradientBase(group->getFillColor());
290 
291  if (base != NULL)
292  {
293  return QSharedPointer<QBrush>(new QBrush(*getGradient(base, pBB, resolver)));
294  }
295 
296  return QSharedPointer<QBrush>(new QBrush(getColor(group->getFillColor(), resolver)));
297  }
298 
299  return QSharedPointer<QBrush>(new QBrush());
300 }
301 
302 QSharedPointer<QPen> getPen(const CLGraphicalPrimitive1D *item, const CLGroup *group, const CLRenderResolver* resolver, const CLBoundingBox * /*pBB*/)
303 {
304  QColor color; double width;
305 
306  if (item != NULL && item->isSetStroke())
307  {
308  color = getColor(item->getStroke(), resolver);
309  }
310  else if (group != NULL && group->isSetStroke())
311  {
312  color = getColor(group->getStroke(), resolver);
313  }
314  else return QSharedPointer<QPen>(new QPen(Qt::transparent));
315 
316  if (item != NULL && item->isSetStrokeWidth())
317  {
318  width = item->getStrokeWidth();
319  }
320  else if (group != NULL && group->isSetStrokeWidth())
321  {
322  width = group->getStrokeWidth();
323  }
324  else return QSharedPointer<QPen>(new QPen(Qt::transparent));
325 
326  QSharedPointer<QPen> result = QSharedPointer<QPen>(new QPen(color, width));
327  result->setCapStyle(Qt::RoundCap);
328  result->setJoinStyle(Qt::RoundJoin);
329 
330  if (item != NULL && item->isSetDashArray())
331  {
332  const std::vector<unsigned int>& raw = item->getDashArray();
333  std::vector<unsigned int>::const_iterator start = raw.begin();
334  QVector<qreal> pattern;
335 
336  while (start != raw.end())
337  {
338  pattern << *start;
339  ++start;
340  }
341 
342  result->setDashPattern(pattern);
343  }
344  else if (group != NULL && group->isSetDashArray())
345  {
346  const std::vector<unsigned int>& raw = group->getDashArray();
347  std::vector<unsigned int>::const_iterator start = raw.begin();
348  QVector<qreal> pattern;
349 
350  while (start != raw.end())
351  {
352  pattern << *start;
353  ++start;
354  }
355 
356  result->setDashPattern(pattern);
357  }
358 
359  return result;
360 }
361 
362 void fillItemFromEllipse(QGraphicsItemGroup *item, const CLBoundingBox *pBB, const CLEllipse *pEllipse, const CLGroup *group, const CLRenderResolver* resolver)
363 {
364  double x = pBB->getPosition().getX() + pEllipse->getCX().getAbsoluteValue() + pEllipse->getCX().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth();
365  double y = pBB->getPosition().getY() + pEllipse->getCY().getAbsoluteValue() + pEllipse->getCY().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
366  double rx = pEllipse->getRX().getAbsoluteValue() + pEllipse->getRX().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth();
367  double ry = pEllipse->getRY().getAbsoluteValue() + pEllipse->getRY().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
368 
369  QGraphicsEllipseItem* ellipseItem = new QGraphicsEllipseItem(
370  x - rx, y - ry, rx * 2, ry * 2);
371  QSharedPointer<QPen> pen = getPen(pEllipse, group, resolver, pBB);
372  ellipseItem->setPen(*pen);
373 
374  QSharedPointer<QBrush> brush = getBrush(pEllipse, group, resolver, pBB);
375  ellipseItem->setBrush(*brush);
376 
377  transform(ellipseItem, pEllipse, group);
378  item->addToGroup(ellipseItem);
379 }
380 
381 void fillItemFromCurve(QGraphicsItemGroup *item, const CLBoundingBox *pBB, const CLCurve* pCurve, const CLGroup *group, const CLRenderResolver* resolver)
382 {
383  QPainterPath path;
384 
385  if (!pCurve->isContinuous())
386  {
387  for (size_t i = 0; i < pCurve->getNumCurveSegments(); ++i)
388  {
389  const CLLineSegment* current = pCurve->getSegmentAt(i);
390  path.moveTo(current->getStart().getX(), current->getStart().getY());
391 
392  if (current->isBezier())
393  {
394  path.cubicTo(
395  current->getBase1().getX(), current->getBase1().getY(),
396  current->getBase2().getX(), current->getBase2().getY(),
397  current->getEnd().getX(), current->getEnd().getY());
398  }
399  else
400  {
401  path.lineTo(
402  current->getEnd().getX(), current->getEnd().getY());
403  }
404  }
405  }
406  else if (pCurve->getListOfPoints().size() > 0)
407  {
408  for (size_t i = 0; i < pCurve->getNumCurveSegments(); ++i)
409  {
410  const CLLineSegment* current = pCurve->getSegmentAt(i);
411 
412  if (i == 0)
413  path.moveTo(current->getStart().getX(), current->getStart().getY());
414 
415  if (current->isBezier())
416  {
417  path.cubicTo(
418  current->getBase1().getX(), current->getBase1().getY(),
419  current->getBase2().getX(), current->getBase2().getY(),
420  current->getEnd().getX(), current->getEnd().getY());
421  }
422  else
423  {
424  path.lineTo(
425  current->getEnd().getX(), current->getEnd().getY());
426  }
427  }
428  }
429  else return;
430 
431  QGraphicsPathItem *pathItem = new QGraphicsPathItem(path);
432  QSharedPointer<QPen> pen = getPen(NULL, group, resolver, pBB);
433  pathItem->setPen(*pen);
434 
435  //QBrush *brush = getBrush(NULL, group, resolver, pBB);
436  //pathItem->setBrush(*brush);
437  //delete brush;
438  item->addToGroup(pathItem);
439 }
440 
441 void addToPath(QPainterPath &path, const CLRenderCubicBezier* cubic, const CLBoundingBox *pBB)
442 {
443  path.cubicTo(
444  pBB->getPosition().getX() + cubic->basePoint1_X().getAbsoluteValue() + cubic->basePoint1_X().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth(),
445  pBB->getPosition().getY() + cubic->basePoint1_Y().getAbsoluteValue() + cubic->basePoint1_Y().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight(),
446  pBB->getPosition().getX() + cubic->basePoint2_X().getAbsoluteValue() + cubic->basePoint2_X().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth(),
447  pBB->getPosition().getY() + cubic->basePoint2_Y().getAbsoluteValue() + cubic->basePoint2_Y().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight(),
448  pBB->getPosition().getX() + cubic->getXOffset().getAbsoluteValue() + cubic->getXOffset().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth(),
449  pBB->getPosition().getY() + cubic->getYOffset().getAbsoluteValue() + cubic->getYOffset().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight()
450  );
451 }
452 
453 void addToPath(QPainterPath &path, const CLRenderPoint* current, const CLBoundingBox *pBB)
454 {
455  path.lineTo(
456  pBB->getPosition().getX() + current->getXOffset().getAbsoluteValue() + current->getXOffset().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth(),
457  pBB->getPosition().getY() + current->getYOffset().getAbsoluteValue() + current->getYOffset().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight()
458  );
459 }
460 void moveToPoint(QPainterPath &path, const CLRenderPoint* current, const CLBoundingBox *pBB)
461 {
462  path.moveTo(
463  pBB->getPosition().getX() + current->getXOffset().getAbsoluteValue() + current->getXOffset().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth(),
464  pBB->getPosition().getY() + current->getYOffset().getAbsoluteValue() + current->getYOffset().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight()
465  );
466 }
467 
468 QSharedPointer<QPainterPath> getPath(const CLPolygon* pCurve, const CLBoundingBox *pBB)
469 {
470  QSharedPointer<QPainterPath> path = QSharedPointer<QPainterPath>(new QPainterPath());
471 
472  const std::vector<CLRenderPoint*>& elements = *pCurve->getListOfElements();
473  std::vector<CLRenderPoint*>::const_iterator it = elements.begin();
474  bool first = true;
475 
476  for (; it != elements.end(); ++it)
477  {
478  const CLRenderPoint* current = *it;
479  const CLRenderCubicBezier* cubic = dynamic_cast<const CLRenderCubicBezier*>(current);
480 
481  if (first)
482  {
483  moveToPoint(*path, current, pBB);
484  first = false;
485  continue;
486  }
487 
488  if (cubic != NULL)
489  {
490  addToPath(*path, cubic, pBB);
491  }
492  else
493  {
494  addToPath(*path, current, pBB);
495  }
496  }
497 
498  path->closeSubpath();
499 
500  return path;
501 }
502 
503 QSharedPointer<QPainterPath> getPath(const CLRectangle* pRect, const CLBoundingBox *pBB)
504 {
505 
506  double x = pBB->getPosition().getX() + pRect->getX().getAbsoluteValue() + pRect->getX().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth();
507  double y = pBB->getPosition().getY() + pRect->getY().getAbsoluteValue() + pRect->getY().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
508  double w = pRect->getWidth().getAbsoluteValue() + pRect->getWidth().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth();
509  double h = pRect->getHeight().getAbsoluteValue() + pRect->getHeight().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
510  double rx = pRect->getRadiusX().getAbsoluteValue() + pRect->getRadiusX().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth();
511  double ry = pRect->getRadiusY().getAbsoluteValue() + pRect->getRadiusY().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
512 
513  QSharedPointer<QPainterPath> path = QSharedPointer<QPainterPath>(new QPainterPath());
514 
515  path->addRoundedRect(x, y, w, h, rx, ry);
516 
517  return path;
518 }
519 
520 QSharedPointer<QPainterPath> getPath(const CLEllipse* pEllipse, const CLBoundingBox *pBB)
521 {
522 
523  double x = pBB->getPosition().getX() + pEllipse->getCX().getAbsoluteValue() + pEllipse->getCX().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth();
524  double y = pBB->getPosition().getY() + pEllipse->getCY().getAbsoluteValue() + pEllipse->getCY().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
525  double rx = pEllipse->getRX().getAbsoluteValue() + pEllipse->getRX().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth();
526  double ry = pEllipse->getRY().getAbsoluteValue() + pEllipse->getRY().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
527 
528  QSharedPointer<QPainterPath> path = QSharedPointer<QPainterPath>(new QPainterPath());
529 
530  path->addEllipse(x - rx, y - ry, 2 * rx, 2 * ry);
531 
532  return path;
533 }
534 
535 QSharedPointer<QPainterPath> getPath(const CLRenderCurve* pCurve, const CLBoundingBox *pBB)
536 {
537  QSharedPointer<QPainterPath> path = QSharedPointer<QPainterPath>(new QPainterPath());
538 
539  const std::vector<CLRenderPoint*>& elements = *pCurve->getListOfCurveElements();
540  std::vector<CLRenderPoint*>::const_iterator it = elements.begin();
541  bool first = true;
542 
543  for (; it != elements.end(); ++it)
544  {
545  const CLRenderPoint* current = *it;
546  const CLRenderCubicBezier* cubic = dynamic_cast<const CLRenderCubicBezier*>(current);
547 
548  if (first)
549  {
550  moveToPoint(*path, current, pBB);
551  first = false;
552  continue;
553  }
554 
555  if (cubic != NULL)
556  {
557  addToPath(*path, cubic, pBB);
558  }
559  else
560  {
561  addToPath(*path, current, pBB);
562  }
563  }
564 
565  return path;
566 }
567 
568 QPointF normalizePoint(const QPointF& vector)
569 {
570  qreal length = (qreal) sqrt(vector.x() * vector.x() + vector.y() * vector.y());
571 
572  if (length == 0) length = 1;
573 
574  return QPointF(vector.x() / length, vector.y() / length);
575 }
576 
577 void applyRotationalMapping(QPainterPath& linePath, const CLLineEnding* ending, QPointF point, QPointF second)
578 {
579  if (!ending->getIsEnabledRotationalMapping())
580  return;
581 
582  QPointF directionVector(point.x() - second.x(), point.y() - second.y());
583  directionVector = normalizePoint(directionVector);
584 
585  if (directionVector.x() == 0 && directionVector.y() == 0)
586  return;
587 
588  QPointF orthogonlVector;
589 
590  if (directionVector.x() == 0)
591  orthogonlVector = QPointF(directionVector.y(), 0);
592  else
593  orthogonlVector = QPointF(-directionVector.y() * directionVector.x(),
594  1 - directionVector.y() * directionVector.y());
595 
596  orthogonlVector = normalizePoint(orthogonlVector);
597 
598  QTransform rotateMatrix(directionVector.x(), directionVector.y(), orthogonlVector.x(),
599  orthogonlVector.y(), 0, 0);
600 
601  linePath = rotateMatrix.map(linePath);
602 }
603 
604 void addLineEndingToItem(QGraphicsPathItem* item, const CLLineEnding* ending, const CLGroup* group, const CLRenderResolver* resolver, QPointF point, QPointF second, QGraphicsItemGroup* itemGroup)
605 {
606  const CLGroup* lineGroup = ending->getGroup();
607 
608  for (size_t i = 0; i < lineGroup->getNumElements(); ++i)
609  {
610  const CLPolygon* poly = dynamic_cast<const CLPolygon*>(lineGroup->getElement(i));
611  const CLRenderCurve* rcurve = dynamic_cast<const CLRenderCurve*>(lineGroup->getElement(i));
612  const CLEllipse* ellipse = dynamic_cast<const CLEllipse*>(lineGroup->getElement(i));
613  const CLRectangle* rect = dynamic_cast<const CLRectangle*>(lineGroup->getElement(i));
614 
615  if (rcurve != NULL)
616  {
617  QPainterPath path = item->path();
618  QSharedPointer<QPainterPath> linePath = getPath(rcurve, ending->getBoundingBox());
619  applyRotationalMapping(*linePath, ending, point, second);
620  linePath->translate(point);
621  path.addPath(*linePath.data());
622  item->setPath(path);
623  }
624  else if (poly != NULL)
625  {
626  QPainterPath path = item->path();
627  QSharedPointer<QPainterPath> linePath = getPath(poly, ending->getBoundingBox());
628  applyRotationalMapping(*linePath, ending, point, second);
629  linePath->translate(point);
630  path.addPath(*linePath);
631  item->setPath(path);
632 
633  if (poly->isSetFill() || group->isSetFill())
634  {
635  QSharedPointer<QBrush> brush = getBrush(poly, ending->getGroup(), resolver, ending->getBoundingBox());
636  QSharedPointer<QPen> pen = getPen(poly, ending->getGroup(), resolver, ending->getBoundingBox());
637 
638  linePath->setFillRule(Qt::WindingFill);
639 
640  if (poly->isSetFillRule())
641  {
642  switch (poly->getFillRule())
643  {
645  linePath->setFillRule(Qt::OddEvenFill);
646  break;
647 
649  default:
650  linePath->setFillRule(Qt::WindingFill);
651  break;
652  }
653  }
654 
655  if (group->isSetFillRule())
656  {
657  switch (group->getFillRule())
658  {
660  linePath->setFillRule(Qt::OddEvenFill);
661  break;
662 
664  default:
665  linePath->setFillRule(Qt::WindingFill);
666  break;
667  }
668  }
669 
670  QGraphicsPathItem* outline = new QGraphicsPathItem(*linePath);
671 
672  outline->setPen(*pen);
673  outline->setBrush(*brush);
674  itemGroup->addToGroup(outline);
675  }
676  }
677  else if (ellipse != NULL)
678  {
679  QPainterPath path = item->path();
680  QSharedPointer<QPainterPath> linePath = getPath(ellipse, ending->getBoundingBox());
681  applyRotationalMapping(*linePath, ending, point, second);
682  linePath->translate(point);
683  path.addPath(*linePath);
684  item->setPath(path);
685 
686  if (ellipse->isSetFill() || group->isSetFill())
687  {
688  QSharedPointer<QBrush> brush = getBrush(ellipse, ending->getGroup(), resolver, ending->getBoundingBox());
689  QSharedPointer<QPen> pen = getPen(ellipse, ending->getGroup(), resolver, ending->getBoundingBox());
690  QGraphicsPathItem* outline = new QGraphicsPathItem(*linePath);
691  outline->setPen(*pen);
692  outline->setBrush(*brush);
693  itemGroup->addToGroup(outline);
694  }
695  }
696  else if (rect != NULL)
697  {
698  QPainterPath path = item->path();
699  QSharedPointer<QPainterPath> linePath = getPath(rect, ending->getBoundingBox());
700  applyRotationalMapping(*linePath, ending, point, second);
701  linePath->translate(point);
702  path.addPath(*linePath);
703  item->setPath(path);
704 
705  if (rect->isSetFill() || group->isSetFill())
706  {
707  QSharedPointer<QBrush> brush = getBrush(rect, ending->getGroup(), resolver, ending->getBoundingBox());
708  QSharedPointer<QPen> pen = getPen(rect, ending->getGroup(), resolver, ending->getBoundingBox());
709  QGraphicsPathItem* outline = new QGraphicsPathItem(*linePath);
710  outline->setPen(*pen);
711  outline->setBrush(*brush);
712  itemGroup->addToGroup(outline);
713  }
714  }
715  }
716 }
717 
718 void fillItemFromRenderCurve(QGraphicsItemGroup *item, const CLBoundingBox *pBB, const CLRenderCurve* pCurve, const CLGroup *group, const CLRenderResolver* resolver)
719 {
720  QSharedPointer<QPainterPath> path = getPath(pCurve, pBB);
721 
722  QGraphicsPathItem *pathItem = new QGraphicsPathItem(*path);
723  QSharedPointer<QPen> pen = getPen(pCurve, group, resolver, pBB);
724  pathItem->setPen(*pen);
725 
726  item->addToGroup(pathItem);
727  //QBrush *brush = getBrush(NULL, group, resolver, pBB);
728  //pathItem->setBrush(*brush);
729  //delete brush;
730 
731  if (path->elementCount() > 1)
732  {
733  if (group -> isSetStartHead())
734  {
735  const CLLineEnding *line = resolver->getLineEnding(group->getStartHead());
736  addLineEndingToItem(pathItem, line, group, resolver, path->elementAt(0), path->elementAt(1), item);
737  }
738  else if (pCurve->isSetStartHead())
739  {
740  const CLLineEnding *line = resolver->getLineEnding(pCurve->getStartHead());
741  addLineEndingToItem(pathItem, line, line->getGroup(), resolver, path->elementAt(0), path->elementAt(1), item);
742  }
743 
744  if (group->isSetEndHead())
745  {
746  const CLLineEnding *line = resolver->getLineEnding(group->getEndHead());
747  addLineEndingToItem(pathItem, line, group, resolver, path->elementAt(path->elementCount() - 1), path->elementAt(path->elementCount() - 2), item);
748  }
749  else if (pCurve->isSetEndHead())
750  {
751  const CLLineEnding *line = resolver->getLineEnding(pCurve->getEndHead());
752  addLineEndingToItem(pathItem, line, line->getGroup(), resolver, path->elementAt(path->elementCount() - 1), path->elementAt(path->elementCount() - 2), item);
753  }
754  }
755 
756  transform(pathItem, pCurve, group);
757 }
758 
759 void fillItemFromPolygon(QGraphicsItemGroup *item, const CLBoundingBox *pBB, const CLPolygon* pPoly, const CLGroup *group, const CLRenderResolver* resolver)
760 {
761  QSharedPointer<QPainterPath> path = getPath(pPoly, pBB);
762  path->setFillRule(Qt::WindingFill);
763 
764  if (pPoly->isSetFillRule())
765  {
766  switch (pPoly->getFillRule())
767  {
769  path->setFillRule(Qt::OddEvenFill);
770  break;
771 
773  default:
774  path->setFillRule(Qt::WindingFill);
775  break;
776  }
777  }
778 
779  if (group->isSetFillRule())
780  {
781  switch (group->getFillRule())
782  {
784  path->setFillRule(Qt::OddEvenFill);
785  break;
786 
788  default:
789  path->setFillRule(Qt::WindingFill);
790  break;
791  }
792  }
793 
794  QGraphicsPathItem *pathItem = new QGraphicsPathItem(*path);
795  QSharedPointer<QPen> pen = getPen(pPoly, group, resolver, pBB);
796  pathItem->setPen(*pen);
797  QSharedPointer<QBrush> brush = getBrush(pPoly, group, resolver, pBB);
798  pathItem->setBrush(*brush);
799 
800  transform(pathItem, pPoly, group);
801 
802  item->addToGroup(pathItem);
803 }
804 
805 void adjustPosition(QGraphicsTextItem *item, const CLBoundingBox *pBB, const CLText *pText, const CLGroup *group)
806 {
807  qreal width = item->boundingRect().width();
808  qreal height = item->boundingRect().height();
809  double bbWidth = pBB->getDimensions().getWidth();
810  double bbHeight = pBB->getDimensions().getHeight();
811 
812  if (group != NULL && (group->isSetTextAnchor() || group->isSetVTextAnchor()))
813  {
814  QPointF pos = item->pos();
815 
816  if (group->isSetTextAnchor() && width > 0)
817  {
818  switch (group->getTextAnchor())
819  {
821  pos.setX(pBB->getPosition().getX() + (bbWidth - width) / 2.0);
822  break;
823 
824  case CLText::ANCHOR_END:
825  pos.setX(pBB->getPosition().getX() + bbWidth - width);
826  break;
827 
829  default:
830  break;
831  }
832  }
833 
834  if (group->isSetVTextAnchor() && height > 0)
835  {
836  switch (group->getVTextAnchor())
837  {
839  pos.setY(pBB->getPosition().getY() + (bbHeight - height) / 2.0);
840  break;
841 
843  pos.setY(pBB->getPosition().getY() + (bbHeight - height));
844  break;
845 
846  case CLText::ANCHOR_TOP:
847  default:
848  break;
849  }
850  }
851 
852  item->setPos(pos);
853  }
854 
855  if (pText != NULL && (pText->isSetTextAnchor() || pText->isSetVTextAnchor()))
856  {
857  QPointF pos = item->pos();
858 
859  if (pText->isSetTextAnchor() && width > 0)
860  {
861  switch (pText->getTextAnchor())
862  {
864  pos.setX(pBB->getPosition().getX() + (bbWidth - width) / 2.0);
865  break;
866 
867  case CLText::ANCHOR_END:
868  pos.setX(pBB->getPosition().getX() + bbWidth - width);
869  break;
870 
872  default:
873  break;
874  }
875  }
876 
877  if (pText->isSetVTextAnchor() && height > 0)
878  {
879  switch (pText->getVTextAnchor())
880  {
882  pos.setY(pBB->getPosition().getY() + (bbHeight - height) / 2.0);
883  break;
884 
886  pos.setY(pBB->getPosition().getY() + bbHeight - height);
887  break;
888 
889  case CLText::ANCHOR_TOP:
890  default:
891  break;
892  }
893  }
894 
895  item->setPos(pos);
896  }
897 }
898 
899 void fillItemFromText(QGraphicsItemGroup *item, const CLBoundingBox *pBB, const CLText *pText, const CLGroup *group, const CLRenderResolver* resolver)
900 {
901  double x = pBB->getPosition().getX() + pText->getX().getAbsoluteValue() + pText->getX().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth();
902  double y = pBB->getPosition().getY() + pText->getY().getAbsoluteValue() + pText->getY().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
903 
904  QGraphicsTextItem* result = new QGraphicsTextItem(pText->getText().c_str());
905  result ->setPos(x, y);
906 
907  if (pText->isSetStroke())
908  {
909  result->setDefaultTextColor(getColor(pText->getStroke(), resolver));
910  }
911  else if (group->isSetStroke())
912  {
913  result->setDefaultTextColor(getColor(group->getStroke(), resolver));
914  }
915 
916  QSharedPointer<QFont> font = getFont(pText, group, resolver, pBB);
917 
918  if (!font.isNull())
919  {
920  result->setFont(*font);
921 
922  adjustPosition(result, pBB, pText, group);
923  }
924 
925  transform(result, pText, group);
926  item->addToGroup(result);
927 }
928 
929 void fillItemFromImage(QGraphicsItemGroup *item, const CLBoundingBox *pBB, const CLImage *pImage, const CLGroup *group, const CLRenderResolver* /* resolver*/)
930 {
931  double x = pBB->getPosition().getX() + pImage->getX().getAbsoluteValue() + pImage->getX().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth();
932  double y = pBB->getPosition().getY() + pImage->getY().getAbsoluteValue() + pImage->getY().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
933  double w = pImage->getWidth().getAbsoluteValue() + pImage->getWidth().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth();
934  double h = pImage->getHeight().getAbsoluteValue() + pImage->getHeight().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
935 
936  QFile *fileName = new QFile(pImage->getImageReference().c_str());
937 
938  if (!fileName->exists())
939  {
940  delete fileName;
941  std::string file = ((*CCopasiRootContainer::getDatamodelList())[0])->getReferenceDirectory() + "/" + pImage->getImageReference();
942  fileName = new QFile(file.c_str());
943  }
944 
945  if (!fileName->exists())
946  {
947  delete fileName;
948  return;
949  }
950 
951  QPixmap pixmap(fileName->fileName());
952  pixmap = pixmap.scaled(w, h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
953  delete fileName;
954  QGraphicsPixmapItem* result = new QGraphicsPixmapItem(
955  pixmap);
956  result->setPos(x, y);
957  transform(result, pImage, group);
958 
959  item->addToGroup(result);
960 }
961 
962 void fillItemFromRectangle(QGraphicsItemGroup *item, const CLBoundingBox *pBB, const CLRectangle *pRect, const CLGroup *group, const CLRenderResolver* resolver)
963 {
964  double x = pBB->getPosition().getX() + pRect->getX().getAbsoluteValue() + pRect->getX().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth();
965  double y = pBB->getPosition().getY() + pRect->getY().getAbsoluteValue() + pRect->getY().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
966  double w = pRect->getWidth().getAbsoluteValue() + pRect->getWidth().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth();
967  double h = pRect->getHeight().getAbsoluteValue() + pRect->getHeight().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
968  double rx = pRect->getRadiusX().getAbsoluteValue() + pRect->getRadiusX().getRelativeValue() / 100.0 * pBB->getDimensions().getWidth();
969  double ry = pRect->getRadiusY().getAbsoluteValue() + pRect->getRadiusY().getRelativeValue() / 100.0 * pBB->getDimensions().getHeight();
970 
971  QGraphicsRectItem* result = new CQRoundedRect(
972  x, y, w, h, rx, ry);
973  QSharedPointer<QPen> pen = getPen(pRect, group, resolver, pBB);
974  result->setPen(*pen);
975 
976  QSharedPointer<QBrush> brush = getBrush(pRect, group, resolver, pBB);
977  result->setBrush(*brush);
978 
979  transform(result, pRect, group);
980  item->addToGroup(result);
981 }
982 
983 void fillItemFromGroup(QGraphicsItemGroup *item, const CLBoundingBox *bounds, const CLGroup *group, const CLRenderResolver* resolver)
984 {
985  if (group == NULL)
986  return;
987 
988  size_t numElements = group->getNumElements();
989 
990  if (numElements == 0)
991  {
992  return;
993  }
994 
995  for (size_t i = 0; i < numElements; ++i)
996  {
997  const CCopasiObject* object = group->getElement(i);
998  const CLEllipse* ellipse = dynamic_cast<const CLEllipse*>(object);
999  const CLRectangle* rect = dynamic_cast<const CLRectangle*>(object);
1000  const CLPolygon* poly = dynamic_cast<const CLPolygon*>(object);
1001  const CLCurve* curve = dynamic_cast<const CLCurve*>(object);
1002  const CLRenderCurve* rcurve = dynamic_cast<const CLRenderCurve*>(object);
1003  const CLText* text = dynamic_cast<const CLText*>(object);
1004  const CLImage* image = dynamic_cast<const CLImage*>(object);
1005  const CLGroup* childGroup = dynamic_cast<const CLGroup*>(object);
1006 
1007  if (ellipse != NULL)
1008  {
1009  fillItemFromEllipse(item, bounds, ellipse, group, resolver);
1010  }
1011  else if (rect != NULL)
1012  {
1013  fillItemFromRectangle(item, bounds, rect, group, resolver);
1014  }
1015  else if (text != NULL)
1016  {
1017  fillItemFromText(item, bounds, text, group, resolver);
1018  }
1019  else if (curve != NULL)
1020  {
1021  fillItemFromCurve(item, bounds, curve, group, resolver);
1022  }
1023  else if (rcurve != NULL)
1024  {
1025  fillItemFromRenderCurve(item, bounds, rcurve, group, resolver);
1026  }
1027  else if (poly != NULL)
1028  {
1029  fillItemFromPolygon(item, bounds, poly, group, resolver);
1030  }
1031  else if (image != NULL)
1032  {
1033  fillItemFromImage(item, bounds, image, group, resolver);
1034  }
1035  else if (childGroup != NULL)
1036  {
1037  fillItemFromGroup(item, bounds, childGroup, resolver);
1038  }
1039  }
1040 
1041  transform(item, group, NULL);
1042 }
1043 
1044 void CQRenderConverter::applyStyle(QGraphicsPathItem* item, const CLBoundingBox* bounds, const CLGroup *group, const CLRenderResolver* resolver, QGraphicsItemGroup* itemGroup)
1045 {
1046  if (resolver == NULL || group == NULL || bounds == NULL || item == NULL)
1047  return;
1048 
1049  QSharedPointer<QPen> pen = getPen(NULL, group, resolver, bounds);
1050  item->setPen(*pen);
1051 
1052  if (item->path().elementCount() < 2)
1053  return;
1054 
1055  QPointF start = item->path().elementAt(0);
1056  QPointF second = item->path().elementAt(1);
1057  QPointF end = item->path().elementAt(item->path().elementCount() - 1);
1058  QPointF secondLast = item->path().elementAt(item->path().elementCount() - 2);
1059 
1060  if (group -> isSetStartHead())
1061  {
1062  const CLLineEnding *line = resolver->getLineEnding(group->getStartHead());
1063  addLineEndingToItem(item, line, group, resolver, start, second, itemGroup);
1064  }
1065 
1066  if (group->isSetEndHead())
1067  {
1068  const CLLineEnding *line = resolver->getLineEnding(group->getEndHead());
1069  addLineEndingToItem(item, line, group, resolver, end, secondLast, itemGroup);
1070  }
1071 }
1072 
1073 void CQRenderConverter::applyStyle(QGraphicsItemGroup *group, const CLBoundingBox* bounds, const CLGroup *style, const CLRenderResolver* resolver)
1074 {
1075  if (resolver == NULL || style == NULL || bounds == NULL || group == NULL)
1076  return;
1077 
1078  for (int i = 0; i < group->childItems().size(); ++i)
1079  {
1080  }
1081 }
1082 
1083 void CQRenderConverter::applyStyle(QGraphicsTextItem *item, const CLBoundingBox* bounds, const CLGroup *style, const CLRenderResolver* resolver)
1084 {
1085  if (resolver == NULL || style == NULL || bounds == NULL || item == NULL)
1086  return;
1087 
1088  if (style->isSetStroke())
1089  item->setDefaultTextColor(getColor(style->getStroke(), resolver));
1090 
1091  QSharedPointer<QFont> font = getFont(NULL, style, resolver, bounds);
1092 
1093  if (!font.isNull())
1094  {
1095  item->setFont(*font);
1096 
1097  adjustPosition(item, bounds, NULL, style);
1098  }
1099 }
1100 
1101 void CQRenderConverter::fillGroupFromStyle(QGraphicsItemGroup *group, const CLBoundingBox *bounds, const CLStyle *style, const CLRenderResolver* resolver)
1102 {
1103  if (resolver == NULL || style == NULL || bounds == NULL || group == NULL)
1104  return;
1105 
1106  fillItemFromGroup(group, bounds, style->getGroup(), resolver);
1107 }
1108 
1109 void CQRenderConverter::setBackground(QGraphicsScene *scene, const std::string& fill, const CLRenderResolver* resolver)
1110 {
1111  if (resolver == NULL || scene == NULL) return;
1112 
1113  QBrush brush(getColor(fill, resolver));
1114  scene->setBackgroundBrush(brush);
1115 }
const CLRelAbsVector & getRadius() const
CLRelAbsVector & getX()
Definition: CLImage.cpp:198
const CLRelAbsVector & basePoint1_X() const
void fillItemFromImage(QGraphicsItemGroup *item, const CLBoundingBox *pBB, const CLImage *pImage, const CLGroup *group, const CLRenderResolver *)
const CLRelAbsVector & getCenterY() const
const CLRelAbsVector & getYPoint1() const
const C_FLOAT64 & getWidth() const
Definition: CLBase.h:211
const CLRelAbsVector & getCenterX() const
Definition: CLText.h:27
const CLRelAbsVector & basePoint2_Y() const
const CLRelAbsVector & getHeight() const
Definition: CLImage.cpp:116
const CLColorDefinition * getColorDefinition(const std::string &id) const
bool isSetFontWeight() const
Definition: CLGroup.cpp:584
const std::string & getStartHead() const
QSharedPointer< QFont > getFont(const CLText *item, const CLGroup *group, const CLRenderResolver *, const CLBoundingBox *pBB)
bool isSetEndHead() const
Definition: CLGroup.cpp:560
const CLRelAbsVector & getY() const
Definition: CLText.cpp:214
const CLRelAbsVector & getRadiusY() const
qreal linear(qreal a, qreal b, qreal t)
bool isSetFontFamily() const
Definition: CLGroup.cpp:568
const CLRelAbsVector & getWidth() const
bool isSetFontSize() const
Definition: CLGroup.cpp:576
static void setBackground(QGraphicsScene *scene, const std::string &fill, const CLRenderResolver *resolver)
CLRelAbsVector & getY()
Definition: CLImage.cpp:206
double getRelativeValue() const
bool setColorValue(const std::string &valueString)
unsigned char getBlue() const
CLGradientStop * getGradientStop(size_t i)
bool isSetFontStyle() const
Definition: CLText.cpp:406
const CLRelAbsVector & basePoint2_X() const
const CLRelAbsVector & getXPoint2() const
const std::string & getFontFamily() const
Definition: CLGroup.cpp:312
const CLRelAbsVector & getFontSize() const
Definition: CLText.cpp:318
const std::string & getStroke() const
const CLPoint & getBase1() const
Definition: CLCurve.h:82
bool isSetFontSize() const
Definition: CLText.cpp:390
static void fillGroupFromStyle(QGraphicsItemGroup *group, const CLBoundingBox *bounds, const CLStyle *style, const CLRenderResolver *resolver)
CLRelAbsVector & getFontSize()
Definition: CLGroup.cpp:320
const std::string & getImageReference() const
Definition: CLImage.cpp:132
bool isSetFontFamily() const
Definition: CLText.cpp:382
size_t getNumGradientStops() const
bool isSetVTextAnchor() const
Definition: CLText.cpp:422
const CLRelAbsVector & getX() const
const CLRelAbsVector & getRX() const
Definition: CLEllipse.cpp:151
FONT_STYLE getFontStyle() const
Definition: CLText.cpp:334
QSharedPointer< QPen > getPen(const CLGraphicalPrimitive1D *item, const CLGroup *group, const CLRenderResolver *resolver, const CLBoundingBox *)
const CLDimensions & getDimensions() const
Definition: CLBase.h:266
const CLRelAbsVector & getY() const
const CLRelAbsVector & getCY() const
Definition: CLEllipse.cpp:135
const CLRelAbsVector & getRadiusX() const
void applyRotationalMapping(QPainterPath &linePath, const CLLineEnding *ending, QPointF point, QPointF second)
void moveToPoint(QPainterPath &path, const CLRenderPoint *current, const CLBoundingBox *pBB)
const std::string & getStopColor() const
void addToPath(QPainterPath &path, const CLRenderCubicBezier *cubic, const CLBoundingBox *pBB)
const CLPoint & getBase2() const
Definition: CLCurve.h:83
const CLRelAbsVector & getOffset() const
QSharedPointer< QBrush > getBrush(const CLGraphicalPrimitive2D *item, const CLGroup *group, const CLRenderResolver *resolver, const CLBoundingBox *pBB)
const CLPoint & getEnd() const
Definition: CLCurve.h:75
const CLRelAbsVector & getHeight() const
const std::string & getEndHead() const
const C_FLOAT64 & getX() const
Definition: CLBase.h:83
const CLRelAbsVector & getFocalPointY() const
const CLPoint & getPosition() const
Definition: CLBase.h:265
const std::string & getStartHead() const
Definition: CLGroup.cpp:368
unsigned char getGreen() const
const CLGroup * getGroup() const
Definition: CLStyle.cpp:91
CCopasiObject * getElement(size_t n)
Definition: CLGroup.cpp:409
static void applyStyle(QGraphicsTextItem *item, const CLBoundingBox *bounds, const CLGroup *style, const CLRenderResolver *resolver)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
const CLGroup * getGroup() const
bool isSetTextAnchor() const
Definition: CLGroup.cpp:775
unsigned char getRed() const
QPointF normalizePoint(const QPointF &vector)
void fillItemFromGroup(QGraphicsItemGroup *item, const CLBoundingBox *bounds, const CLGroup *group, const CLRenderResolver *resolver)
std::vector< CLPoint > getListOfPoints() const
Definition: CLCurve.cpp:130
const std::string & getEndHead() const
Definition: CLGroup.cpp:376
void transform(QGraphicsItem *item, const CLTransformation2D *trans, const CLGroup *group)
const CLRelAbsVector & getWidth() const
Definition: CLImage.cpp:108
bool isSetFontStyle() const
Definition: CLGroup.cpp:592
QSharedPointer< QRadialGradient > getRadialGradient(const CLRadialGradient *radial, const CLBoundingBox *bounds, const CLRenderResolver *resolver)
CLText::FONT_STYLE getFontStyle() const
Definition: CLGroup.cpp:344
bool isSetStartHead() const
unsigned char getAlpha() const
CLText::FONT_WEIGHT getFontWeight() const
Definition: CLGroup.cpp:336
const CLRelAbsVector & getXOffset() const
const CLRelAbsVector & getRY() const
Definition: CLEllipse.cpp:159
CLBoundingBox * getBoundingBox()
CLText::TEXT_ANCHOR getVTextAnchor() const
Definition: CLGroup.cpp:360
const CLRelAbsVector & getYOffset() const
void fillItemFromText(QGraphicsItemGroup *item, const CLBoundingBox *pBB, const CLText *pText, const CLGroup *group, const CLRenderResolver *resolver)
QSharedPointer< QGradient > getGradient(const CLGradientBase *base, const CLBoundingBox *bounds, const CLRenderResolver *resolver)
const C_FLOAT64 & getY() const
Definition: CLBase.h:84
void fillItemFromRenderCurve(QGraphicsItemGroup *item, const CLBoundingBox *pBB, const CLRenderCurve *pCurve, const CLGroup *group, const CLRenderResolver *resolver)
bool isBezier() const
Definition: CLCurve.h:90
double getAbsoluteValue() const
const C_FLOAT64 & getHeight() const
Definition: CLBase.h:212
const std::string & getFillColor() const
void addLineEndingToItem(QGraphicsPathItem *item, const CLLineEnding *ending, const CLGroup *group, const CLRenderResolver *resolver, QPointF point, QPointF second, QGraphicsItemGroup *itemGroup)
const CLLineSegment * getSegmentAt(size_t i) const
Definition: CLCurve.h:156
bool isSetEndHead() const
const double * getMatrix2D() const
std::vector< CLRenderPoint * > * getListOfElements()
Definition: CLPolygon.cpp:108
const std::string & getFontFamily() const
Definition: CLText.cpp:302
QColor getColor(const CLColorDefinition *cd)
const CLRelAbsVector & getFocalPointX() const
bool isSetTextAnchor() const
Definition: CLText.cpp:414
bool getIsEnabledRotationalMapping() const
const CLRelAbsVector & getCX() const
Definition: CLEllipse.cpp:127
QSharedPointer< QLinearGradient > getLinearGradient(const CLLinearGradient *linear, const CLBoundingBox *bounds, const CLRenderResolver *resolver)
TEXT_ANCHOR getVTextAnchor() const
Definition: CLText.cpp:350
const CLRelAbsVector & basePoint1_Y() const
const std::string & getText() const
Definition: CLText.cpp:358
QSharedPointer< QPainterPath > getPath(const CLPolygon *pCurve, const CLBoundingBox *pBB)
const std::vector< CLRenderPoint * > * getListOfCurveElements() const
SPREADMETHOD getSpreadMethod() const
const CLLineEnding * getLineEnding(const std::string &id) const
const CLRelAbsVector & getX() const
Definition: CLText.cpp:206
void fillItemFromRectangle(QGraphicsItemGroup *item, const CLBoundingBox *pBB, const CLRectangle *pRect, const CLGroup *group, const CLRenderResolver *resolver)
bool isSetMatrix() const
CLText::TEXT_ANCHOR getTextAnchor() const
Definition: CLGroup.cpp:352
const CLGradientBase * getGradientBase(const std::string &id) const
bool isSetFontWeight() const
Definition: CLText.cpp:398
size_t getNumElements() const
Definition: CLGroup.cpp:384
void fillItemFromPolygon(QGraphicsItemGroup *item, const CLBoundingBox *pBB, const CLPolygon *pPoly, const CLGroup *group, const CLRenderResolver *resolver)
const CLRelAbsVector & getYPoint2() const
size_t getNumCurveSegments() const
Definition: CLCurve.h:168
TEXT_ANCHOR getTextAnchor() const
Definition: CLText.cpp:342
const CLRelAbsVector & getXPoint1() const
bool isSetVTextAnchor() const
Definition: CLGroup.cpp:783
const std::vector< unsigned int > & getDashArray() const
void fillItemFromCurve(QGraphicsItemGroup *item, const CLBoundingBox *pBB, const CLCurve *pCurve, const CLGroup *group, const CLRenderResolver *resolver)
bool isContinuous() const
Definition: CLCurve.cpp:117
const CLPoint & getStart() const
Definition: CLCurve.h:74
FONT_WEIGHT getFontWeight() const
Definition: CLText.cpp:326
void adjustPosition(QGraphicsTextItem *item, const CLBoundingBox *pBB, const CLText *pText, const CLGroup *group)
void fillItemFromEllipse(QGraphicsItemGroup *item, const CLBoundingBox *pBB, const CLEllipse *pEllipse, const CLGroup *group, const CLRenderResolver *resolver)