<commit_before>/*=========================================================================
 
Program:   Medical Imaging & Interaction Toolkit
Module:    $RCSfile$
Language:  C++
Date:      $Date$
Version:   $Revision$
 
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
 
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notices for more information.
 
=========================================================================*/

#include "QmitkViewInitialization.h"
#include "QmitkViewInitializationControls.h"
#include "icon.xpm"

#include <qaction.h>
#include <qbuttongroup.h>
#include <qcheckbox.h>

#include <QmitkStdMultiWidget.h>
#include <QmitkSelectableGLWidget.h>
#include <QmitkRenderWindowSelector.h>

#include <mitkSliceNavigationController.h>

QmitkViewInitialization::QmitkViewInitialization(QObject *parent, const char *name, QmitkStdMultiWidget *mitkStdMultiWidget, mitk::DataTreeIteratorBase* it)
  : QmitkFunctionality(parent, name, it), m_Controls(NULL), m_MultiWidget(mitkStdMultiWidget)
{
  SetAvailability(true);
}

QmitkViewInitialization::~QmitkViewInitialization()
{
}

QWidget * QmitkViewInitialization::CreateMainWidget(QWidget *parent)
{
  return NULL;
}

QWidget * QmitkViewInitialization::CreateControlWidget(QWidget *parent)
{
  if (m_Controls == NULL)
  {
    m_Controls = new QmitkViewInitializationControls(parent);
  }
  return m_Controls;
}

void QmitkViewInitialization::CreateConnections()
{
  if ( m_Controls )
  {
    connect( (QObject*)(m_Controls->pbApply), SIGNAL(clicked()),(QObject*) this, SLOT(Apply()) );
    connect( (QObject*)(m_Controls->pbReset), SIGNAL(clicked()),(QObject*) this, SLOT(ResetAll()) );
  }
}

QAction * QmitkViewInitialization::CreateAction(QActionGroup *parent)
{
  QAction* action;
  action = new QAction( tr( "change view initialization" ), QPixmap((const char**)icon_xpm), tr( "&View Initialization" ), NULL, parent, "ViewInitialization" );
  return action;
}

void QmitkViewInitialization::Activated()
{
  QmitkFunctionality::Activated();
}

void QmitkViewInitialization::Apply()
{
  mitk::SliceNavigationController::ViewDirection viewDirection;
  switch ( m_Controls->bgOrientation->selectedId() )
  {
    default:
    case 0: 
      viewDirection = mitk::SliceNavigationController::Transversal;
      break;
    case 1: 
      viewDirection = mitk::SliceNavigationController::Frontal;
      break;
    case 2: 
      viewDirection = mitk::SliceNavigationController::Sagittal;
      break;            
  }

  mitk::RenderWindow* renderwindow = m_Controls->m_RenderWindowSelector->GetSelectedRenderWindow();
  if(renderwindow != NULL)
  {
    renderwindow->GetSliceNavigationController()->Update(viewDirection, 
      m_Controls->cbTop->isChecked(), 
      m_Controls->cbFrontSide->isChecked(), 
      m_Controls->cbRotated->isChecked()
    );
    renderwindow->GetRenderer()->GetDisplayGeometry()->Fit();
  }
}

void QmitkViewInitialization::ResetAll()
{
  m_MultiWidget->ReInitializeStandardViews();
}
<commit_msg>FIX: warning<commit_after>/*=========================================================================
 
Program:   Medical Imaging & Interaction Toolkit
Module:    $RCSfile$
Language:  C++
Date:      $Date$
Version:   $Revision$
 
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
 
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.  See the above copyright notices for more information.
 
=========================================================================*/

#include "QmitkViewInitialization.h"
#include "QmitkViewInitializationControls.h"
#include "icon.xpm"

#include <qaction.h>
#include <qbuttongroup.h>
#include <qcheckbox.h>

#include <QmitkStdMultiWidget.h>
#include <QmitkSelectableGLWidget.h>
#include <QmitkRenderWindowSelector.h>

#include <mitkSliceNavigationController.h>

QmitkViewInitialization::QmitkViewInitialization(QObject *parent, const char *name, QmitkStdMultiWidget *mitkStdMultiWidget, mitk::DataTreeIteratorBase* it)
  : QmitkFunctionality(parent, name, it), m_Controls(NULL), m_MultiWidget(mitkStdMultiWidget)
{
  SetAvailability(true);
}

QmitkViewInitialization::~QmitkViewInitialization()
{
}

QWidget * QmitkViewInitialization::CreateMainWidget(QWidget *parent)
{
  return NULL;
}

QWidget * QmitkViewInitialization::CreateControlWidget(QWidget *parent)
{
  if (m_Controls == NULL)
  {
    m_Controls = new QmitkViewInitializationControls(parent);
  }
  return m_Controls;
}

void QmitkViewInitialization::CreateConnections()
{
  if ( m_Controls )
  {
    connect( (QObject*)(m_Controls->pbApply), SIGNAL(clicked()),(QObject*) this, SLOT(Apply()) );
    connect( (QObject*)(m_Controls->pbReset), SIGNAL(clicked()),(QObject*) this, SLOT(ResetAll()) );
  }
}

QAction * QmitkViewInitialization::CreateAction(QActionGroup *parent)
{
  QAction* action;
  action = new QAction( tr( "change view initialization" ), QPixmap((const char**)icon_xpm), tr( "&View Initialization" ), 0, parent, "ViewInitialization" );
  return action;
}

void QmitkViewInitialization::Activated()
{
  QmitkFunctionality::Activated();
}

void QmitkViewInitialization::Apply()
{
  mitk::SliceNavigationController::ViewDirection viewDirection;
  switch ( m_Controls->bgOrientation->selectedId() )
  {
    default:
    case 0: 
      viewDirection = mitk::SliceNavigationController::Transversal;
      break;
    case 1: 
      viewDirection = mitk::SliceNavigationController::Frontal;
      break;
    case 2: 
      viewDirection = mitk::SliceNavigationController::Sagittal;
      break;            
  }

  mitk::RenderWindow* renderwindow = m_Controls->m_RenderWindowSelector->GetSelectedRenderWindow();
  if(renderwindow != NULL)
  {
    renderwindow->GetSliceNavigationController()->Update(viewDirection, 
      m_Controls->cbTop->isChecked(), 
      m_Controls->cbFrontSide->isChecked(), 
      m_Controls->cbRotated->isChecked()
    );
    renderwindow->GetRenderer()->GetDisplayGeometry()->Fit();
  }
}

void QmitkViewInitialization::ResetAll()
{
  m_MultiWidget->ReInitializeStandardViews();
}

{'fraction_non_alphanumeric': 0.1578216599814872, 'fraction_numerical': 0.0010799136069114472, 'mean_word_length': 5.809873949579832, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3020773', 'n_tokens_mistral': 1980, 'n_tokens_neox': 1914, 'n_words': 379}