Commit d641e143 authored by allens's avatar allens

updated GUI from 1.12 branch

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@9722 18c085ea-50e0-402c-830e-de6fd14e8384
parent 7f93a5a4
<?xml version="1.0"?>
<Plugin name="PersistentParticles" type="operator" label="PersistentParticles" version="2.0" enabled="true" mdspecificcode="false" engspecificcode="false" onlyengine="false" noengine="false" iconFile="PersistentParticles.xpm">
<Attribute name="PersistentParticlesAttributes" purpose="This class contains attributes for the PersistentParticles operator." persistent="true" keyframe="true" exportAPI="" exportInclude="">
<Enum name="PathTypeEnum">
Absolute
Relative
</Enum>
<Field name="startIndex" label="Index of first time slice" type="int">
0
</Field>
<Field name="startIndexRelative" label="Index of first time slice relative to current time" type="bool">
false
<Field name="startPathType" label="Absolute" type="int">
0
</Field>
<Field name="stopIndex" label="Index of last time slice" type="int">
1
</Field>
<Field name="stopIndexRelative" label="Index of last time slice relative to current time" type="bool">
false
<Field name="stopPathType" label="Absolute" type="int">
0
</Field>
<Field name="stride" label="Skip rate between time slices" type="int">
1
......
......@@ -39,6 +39,43 @@
#include <PersistentParticlesAttributes.h>
#include <DataNode.h>
//
// Enum conversion methods for PersistentParticlesAttributes::PathTypeEnum
//
static const char *PathTypeEnum_strings[] = {
"Absolute", "Relative"};
std::string
PersistentParticlesAttributes::PathTypeEnum_ToString(PersistentParticlesAttributes::PathTypeEnum t)
{
int index = int(t);
if(index < 0 || index >= 2) index = 0;
return PathTypeEnum_strings[index];
}
std::string
PersistentParticlesAttributes::PathTypeEnum_ToString(int t)
{
int index = (t < 0 || t >= 2) ? 0 : t;
return PathTypeEnum_strings[index];
}
bool
PersistentParticlesAttributes::PathTypeEnum_FromString(const std::string &s, PersistentParticlesAttributes::PathTypeEnum &val)
{
val = PersistentParticlesAttributes::Absolute;
for(int i = 0; i < 2; ++i)
{
if(s == PathTypeEnum_strings[i])
{
val = (PathTypeEnum)i;
return true;
}
}
return false;
}
// ****************************************************************************
// Method: PersistentParticlesAttributes::PersistentParticlesAttributes
//
......@@ -57,9 +94,9 @@
void PersistentParticlesAttributes::Init()
{
startIndex = 0;
startIndexRelative = false;
startPathType = 0;
stopIndex = 1;
stopIndexRelative = false;
stopPathType = 0;
stride = 1;
PersistentParticlesAttributes::SelectAll();
......@@ -83,9 +120,9 @@ void PersistentParticlesAttributes::Init()
void PersistentParticlesAttributes::Copy(const PersistentParticlesAttributes &obj)
{
startIndex = obj.startIndex;
startIndexRelative = obj.startIndexRelative;
startPathType = obj.startPathType;
stopIndex = obj.stopIndex;
stopIndexRelative = obj.stopIndexRelative;
stopPathType = obj.stopPathType;
stride = obj.stride;
traceVariableX = obj.traceVariableX;
traceVariableY = obj.traceVariableY;
......@@ -254,9 +291,9 @@ PersistentParticlesAttributes::operator == (const PersistentParticlesAttributes
{
// Create the return value
return ((startIndex == obj.startIndex) &&
(startIndexRelative == obj.startIndexRelative) &&
(startPathType == obj.startPathType) &&
(stopIndex == obj.stopIndex) &&
(stopIndexRelative == obj.stopIndexRelative) &&
(stopPathType == obj.stopPathType) &&
(stride == obj.stride) &&
(traceVariableX == obj.traceVariableX) &&
(traceVariableY == obj.traceVariableY) &&
......@@ -406,16 +443,16 @@ PersistentParticlesAttributes::NewInstance(bool copy) const
void
PersistentParticlesAttributes::SelectAll()
{
Select(ID_startIndex, (void *)&startIndex);
Select(ID_startIndexRelative, (void *)&startIndexRelative);
Select(ID_stopIndex, (void *)&stopIndex);
Select(ID_stopIndexRelative, (void *)&stopIndexRelative);
Select(ID_stride, (void *)&stride);
Select(ID_traceVariableX, (void *)&traceVariableX);
Select(ID_traceVariableY, (void *)&traceVariableY);
Select(ID_traceVariableZ, (void *)&traceVariableZ);
Select(ID_connectParticles, (void *)&connectParticles);
Select(ID_indexVariable, (void *)&indexVariable);
Select(ID_startIndex, (void *)&startIndex);
Select(ID_startPathType, (void *)&startPathType);
Select(ID_stopIndex, (void *)&stopIndex);
Select(ID_stopPathType, (void *)&stopPathType);
Select(ID_stride, (void *)&stride);
Select(ID_traceVariableX, (void *)&traceVariableX);
Select(ID_traceVariableY, (void *)&traceVariableY);
Select(ID_traceVariableZ, (void *)&traceVariableZ);
Select(ID_connectParticles, (void *)&connectParticles);
Select(ID_indexVariable, (void *)&indexVariable);
}
///////////////////////////////////////////////////////////////////////////////
......@@ -454,10 +491,10 @@ PersistentParticlesAttributes::CreateNode(DataNode *parentNode, bool completeSav
node->AddNode(new DataNode("startIndex", startIndex));
}
if(completeSave || !FieldsEqual(ID_startIndexRelative, &defaultObject))
if(completeSave || !FieldsEqual(ID_startPathType, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("startIndexRelative", startIndexRelative));
node->AddNode(new DataNode("startPathType", startPathType));
}
if(completeSave || !FieldsEqual(ID_stopIndex, &defaultObject))
......@@ -466,10 +503,10 @@ PersistentParticlesAttributes::CreateNode(DataNode *parentNode, bool completeSav
node->AddNode(new DataNode("stopIndex", stopIndex));
}
if(completeSave || !FieldsEqual(ID_stopIndexRelative, &defaultObject))
if(completeSave || !FieldsEqual(ID_stopPathType, &defaultObject))
{
addToParent = true;
node->AddNode(new DataNode("stopIndexRelative", stopIndexRelative));
node->AddNode(new DataNode("stopPathType", stopPathType));
}
if(completeSave || !FieldsEqual(ID_stride, &defaultObject))
......@@ -546,12 +583,12 @@ PersistentParticlesAttributes::SetFromNode(DataNode *parentNode)
DataNode *node;
if((node = searchNode->GetNode("startIndex")) != 0)
SetStartIndex(node->AsInt());
if((node = searchNode->GetNode("startIndexRelative")) != 0)
SetStartIndexRelative(node->AsBool());
if((node = searchNode->GetNode("startPathType")) != 0)
SetStartPathType(node->AsInt());
if((node = searchNode->GetNode("stopIndex")) != 0)
SetStopIndex(node->AsInt());
if((node = searchNode->GetNode("stopIndexRelative")) != 0)
SetStopIndexRelative(node->AsBool());
if((node = searchNode->GetNode("stopPathType")) != 0)
SetStopPathType(node->AsInt());
if((node = searchNode->GetNode("stride")) != 0)
SetStride(node->AsInt());
if((node = searchNode->GetNode("traceVariableX")) != 0)
......@@ -578,10 +615,10 @@ PersistentParticlesAttributes::SetStartIndex(int startIndex_)
}
void
PersistentParticlesAttributes::SetStartIndexRelative(bool startIndexRelative_)
PersistentParticlesAttributes::SetStartPathType(int startPathType_)
{
startIndexRelative = startIndexRelative_;
Select(ID_startIndexRelative, (void *)&startIndexRelative);
startPathType = startPathType_;
Select(ID_startPathType, (void *)&startPathType);
}
void
......@@ -592,10 +629,10 @@ PersistentParticlesAttributes::SetStopIndex(int stopIndex_)
}
void
PersistentParticlesAttributes::SetStopIndexRelative(bool stopIndexRelative_)
PersistentParticlesAttributes::SetStopPathType(int stopPathType_)
{
stopIndexRelative = stopIndexRelative_;
Select(ID_stopIndexRelative, (void *)&stopIndexRelative);
stopPathType = stopPathType_;
Select(ID_stopPathType, (void *)&stopPathType);
}
void
......@@ -650,10 +687,10 @@ PersistentParticlesAttributes::GetStartIndex() const
return startIndex;
}
bool
PersistentParticlesAttributes::GetStartIndexRelative() const
int
PersistentParticlesAttributes::GetStartPathType() const
{
return startIndexRelative;
return startPathType;
}
int
......@@ -662,10 +699,10 @@ PersistentParticlesAttributes::GetStopIndex() const
return stopIndex;
}
bool
PersistentParticlesAttributes::GetStopIndexRelative() const
int
PersistentParticlesAttributes::GetStopPathType() const
{
return stopIndexRelative;
return stopPathType;
}
int
......@@ -780,16 +817,16 @@ PersistentParticlesAttributes::GetFieldName(int index) const
{
switch (index)
{
case ID_startIndex: return "startIndex";
case ID_startIndexRelative: return "startIndexRelative";
case ID_stopIndex: return "stopIndex";
case ID_stopIndexRelative: return "stopIndexRelative";
case ID_stride: return "stride";
case ID_traceVariableX: return "traceVariableX";
case ID_traceVariableY: return "traceVariableY";
case ID_traceVariableZ: return "traceVariableZ";
case ID_connectParticles: return "connectParticles";
case ID_indexVariable: return "indexVariable";
case ID_startIndex: return "startIndex";
case ID_startPathType: return "startPathType";
case ID_stopIndex: return "stopIndex";
case ID_stopPathType: return "stopPathType";
case ID_stride: return "stride";
case ID_traceVariableX: return "traceVariableX";
case ID_traceVariableY: return "traceVariableY";
case ID_traceVariableZ: return "traceVariableZ";
case ID_connectParticles: return "connectParticles";
case ID_indexVariable: return "indexVariable";
default: return "invalid index";
}
}
......@@ -814,16 +851,16 @@ PersistentParticlesAttributes::GetFieldType(int index) const
{
switch (index)
{
case ID_startIndex: return FieldType_int;
case ID_startIndexRelative: return FieldType_bool;
case ID_stopIndex: return FieldType_int;
case ID_stopIndexRelative: return FieldType_bool;
case ID_stride: return FieldType_int;
case ID_traceVariableX: return FieldType_variablename;
case ID_traceVariableY: return FieldType_variablename;
case ID_traceVariableZ: return FieldType_variablename;
case ID_connectParticles: return FieldType_bool;
case ID_indexVariable: return FieldType_variablename;
case ID_startIndex: return FieldType_int;
case ID_startPathType: return FieldType_int;
case ID_stopIndex: return FieldType_int;
case ID_stopPathType: return FieldType_int;
case ID_stride: return FieldType_int;
case ID_traceVariableX: return FieldType_variablename;
case ID_traceVariableY: return FieldType_variablename;
case ID_traceVariableZ: return FieldType_variablename;
case ID_connectParticles: return FieldType_bool;
case ID_indexVariable: return FieldType_variablename;
default: return FieldType_unknown;
}
}
......@@ -848,16 +885,16 @@ PersistentParticlesAttributes::GetFieldTypeName(int index) const
{
switch (index)
{
case ID_startIndex: return "int";
case ID_startIndexRelative: return "bool";
case ID_stopIndex: return "int";
case ID_stopIndexRelative: return "bool";
case ID_stride: return "int";
case ID_traceVariableX: return "variablename";
case ID_traceVariableY: return "variablename";
case ID_traceVariableZ: return "variablename";
case ID_connectParticles: return "bool";
case ID_indexVariable: return "variablename";
case ID_startIndex: return "int";
case ID_startPathType: return "int";
case ID_stopIndex: return "int";
case ID_stopPathType: return "int";
case ID_stride: return "int";
case ID_traceVariableX: return "variablename";
case ID_traceVariableY: return "variablename";
case ID_traceVariableZ: return "variablename";
case ID_connectParticles: return "bool";
case ID_indexVariable: return "variablename";
default: return "invalid index";
}
}
......@@ -889,9 +926,9 @@ PersistentParticlesAttributes::FieldsEqual(int index_, const AttributeGroup *rhs
retval = (startIndex == obj.startIndex);
}
break;
case ID_startIndexRelative:
case ID_startPathType:
{ // new scope
retval = (startIndexRelative == obj.startIndexRelative);
retval = (startPathType == obj.startPathType);
}
break;
case ID_stopIndex:
......@@ -899,9 +936,9 @@ PersistentParticlesAttributes::FieldsEqual(int index_, const AttributeGroup *rhs
retval = (stopIndex == obj.stopIndex);
}
break;
case ID_stopIndexRelative:
case ID_stopPathType:
{ // new scope
retval = (stopIndexRelative == obj.stopIndexRelative);
retval = (stopPathType == obj.stopPathType);
}
break;
case ID_stride:
......
......@@ -60,6 +60,12 @@
class PersistentParticlesAttributes : public AttributeSubject
{
public:
enum PathTypeEnum
{
Absolute,
Relative
};
// These constructors are for objects of this class
PersistentParticlesAttributes();
PersistentParticlesAttributes(const PersistentParticlesAttributes &obj);
......@@ -92,9 +98,9 @@ public:
// Property setting methods
void SetStartIndex(int startIndex_);
void SetStartIndexRelative(bool startIndexRelative_);
void SetStartPathType(int startPathType_);
void SetStopIndex(int stopIndex_);
void SetStopIndexRelative(bool stopIndexRelative_);
void SetStopPathType(int stopPathType_);
void SetStride(int stride_);
void SetTraceVariableX(const std::string &traceVariableX_);
void SetTraceVariableY(const std::string &traceVariableY_);
......@@ -104,9 +110,9 @@ public:
// Property getting methods
int GetStartIndex() const;
bool GetStartIndexRelative() const;
int GetStartPathType() const;
int GetStopIndex() const;
bool GetStopIndexRelative() const;
int GetStopPathType() const;
int GetStride() const;
const std::string &GetTraceVariableX() const;
std::string &GetTraceVariableX();
......@@ -122,6 +128,12 @@ public:
virtual bool CreateNode(DataNode *node, bool completeSave, bool forceAdd);
virtual void SetFromNode(DataNode *node);
// Enum conversion functions
static std::string PathTypeEnum_ToString(PathTypeEnum);
static bool PathTypeEnum_FromString(const std::string &, PathTypeEnum &);
protected:
static std::string PathTypeEnum_ToString(int);
public:
// Keyframing methods
virtual std::string GetFieldName(int index) const;
......@@ -133,9 +145,9 @@ public:
// IDs that can be used to identify fields in case statements
enum {
ID_startIndex = 0,
ID_startIndexRelative,
ID_startPathType,
ID_stopIndex,
ID_stopIndexRelative,
ID_stopPathType,
ID_stride,
ID_traceVariableX,
ID_traceVariableY,
......@@ -147,9 +159,9 @@ public:
private:
int startIndex;
bool startIndexRelative;
int startPathType;
int stopIndex;
bool stopIndexRelative;
int stopPathType;
int stride;
std::string traceVariableX;
std::string traceVariableY;
......@@ -161,6 +173,6 @@ private:
static const char *TypeMapFormatString;
static const private_tmfs_t TmfsStruct;
};
#define PERSISTENTPARTICLESATTRIBUTES_TMFS "ibibisssbs"
#define PERSISTENTPARTICLESATTRIBUTES_TMFS "iiiiisssbs"
#endif
......@@ -61,14 +61,19 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
{
private static int numAdditionalAttributes = 10;
// Enum values
public final static int PATHTYPEENUM_ABSOLUTE = 0;
public final static int PATHTYPEENUM_RELATIVE = 1;
public PersistentParticlesAttributes()
{
super(numAdditionalAttributes);
startIndex = 0;
startIndexRelative = false;
startPathType = 0;
stopIndex = 1;
stopIndexRelative = false;
stopPathType = 0;
stride = 1;
traceVariableX = new String("");
traceVariableY = new String("");
......@@ -82,9 +87,9 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
super(numAdditionalAttributes + nMoreFields);
startIndex = 0;
startIndexRelative = false;
startPathType = 0;
stopIndex = 1;
stopIndexRelative = false;
stopPathType = 0;
stride = 1;
traceVariableX = new String("");
traceVariableY = new String("");
......@@ -98,9 +103,9 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
super(numAdditionalAttributes);
startIndex = obj.startIndex;
startIndexRelative = obj.startIndexRelative;
startPathType = obj.startPathType;
stopIndex = obj.stopIndex;
stopIndexRelative = obj.stopIndexRelative;
stopPathType = obj.stopPathType;
stride = obj.stride;
traceVariableX = new String(obj.traceVariableX);
traceVariableY = new String(obj.traceVariableY);
......@@ -125,9 +130,9 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
{
// Create the return value
return ((startIndex == obj.startIndex) &&
(startIndexRelative == obj.startIndexRelative) &&
(startPathType == obj.startPathType) &&
(stopIndex == obj.stopIndex) &&
(stopIndexRelative == obj.stopIndexRelative) &&
(stopPathType == obj.stopPathType) &&
(stride == obj.stride) &&
(traceVariableX.equals(obj.traceVariableX)) &&
(traceVariableY.equals(obj.traceVariableY)) &&
......@@ -146,9 +151,9 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
Select(0);
}
public void SetStartIndexRelative(boolean startIndexRelative_)
public void SetStartPathType(int startPathType_)
{
startIndexRelative = startIndexRelative_;
startPathType = startPathType_;
Select(1);
}
......@@ -158,9 +163,9 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
Select(2);
}
public void SetStopIndexRelative(boolean stopIndexRelative_)
public void SetStopPathType(int stopPathType_)
{
stopIndexRelative = stopIndexRelative_;
stopPathType = stopPathType_;
Select(3);
}
......@@ -202,9 +207,9 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
// Property getting methods
public int GetStartIndex() { return startIndex; }
public boolean GetStartIndexRelative() { return startIndexRelative; }
public int GetStartPathType() { return startPathType; }
public int GetStopIndex() { return stopIndex; }
public boolean GetStopIndexRelative() { return stopIndexRelative; }
public int GetStopPathType() { return stopPathType; }
public int GetStride() { return stride; }
public String GetTraceVariableX() { return traceVariableX; }
public String GetTraceVariableY() { return traceVariableY; }
......@@ -218,11 +223,11 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
if(WriteSelect(0, buf))
buf.WriteInt(startIndex);
if(WriteSelect(1, buf))
buf.WriteBool(startIndexRelative);
buf.WriteInt(startPathType);
if(WriteSelect(2, buf))
buf.WriteInt(stopIndex);
if(WriteSelect(3, buf))
buf.WriteBool(stopIndexRelative);
buf.WriteInt(stopPathType);
if(WriteSelect(4, buf))
buf.WriteInt(stride);
if(WriteSelect(5, buf))
......@@ -245,13 +250,13 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
SetStartIndex(buf.ReadInt());
break;
case 1:
SetStartIndexRelative(buf.ReadBool());
SetStartPathType(buf.ReadInt());
break;
case 2:
SetStopIndex(buf.ReadInt());
break;
case 3:
SetStopIndexRelative(buf.ReadBool());
SetStopPathType(buf.ReadInt());
break;
case 4:
SetStride(buf.ReadInt());
......@@ -278,9 +283,9 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
{
String str = new String();
str = str + intToString("startIndex", startIndex, indent) + "\n";
str = str + boolToString("startIndexRelative", startIndexRelative, indent) + "\n";
str = str + intToString("startPathType", startPathType, indent) + "\n";
str = str + intToString("stopIndex", stopIndex, indent) + "\n";
str = str + boolToString("stopIndexRelative", stopIndexRelative, indent) + "\n";
str = str + intToString("stopPathType", stopPathType, indent) + "\n";
str = str + intToString("stride", stride, indent) + "\n";
str = str + stringToString("traceVariableX", traceVariableX, indent) + "\n";
str = str + stringToString("traceVariableY", traceVariableY, indent) + "\n";
......@@ -293,9 +298,9 @@ public class PersistentParticlesAttributes extends AttributeSubject implements P
// Attributes
private int startIndex;
private boolean startIndexRelative;
private int startPathType;
private int stopIndex;
private boolean stopIndexRelative;
private int stopPathType;
private int stride;
private String traceVariableX;
private String traceVariableY;
......
......@@ -78,17 +78,11 @@ PyPersistentParticlesAttributes_ToString(const PersistentParticlesAttributes *at
SNPRINTF(tmpStr, 1000, "%sstartIndex = %d\n", prefix, atts->GetStartIndex());
str += tmpStr;
if(atts->GetStartIndexRelative())
SNPRINTF(tmpStr, 1000, "%sstartIndexRelative = 1\n", prefix);
else
SNPRINTF(tmpStr, 1000, "%sstartIndexRelative = 0\n", prefix);
SNPRINTF(tmpStr, 1000, "%sstartPathType = %d\n", prefix, atts->GetStartPathType());
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%sstopIndex = %d\n", prefix, atts->GetStopIndex());
str += tmpStr;
if(atts->GetStopIndexRelative())
SNPRINTF(tmpStr, 1000, "%sstopIndexRelative = 1\n", prefix);
else
SNPRINTF(tmpStr, 1000, "%sstopIndexRelative = 0\n", prefix);
SNPRINTF(tmpStr, 1000, "%sstopPathType = %d\n", prefix, atts->GetStopPathType());
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%sstride = %d\n", prefix, atts->GetStride());
str += tmpStr;
......@@ -142,7 +136,7 @@ PersistentParticlesAttributes_GetStartIndex(PyObject *self, PyObject *args)
}
/*static*/ PyObject *
PersistentParticlesAttributes_SetStartIndexRelative(PyObject *self, PyObject *args)
PersistentParticlesAttributes_SetStartPathType(PyObject *self, PyObject *args)
{
PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;
......@@ -150,18 +144,18 @@ PersistentParticlesAttributes_SetStartIndexRelative(PyObject *self, PyObject *ar
if(!PyArg_ParseTuple(args, "i", &ival))
return NULL;
// Set the startIndexRelative in the object.
obj->data->SetStartIndexRelative(ival != 0);
// Set the startPathType in the object.
obj->data->SetStartPathType((int)ival);
Py_INCREF(Py_None);
return Py_None;
}
/*static*/ PyObject *
PersistentParticlesAttributes_GetStartIndexRelative(PyObject *self, PyObject *args)
PersistentParticlesAttributes_GetStartPathType(PyObject *self, PyObject *args)
{
PersistentParticlesAttributesObject *obj = (PersistentParticlesAttributesObject *)self;
PyObject *retval = PyInt_FromLong(obj->data->GetStartIndexRelative()?1L:0L);
PyObject *retval = PyInt_FromLong(long(obj->data->GetStartPathType()));
return retval;
}
......@@ -190,7 +184,7 @@ PersistentParticlesAttributes_GetStopIndex(PyObject *self, PyObject *args)