Commit 75c209cc authored by Dave Demarle's avatar Dave Demarle
Browse files

ENH: Expose the rest of the vtkSelection controls in vtkSelectionSource.

parent 54842ef6
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <vtkstd/map> #include <vtkstd/map>
#include <vtkstd/vector> #include <vtkstd/vector>
vtkCxxRevisionMacro(vtkSelection, "1.13"); vtkCxxRevisionMacro(vtkSelection, "1.14");
vtkStandardNewMacro(vtkSelection); vtkStandardNewMacro(vtkSelection);
vtkCxxSetObjectMacro(vtkSelection, SelectionList, vtkAbstractArray); vtkCxxSetObjectMacro(vtkSelection, SelectionList, vtkAbstractArray);
...@@ -49,6 +49,8 @@ vtkInformationKeyMacro(vtkSelection,PRESERVE_TOPOLOGY,Integer); ...@@ -49,6 +49,8 @@ vtkInformationKeyMacro(vtkSelection,PRESERVE_TOPOLOGY,Integer);
vtkInformationKeyMacro(vtkSelection,CONTAINING_CELLS,Integer); vtkInformationKeyMacro(vtkSelection,CONTAINING_CELLS,Integer);
vtkInformationKeyMacro(vtkSelection,PIXEL_COUNT,Integer); vtkInformationKeyMacro(vtkSelection,PIXEL_COUNT,Integer);
vtkInformationKeyMacro(vtkSelection,INVERSE,Integer); vtkInformationKeyMacro(vtkSelection,INVERSE,Integer);
vtkInformationKeyMacro(vtkSelection,EXACT_TEST,Integer);
vtkInformationKeyMacro(vtkSelection,SHOW_BOUNDS,Integer);
struct vtkSelectionInternals struct vtkSelectionInternals
{ {
...@@ -463,4 +465,3 @@ vtkSelection* vtkSelection::GetData(vtkInformationVector* v, int i) ...@@ -463,4 +465,3 @@ vtkSelection* vtkSelection::GetData(vtkInformationVector* v, int i)
{ {
return vtkSelection::GetData(v->GetInformationObject(i)); return vtkSelection::GetData(v->GetInformationObject(i));
} }
...@@ -265,6 +265,14 @@ public: ...@@ -265,6 +265,14 @@ public:
static vtkSelection* GetData(vtkInformation* info); static vtkSelection* GetData(vtkInformation* info);
static vtkSelection* GetData(vtkInformationVector* v, int i=0); static vtkSelection* GetData(vtkInformationVector* v, int i=0);
// Description:
// For Frustum selection.
static vtkInformationIntegerKey* EXACT_TEST();
// Description:
// For Frustum selection.
static vtkInformationIntegerKey* SHOW_BOUNDS();
protected: protected:
vtkSelection(); vtkSelection();
~vtkSelection(); ~vtkSelection();
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "vtkLine.h" #include "vtkLine.h"
#include "vtkSelection.h" #include "vtkSelection.h"
vtkCxxRevisionMacro(vtkExtractSelectedFrustum, "1.7"); vtkCxxRevisionMacro(vtkExtractSelectedFrustum, "1.8");
vtkStandardNewMacro(vtkExtractSelectedFrustum); vtkStandardNewMacro(vtkExtractSelectedFrustum);
vtkCxxSetObjectMacro(vtkExtractSelectedFrustum,Frustum,vtkPlanes); vtkCxxSetObjectMacro(vtkExtractSelectedFrustum,Frustum,vtkPlanes);
...@@ -257,15 +257,29 @@ int vtkExtractSelectedFrustum::RequestData( ...@@ -257,15 +257,29 @@ int vtkExtractSelectedFrustum::RequestData(
vtkDoubleArray *corners = vtkDoubleArray::SafeDownCast( vtkDoubleArray *corners = vtkDoubleArray::SafeDownCast(
sel->GetSelectionList()); sel->GetSelectionList());
this->CreateFrustum(corners->GetPointer(0)); this->CreateFrustum(corners->GetPointer(0));
if (sel->GetProperties()->Has(vtkSelection::PRESERVE_TOPOLOGY()) && if (sel->GetProperties()->Has(vtkSelection::PRESERVE_TOPOLOGY()))
sel->GetProperties()->Get(vtkSelection::PRESERVE_TOPOLOGY()) != 0)
{ {
this->PassThroughOn(); this->SetPassThrough(
sel->GetProperties()->Get(vtkSelection::PRESERVE_TOPOLOGY())
);
} }
if (sel->GetProperties()->Has(vtkSelection::INVERSE()) && if (sel->GetProperties()->Has(vtkSelection::INVERSE()))
sel->GetProperties()->Get(vtkSelection::INVERSE()) != 0)
{ {
this->InsideOutOn(); this->SetInsideOut(
sel->GetProperties()->Get(vtkSelection::INVERSE())
);
}
if (sel->GetProperties()->Has(vtkSelection::EXACT_TEST()))
{
this->SetExactTest(
sel->GetProperties()->Get(vtkSelection::EXACT_TEST())
);
}
if (sel->GetProperties()->Has(vtkSelection::SHOW_BOUNDS()))
{
this->SetShowBounds(
sel->GetProperties()->Get(vtkSelection::SHOW_BOUNDS())
);
} }
} }
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "vtkstd/vector" #include "vtkstd/vector"
#include "vtkstd/set" #include "vtkstd/set"
vtkCxxRevisionMacro(vtkSelectionSource, "1.10"); vtkCxxRevisionMacro(vtkSelectionSource, "1.11");
vtkStandardNewMacro(vtkSelectionSource); vtkStandardNewMacro(vtkSelectionSource);
class vtkSelectionSourceInternals class vtkSelectionSourceInternals
...@@ -61,12 +61,22 @@ vtkSelectionSource::vtkSelectionSource() ...@@ -61,12 +61,22 @@ vtkSelectionSource::vtkSelectionSource()
this->ContentType = vtkSelection::INDICES; this->ContentType = vtkSelection::INDICES;
this->FieldType = vtkSelection::CELL; this->FieldType = vtkSelection::CELL;
this->ContainingCells = 1;
this->PreserveTopology = 0;
this->Inverse = 0;
this->ExactTest = 1;
this->ShowBounds = 0;
this->ArrayName = NULL;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
vtkSelectionSource::~vtkSelectionSource() vtkSelectionSource::~vtkSelectionSource()
{ {
delete this->Internal; delete this->Internal;
if (this->ArrayName)
{
delete[] this->ArrayName;
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -206,6 +216,14 @@ void vtkSelectionSource::PrintSelf(ostream& os, vtkIndent indent) ...@@ -206,6 +216,14 @@ void vtkSelectionSource::PrintSelf(ostream& os, vtkIndent indent)
os << "UNKNOWN"; os << "UNKNOWN";
} }
os << endl; os << endl;
os << indent << "ContainingCells: ";
os << (this->ContainingCells?"CELLS":"POINTS") << endl;
os << indent << "PreserveTopology: " << this->PreserveTopology << endl;
os << indent << "Inverse: " << this->Inverse << endl;
os << indent << "ExactTest: " << this->ExactTest << endl;
os << indent << "ShowBounds: " << this->ShowBounds << endl;
os << indent << "ArrayName: " << (this->ArrayName?this->ArrayName:"NULL") << endl;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
...@@ -343,7 +361,24 @@ int vtkSelectionSource::RequestData( ...@@ -343,7 +361,24 @@ int vtkSelectionSource::RequestData(
output->SetSelectionList(selectionList); output->SetSelectionList(selectionList);
selectionList->Delete(); selectionList->Delete();
} }
output->GetProperties()->Set(vtkSelection::CONTAINING_CELLS(),
this->ContainingCells);
output->GetProperties()->Set(vtkSelection::PRESERVE_TOPOLOGY(),
this->PreserveTopology);
output->GetProperties()->Set(vtkSelection::INVERSE(),
this->Inverse);
output->GetProperties()->Set(vtkSelection::ARRAY_NAME(),
this->ArrayName);
output->GetProperties()->Set(vtkSelection::EXACT_TEST(),
this->ExactTest);
output->GetProperties()->Set(vtkSelection::SHOW_BOUNDS(),
this->ShowBounds);
return 1; return 1;
} }
......
...@@ -70,6 +70,32 @@ public: ...@@ -70,6 +70,32 @@ public:
vtkSetMacro(FieldType, int); vtkSetMacro(FieldType, int);
vtkGetMacro(FieldType, int); vtkGetMacro(FieldType, int);
// Description:
// When extracting by points, extract the cells that contain the
// passing points.
vtkSetMacro(ContainingCells, int);
vtkGetMacro(ContainingCells, int);
// Description:
vtkSetMacro(PreserveTopology, int);
vtkGetMacro(PreserveTopology, int);
// Description:
vtkSetMacro(Inverse, int);
vtkGetMacro(Inverse, int);
// Description:
vtkSetStringMacro(ArrayName);
vtkGetStringMacro(ArrayName);
// Description:
vtkSetMacro(ExactTest, int);
vtkGetMacro(ExactTest, int);
// Description:
vtkSetMacro(ShowBounds, int);
vtkGetMacro(ShowBounds, int);
protected: protected:
vtkSelectionSource(); vtkSelectionSource();
~vtkSelectionSource(); ~vtkSelectionSource();
...@@ -86,6 +112,12 @@ protected: ...@@ -86,6 +112,12 @@ protected:
int ContentType; int ContentType;
int FieldType; int FieldType;
int ContainingCells;
int PreserveTopology;
int Inverse;
int ExactTest;
int ShowBounds;
char *ArrayName;
private: private:
vtkSelectionSource(const vtkSelectionSource&); // Not implemented. vtkSelectionSource(const vtkSelectionSource&); // Not implemented.
......
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