]> Creatis software - bbtkGEditor.git/blob - lib/EditorGraphicBBS/bbsKernelEditorGraphic/GBoxModel.h
970d7a548ea1c6d18274d53a9bb7b8227b360a18
[bbtkGEditor.git] / lib / EditorGraphicBBS / bbsKernelEditorGraphic / GBoxModel.h
1 /*
2 # ---------------------------------------------------------------------
3 #
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image 
5 #                        pour la Santé)
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 #
8 #  This software is governed by the CeCILL-B license under French law and 
9 #  abiding by the rules of distribution of free software. You can  use, 
10 #  modify and/ or redistribute the software under the terms of the CeCILL-B 
11 #  license as circulated by CEA, CNRS and INRIA at the following URL 
12 #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
13 #  or in the file LICENSE.txt.
14 #
15 #  As a counterpart to the access to the source code and  rights to copy,
16 #  modify and redistribute granted by the license, users are provided only
17 #  with a limited warranty  and the software's author,  the holder of the
18 #  economic rights,  and the successive licensors  have only  limited
19 #  liability. 
20 #
21 #  The fact that you are presently reading this means that you have had
22 #  knowledge of the CeCILL-B license and that you accept its terms.
23 # ------------------------------------------------------------------------  
24 */
25
26 /*=========================================================================                                                                               
27 Program:   bbtk
28 Module:    $RCSfile$
29 Language:  C++
30 Date:      $Date$
31 Version:   $Revision$
32 =========================================================================*/
33
34 /* ---------------------------------------------------------------------
35
36 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
37 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
38 *
39 *  This software is governed by the CeCILL-B license under French law and 
40 *  abiding by the rules of distribution of free software. You can  use, 
41 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
42 *  license as circulated by CEA, CNRS and INRIA at the following URL 
43 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
44 *  or in the file LICENSE.txt.
45 *
46 *  As a counterpart to the access to the source code and  rights to copy,
47 *  modify and redistribute granted by the license, users are provided only
48 *  with a limited warranty  and the software's author,  the holder of the
49 *  economic rights,  and the successive licensors  have only  limited
50 *  liability. 
51 *
52 *  The fact that you are presently reading this means that you have had
53 *  knowledge of the CeCILL-B license and that you accept its terms.
54 * ------------------------------------------------------------------------ */                                                                         
55
56 /****
57 * Design and Developpement of BBTK GEditor
58 * Ricardo A Corredor J <ra.corredor67@uniandes.edu.co>
59 * RaC - 2010
60 ****/
61
62 #ifndef __GBoxModel_h__
63 #define __GBoxModel_h__
64
65 //Includes same project
66 #include "GlobalConstants.h"
67 #include "GObjectModel.h"
68 #include "GPortModel.h"
69
70 //Includes creaMaracasVisu
71
72 //Includes std
73 #include <iostream>
74
75
76 namespace bbtk
77 {
78
79         // Mandatory when exists a bidirectional relation: GPortModel includes GBoxModel and viceversa
80         class GPortModel;
81
82         class GBoxModel : public GObjectModel 
83         {
84
85         public: 
86
87                 //Constructors
88                 GBoxModel();
89                 ~GBoxModel();
90                 
91                 //Public methods                
92                 virtual void setInicPoint(double& x, double& y, double& z);
93
94                 void addInputPort(GPortModel *inputport);
95                 void addOutputPort(GPortModel *outputport);
96
97                 int getNumInputPorts();
98                 int getNumOutputPorts();
99
100                 // Change the position of the box and its ports
101                 virtual void move(double xx,double yy,double zz);
102
103                 // Text in the status bar
104                 virtual std::string getStatusText();
105
106                 // Method to write the information of the black box to be saved in the parameter string
107                 virtual void save(std::string &content);
108
109                 // Returns a vector with inputs or outputs
110                 std::vector<GPortModel*> getInputPorts();
111                 std::vector<GPortModel*> getOutputPorts();
112
113                 // Get input with the name given by parameter
114                 GPortModel* getInputPort(std::string name);
115                 GPortModel* getInputPort(int pos);
116
117                 // Get output with the name given by parameter
118                 GPortModel* getOutputPort(std::string name);
119                 GPortModel* getOutputPort(int pos);
120                 
121                 // Updates the position and finally the view of inputs and outputs
122                 void updatePorts();
123
124
125                 void addColons(std::string &text);
126                 void removeColons(std::string &text);
127
128         private:
129
130                 //Private Attributes
131
132                 //Private Methods
133
134         protected:
135                 //Protected Attributes
136
137                 std::vector<GPortModel*> _inputs;
138                 std::vector<GPortModel*> _outputs;
139
140                 //Protected methods
141                 
142         };
143
144
145 }
146 // namespace bbtk
147 #endif
148