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 <gccv/item-client.h>
00030
00032 namespace gcp {
00033
00034 class FragmentAtom;
00035 class Atom;
00036
00044 class Fragment: public TextObject, public gccv::ItemClient
00045 {
00046 public:
00050 Fragment ();
00058 Fragment (double x, double y);
00062 virtual ~Fragment ();
00063
00067 void AddItem ();
00071 void UpdateItem ();
00079 void SetSelected (int state);
00086 xmlNodePtr Save (xmlDocPtr xml) const;
00094 xmlNodePtr SaveSelection (xmlDocPtr xml) const;
00101 bool Load (xmlNodePtr node);
00107 bool OnChanged (bool save);
00111 void AnalContent ();
00118 void AnalContent (unsigned start, unsigned &end);
00127 Object* GetAtomAt (double x, double y, double z = 0.);
00135 void Move (double x, double y, double z = 0);
00143 void Transform2D (gcu::Matrix2D& m, double x, double y);
00148 void OnChangeAtom ();
00152 Atom* GetAtom () {return (Atom*) m_Atom;}
00160 int GetElementAtPos (unsigned start, unsigned &end);
00181 int GetChargePosition (FragmentAtom *pAtom, unsigned char &Pos, double Angle, double &x, double &y);
00191 int GetAvailablePosition (double &x, double &y);
00199 bool GetPosition (double angle, double &x, double &y);
00203 bool Validate ();
00207 double GetYAlign ();
00208
00218 bool SetProperty (unsigned property, char const *value);
00219
00224 bool Analyze ();
00225
00230 void Update ();
00231
00232 private:
00233 bool SavePortion (xmlDocPtr xml, xmlNodePtr node, unsigned start, unsigned end) const;
00234
00235 private:
00236 FragmentAtom *m_Atom;
00237 unsigned m_BeginAtom, m_EndAtom;
00238 int m_lbearing;
00239 double m_CHeight;
00240 bool m_Inversable;
00241 };
00242
00243 }
00244
00245 #endif //GCHEMPAINT_FRAGMENT_H