Commit 8311d712 authored by Jorge Poco's avatar Jorge Poco

ENH: YT Updates

YT Updates

Change-Id: I53764bcfc6a58b331389586d25e5e57af014c259
parent 1c371c08
......@@ -212,7 +212,7 @@ int vtkPythonProgrammableFilter::RequestUpdateExtent(
}
//----------------------------------------------------------------------------
void vtkPythonProgrammableFilter::SetParameter(const char *raw_name,
void vtkPythonProgrammableFilter::SetParameterInternal(const char *raw_name,
const char *raw_value)
{
const vtkstd::string name = raw_name ? raw_name : "";
......@@ -228,6 +228,42 @@ void vtkPythonProgrammableFilter::SetParameter(const char *raw_name,
this->Modified();
}
void vtkPythonProgrammableFilter::SetParameter(const char *raw_name,
const int value)
{
char buf[20];
snprintf(buf, 20, "%d", value);
this->SetParameterInternal(raw_name, buf);
}
void vtkPythonProgrammableFilter::SetParameter(const char *raw_name,
const double value)
{
char buf[20];
snprintf(buf, 20, "%f", value);
this->SetParameterInternal(raw_name, buf);
}
void vtkPythonProgrammableFilter::SetParameter(const char *raw_name,
const char *value)
{
char buf[100];
snprintf(buf, 100, "'%s'", value);
this->SetParameterInternal(raw_name, buf);
}
void vtkPythonProgrammableFilter::SetParameter(
const char *raw_name,
const double value1,
const double value2,
const double value3)
{
char buf[100];
snprintf(buf, 100, "[%f, %f, %f]", value1, value2, value3);
this->SetParameterInternal(raw_name, buf);
}
//----------------------------------------------------------------------------
void vtkPythonProgrammableFilter::ClearParameters()
{
......
......@@ -73,7 +73,12 @@ public:
// Description:
// Set a name-value parameter that will be available to the script
// when it is run
void SetParameterInternal(const char *name, const char *value);
void SetParameter(const char *name, const char *value);
void SetParameter(const char *name, const int value);
void SetParameter(const char *name, const double value);
void SetParameter(const char *name, const double value1,
const double value2, const double value3);
// Description:
// Clear all name-value parameters
......
......@@ -15,8 +15,8 @@
Enable/Disable widget interaction.
</Documentation>
</IntVectorProperty>
<SubProxy>
<Proxy name="Prop"
proxygroup="3d_widget_representations" proxyname="HandleRepresentation">
</Proxy>
......
......@@ -201,6 +201,12 @@ bool vtkSIStringVectorProperty::Push(const vtkVectorOfStrings &values)
if (!this->Repeatable)
{
stream << vtkClientServerStream::Invoke << object << this->Command;
if (this->InitialString)
{
stream << InitialString;
}
vtkVectorOfStrings::const_iterator iter;
int i=0;
for (iter = values.begin(); iter != values.end(); ++iter, ++i)
......
......@@ -28,6 +28,7 @@ public:
vtkTypeMacro(vtkSIStringVectorProperty, vtkSIVectorProperty);
void PrintSelf(ostream& os, vtkIndent indent);
//BTX
protected:
vtkSIStringVectorProperty();
......
......@@ -24,6 +24,7 @@ vtkSIVectorProperty::vtkSIVectorProperty()
this->UseIndex = false;
this->CleanCommand = NULL;
this->SetNumberCommand = NULL;
this->InitialString = NULL;
}
//----------------------------------------------------------------------------
......@@ -31,6 +32,7 @@ vtkSIVectorProperty::~vtkSIVectorProperty()
{
this->SetCleanCommand(0);
this->SetSetNumberCommand(0);
this->SetInitialString(0);
}
//---------------------------------------------------------------------------
......@@ -67,6 +69,12 @@ bool vtkSIVectorProperty::ReadXMLAttributes(
this->SetCleanCommand(clean_command);
}
const char* initial_string = element->GetAttribute("initial_string");
if (initial_string)
{
this->SetInitialString(initial_string);
}
return 1;
}
......
......@@ -65,6 +65,7 @@ public:
// with the number of arguments as the parameter.
vtkGetStringMacro(SetNumberCommand);
vtkGetStringMacro(InitialString);
//BTX
protected:
......@@ -72,11 +73,13 @@ protected:
~vtkSIVectorProperty();
vtkSetStringMacro(CleanCommand);
vtkSetStringMacro(SetNumberCommand);
vtkSetStringMacro(InitialString);
char* SetNumberCommand;
char* CleanCommand;
bool UseIndex;
int NumberOfElementsPerCommand;
char *InitialString;
// Description:
// Set the appropriate ivars from the xml element.
......
......@@ -375,6 +375,11 @@ bool vtkSIVectorPropertyTemplate<T, force_idtype>::Push(T* values, int number_of
if (!this->Repeatable)
{
stream << vtkClientServerStream::Invoke << object << this->Command;
if (this->InitialString)
{
stream << this->InitialString;
}
if (this->ArgumentIsArray)
{
stream << vtkClientServerStream::InsertArray(values, number_of_elements);
......
......@@ -26,6 +26,7 @@ vtkSMVectorProperty::vtkSMVectorProperty()
this->CleanCommand = 0;
this->IsInternal = 0;
this->SetNumberCommand = 0;
this->InitialString = 0; // TODO(jpocom) check
}
//---------------------------------------------------------------------------
......@@ -33,6 +34,7 @@ vtkSMVectorProperty::~vtkSMVectorProperty()
{
this->SetCleanCommand(0);
this->SetSetNumberCommand(0);
this->SetInitialString(0); // TODO(jpocom) check
}
//---------------------------------------------------------------------------
......@@ -86,6 +88,13 @@ int vtkSMVectorProperty::ReadXMLAttributes(vtkSMProxy* parent,
{
this->SetCleanCommand(clean_command);
}
// TODO(jpocom) check
const char* initial_string = element->GetAttribute("initial_string");
if (initial_string)
{
this->SetInitialString(initial_string);
}
return 1;
}
......
......@@ -101,6 +101,10 @@ public:
vtkGetStringMacro(SetNumberCommand);
char* SetNumberCommand;
vtkSetStringMacro(InitialString);
vtkGetStringMacro(InitialString);
protected:
vtkSMVectorProperty();
......@@ -119,6 +123,8 @@ protected:
int UseIndex;
char* CleanCommand;
char* InitialString;
// Description:
// Set the appropriate ivars from the xml element.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment