The Gnome Chemistry Utils
0.12.11
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-2008 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 2 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
gcp {
35
44
typedef
enum
45
{
46
NormalBondType,
47
UpBondType,
48
DownBondType,
49
ForeBondType,
50
UndeterminedBondType
51
}
BondType
;
52
57
typedef
struct
{
61
double
a
;
65
bool
is_before
;
66
}
BondCrossing
;
67
68
class
Atom
;
69
class
WidgetData
;
70
75
class
Bond
:
public
gcu::Bond
,
public
gccv::ItemClient
76
{
77
public
:
81
Bond
();
89
Bond
(
Atom
* first,
Atom
* last,
unsigned
char
order);
93
virtual
~Bond
();
94
103
Object
*
GetAtomAt
(
double
x,
double
y,
double
z = 0.);
107
BondType
GetType
()
const
{
return
m_type;}
113
void
SetType
(
BondType
type);
120
double
GetAngle2D
(
Atom
* pAtom);
126
void
AddCycle
(
gcu::Cycle
* pCycle);
132
void
RemoveCycle
(
gcu::Cycle
* pCycle);
136
void
RemoveAllCycles
();
148
bool
GetLine2DCoords
(
unsigned
Num,
double
* x1,
double
* y1,
double
* x2,
double
* y2);
156
virtual
bool
SaveNode
(xmlDocPtr xml, xmlNodePtr node)
const
;
162
bool
LoadNode
(xmlNodePtr node);
171
void
Move
(
double
x,
double
y,
double
z = 0);
181
void
Transform2D
(
gcu::Matrix2D
& m,
double
x,
double
y);
191
double
GetDist
(
double
x,
double
y);
196
void
SetDirty
();
200
void
Revert
();
207
void
IncOrder
(
int
n = 1);
211
void
AddItem
();
215
void
UpdateItem
();
223
void
SetSelected
(
int
state);
228
double
GetYAlign
();
236
bool
IsCrossing
(
Bond
*pBond);
245
bool
BuildContextualMenu
(GtkUIManager *UIManager,
Object
*
object
,
double
x,
double
y);
249
void
MoveToBack
();
253
void
BringToFront
();
260
std::string
GetProperty
(
unsigned
property)
const
;
269
bool
SetProperty
(
unsigned
property,
char
const
*value);
270
279
void
AdjustPosition
(
double
&x,
double
&y);
280
281
private
:
282
// GnomeCanvasPathDef* BuildPathDef (WidgetData* pData);
283
// GnomeCanvasPathDef* BuildCrossingPathDef (WidgetData* pData);
284
BondType
m_type;
285
double
m_coords[16];
//coordinates of the lines used to represent the bond in the canvas
286
bool
m_CoordsCalc;
//true if m_coords have been calculated, false else
287
std::map<Bond*, BondCrossing> m_Crossing;
288
int
m_level;
// to know which bond should be considered front
289
};
290
291
}
// namespace gcp
292
293
#endif // GCHEMPAINT_BOND_H
Generated on Tue Jun 26 2012 08:44:53 for The Gnome Chemistry Utils by
1.8.1.1