1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
#include "CubitCoordinateSystem.hpp"<--- Skipping configuration 'DBL_MAX' since the value of 'DBL_MAX' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.<--- Skipping configuration 'DBL_MIN' since the value of 'DBL_MIN' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.<--- Skipping configuration 'M_PI' since the value of 'M_PI' is unknown. Use -D if you want to check it. You can use -U to skip it explicitly.

#include <cassert>

#include "CubitMessage.hpp"
#include "CubitBox.hpp"
#include "CubitObserver.hpp"
#include "CubitString.hpp"
#include "AppUtil.hpp"
#include "CubitCoordEvent.hpp"

//! default constructor, initializes to rectangular type with an identity transform
CubitCoordinateSystem::CubitCoordinateSystem(int id)
 : mType(Rectangular), mMatrix(CubitTransformMatrix()), mReference(0)
{
    this->set_id(id);
}

CubitCoordinateSystem::~CubitCoordinateSystem()
{
  if(mReference)
    mReference->mUses.remove(this);
  
  // if we have uses, make them reference this reference
  while(mUses.size())
  {
    CubitCoordinateSystem* sys = mUses.get();
    sys->set_transform(sys->mMatrix * this->mMatrix);
    sys->mReference = this->mReference;
    if(mReference)
      mReference->mUses.append(sys);
    mUses.remove();
  }

  this->remove_from_observers();

  AppUtil::instance()->send_event(CubitCoordEvent(CubitCoordEvent::COORDINATE_SYSTEM_DELETED, this));
}

CubitBox CubitCoordinateSystem::bounding_box()
{
    assert(0); // this function is only here b/c CubitEntity requires it
    
    CubitBox temp;
    return temp;
}

const std::type_info& CubitCoordinateSystem::entity_type_info() const
{
    return typeid(CubitCoordinateSystem);
}

const char* CubitCoordinateSystem::class_name() const
{
    return "Coordinate System";
}

CubitString CubitCoordinateSystem::entity_name() const
{
  CubitString name = class_name();
  name += " ";
  name += CubitString::number( this->id() );
  return name;
}

CubitCoordinateSystem::Type CubitCoordinateSystem::get_type() const
{
  return mType;
}

void CubitCoordinateSystem::set_type(CubitCoordinateSystem::Type type)
{<--- The function 'set_type' is never used.
  mType = type;
  AppUtil::instance()->send_event(CubitCoordEvent(CubitCoordEvent::COORDINATE_SYSTEM_MODIFIED, this));
}


//! return the transform of this coordinate system
const CubitTransformMatrix& CubitCoordinateSystem::get_transform() const
{<--- The function 'get_transform' is never used.
  return mMatrix;
}

void CubitCoordinateSystem::set_transform(const CubitTransformMatrix& mat)
{
  mMatrix = mat;
  AppUtil::instance()->send_event(CubitCoordEvent(CubitCoordEvent::COORDINATE_SYSTEM_MODIFIED, this));
}


//! return the transform of this coordinate system 
//! with respect to the global coordinate system
CubitTransformMatrix CubitCoordinateSystem::get_concatenated_transform() const
{<--- The function 'get_concatenated_transform' is never used.
  CubitTransformMatrix mat;
  mat = mMatrix;
  CubitCoordinateSystem* ref;
  for(ref = mReference; ref != 0; ref = ref->mReference)
    mat = mat * ref->mMatrix;
  return mat;
}