Commit cbd8c561 authored by Dave Demarle's avatar Dave Demarle
Browse files

ENH: Add 3d widget to probe location over time. Also don't use custom panel...

ENH: Add 3d widget to probe location over time. Also don't use custom panel until we are ready to probe multiple locations. Also start to put thresholds selection in, and make frustum selection use a sourceselection for consistancy.
parent 1f03e3b4
......@@ -27,7 +27,7 @@
#include "vtkstd/vector"
#include "vtkstd/set"
vtkCxxRevisionMacro(vtkSelectionSource, "1.8");
vtkCxxRevisionMacro(vtkSelectionSource, "1.9");
vtkStandardNewMacro(vtkSelectionSource);
class vtkSelectionSourceInternals
......@@ -112,7 +112,7 @@ void vtkSelectionSource::AddLocation(double x, double y, double z)
{
if (this->ContentType != vtkSelection::LOCATIONS)
{
return;
this->SetContentType(vtkSelection::LOCATIONS);
}
vtkDoubleArray *da = vtkDoubleArray::SafeDownCast(this->Internal->Values);
......@@ -123,6 +123,40 @@ void vtkSelectionSource::AddLocation(double x, double y, double z)
}
}
//----------------------------------------------------------------------------
void vtkSelectionSource::AddThreshold(double min, double max)
{
if (this->ContentType != vtkSelection::THRESHOLDS)
{
this->SetContentType(vtkSelection::THRESHOLDS);
}
vtkDoubleArray *da = vtkDoubleArray::SafeDownCast(this->Internal->Values);
if (da)
{
da->InsertNextValue(min);
da->InsertNextValue(max);
this->Modified();
}
}
//----------------------------------------------------------------------------
void vtkSelectionSource::SetFrustum(double *vertices)
{
if (this->ContentType != vtkSelection::FRUSTUM)
{
this->SetContentType(vtkSelection::FRUSTUM);
}
vtkDoubleArray *da = vtkDoubleArray::SafeDownCast(this->Internal->Values);
if (da)
{
double *data = da->GetPointer(0);
memcpy(data, vertices, 32*sizeof(double));
this->Modified();
}
}
//----------------------------------------------------------------------------
void vtkSelectionSource::PrintSelf(ostream& os, vtkIndent indent)
{
......@@ -275,6 +309,40 @@ int vtkSelectionSource::RequestData(
output->SetSelectionList(selectionList);
selectionList->Delete();
}
if (
(this->ContentType == vtkSelection::THRESHOLDS)
&&
(this->Internal->Values != 0)
)
{
output->GetProperties()->Set(vtkSelection::CONTENT_TYPE(),
this->ContentType);
output->GetProperties()->Set(vtkSelection::FIELD_TYPE(),
this->FieldType);
// Create the selection list
vtkAbstractArray* selectionList = this->Internal->Values->NewInstance();
selectionList->DeepCopy(this->Internal->Values);
output->SetSelectionList(selectionList);
selectionList->Delete();
}
if (
(this->ContentType == vtkSelection::FRUSTUM)
&&
(this->Internal->Values != 0)
)
{
output->GetProperties()->Set(vtkSelection::CONTENT_TYPE(),
this->ContentType);
output->GetProperties()->Set(vtkSelection::FIELD_TYPE(),
this->FieldType);
// Create the selection list
vtkAbstractArray* selectionList = this->Internal->Values->NewInstance();
selectionList->DeepCopy(this->Internal->Values);
output->SetSelectionList(selectionList);
selectionList->Delete();
}
return 1;
}
......@@ -305,11 +373,19 @@ void vtkSelectionSource::SetContentType(int value)
case vtkSelection::THRESHOLDS:
{
vtkDoubleArray *da = vtkDoubleArray::New();
da->SetNumberOfComponents(2);
da->SetNumberOfComponents(1);
da->SetNumberOfTuples(0);
this->Internal->Values = da;
break;
}
case vtkSelection::FRUSTUM:
{
vtkDoubleArray *da = vtkDoubleArray::New();
da->SetNumberOfComponents(4);
da->SetNumberOfTuples(8);
this->Internal->Values = da;
break;
}
default:
break;
}
......
......@@ -43,12 +43,18 @@ public:
// Add a point in world space to probe at.
void AddLocation(double x, double y, double z);
// Description:
// Add a value range to threshold within.
void AddThreshold(double min, double max);
// Description:
// Set a frustum to choose within.
void SetFrustum(double *vertices);
// Description:
// Removes all IDs.
void RemoveAllIDs();
void RemoveAllValues();
// Description:
// Set the content type for the generated selection.
......
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