----------------------------------------------------------------------------
| 313 | |
| 314 | //---------------------------------------------------------------------------- |
| 315 | void vtkSMViewLayoutProxy::LoadState(const vtkSMMessage* message, vtkSMProxyLocator* locator) |
| 316 | { |
| 317 | this->Superclass::LoadState(message, locator); |
| 318 | |
| 319 | if (message->ExtensionSize(ProxyState::user_data) != 1) |
| 320 | { |
| 321 | // vtkWarningMacro("Missing ViewLayoutState"); |
| 322 | return; |
| 323 | } |
| 324 | |
| 325 | const ProxyState_UserData& user_data = message->GetExtension(ProxyState::user_data, 0); |
| 326 | if (user_data.key() != "ViewLayoutState") |
| 327 | { |
| 328 | // vtkWarningMacro("Unexpected user_data. Expecting ViewLayoutState."); |
| 329 | return; |
| 330 | } |
| 331 | |
| 332 | const bool prev = this->SetBlockUpdateViewPositions(true); |
| 333 | |
| 334 | this->Internals->KDTree.clear(); |
| 335 | this->Internals->KDTree.resize(user_data.variant_size()); |
| 336 | |
| 337 | for (int cc = 0; cc < user_data.variant_size(); cc++) |
| 338 | { |
| 339 | vtkInternals::Cell& cell = this->Internals->KDTree[cc]; |
| 340 | const Variant& value = user_data.variant(cc); |
| 341 | |
| 342 | cell.SplitFraction = value.float64(0); |
| 343 | |
| 344 | switch (value.integer(0)) |
| 345 | { |
| 346 | case HORIZONTAL: |
| 347 | cell.Direction = HORIZONTAL; |
| 348 | break; |
| 349 | |
| 350 | case VERTICAL: |
| 351 | cell.Direction = VERTICAL; |
| 352 | break; |
| 353 | |
| 354 | case NONE: |
| 355 | default: |
| 356 | cell.Direction = NONE; |
| 357 | } |
| 358 | |
| 359 | if (locator && vtkSMProxyProperty::CanCreateProxy()) |
| 360 | { |
| 361 | cell.ViewProxy = vtkSMViewProxy::SafeDownCast(locator->LocateProxy(value.proxy_global_id(0))); |
| 362 | } |
| 363 | else |
| 364 | { |
| 365 | cell.ViewProxy = |
| 366 | vtkSMViewProxy::SafeDownCast(this->GetSession()->GetRemoteObject(value.proxy_global_id(0))); |
| 367 | } |
| 368 | if (cell.ViewProxy && cell.ViewProxy->GetProperty("ViewSize")) |
| 369 | { |
| 370 | // every time view-size changes, we update the view positions for all views. |
| 371 | cell.ViewProxy->GetProperty("ViewSize") |
| 372 | ->AddObserver(vtkCommand::ModifiedEvent, this->Internals->Observer); |
nothing calls this directly
no test coverage detected