MCPcopy Create free account
hub / github.com/Kitware/VTK / SetEnabled

Method SetEnabled

Interaction/Widgets/vtkDistanceWidget.cxx:141–277  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

139
140//------------------------------------------------------------------------------
141void vtkDistanceWidget::SetEnabled(int enabling)
142{
143 // The handle widgets are not actually enabled until they are placed.
144 // The handle widgets take their representation from the
145 // vtkDistanceRepresentation.
146 if (enabling)
147 {
148 if (this->WidgetState == vtkDistanceWidget::Start)
149 {
150 reinterpret_cast<vtkDistanceRepresentation*>(this->WidgetRep)->VisibilityOff();
151 }
152 else
153 {
154 // The interactor must be set prior to enabling the widget.
155 if (this->Interactor)
156 {
157 this->Point1Widget->SetInteractor(this->Interactor);
158 this->Point2Widget->SetInteractor(this->Interactor);
159 }
160
161 this->Point1Widget->SetEnabled(1);
162 this->Point2Widget->SetEnabled(1);
163 }
164 }
165
166 if (enabling) //----------------
167 {
168 if (this->Enabled) // already enabled, just return
169 {
170 return;
171 }
172
173 if (!this->Interactor)
174 {
175 vtkErrorMacro(<< "The interactor must be set prior to enabling the widget");
176 return;
177 }
178
179 int X = this->Interactor->GetEventPosition()[0];
180 int Y = this->Interactor->GetEventPosition()[1];
181
182 if (!this->CurrentRenderer)
183 {
184 this->SetCurrentRenderer(this->Interactor->FindPokedRenderer(X, Y));
185 if (this->CurrentRenderer == nullptr)
186 {
187 return;
188 }
189 }
190
191 // We're ready to enable
192 this->Enabled = 1;
193 this->CreateDefaultRepresentation();
194 this->WidgetRep->SetRenderer(this->CurrentRenderer);
195
196 // Set the renderer, interactor and representation on the two handle
197 // widgets.
198 this->Point1Widget->SetRepresentation(

Callers 4

SetWidgetStateToStartMethod · 0.95
AddPointActionMethod · 0.45
AddPointAction3DMethod · 0.45

Calls 15

GetRepresentationMethod · 0.80
AddEventsToInteractorMethod · 0.80
AddEventsToParentMethod · 0.80
InvokeEventMethod · 0.80
RenderMethod · 0.65
SetInteractorMethod · 0.45
SetCurrentRendererMethod · 0.45
FindPokedRendererMethod · 0.45
SetRendererMethod · 0.45
SetRepresentationMethod · 0.45

Tested by

no test coverage detected