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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
/*=========================================================================
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.kitware.com/VolViewCopyright.htm 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 notice for more information.
=========================================================================*/
#include "vtkVVDataItem.h"
#include "vtkObjectFactory.h"
#include <vtksys/SystemTools.hxx>
#include "vtkVVFileInstance.h"
#ifdef KWCommonPro_USE_XML_RW
#include "XML/vtkXMLVVDataItemReader.h"
#include "XML/vtkXMLVVDataItemWriter.h"
#endif
vtkKWGetXMLReaderWriterObjectsImplementationMacro(vtkVVDataItem, vtkXMLVVDataItemReader, vtkXMLVVDataItemWriter);
//----------------------------------------------------------------------------
vtkCxxRevisionMacro(vtkVVDataItem, "$Revision: 1.11 $");
vtkCxxSetObjectMacro(vtkVVDataItem, FileInstance, vtkVVFileInstance);
//----------------------------------------------------------------------------
class vtkVVDataItemInternals
{
public:
};
//----------------------------------------------------------------------------
vtkVVDataItem::vtkVVDataItem()
{
this->Internals = new vtkVVDataItemInternals;
this->Name = NULL;
this->DescriptiveName = NULL;
this->DistanceUnits = NULL;
this->FileInstance = NULL;
this->Scope = vtkVVDataItem::ScopeUnknown;
}
//----------------------------------------------------------------------------
vtkVVDataItem::~vtkVVDataItem()
{
this->ReleaseData();
// Delete our pool
if (this->Internals)
{
delete this->Internals;
}
this->SetName(NULL);
this->SetDescriptiveName(NULL);
this->SetDistanceUnits(NULL);
this->SetFileInstance(NULL);
}
//----------------------------------------------------------------------------
const char* vtkVVDataItem::GetDescriptiveName()
{
if (!this->DescriptiveName && this->Name)
{
vtksys_stl::string short_data_name =
vtksys::SystemTools::GetFilenameName(this->Name);
this->SetDescriptiveName(short_data_name.c_str());
}
return this->DescriptiveName;
}
//----------------------------------------------------------------------------
void vtkVVDataItem::SetScope(int arg)
{
if (arg < vtkVVDataItem::ScopeUnknown ||
arg > vtkVVDataItem::ScopeScientific ||
this->Scope == arg)
{
return;
}
this->Scope = arg;
this->Modified();
}
void vtkVVDataItem::SetScopeToUnknown()
{
this->SetScope(vtkVVDataItem::ScopeUnknown);
}
void vtkVVDataItem::SetScopeToMedical()
{
this->SetScope(vtkVVDataItem::ScopeMedical);
}
void vtkVVDataItem::SetScopeToScientific()
{
this->SetScope(vtkVVDataItem::ScopeScientific);
}
//----------------------------------------------------------------------------
void vtkVVDataItem::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "Name: "
<< (this->Name ? this->Name : "(NULL)") << endl;
os << indent << "DescriptiveName: "
<< (this->DescriptiveName ? this->DescriptiveName : "(NULL)") << endl;
os << indent << "DistanceUnits: "
<< (this->DistanceUnits ? this->DistanceUnits : "(NULL)") << endl;
os << indent << "Scope: " << this->Scope << endl;
}
|