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
afc8bfb5
Commit
afc8bfb5
authored
Feb 11, 2013
by
Otmane Lahlou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: resolve zoom bug for j2k images
parent
10d6d7a5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
11 deletions
+42
-11
Code/Common/mvdGLImageWidget.cxx
Code/Common/mvdGLImageWidget.cxx
+1
-1
Code/Common/mvdImageModelRenderer.cxx
Code/Common/mvdImageModelRenderer.cxx
+3
-1
Code/Common/mvdImageModelRenderer.h
Code/Common/mvdImageModelRenderer.h
+5
-2
Code/Common/mvdImageViewManipulator.cxx
Code/Common/mvdImageViewManipulator.cxx
+6
-1
Code/Common/mvdImageViewManipulator.h
Code/Common/mvdImageViewManipulator.h
+16
-0
Code/Common/mvdVectorImageModel.cxx
Code/Common/mvdVectorImageModel.cxx
+8
-5
Code/Common/mvdVectorImageModel.h
Code/Common/mvdVectorImageModel.h
+3
-1
No files found.
Code/Common/mvdGLImageWidget.cxx
View file @
afc8bfb5
...
...
@@ -220,7 +220,7 @@ GLImageWidget
ImageModelRenderer
::
RenderingContext
context
(
datasetModel
->
GetSelectedImageModel
(),
region
,
isotropicZoom
,
width
(),
height
()
width
(),
height
()
,
m_ImageViewManipulator
->
HasZoomChanged
()
);
// use the model renderer to paint the requested region of the image.
...
...
Code/Common/mvdImageModelRenderer.cxx
View file @
afc8bfb5
...
...
@@ -101,7 +101,9 @@ void ImageModelRenderer::paintGL( const RenderingContext& context )
if
(
!
m_IsMoving
)
{
// request the data for the current region
m_Buffer
=
viModel
->
RasterizeRegion
(
scaledRegion
,
context
.
m_IsotropicZoom
);
m_Buffer
=
viModel
->
RasterizeRegion
(
scaledRegion
,
context
.
m_IsotropicZoom
,
context
.
m_ForceRefresh
);
}
// current resolution
...
...
Code/Common/mvdImageModelRenderer.h
View file @
afc8bfb5
...
...
@@ -75,12 +75,14 @@ public:
unsigned
int
width
=
0
,
unsigned
int
height
=
0
,
int
dx
=
0
,
int
dy
=
0
)
:
int
dy
=
0
,
bool
refresh
=
true
)
:
m_AbstractImageModel
(
model
),
m_ImageRegion
(
region
),
m_IsotropicZoom
(
zoom
),
m_WidgetWidth
(
width
),
m_WidgetHeight
(
height
)
m_WidgetHeight
(
height
),
m_ForceRefresh
(
refresh
)
{
}
...
...
@@ -89,6 +91,7 @@ public:
double
m_IsotropicZoom
;
unsigned
int
m_WidgetWidth
;
unsigned
int
m_WidgetHeight
;
bool
m_ForceRefresh
;
};
//
...
...
Code/Common/mvdImageViewManipulator.cxx
View file @
afc8bfb5
...
...
@@ -51,7 +51,8 @@ ImageViewManipulator
QObject
(
parent
),
m_NavigationContext
(),
m_MouseContext
(),
m_IsotropicZoom
(
1
)
m_IsotropicZoom
(
1
),
m_PreviousIsotropicZoom
(
1.
)
{
// TODO: Remove later because initialized in struct's default constructor and resizeEvent().
this
->
InitializeContext
(
1
,
1
);
...
...
@@ -95,6 +96,8 @@ void
ImageViewManipulator
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
m_PreviousIsotropicZoom
=
m_IsotropicZoom
;
// Update the mouse context
m_MouseContext
.
dx
=
-
event
->
x
()
+
m_MouseContext
.
xMove
;
m_MouseContext
.
dy
=
-
event
->
y
()
+
m_MouseContext
.
yMove
;
...
...
@@ -196,6 +199,8 @@ void
ImageViewManipulator
::
Zoom
(
const
double
scale
)
{
m_PreviousIsotropicZoom
=
m_IsotropicZoom
;
// compute the new size
double
sizeX
=
m_NavigationContext
.
m_SizeXBeforeConstrain
/
scale
;
double
sizeY
=
m_NavigationContext
.
m_SizeYBeforeConstrain
/
scale
;
...
...
Code/Common/mvdImageViewManipulator.h
View file @
afc8bfb5
...
...
@@ -108,6 +108,19 @@ public:
return
m_IsotropicZoom
;
}
inline
bool
HasZoomChanged
()
const
{
bool
res
=
false
;
if
(
vcl_abs
(
m_IsotropicZoom
-
m_PreviousIsotropicZoom
)
>
0.00000001
)
{
res
=
true
;
}
return
res
;
}
/*
const MouseContextType& GetMouseContextType() const
{
...
...
@@ -121,6 +134,8 @@ public:
// set back the zoom to 1
m_IsotropicZoom
=
1.
;
m_PreviousIsotropicZoom
=
1.
;
// store the image largest region
m_NavigationContext
.
m_ModelImageRegion
=
largestRegion
;
...
...
@@ -217,6 +232,7 @@ private:
MouseContextType
m_MouseContext
;
double
m_IsotropicZoom
;
double
m_PreviousIsotropicZoom
;
//
// SLOTS.
...
...
Code/Common/mvdVectorImageModel.cxx
View file @
afc8bfb5
...
...
@@ -256,7 +256,7 @@ VectorImageModel
/*******************************************************************************/
unsigned
char
*
VectorImageModel
::
RasterizeRegion
(
const
ImageRegionType
&
region
,
const
double
zoomFactor
)
::
RasterizeRegion
(
const
ImageRegionType
&
region
,
const
double
zoomFactor
,
bool
refresh
)
{
m_Region
=
region
;
...
...
@@ -271,7 +271,8 @@ VectorImageModel
// Don't do anything if the region did not changed
if
(
m_PreviousRegion
!=
region
||
m_Settings
.
IsDirty
()
)
m_Settings
.
IsDirty
()
||
refresh
)
{
// check that the current and the previous region have some pixels in
// common
...
...
@@ -281,7 +282,8 @@ VectorImageModel
// if the first time or no pixels in common , reload all
if
(
res
&&
m_PreviousRegion
!=
ImageRegionType
()
&&
!
m_Settings
.
IsDirty
()
)
!
m_Settings
.
IsDirty
()
&&
!
refresh
)
{
// Compute loaded region, and the four regions not loaded yet
// within the new requested region
...
...
@@ -348,10 +350,11 @@ VectorImageModel
// rasterize the region
this
->
DumpImagePixelsWithinRegionIntoBuffer
(
region
);
}
m_Settings
.
ClearDirty
();
}
// settings changes have been taken into account, clean the dirty flag
m_Settings
.
ClearDirty
();
// Store the region
m_PreviousRegion
=
region
;
...
...
Code/Common/mvdVectorImageModel.h
View file @
afc8bfb5
...
...
@@ -282,7 +282,9 @@ public:
void
LoadFile
(
const
QString
&
filename
,
int
w
,
int
h
);
/** Rasterize the buffered region in a buffer */
unsigned
char
*
RasterizeRegion
(
const
ImageRegionType
&
region
,
const
double
zoomFactor
);
unsigned
char
*
RasterizeRegion
(
const
ImageRegionType
&
region
,
const
double
zoomFactor
,
bool
refresh
);
/**
* Following the zoom factor, get the best level of detail knowing
...
...
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