Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
otb
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
213
Issues
213
List
Boards
Labels
Milestones
Merge Requests
11
Merge Requests
11
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main Repositories
otb
Commits
be320e35
Commit
be320e35
authored
Jul 06, 2016
by
Stéphane Albert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: Optimized ImageViewWidget::mouseMoveEvent().
parent
b74d1eb6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
95 additions
and
68 deletions
+95
-68
Code/Common/Gui/mvdAbstractImageViewRenderer.h
Code/Common/Gui/mvdAbstractImageViewRenderer.h
+3
-0
Code/Common/Gui/mvdImageViewRenderer.cxx
Code/Common/Gui/mvdImageViewRenderer.cxx
+8
-0
Code/Common/Gui/mvdImageViewRenderer.h
Code/Common/Gui/mvdImageViewRenderer.h
+2
-0
Code/Common/Gui/mvdImageViewWidget.cxx
Code/Common/Gui/mvdImageViewWidget.cxx
+82
-68
No files found.
Code/Common/Gui/mvdAbstractImageViewRenderer.h
View file @
be320e35
...
...
@@ -221,6 +221,9 @@ public:
/**
*/
inline
bool
IsGLSLEnabled
()
const
;
/**
*/
virtual
bool
IsEffectsEnabled
()
const
=
0
;
/**
*/
inline
bool
ZoomToRegion
(
const
PointType
&
origin
,
...
...
Code/Common/Gui/mvdImageViewRenderer.cxx
View file @
be320e35
...
...
@@ -1090,6 +1090,14 @@ ImageViewRenderer
m_GlView
->
SaveScreenshot
(
QFile
::
encodeName
(
filename
).
constData
()
);
}
/*****************************************************************************/
bool
ImageViewRenderer
::
IsEffectsEnabled
()
const
{
return
m_EffectsEnabled
;
}
/*****************************************************************************/
/* SLOTS */
/*****************************************************************************/
...
...
Code/Common/Gui/mvdImageViewRenderer.h
View file @
be320e35
...
...
@@ -194,6 +194,8 @@ public:
const
PointType
&
vcenter
,
const
SpacingType
&
vspacing
)
const
;
virtual
bool
IsEffectsEnabled
()
const
;
/*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/
// public slots
...
...
Code/Common/Gui/mvdImageViewWidget.cxx
View file @
be320e35
...
...
@@ -732,16 +732,89 @@ ImageViewWidget
// Superclass default behaviour.
QGLWidget
::
mouseMoveEvent
(
event
);
// Delegate behaviour.
m_Manipulator
->
MouseMoveEvent
(
event
);
//
// Get layer-stack.
StackedLayerModel
*
stackedLayerModel
=
GetLayerStack
();
assert
(
stackedLayerModel
!=
NULL
);
//
// Update view depending on shader status special behaviour.
//
bool
isAnyEffectActive
=
false
;
if
(
m_Renderer
->
IsEffectsEnabled
()
)
{
for
(
StackedLayerModel
::
ConstIterator
it
(
stackedLayerModel
->
Begin
()
);
it
!=
stackedLayerModel
->
End
();
++
it
)
{
assert
(
it
->
second
!=
NULL
);
if
(
it
->
second
->
inherits
(
AbstractImageModel
::
staticMetaObject
.
className
()
)
)
{
VectorImageModel
*
imageModel
=
qobject_cast
<
VectorImageModel
*
>
(
it
->
second
);
assert
(
imageModel
!=
NULL
);
if
(
imageModel
->
GetSettings
().
GetEffect
()
!=
EFFECT_NONE
&&
imageModel
->
GetSettings
().
GetEffect
()
!=
EFFECT_NORMAL
)
{
#if USE_XP_REGION_OPTIM
PointType
origin
;
PointType
extent
;
m_Renderer
->
GetLayerExtent
(
it
->
first
,
origin
,
extent
);
if
(
(
origin
[
0
]
<=
ptView
[
0
]
&&
ptView
[
0
]
<=
extent
[
0
]
&&
origin
[
1
]
<=
ptView
[
1
]
&&
ptView
[
1
]
<=
extent
[
1
]
)
||
(
origin
[
0
]
<=
m_Position
[
0
]
&&
m_Position
[
0
]
<=
extent
[
0
]
&&
origin
[
1
]
<=
m_Position
[
1
]
&&
m_Position
[
1
]
<=
extent
[
1
]
)
)
{
qDebug
()
<<
FromStdString
(
it
->
first
);
// qDebug()
// << "x:" << origin[ 0 ] << ptView[ 0 ] << m_Position[ 0 ] << extent[ 0 ];
// qDebug()
// << "y:" << origin[ 1 ] << ptView[ 1 ] << m_Position[ 1 ] << extent[ 1 ];
// qDebug()
// << "x:" << ptView[ 0 ] << m_Position[ 0 ];
// qDebug()
// << "y:" << ptView[ 1 ] << m_Position[ 1 ];
#endif // USE_XP_REGION_OPTIM
// qDebug() << "updateGL(" << in[ 0 ] << "," << in[ 1 ] << ")";
isAnyEffectActive
=
true
;
break
;
}
#if USE_XP_REGION_OPTIM
}
#endif // USE_XP_REGION_OPTIM
}
}
#if USE_XP_REGION_OPTIM
m_Position
=
ptView
;
#endif // USE_XP_REGION_OPTION
}
// Delegate behaviour.
if
(
isAnyEffectActive
)
{
bool
bypass
=
m_Renderer
->
SetBypassRenderingEnabled
(
true
);
m_Manipulator
->
MouseMoveEvent
(
event
);
m_Renderer
->
SetBypassRenderingEnabled
(
bypass
);
}
else
m_Manipulator
->
MouseMoveEvent
(
event
);
// assert( stackedLayerModel!=NULL );
if
(
stackedLayerModel
==
NULL
)
return
;
//
// Pixel-picking special behaviour.
...
...
@@ -788,7 +861,7 @@ ImageViewWidget
DefaultImageType
::
PixelType
()
);
}
else
else
if
(
isAnyEffectActive
)
{
// Transform coordinates from widget space to viewport space.
assert
(
m_Manipulator
!=
NULL
);
...
...
@@ -807,67 +880,8 @@ ImageViewWidget
m_Renderer
->
UpdatePixelInfo
(
event
->
pos
(),
ptView
,
pixels
);
}
//
// Update view depending on shader status special behaviour.
//
{
for
(
StackedLayerModel
::
ConstIterator
it
(
stackedLayerModel
->
Begin
()
);
it
!=
stackedLayerModel
->
End
();
++
it
)
{
assert
(
it
->
second
!=
NULL
);
if
(
it
->
second
->
inherits
(
AbstractImageModel
::
staticMetaObject
.
className
()
)
)
{
VectorImageModel
*
imageModel
=
qobject_cast
<
VectorImageModel
*
>
(
it
->
second
);
assert
(
imageModel
!=
NULL
);
if
(
imageModel
->
GetSettings
().
GetEffect
()
!=
EFFECT_NONE
&&
imageModel
->
GetSettings
().
GetEffect
()
!=
EFFECT_NORMAL
)
{
#if USE_XP_REGION_OPTIM
PointType
origin
;
PointType
extent
;
m_Renderer
->
GetLayerExtent
(
it
->
first
,
origin
,
extent
);
if
(
(
origin
[
0
]
<=
ptView
[
0
]
&&
ptView
[
0
]
<=
extent
[
0
]
&&
origin
[
1
]
<=
ptView
[
1
]
&&
ptView
[
1
]
<=
extent
[
1
]
)
||
(
origin
[
0
]
<=
m_Position
[
0
]
&&
m_Position
[
0
]
<=
extent
[
0
]
&&
origin
[
1
]
<=
m_Position
[
1
]
&&
m_Position
[
1
]
<=
extent
[
1
]
)
)
{
qDebug
()
<<
FromStdString
(
it
->
first
);
// qDebug()
// << "x:" << origin[ 0 ] << ptView[ 0 ] << m_Position[ 0 ] << extent[ 0 ];
// qDebug()
// << "y:" << origin[ 1 ] << ptView[ 1 ] << m_Position[ 1 ] << extent[ 1 ];
// qDebug()
// << "x:" << ptView[ 0 ] << m_Position[ 0 ];
// qDebug()
// << "y:" << ptView[ 1 ] << m_Position[ 1 ];
#endif // USE_XP_REGION_OPTIM
// qDebug() << "updateGL(" << in[ 0 ] << "," << in[ 1 ] << ")";
updateGL
();
break
;
}
#if USE_XP_REGION_OPTIM
}
#endif // USE_XP_REGION_OPTIM
}
}
#if USE_XP_REGION_OPTIM
m_Position
=
ptView
;
#endif // USE_XP_REGION_OPTION
}
if
(
isAnyEffectActive
)
updateGL
();
}
/*******************************************************************************/
...
...
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