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::vtkGComplexBoxPortView
63 #include "vtkGComplexBoxPortView.h"
68 //=========================================================================
70 vtkGComplexBoxPortView::vtkGComplexBoxPortView( )
74 //=========================================================================
76 vtkGComplexBoxPortView::~vtkGComplexBoxPortView( )
80 //=========================================================================
82 void vtkGComplexBoxPortView::update( int idController , int command )
85 double xInic , yInic , zInic , xFin , yFin , zFin ;
86 _model->getInicPoint( xInic , yInic , zInic ) ;
87 _model->getFinalPoint( xFin , yFin , zFin ) ;
88 // RaC In the actual version, zInic=zFin=GPOSITION_Z
89 _pts->SetPoint( 0 , xInic , yInic , zInic ) ;
90 _pts->SetPoint( 1 , xInic , yFin , zInic ) ;
91 _pts->SetPoint( 2 , xFin , yFin , zFin ) ;
92 _pts->SetPoint( 3 , xFin , yInic , zFin ) ;
94 // _borderPolyMapper->Modified( ) ;
95 _fillPolyMapper->Modified( ) ;
98 setRefreshWaiting( ) ;
101 //=========================================================================
103 void vtkGComplexBoxPortView::createVtkObjects( ) //virtual
107 _pts = vtkPoints::New( ) ;
108 // vtkCellArray *lines = vtkCellArray::New( ) ;
109 // vtkPolyData *_pd = vtkPolyData::New( ) ;
110 // _borderPolyMapper = vtkPolyDataMapper::New( ) ;
111 // _borderObjectActor = vtkActor::New( ) ;
113 _pts->SetNumberOfPoints( 4 ) ;
115 double xInic , yInic , zInic , xFin , yFin , zFin ;
116 _model->getInicPoint( xInic , yInic , zInic ) ;
117 _model->getFinalPoint( xFin , yFin , zFin ) ;
119 // RaC In the actual version, zInic=zFin=GPOSITION_Z
121 //EED _pts->SetPoint(0, xInic, yInic, zInic );
122 //EED _pts->SetPoint(1, xInic, yFin, zInic );
123 //EED _pts->SetPoint(2, xFin, yFin, zFin );
124 //EED _pts->SetPoint(3, xFin, yInic, zFin );
125 _pts->SetPoint( 0 , -1000 , -1000 , -1000 ) ;
126 _pts->SetPoint( 1 , xInic , yFin , zInic ) ;
127 _pts->SetPoint( 2 , 1000 , 1000 , 1000 ) ;
128 _pts->SetPoint( 3 , xFin , yInic , zFin ) ;
131 // lines->InsertNextCell( 5 ) ;
132 // lines->InsertCellPoint( 0 ) ;
133 // lines->InsertCellPoint( 1 ) ;
134 // lines->InsertCellPoint( 2 ) ;
135 // lines->InsertCellPoint( 3 ) ;
136 // lines->InsertCellPoint( 0 ) ;
137 // _pd->SetPoints( _pts ) ;
138 // _pd->SetLines( lines ) ;
139 // _borderPolyMapper->SetInput( _pd ) ;
140 // _borderObjectActor->SetMapper( _borderPolyMapper ) ;
141 // _borderPolyMapper->Modified( ) ;
144 ///************************* FILL *************************
145 vtkCellArray *strip = vtkCellArray::New( ) ;
146 vtkPolyData *pdFill = vtkPolyData::New( ) ;
147 _fillPolyMapper = vtkPolyDataMapper::New( ) ;
148 _fillObjectActor = vtkActor::New( ) ;
149 // RaC In the actual version, zInic=zFin=GPOSITION_Z
150 strip->InsertNextCell( 5 ) ;
151 strip->InsertCellPoint( 0 ) ;
152 strip->InsertCellPoint( 1 ) ;
153 strip->InsertCellPoint( 2 ) ;
154 strip->InsertCellPoint( 0 ) ;
155 strip->InsertCellPoint( 3 ) ;
156 pdFill->SetPoints( _pts ) ;
157 pdFill->SetStrips( strip ) ;
158 _fillPolyMapper->SetInput( pdFill ) ;
159 _fillObjectActor->SetMapper( _fillPolyMapper ) ;
160 _fillPolyMapper->Modified( ) ;
161 ///************************* FILL *************************
163 createVtkInputOutputPorts();
167 //=========================================================================
169 void vtkGComplexBoxPortView::addVtkActors( )//virtual
171 // _baseView->GetRenderer( )->AddActor( _borderObjectActor ) ;
172 vtkGBoxView::addVtkActors( ) ;
175 //=========================================================================
177 void vtkGComplexBoxPortView::removeVtkActors( )//virtual
179 // _baseView->GetRenderer( )->RemoveActor( _borderObjectActor ) ;
180 vtkGBoxView::removeVtkActors( ) ;
183 //=========================================================================
185 void vtkGComplexBoxPortView::updateColors( ) {
186 _fillObjectActor->GetProperty( )->SetAmbient( 0.6 ) ;
188 if ( _state == NOTHING_HAPPENS )
190 // _borderObjectActor->GetProperty( )->SetLineWidth( 1 ) ;
191 GComplexBoxPortModel *portModel = ( GComplexBoxPortModel* ) _model ;
192 if ( portModel->getComplexPortType( ) == GCOMPLEXINPUTPORT ) {
193 _fillObjectActor->GetProperty( )->SetColor( COMPLEXINPUTPORTFILL_NH_R , COMPLEXINPUTPORTFILL_NH_G , COMPLEXINPUTPORTFILL_NH_B ) ;
194 // _borderObjectActor->GetProperty( )->SetColor( COMPLEXINPUTPORTBORDER_NH_R , COMPLEXINPUTPORTBORDER_NH_G , COMPLEXINPUTPORTBORDER_NH_B ) ;
195 } else if ( portModel->getComplexPortType( ) == GCOMPLEXOUTPUTPORT ) {
196 _fillObjectActor->GetProperty( )->SetColor( COMPLEXOUTPUTPORTFILL_NH_R , COMPLEXOUTPUTPORTFILL_NH_G , COMPLEXOUTPUTPORTFILL_NH_B ) ;
197 // _borderObjectActor->GetProperty( )->SetColor( COMPLEXOUTPUTPORTBORDER_NH_R , COMPLEXOUTPUTPORTBORDER_NH_G , COMPLEXOUTPUTPORTBORDER_NH_B ) ;
200 } else if ( _state == HIGHLIGHTED ) {
201 // _borderObjectActor->GetProperty( )->SetLineWidth( 2 ) ;
202 // _borderObjectActor->GetProperty( )->SetColor( BOXBORDER_HIGHLIGHTED_R , BOXBORDER_HIGHLIGHTED_G , BOXBORDER_HIGHLIGHTED_B ) ;
203 _fillObjectActor->GetProperty( )->SetColor( BOXFILL_HIGHLIGHTED_R , BOXFILL_HIGHLIGHTED_G , BOXFILL_HIGHLIGHTED_B ) ;
204 } else if ( _state == DRAG ) {
205 // _borderObjectActor->GetProperty( )->SetLineWidth( 1.2 ) ;
206 // _borderObjectActor->GetProperty( )->SetColor( BOXBORDER_DRAG_R , BOXBORDER_DRAG_G , BOXBORDER_DRAG_B ) ;
207 _fillObjectActor->GetProperty( )->SetColor( BOXFILL_DRAG_R , BOXFILL_DRAG_G , BOXFILL_DRAG_B ) ;
208 } else if ( _state == SELECTED ) {
209 // _borderObjectActor->GetProperty( )->SetLineWidth( 2 ) ;
210 // _borderObjectActor->GetProperty( )->SetColor( BOXBORDER_SELECTED_R , BOXBORDER_SELECTED_G , BOXBORDER_SELECTED_B ) ;
211 _fillObjectActor->GetProperty( )->SetColor( BOXFILL_SELECTED_R , BOXFILL_SELECTED_G , BOXFILL_SELECTED_B ) ;
215 //=========================================================================
218 } // EO namespace bbtk