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 <gcu/bond.h>
00029 #include <list>
00030 #include <libgnomecanvas/gnome-canvas-path-def.h>
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
00074 {
00075 public:
00079 Bond ();
00087 Bond (Atom* first, Atom* last, unsigned char order);
00091 virtual ~Bond ();
00092
00093 virtual Object* GetAtomAt (double x, double y, double z = 0.);
00094 BondType GetType() const {return m_type;}
00095 void SetType (BondType type);
00096 double GetAngle2D (Atom* pAtom);
00097 void AddCycle (gcu::Cycle* pCycle);
00098 void RemoveCycle (gcu::Cycle* pCycle);
00099 void RemoveAllCycles ();
00100 bool GetLine2DCoords (unsigned Num, double* x1, double* y1, double* x2, double* y2);
00101 virtual bool SaveNode (xmlDocPtr xml, xmlNodePtr) const;
00107 virtual bool LoadNode (xmlNodePtr node);
00108 virtual void Update (GtkWidget* w) const;
00109 virtual void Move (double x, double y, double z = 0);
00110 virtual void Transform2D (gcu::Matrix2D& m, double x, double y);
00111 double GetDist (double x, double y);
00114 void SetDirty ();
00117 void Revert ();
00124 void IncOrder (int n = 1);
00133 void SetSelected (GtkWidget* w, int state);
00134 void Add (GtkWidget* w) const;
00135 double GetYAlign ();
00136 bool IsCrossing (Bond *pBond);
00145 bool BuildContextualMenu (GtkUIManager *UIManager, Object *object, double x, double y);
00146 void MoveToBack ();
00147 void BringToFront ();
00148 bool SetProperty (unsigned property, char const *value);
00149
00150 private:
00151 GnomeCanvasPathDef* BuildPathDef (WidgetData* pData);
00152 GnomeCanvasPathDef* BuildCrossingPathDef (WidgetData* pData);
00153 BondType m_type;
00154 double m_coords[16];
00155 bool m_CoordsCalc;
00156 std::map<Bond*, BondCrossing> m_Crossing;
00157 int m_level;
00158 };
00159
00160 }
00161
00162 #endif // GCHEMPAINT_BOND_H