<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 "mitkPlanarFigure.h"
#include "mitkPlaneGeometry.h"
#include <mitkProperties.h>
#include <mitkProportionalTimeGeometry.h>

#include <algorithm>

mitk::PlanarFigure::PlanarFigure()
: m_SelectedControlPoint( -1 ),
  m_PreviewControlPointVisible( false ),
  m_FigurePlaced( false ),
  m_PlaneGeometry( nullptr ),
  m_PolyLineUpToDate(false),
  m_HelperLinesUpToDate(false),
  m_FeaturesUpToDate(false),
  m_FeaturesMTime( 0 )
{
  m_HelperPolyLinesToBePainted = BoolContainerType::New();

  m_DisplaySize.first = 0.0;
  m_DisplaySize.second = 0;

  this->SetProperty( "closed", mitk::BoolProperty::New( false ) );

  // Currently only single-time-step geometries are supported
  this->InitializeTimeGeometry( 1 );
}


mitk::PlanarFigure::PlanarFigure(const Self& other)
  : BaseData(other),
    m_ControlPoints(other.m_ControlPoints),
    m_NumberOfControlPoints(other.m_NumberOfControlPoints),
    m_SelectedControlPoint(other.m_SelectedControlPoint),
    m_PolyLines(other.m_PolyLines),
    m_HelperPolyLines(other.m_HelperPolyLines),
    m_PreviewControlPoint(other.m_PreviewControlPoint),
    m_PreviewControlPointVisible(other.m_PreviewControlPointVisible),
    m_FigurePlaced(other.m_FigurePlaced),
    m_PlaneGeometry(other.m_PlaneGeometry), // do not clone since SetPlaneGeometry() doesn't clone either
    m_PolyLineUpToDate(other.m_PolyLineUpToDate),
    m_HelperLinesUpToDate(other.m_HelperLinesUpToDate),
    m_FeaturesUpToDate(other.m_FeaturesUpToDate),
    m_Features(other.m_Features),
    m_FeaturesMTime(other.m_FeaturesMTime),
    m_DisplaySize(other.m_DisplaySize)
{
  m_HelperPolyLinesToBePainted = BoolContainerType::New();
  for( auto i=0; i<other.m_HelperPolyLinesToBePainted->Size(); ++i )
  {
    m_HelperPolyLinesToBePainted->InsertElement( i, other.m_HelperPolyLinesToBePainted->GetElement( i ) );
  }

}


void mitk::PlanarFigure::SetPlaneGeometry( mitk::PlaneGeometry *geometry )
{
  this->SetGeometry( geometry );
  m_PlaneGeometry = dynamic_cast<PlaneGeometry *>(GetGeometry(0));//geometry;
}


const mitk::PlaneGeometry *mitk::PlanarFigure::GetPlaneGeometry() const
{
  return m_PlaneGeometry;
}
<commit_msg>using correct type to avoid warning as error<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 "mitkPlanarFigure.h"
#include "mitkPlaneGeometry.h"
#include <mitkProperties.h>
#include <mitkProportionalTimeGeometry.h>

#include <algorithm>

mitk::PlanarFigure::PlanarFigure()
: m_SelectedControlPoint( -1 ),
  m_PreviewControlPointVisible( false ),
  m_FigurePlaced( false ),
  m_PlaneGeometry( nullptr ),
  m_PolyLineUpToDate(false),
  m_HelperLinesUpToDate(false),
  m_FeaturesUpToDate(false),
  m_FeaturesMTime( 0 )
{
  m_HelperPolyLinesToBePainted = BoolContainerType::New();

  m_DisplaySize.first = 0.0;
  m_DisplaySize.second = 0;

  this->SetProperty( "closed", mitk::BoolProperty::New( false ) );

  // Currently only single-time-step geometries are supported
  this->InitializeTimeGeometry( 1 );
}


mitk::PlanarFigure::PlanarFigure(const Self& other)
  : BaseData(other),
    m_ControlPoints(other.m_ControlPoints),
    m_NumberOfControlPoints(other.m_NumberOfControlPoints),
    m_SelectedControlPoint(other.m_SelectedControlPoint),
    m_PolyLines(other.m_PolyLines),
    m_HelperPolyLines(other.m_HelperPolyLines),
    m_PreviewControlPoint(other.m_PreviewControlPoint),
    m_PreviewControlPointVisible(other.m_PreviewControlPointVisible),
    m_FigurePlaced(other.m_FigurePlaced),
    m_PlaneGeometry(other.m_PlaneGeometry), // do not clone since SetPlaneGeometry() doesn't clone either
    m_PolyLineUpToDate(other.m_PolyLineUpToDate),
    m_HelperLinesUpToDate(other.m_HelperLinesUpToDate),
    m_FeaturesUpToDate(other.m_FeaturesUpToDate),
    m_Features(other.m_Features),
    m_FeaturesMTime(other.m_FeaturesMTime),
    m_DisplaySize(other.m_DisplaySize)
{
  m_HelperPolyLinesToBePainted = BoolContainerType::New();
  for( unsigned long i=0; i<other.m_HelperPolyLinesToBePainted->Size(); ++i )
  {
    m_HelperPolyLinesToBePainted->InsertElement( i, other.m_HelperPolyLinesToBePainted->GetElement( i ) );
  }

}


void mitk::PlanarFigure::SetPlaneGeometry( mitk::PlaneGeometry *geometry )
{
  this->SetGeometry( geometry );
  m_PlaneGeometry = dynamic_cast<PlaneGeometry *>(GetGeometry(0));//geometry;
}


const mitk::PlaneGeometry *mitk::PlanarFigure::GetPlaneGeometry() const
{
  return m_PlaneGeometry;
}

{'fraction_non_alphanumeric': 0.14696008951883627, 'fraction_numerical': 0.0029839612085042896, 'mean_word_length': 6.542897327707454, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 23, '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': '3313415', 'n_tokens_mistral': 1699, 'n_tokens_neox': 1648, 'n_words': 294}