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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
/*=========================================================================
Program: ParaView
Module: vtkSMVectorProperty.cxx
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/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 notice for more information.
=========================================================================*/
#include "vtkSMVectorProperty.h"
#include "vtkPVXMLElement.h"
//---------------------------------------------------------------------------
vtkSMVectorProperty::vtkSMVectorProperty()
{
this->RepeatCommand = 0;
this->NumberOfElementsPerCommand = 1;
this->UseIndex = 0;
this->CleanCommand = 0;
this->IsInternal = 0;
this->SetNumberCommand = 0;
this->InitialString = 0; // TODO(jpocom) check
}
//---------------------------------------------------------------------------
vtkSMVectorProperty::~vtkSMVectorProperty()
{
this->SetCleanCommand(0);
this->SetSetNumberCommand(0);
this->SetInitialString(0); // TODO(jpocom) check
}
//---------------------------------------------------------------------------
int vtkSMVectorProperty::ReadXMLAttributes(vtkSMProxy* parent,
vtkPVXMLElement* element)
{
int retVal;
retVal = this->Superclass::ReadXMLAttributes(parent, element);
if (!retVal)
{
return retVal;
}
const char* numCommand = element->GetAttribute("set_number_command");
if (numCommand)
{
this->SetSetNumberCommand(numCommand);
}
int use_index;
retVal = element->GetScalarAttribute("use_index", &use_index);
if(retVal)
{
this->SetUseIndex(use_index);
}
int repeat_command;
retVal = element->GetScalarAttribute("repeat_command", &repeat_command);
if(retVal)
{
this->SetRepeatCommand(repeat_command);
this->Repeatable = repeat_command;
}
int numElsPerCommand;
retVal =
element->GetScalarAttribute(
"number_of_elements_per_command", &numElsPerCommand);
if (retVal)
{
this->SetNumberOfElementsPerCommand(numElsPerCommand);
}
int numEls;
retVal = element->GetScalarAttribute("number_of_elements", &numEls);
if (retVal)
{
this->SetNumberOfElements(numEls);
}
const char* clean_command = element->GetAttribute("clean_command");
if (clean_command)
{
this->SetCleanCommand(clean_command);
}
// TODO(jpocom) check
const char* initial_string = element->GetAttribute("initial_string");
if (initial_string)
{
this->SetInitialString(initial_string);
}
return 1;
}
//---------------------------------------------------------------------------
void vtkSMVectorProperty::Copy(vtkSMProperty* src)
{
this->Superclass::Copy(src);
}
//---------------------------------------------------------------------------
bool vtkSMVectorProperty::ResetToDomainDefaults(bool use_unchecked_values)
{
if (this->Superclass::ResetToDomainDefaults(use_unchecked_values))
{
return true;
}
// If none of the domains picked a default, maybe there's an information
// property that wants to provide use with a default.
if (vtkSMVectorProperty* infoProp = vtkSMVectorProperty::SafeDownCast(this->GetInformationProperty()))
{
if (infoProp->GetNumberOfElements() > 0)
{
this->Copy(infoProp);
return true;
}
}
return false;
}
//---------------------------------------------------------------------------
void vtkSMVectorProperty::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "NumberOfElements: " << this->GetNumberOfElements() << endl;
os << indent << "NumberOfElementsPerCommand: "
<< this->GetNumberOfElementsPerCommand() << endl;
os << indent << "RepeatCommand: " << this->RepeatCommand << endl;
os << indent << "CleanCommand: " <<
(this->CleanCommand? this->CleanCommand : "(null)" ) << endl;
os << indent << "UseIndex: " << this->UseIndex << endl;
os << indent << "SetNumberCommand: " <<
(this->SetNumberCommand? this->SetNumberCommand : "(null)") << endl;
}
|