Commit 520fa3c7 authored by Dave Partyka's avatar Dave Partyka
Browse files

ENH: some work on coincident points completed.

parent 21b47803
......@@ -20,7 +20,6 @@ IF(VTK_USE_DISPLAY)
SurfacePlusEdges.cxx
TestDynamic2DLabelMapper.cxx
TestFBO.cxx
TestGenericVertexAttributesGLSLCxx.cxx
TestGradientBackground.cxx
TestInteractorTimers.cxx
TestLabelPlacer.cxx
......@@ -46,6 +45,7 @@ IF(VTK_USE_DISPLAY)
${RenderingTestsWithArguments}
TestAreaSelections.cxx
TestMultiTexturing.cxx
TestMultiTexturingGLSL.cxx
TestMultiTexturingTransform.cxx
TestScenePicker.cxx
TestTextureRGBA.cxx
......@@ -59,6 +59,14 @@ IF(VTK_USE_DISPLAY)
)
ENDIF(VTK_DATA_ROOT)
IF (VTK_USE_GLSL_SHADERS)
# Tests testing GLSL Shaders.
SET(RenderingTestsWithArguments
${RenderingTestsWithArguments}
TestGenericVertexAttributesGLSLCxx.cxx
)
ENDIF (VTK_USE_GLSL_SHADERS)
ENDIF(VTK_USE_DISPLAY)
CREATE_TEST_SOURCELIST(Tests ${KIT}CxxTests.cxx
......
......@@ -56,6 +56,8 @@ int TestLabelPlacer(int argc, char *argv[])
int iteratorType = vtkLabelHierarchy::FULL_SORT;
bool showBounds = false;
cout << "TestLabelPlacer" << endl;
vtkSmartPointer<vtkLabelSizeCalculator> labelSizeCalculator =
vtkSmartPointer<vtkLabelSizeCalculator>::New();
vtkSmartPointer<vtkLabelHierarchy> labelHierarchy =
......@@ -82,6 +84,8 @@ int TestLabelPlacer(int argc, char *argv[])
vtkSmartPointer<vtkLabeledDataMapper>::New();
vtkSmartPointer<vtkActor2D> textActor = vtkSmartPointer<vtkActor2D>::New();
cout << "Done Instantiating" << endl;
xmlPolyDataReader->SetFileName( fname );
delete [] fname;
......@@ -104,12 +108,17 @@ int TestLabelPlacer(int argc, char *argv[])
labelPlacer->SetRenderer( renderer );
labelPlacer->SetMaximumLabelFraction( labelRatio );
cout << "Done Setting up LabelPlacer" << endl;
polyDataMapper->SetInputConnection(labelPlacer->GetOutputPort());
actor->SetMapper(polyDataMapper);
labelPlacer->Update();
cout << "Done Updating Label Placer" << endl;
labeledMapper->SetInputConnection(labelPlacer->GetOutputPort());
labeledMapper->SetLabelTextProperty(labelSizeCalculator->GetFontProperty());
labeledMapper->SetFieldDataName("LabelText");
......@@ -125,6 +134,8 @@ int TestLabelPlacer(int argc, char *argv[])
renderer->SetBackground(0.0, 0.0, 0.0);
iren->SetRenderWindow(renWin);
cout << "Calling Render" << endl;
renWin->Render();
renderer->ResetCamera();
renderer->ResetCamera();
......
......@@ -41,6 +41,7 @@
#include <vtkstd/deque>
#include <vtkstd/set>
#include <vtkstd/vector>
#include <vtkstd/map>
//----------------------------------------------------------------------------
// vtkLabelHierarchy::implementation
......@@ -120,9 +121,41 @@ public:
}
};
struct Coord
{
double coord[3];
Coord()
{
this->coord[0] = -1.0;
this->coord[1] = -1.0;
this->coord[2] = -1.0;
}
Coord( const Coord & src )
{
this->coord[0] = src.coord[0];
this->coord[1] = src.coord[1];
this->coord[2] = src.coord[2];
}
Coord( const double src[3] )
{
this->coord[0] = src[0];
this->coord[1] = src[1];
this->coord[2] = src[2];
}
~Coord() {}
inline bool operator < (const Coord & other) const
{
return this->coord[0] < other.coord[0] ||
(this->coord[0] == other.coord[0] && this->coord[0] < other.coord[1]) ||
(this->coord[0] == other.coord[0] && this->coord[1] == other.coord[1] && this->coord[2] < other.coord[2]);
}
};
class LabelSet : public vtkstd::multiset<vtkIdType,PriorityComparator>
{
public:
public:
LabelSet( vtkLabelHierarchy* hierarchy )
: vtkstd::multiset<vtkIdType,PriorityComparator>( PriorityComparator(hierarchy) )
{
......@@ -159,6 +192,7 @@ public:
typedef octree<LabelSet> HierarchyType;
typedef octree<LabelSet>::cursor HierarchyCursor;
typedef octree<LabelSet>::iterator HierarchyIterator;
typedef vtkstd::map<Coord,vtkstd::pair<int,vtkstd::set<vtkIdType> > >::iterator MapCoordIter;
// Description:
// Computes the depth of the generated hierarchy.
......@@ -182,8 +216,9 @@ public:
vtkTimeStamp HierarchyTime;
int ActualDepth;
vtkLabelHierarchy* Self;
static vtkLabelHierarchy* Current;
vtkstd::map<Coord,vtkstd::pair<int,vtkstd::set<vtkIdType> > > coordMap;
};
......@@ -264,7 +299,7 @@ protected:
double BoundsFactor;
};
vtkCxxRevisionMacro(vtkLabelHierarchyFrustumIterator,"1.15");
vtkCxxRevisionMacro(vtkLabelHierarchyFrustumIterator,"1.16");
vtkStandardNewMacro(vtkLabelHierarchyFrustumIterator);
vtkCxxSetObjectMacro(vtkLabelHierarchyFrustumIterator, Camera, vtkCamera);
vtkLabelHierarchyFrustumIterator::vtkLabelHierarchyFrustumIterator()
......@@ -752,7 +787,7 @@ protected:
int NodesTraversed;
};
vtkCxxRevisionMacro(vtkLabelHierarchyFullSortIterator,"1.15");
vtkCxxRevisionMacro(vtkLabelHierarchyFullSortIterator,"1.16");
vtkStandardNewMacro(vtkLabelHierarchyFullSortIterator);
vtkCxxSetObjectMacro(vtkLabelHierarchyFullSortIterator, Camera, vtkCamera);
void vtkLabelHierarchyFullSortIterator::Prepare( vtkLabelHierarchy* hier, vtkCamera* cam,
......@@ -987,7 +1022,7 @@ vtkLabelHierarchyFullSortIterator::~vtkLabelHierarchyFullSortIterator()
// vtkLabelHierarchy
vtkStandardNewMacro(vtkLabelHierarchy);
vtkCxxRevisionMacro(vtkLabelHierarchy,"1.15");
vtkCxxRevisionMacro(vtkLabelHierarchy,"1.16");
vtkCxxSetObjectMacro(vtkLabelHierarchy,Priorities,vtkDataArray);
vtkLabelHierarchy::vtkLabelHierarchy()
{
......@@ -1028,7 +1063,7 @@ void vtkLabelHierarchy::SetPoints( vtkPoints* src )
if ( src )
{
this->ComputeHierarchy();
this->ComputeHierarchy( NULL, NULL );
}
}
......@@ -1039,7 +1074,7 @@ void vtkLabelHierarchy::SetPoints( vtkPoints* src )
// The exact procedure involves sorting all labels in descending priority, filling the root of
// the label octree with the highest priority labels, and then inserting the remaining labels
// in the highest possible level of octree which is not already full.
void vtkLabelHierarchy::ComputeHierarchy()
void vtkLabelHierarchy::ComputeHierarchy( vtkPoints* coincidentPts, vtkIdTypeArray* coincidenceMap )
{
if ( this->Implementation->Hierarchy )
{
......@@ -1069,6 +1104,9 @@ void vtkLabelHierarchy::ComputeHierarchy()
this->Implementation->DropAnchor( *it ); // Ha!!!
}
coincidenceMap;
coincidentPts;
this->Implementation->HierarchyTime.Modified();
this->Implementation->ComputeActualDepth();
......@@ -1437,6 +1475,30 @@ void vtkLabelHierarchy::implementation::DropAnchor( vtkIdType anchor )
curs.down( child );
}
curs->value().insert( anchor );
//vtkstd::map<Coord,vtkstd::pair<int,vtkstd::set<vtkIdType> > > coordMap;
Coord coord(x);
//anchor->Get
MapCoordIter mapIter = this->coordMap.find(coord);
if(mapIter == this->coordMap.end())
{
vtkstd::pair<int, vtkstd::set<vtkIdType> > Pair;
Pair.first = curs.level();
Pair.second.insert(anchor);
this->coordMap[coord] = Pair;
}
else
{
(*mapIter).second.first =
(*mapIter).second.first < static_cast<int>(curs.level()) ?
static_cast<int>(curs.level()) : (*mapIter).second.first;
(*mapIter).second.second.insert(anchor);
}
this->SmudgeAnchor( curs, anchor, x );
}
......
......@@ -79,7 +79,7 @@ public:
// Description:
// Fill the hierarchy with the input labels.
virtual void ComputeHierarchy();
virtual void ComputeHierarchy( vtkPoints* coincidentPts, vtkIdTypeArray* coincidenceMap );
// Description:
// The number of labels that is ideally present at any octree node.
......
......@@ -37,7 +37,7 @@
#include <vtkstd/vector>
vtkStandardNewMacro(vtkPointSetToLabelHierarchy);
vtkCxxRevisionMacro(vtkPointSetToLabelHierarchy,"1.3");
vtkCxxRevisionMacro(vtkPointSetToLabelHierarchy,"1.4");
vtkPointSetToLabelHierarchy::vtkPointSetToLabelHierarchy()
{
......@@ -235,7 +235,7 @@ int vtkPointSetToLabelHierarchy::RequestData(
ouData->GetPointData()->AddArray( type );
ouData->GetPointData()->AddArray( iconIndex );
ouData->GetPointData()->AddArray( labelString );
ouData->ComputeHierarchy();
ouData->ComputeHierarchy( NULL, NULL );
return 1;
}
......
Supports Markdown
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