Commit 62f1e25d authored by hrchilds's avatar hrchilds
Browse files

Update from April 7, 2005

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@447 18c085ea-50e0-402c-830e-de6fd14e8384
parent a6b0540a
......@@ -2,6 +2,7 @@
#include <DataNode.h>
#include <ColorAttribute.h>
// ****************************************************************************
// Method: ColorAttributeList::ColorAttributeList
//
......@@ -299,6 +300,12 @@ ColorAttributeList::SelectAll()
Select(0, (void *)&colors);
}
void
ColorAttributeList::SelectColors()
{
Select(0, (void *)&colors);
}
// ****************************************************************************
// Method: ColorAttributeList::CreateSubAttributeGroup
//
......
This diff is collapsed.
......@@ -540,6 +540,9 @@ dnl
dnl Jeremy Meredith, Tue Feb 22 18:48:19 PST 2005
dnl Renamed "convert" to "visitconvert".
dnl
dnl Hank Childs, Wed Apr 6 13:13:10 PDT 2005
dnl Added tools/writer.
dnl
dnl --------------------------------------------------------------------------
dnl
......@@ -3007,6 +3010,7 @@ TOOLS_FILES="tools/Makefile
tools/silex/Makefile
tools/surfcomp/Makefile
tools/windowmaker/Makefile
tools/writer/Makefile
tools/xml/Makefile
tools/xmledit/Makefile"
VISIT_VTK_FILES="visit_vtk/Makefile
......
......@@ -11,7 +11,7 @@
// Note: Autogenerated by xml2python. Do not modify by hand!
//
// Programmer: xml2python
// Creation: Fri Nov 12 10:15:06 PDT 2004
// Creation: Wed Apr 6 17:21:56 PST 2005
//
// ****************************************************************************
......@@ -274,8 +274,165 @@ BoundaryAttributes_SetMultiColor(PyObject *self, PyObject *args)
{
BoundaryAttributesObject *obj = (BoundaryAttributesObject *)self;
// NOT IMPLEMENTED!!!
// name=multiColor, type=att
PyObject *pyobj = NULL;
ColorAttributeList &cL = obj->data->GetMultiColor();
int index = 0;
int c[4] = {0,0,0,255};
bool setTheColor = true;
if(!PyArg_ParseTuple(args, "iiiii", &index, &c[0], &c[1], &c[2], &c[3]))
{
if(!PyArg_ParseTuple(args, "iiii", &index, &c[0], &c[1], &c[2]))
{
double dr, dg, db, da;
if(PyArg_ParseTuple(args, "idddd", &index, &dr, &dg, &db, &da))
{
c[0] = int(dr);
c[1] = int(dg);
c[2] = int(db);
c[3] = int(da);
}
else if(PyArg_ParseTuple(args, "iddd", &index, &dr, &dg, &db))
{
c[0] = int(dr);
c[1] = int(dg);
c[2] = int(db);
c[3] = 255;
}
else
{
if(!PyArg_ParseTuple(args, "iO", &index, &pyobj))
{
if(PyArg_ParseTuple(args, "O", &pyobj))
{
setTheColor = false;
if(PyTuple_Check(pyobj))
{
// Make sure that the tuple is the right size.
if(PyTuple_Size(pyobj) < cL.GetNumColorAttributes())
return NULL;
// Make sure that the tuple is the right size.
bool badInput = false;
int i, *C = new int[4 * cL.GetNumColorAttributes()];
for(i = 0; i < PyTuple_Size(pyobj) && !badInput; ++i)
{
PyObject *item = PyTuple_GET_ITEM(pyobj, i);
if(PyTuple_Check(item) &&
PyTuple_Size(item) == 3 || PyTuple_Size(item) == 4)
{
C[i*4] = 0;
C[i*4+1] = 0;
C[i*4+2] = 0;
C[i*4+3] = 255;
for(int j = 0; j < PyTuple_Size(item) && !badInput; ++j)
{
PyObject *colorcomp = PyTuple_GET_ITEM(item, j);
if(PyInt_Check(colorcomp))
C[i*4+j] = int(PyInt_AS_LONG(colorcomp));
else if(PyFloat_Check(colorcomp))
C[i*4+j] = int(PyFloat_AS_DOUBLE(colorcomp));
else
badInput = true;
}
}
else
badInput = true;
}
if(badInput)
{
delete [] C;
return NULL;
}
for(i = 0; i < cL.GetNumColorAttributes(); ++i)
cL[i].SetRgba(C[i*4], C[i*4+1], C[i*4+2], C[i*4+3]);
delete [] C;
}
else if(PyList_Check(pyobj))
{
// Make sure that the list is the right size.
if(PyList_Size(pyobj) < cL.GetNumColorAttributes())
return NULL;
// Make sure that the tuple is the right size.
bool badInput = false;
int i, *C = new int[4 * cL.GetNumColorAttributes()];
for(i = 0; i < PyList_Size(pyobj) && !badInput; ++i)
{
PyObject *item = PyList_GET_ITEM(pyobj, i);
if(PyTuple_Check(item) &&
PyTuple_Size(item) == 3 || PyTuple_Size(item) == 4)
{
C[i*4] = 0;
C[i*4+1] = 0;
C[i*4+2] = 0;
C[i*4+3] = 255;
for(int j = 0; j < PyTuple_Size(item) && !badInput; ++j)
{
PyObject *colorcomp = PyTuple_GET_ITEM(item, j);
if(PyInt_Check(colorcomp))
C[i*4+j] = int(PyInt_AS_LONG(colorcomp));
else if(PyFloat_Check(colorcomp))
C[i*4+j] = int(PyFloat_AS_DOUBLE(colorcomp));
else
badInput = true;
}
}
else
badInput = true;
}
if(badInput)
{
delete [] C;
return NULL;
}
for(i = 0; i < cL.GetNumColorAttributes(); ++i)
cL[i].SetRgba(C[i*4], C[i*4+1], C[i*4+2], C[i*4+3]);
delete [] C;
}
else
return NULL;
}
}
else
{
if(!PyTuple_Check(pyobj))
return NULL;
// Make sure that the tuple is the right size.
if(PyTuple_Size(pyobj) < 3 || PyTuple_Size(pyobj) > 4)
return NULL;
// Make sure that all elements in the tuple are ints.
for(int i = 0; i < PyTuple_Size(pyobj); ++i)
{
PyObject *item = PyTuple_GET_ITEM(pyobj, i);
if(PyInt_Check(item))
c[i] = int(PyInt_AS_LONG(PyTuple_GET_ITEM(pyobj, i)));
else if(PyFloat_Check(item))
c[i] = int(PyFloat_AS_DOUBLE(PyTuple_GET_ITEM(pyobj, i)));
else
return NULL;
}
}
}
}
PyErr_Clear();
}
if(index < 0 || index >= cL.GetNumColorAttributes())
return NULL;
// Set the color in the object.
if(setTheColor)
cL[index] = ColorAttribute(c[0], c[1], c[2], c[3]);
cL.SelectColors();
obj->data->SelectMultiColor();
Py_INCREF(Py_None);
return Py_None;
......@@ -285,9 +442,42 @@ static PyObject *
BoundaryAttributes_GetMultiColor(PyObject *self, PyObject *args)
{
BoundaryAttributesObject *obj = (BoundaryAttributesObject *)self;
// NOT IMPLEMENTED!!!
// name=multiColor, type=att
PyObject *retval = NULL;
ColorAttributeList &cL = obj->data->GetMultiColor();
int index = 0;
if(PyArg_ParseTuple(args, "i", &index))
{
if(index < 0 || index >= cL.GetNumColorAttributes())
return NULL;
// Allocate a tuple the with enough entries to hold the singleColor.
retval = PyTuple_New(4);
const unsigned char *c = cL.GetColorAttribute(index).GetColor();
PyTuple_SET_ITEM(retval, 0, PyInt_FromLong(long(c[0])));
PyTuple_SET_ITEM(retval, 1, PyInt_FromLong(long(c[1])));
PyTuple_SET_ITEM(retval, 2, PyInt_FromLong(long(c[2])));
PyTuple_SET_ITEM(retval, 3, PyInt_FromLong(long(c[3])));
}
else
{
PyErr_Clear();
// Return the whole thing.
retval = PyList_New(cL.GetNumColorAttributes());
for(int i = 0; i < cL.GetNumColorAttributes(); ++i)
{
const unsigned char *c = cL.GetColorAttribute(i).GetColor();
PyObject *t = PyTuple_New(4);
PyTuple_SET_ITEM(t, 0, PyInt_FromLong(long(c[0])));
PyTuple_SET_ITEM(t, 1, PyInt_FromLong(long(c[1])));
PyTuple_SET_ITEM(t, 2, PyInt_FromLong(long(c[2])));
PyTuple_SET_ITEM(t, 3, PyInt_FromLong(long(c[3])));
PyList_SET_ITEM(retval, i, t);
}
}
return retval;
}
......@@ -735,7 +925,7 @@ BoundaryAttributes_print(PyObject *v, FILE *fp, int flags)
else
fprintf(fp, "colorType = ColorByColorTable # %s\n", colorType_names);
fprintf(fp, "colorTableName = %s\n", obj->data->GetColorTableName().c_str());
fprintf(fp, "colorTableName = \"%s\"\n", obj->data->GetColorTableName().c_str());
if(obj->data->GetFilledFlag())
fprintf(fp, "filledFlag = 1\n");
else
......@@ -748,7 +938,18 @@ BoundaryAttributes_print(PyObject *v, FILE *fp, int flags)
fprintf(fp, "lineWidth = %d\n", obj->data->GetLineWidth());
const unsigned char *singleColor = obj->data->GetSingleColor().GetColor();
fprintf(fp, "singleColor = (%d, %d, %d, %d)\n", int(singleColor[0]), int(singleColor[1]), int(singleColor[2]), int(singleColor[3]));
//multiColor
fprintf(fp, "multiColor = [");
{ const ColorAttributeList &cL = obj->data->GetMultiColor();
for(int i = 0; i < cL.GetNumColorAttributes(); ++i)
{
const unsigned char *c = cL[i].GetColor();
fprintf(fp, "(%d, %d, %d, %d)",
int(c[0]), int(c[1]), int(c[2]), int(c[3]));
if(i < cL.GetNumColorAttributes()-1)
fprintf(fp, ", ");
}
}
fprintf(fp, "]\n");
{ const stringVector &boundaryNames = obj->data->GetBoundaryNames();
fprintf(fp, "boundaryNames = (");
for(int i = 0; i < boundaryNames.size(); ++i)
......@@ -819,7 +1020,7 @@ PyBoundaryAttributes_StringRepresentation(const BoundaryAttributes *atts)
str += tmpStr;
}
SNPRINTF(tmpStr, 1000, "colorTableName = %s\n", atts->GetColorTableName().c_str());
SNPRINTF(tmpStr, 1000, "colorTableName = \"%s\"\n", atts->GetColorTableName().c_str());
str += tmpStr;
if(atts->GetFilledFlag())
SNPRINTF(tmpStr, 1000, "filledFlag = 1\n");
......@@ -838,14 +1039,19 @@ PyBoundaryAttributes_StringRepresentation(const BoundaryAttributes *atts)
const unsigned char *singleColor = atts->GetSingleColor().GetColor();
SNPRINTF(tmpStr, 1000, "singleColor = (%d, %d, %d, %d)\n", int(singleColor[0]), int(singleColor[1]), int(singleColor[2]), int(singleColor[3]));
str += tmpStr;
#if 0
{ // new scope
PyObject *s = PyColorAttributeList_StringRepresentation(atts->GetMultiColor());
str += "multiColor = {"
if(obj != 0) str += PyString_AS_STRING(s);
str += "}"
{ const ColorAttributeList &cL = atts->GetMultiColor();
str += "multiColor = [";
for(int i = 0; i < cL.GetNumColorAttributes(); ++i)
{
const unsigned char *c = cL[i].GetColor();
SNPRINTF(tmpStr, 1000, "(%d, %d, %d, %d)",
int(c[0]), int(c[1]), int(c[2]), int(c[3]));
str += tmpStr;
if(i < cL.GetNumColorAttributes()-1)
str += ", ";
}
str += "]\n";
}
#endif
{ const stringVector &boundaryNames = atts->GetBoundaryNames();
SNPRINTF(tmpStr, 1000, "boundaryNames = (");
str += tmpStr;
......@@ -1122,7 +1328,6 @@ PyBoundaryAttributes_SetLogging(bool val)
BoundaryAttributesEnableLogging = val;
}
// ****************************************************************************
// Modifications:
// Kathleen Bonnell, Fri Jul 18 13:49:42 PDT 2003
......@@ -1135,3 +1340,4 @@ PyBoundaryAttributes_SetDefaults(const BoundaryAttributes *atts)
{
defaultAtts = const_cast<BoundaryAttributes*>(atts);
}
......@@ -16,5 +16,7 @@ PyObject *PyBoundaryAttributes_WrapPyObject(const BoundaryAttributes *attr
void PyBoundaryAttributes_SetLogging(bool val);
void PyBoundaryAttributes_SetDefaults(const BoundaryAttributes *atts);
PyObject *PyBoundaryAttributes_StringRepresentation(const BoundaryAttributes *atts);
#endif
......@@ -11,7 +11,7 @@
// Note: Autogenerated by xml2python. Do not modify by hand!
//
// Programmer: xml2python
// Creation: Thu Jan 13 18:06:31 PST 2005
// Creation: Wed Apr 6 17:14:38 PST 2005
//
// ****************************************************************************
......@@ -349,8 +349,165 @@ ContourAttributes_SetMultiColor(PyObject *self, PyObject *args)
{
ContourAttributesObject *obj = (ContourAttributesObject *)self;
// NOT IMPLEMENTED!!!
// name=multiColor, type=att
PyObject *pyobj = NULL;
ColorAttributeList &cL = obj->data->GetMultiColor();
int index = 0;
int c[4] = {0,0,0,255};
bool setTheColor = true;
if(!PyArg_ParseTuple(args, "iiiii", &index, &c[0], &c[1], &c[2], &c[3]))
{
if(!PyArg_ParseTuple(args, "iiii", &index, &c[0], &c[1], &c[2]))
{
double dr, dg, db, da;
if(PyArg_ParseTuple(args, "idddd", &index, &dr, &dg, &db, &da))
{
c[0] = int(dr);
c[1] = int(dg);
c[2] = int(db);
c[3] = int(da);
}
else if(PyArg_ParseTuple(args, "iddd", &index, &dr, &dg, &db))
{
c[0] = int(dr);
c[1] = int(dg);
c[2] = int(db);
c[3] = 255;
}
else
{
if(!PyArg_ParseTuple(args, "iO", &index, &pyobj))
{
if(PyArg_ParseTuple(args, "O", &pyobj))
{
setTheColor = false;
if(PyTuple_Check(pyobj))
{
// Make sure that the tuple is the right size.
if(PyTuple_Size(pyobj) < cL.GetNumColorAttributes())
return NULL;
// Make sure that the tuple is the right size.
bool badInput = false;
int i, *C = new int[4 * cL.GetNumColorAttributes()];
for(i = 0; i < PyTuple_Size(pyobj) && !badInput; ++i)
{
PyObject *item = PyTuple_GET_ITEM(pyobj, i);
if(PyTuple_Check(item) &&
PyTuple_Size(item) == 3 || PyTuple_Size(item) == 4)
{
C[i*4] = 0;
C[i*4+1] = 0;
C[i*4+2] = 0;
C[i*4+3] = 255;
for(int j = 0; j < PyTuple_Size(item) && !badInput; ++j)
{
PyObject *colorcomp = PyTuple_GET_ITEM(item, j);
if(PyInt_Check(colorcomp))
C[i*4+j] = int(PyInt_AS_LONG(colorcomp));
else if(PyFloat_Check(colorcomp))
C[i*4+j] = int(PyFloat_AS_DOUBLE(colorcomp));
else
badInput = true;
}
}
else
badInput = true;
}
if(badInput)
{
delete [] C;
return NULL;
}
for(i = 0; i < cL.GetNumColorAttributes(); ++i)
cL[i].SetRgba(C[i*4], C[i*4+1], C[i*4+2], C[i*4+3]);
delete [] C;
}
else if(PyList_Check(pyobj))
{
// Make sure that the list is the right size.
if(PyList_Size(pyobj) < cL.GetNumColorAttributes())
return NULL;
// Make sure that the tuple is the right size.
bool badInput = false;
int i, *C = new int[4 * cL.GetNumColorAttributes()];
for(i = 0; i < PyList_Size(pyobj) && !badInput; ++i)
{
PyObject *item = PyList_GET_ITEM(pyobj, i);
if(PyTuple_Check(item) &&
PyTuple_Size(item) == 3 || PyTuple_Size(item) == 4)
{
C[i*4] = 0;
C[i*4+1] = 0;
C[i*4+2] = 0;
C[i*4+3] = 255;
for(int j = 0; j < PyTuple_Size(item) && !badInput; ++j)
{
PyObject *colorcomp = PyTuple_GET_ITEM(item, j);
if(PyInt_Check(colorcomp))
C[i*4+j] = int(PyInt_AS_LONG(colorcomp));
else if(PyFloat_Check(colorcomp))
C[i*4+j] = int(PyFloat_AS_DOUBLE(colorcomp));
else
badInput = true;
}
}
else
badInput = true;
}
if(badInput)
{
delete [] C;
return NULL;
}
for(i = 0; i < cL.GetNumColorAttributes(); ++i)
cL[i].SetRgba(C[i*4], C[i*4+1], C[i*4+2], C[i*4+3]);
delete [] C;
}
else
return NULL;
}
}
else
{
if(!PyTuple_Check(pyobj))
return NULL;
// Make sure that the tuple is the right size.
if(PyTuple_Size(pyobj) < 3 || PyTuple_Size(pyobj) > 4)
return NULL;
// Make sure that all elements in the tuple are ints.
for(int i = 0; i < PyTuple_Size(pyobj); ++i)
{
PyObject *item = PyTuple_GET_ITEM(pyobj, i);
if(PyInt_Check(item))
c[i] = int(PyInt_AS_LONG(PyTuple_GET_ITEM(pyobj, i)));
else if(PyFloat_Check(item))
c[i] = int(PyFloat_AS_DOUBLE(PyTuple_GET_ITEM(pyobj, i)));
else
return NULL;
}
}
}
}
PyErr_Clear();
}
if(index < 0 || index >= cL.GetNumColorAttributes())
return NULL;
// Set the color in the object.
if(setTheColor)
cL[index] = ColorAttribute(c[0], c[1], c[2], c[3]);
cL.SelectColors();
obj->data->SelectMultiColor();
Py_INCREF(Py_None);
return Py_None;
......@@ -360,9 +517,42 @@ static PyObject *
ContourAttributes_GetMultiColor(PyObject *self, PyObject *args)
{
ContourAttributesObject *obj = (ContourAttributesObject *)self;
// NOT IMPLEMENTED!!!
// name=multiColor, type=att
PyObject *retval = NULL;
ColorAttributeList &cL = obj->data->GetMultiColor();
int index = 0;
if(PyArg_ParseTuple(args, "i", &index))
{
if(index < 0 || index >= cL.GetNumColorAttributes())
return NULL;
// Allocate a tuple the with enough entries to hold the singleColor.
retval = PyTuple_New(4);
const unsigned char *c = cL.GetColorAttribute(index).GetColor();
PyTuple_SET_ITEM(retval, 0, PyInt_FromLong(long(c[0])));
PyTuple_SET_ITEM(retval, 1, PyInt_FromLong(long(c[1])));
PyTuple_SET_ITEM(retval, 2, PyInt_FromLong(long(c[2])));
PyTuple_SET_ITEM(retval, 3, PyInt_FromLong(long(c[3])));
}
else
{
PyErr_Clear();
// Return the whole thing.
retval = PyList_New(cL.GetNumColorAttributes());
for(int i = 0; i < cL.GetNumColorAttributes(); ++i)
{
const unsigned char *c = cL.GetColorAttribute(i).GetColor();
PyObject *t = PyTuple_New(4);
PyTuple_SET_ITEM(t, 0, PyInt_FromLong(long(c[0])));
PyTuple_SET_ITEM(t, 1, PyInt_FromLong(long(c[1])));
PyTuple_SET_ITEM(t, 2, PyInt_FromLong(long(c[2])));
PyTuple_SET_ITEM(t, 3, PyInt_FromLong(long(c[3])));
PyList_SET_ITEM(retval, i, t);
}
}
return retval;
}
......@@ -881,7 +1071,7 @@ ContourAttributes_print(PyObject *v, FILE *fp, int flags)
{
ContourAttributesObject *obj = (ContourAttributesObject *)v;
//defaultPalette
// Code to print defaultPalette not implemented.
{ const unsignedCharVector &changedColors = obj->data->GetChangedColors();
fprintf(fp, "changedColors = (");
for(int i = 0; i < changedColors.size(); ++i)
......@@ -909,7 +1099,18 @@ ContourAttributes_print(PyObject *v, FILE *fp, int flags)
fprintf(fp, "lineWidth = %d\n", obj->data->GetLineWidth());
const unsigned char *singleColor = obj->data->GetSingleColor().GetColor();
fprintf(fp, "singleColor = (%d, %d, %d, %d)\n", int(singleColor[0]), int(singleColor[1]), int(singleColor[2]), int(singleColor[3]));
//multiColor
fprintf(fp, "multiColor = [");
{ const ColorAttributeList &cL = obj->data->GetMultiColor();
for(int i = 0; i < cL.GetNumColorAttributes(); ++i)
{
const unsigned char *c = cL[i].GetColor();
fprintf(fp, "(%d, %d, %d, %d)",
int(c[0]), int(c[1]), int(c[2]), int(c[3]));