Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Michael Migliore
VTK
Commits
520fa3c7
Commit
520fa3c7
authored
Nov 25, 2008
by
Dave Partyka
Browse files
ENH: some work on coincident points completed.
parent
21b47803
Changes
5
Hide whitespace changes
Inline
Side-by-side
Rendering/Testing/Cxx/CMakeLists.txt
View file @
520fa3c7
...
...
@@ -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
...
...
Rendering/Testing/Cxx/TestLabelPlacer.cxx
View file @
520fa3c7
...
...
@@ -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
();
...
...
Rendering/vtkLabelHierarchy.cxx
View file @
520fa3c7
...
...
@@ -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.1
5
"
);
vtkCxxRevisionMacro
(
vtkLabelHierarchyFrustumIterator
,
"1.1
6
"
);
vtkStandardNewMacro
(
vtkLabelHierarchyFrustumIterator
);
vtkCxxSetObjectMacro
(
vtkLabelHierarchyFrustumIterator
,
Camera
,
vtkCamera
);
vtkLabelHierarchyFrustumIterator
::
vtkLabelHierarchyFrustumIterator
()
...
...
@@ -752,7 +787,7 @@ protected:
int
NodesTraversed
;
};
vtkCxxRevisionMacro
(
vtkLabelHierarchyFullSortIterator
,
"1.1
5
"
);
vtkCxxRevisionMacro
(
vtkLabelHierarchyFullSortIterator
,
"1.1
6
"
);
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.1
5
"
);
vtkCxxRevisionMacro
(
vtkLabelHierarchy
,
"1.1
6
"
);
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
);
}
...
...
Rendering/vtkLabelHierarchy.h
View file @
520fa3c7
...
...
@@ -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.
...
...
Rendering/vtkPointSetToLabelHierarchy.cxx
View file @
520fa3c7
...
...
@@ -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
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment