The Gnome Chemistry Utils
0.14.0
Main Page
Namespaces
Classes
Files
File List
File Members
libs
gcp
gcp/bond.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
3
/*
4
* GChemPaint library
5
* bond.h
6
*
7
* Copyright (C) 2001-2012 Jean Bréfort <jean.brefort@normalesup.org>
8
*
9
* This program is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU General Public License as
11
* published by the Free Software Foundation; either version 3 of the
12
* License, or (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22
* USA
23
*/
24
25
#ifndef GCHEMPAINT_BOND_H
26
#define GCHEMPAINT_BOND_H
27
30
#include <
gccv/item-client.h
>
31
#include <
gcu/bond.h
>
32
#include <list>
33
34
namespace
gcu {
35
class
UIManager;
36
}
37
38
namespace
gcp {
39
49
typedef
enum
50
{
51
NormalBondType,
52
UpBondType,
53
DownBondType,
54
ForeBondType,
55
UndeterminedBondType,
56
NewmanBondType
57
}
BondType
;
58
63
typedef
struct
{
67
double
a
;
71
bool
is_before
;
72
}
BondCrossing
;
73
74
class
Atom
;
75
class
WidgetData
;
76
81
class
Bond
:
public
gcu::Bond
,
public
gccv::ItemClient
82
{
83
public
:
87
Bond
();
95
Bond
(
Atom
* first,
Atom
* last,
unsigned
char
order);
99
virtual
~Bond
();
100
109
Object
*
GetAtomAt
(
double
x,
double
y,
double
z = 0.);
113
BondType
GetType
()
const
{
return
m_type;}
119
void
SetType
(
BondType
type);
126
double
GetAngle2D
(
Atom
* pAtom);
132
void
AddCycle
(
gcu::Cycle
* pCycle);
138
void
RemoveCycle
(
gcu::Cycle
* pCycle);
142
void
RemoveAllCycles
();
154
bool
GetLine2DCoords
(
unsigned
Num,
double
* x1,
double
* y1,
double
* x2,
double
* y2);
162
virtual
bool
SaveNode
(xmlDocPtr xml, xmlNodePtr node)
const
;
168
bool
LoadNode
(xmlNodePtr node);
177
void
Move
(
double
x,
double
y,
double
z = 0);
187
void
Transform2D
(
gcu::Matrix2D
& m,
double
x,
double
y);
197
double
GetDist
(
double
x,
double
y);
202
void
SetDirty
();
206
void
Revert
();
213
void
IncOrder
(
int
n = 1);
217
void
AddItem
();
221
void
UpdateItem
();
229
void
SetSelected
(
int
state);
234
double
GetYAlign
();
242
bool
IsCrossing
(
Bond
*pBond);
251
bool
BuildContextualMenu
(
gcu::UIManager
*UIManager,
Object
*
object
,
double
x,
double
y);
255
void
MoveToBack
();
259
void
BringToFront
();
266
std::string
GetProperty
(
unsigned
property)
const
;
275
bool
SetProperty
(
unsigned
property,
char
const
*value);
276
285
void
AdjustPosition
(
double
&x,
double
&y);
286
290
void
OnLoaded
();
291
292
private
:
293
// GnomeCanvasPathDef* BuildPathDef (WidgetData* pData);
294
// GnomeCanvasPathDef* BuildCrossingPathDef (WidgetData* pData);
295
BondType
m_type;
296
double
m_coords[16];
//coordinates of the lines used to represent the bond in the canvas
297
bool
m_CoordsCalc;
//true if m_coords have been calculated, false else
298
std::map<Bond*, BondCrossing> m_Crossing;
299
int
m_level;
// to know which bond should be considered front
300
};
301
302
}
// namespace gcp
303
304
#endif // GCHEMPAINT_BOND_H
Generated on Tue Jan 1 2013 22:29:22 for The Gnome Chemistry Utils by
1.8.1.2