2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
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.
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
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 # ------------------------------------------------------------------------
27 /*=========================================================================
33 =========================================================================*/
35 /* ---------------------------------------------------------------------
37 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
38 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
40 * This software is governed by the CeCILL-B license under French law and
41 * abiding by the rules of distribution of free software. You can use,
42 * modify and/ or redistribute the software under the terms of the CeCILL-B
43 * license as circulated by CEA, CNRS and INRIA at the following URL
44 * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
45 * or in the file LICENSE.txt.
47 * As a counterpart to the access to the source code and rights to copy,
48 * modify and redistribute granted by the license, users are provided only
49 * with a limited warranty and the software's author, the holder of the
50 * economic rights, and the successive licensors have only limited
53 * The fact that you are presently reading this means that you have had
54 * knowledge of the CeCILL-B license and that you accept its terms.
55 * ------------------------------------------------------------------------ */
59 * \brief Class bbtk::vtkGPortView
63 #include "vtkGPortView.h"
68 //=========================================================================
70 vtkGPortView::vtkGPortView( ) {
73 //=========================================================================
75 vtkGPortView::~vtkGPortView( ) {
78 //=========================================================================
80 void vtkGPortView::update( int idController , int command ) {
84 double xInic , yInic , zInic , xFin , yFin , zFin ;
86 _model->getInicPoint( xInic , yInic , zInic ) ;
87 _model->getFinalPoint( xFin , yFin , zFin ) ;
89 // RaC In the actual version, zInic=zFin=GPOSITION_Z
91 double mid = ( xInic + xFin ) / 2 ;
93 _pts->SetPoint( 0 , xInic , yInic , zInic ) ;
94 _pts->SetPoint( 1 , mid , yFin , zInic ) ;
95 _pts->SetPoint( 2 , xFin , yInic , zFin ) ;
97 _fillPolyMapper->Modified( ) ;
100 setRefreshWaiting( ) ;
103 //=========================================================================
105 void vtkGPortView::createVtkObjects( ) //virtual
107 _pts = vtkPoints::New( ) ;
108 _pts->SetNumberOfPoints( 3 ) ;
110 double xInic , yInic , zInic , xFin , yFin , zFin ;
112 _model->getInicPoint( xInic , yInic , zInic ) ;
113 _model->getFinalPoint( xFin , yFin , zFin ) ;
115 // RaC In the actual version, zInic=zFin=GPOSITION_Z
117 double mid = ( xInic + xFin ) / 2 ;
119 //EED _pts->SetPoint(0, xInic, yInic, zInic );
120 //EED _pts->SetPoint(1, mid, yFin, zInic );
121 //EED _pts->SetPoint(2, xFin, yInic, zFin );
123 _pts->SetPoint( 0 , -1000 , -1000 , -1000 ) ;
124 _pts->SetPoint( 1 , mid , yFin , zInic ) ;
125 _pts->SetPoint( 2 , 1000 , 1000 , 1000 ) ;
128 ///************************* FILL *************************
130 vtkCellArray *strip = vtkCellArray::New( ) ;
131 vtkPolyData *pdFill = vtkPolyData::New( ) ;
132 _fillPolyMapper = vtkPolyDataMapper::New( ) ;
133 _fillObjectActor = vtkActor::New( ) ;
135 // RaC In the actual version, zInic=zFin=GPOSITION_Z
137 strip->InsertNextCell( 3 ) ;
138 strip->InsertCellPoint( 0 ) ;
139 strip->InsertCellPoint( 1 ) ;
140 strip->InsertCellPoint( 2 ) ;
142 pdFill->SetPoints( _pts ) ;
143 pdFill->SetStrips( strip ) ;
145 _fillPolyMapper->SetInput( pdFill ) ;
146 _fillObjectActor->SetMapper( _fillPolyMapper ) ;
147 _fillPolyMapper->Modified( ) ;
149 ///************************* FILL *************************
156 //=========================================================================
158 void vtkGPortView::updateColors( ) {
159 _fillObjectActor->GetProperty( )->SetColor( 0.45 , 0.45 , 0.45 ) ;
161 if ( _state == POSSIBLE_CONNECTION ) {
162 _fillObjectActor->GetProperty( )->SetColor( 1 , 1 , 0 ) ;
163 } else if ( _state == SELECTED_POSSIBLE_CONNECTION ) {
164 _fillObjectActor->GetProperty( )->SetColor( 0 , 1 , 0 ) ;
165 } else if ( _state == HIGHLIGHTED ) {
166 _fillObjectActor->GetProperty( )->SetColor( 0 , 0 , 1 ) ;
168 GPortModel* portm = ( GPortModel* ) _model ;
169 if ( portm->isConnected( ) ) {
170 _fillObjectActor->GetProperty( )->SetColor( 0.15 , 0.15 , 0.15 ) ;
171 } else if ( portm->isValueSet( ) ) {
172 _fillObjectActor->GetProperty( )->SetColor( 0.55 , 0.25 , 0.25 ) ;
174 _fillObjectActor->GetProperty( )->SetColor( 0.45 , 0.45 , 0.45 ) ;
179 //=========================================================================
182 } // EO namespace bbtk