Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
CAMP
campvis-public
Commits
7e1f1e13
Commit
7e1f1e13
authored
Dec 24, 2013
by
Hossain Mahmud
Browse files
iteration for the reader is replace with a functor
parent
153431d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
modules/io/processors/abstractimagereader.h
View file @
7e1f1e13
...
...
@@ -58,8 +58,13 @@ namespace campvis {
**/
virtual
~
AbstractImageReader
();
/// \see AbstractProcessor::acceptsExtension()
virtual
bool
acceptsExtension
(
const
std
::
string
&
extenstion
);
/**
* Checks whether an extension is handled by the current reader.
* returns true is the extension is handled, false otherwise
*
* \param extension The extension to be checked
**/
virtual
bool
acceptsExtension
(
const
std
::
string
&
extension
);
/// functions to set the property of the readers
virtual
void
setURL
(
StringProperty
p_url
);
...
...
modules/io/processors/genericimagereader.cpp
View file @
7e1f1e13
...
...
@@ -69,16 +69,14 @@ namespace campvis {
}
}
void
GenericImageReader
::
process
(
DataContainer
&
data
)
{
for
(
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
iterator
it
=
this
->
_readers
.
begin
();
it
!=
this
->
_readers
.
end
();
it
++
)
{
if
((
it
->
first
)
->
acceptsExtension
(
this
->
_ext
))
{
if
(
nullptr
!=
this
->
_currentlyVisible
)
{
this
->
_currentlyVisible
->
setVisible
(
false
);
}
(
it
->
second
)
->
setVisible
(
true
);
this
->
_currentlyVisible
=
it
->
second
;
(
it
->
first
)
->
process
(
data
);
break
;
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
iterator
it
=
std
::
find_if
(
this
->
_readers
.
begin
(),
this
->
_readers
.
end
(),
checkExt
(
this
->
_ext
));
if
(
it
!=
this
->
_readers
.
end
())
{
if
(
nullptr
!=
this
->
_currentlyVisible
)
{
this
->
_currentlyVisible
->
setVisible
(
false
);
}
(
it
->
second
)
->
setVisible
(
true
);
this
->
_currentlyVisible
=
it
->
second
;
(
it
->
first
)
->
process
(
data
);
}
return
;
}
...
...
@@ -91,11 +89,9 @@ namespace campvis {
this
->
_ext
=
url
.
substr
(
extPos
);
}
for
(
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
iterator
it
=
this
->
_readers
.
begin
();
it
!=
this
->
_readers
.
end
();
it
++
)
{
if
((
it
->
first
)
->
acceptsExtension
(
this
->
_ext
))
{
(
it
->
first
)
->
p_url
.
setValue
(
this
->
p_url
.
getValue
());
break
;
}
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
iterator
it
=
std
::
find_if
(
this
->
_readers
.
begin
(),
this
->
_readers
.
end
(),
checkExt
(
this
->
_ext
));
if
(
it
!=
this
->
_readers
.
end
())
{
(
it
->
first
)
->
p_url
.
setValue
(
this
->
p_url
.
getValue
());
}
return
;
}
...
...
@@ -109,14 +105,12 @@ namespace campvis {
}
void
GenericImageReader
::
setTargetImageId
(
DataNameProperty
&
targetImageId
)
{
for
(
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
iterator
it
=
this
->
_readers
.
begin
();
it
!=
this
->
_readers
.
end
();
it
++
)
{
if
((
it
->
first
)
->
acceptsExtension
(
this
->
_ext
))
{
(
it
->
first
)
->
p_targetImageID
.
setValue
(
targetImageId
.
getValue
());
std
::
set
<
AbstractProperty
*>
sharedProperties
=
targetImageId
.
getSharedProperties
();
for
(
std
::
set
<
AbstractProperty
*>::
iterator
jt
=
sharedProperties
.
begin
();
jt
!=
sharedProperties
.
end
();
jt
++
)
{
(
it
->
first
)
->
p_targetImageID
.
addSharedProperty
(
*
jt
);
}
break
;
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
iterator
it
=
std
::
find_if
(
this
->
_readers
.
begin
(),
this
->
_readers
.
end
(),
checkExt
(
this
->
_ext
));
if
(
it
!=
this
->
_readers
.
end
())
{
(
it
->
first
)
->
p_targetImageID
.
setValue
(
targetImageId
.
getValue
());
std
::
set
<
AbstractProperty
*>
sharedProperties
=
targetImageId
.
getSharedProperties
();
for
(
std
::
set
<
AbstractProperty
*>::
iterator
jt
=
sharedProperties
.
begin
();
jt
!=
sharedProperties
.
end
();
jt
++
)
{
(
it
->
first
)
->
p_targetImageID
.
addSharedProperty
(
*
jt
);
}
}
return
;
...
...
@@ -126,21 +120,17 @@ namespace campvis {
return
this
->
setTargetImageId
(
std
::
string
(
imageId
));
}
void
GenericImageReader
::
setTargetImageId
(
std
::
string
imageId
)
{
for
(
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
iterator
it
=
this
->
_readers
.
begin
();
it
!=
this
->
_readers
.
end
();
it
++
)
{
if
((
it
->
first
)
->
acceptsExtension
(
this
->
_ext
))
{
(
it
->
first
)
->
p_targetImageID
.
setValue
(
imageId
);
break
;
}
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
iterator
it
=
std
::
find_if
(
this
->
_readers
.
begin
(),
this
->
_readers
.
end
(),
checkExt
(
this
->
_ext
));
if
(
it
!=
this
->
_readers
.
end
())
{
(
it
->
first
)
->
p_targetImageID
.
setValue
(
imageId
);
}
return
;
}
void
GenericImageReader
::
setTargetImageIdSharedProperty
(
DataNameProperty
*
sharedProperty
)
{
for
(
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
iterator
it
=
this
->
_readers
.
begin
();
it
!=
this
->
_readers
.
end
();
it
++
)
{
if
((
it
->
first
)
->
acceptsExtension
(
this
->
_ext
))
{
(
it
->
first
)
->
p_targetImageID
.
addSharedProperty
(
sharedProperty
);
break
;
}
std
::
map
<
AbstractImageReader
*
,
MetaProperty
*>::
iterator
it
=
std
::
find_if
(
this
->
_readers
.
begin
(),
this
->
_readers
.
end
(),
checkExt
(
this
->
_ext
));
if
(
it
!=
this
->
_readers
.
end
())
{
(
it
->
first
)
->
p_targetImageID
.
addSharedProperty
(
sharedProperty
);
}
return
;
}
...
...
modules/io/processors/genericimagereader.h
View file @
7e1f1e13
...
...
@@ -111,6 +111,15 @@ namespace campvis {
};
struct
checkExt
{
checkExt
(
std
::
string
str
)
:
_str
(
str
)
{}
bool
operator
()(
const
std
::
pair
<
AbstractImageReader
*
,
MetaProperty
*>&
v
)
const
{
return
v
.
first
->
acceptsExtension
(
this
->
_str
);
}
private:
std
::
string
_str
;
};
}
#endif // GENERICIMAGEREADER_H__
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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