Commit a4ee902a authored by allens's avatar allens

added the ability to obtain seeds from field data

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@26143 18c085ea-50e0-402c-830e-de6fd14e8384
parent ee1274a5
......@@ -367,7 +367,7 @@ IntegralCurveAttributes::ChangesRequireRecalculation(const IntegralCurveAttribut
}
}
if (sourceType == PointList)
if (sourceType == PointList || sourceType == FieldData)
{
if (pointList.size() != obj.pointList.size())
return true;
......@@ -434,6 +434,14 @@ IntegralCurveViewerEnginePluginInfo::GetOperatorVarDescription(AttributeSubject
var = justTheVar;
}
else if( strncmp(var.c_str(), "operators/LCS/",
strlen("operators/LCS/")) == 0)
{
std::string justTheVar = var.substr(strlen("operators/LCS/"));
var = justTheVar;
}
var += std::string(" - ") +
std::string(typeString[atts_in->GetDataValue()]);
......
......@@ -21,6 +21,7 @@
Sphere
Box
Selection
FieldData
</Enum>
<Enum name="DataValue">
Solid
......
......@@ -53,20 +53,21 @@
static const char *SourceType_strings[] = {
"Point", "PointList", "Line_",
"Circle", "Plane", "Sphere",
"Box", "Selection"};
"Box", "Selection", "FieldData"
};
std::string
IntegralCurveAttributes::SourceType_ToString(IntegralCurveAttributes::SourceType t)
{
int index = int(t);
if(index < 0 || index >= 8) index = 0;
if(index < 0 || index >= 9) index = 0;
return SourceType_strings[index];
}
std::string
IntegralCurveAttributes::SourceType_ToString(int t)
{
int index = (t < 0 || t >= 8) ? 0 : t;
int index = (t < 0 || t >= 9) ? 0 : t;
return SourceType_strings[index];
}
......@@ -74,7 +75,7 @@ bool
IntegralCurveAttributes::SourceType_FromString(const std::string &s, IntegralCurveAttributes::SourceType &val)
{
val = IntegralCurveAttributes::Point;
for(int i = 0; i < 8; ++i)
for(int i = 0; i < 9; ++i)
{
if(s == SourceType_strings[i])
{
......@@ -1714,7 +1715,7 @@ IntegralCurveAttributes::SetFromNode(DataNode *parentNode)
if(node->GetNodeType() == INT_NODE)
{
int ival = node->AsInt();
if(ival >= 0 && ival < 8)
if(ival >= 0 && ival < 9)
SetSourceType(SourceType(ival));
}
else if(node->GetNodeType() == STRING_NODE)
......@@ -3898,7 +3899,7 @@ IntegralCurveAttributes::ChangesRequireRecalculation(const IntegralCurveAttribut
}
}
if (sourceType == PointList)
if (sourceType == PointList || sourceType == FieldData)
{
if (pointList.size() != obj.pointList.size())
return true;
......
......@@ -69,7 +69,8 @@ public:
Plane,
Sphere,
Box,
Selection
Selection,
FieldData
};
enum DataValue
{
......
......@@ -72,6 +72,7 @@ public class IntegralCurveAttributes extends AttributeSubject implements Plugin
public final static int SOURCETYPE_SPHERE = 5;
public final static int SOURCETYPE_BOX = 6;
public final static int SOURCETYPE_SELECTION = 7;
public final static int SOURCETYPE_FIELDDATA = 8;
public final static int DATAVALUE_SOLID = 0;
public final static int DATAVALUE_SEEDPOINTID = 1;
......@@ -1514,6 +1515,8 @@ public class IntegralCurveAttributes extends AttributeSubject implements Plugin
str = str + "SOURCETYPE_BOX";
if(sourceType == SOURCETYPE_SELECTION)
str = str + "SOURCETYPE_SELECTION";
if(sourceType == SOURCETYPE_FIELDDATA)
str = str + "SOURCETYPE_FIELDDATA";
str = str + "\n";
str = str + doubleArrayToString("pointSource", pointSource, indent) + "\n";
str = str + doubleArrayToString("lineStart", lineStart, indent) + "\n";
......
......@@ -234,6 +234,14 @@ IntegralCurveViewerEnginePluginInfo::GetOperatorVarDescription(AttributeSubject
var = justTheVar;
}
else if( strncmp(var.c_str(), "operators/LCS/",
strlen("operators/LCS/")) == 0)
{
std::string justTheVar = var.substr(strlen("operators/LCS/"));
var = justTheVar;
}
var += std::string(" - ") +
std::string(typeString[atts_in->GetDataValue()]);
......@@ -263,4 +271,3 @@ IntegralCurveViewerEnginePluginInfo::GetMenuName() const
{
return "IntegralCurve";
}
......@@ -77,7 +77,7 @@ PyIntegralCurveAttributes_ToString(const IntegralCurveAttributes *atts, const ch
char tmpStr[1000];
const char *sourceType_names = "Point, PointList, Line_, Circle, Plane, "
"Sphere, Box, Selection";
"Sphere, Box, Selection, FieldData";
switch (atts->GetSourceType())
{
case IntegralCurveAttributes::Point:
......@@ -112,6 +112,10 @@ PyIntegralCurveAttributes_ToString(const IntegralCurveAttributes *atts, const ch
SNPRINTF(tmpStr, 1000, "%ssourceType = %sSelection # %s\n", prefix, prefix, sourceType_names);
str += tmpStr;
break;
case IntegralCurveAttributes::FieldData:
SNPRINTF(tmpStr, 1000, "%ssourceType = %sFieldData # %s\n", prefix, prefix, sourceType_names);
str += tmpStr;
break;
default:
break;
}
......@@ -689,15 +693,16 @@ IntegralCurveAttributes_SetSourceType(PyObject *self, PyObject *args)
return NULL;
// Set the sourceType in the object.
if(ival >= 0 && ival < 8)
if(ival >= 0 && ival < 9)
obj->data->SetSourceType(IntegralCurveAttributes::SourceType(ival));
else
{
fprintf(stderr, "An invalid sourceType value was given. "
"Valid values are in the range of [0,7]. "
"Valid values are in the range of [0,8]. "
"You can also use the following names: "
"Point, PointList, Line_, Circle, Plane, "
"Sphere, Box, Selection.");
"Sphere, Box, Selection, FieldData"
".");
return NULL;
}
......@@ -2859,6 +2864,8 @@ PyIntegralCurveAttributes_getattr(PyObject *self, char *name)
return PyInt_FromLong(long(IntegralCurveAttributes::Box));
if(strcmp(name, "Selection") == 0)
return PyInt_FromLong(long(IntegralCurveAttributes::Selection));
if(strcmp(name, "FieldData") == 0)
return PyInt_FromLong(long(IntegralCurveAttributes::FieldData));
if(strcmp(name, "pointSource") == 0)
return IntegralCurveAttributes_GetPointSource(self, NULL);
......
......@@ -296,6 +296,7 @@ QvisIntegralCurveWindow::CreateIntegrationTab(QWidget *pageIntegration)
sourceType->addItem(tr("Sphere"));
sourceType->addItem(tr("Box"));
sourceType->addItem(tr("Selection"));
sourceType->addItem(tr("Field Data"));
connect(sourceType, SIGNAL(activated(int)),
this, SLOT(sourceTypeChanged(int)));
sourceLayout->addWidget(sourceType, 0, 1, 1, 2);
......@@ -2589,7 +2590,6 @@ QvisIntegralCurveWindow::GetCurrentValues(int which_widget)
}
}
void
QvisIntegralCurveWindow::sourceTypeChanged(int val)
{
......@@ -2597,6 +2597,29 @@ QvisIntegralCurveWindow::sourceTypeChanged(int val)
{
atts->SetSourceType(IntegralCurveAttributes::SourceType(val));
Apply();
// The field data can contain seed points and wil stuff them
// into the pint list so teh user can see the points so when
// ever switching to the point list do an update.
if(val == IntegralCurveAttributes::PointList )
{
std::vector<double> points = atts->GetPointList();
pointList->clear();
for (size_t i = 0; i < points.size(); i+= 3)
{
fprintf(stderr, "%lf %lf %lf\n",
points[i], points[i+1], points[i+2]);
char tmp[256];
sprintf(tmp, "%lf %lf %lf",
points[i], points[i+1], points[i+2]);
QString str = tmp;
QListWidgetItem *item = new QListWidgetItem(str, pointList);
item->setFlags(item->flags() | Qt::ItemIsEditable);
pointList->setCurrentItem(item);
}
}
}
}
......
......@@ -98,7 +98,7 @@ class avtStateRecorderIntegralCurve;
// ****************************************************************************
class avtIntegralCurveFilter : public virtual avtPluginFilter,
public avtPICSFilter
public virtual avtPICSFilter
{
public:
// default constructor
......@@ -150,6 +150,7 @@ class avtIntegralCurveFilter : public virtual avtPluginFilter,
void SetSelectionSource(std::string selectionName,
int stride,
bool random, int seed, int numPts);
void SetFieldDataSource();
void SetDisplayGeometry(int d);
void SetDataValue(int, const std::string &var="");
......@@ -204,6 +205,9 @@ class avtIntegralCurveFilter : public virtual avtPluginFilter,
void GenerateSeedPointsFromCircle(std::vector<avtVector> &pts);
void GenerateSeedPointsFromPointList(std::vector<avtVector> &pts);
void GenerateSeedPointsFromSelection(std::vector<avtVector> &pts);
void GenerateSeedPointsFromFieldData(std::vector<avtVector> &pts);
void GenerateSeedPointsFromFieldData(avtDataTree_p inDT);
void GenerateSeedPointsFromFieldData(vtkDataSet *in_ds);
unsigned int GenerateAttributeFields() const;
......
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