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
273
Issues
273
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
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
f2e9fc6f
Commit
f2e9fc6f
authored
Mar 13, 2013
by
Otmane Lahlou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH: take into account the search text when adding item to the tree
parent
4036c794
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
102 additions
and
30 deletions
+102
-30
Code/Common/Gui/mvdApplicationsToolBox.cxx
Code/Common/Gui/mvdApplicationsToolBox.cxx
+96
-30
Code/Common/Gui/mvdApplicationsToolBox.h
Code/Common/Gui/mvdApplicationsToolBox.h
+6
-0
No files found.
Code/Common/Gui/mvdApplicationsToolBox.cxx
View file @
f2e9fc6f
...
...
@@ -84,6 +84,10 @@ ApplicationsToolBox
SIGNAL
(
itemDoubleClicked
(
QTreeWidgetItem
*
,
int
)
),
this
,
SLOT
(
OnAlgorithmTreeDoubleClick
(
QTreeWidgetItem
*
,
int
)
)
);
SIGNAL
(
itemDoubleClicked
(
QTreeWidgetItem
*
,
int
)
),
this
,
SLOT
(
OnAlgorithmTreeDoubleClick
(
QTreeWidgetItem
*
,
int
)
)
);
}
...
...
@@ -109,47 +113,109 @@ ApplicationsToolBox
//
// clear algorithms tree
GetAlgorithmsTree
()
->
clear
();
//
// main item (title)
QTreeWidgetItem
*
mainItem
=
new
QTreeWidgetItem
(
GetAlgorithmsTree
()
);
mainItem
->
setText
(
0
,
"Orfeo Toolbox Algorithms"
);
//
// Fill the map as following
if
(
m_AppTags
.
size
()
>
0
)
{
//
// main item (title)
QTreeWidgetItem
*
mainItem
=
new
QTreeWidgetItem
(
GetAlgorithmsTree
()
);
mainItem
->
setText
(
0
,
tr
(
"Orfeo Toolbox Algorithms"
));
mainItem
->
setExpanded
(
!
m_SearchText
.
isEmpty
()
);
//
// iterate on map: key as high-level item / algorithms as lower-level items
// - key -> tag
// - value -> list of applications having this tag
ApplicationsTagContainer
::
const_iterator
itTag
=
m_AppTags
.
begin
();
while
(
itTag
!=
m_AppTags
.
end
()
)
{
//
// step #1 -> DocTag is a main item
QTreeWidgetItem
*
cmainItem
=
new
QTreeWidgetItem
(
mainItem
);
QString
qcurrentMainItem
(
(
*
itTag
).
first
.
c_str
()
);
cmainItem
->
setText
(
0
,
qcurrentMainItem
);
ApplicationsTagContainer
::
const_iterator
itTag
=
m_AppTags
.
begin
();
while
(
itTag
!=
m_AppTags
.
end
()
)
{
//
// current Doctag name
QString
qcurrentTag
(
(
*
itTag
).
first
.
c_str
()
);
// If a current tag applicaton name match the searcText, add the
// tag as an item to the tree
if
(
m_SearchText
.
isEmpty
()
||
IsSearchTextMatchAnyAlgorithm
(
qcurrentTag
)
)
{
//
// step #1 -> DocTag is a main item
QTreeWidgetItem
*
cmainItem
=
new
QTreeWidgetItem
(
mainItem
);
cmainItem
->
setText
(
0
,
qcurrentTag
);
cmainItem
->
setExpanded
(
!
m_SearchText
.
isEmpty
()
);
//
// TODO : add category icon
//
// step #2 -> Add algorithms name if matching the sear
StringVector
::
const_iterator
itApps
=
(
*
itTag
).
second
.
begin
();
while
(
itApps
!=
(
*
itTag
).
second
.
end
()
)
{
// get current app name
QString
qcurrentAlg
(
(
*
itApps
).
c_str
()
);
// does the current algorithm match the search text
if
(
m_SearchText
.
isEmpty
()
||
qcurrentAlg
.
contains
(
m_SearchText
,
Qt
::
CaseInsensitive
)
)
{
//
// set current application name as secondary item
QTreeWidgetItem
*
secItem
=
new
QTreeWidgetItem
(
cmainItem
);
secItem
->
setText
(
0
,
qcurrentAlg
);
//
// TODO : add algorithm icon
}
++
itApps
;
}
}
++
itTag
;
}
//
// TODO : add category icon
}
}
//
// step #2 -> Applications name are secondary items
/*******************************************************************************/
bool
ApplicationsToolBox
::
IsSearchTextMatchAnyAlgorithm
(
const
QString
&
tagName
)
{
bool
res
=
false
;
// find the pair corresponding to the tagName
ApplicationsTagContainer
::
const_iterator
itTag
=
m_AppTags
.
find
(
ToStdString
(
tagName
)
);
if
(
itTag
!=
m_AppTags
.
end
()
)
{
// iterate on the alg names relative to this tag
StringVector
::
const_iterator
itApps
=
(
*
itTag
).
second
.
begin
();
while
(
itApps
!=
(
*
itTag
).
second
.
end
()
)
{
//
// set current application name as secondary item
QTreeWidgetItem
*
secItem
=
new
QTreeWidgetItem
(
cmainItem
);
QString
qcurrentSecItem
(
(
*
itApps
).
c_str
()
);
secItem
->
setText
(
0
,
qcurrentSecItem
);
//
// TODO : add algorithm icon
// get current app name
QString
qcurrentAlgItem
(
(
*
itApps
).
c_str
()
);
if
(
qcurrentAlgItem
.
contains
(
m_SearchText
,
Qt
::
CaseInsensitive
)
)
{
return
true
;
}
++
itApps
;
}
++
itTag
;
}
return
res
;
}
/*******************************************************************************/
void
ApplicationsToolBox
::
ExecuteAlgorithm
(
const
QString
&
appName
)
{
//
// WIP
std
::
cout
<<
"ApplicationsToolBox::ExecuteAlgorithm - "
<<
ToStdString
(
appName
)
<<
"- WIP."
<<
std
::
endl
;
}
/*******************************************************************************/
...
...
@@ -193,8 +259,8 @@ ApplicationsToolBox
::
OnAlgorithmTreeDoubleClick
(
QTreeWidgetItem
*
item
,
int
column
)
{
//
// Execute algorithm
only if a secondary item
//
lower-level items (algorithms)
does not any child
// Execute algorithm
: check if the
//
item is low-level ->
does not any child
if
(
item
->
childCount
()
==
0
)
{
QString
appName
=
item
->
text
(
column
);
...
...
Code/Common/Gui/mvdApplicationsToolBox.h
View file @
f2e9fc6f
...
...
@@ -137,6 +137,12 @@ private:
*/
void
ExecuteAlgorithm
(
const
QString
&
appName
);
/**
* \brief Helper method to check if searchText matches any of the
* algorithms string contained in the map
*/
bool
IsSearchTextMatchAnyAlgorithm
(
const
QString
&
tagName
);
//
// Private attributes.
private:
...
...
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