6 #include <QtCore/QCoreApplication>
7 #include <QtGui/QGraphicsScene>
8 #include <QtGui/QGraphicsItem>
9 #include <QtGui/QPainter>
10 #include <QtGui/QPrinter>
11 #include <QtGui/QImage>
12 #include <QtGui/QGraphicsEffect>
40 , mpRender(renderInformation)
75 if (fileType ==
"pdf")
77 QPrinter printer(QPrinter::HighResolution);
78 printer.setOutputFormat(QPrinter::PdfFormat);
79 printer.setOutputFileName(fileName.c_str());
80 QPainter painter(&printer);
81 painter.setRenderHints(
82 QPainter::Antialiasing | QPainter::HighQualityAntialiasing | QPainter::SmoothPixmapTransform);
83 render(&painter, QRect(), itemsBoundingRect());
89 QImage image(QSize(width()*scale, height()*scale), QImage::Format_ARGB32);
90 QPainter painter(&image);
91 painter.setRenderHints(
92 QPainter::Antialiasing | QPainter::HighQualityAntialiasing | QPainter::SmoothPixmapTransform);
93 render(&painter, image.rect(), itemsBoundingRect());
95 image.save(fileName.c_str(), fileType.c_str());
104 if (renderInformation == NULL)
129 mpResolver = QSharedPointer<CLRenderResolver>(resolver);
149 if (go == NULL)
return;
155 QGraphicsItem *item = NULL;
157 if (curveGlyph != NULL)
163 else if (text != NULL)
176 if (obj != NULL && text == NULL)
190 while (it != subGlyphs.
end())
205 if (layout == NULL)
return;
219 while (itComp != comps.
end())
229 while (itReactions != reactions.
end())
239 while (itSpecies != species.
end())
249 while (itTexts != texts.
end())
259 while (itList != list.
end())
271 while (it != texts.
end())
273 if ((*it)->getGraphicalObjectKey() == obj->
getKey())
290 while (it != metabs.
end())
292 if ((*it)->getModelObjectKey() == metab->
getKey())
303 if (obj == NULL)
return;
328 while (it != metabs.
end())
339 if (kf == NULL)
return;
343 if (obj == NULL)
return;
345 CLPoint delta(newPos.x(), newPos.y());
std::map< std::string, QGraphicsItem * > mItems
const CLayout * getCurrentLayout() const
QSharedPointer< CLRenderResolver > mpResolver
void saveToFile(const std::string &fileName, const std::string &fileType="pdf")
const CCopasiVector< CLTextGlyph > & getListOfTextGlyphs() const
CLRenderInformationBase * mpRender
CCopasiVectorNS< CMetab > & getMetabolites()
void setLayout(CLayout *layout, CCopasiDataModel *model=NULL, CLRenderInformationBase *renderInformation=NULL)
virtual CCopasiObjectName getCN() const
const CCopasiVector< CLLocalRenderInformation > & getListOfLocalRenderInformationObjects() const
virtual size_t size() const
CCopasiObject * get(const std::string &key)
void fillFromLayout(const CLayout *layout)
static void setBackground(QGraphicsScene *scene, const std::string &fill, const CLRenderResolver *resolver)
const CLRenderInformationBase * getCurrentRenderInfo() const
const CCopasiVector< CLGraphicalObject > & getListOfSubglyphs() const
CQLayoutScene(CLayout *layout, CCopasiDataModel *model=NULL, CLRenderInformationBase *renderInformation=NULL)
void initializeResolver(CCopasiDataModel *model, CLRenderInformationBase *renderInformation)
const CCopasiVector< CLCompartmentGlyph > & getListOfCompartmentGlyphs() const
virtual const std::string & getKey() const
CLGraphicalObject * getMetabGlyphForKey(const CLayout *layout, const CMetab *metab)
CLGlobalRenderInformation * getDefaultStyle(size_t index)
void setRenderInformation(CCopasiDataModel *model, CLRenderInformationBase *renderInformation)
virtual const std::string & getKey() const
void updatePosition(const QString &key, const QPointF &newPos)
const CCopasiVector< CLMetabGlyph > & getListOfMetaboliteGlyphs() const
CListOfLayouts * getListOfLayouts()
const CCopasiVector< CLGeneralGlyph > & getListOfGeneralGlyphs() const
CLGraphicalObject * getTextForItem(const CLayout *layout, const CLGraphicalObject *obj)
CCopasiObject * getModelObject() const
static CKeyFactory * getKeyFactory()
virtual void moveBy(const CLPoint &p)
void addGlyph(const CLGraphicalObject *go)
void setResolver(CLRenderResolver *resolver)
const CLCurve & getCurve() const
size_t getNumCurveSegments() const
const CLRenderResolver * getResolver() const
void moveObject(CLGraphicalObject *obj, const CLPoint &delta, CLayout *layout)
const CCopasiVector< CLReactionGlyph > & getListOfReactionGlyphs() const
QGraphicsItem * getItemFor(const std::string &cn)
const CCopasiVector< CLGlobalRenderInformation > & getListOfGlobalRenderInformationObjects() const