Moka libraries
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
matrix-att.hh
Go to the documentation of this file.
1
/*
2
* lib-spamod : Visualisation des objets en discret.
3
* Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4
* http://www.sic.sp2mi.univ-poitiers.fr/
5
* Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6
* guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7
*
8
* This file is part of lib-spamod
9
*
10
* This program is free software: you can redistribute it and/or modify
11
* it under the terms of the GNU Lesser General Public License as published by
12
* the Free Software Foundation, either version 3 of the License, or
13
* (at your option) any later version.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Lesser General Public License for more details.
19
*
20
* You should have received a copy of the GNU Lesser General Public License
21
* along with this program. If not, see <http://www.gnu.org/licenses/>.
22
*/
23
24
/******************************************************************************
25
* Fichier : Matrix_Att.h *
26
* Auteur : DEXET Martine *
27
*----------------------------------------------------------------------------*
28
* Ce fichier contient la spécification de la classe Matrix_Att. Cette *
29
* classe permet de stocker un objet de la classe Matrix en tant *
30
* qu'attribut. *
31
* *
32
*****************************************************************************/
33
34
35
#ifndef MATRIX_ATT_H
36
#define MATRIX_ATT_H
37
38
#include "
matrix.hh
"
39
#include "attribute.hh"
40
41
42
43
/******************************************************************************
44
* Classe Matrix_Att *
45
*****************************************************************************/
46
47
class
Matrix_Att
:
public
CAttribute
48
{
49
public
:
50
51
// Constructeurs.
52
Matrix_Att
();
53
Matrix_Att
(
int
tab[6],
unsigned
char
color);
54
55
// Destructeur.
56
virtual
~Matrix_Att
();
57
58
// Surcharge des méthodes de la classe CAttribute.
59
TAttributeId
getType
()
const
;
60
Matrix
*
Get_Data
();
61
CAttribute *
copy
()
const
;
62
void
destroy
();
63
void
save
(std::ostream &fd)
const
;
64
void
load
(std::istream &fd);
65
66
private
:
67
68
// Pointeur sur un objet de la classe Matrix.
69
Matrix
* mat;
70
71
};
72
73
/******************************************************************************
74
* Fichier : Matrix_Att.inl *
75
* Auteur : DEXET Martine *
76
*----------------------------------------------------------------------------*
77
* Ce fichier contient l'implémentation des méthodes de la classe *
78
* Matrix_Att. *
79
* *
80
*****************************************************************************/
81
82
#include "
user.hh
"
83
84
// Constructeurs.
85
inline
86
Matrix_Att::Matrix_Att
()
87
{
88
mat = NULL;
89
}
90
91
inline
92
Matrix_Att::Matrix_Att
(
int
tab[6],
unsigned
char
color)
93
{
94
mat =
new
Matrix
(tab,color);
95
}
96
97
98
// Destructeur.
99
inline
100
Matrix_Att::~Matrix_Att
()
101
{
102
delete
mat;
103
}
104
105
106
// Surcharge des méthodes de la classe CAttribute.
107
inline
108
TAttributeId
Matrix_Att::getType
()
const
109
{
110
return
MATRIX_ATTRIBUTE_ID
;
111
}
112
113
inline
114
Matrix
*
Matrix_Att::Get_Data
()
115
{
116
return
mat;
117
}
118
119
inline
120
CAttribute *
Matrix_Att::copy
()
const
121
{
122
Matrix_Att
* m =
new
Matrix_Att
();
123
m->mat =
new
Matrix
(*mat);
124
125
return
m;
126
}
127
128
inline
129
void
Matrix_Att::destroy
()
130
{
131
delete
this
;
132
}
133
134
135
inline
136
void
Matrix_Att::save
(std::ostream &fd)
const
137
{
138
fd << mat->
Get_X_Max
() <<
" "
<< mat->
Get_X_Min
() <<
" "
139
<< mat->
Get_Y_Max
() <<
" "
<< mat->
Get_Y_Min
() <<
" "
140
<< mat->
Get_Z_Max
() <<
" "
<< mat->
Get_Z_Min
() << std::endl;
141
142
for
(
int
k=mat->
Get_Z_Min
(); k<=mat->
Get_Z_Max
(); k++)
143
for
(
int
j=mat->
Get_Y_Min
(); j<=mat->
Get_Y_Max
(); j++)
144
{
145
for
(
int
i=mat->
Get_X_Min
(); i<=mat->
Get_X_Max
(); i++)
146
fd << (
int
)mat->
Get_Value
(i,j,k) <<
" "
;
147
148
fd << std::endl;
149
}
150
}
151
152
inline
153
void
Matrix_Att::load
(std::istream &fd)
154
{
155
}
156
157
#endif
lib-spamod
main
attributes
matrix-att.hh
Generated on Tue Apr 9 2013 09:51:42 for Moka libraries by
1.8.2