The Gnome Chemistry Utils
0.14.0
|
Atoms groups. More...
#include <gcp/fragment.h>
Public Types | |
enum | Validity { Invalid, Valid, Valid2D, Valid3D } |
The validity state of a Fragment as it is currently evaluated by the framework. The 0.12.x version don't do anything useful with it and all Fragment instances are invalid. More... | |
enum | FragmentMode { AutoMode, NormalMode, SubscriptMode, SuperscriptMode, ChargeMode, StoichiometryMode } |
Edition mode. More... |
Public Member Functions | |
Fragment () | |
Fragment (double x, double y) | |
virtual | ~Fragment () |
void | AddItem () |
void | UpdateItem () |
void | SetSelected (int state) |
xmlNodePtr | Save (xmlDocPtr xml) const |
xmlNodePtr | SaveSelection (xmlDocPtr xml) const |
bool | Load (xmlNodePtr node) |
bool | OnChanged (bool save) |
void | AnalContent () |
void | AnalContent (unsigned start, unsigned &end) |
Object * | GetAtomAt (double x, double y, double z=0.) |
void | Move (double x, double y, double z=0) |
void | Transform2D (gcu::Matrix2D &m, double x, double y) |
void | OnChangeAtom () |
Atom * | GetAtom () |
int | GetElementAtPos (unsigned start, unsigned &end) |
gccv::Anchor | GetChargePosition (FragmentAtom *pAtom, unsigned char &Pos, double Angle, double &x, double &y) |
int | GetAvailablePosition (double &x, double &y) |
bool | GetPosition (double angle, double &x, double &y) |
bool | Validate () |
double | GetYAlign () |
bool | SetProperty (unsigned property, char const *value) |
bool | Analyze () |
void | Update () |
gccv::Item * | GetChargeItem () |
std::string | Name () |
bool | GetCoords (double *x, double *y, double *z=NULL) const |
Validity | GetValid (void) const |
void | SetMode (FragmentMode val) |
FragmentMode | GetMode (void) const |
FragmentMode & | GetRefMode (void) |
Public Member Functions inherited from gcp::TextObject | |
TextObject (gcu::TypeId Type) | |
TextObject (double x, double y, gcu::TypeId Type) | |
virtual | ~TextObject () |
void | GetSize (double &x, double &y) |
xmlNodePtr | SaveSelected () |
void | LoadSelected (xmlNodePtr node) |
bool | SaveNode (xmlDocPtr xml, xmlNodePtr node) const |
bool | IsLocked () |
void | GetSelectionBounds (unsigned &start, unsigned &end) |
std::string | GetBuffer () |
virtual std::string | GetProperty (unsigned property) const |
void | SelectionChanged (unsigned start, unsigned end) |
void | TextChanged (unsigned pos) |
gccv::TextTagList | GetTagList (void) |
void | SetEditor (TextEditor *val) |
TextEditor * | GetEditor (void) const |
TextEditor *& | GetRefEditor (void) |
gccv::Text * | GetTextItem (void) |
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) |
Object * | GetMolecule () const |
Object * | GetReaction () const |
Object * | GetGroup () const |
Document * | GetDocument () const |
Application * | GetApplication () const |
Object * | GetParentOfType (TypeId Id) const |
Object * | GetChild (const gchar *Id) const |
Object * | GetFirstChild (std::map< std::string, Object * >::iterator &i) |
Object * | GetNextChild (std::map< std::string, Object * >::iterator &i) |
Object * | GetDescendant (const char *Id) const |
Object * | GetParent () const |
void | SetParent (Object *Parent) |
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 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) |
Object * | GetFirstLink (std::set< Object * >::iterator &i) |
Object * | GetNextLink (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 |
virtual void | OnLoaded () |
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::TextClient | |
TextClient () | |
virtual | ~TextClient () |
virtual void | InterlineChanged (G_GNUC_UNUSED double interline) |
virtual void | JustificationChanged (G_GNUC_UNUSED GtkJustification justification) |
Public Member Functions inherited from gccv::ItemClient | |
ItemClient () | |
virtual | ~ItemClient () |
Item * | GetItem (void) |
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 Object * | CreateObject (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 () |
Protected Member Functions inherited from gcu::Object | |
virtual Dialog * | BuildPropertiesDialog () |
Protected Attributes inherited from gcp::TextObject | |
double | m_x |
double | m_y |
double | m_length |
double | m_height |
int | m_ascent |
int | m_InsertOffset |
std::string | m_buf |
bool | m_bLoading |
unsigned | m_StartSel |
unsigned | m_EndSel |
bool | m_RealSave |
gccv::TextTagList | m_TagList |
gccv::Text * | m_TextItem |
Atoms groups.
Represents atoms groups displayed as a string. Currntly, the string is not fully parsed, so that some non sense strings might be accepted. Anyway, this will not always be the case in the future.
Definition at line 109 of file fragment.h.
Edition mode.
Current edition mode for the fragment. Used to know how inserted symbolds need to be interpreted.
Definition at line 343 of file fragment.h.
The validity state of a Fragment as it is currently evaluated by the framework. The 0.12.x version don't do anything useful with it and all Fragment instances are invalid.
Invalid |
Invalid Fragment or validity not checked. |
Valid |
Valid Fragment, all symbols in the string can be interpreted. |
Valid2D |
Valid Fragment, with a known and reasonable 2D structure. |
Valid3D |
Valid Fragment, with a known and reasonable 3D structure. |
Definition at line 318 of file fragment.h.
gcp::Fragment::Fragment | ( | ) |
The default constructor.
gcp::Fragment::Fragment | ( | double | x, |
double | y | ||
) |
x | the x position of the new fragment. |
y | the y position of the new fragment. |
Constructs a new fragment and position it. x and y are the position of the main atom or residue in the fragment.
|
virtual |
The destructor.
|
virtual |
Used to add a representation of the fragment in the view.
Reimplemented from gccv::ItemClient.
void gcp::Fragment::AnalContent | ( | ) |
Analyses the whole contents.
void gcp::Fragment::AnalContent | ( | unsigned | start, |
unsigned & | end | ||
) |
start | the start fo the substring to parse, in bytes. |
end | the end fo the substring to parse, in bytes. |
Analyses a substring.
bool gcp::Fragment::Analyze | ( | ) |
Analyses the text in the fragment. This calls gcp::Fragment::AnalContent() and updates the attribute list.
|
inline |
Definition at line 217 of file fragment.h.
|
virtual |
x | the x coordinate |
y | the y coordinate |
z | the z coordinate (unused) |
Reimplemented from gcu::Object.
int gcp::Fragment::GetAvailablePosition | ( | double & | x, |
double & | y | ||
) |
x | the x position. |
y | the y position. |
This method finds an available position for drawing a charge sign or electrons and returns it as a symbolic value (see POSITION_E, POSITION_N,...). The x and y are updated so that they give the absolute position.
gccv::Item* gcp::Fragment::GetChargeItem | ( | ) |
gccv::Anchor gcp::Fragment::GetChargePosition | ( | FragmentAtom * | pAtom, |
unsigned char & | Pos, | ||
double | Angle, | ||
double & | x, | ||
double & | y | ||
) |
pAtom | the main atom which will get the local charge. |
Pos | the approximate position of the charge. |
Angle | the angle from horizontal left. |
x | the x position of the charge symbol. |
y | the y position of the charge symbol. |
If pAtom is not the main atom of the fragment, 0 is returned and Pos is not updated. On input Pos can be one of POSITION_E, POSITION_N,... or 0xff, in which case, it will be given a default value. x and y are set to the position where the charge sign should be displayed usding the alignment code returned by this method.
|
virtual |
x | a pointer to the double value which will receive the x coordinate of the Fragment. |
y | a pointer to the double value which will receive the y coordinate of the Fragment. |
z | a pointer to the double value which will receive the z coordinate of the Fragment or NULL for 2D representations. |
Retrieves the coordinates of this Arrow.
Reimplemented from gcu::Object.
int gcp::Fragment::GetElementAtPos | ( | unsigned | start, |
unsigned & | end | ||
) |
start | the start position of the atomic symbol. |
end | the end position of the atomic symbol. |
|
inline |
Definition at line 395 of file fragment.h.
bool gcp::Fragment::GetPosition | ( | double | angle, |
double & | x, | ||
double & | y | ||
) |
angle | the angle at which a charge sign should be displayed. |
x | the x position. |
y | the y position. |
|
inline |
Definition at line 395 of file fragment.h.
|
inline |
Definition at line 383 of file fragment.h.
|
virtual |
Reimplemented from gcu::Object.
|
virtual |
node | a pointer to the xmlNode containing the serialized fragment. |
Used to load a fragment in memory. The Fragment must already exist.
Reimplemented from gcp::TextObject.
|
virtual |
x | the x component of the transation vector. |
y | the y component of the transation vector. |
z | the z component of the transation vector. |
Moves the fragment.
Reimplemented from gcp::TextObject.
|
virtual |
Reimplemented from gcu::Object.
void gcp::Fragment::OnChangeAtom | ( | ) |
Called by the framework when the user changes the nature of an atom using the element tool.
|
virtual |
save | whether the text should be saved for undo/redo operations. |
Called after any change in the text.
Implements gcp::TextObject.
|
virtual |
xml | the xmlDoc used to save the document. |
Used to save the fragment to the xmlDoc.
Reimplemented from gcu::Object.
xmlNodePtr gcp::Fragment::SaveSelection | ( | xmlDocPtr | xml | ) | const |
xml | the xmlDoc used for clipboard operations. |
Saves the currently selected text inside the fragment. This method is used by the framework when editing the fragment.
|
inline |
mode | the nexw edition mode. |
Sets the current edition mode for the Fragment instance.
Definition at line 395 of file fragment.h.
|
virtual |
property | the property id as defined in objprops.h |
value | the property value as a string |
Used when loading to set properties for the fragment. This method supports GCU_PROP_POS2D, GCU_PROP_TEXT_TEXT, GCU_PROP_FRAGMENT_ATOM_START, and GCU_PROP_FRAGMENT_ATOM_ID.
Reimplemented from gcu::Object.
|
virtual |
state | the selection state of the fragment. |
Used to set the selection state of the fragment inside the widget. The values of state might be gcp::SelStateUnselected, gcp::SelStateSelected, gcp::SelStateUpdating, or gcp::SelStateErasing.
Reimplemented from gccv::ItemClient.
|
virtual |
m | the Matrix2D of the transformation. |
x | the x component of the center of the transformation. |
y | the y component of the center of the transformation. |
Moves and/or transform an object.
Reimplemented from gcu::Object.
void gcp::Fragment::Update | ( | ) |
Changes the order of the symbols if necessary when a bond is at an extremity of the fragment.
|
virtual |
Used to update a representation of the fragment in the view.
Reimplemented from gccv::ItemClient.
bool gcp::Fragment::Validate | ( | ) |
Validates the contents of the fragment text, and display error messages when necessary.