Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
10c2768e
Commit
10c2768e
authored
13 years ago
by
Cyrille Valladeau
Browse files
Options
Downloads
Patches
Plain Diff
ENH: use the new doc generator class to generate the displayed doc
parent
abff47ed
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx
+5
-186
5 additions, 186 deletions
Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx
Code/Wrappers/QtWidget/otbWrapperQtWidgetView.h
+0
-12
0 additions, 12 deletions
Code/Wrappers/QtWidget/otbWrapperQtWidgetView.h
with
5 additions
and
198 deletions
Code/Wrappers/QtWidget/otbWrapperQtWidgetView.cxx
+
5
−
186
View file @
10c2768e
...
...
@@ -24,6 +24,7 @@
#include
"otbWrapperParameterGroup.h"
#include
"otbWrapperChoiceParameter.h"
#include
"otbWrapperQtWidgetSimpleProgressReport.h"
#include
"otbWrapperApplicationHtmlDocGenerator.h"
#include
"itksys/SystemTools.hxx"
...
...
@@ -145,199 +146,17 @@ QWidget* QtWidgetView::CreateDoc()
text
->
setReadOnly
(
true
);
QTextDocument
*
doc
=
new
QTextDocument
();
itk
::
OStringStream
oss
;
oss
<<
"<center><h2>"
<<
m_Application
->
GetDocName
()
<<
"</center></h2>"
;
oss
<<
"<h3>Brief Description</h3>"
;
oss
<<
"<body>"
<<
m_Application
->
GetDescription
()
<<
"</body>"
;
oss
<<
"<h3>Tags</h3>"
;
oss
<<
"<body>"
;
if
(
m_Application
->
GetDocTags
().
size
()
>
0
)
{
for
(
unsigned
int
i
=
0
;
i
<
m_Application
->
GetDocTags
().
size
()
-
1
;
i
++
)
{
oss
<<
m_Application
->
GetDocTags
()[
i
]
<<
", "
;
;
}
oss
<<
m_Application
->
GetDocTags
()[
m_Application
->
GetDocTags
().
size
()
-
1
];
}
oss
<<
"</body>"
;
oss
<<
"<h3>Long Description</h3>"
;
oss
<<
"<body>"
<<
m_Application
->
GetDocLongDescription
()
<<
"</body>"
;
std
::
string
val
;
this
->
SetDocParameters
(
val
);
oss
<<
val
;
oss
<<
"<h3>Limitations</h3>"
;
oss
<<
"<body>"
<<
m_Application
->
GetDocLimitations
()
<<
"</body>"
;
oss
<<
"<h3>Authors</h3>"
;
oss
<<
"<body>"
<<
m_Application
->
GetDocAuthors
()
<<
"</body>"
;
oss
<<
"<h3>See also</h3>"
;
oss
<<
"<body>"
<<
m_Application
->
GetDocSeeAlso
()
<<
"</body>"
;
oss
<<
"<h3>Command line example</h3>"
;
oss
<<
"<code>"
<<
m_Application
->
GetDocCLExample
()
<<
"</code>"
;
doc
->
setHtml
(
oss
.
str
().
c_str
());
text
->
setDocument
(
doc
);
std
::
string
docContain
;
ApplicationHtmlDocGenerator
::
GenerateDoc
(
m_Application
,
docContain
);
doc
->
setHtml
(
docContain
.
c_str
());
//std::cout<<text->toHtml().toStdString()<<std::endl
;
text
->
setDocument
(
doc
)
;
return
text
;
}
void
QtWidgetView
::
SetDocParameters
(
std
::
string
&
val
)
{
const
std
::
vector
<
std
::
string
>
appKeyList
=
m_Application
->
GetParametersKeys
(
false
);
itk
::
OStringStream
oss
;
oss
<<
"<h3>Parameters</h3>"
;
oss
<<
"<ul>"
;
std
::
string
paramDocs
(
""
);
this
->
GetDocParameters
(
paramDocs
);
oss
<<
paramDocs
;
oss
<<
"</ul>"
;
val
.
append
(
oss
.
str
());
}
void
QtWidgetView
::
GetDocParameters
(
std
::
string
&
val
)
{
itk
::
OStringStream
oss
;
const
std
::
vector
<
std
::
string
>
appKeyList
=
m_Application
->
GetParametersKeys
(
false
);
const
unsigned
int
nbOfParam
=
appKeyList
.
size
();
std
::
string
paramDocs
(
""
);
for
(
unsigned
int
i
=
0
;
i
<
nbOfParam
;
i
++
)
{
const
std
::
string
key
(
appKeyList
[
i
]);
Parameter
::
Pointer
param
=
m_Application
->
GetParameterByKey
(
key
);
if
(
m_Application
->
GetParameterType
(
key
)
==
ParameterType_Group
)
{
oss
<<
"<li><b>[group] "
<<
param
->
GetName
()
<<
": </b>"
;
if
(
std
::
string
(
param
->
GetDescription
()).
size
()
!=
0
)
{
oss
<<
param
->
GetDescription
();
}
std
::
string
grDoc
;
GetDocParameterGroup
(
grDoc
,
key
);
oss
<<
grDoc
;
oss
<<
"</li><br />"
;
}
else
if
(
m_Application
->
GetParameterType
(
key
)
==
ParameterType_Choice
)
{
oss
<<
"<li><b> [choice] "
<<
param
->
GetName
()
<<
": </b>"
;
if
(
std
::
string
(
param
->
GetDescription
()).
size
()
!=
0
)
{
oss
<<
param
->
GetDescription
();
}
std
::
string
grDoc
;
GetDocParameterChoice
(
grDoc
,
key
);
oss
<<
grDoc
;
oss
<<
"</li><br />"
;
}
else
{
oss
<<
"<li><b><code>[param] "
<<
param
->
GetName
()
<<
": </code></b>"
;
oss
<<
param
->
GetDescription
()
<<
"</li>"
;
}
}
if
(
oss
.
str
()
==
""
)
oss
<<
"None"
;
val
=
oss
.
str
();
}
void
QtWidgetView
::
GetDocParameterGroup
(
std
::
string
&
val
,
const
std
::
string
&
key
)
{
Parameter
*
paramGr
=
m_Application
->
GetParameterByKey
(
key
);
if
(
!
dynamic_cast
<
ParameterGroup
*>
(
paramGr
))
{
itkGenericExceptionMacro
(
"Invalid parameter type for key "
<<
key
<<
", wait for ParameterGroup..."
);
}
ParameterGroup
*
group
=
dynamic_cast
<
ParameterGroup
*>
(
paramGr
);
const
std
::
vector
<
std
::
string
>
appKeyList
=
group
->
GetParametersKeys
(
false
);
unsigned
int
nbOfParam
=
appKeyList
.
size
();
itk
::
OStringStream
oss
;
oss
<<
"<ul>"
;
for
(
unsigned
int
i
=
0
;
i
<
nbOfParam
;
i
++
)
{
const
std
::
string
fullKey
(
std
::
string
(
key
).
append
(
"."
).
append
(
appKeyList
[
i
]));
Parameter
::
Pointer
param
=
m_Application
->
GetParameterByKey
(
fullKey
);
if
(
m_Application
->
GetParameterType
(
fullKey
)
==
ParameterType_Group
)
{
oss
<<
"<li><b><code>[group] "
<<
param
->
GetName
()
<<
": </code></b>"
;
if
(
std
::
string
(
param
->
GetDescription
()).
size
()
!=
0
)
{
oss
<<
param
->
GetDescription
();
}
std
::
string
grDoc
;
GetDocParameterGroup
(
grDoc
,
fullKey
);
oss
<<
grDoc
;
oss
<<
"</li>"
;
}
else
if
(
m_Application
->
GetParameterType
(
fullKey
)
==
ParameterType_Choice
)
{
oss
<<
"<li><b><code>[choice] "
<<
param
->
GetName
()
<<
": </code></b>"
;
if
(
std
::
string
(
param
->
GetDescription
()).
size
()
!=
0
)
{
oss
<<
param
->
GetDescription
();
}
std
::
string
grDoc
;
GetDocParameterChoice
(
grDoc
,
fullKey
);
oss
<<
grDoc
;
oss
<<
"</li>"
;
}
else
{
oss
<<
"<li><b><code>[param] "
<<
param
->
GetName
()
<<
": </code></b>"
;
oss
<<
param
->
GetDescription
()
<<
"</li>"
;
}
}
oss
<<
"</ul>"
;
val
.
append
(
oss
.
str
());
}
void
QtWidgetView
::
GetDocParameterChoice
(
std
::
string
&
val
,
const
std
::
string
&
key
)
{
Parameter
*
paramCh
=
m_Application
->
GetParameterByKey
(
key
);
if
(
!
dynamic_cast
<
ChoiceParameter
*>
(
paramCh
))
{
itkGenericExceptionMacro
(
"Invalid parameter type for key "
<<
key
<<
", wait for ChoiceParameter..."
);
}
ChoiceParameter
*
choice
=
dynamic_cast
<
ChoiceParameter
*>
(
paramCh
);
const
std
::
vector
<
std
::
string
>
appKeyList
=
choice
->
GetChoiceKeys
();
unsigned
int
nbOfParam
=
choice
->
GetNbChoices
();
itk
::
OStringStream
oss
;
oss
<<
"<ul>"
;
for
(
unsigned
int
i
=
0
;
i
<
nbOfParam
;
i
++
)
{
const
std
::
string
fullKey
(
std
::
string
(
key
).
append
(
"."
).
append
(
appKeyList
[
i
]));
ParameterGroup
*
group
=
choice
->
GetChoiceParameterGroupByIndex
(
i
);
std
::
string
grDoc
;
oss
<<
"<li><b><code>[group] "
<<
group
->
GetName
()
<<
": </code></b>"
;
if
(
std
::
string
(
group
->
GetDescription
()).
size
()
!=
0
)
{
oss
<<
group
->
GetDescription
();
}
GetDocParameterGroup
(
grDoc
,
fullKey
);
oss
<<
grDoc
;
oss
<<
"</li>"
;
}
oss
<<
"</ul>"
;
val
.
append
(
oss
.
str
());
}
void
QtWidgetView
::
CloseSlot
()
{
// Close the widget
...
...
This diff is collapsed.
Click to expand it.
Code/Wrappers/QtWidget/otbWrapperQtWidgetView.h
+
0
−
12
View file @
10c2768e
...
...
@@ -66,18 +66,6 @@ private:
QWidget
*
CreateDoc
();
/** Add the parameter description in the flux of the documentation tab. */
void
SetDocParameters
(
std
::
string
&
val
);
/** Get the parameter description of one parameter. */
void
GetDocParameters
(
std
::
string
&
val
);
/** generate the documentation associated to a group.*/
void
GetDocParameterGroup
(
std
::
string
&
val
,
const
std
::
string
&
key
);
/** generate the documentation associated to a choice.*/
void
GetDocParameterChoice
(
std
::
string
&
val
,
const
std
::
string
&
key
);
Application
::
Pointer
m_Application
;
QtWidgetModel
*
m_Model
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment