<commit_before>/*===================================================================

The Medical Imaging Interaction Toolkit (MITK)

Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.

This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.

See LICENSE.txt or http://www.mitk.org for details.

===================================================================*/
#include <mitkContourModel.h>

mitk::ContourModel::ContourModel()
{
  this->m_Contour = mitk::ContourModelElement::New();
  m_SelectedVertex = NULL;
}

mitk::ContourModel::ContourModel(const mitk::ContourModel &other) :
m_Contour(other.m_Contour)
{
  m_SelectedVertex = NULL;
}

mitk::ContourModel::~ContourModel()
{
  m_SelectedVertex = NULL;
  this->m_Contour = NULL;
}


bool mitk::ContourModel::SelectVertexAt(int index)
{
  if(index < 0 || index > this->m_Contour->GetSize())
    return false;

  this->m_SelectedVertex = this->m_Contour->GetVertexAt(index);

  return true;
}

bool mitk::ContourModel::SelectVertexAt(mitk::Point3D &point, float eps)
{
  this->m_SelectedVertex = this->m_Contour->GetVertexAt(point, eps);
  return this->m_SelectedVertex != NULL;
}

bool mitk::ContourModel::RemoveVertexAt(int index)
{
  if(index < 0 || index > this->m_Contour->GetSize())
    return false;

  this->m_Contour->RemoveVertexAt(index);

  return true;
}

bool mitk::ContourModel::RemoveVertexAt(mitk::Point3D &point, float eps)
{
  return this->m_Contour->RemoveVertexAt(point, eps);
}

void mitk::ContourModel::MoveSelectedVertex(mitk::Vector3D &translate)
{
  if(this->m_SelectedVertex)
  {
    this->MoveVertex(this->m_SelectedVertex,translate);
  }
}

void mitk::ContourModel::MoveContour(mitk::Vector3D &translate)
{
  VertexListType* vList = this->m_Contour->GetVertexList();
  VertexIterator it = vList->begin();
  VertexIterator end = vList->end();

  while(it != end)
  {
    this->MoveVertex((*it),translate);
    it++;
  }

}



void mitk::ContourModel::MoveVertex(VertexType* vertex, mitk::Vector3D &vector)
{
  vertex->Coordinates[0] += vector[0];
  vertex->Coordinates[1] += vector[1];
  vertex->Coordinates[2] += vector[2];
}



void mitk::ContourModel::SetRequestedRegionToLargestPossibleRegion ()
{
  
}

bool mitk::ContourModel::RequestedRegionIsOutsideOfTheBufferedRegion ()
{
  return NULL;
}

bool mitk::ContourModel::VerifyRequestedRegion ()
{
  return NULL;
}

const mitk::Geometry3D * mitk::ContourModel::GetUpdatedGeometry (int t)<commit_msg>init timestep<commit_after>/*===================================================================

The Medical Imaging Interaction Toolkit (MITK)

Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.

This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.

See LICENSE.txt or http://www.mitk.org for details.

===================================================================*/
#include <mitkContourModel.h>

mitk::ContourModel::ContourModel()
{
  this->m_Contour = mitk::ContourModelElement::New();
  Superclass::InitializeTimeSlicedGeometry(1);
  m_SelectedVertex = NULL;
}

mitk::ContourModel::ContourModel(const mitk::ContourModel &other) :
m_Contour(other.m_Contour)
{
  m_SelectedVertex = NULL;
}

mitk::ContourModel::~ContourModel()
{
  m_SelectedVertex = NULL;
  this->m_Contour = NULL;
}


bool mitk::ContourModel::SelectVertexAt(int index)
{
  if(index < 0 || index > this->m_Contour->GetSize())
    return false;

  this->m_SelectedVertex = this->m_Contour->GetVertexAt(index);

  return true;
}

bool mitk::ContourModel::SelectVertexAt(mitk::Point3D &point, float eps)
{
  this->m_SelectedVertex = this->m_Contour->GetVertexAt(point, eps);
  return this->m_SelectedVertex != NULL;
}

bool mitk::ContourModel::RemoveVertexAt(int index)
{
  if(index < 0 || index > this->m_Contour->GetSize())
    return false;

  this->m_Contour->RemoveVertexAt(index);

  return true;
}

bool mitk::ContourModel::RemoveVertexAt(mitk::Point3D &point, float eps)
{
  return this->m_Contour->RemoveVertexAt(point, eps);
}

void mitk::ContourModel::MoveSelectedVertex(mitk::Vector3D &translate)
{
  if(this->m_SelectedVertex)
  {
    this->MoveVertex(this->m_SelectedVertex,translate);
  }
}

void mitk::ContourModel::MoveContour(mitk::Vector3D &translate)
{
  VertexListType* vList = this->m_Contour->GetVertexList();
  VertexIterator it = vList->begin();
  VertexIterator end = vList->end();

  while(it != end)
  {
    this->MoveVertex((*it),translate);
    it++;
  }

}



void mitk::ContourModel::MoveVertex(VertexType* vertex, mitk::Vector3D &vector)
{
  vertex->Coordinates[0] += vector[0];
  vertex->Coordinates[1] += vector[1];
  vertex->Coordinates[2] += vector[2];
}



void mitk::ContourModel::SetRequestedRegionToLargestPossibleRegion ()
{
  
}

bool mitk::ContourModel::RequestedRegionIsOutsideOfTheBufferedRegion ()
{
  return false;
}

bool mitk::ContourModel::VerifyRequestedRegion ()
{
  return true;
}

const mitk::Geometry3D * mitk::ContourModel::GetUpdatedGeometry (int t)
{'fraction_non_alphanumeric': 0.18194018404907975, 'fraction_numerical': 0.005559815950920245, 'mean_word_length': 6.136798905608755, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 65, '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': '933004', 'n_tokens_mistral': 1748, 'n_tokens_neox': 1697, 'n_words': 315}