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