#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 () |
Validity | GetValid (void) const |
void | SetMode (FragmentMode val) |
FragmentMode | GetMode (void) const |
FragmentMode & | GetRefMode (void) |
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 333 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 308 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. |
virtual gcp::Fragment::~Fragment | ( | ) | [virtual] |
The destructor.
void gcp::Fragment::AddItem | ( | ) | [virtual] |
Used to add a representation of the fragment in the view.
Reimplemented from gccv::ItemClient.
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. |
void gcp::Fragment::AnalContent | ( | ) |
Analyses the whole contents.
bool gcp::Fragment::Analyze | ( | ) |
Analyses the text in the fragment. This calls gcp::Fragment::AnalContent() and updates the attribute list.
Atom* gcp::Fragment::GetAtom | ( | ) | [inline] |
Object* gcp::Fragment::GetAtomAt | ( | double | x, | |
double | y, | |||
double | z = 0. | |||
) | [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. |
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. |
int gcp::Fragment::GetElementAtPos | ( | unsigned | start, | |
unsigned & | end | |||
) |
start | the start position of the atomic symbol. | |
end | the end position of the atomic symbol. |
gcp::Fragment::GetMode | ( | void | ) | const [inline] |
Definition at line 385 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. |
gcp::Fragment::GetRefMode | ( | void | ) | [inline] |
Definition at line 385 of file fragment.h.
gcp::Fragment::GetValid | ( | void | ) | const [inline] |
Definition at line 373 of file fragment.h.
double gcp::Fragment::GetYAlign | ( | ) | [virtual] |
Reimplemented from gcu::Object.
bool gcp::Fragment::Load | ( | xmlNodePtr | node | ) | [virtual] |
node | a pointer to the xmlNode containing the serialized fragment. |
Reimplemented from gcp::TextObject.
void gcp::Fragment::Move | ( | double | x, | |
double | y, | |||
double | z = 0 | |||
) | [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. |
Reimplemented from gcp::TextObject.
std::string gcp::Fragment::Name | ( | ) | [virtual] |
void gcp::Fragment::OnChangeAtom | ( | ) |
Called by the framework when the user changes the nature of an atom using the element tool.
bool gcp::Fragment::OnChanged | ( | bool | save | ) | [virtual] |
save | whether the text should be saved for undo/redo operations. |
Implements gcp::TextObject.
xmlNodePtr gcp::Fragment::Save | ( | xmlDocPtr | xml | ) | const [virtual] |
xml | the xmlDoc used to save the document. |
Reimplemented from gcu::Object.
xmlNodePtr gcp::Fragment::SaveSelection | ( | xmlDocPtr | xml | ) | const |
xml | the xmlDoc used for clipboard operations. |
gcp::Fragment::SetMode | ( | FragmentMode | mode | ) | [inline] |
mode | the nexw edition mode. |
Definition at line 385 of file fragment.h.
bool gcp::Fragment::SetProperty | ( | unsigned | property, | |
char const * | value | |||
) | [virtual] |
property | the property id as defined in objprops.h | |
value | the property value as a string |
Reimplemented from gcu::Object.
void gcp::Fragment::SetSelected | ( | int | state | ) | [virtual] |
state | the selection state of the fragment. |
Reimplemented from gccv::ItemClient.
void gcp::Fragment::Transform2D | ( | gcu::Matrix2D & | m, | |
double | x, | |||
double | y | |||
) | [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. |
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.
void gcp::Fragment::UpdateItem | ( | ) | [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.