Commit c96aa175 authored by whitlocb's avatar whitlocb

I added some new glyph types.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@19954 18c085ea-50e0-402c-830e-de6fd14e8384
parent 46b2e756
......@@ -44,6 +44,7 @@
#include <vtkVisItGlyph3D.h>
#include <vtkPolyData.h>
#include <vtkSphereSource.h>
#include <vtkVisItPolyDataNormals.h>
#include <BadIndexException.h>
......@@ -394,6 +395,9 @@ avtPointGlypher::SetGlyphType(PointGlyphType type)
// Brad Whitlock, Thu Aug 25 10:23:23 PDT 2005
// Added support for sphere glyphs.
//
// Brad Whitlock, Tue Jan 8 13:54:01 PST 2013
// Add some new glyphs.
//
// ****************************************************************************
void
......@@ -592,6 +596,116 @@ avtPointGlypher::SetUpGlyph(void)
glyph2D->InsertNextCell(VTK_TRIANGLE, 3, tri);
}
}
else if (glyphType == Octahedron)
{
vtkPoints *pts = vtkPoints::New();
pts->SetNumberOfPoints(6);
pts->SetPoint(0, 0.5, 0.0, 0.0);
pts->SetPoint(1, 0.0, 0.0, -0.5);
pts->SetPoint(2, -0.5, 0.0, 0.0);
pts->SetPoint(3, 0.0, 0.0, 0.5);
pts->SetPoint(4, 0.0, 0.5, 0.0);
pts->SetPoint(5, 0.0, -0.5, 0.0);
glyph3D = vtkPolyData::New();
glyph3D->SetPoints(pts);
pts->Delete();
glyph3D->Allocate(24);
vtkIdType ids[8][3] = { {0,1,4}, {1,2,4}, {2,3,4}, {3,0,4},
{5,0,3}, {5,1,0}, {5,1,2}, {5,2,3} };
glyph3D->InsertNextCell(VTK_TRIANGLE, 3, ids[0]);
glyph3D->InsertNextCell(VTK_TRIANGLE, 3, ids[1]);
glyph3D->InsertNextCell(VTK_TRIANGLE, 3, ids[2]);
glyph3D->InsertNextCell(VTK_TRIANGLE, 3, ids[3]);
glyph3D->InsertNextCell(VTK_TRIANGLE, 3, ids[4]);
glyph3D->InsertNextCell(VTK_TRIANGLE, 3, ids[5]);
glyph3D->InsertNextCell(VTK_TRIANGLE, 3, ids[6]);
glyph3D->InsertNextCell(VTK_TRIANGLE, 3, ids[7]);
vtkPoints *pts2D = vtkPoints::New();
pts2D->SetNumberOfPoints(4);
pts2D->SetPoint(0, 0.5, 0.0, 0.);
pts2D->SetPoint(1, 0.0, 0.5, 0.);
pts2D->SetPoint(2, -0.5, 0.0, 0.);
pts2D->SetPoint(3, 0.0, -0.5, 0.);
glyph2D = vtkPolyData::New();
glyph2D->SetPoints(pts2D);
pts2D->Delete();
glyph2D->Allocate(4);
vtkIdType ids2D[4] = { 0, 1, 2, 3};
glyph2D->InsertNextCell(VTK_QUAD, 4, ids2D);
}
else if (glyphType == Tetrahedron)
{
vtkPoints *pts = vtkPoints::New();
pts->SetNumberOfPoints(4);
pts->SetPoint(0, 0.5, -0.42983, -0.377355);
pts->SetPoint(1, 0, 0.43479, -0.42667);
pts->SetPoint(2, -0.5, -0.42983, -0.377355);
pts->SetPoint(3, 0, -0.0951297, 0.421379);
glyph3D = vtkPolyData::New();
glyph3D->SetPoints(pts);
pts->Delete();
glyph3D->Allocate(12);
vtkIdType ids[4][3] = { {0,1,3}, {1,2,3}, {2,0,3}, {1,0,2}};
glyph3D->InsertNextCell(VTK_TRIANGLE, 3, ids[0]);
glyph3D->InsertNextCell(VTK_TRIANGLE, 3, ids[1]);
glyph3D->InsertNextCell(VTK_TRIANGLE, 3, ids[2]);
glyph3D->InsertNextCell(VTK_TRIANGLE, 3, ids[3]);
vtkPoints *pts2D = vtkPoints::New();
pts2D->SetNumberOfPoints(3);
pts2D->SetPoint(0, 0.0, 0.5, 0.);
pts2D->SetPoint(1, -0.433, -0.25, 0.);
pts2D->SetPoint(2, 0.433, -0.25, 0.);
glyph2D = vtkPolyData::New();
glyph2D->SetPoints(pts2D);
pts2D->Delete();
glyph2D->Allocate(3);
vtkIdType ids2D[3] = { 0, 1, 2};
glyph2D->InsertNextCell(VTK_TRIANGLE, 3, ids2D);
}
else if (glyphType == SphereGeometry)
{
vtkSphereSource *sphere = vtkSphereSource::New();
sphere->SetRadius(0.5);
sphere->SetCenter(0.,0.,0.);
sphere->SetThetaResolution(16);
sphere->SetPhiResolution(16);
sphere->Update();
glyph3D = sphere->GetOutput();
glyph3D->Register(NULL);
sphere->Delete();
vtkPoints *pts2D = vtkPoints::New();
pts2D->SetNumberOfPoints(13);
pts2D->SetPoint(0, 0., 0., 0.);
for (int i = 0 ; i < 12 ; i++)
{
double rad = ((double) i) / 12. * 2. * M_PI;
pts2D->SetPoint(i+1, cos(rad)/2., sin(rad)/2., 0.);
}
glyph2D = vtkPolyData::New();
glyph2D->SetPoints(pts2D);
pts2D->Delete();
glyph2D->Allocate(48);
for (int i = 0 ; i < 12 ; i++)
{
int pt2 = (i+2 >= 13 ? 1 : i+2);
vtkIdType tri[3] = { 0, i+1, pt2 };
glyph2D->InsertNextCell(VTK_TRIANGLE, 3, tri);
}
}
else if (glyphType == Point || glyphType == Sphere)
{
vtkPoints *pts = vtkPoints::New();
......
......@@ -67,6 +67,9 @@ class vtkVisItPolyDataNormals;
// avtVariableMapper, modified some method names so that they don't collide
// with avtMapper method names.
//
// Brad Whitlock, Mon Jan 7 16:53:56 PST 2013
// Adding new glyph types.
//
// ****************************************************************************
class PLOTTER_API avtPointGlypher
......@@ -76,7 +79,10 @@ class PLOTTER_API avtPointGlypher
Axis,
Icosahedron,
Point,
Sphere
Sphere,
Octahedron,
Tetrahedron,
SphereGeometry
} PointGlyphType;
avtPointGlypher();
......
......@@ -47,8 +47,8 @@
#include <QNarrowLineEdit.h>
#include <QvisVariableButton.h>
#define POINT_TYPE_POINTS 3
#define POINT_TYPE_SPHERE 4
#define POINT_TYPE_POINTS 6
#define POINT_TYPE_SPHERE 7
// ****************************************************************************
// Method: QvisPointControl::QvisPointControl
......@@ -105,6 +105,9 @@ QvisPointControl::QvisPointControl(QWidget *parent,
typeComboBox->addItem(tr("Box"));
typeComboBox->addItem(tr("Axis"));
typeComboBox->addItem(tr("Icosahedron"));
typeComboBox->addItem(tr("Octahedron"));
typeComboBox->addItem(tr("Tetrahedron"));
typeComboBox->addItem(tr("Sphere Geometry"));
typeComboBox->addItem(tr("Point"));
typeComboBox->addItem(tr("Sphere"));
connect(typeComboBox, SIGNAL(activated(int)),
......@@ -604,11 +607,14 @@ void QvisPointControl::SetPointSizeVar(QString &var)
// Hank Childs, Tue Dec 23 17:34:19 PST 2008
// Change limit from >3 to >4, since 4 now corresponds to Sphere.
//
// Brad Whitlock, Mon Jan 7 17:02:49 PST 2013
// Changed 4 to 7 since I added 3 new point types.
//
// ****************************************************************************
void QvisPointControl::SetPointType(int type)
{
if (type < 0 || type > 4)
if (type < 0 || type > 7)
return;
typeComboBox->blockSignals(true);
......
......@@ -16,6 +16,9 @@
Box
Axis
Icosahedron
Octahedron
Tetrahedron
SphereGeometry
Point
Sphere
</Enum>
......
......@@ -121,20 +121,21 @@ BoundaryAttributes::ColoringMethod_FromString(const std::string &s, BoundaryAttr
static const char *PointType_strings[] = {
"Box", "Axis", "Icosahedron",
"Octahedron", "Tetrahedron", "SphereGeometry",
"Point", "Sphere"};
std::string
BoundaryAttributes::PointType_ToString(BoundaryAttributes::PointType t)
{
int index = int(t);
if(index < 0 || index >= 5) index = 0;
if(index < 0 || index >= 8) index = 0;
return PointType_strings[index];
}
std::string
BoundaryAttributes::PointType_ToString(int t)
{
int index = (t < 0 || t >= 5) ? 0 : t;
int index = (t < 0 || t >= 8) ? 0 : t;
return PointType_strings[index];
}
......@@ -142,7 +143,7 @@ bool
BoundaryAttributes::PointType_FromString(const std::string &s, BoundaryAttributes::PointType &val)
{
val = BoundaryAttributes::Box;
for(int i = 0; i < 5; ++i)
for(int i = 0; i < 8; ++i)
{
if(s == PointType_strings[i])
{
......@@ -820,7 +821,7 @@ BoundaryAttributes::SetFromNode(DataNode *parentNode)
if(node->GetNodeType() == INT_NODE)
{
int ival = node->AsInt();
if(ival >= 0 && ival < 5)
if(ival >= 0 && ival < 8)
SetPointType(PointType(ival));
}
else if(node->GetNodeType() == STRING_NODE)
......
......@@ -80,6 +80,9 @@ public:
Box,
Axis,
Icosahedron,
Octahedron,
Tetrahedron,
SphereGeometry,
Point,
Sphere
};
......
......@@ -77,8 +77,11 @@ public class BoundaryAttributes extends AttributeSubject implements Plugin
public final static int POINTTYPE_BOX = 0;
public final static int POINTTYPE_AXIS = 1;
public final static int POINTTYPE_ICOSAHEDRON = 2;
public final static int POINTTYPE_POINT = 3;
public final static int POINTTYPE_SPHERE = 4;
public final static int POINTTYPE_OCTAHEDRON = 3;
public final static int POINTTYPE_TETRAHEDRON = 4;
public final static int POINTTYPE_SPHEREGEOMETRY = 5;
public final static int POINTTYPE_POINT = 6;
public final static int POINTTYPE_SPHERE = 7;
public BoundaryAttributes()
......@@ -497,6 +500,12 @@ public class BoundaryAttributes extends AttributeSubject implements Plugin
str = str + "POINTTYPE_AXIS";
if(pointType == POINTTYPE_ICOSAHEDRON)
str = str + "POINTTYPE_ICOSAHEDRON";
if(pointType == POINTTYPE_OCTAHEDRON)
str = str + "POINTTYPE_OCTAHEDRON";
if(pointType == POINTTYPE_TETRAHEDRON)
str = str + "POINTTYPE_TETRAHEDRON";
if(pointType == POINTTYPE_SPHEREGEOMETRY)
str = str + "POINTTYPE_SPHEREGEOMETRY";
if(pointType == POINTTYPE_POINT)
str = str + "POINTTYPE_POINT";
if(pointType == POINTTYPE_SPHERE)
......
......@@ -182,7 +182,8 @@ PyBoundaryAttributes_ToString(const BoundaryAttributes *atts, const char *prefix
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%spointSize = %g\n", prefix, atts->GetPointSize());
str += tmpStr;
const char *pointType_names = "Box, Axis, Icosahedron, Point, Sphere";
const char *pointType_names = "Box, Axis, Icosahedron, Octahedron, Tetrahedron, "
"SphereGeometry, Point, Sphere";
switch (atts->GetPointType())
{
case BoundaryAttributes::Box:
......@@ -197,6 +198,18 @@ PyBoundaryAttributes_ToString(const BoundaryAttributes *atts, const char *prefix
SNPRINTF(tmpStr, 1000, "%spointType = %sIcosahedron # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
break;
case BoundaryAttributes::Octahedron:
SNPRINTF(tmpStr, 1000, "%spointType = %sOctahedron # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
break;
case BoundaryAttributes::Tetrahedron:
SNPRINTF(tmpStr, 1000, "%spointType = %sTetrahedron # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
break;
case BoundaryAttributes::SphereGeometry:
SNPRINTF(tmpStr, 1000, "%spointType = %sSphereGeometry # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
break;
case BoundaryAttributes::Point:
SNPRINTF(tmpStr, 1000, "%spointType = %sPoint # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
......@@ -893,15 +906,15 @@ BoundaryAttributes_SetPointType(PyObject *self, PyObject *args)
return NULL;
// Set the pointType in the object.
if(ival >= 0 && ival < 5)
if(ival >= 0 && ival < 8)
obj->data->SetPointType(BoundaryAttributes::PointType(ival));
else
{
fprintf(stderr, "An invalid pointType value was given. "
"Valid values are in the range of [0,4]. "
"Valid values are in the range of [0,7]. "
"You can also use the following names: "
"Box, Axis, Icosahedron, Point, Sphere"
".");
"Box, Axis, Icosahedron, Octahedron, Tetrahedron, "
"SphereGeometry, Point, Sphere.");
return NULL;
}
......@@ -1122,6 +1135,12 @@ PyBoundaryAttributes_getattr(PyObject *self, char *name)
return PyInt_FromLong(long(BoundaryAttributes::Axis));
if(strcmp(name, "Icosahedron") == 0)
return PyInt_FromLong(long(BoundaryAttributes::Icosahedron));
if(strcmp(name, "Octahedron") == 0)
return PyInt_FromLong(long(BoundaryAttributes::Octahedron));
if(strcmp(name, "Tetrahedron") == 0)
return PyInt_FromLong(long(BoundaryAttributes::Tetrahedron));
if(strcmp(name, "SphereGeometry") == 0)
return PyInt_FromLong(long(BoundaryAttributes::SphereGeometry));
if(strcmp(name, "Point") == 0)
return PyInt_FromLong(long(BoundaryAttributes::Point));
if(strcmp(name, "Sphere") == 0)
......
......@@ -211,6 +211,9 @@ avtBoundaryPlot::Create()
// I made the pointSize in the atts be used for to set the point size for
// points, which is not the same as what's used for Box, Axis, Icosahedra.
//
// Brad Whitlock, Tue Jan 8 11:44:18 PST 2013
// I added some new glyph types.
//
// ****************************************************************************
void
......@@ -258,6 +261,12 @@ avtBoundaryPlot::SetAtts(const AttributeGroup *a)
levelsMapper->SetGlyphType(avtPointGlypher::Axis);
else if (atts.GetPointType() == BoundaryAttributes::Icosahedron)
levelsMapper->SetGlyphType(avtPointGlypher::Icosahedron);
else if (atts.GetPointType() == BoundaryAttributes::Octahedron)
levelsMapper->SetGlyphType(avtPointGlypher::Octahedron);
else if (atts.GetPointType() == BoundaryAttributes::Tetrahedron)
levelsMapper->SetGlyphType(avtPointGlypher::Tetrahedron);
else if (atts.GetPointType() == BoundaryAttributes::SphereGeometry)
levelsMapper->SetGlyphType(avtPointGlypher::SphereGeometry);
else if (atts.GetPointType() == BoundaryAttributes::Point)
levelsMapper->SetGlyphType(avtPointGlypher::Point);
else if (atts.GetPointType() == BoundaryAttributes::Sphere)
......
......@@ -16,6 +16,9 @@
Box
Axis
Icosahedron
Octahedron
Tetrahedron
SphereGeometry
Point
Sphere
</Enum>
......
......@@ -121,20 +121,21 @@ FilledBoundaryAttributes::ColoringMethod_FromString(const std::string &s, Filled
static const char *PointType_strings[] = {
"Box", "Axis", "Icosahedron",
"Octahedron", "Tetrahedron", "SphereGeometry",
"Point", "Sphere"};
std::string
FilledBoundaryAttributes::PointType_ToString(FilledBoundaryAttributes::PointType t)
{
int index = int(t);
if(index < 0 || index >= 5) index = 0;
if(index < 0 || index >= 8) index = 0;
return PointType_strings[index];
}
std::string
FilledBoundaryAttributes::PointType_ToString(int t)
{
int index = (t < 0 || t >= 5) ? 0 : t;
int index = (t < 0 || t >= 8) ? 0 : t;
return PointType_strings[index];
}
......@@ -142,7 +143,7 @@ bool
FilledBoundaryAttributes::PointType_FromString(const std::string &s, FilledBoundaryAttributes::PointType &val)
{
val = FilledBoundaryAttributes::Box;
for(int i = 0; i < 5; ++i)
for(int i = 0; i < 8; ++i)
{
if(s == PointType_strings[i])
{
......@@ -857,7 +858,7 @@ FilledBoundaryAttributes::SetFromNode(DataNode *parentNode)
if(node->GetNodeType() == INT_NODE)
{
int ival = node->AsInt();
if(ival >= 0 && ival < 5)
if(ival >= 0 && ival < 8)
SetPointType(PointType(ival));
}
else if(node->GetNodeType() == STRING_NODE)
......
......@@ -80,6 +80,9 @@ public:
Box,
Axis,
Icosahedron,
Octahedron,
Tetrahedron,
SphereGeometry,
Point,
Sphere
};
......
......@@ -77,8 +77,11 @@ public class FilledBoundaryAttributes extends AttributeSubject implements Plugin
public final static int POINTTYPE_BOX = 0;
public final static int POINTTYPE_AXIS = 1;
public final static int POINTTYPE_ICOSAHEDRON = 2;
public final static int POINTTYPE_POINT = 3;
public final static int POINTTYPE_SPHERE = 4;
public final static int POINTTYPE_OCTAHEDRON = 3;
public final static int POINTTYPE_TETRAHEDRON = 4;
public final static int POINTTYPE_SPHEREGEOMETRY = 5;
public final static int POINTTYPE_POINT = 6;
public final static int POINTTYPE_SPHERE = 7;
public FilledBoundaryAttributes()
......@@ -549,6 +552,12 @@ public class FilledBoundaryAttributes extends AttributeSubject implements Plugin
str = str + "POINTTYPE_AXIS";
if(pointType == POINTTYPE_ICOSAHEDRON)
str = str + "POINTTYPE_ICOSAHEDRON";
if(pointType == POINTTYPE_OCTAHEDRON)
str = str + "POINTTYPE_OCTAHEDRON";
if(pointType == POINTTYPE_TETRAHEDRON)
str = str + "POINTTYPE_TETRAHEDRON";
if(pointType == POINTTYPE_SPHEREGEOMETRY)
str = str + "POINTTYPE_SPHEREGEOMETRY";
if(pointType == POINTTYPE_POINT)
str = str + "POINTTYPE_POINT";
if(pointType == POINTTYPE_SPHERE)
......
......@@ -196,7 +196,8 @@ PyFilledBoundaryAttributes_ToString(const FilledBoundaryAttributes *atts, const
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%spointSize = %g\n", prefix, atts->GetPointSize());
str += tmpStr;
const char *pointType_names = "Box, Axis, Icosahedron, Point, Sphere";
const char *pointType_names = "Box, Axis, Icosahedron, Octahedron, Tetrahedron, "
"SphereGeometry, Point, Sphere";
switch (atts->GetPointType())
{
case FilledBoundaryAttributes::Box:
......@@ -211,6 +212,18 @@ PyFilledBoundaryAttributes_ToString(const FilledBoundaryAttributes *atts, const
SNPRINTF(tmpStr, 1000, "%spointType = %sIcosahedron # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
break;
case FilledBoundaryAttributes::Octahedron:
SNPRINTF(tmpStr, 1000, "%spointType = %sOctahedron # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
break;
case FilledBoundaryAttributes::Tetrahedron:
SNPRINTF(tmpStr, 1000, "%spointType = %sTetrahedron # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
break;
case FilledBoundaryAttributes::SphereGeometry:
SNPRINTF(tmpStr, 1000, "%spointType = %sSphereGeometry # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
break;
case FilledBoundaryAttributes::Point:
SNPRINTF(tmpStr, 1000, "%spointType = %sPoint # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
......@@ -1032,15 +1045,15 @@ FilledBoundaryAttributes_SetPointType(PyObject *self, PyObject *args)
return NULL;
// Set the pointType in the object.
if(ival >= 0 && ival < 5)
if(ival >= 0 && ival < 8)
obj->data->SetPointType(FilledBoundaryAttributes::PointType(ival));
else
{
fprintf(stderr, "An invalid pointType value was given. "
"Valid values are in the range of [0,4]. "
"Valid values are in the range of [0,7]. "
"You can also use the following names: "
"Box, Axis, Icosahedron, Point, Sphere"
".");
"Box, Axis, Icosahedron, Octahedron, Tetrahedron, "
"SphereGeometry, Point, Sphere.");
return NULL;
}
......@@ -1273,6 +1286,12 @@ PyFilledBoundaryAttributes_getattr(PyObject *self, char *name)
return PyInt_FromLong(long(FilledBoundaryAttributes::Axis));
if(strcmp(name, "Icosahedron") == 0)
return PyInt_FromLong(long(FilledBoundaryAttributes::Icosahedron));
if(strcmp(name, "Octahedron") == 0)
return PyInt_FromLong(long(FilledBoundaryAttributes::Octahedron));
if(strcmp(name, "Tetrahedron") == 0)
return PyInt_FromLong(long(FilledBoundaryAttributes::Tetrahedron));
if(strcmp(name, "SphereGeometry") == 0)
return PyInt_FromLong(long(FilledBoundaryAttributes::SphereGeometry));
if(strcmp(name, "Point") == 0)
return PyInt_FromLong(long(FilledBoundaryAttributes::Point));
if(strcmp(name, "Sphere") == 0)
......
......@@ -227,6 +227,9 @@ avtFilledBoundaryPlot::Create()
// I made the pointSize in the atts be used for to set the point size for
// points, which is not the same as what's used for Box, Axis, Icosahedra.
//
// Brad Whitlock, Tue Jan 8 11:44:18 PST 2013
// I added some new glyph types.
//
// ****************************************************************************
void
......@@ -271,6 +274,12 @@ avtFilledBoundaryPlot::SetAtts(const AttributeGroup *a)
levelsMapper->SetGlyphType(avtPointGlypher::Axis);
else if (atts.GetPointType() == FilledBoundaryAttributes::Icosahedron)
levelsMapper->SetGlyphType(avtPointGlypher::Icosahedron);
else if (atts.GetPointType() == FilledBoundaryAttributes::Octahedron)
levelsMapper->SetGlyphType(avtPointGlypher::Octahedron);
else if (atts.GetPointType() == FilledBoundaryAttributes::Tetrahedron)
levelsMapper->SetGlyphType(avtPointGlypher::Tetrahedron);
else if (atts.GetPointType() == FilledBoundaryAttributes::SphereGeometry)
levelsMapper->SetGlyphType(avtPointGlypher::SphereGeometry);
else if (atts.GetPointType() == FilledBoundaryAttributes::Point)
levelsMapper->SetGlyphType(avtPointGlypher::Point);
else if (atts.GetPointType() == FilledBoundaryAttributes::Sphere)
......
......@@ -5,6 +5,9 @@
Box
Axis
Icosahedron
Octahedron
Tetrahedron
SphereGeometry
Point
Sphere
</Enum>
......
......@@ -45,20 +45,21 @@
static const char *PointType_strings[] = {
"Box", "Axis", "Icosahedron",
"Octahedron", "Tetrahedron", "SphereGeometry",
"Point", "Sphere"};
std::string
MeshAttributes::PointType_ToString(MeshAttributes::PointType t)
{
int index = int(t);
if(index < 0 || index >= 5) index = 0;
if(index < 0 || index >= 8) index = 0;
return PointType_strings[index];
}
std::string
MeshAttributes::PointType_ToString(int t)
{
int index = (t < 0 || t >= 5) ? 0 : t;
int index = (t < 0 || t >= 8) ? 0 : t;
return PointType_strings[index];
}
......@@ -66,7 +67,7 @@ bool
MeshAttributes::PointType_FromString(const std::string &s, MeshAttributes::PointType &val)
{
val = MeshAttributes::Box;
for(int i = 0; i < 5; ++i)
for(int i = 0; i < 8; ++i)
{
if(s == PointType_strings[i])
{
......@@ -918,7 +919,7 @@ MeshAttributes::SetFromNode(DataNode *parentNode)
if(node->GetNodeType() == INT_NODE)
{
int ival = node->AsInt();
if(ival >= 0 && ival < 5)
if(ival >= 0 && ival < 8)
SetPointType(PointType(ival));
}
else if(node->GetNodeType() == STRING_NODE)
......
......@@ -66,6 +66,9 @@ public:
Box,
Axis,
Icosahedron,
Octahedron,
Tetrahedron,
SphereGeometry,
Point,
Sphere
};
......
......@@ -66,8 +66,11 @@ public class MeshAttributes extends AttributeSubject implements Plugin
public final static int POINTTYPE_BOX = 0;
public final static int POINTTYPE_AXIS = 1;
public final static int POINTTYPE_ICOSAHEDRON = 2;
public final static int POINTTYPE_POINT = 3;
public final static int POINTTYPE_SPHERE = 4;
public final static int POINTTYPE_OCTAHEDRON = 3;
public final static int POINTTYPE_TETRAHEDRON = 4;
public final static int POINTTYPE_SPHEREGEOMETRY = 5;
public final static int POINTTYPE_POINT = 6;
public final static int POINTTYPE_SPHERE = 7;
public final static int SMOOTHINGLEVEL_NONE = 0;
public final static int SMOOTHINGLEVEL_FAST = 1;
......@@ -491,6 +494,12 @@ public class MeshAttributes extends AttributeSubject implements Plugin
str = str + "POINTTYPE_AXIS";
if(pointType == POINTTYPE_ICOSAHEDRON)
str = str + "POINTTYPE_ICOSAHEDRON";
if(pointType == POINTTYPE_OCTAHEDRON)
str = str + "POINTTYPE_OCTAHEDRON";
if(pointType == POINTTYPE_TETRAHEDRON)
str = str + "POINTTYPE_TETRAHEDRON";
if(pointType == POINTTYPE_SPHEREGEOMETRY)
str = str + "POINTTYPE_SPHEREGEOMETRY";
if(pointType == POINTTYPE_POINT)
str = str + "POINTTYPE_POINT";
if(pointType == POINTTYPE_SPHERE)
......
......@@ -178,7 +178,8 @@ PyMeshAttributes_ToString(const MeshAttributes *atts, const char *prefix)
str += tmpStr;
SNPRINTF(tmpStr, 1000, "%spointSizeVar = \"%s\"\n", prefix, atts->GetPointSizeVar().c_str());
str += tmpStr;
const char *pointType_names = "Box, Axis, Icosahedron, Point, Sphere";
const char *pointType_names = "Box, Axis, Icosahedron, Octahedron, Tetrahedron, "
"SphereGeometry, Point, Sphere";
switch (atts->GetPointType())
{
case MeshAttributes::Box:
......@@ -193,6 +194,18 @@ PyMeshAttributes_ToString(const MeshAttributes *atts, const char *prefix)
SNPRINTF(tmpStr, 1000, "%spointType = %sIcosahedron # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
break;
case MeshAttributes::Octahedron:
SNPRINTF(tmpStr, 1000, "%spointType = %sOctahedron # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
break;
case MeshAttributes::Tetrahedron:
SNPRINTF(tmpStr, 1000, "%spointType = %sTetrahedron # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
break;
case MeshAttributes::SphereGeometry:
SNPRINTF(tmpStr, 1000, "%spointType = %sSphereGeometry # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
break;
case MeshAttributes::Point:
SNPRINTF(tmpStr, 1000, "%spointType = %sPoint # %s\n", prefix, prefix, pointType_names);
str += tmpStr;
......@@ -723,15 +736,15 @@ MeshAttributes_SetPointType(PyObject *self, PyObject *args)
return NULL;
// Set the pointType in the object.
if(ival >= 0 && ival < 5)
if(ival >= 0 && ival < 8)
obj->data->SetPointType(MeshAttributes::PointType(ival));
else
{
fprintf(stderr, "An invalid pointType value was given. "
"Valid values are in the range of [0,4]. "
"Valid values are in the range of [0,7]. "
"You can also use the following names: "
"Box, Axis, Icosahedron, Point, Sphere"
".");
"Box, Axis, Icosahedron, Octahedron, Tetrahedron, "
"SphereGeometry, Point, Sphere.");
return NULL;
}
......@@ -956,6 +969,12 @@ PyMeshAttributes_getattr(PyObject *self, char *name)
return PyInt_FromLong(long(MeshAttributes::Axis));
if(strcmp(name, "Icosahedron") == 0)
return PyInt_FromLong(long(MeshAttributes::Icosahedron));
if(strcmp(name, "Octahedron") == 0)
return PyInt_FromLong(long(MeshAttributes::Octahedron));
if(strcmp(name, "Tetrahedron") == 0)
return PyInt_FromLong(long(MeshAttributes::Tetrahedron));
if(strcmp(name, "SphereGeometry") == 0)
return PyInt_FromLong(long(MeshAttributes::SphereGeometry));
if(strcmp(name, "Point") == 0)