fragment.h
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 "libgnomecanvas/gnome-canvas.h"
00030
00031 namespace gcp {
00032
00033 class FragmentAtom;
00034 class Atom;
00035
00036 class Fragment: public TextObject
00037 {
00038 friend class FragmentTool;
00039 public:
00040 Fragment ();
00041 Fragment (double x, double y);
00042 virtual ~Fragment ();
00043
00044 void SetSelected (GtkWidget *w, int state);
00045 void Add (GtkWidget *w) const;
00046 void Update (GtkWidget *w) const;
00047 xmlNodePtr Save (xmlDocPtr xml) const;
00048 xmlNodePtr SaveSelection (xmlDocPtr xml) const;
00049 bool Load (xmlNodePtr);
00050 bool OnChanged (bool save);
00051 void AnalContent ();
00052 void AnalContent (unsigned start, unsigned &end);
00053 Object* GetAtomAt (double x, double y, double z = 0.);
00054 void Move (double x, double y, double z = 0);
00055 void Transform2D (gcu::Matrix2D& m, double x, double y);
00056 void OnChangeAtom ();
00057 Atom* GetAtom () {return (Atom*) m_Atom;}
00058 int GetElementAtPos (unsigned start, unsigned &end);
00059 int GetChargePosition (FragmentAtom *pAtom, unsigned char &Pos, double Angle, double &x, double &y);
00060 int GetAvailablePosition (double &x, double &y);
00061 bool GetPosition (double angle, double &x, double &y);
00062 bool Validate ();
00063 double GetYAlign ();
00064
00067 bool SetProperty (unsigned property, char const *value);
00068
00071 bool Analyze ();
00072
00075 void Update ();
00076
00077 private:
00078 bool SavePortion (xmlDocPtr xml, xmlNodePtr node, unsigned start, unsigned end) const;
00079
00080 private:
00081 FragmentAtom *m_Atom;
00082 unsigned m_BeginAtom, m_EndAtom;
00083 int m_lbearing;
00084 double m_CHeight;
00085 bool m_Inversable;
00086 };
00087
00088 }
00089
00090 #endif //GCHEMPAINT_FRAGMENT_H