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