Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
200b254b
Commit
200b254b
authored
Jul 09, 2013
by
ozantonkal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rearrange widget constructors
parent
10d955f1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
17 deletions
+20
-17
widget_accessor.hpp
modules/viz/include/opencv2/viz/widget_accessor.hpp
+2
-2
widgets.hpp
modules/viz/include/opencv2/viz/widgets.hpp
+3
-0
simple_widgets.cpp
modules/viz/src/simple_widgets.cpp
+0
-0
viz3d_impl.cpp
modules/viz/src/viz3d_impl.cpp
+4
-4
widget.cpp
modules/viz/src/widget.cpp
+11
-11
No files found.
modules/viz/include/opencv2/viz/widget_accessor.hpp
View file @
200b254b
...
...
@@ -12,7 +12,7 @@ namespace temp_viz
//It is indended for those users who want to develop own widgets system using VTK library API.
struct
CV_EXPORTS
WidgetAccessor
{
static
vtkSmartPointer
<
vtkProp
>
get
Actor
(
const
Widget
&
widget
);
static
void
set
Vtk
Prop
(
Widget
&
widget
,
vtkSmartPointer
<
vtkProp
>
actor
);
static
vtkSmartPointer
<
vtkProp
>
get
Prop
(
const
Widget
&
widget
);
static
void
setProp
(
Widget
&
widget
,
vtkSmartPointer
<
vtkProp
>
actor
);
};
}
modules/viz/include/opencv2/viz/widgets.hpp
View file @
200b254b
...
...
@@ -132,6 +132,9 @@ namespace temp_viz
TextWidget
(
const
String
&
text
,
const
Point2i
&
pos
,
int
font_size
=
10
,
const
Color
&
color
=
Color
::
white
());
TextWidget
(
const
Widget
&
other
)
:
Widget2D
(
other
)
{}
TextWidget
&
operator
=
(
const
Widget
&
other
);
void
setText
(
const
String
&
text
);
String
getText
()
const
;
};
class
CV_EXPORTS
CloudWidget
:
public
Widget3D
...
...
modules/viz/src/simple_widgets.cpp
View file @
200b254b
This diff is collapsed.
Click to expand it.
modules/viz/src/viz3d_impl.cpp
View file @
200b254b
...
...
@@ -874,7 +874,7 @@ void temp_viz::Viz3d::VizImpl::showWidget(const String &id, const Widget &widget
removeActorFromRenderer
(
wam_itr
->
second
.
actor
);
}
// Get the actor and set the user matrix
vtkProp3D
*
actor
=
vtkProp3D
::
SafeDownCast
(
WidgetAccessor
::
get
Actor
(
widget
));
vtkProp3D
*
actor
=
vtkProp3D
::
SafeDownCast
(
WidgetAccessor
::
get
Prop
(
widget
));
if
(
actor
)
{
// If the actor is 3D, apply pose
...
...
@@ -882,8 +882,8 @@ void temp_viz::Viz3d::VizImpl::showWidget(const String &id, const Widget &widget
actor
->
SetUserMatrix
(
matrix
);
actor
->
Modified
();
}
renderer_
->
AddActor
(
WidgetAccessor
::
get
Actor
(
widget
));
(
*
widget_actor_map_
)[
id
].
actor
=
WidgetAccessor
::
get
Actor
(
widget
);
renderer_
->
AddActor
(
WidgetAccessor
::
get
Prop
(
widget
));
(
*
widget_actor_map_
)[
id
].
actor
=
WidgetAccessor
::
get
Prop
(
widget
);
}
void
temp_viz
::
Viz3d
::
VizImpl
::
removeWidget
(
const
String
&
id
)
...
...
@@ -902,7 +902,7 @@ temp_viz::Widget temp_viz::Viz3d::VizImpl::getWidget(const String &id) const
CV_Assert
(
exists
);
Widget
widget
;
WidgetAccessor
::
set
Vtk
Prop
(
widget
,
wam_itr
->
second
.
actor
);
WidgetAccessor
::
setProp
(
widget
,
wam_itr
->
second
.
actor
);
return
widget
;
}
...
...
modules/viz/src/widget.cpp
View file @
200b254b
...
...
@@ -57,12 +57,12 @@ void temp_viz::Widget::release()
///////////////////////////////////////////////////////////////////////////////////////////////
/// widget accessor implementaion
vtkSmartPointer
<
vtkProp
>
temp_viz
::
WidgetAccessor
::
get
Actor
(
const
Widget
&
widget
)
vtkSmartPointer
<
vtkProp
>
temp_viz
::
WidgetAccessor
::
get
Prop
(
const
Widget
&
widget
)
{
return
widget
.
impl_
->
actor
;
}
void
temp_viz
::
WidgetAccessor
::
set
Vtk
Prop
(
Widget
&
widget
,
vtkSmartPointer
<
vtkProp
>
actor
)
void
temp_viz
::
WidgetAccessor
::
setProp
(
Widget
&
widget
,
vtkSmartPointer
<
vtkProp
>
actor
)
{
widget
.
impl_
->
actor
=
actor
;
}
...
...
@@ -94,14 +94,14 @@ struct temp_viz::Widget3D::MatrixConverter
temp_viz
::
Widget3D
::
Widget3D
(
const
Widget
&
other
)
:
Widget
(
other
)
{
// Check if other's actor is castable to vtkProp3D
vtkProp3D
*
actor
=
vtkProp3D
::
SafeDownCast
(
WidgetAccessor
::
get
Actor
(
other
));
vtkProp3D
*
actor
=
vtkProp3D
::
SafeDownCast
(
WidgetAccessor
::
get
Prop
(
other
));
CV_Assert
(
actor
);
}
temp_viz
::
Widget3D
&
temp_viz
::
Widget3D
::
operator
=
(
const
Widget
&
other
)
{
// Check if other's actor is castable to vtkProp3D
vtkProp3D
*
actor
=
vtkProp3D
::
SafeDownCast
(
WidgetAccessor
::
get
Actor
(
other
));
vtkProp3D
*
actor
=
vtkProp3D
::
SafeDownCast
(
WidgetAccessor
::
get
Prop
(
other
));
CV_Assert
(
actor
);
Widget
::
operator
=
(
other
);
...
...
@@ -110,7 +110,7 @@ temp_viz::Widget3D& temp_viz::Widget3D::operator =(const Widget &other)
void
temp_viz
::
Widget3D
::
setPose
(
const
Affine3f
&
pose
)
{
vtkProp3D
*
actor
=
vtkProp3D
::
SafeDownCast
(
WidgetAccessor
::
get
Actor
(
*
this
));
vtkProp3D
*
actor
=
vtkProp3D
::
SafeDownCast
(
WidgetAccessor
::
get
Prop
(
*
this
));
CV_Assert
(
actor
);
vtkSmartPointer
<
vtkMatrix4x4
>
matrix
=
convertToVtkMatrix
(
pose
.
matrix
);
...
...
@@ -120,7 +120,7 @@ void temp_viz::Widget3D::setPose(const Affine3f &pose)
void
temp_viz
::
Widget3D
::
updatePose
(
const
Affine3f
&
pose
)
{
vtkProp3D
*
actor
=
vtkProp3D
::
SafeDownCast
(
WidgetAccessor
::
get
Actor
(
*
this
));
vtkProp3D
*
actor
=
vtkProp3D
::
SafeDownCast
(
WidgetAccessor
::
get
Prop
(
*
this
));
CV_Assert
(
actor
);
vtkSmartPointer
<
vtkMatrix4x4
>
matrix
=
actor
->
GetUserMatrix
();
...
...
@@ -140,7 +140,7 @@ void temp_viz::Widget3D::updatePose(const Affine3f &pose)
temp_viz
::
Affine3f
temp_viz
::
Widget3D
::
getPose
()
const
{
vtkProp3D
*
actor
=
vtkProp3D
::
SafeDownCast
(
WidgetAccessor
::
get
Actor
(
*
this
));
vtkProp3D
*
actor
=
vtkProp3D
::
SafeDownCast
(
WidgetAccessor
::
get
Prop
(
*
this
));
CV_Assert
(
actor
);
vtkSmartPointer
<
vtkMatrix4x4
>
matrix
=
actor
->
GetUserMatrix
();
...
...
@@ -151,7 +151,7 @@ temp_viz::Affine3f temp_viz::Widget3D::getPose() const
void
temp_viz
::
Widget3D
::
setColor
(
const
Color
&
color
)
{
// Cast to actor instead of prop3d since prop3d doesn't provide getproperty
vtkActor
*
actor
=
vtkActor
::
SafeDownCast
(
WidgetAccessor
::
get
Actor
(
*
this
));
vtkActor
*
actor
=
vtkActor
::
SafeDownCast
(
WidgetAccessor
::
get
Prop
(
*
this
));
CV_Assert
(
actor
);
Color
c
=
vtkcolor
(
color
);
...
...
@@ -171,14 +171,14 @@ void temp_viz::Widget3D::setColor(const Color &color)
temp_viz
::
Widget2D
::
Widget2D
(
const
Widget
&
other
)
:
Widget
(
other
)
{
// Check if other's actor is castable to vtkActor2D
vtkActor2D
*
actor
=
vtkActor2D
::
SafeDownCast
(
WidgetAccessor
::
get
Actor
(
other
));
vtkActor2D
*
actor
=
vtkActor2D
::
SafeDownCast
(
WidgetAccessor
::
get
Prop
(
other
));
CV_Assert
(
actor
);
}
temp_viz
::
Widget2D
&
temp_viz
::
Widget2D
::
operator
=
(
const
Widget
&
other
)
{
// Check if other's actor is castable to vtkActor2D
vtkActor2D
*
actor
=
vtkActor2D
::
SafeDownCast
(
WidgetAccessor
::
get
Actor
(
other
));
vtkActor2D
*
actor
=
vtkActor2D
::
SafeDownCast
(
WidgetAccessor
::
get
Prop
(
other
));
CV_Assert
(
actor
);
Widget
::
operator
=
(
other
);
return
*
this
;
...
...
@@ -186,7 +186,7 @@ temp_viz::Widget2D& temp_viz::Widget2D::operator=(const Widget &other)
void
temp_viz
::
Widget2D
::
setColor
(
const
Color
&
color
)
{
vtkActor2D
*
actor
=
vtkActor2D
::
SafeDownCast
(
WidgetAccessor
::
get
Actor
(
*
this
));
vtkActor2D
*
actor
=
vtkActor2D
::
SafeDownCast
(
WidgetAccessor
::
get
Prop
(
*
this
));
CV_Assert
(
actor
);
Color
c
=
vtkcolor
(
color
);
actor
->
GetProperty
()
->
SetColor
(
c
.
val
);
...
...
Write
Preview
Markdown
is supported
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