gcp/bond.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_BOND_H
00026 #define GCHEMPAINT_BOND_H
00027
00030 #include <gccv/item-client.h>
00031 #include <gcu/bond.h>
00032 #include <list>
00033
00034 namespace gcp {
00035
00044 typedef enum
00045 {
00046 NormalBondType,
00047 UpBondType,
00048 DownBondType,
00049 ForeBondType,
00050 UndeterminedBondType
00051 } BondType;
00052
00057 typedef struct {
00061 double a;
00065 bool is_before;
00066 } BondCrossing;
00067
00068 class Atom;
00069 class WidgetData;
00070
00075 class Bond: public gcu::Bond, public gccv::ItemClient
00076 {
00077 public:
00081 Bond ();
00089 Bond (Atom* first, Atom* last, unsigned char order);
00093 virtual ~Bond ();
00094
00103 Object* GetAtomAt (double x, double y, double z = 0.);
00107 BondType GetType() const {return m_type;}
00113 void SetType (BondType type);
00120 double GetAngle2D (Atom* pAtom);
00126 void AddCycle (gcu::Cycle* pCycle);
00132 void RemoveCycle (gcu::Cycle* pCycle);
00136 void RemoveAllCycles ();
00148 bool GetLine2DCoords (unsigned Num, double* x1, double* y1, double* x2, double* y2);
00156 virtual bool SaveNode (xmlDocPtr xml, xmlNodePtr node) const;
00162 bool LoadNode (xmlNodePtr node);
00171 void Move (double x, double y, double z = 0);
00181 void Transform2D (gcu::Matrix2D& m, double x, double y);
00191 double GetDist (double x, double y);
00196 void SetDirty ();
00200 void Revert ();
00207 void IncOrder (int n = 1);
00211 void AddItem ();
00215 void UpdateItem ();
00223 void SetSelected (int state);
00228 double GetYAlign ();
00236 bool IsCrossing (Bond *pBond);
00245 bool BuildContextualMenu (GtkUIManager *UIManager, Object *object, double x, double y);
00249 void MoveToBack ();
00253 void BringToFront ();
00260 std::string GetProperty (unsigned property) const;
00269 bool SetProperty (unsigned property, char const *value);
00270
00279 void AdjustPosition (double &x, double &y);
00280
00281 private:
00282
00283
00284 BondType m_type;
00285 double m_coords[16];
00286 bool m_CoordsCalc;
00287 std::map<Bond*, BondCrossing> m_Crossing;
00288 int m_level;
00289 };
00290
00291 }
00292
00293 #endif // GCHEMPAINT_BOND_H