COPASI API  4.16.103
Public Member Functions | Protected Attributes | Friends | List of all members
CLTextGlyph Class Reference

#include <CLGlyphs.h>

Inheritance diagram for CLTextGlyph:
Inheritance graph
[legend]
Collaboration diagram for CLTextGlyph:
Collaboration graph
[legend]

Public Member Functions

void clearText ()
 
virtual CLGraphicalObjectclone () const
 
 CLTextGlyph (const std::string &name="TextGlyph", const CCopasiContainer *pParent=NULL)
 
 CLTextGlyph (const CLTextGlyph &src, const CCopasiContainer *pParent=NULL)
 
 CLTextGlyph (const TextGlyph &sbml, const std::map< std::string, std::string > &modelmap, std::map< std::string, std::string > &layoutmap, const CCopasiContainer *pParent=NULL)
 
void exportReferenceToSBML (TextGlyph *g, const std::map< const CLBase *, const SBase * > &layoutmap) const
 
virtual void exportToSBML (TextGlyph *g, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs) const
 
CLGraphicalObjectgetGraphicalObject () const
 
const std::string & getGraphicalObjectKey () const
 
virtual std::string getText () const
 
bool isTextSet () const
 
CLTextGlyphoperator= (const CLTextGlyph &rhs)
 
void print (std::ostream *ostream) const
 
void setGraphicalObjectKey (const std::string &k)
 
void setText (const std::string &t)
 
- Public Member Functions inherited from CLGraphicalObject
 CLGraphicalObject (const std::string &name="GraphicalObject", const CCopasiContainer *pParent=NULL)
 
 CLGraphicalObject (const CLGraphicalObject &src, const CCopasiContainer *pParent=NULL)
 
 CLGraphicalObject (const GraphicalObject &sbml, std::map< std::string, std::string > &layoutmap, const CCopasiContainer *pParent=NULL)
 
virtual void exportToSBML (GraphicalObject *sbmlobject, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs) const
 
const CLBoundingBoxgetBoundingBox () const
 
CLBoundingBoxgetBoundingBox ()
 
const CLDimensionsgetDimensions () const
 
const C_FLOAT64getHeight () const
 
virtual const std::string & getKey () const
 
CCopasiObjectgetModelObject () const
 
std::string getModelObjectDisplayName (bool regular=true, bool richtext=false) const
 
const std::string & getModelObjectKey () const
 
std::string getModelObjectName () const
 
const std::string & getObjectRole () const
 
const CLPointgetPosition () const
 
const C_FLOAT64getWidth () const
 
const C_FLOAT64getX () const
 
const C_FLOAT64getY () const
 
bool hasValidModelReference () const
 
virtual void moveBy (const CLPoint &p)
 
CLGraphicalObjectoperator= (const CLGraphicalObject &rhs)
 
void print (std::ostream *ostream) const
 
void setBoundingBox (const CLBoundingBox &bb)
 
void setDimensions (const CLDimensions &d)
 
void setHeight (const C_FLOAT64 &h)
 
void setModelObjectKey (const std::string &k)
 
void setObjectRole (const std::string &role)
 
void setPosition (const CLPoint &p)
 
void setWidth (const C_FLOAT64 &w)
 
void setX (const C_FLOAT64 &x)
 
void setY (const C_FLOAT64 &y)
 
 ~CLGraphicalObject ()
 
- Public Member Functions inherited from CLBase
 CLBase ()
 
 CLBase (const CLBase &b)
 
 CLBase (const SBase &)
 
const std::string & getTag () const
 
bool hasTag () const
 
void setTag (const std::string &tag)
 
virtual ~CLBase ()
 
- Public Member Functions inherited from CCopasiContainer
virtual bool add (CCopasiObject *pObject, const bool &adopt=true)
 
 CCopasiContainer (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=CCopasiObject::Container)
 
 CCopasiContainer (const CCopasiContainer &src, const CCopasiContainer *pParent=NULL)
 
virtual std::string getChildObjectUnits (const CCopasiObject *pObject) const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
virtual const objectMapgetObjects () const
 
virtual std::string getUnits () const
 
virtual const CCopasiObjectgetValueObject () const
 
virtual bool remove (CCopasiObject *pObject)
 
virtual ~CCopasiContainer ()
 
- Public Member Functions inherited from CCopasiObject
void addDirectDependency (const CCopasiObject *pObject)
 
 CCopasiObject (const CCopasiObject &src, const CCopasiContainer *pParent=NULL)
 
void clearDirectDependencies ()
 
void clearRefresh ()
 
bool dependsOn (DataObjectSet candidates, const DataObjectSet &context=DataObjectSet()) const
 
void getAllDependencies (DataObjectSet &dependencies, const DataObjectSet &context) const
 
virtual CCopasiObjectName getCN () const
 
virtual const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () const
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual RefreshgetRefresh () const
 
UpdateMethodgetUpdateMethod () const
 
virtual voidgetValuePointer () const
 
bool hasCircularDependencies (DataObjectSet &candidates, DataObjectSet &verified, const DataObjectSet &context) const
 
bool hasUpdateMethod () const
 
bool isArray () const
 
bool isContainer () const
 
bool isDataModel () const
 
bool isMatrix () const
 
bool isNameVector () const
 
bool isNonUniqueName () const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
 
bool isReference () const
 
bool isRoot () const
 
bool isSeparator () const
 
bool isStaticString () const
 
bool isValueBool () const
 
bool isValueDbl () const
 
bool isValueInt () const
 
bool isValueInt64 () const
 
bool isValueString () const
 
bool isVector () const
 
virtual bool mustBeDeleted (const DataObjectSet &deletedObjects) const
 
void removeDirectDependency (const CCopasiObject *pObject)
 
void setDirectDependencies (const DataObjectSet &directDependencies)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CCopasiContainer *pParent)
 
void setObjectValue (const C_FLOAT64 &value)
 
void setObjectValue (const C_INT32 &value)
 
void setObjectValue (const bool &value)
 
template<class CType >
void setRefresh (CType *pType, void(CType::*method)(void))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_FLOAT64 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_INT32 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const bool &))
 
virtual ~CCopasiObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
virtual ~CObjectInterface ()
 

Protected Attributes

std::string mGraphicalObjectKey
 
bool mIsTextSet
 
std::string mText
 
- Protected Attributes inherited from CLGraphicalObject
CLBoundingBox mBBox
 
std::string mKey
 
std::string mModelObjectKey
 
std::string mObjectRole
 
- Protected Attributes inherited from CLBase
std::string mTag
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 

Friends

std::ostream & operator<< (std::ostream &os, const CLTextGlyph &g)
 

Additional Inherited Members

- Public Types inherited from CCopasiContainer
typedef std::multimap
< std::string, CCopasiObject * > 
objectMap
 
- Public Types inherited from CCopasiObject
typedef std::set< const
CCopasiObject * > 
DataObjectSet
 
typedef std::vector< Refresh * > DataUpdateSequence
 
- Public Types inherited from CObjectInterface
typedef std::set< const
CObjectInterface * > 
ObjectSet
 
typedef std::vector
< CObjectInterface * > 
UpdateSequence
 
- Static Public Member Functions inherited from CCopasiObject
static std::vector< Refresh * > buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
 
static void setRenameHandler (CRenameHandler *rh)
 
- Static Public Attributes inherited from CCopasiContainer
static const std::vector
< CCopasiContainer * > 
EmptyList
 
- Protected Types inherited from CCopasiObject
enum  Flag {
  Container = 0x1, Vector = 0x2, Matrix = 0x4, NameVector = 0x8,
  Reference = 0x10, ValueBool = 0x20, ValueInt = 0x40, ValueInt64 = 0x80,
  ValueDbl = 0x100, NonUniqueName = 0x200, StaticString = 0x400, ValueString = 0x800,
  Separator = 0x1000, ModelEntity = 0x2000, Array = 0x4000, DataModel = 0x8000,
  Root = 0x10000, Gui = 0x20000
}
 
- Protected Member Functions inherited from CCopasiContainer
template<class CType >
CCopasiObjectaddMatrixReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddObjectReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddVectorReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
void initObjects ()
 
- Protected Member Functions inherited from CCopasiObject
 CCopasiObject ()
 
 CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0)
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Graphical representation of a Label

Definition at line 118 of file CLGlyphs.h.

Constructor & Destructor Documentation

CLTextGlyph::CLTextGlyph ( const std::string &  name = "TextGlyph",
const CCopasiContainer pParent = NULL 
)

Definition at line 180 of file CLGlyphs.cpp.

Referenced by clone().

182  : CLGraphicalObject(name, pParent),
183  mIsTextSet(false),
184  mText(""),
186 {}
std::string mGraphicalObjectKey
Definition: CLGlyphs.h:133
bool mIsTextSet
Definition: CLGlyphs.h:126
CLGraphicalObject(const std::string &name="GraphicalObject", const CCopasiContainer *pParent=NULL)
std::string mText
Definition: CLGlyphs.h:127
CLTextGlyph::CLTextGlyph ( const CLTextGlyph src,
const CCopasiContainer pParent = NULL 
)

Definition at line 188 of file CLGlyphs.cpp.

190  : CLGraphicalObject(src, pParent),
191  mIsTextSet(src.mIsTextSet),
192  mText(src.mText),
194 {}
std::string mGraphicalObjectKey
Definition: CLGlyphs.h:133
bool mIsTextSet
Definition: CLGlyphs.h:126
CLGraphicalObject(const std::string &name="GraphicalObject", const CCopasiContainer *pParent=NULL)
std::string mText
Definition: CLGlyphs.h:127
CLTextGlyph::CLTextGlyph ( const TextGlyph &  sbml,
const std::map< std::string, std::string > &  modelmap,
std::map< std::string, std::string > &  layoutmap,
const CCopasiContainer pParent = NULL 
)

constructor from libsbml object

Definition at line 196 of file CLGlyphs.cpp.

References CLGraphicalObject::setModelObjectKey().

200  : CLGraphicalObject(sbml, layoutmap, pParent),
201  mIsTextSet(sbml.isSetText()),
202  mText(sbml.getText()),
204 {
205  //get the copasi key corresponding to the sbml id for the graphical object
206  /* if (sbml.getGraphicalObjectId() != "")
207  {
208  std::map<std::string, std::string>::const_iterator it = m.find(sbml.getGraphicalObjectId());
209  if (it != m.end())
210  mGraphicalObjectKey = it->second;
211  }*/
212 
213  //get the copasi key corresponding to the sbml id for the model element (OriginOfText)
214  if (sbml.getOriginOfTextId() != "")
215  {
216  std::map<std::string, std::string>::const_iterator it = modelmap.find(sbml.getOriginOfTextId());
217 
218  if (it != modelmap.end())
219  setModelObjectKey(it->second);
220  }
221 }
std::string mGraphicalObjectKey
Definition: CLGlyphs.h:133
bool mIsTextSet
Definition: CLGlyphs.h:126
void setModelObjectKey(const std::string &k)
CLGraphicalObject(const std::string &name="GraphicalObject", const CCopasiContainer *pParent=NULL)
std::string mText
Definition: CLGlyphs.h:127

Member Function Documentation

void CLTextGlyph::clearText ( )

Definition at line 256 of file CLGlyphs.cpp.

References mIsTextSet, and mText.

257 {
258  mIsTextSet = false;
259  mText = "";
260 }
bool mIsTextSet
Definition: CLGlyphs.h:126
std::string mText
Definition: CLGlyphs.h:127
virtual CLGraphicalObject* CLTextGlyph::clone ( ) const
inlinevirtual

Reimplemented from CLGraphicalObject.

Definition at line 167 of file CLGlyphs.h.

References CLTextGlyph().

167 {return new CLTextGlyph(*this, NULL);};
CLTextGlyph(const std::string &name="TextGlyph", const CCopasiContainer *pParent=NULL)
Definition: CLGlyphs.cpp:180
void CLTextGlyph::exportReferenceToSBML ( TextGlyph *  g,
const std::map< const CLBase *, const SBase * > &  layoutmap 
) const

handle the reference to another graphical object for sbml export. This should only be called after all other graphical objects are in the layout map.

Definition at line 297 of file CLGlyphs.cpp.

References getGraphicalObject().

Referenced by CLayout::exportToSBML().

298 {
299  if (!g) return;
300 
301  //reference to layout object
303 
304  if (tmp)
305  {
306  std::map<const CLBase*, const SBase*>::const_iterator it = layoutmap.find(tmp);
307 
308  if (it != layoutmap.end() && it->second)
309  {
310  //we need to cast here since layout objects in libsbml donĀ“t inherit the getId() method
311  //from SBase
312  const GraphicalObject* pGO = dynamic_cast<const GraphicalObject*>(it->second);
313 
314  if (pGO)
315  g->setGraphicalObjectId(pGO->getId());
316  }
317  }
318 }
CLGraphicalObject * getGraphicalObject() const
Definition: CLGlyphs.cpp:262
void CLTextGlyph::exportToSBML ( TextGlyph *  g,
const std::map< const CCopasiObject *, SBase * > &  copasimodelmap,
std::map< std::string, const SBase * > &  sbmlIDs 
) const
virtual

This method writes the information of the copasi layout object into the corresponding sbml object. The reference to other graphical objects cannot be done in this method since when this method is called not necessarily all other graphical objects have been created.

Definition at line 267 of file CLGlyphs.cpp.

References CLGraphicalObject::exportToSBML(), CLGraphicalObject::getModelObject(), isTextSet(), and mText.

Referenced by CLayout::exportToSBML(), and CLGeneralGlyph::exportToSBML().

270 {
271  if (!g) return;
272 
273  //call the coresponding method of the base class
274  CLGraphicalObject::exportToSBML(g, copasimodelmap, sbmlIDs);
275 
276  //reference to model objects
277  CCopasiObject* tmp = getModelObject();
278 
279  if (tmp)
280  {
281  std::map<const CCopasiObject*, SBase*>::const_iterator it = copasimodelmap.find(tmp);
282 
283  if (it != copasimodelmap.end())
284  {
285  if (it->second)
286  g->setOriginOfTextId(it->second->getId());
287  }
288  }
289 
290  //explicit text
291  if (isTextSet())
292  {
293  g->setText(mText);
294  }
295 }
bool isTextSet() const
Definition: CLGlyphs.h:161
virtual void exportToSBML(GraphicalObject *sbmlobject, const std::map< const CCopasiObject *, SBase * > &copasimodelmap, std::map< std::string, const SBase * > &sbmlIDs) const
CCopasiObject * getModelObject() const
std::string mText
Definition: CLGlyphs.h:127
CLGraphicalObject * CLTextGlyph::getGraphicalObject ( ) const

Definition at line 262 of file CLGlyphs.cpp.

References CKeyFactory::get(), CCopasiRootContainer::getKeyFactory(), and mGraphicalObjectKey.

Referenced by exportReferenceToSBML(), operator<<(), and placeTextGlyphs().

263 {
265 }
std::string mGraphicalObjectKey
Definition: CLGlyphs.h:133
CCopasiObject * get(const std::string &key)
static CKeyFactory * getKeyFactory()
const std::string& CLTextGlyph::getGraphicalObjectKey ( ) const
inline

Definition at line 163 of file CLGlyphs.h.

References mGraphicalObjectKey.

Referenced by CLayout::CLayout(), CCopasiXML::saveLayoutList(), and CLLayoutRenderer::update_associations().

163 {return mGraphicalObjectKey;};
std::string mGraphicalObjectKey
Definition: CLGlyphs.h:133
std::string CLTextGlyph::getText ( ) const
virtual

Reimplemented in CLabel.

Definition at line 238 of file CLGlyphs.cpp.

References CLGraphicalObject::getModelObjectDisplayName(), mIsTextSet, and mText.

Referenced by CLLayoutRenderer::resolve_text(), and CCopasiXML::saveLayoutList().

239 {
240  if (mIsTextSet)
241  {
242  return mText;
243  }
244  else
245  {
246  return getModelObjectDisplayName();
247  }
248 }
std::string getModelObjectDisplayName(bool regular=true, bool richtext=false) const
bool mIsTextSet
Definition: CLGlyphs.h:126
std::string mText
Definition: CLGlyphs.h:127
bool CLTextGlyph::isTextSet ( ) const
inline

Definition at line 161 of file CLGlyphs.h.

References mIsTextSet.

Referenced by exportToSBML(), CLLayoutRenderer::resolve_text(), and CCopasiXML::saveLayoutList().

161 {return mIsTextSet;};
bool mIsTextSet
Definition: CLGlyphs.h:126
CLTextGlyph & CLTextGlyph::operator= ( const CLTextGlyph rhs)

assignment operator.

Definition at line 223 of file CLGlyphs.cpp.

References mGraphicalObjectKey, mIsTextSet, mText, and CLGraphicalObject::operator=().

224 {
225  if (this == &rhs) return * this; //do nothing if lhs and rhs are the same
226 
228 
229  //handle the specific text glyph stuff:
230  mIsTextSet = rhs.mIsTextSet;
231  mText = rhs.mText;
232 
234 
235  return *this;
236 }
std::string mGraphicalObjectKey
Definition: CLGlyphs.h:133
bool mIsTextSet
Definition: CLGlyphs.h:126
CLGraphicalObject & operator=(const CLGraphicalObject &rhs)
std::string mText
Definition: CLGlyphs.h:127
void CLTextGlyph::print ( std::ostream *  ostream) const
virtual

This is the output method for any object. The default implementation provided with CCopasiObject uses the ostream operator<< of the object to print the object.To override this default behavior one needs to reimplement the virtual print function.

Parameters
std::ostream* ostream

Reimplemented from CCopasiObject.

Definition at line 335 of file CLGlyphs.cpp.

336 {*ostream << *this;}
void CLTextGlyph::setGraphicalObjectKey ( const std::string &  k)
void CLTextGlyph::setText ( const std::string &  t)

Definition at line 250 of file CLGlyphs.cpp.

References mIsTextSet, and mText.

Referenced by CCopasiXML::saveLayoutList(), and CCopasiXMLParser::TextGlyphElement::start().

251 {
252  mIsTextSet = true;
253  mText = t;
254 }
bool mIsTextSet
Definition: CLGlyphs.h:126
std::string mText
Definition: CLGlyphs.h:127

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CLTextGlyph g 
)
friend

insert operator

Definition at line 320 of file CLGlyphs.cpp.

321 {
322  os << "TextGlyph: " << dynamic_cast<const CLGraphicalObject&>(g);
323 
324  if (g.mIsTextSet)
325  os << " Explicit text is: \"" << g.mText << "\"\n";
326 
328 
329  if (tmp)
330  os << " Label for: \"" << tmp->getObjectName() << "\"\n";
331 
332  return os;
333 }
const std::string & getObjectName() const
bool mIsTextSet
Definition: CLGlyphs.h:126
CLGraphicalObject * getGraphicalObject() const
Definition: CLGlyphs.cpp:262
std::string mText
Definition: CLGlyphs.h:127

Member Data Documentation

std::string CLTextGlyph::mGraphicalObjectKey
protected

Key of a layout element. If this is set the text glyph is considered to be a label to this layout element.

Definition at line 133 of file CLGlyphs.h.

Referenced by getGraphicalObject(), getGraphicalObjectKey(), operator=(), and setGraphicalObjectKey().

bool CLTextGlyph::mIsTextSet
protected

indicates if a text is set. If the text is not set the label text is taken from the model object.

Definition at line 126 of file CLGlyphs.h.

Referenced by clearText(), CLabel::getText(), getText(), isTextSet(), operator<<(), operator=(), and setText().

std::string CLTextGlyph::mText
protected

The documentation for this class was generated from the following files: