Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
otb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
269
Issues
269
List
Boards
Labels
Service Desk
Milestones
Merge Requests
13
Merge Requests
13
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main Repositories
otb
Commits
d2fea898
Commit
d2fea898
authored
Apr 13, 2016
by
Stéphane Albert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG: MANTIS1179: Fixed otb::GlImageActor::UpdateResolution() algorithm.
parent
c55d177a
Changes
1
Hide whitespace changes
Inline
Sidebyside
Showing
1 changed file
with
41 additions
and
24 deletions
+41
24
Modules/Visualization/Ice/src/otbGlImageActor.cxx
Modules/Visualization/Ice/src/otbGlImageActor.cxx
+41
24
No files found.
Modules/Visualization/Ice/src/otbGlImageActor.cxx
View file @
d2fea898
...
...
@@ 972,44 +972,61 @@ void GlImageActor::UpdateResolution()
double
distAC
=
vcl_sqrt
((
pointA
[
0
]

pointC
[
0
])
*
(
pointA
[
0
]

pointC
[
0
])
+
(
pointA
[
1
]

pointC
[
1
])
*
(
pointA
[
1
]

pointC
[
1
]));
double
resolution
=
std
::
min
(
100
/
distAB
,
100
/
distAC
);
// std::cout << std::endl;
// std::cout << "resolution: " << resolution << std::endl;
// Arbitrary higher than any distance we will compute here
double
minDist
=
50000.
;
m_CurrentResolution
=
0
;
bool
isFound
=
false
;
// OTB always include full resolution level in available resolutions.
assert
(
!
m_AvailableResolutions
.
empty
()
);
//
Compute the diff and keep the index that minimize the distance
for
(
ResolutionVectorType
::
iterator
it
=
m_AvailableResolutions
.
begin
();
it
!=
m_AvailableResolutions
.
end
();
++
it
)
//
MANTIS1179: resolution>1 <=> zooming in past 1:1 scale. So, cap
// resolution to index 0.
if
(
resolution
<
1.0
)
{
bool
isFound
=
false
;
// Compute the diff and keep the index that minimize the distance
for
(
ResolutionVectorType
::
iterator
it
=
m_AvailableResolutions
.
begin
();
it
!=
m_AvailableResolutions
.
end
();
++
it
)
{
double
diff
=
1
/
((
double
)(
1
<<
(
*
it
)))

resolution
;
// std::cout << "diff: " << diff << std::endl;
if
(
(
(
m_ResolutionAlgorithm
==
ResolutionAlgorithm
::
Nearest_Lower
&&
diff
<=
0
)

(
m_ResolutionAlgorithm
==
ResolutionAlgorithm
::
Nearest_Upper
&&
diff
>=
0
)

(
m_ResolutionAlgorithm
==
ResolutionAlgorithm
::
Nearest
)
)
&&
vcl_abs
(
diff
)
<
minDist
)
{
isFound
=
true
;
minDist
=
vcl_abs
(
diff
);
m_CurrentResolution
=
std
::
distance
(
m_AvailableResolutions
.
begin
(),
it
);
// std::cout << "found: " << m_CurrentResolution << std::endl;
}
}
double
diff
=
1
/
((
double
)(
1
<<
(
*
it
)))

resolution
;
if
(
(
(
m_ResolutionAlgorithm
==
ResolutionAlgorithm
::
Nearest_Lower
&&
diff
<
0
)

(
m_ResolutionAlgorithm
==
ResolutionAlgorithm
::
Nearest_Upper
&&
diff
>
0
)

(
m_ResolutionAlgorithm
==
ResolutionAlgorithm
::
Nearest
)
)
&&
vcl_abs
(
diff
)
<
minDist
)
// MANTIS1147: Cap currentresolution.
if
(
!
isFound
)
{
isFound
=
true
;
assert
(
m_AvailableResolutions
.
size
()
>
0
);
m_CurrentResolution
=
m_AvailableResolutions
.
size
()

1
;
minDist
=
vcl_abs
(
diff
);
m_CurrentResolution
=
std
::
distance
(
m_AvailableResolutions
.
begin
(),
it
);
// std::cout << "not found: " << m_CurrentResolution << std::endl;
}
}
// MANTIS1147: Cap currentresolution.
if
(
!
isFound
)
m_CurrentResolution
=
m_AvailableResolutions
.
size
()

1
;
std
::
ostringstream
extFilename
;
extFilename
<<
m_FileName
<<
"?&resol="
<<
m_CurrentResolution
;
...
...
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