Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef GCHEMPAINT_FRAGMENT_H
00026 #define GCHEMPAINT_FRAGMENT_H
00027
00028 #include "text-object.h"
00029 #include <gccv/item-client.h>
00030 #include <gccv/text-tag.h>
00031
00032 namespace gccv {
00033 class Text;
00034 }
00035
00037 namespace gcp {
00038
00039 extern gccv::Tag ChargeTag, StoichiometryTag;
00040
00047 class ChargeTextTag: public gccv::PositionTextTag
00048 {
00049 public:
00055 ChargeTextTag (double size);
00059 virtual ~ChargeTextTag ();
00060
00067 TextTag *Restrict (TextTag *tag);
00068 };
00069
00076 class StoichiometryTextTag: public gccv::PositionTextTag
00077 {
00078 public:
00084 StoichiometryTextTag (double size);
00088 virtual ~StoichiometryTextTag ();
00089
00096 TextTag *Restrict (TextTag *tag);
00097 };
00098
00099 class FragmentAtom;
00100 class Atom;
00101
00109 class Fragment: public TextObject
00110 {
00111 public:
00115 Fragment ();
00123 Fragment (double x, double y);
00127 virtual ~Fragment ();
00128
00132 void AddItem ();
00136 void UpdateItem ();
00144 void SetSelected (int state);
00151 xmlNodePtr Save (xmlDocPtr xml) const;
00159 xmlNodePtr SaveSelection (xmlDocPtr xml) const;
00166 bool Load (xmlNodePtr node);
00172 bool OnChanged (bool save);
00176 void AnalContent ();
00183 void AnalContent (unsigned start, unsigned &end);
00192 Object* GetAtomAt (double x, double y, double z = 0.);
00200 void Move (double x, double y, double z = 0);
00208 void Transform2D (gcu::Matrix2D& m, double x, double y);
00213 void OnChangeAtom ();
00217 Atom* GetAtom () {return (Atom*) m_Atom;}
00225 int GetElementAtPos (unsigned start, unsigned &end);
00241 gccv::Anchor GetChargePosition (FragmentAtom *pAtom, unsigned char &Pos, double Angle, double &x, double &y);
00251 int GetAvailablePosition (double &x, double &y);
00259 bool GetPosition (double angle, double &x, double &y);
00263 bool Validate ();
00267 double GetYAlign ();
00268
00278 bool SetProperty (unsigned property, char const *value);
00279
00284 bool Analyze ();
00285
00290 void Update ();
00291
00295 gccv::Item *GetChargeItem ();
00296
00300 std::string Name ();
00309 bool GetCoords (double *x, double *y, double *z = NULL) const;
00317 typedef enum {
00321 Invalid,
00325 Valid,
00329 Valid2D,
00333 Valid3D
00334 } Validity;
00335
00342 typedef enum {
00346 AutoMode,
00350 NormalMode,
00354 SubscriptMode,
00358 SuperscriptMode,
00362 ChargeMode,
00366 StoichiometryMode
00367 } FragmentMode;
00368
00369 private:
00370 bool SavePortion (xmlDocPtr xml, xmlNodePtr node, unsigned start, unsigned end) const;
00371
00372 private:
00373 FragmentAtom *m_Atom;
00374 unsigned m_BeginAtom, m_EndAtom;
00375 double m_lbearing;
00376 double m_CHeight;
00377 bool m_Inversable;
00378
00382 GCU_RO_PROP (Validity, Valid)
00394 GCU_PROP (FragmentMode, Mode)
00395 };
00396
00397 }
00398
00399 #endif //GCHEMPAINT_FRAGMENT_H