gcp/bond.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_BOND_H
00026 #define GCHEMPAINT_BOND_H
00027
00028 #include <gccv/item-client.h>
00029 #include <gcu/bond.h>
00030 #include <list>
00031
00032 namespace gcp {
00033
00042 typedef enum
00043 {
00044 NormalBondType,
00045 UpBondType,
00046 DownBondType,
00047 ForeBondType,
00048 UndeterminedBondType
00049 } BondType;
00050
00055 typedef struct {
00059 double a;
00063 bool is_before;
00064 } BondCrossing;
00065
00066 class Atom;
00067 class WidgetData;
00068
00073 class Bond: public gcu::Bond, public gccv::ItemClient
00074 {
00075 public:
00079 Bond ();
00087 Bond (Atom* first, Atom* last, unsigned char order);
00091 virtual ~Bond ();
00092
00101 Object* GetAtomAt (double x, double y, double z = 0.);
00105 BondType GetType() const {return m_type;}
00111 void SetType (BondType type);
00118 double GetAngle2D (Atom* pAtom);
00124 void AddCycle (gcu::Cycle* pCycle);
00130 void RemoveCycle (gcu::Cycle* pCycle);
00134 void RemoveAllCycles ();
00146 bool GetLine2DCoords (unsigned Num, double* x1, double* y1, double* x2, double* y2);
00154 virtual bool SaveNode (xmlDocPtr xml, xmlNodePtr node) const;
00160 bool LoadNode (xmlNodePtr node);
00169 void Move (double x, double y, double z = 0);
00179 void Transform2D (gcu::Matrix2D& m, double x, double y);
00189 double GetDist (double x, double y);
00194 void SetDirty ();
00198 void Revert ();
00205 void IncOrder (int n = 1);
00209 void AddItem ();
00213 void UpdateItem ();
00221 void SetSelected (int state);
00226 double GetYAlign ();
00234 bool IsCrossing (Bond *pBond);
00243 bool BuildContextualMenu (GtkUIManager *UIManager, Object *object, double x, double y);
00247 void MoveToBack ();
00251 void BringToFront ();
00260 bool SetProperty (unsigned property, char const *value);
00261
00262 private:
00263
00264
00265 BondType m_type;
00266 double m_coords[16];
00267 bool m_CoordsCalc;
00268 std::map<Bond*, BondCrossing> m_Crossing;
00269 int m_level;
00270 };
00271
00272 }
00273
00274 #endif // GCHEMPAINT_BOND_H