The Gnome Chemistry Utils  0.14.17
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gcp::Arrow Class Reference
Inheritance diagram for gcp::Arrow:
gcu::Object gccv::ItemClient gcp::MesomeryArrow gcp::ReactionArrow

Public Member Functions

 Arrow (gcu::TypeId Type)
 
virtual ~Arrow ()
 
bool Load (xmlNodePtr node)
 
void SetSelected (int state)
 
void SetCoords (double xstart, double ystart, double xend, double yend)
 
bool GetCoords (double *xstart, double *ystart, double *xend, double *yend) const
 
bool GetCoords (double *x, double *y, double *z=NULL) const
 
void Move (double x, double y, double z=0)
 
void Transform2D (gcu::Matrix2D &m, double x, double y)
 
double GetYAlign ()
 
std::string GetProperty (unsigned property) const
 
bool SetProperty (unsigned property, char const *value)
 
void SetStartStep (Step *step)
 
Step ** GetStartStepPtr ()
 
StepGetStartStep () const
 
void SetEndStep (Step *step)
 
StepGetEndStep () const
 
Step ** GetEndStepPtr ()
 
void Reverse ()
 
void RemoveStep (Step *step)
 
double GetLength (void) const
 
- Public Member Functions inherited from gcu::Object
 Object (TypeId Id=OtherType)
 
virtual ~Object ()
 
TypeId GetType () const
 
void SetId (gchar const *Id)
 
char const * GetId () const
 
virtual void AddChild (Object *object)
 
ObjectGetMolecule () const
 
ObjectGetReaction () const
 
ObjectGetGroup () const
 
DocumentGetDocument () const
 
ApplicationGetApplication () const
 
ObjectGetParentOfType (TypeId Id) const
 
ObjectGetChild (const gchar *Id) const
 
ObjectGetFirstChild (std::map< std::string, Object *>::iterator &i)
 
ObjectGetNextChild (std::map< std::string, Object *>::iterator &i)
 
ObjectGetDescendant (const char *Id) const
 
ObjectGetParent () const
 
void SetParent (Object *Parent)
 
virtual xmlNodePtr Save (xmlDocPtr xml) const
 
bool SaveChildren (xmlDocPtr xml, xmlNodePtr node) const
 
void SaveId (xmlNodePtr node) const
 
xmlNodePtr GetNodeByProp (xmlNodePtr node, char const *Property, char const *Id)
 
xmlNodePtr GetNextNodeByProp (xmlNodePtr node, char const *Property, char const *Id)
 
xmlNodePtr GetNodeByName (xmlNodePtr node, char const *Name)
 
xmlNodePtr GetNextNodeByName (xmlNodePtr node, char const *Name)
 
bool HasChildren () const
 
unsigned GetChildrenNumber () const
 
virtual ObjectGetAtomAt (double x, double y, double z=0.)
 
virtual bool Build (std::set< Object * > const &Children) throw (std::invalid_argument)
 
virtual bool BuildContextualMenu (UIManager *uim, Object *object, double x, double y)
 
void EmitSignal (SignalId Signal)
 
virtual bool OnSignal (SignalId Signal, Object *Child)
 
void Lock (bool state=true)
 
bool IsLocked ()
 
ObjectGetFirstLink (std::set< Object *>::iterator &i)
 
ObjectGetNextLink (std::set< Object *>::iterator &i)
 
void Link (Object *object)
 
void Unlink (Object *object)
 
virtual void OnUnlink (Object *object)
 
void GetPossibleAncestorTypes (std::set< TypeId > &types) const
 
void SetDirty (bool dirty=true)
 
virtual void Clear ()
 
std::string Identity ()
 
virtual char const * HasPropertiesDialog () const
 
virtual bool CanSelect () const
 
virtual void NotifyEmpty ()
 
void ShowPropertiesDialog ()
 
bool GetDirty (void) const
 
- Public Member Functions inherited from gccv::ItemClient
 ItemClient ()
 
virtual ~ItemClient ()
 
virtual void AddItem ()
 
virtual void UpdateItem ()
 
ItemGetItem (void)
 

Protected Member Functions

bool Save (xmlDocPtr xml, xmlNodePtr node) const
 
std::string Name ()
 
void OnLoaded ()
 
- Protected Member Functions inherited from gcu::Object
virtual DialogBuildPropertiesDialog ()
 

Protected Attributes

double m_x
 
double m_y
 
double m_width
 
double m_height
 
- Protected Attributes inherited from gccv::ItemClient
Itemm_Item
 

Additional Inherited Members

- Static Public Member Functions inherited from gcu::Object
static TypeId AddType (std::string TypeName, Object *(*CreateFunc)(), TypeId id=OtherType)
 
static void AddAlias (TypeId id, std::string TypeName)
 
static ObjectCreateObject (const std::string &TypeName, Object *parent=NULL)
 
static TypeId GetTypeId (const std::string &Name)
 
static std::string GetTypeName (TypeId Id)
 
static void AddMenuCallback (TypeId Id, BuildMenuCb cb)
 
static void AddRule (TypeId type1, RuleId rule, TypeId type2)
 
static void AddRule (const std::string &type1, RuleId rule, const std::string &type2)
 
static const std::set< TypeId > & GetRules (TypeId type, RuleId rule)
 
static const std::set< TypeId > & GetRules (const std::string &type, RuleId rule)
 
static void SetCreationLabel (TypeId Id, std::string Label)
 
static const std::string & GetCreationLabel (TypeId Id)
 
static const std::string & GetCreationLabel (const std::string &TypeName)
 
static SignalId CreateNewSignalId ()
 

Detailed Description

Definition at line 57 of file gcp/arrow.h.

Constructor & Destructor Documentation

◆ Arrow()

gcp::Arrow::Arrow ( gcu::TypeId  Type)
Parameters
Typean arrow type id.

Used to create an arrow of type Id. Should only be called from the constructor of a derived class.

◆ ~Arrow()

virtual gcp::Arrow::~Arrow ( )
virtual

The destructor.

Member Function Documentation

◆ GetCoords() [1/2]

bool gcp::Arrow::GetCoords ( double *  xstart,
double *  ystart,
double *  xend,
double *  yend 
) const
Parameters
xstartwhere to store the x coordinate of the start point.
ystartwhere to store the y coordinate of the start point.
xendwhere to store the x coordinate of the end point.
yendwhere to store the y coordinate of the end point.

Retrieves the position of the arrow.

◆ GetCoords() [2/2]

bool gcp::Arrow::GetCoords ( double *  x,
double *  y,
double *  z = NULL 
) const
virtual
Parameters
xa pointer to the double value which will receive the x coordinate of the Arrow.
ya pointer to the double value which will receive the y coordinate of the Arrow.
za pointer to the double value which will receive the z coordinate of the Arrow or NULL for 2D representations.

Retrieves the coordinates of this Arrow.

Returns
true if successful and false if an error occurs (if x or y is NULL).

Reimplemented from gcu::Object.

◆ GetEndStep()

Step* gcp::Arrow::GetEndStep ( ) const
inline
Returns
the Step at last end of the arrow.

Definition at line 182 of file gcp/arrow.h.

◆ GetEndStepPtr()

Step** gcp::Arrow::GetEndStepPtr ( )
inline
Returns
a pointer to the Step at last end of the arrow.

Definition at line 186 of file gcp/arrow.h.

References Name(), OnLoaded(), RemoveStep(), Reverse(), and Save().

◆ GetLength()

gcp::Arrow::GetLength ( void  ) const
inline
Returns
the arrow length.

Definition at line 243 of file gcp/arrow.h.

◆ GetProperty()

std::string gcp::Arrow::GetProperty ( unsigned  property) const
virtual
Parameters
propertythe identity of the property as defined in objprops.h.

Used by the gcu::Loader mechanism to retrieve properties of arrows.

Returns
the value of the property as a string.

Reimplemented from gcu::Object.

Reimplemented in gcp::ReactionArrow.

◆ GetStartStep()

Step* gcp::Arrow::GetStartStep ( ) const
inline
Returns
the Step at first end of the arrow.

Definition at line 171 of file gcp/arrow.h.

◆ GetStartStepPtr()

Step** gcp::Arrow::GetStartStepPtr ( )
inline
Returns
a pointer to the Step at first end of the arrow.

Definition at line 167 of file gcp/arrow.h.

◆ GetYAlign()

double gcp::Arrow::GetYAlign ( )
virtual

Used to retrieve the y coordinate for alignment.

Returns
y coordinate used for arrows alignment.

Reimplemented from gcu::Object.

◆ Load()

bool gcp::Arrow::Load ( xmlNodePtr  node)
virtual
Parameters
nodea pointer to the xmlNode containing the serialized arrow.

Used to load an Arrow in memory. This method must be called from derived classes overloaded Load methods.

Returns
true on succes, false otherwise.

Reimplemented from gcu::Object.

Reimplemented in gcp::ReactionArrow, and gcp::MesomeryArrow.

◆ Move()

void gcp::Arrow::Move ( double  x,
double  y,
double  z = 0 
)
virtual
Parameters
xthe x component of the transation vector.
ythe y component of the transation vector.
zthe z component of the transation vector (unused).

Used to move an arrow. The third parameter is not taken into account.

Reimplemented from gcu::Object.

Reimplemented in gcp::ReactionArrow.

◆ Name()

std::string gcp::Arrow::Name ( )
protectedvirtual
Returns
"Arrow" (actually it is localized).

Reimplemented from gcu::Object.

Reimplemented in gcp::ReactionArrow, and gcp::MesomeryArrow.

Referenced by GetEndStepPtr().

◆ OnLoaded()

void gcp::Arrow::OnLoaded ( )
protectedvirtual

This method should be called when an arrow has been fully loaded.

Reimplemented from gcu::Object.

Referenced by GetEndStepPtr().

◆ RemoveStep()

void gcp::Arrow::RemoveStep ( Step step)
Parameters
stepthe Step to remove from the Scheme

Removes the Step, which might be either the initial or final step. If it not one of these, nothing is done.

Referenced by GetEndStepPtr().

◆ Reverse()

void gcp::Arrow::Reverse ( )

Exchange both ends or the arrow and their associated steps.

Referenced by GetEndStepPtr().

◆ Save()

bool gcp::Arrow::Save ( xmlDocPtr  xml,
xmlNodePtr  node 
) const
protected
Parameters
xmlthe xmlDoc used to save the document.
nodethe node representing the Object.

This method must be called from derived classes overloaded Save methods.

Returns
true on succes, false otherwise.

Referenced by GetEndStepPtr().

◆ SetCoords()

void gcp::Arrow::SetCoords ( double  xstart,
double  ystart,
double  xend,
double  yend 
)
Parameters
xstartthe x coordinate of the start point.
ystartthe y coordinate of the start point.
xendthe x coordinate of the end point.
yendthe y coordinate of the end point.

Sets the position and length of an arrow.

◆ SetEndStep()

void gcp::Arrow::SetEndStep ( Step step)
inline
Parameters
stepa Step

Sets step at last end of the arrow. This does not affect coordinates, alignment is dealt with elsewhere.

Definition at line 178 of file gcp/arrow.h.

◆ SetProperty()

bool gcp::Arrow::SetProperty ( unsigned  property,
char const *  value 
)
virtual
Parameters
propertythe property id as defined in objprops.h
valuethe property value as a string

Used when loading to set common properties to arrows.Currently supported properties are: CU_PROP_ARROW_COORDS, GCU_PROP_ARROW_START_ID, GCU_PROP_ARROW_END_ID.

Returns
true if the property could be set, or if the property is not relevant, false otherwise.

Reimplemented from gcu::Object.

Reimplemented in gcp::ReactionArrow.

◆ SetSelected()

void gcp::Arrow::SetSelected ( int  state)
virtual
Parameters
statethe selection state of the arrow.

Used to set the selection state of the arrow. The values of state might be gcp::SelStateUnselected, gcp::SelStateSelected, gcp::SelStateUpdating, or gcp::SelStateErasing.

Reimplemented from gccv::ItemClient.

Reimplemented in gcp::ReactionArrow.

◆ SetStartStep()

void gcp::Arrow::SetStartStep ( Step step)
inline
Parameters
stepa Step

Sets step at first end of the arrow. This does not affect coordinates, alignment is dealt with elsewhere.

Definition at line 163 of file gcp/arrow.h.

◆ Transform2D()

void gcp::Arrow::Transform2D ( gcu::Matrix2D m,
double  x,
double  y 
)
virtual
Parameters
mthe Matrix2D of the transformation.
xthe x component of the center of the transformation.
ythe y component of the center of the transformation.

Used to move and/or transform an arrow.

Reimplemented from gcu::Object.

Member Data Documentation

◆ m_height

double gcp::Arrow::m_height
protected

The y coordinate difference between tail and head.

Definition at line 235 of file gcp/arrow.h.

◆ m_width

double gcp::Arrow::m_width
protected

The x coordinate difference between tail and head.

Definition at line 231 of file gcp/arrow.h.

◆ m_x

double gcp::Arrow::m_x
protected

The x coordinate of the start point.

Definition at line 223 of file gcp/arrow.h.

◆ m_y

double gcp::Arrow::m_y
protected

The y coordinate of the start point.

Definition at line 227 of file gcp/arrow.h.


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