The Gnome Chemistry Utils
0.12.11
Main Page
Namespaces
Classes
Files
File List
File Members
libs
gcp
fragment.h
Go to the documentation of this file.
1
// -*- C++ -*-
2
3
/*
4
* GChemPaint library
5
* fragment.h
6
*
7
* Copyright (C) 2002-2010 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_FRAGMENT_H
26
#define GCHEMPAINT_FRAGMENT_H
27
28
#include "
text-object.h
"
29
#include <
gccv/item-client.h
>
30
#include <
gccv/text-tag.h
>
31
32
namespace
gccv {
33
class
Text
;
34
}
35
37
namespace
gcp {
38
39
extern
gccv::Tag
ChargeTag, StoichiometryTag;
40
47
class
ChargeTextTag
:
public
gccv::PositionTextTag
48
{
49
public
:
55
ChargeTextTag
(
double
size);
59
virtual
~ChargeTextTag
();
60
67
TextTag
*
Restrict
(
TextTag
*tag);
68
};
69
76
class
StoichiometryTextTag
:
public
gccv::PositionTextTag
77
{
78
public
:
84
StoichiometryTextTag
(
double
size);
88
virtual
~StoichiometryTextTag
();
89
96
TextTag
*
Restrict
(
TextTag
*tag);
97
};
98
99
class
FragmentAtom
;
100
class
Atom
;
101
109
class
Fragment
:
public
TextObject
110
{
111
public
:
115
Fragment
();
123
Fragment
(
double
x,
double
y);
127
virtual
~Fragment
();
128
132
void
AddItem
();
136
void
UpdateItem
();
144
void
SetSelected
(
int
state);
151
xmlNodePtr
Save
(xmlDocPtr xml)
const
;
159
xmlNodePtr
SaveSelection
(xmlDocPtr xml)
const
;
166
bool
Load
(xmlNodePtr node);
172
bool
OnChanged
(
bool
save);
176
void
AnalContent
();
183
void
AnalContent
(
unsigned
start,
unsigned
&end);
192
Object
*
GetAtomAt
(
double
x,
double
y,
double
z = 0.);
200
void
Move
(
double
x,
double
y,
double
z = 0);
208
void
Transform2D
(
gcu::Matrix2D
& m,
double
x,
double
y);
213
void
OnChangeAtom
();
217
Atom
*
GetAtom
() {
return
(
Atom
*) m_Atom;}
225
int
GetElementAtPos
(
unsigned
start,
unsigned
&end);
241
gccv::Anchor
GetChargePosition
(
FragmentAtom
*pAtom,
unsigned
char
&Pos,
double
Angle,
double
&x,
double
&y);
251
int
GetAvailablePosition
(
double
&x,
double
&y);
259
bool
GetPosition
(
double
angle,
double
&x,
double
&y);
263
bool
Validate
();
267
double
GetYAlign
();
268
278
bool
SetProperty
(
unsigned
property,
char
const
*value);
279
284
bool
Analyze
();
285
290
void
Update
();
291
295
gccv::Item
*
GetChargeItem
();
296
300
std::string
Name
();
308
typedef
enum
{
312
Invalid
,
316
Valid
,
320
Valid2D
,
324
Valid3D
325
}
Validity
;
326
333
typedef
enum
{
337
AutoMode
,
341
NormalMode
,
345
SubscriptMode
,
349
SuperscriptMode
,
353
ChargeMode
,
357
StoichiometryMode
358
}
FragmentMode
;
359
360
private
:
361
bool
SavePortion (xmlDocPtr xml, xmlNodePtr node,
unsigned
start,
unsigned
end)
const
;
362
363
private
:
364
FragmentAtom
*m_Atom;
365
unsigned
m_BeginAtom, m_EndAtom;
366
double
m_lbearing;
367
double
m_CHeight;
368
bool
m_Inversable;
369
373
GCU_RO_PROP
(
Validity
,
Valid
)
385
GCU_PROP
(
FragmentMode
, Mode)
386
};
387
388
}
// namespace gcp
389
390
#endif //GCHEMPAINT_FRAGMENT_H
Generated on Tue Jun 26 2012 08:44:53 for The Gnome Chemistry Utils by
1.8.1.1