Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ISIS3
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
aflab
astrogeology
ISIS3
Commits
4d7ef35c
Unverified
Commit
4d7ef35c
authored
3 months ago
by
Amy Stamile
Committed by
GitHub
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
remove the need to specify model and plugin (#5729)
parent
75682c16
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
isis/src/base/apps/csminit/csminit.cpp
+54
-4
54 additions, 4 deletions
isis/src/base/apps/csminit/csminit.cpp
isis/tests/FunctionalTestsCsminit.cpp
+2
-20
2 additions, 20 deletions
isis/tests/FunctionalTestsCsminit.cpp
with
57 additions
and
24 deletions
CHANGELOG.md
+
1
−
0
View file @
4d7ef35c
...
@@ -42,6 +42,7 @@ ctest FunctionalTestJigsawApollo to validate this output. [#5710](https://github
...
@@ -42,6 +42,7 @@ ctest FunctionalTestJigsawApollo to validate this output. [#5710](https://github
-
Added support for reading, writing, and viewing GeoTIFFs in ISIS.
[
#5618
](
https://github.com/DOI-USGS/ISIS3/pull/5618
)
-
Added support for reading, writing, and viewing GeoTIFFs in ISIS.
[
#5618
](
https://github.com/DOI-USGS/ISIS3/pull/5618
)
### Changed
### Changed
-
Enhanced csminit by removing the need to specify model and plugin
[
#5585
](
https://github.com/DOI-USGS/ISIS3/issues/5585
)
### Fixed
### Fixed
-
Fixed kaguyatc2isis invalid BandBin values
[
#5629
](
https://github.com/DOI-USGS/ISIS3/issues/5629
)
-
Fixed kaguyatc2isis invalid BandBin values
[
#5629
](
https://github.com/DOI-USGS/ISIS3/issues/5629
)
...
...
This diff is collapsed.
Click to expand it.
isis/src/base/apps/csminit/csminit.cpp
+
54
−
4
View file @
4d7ef35c
...
@@ -169,12 +169,62 @@ namespace Isis {
...
@@ -169,12 +169,62 @@ namespace Isis {
buffer
<<
file
.
rdbuf
();
buffer
<<
file
.
rdbuf
();
QString
stateString
=
QString
::
fromStdString
(
buffer
.
str
());
QString
stateString
=
QString
::
fromStdString
(
buffer
.
str
());
if
(
!
ui
.
WasEntered
(
"PLUGINNAME"
)
&&
!
ui
.
WasEntered
(
"MODELNAME"
))
{
QList
<
QStringList
>
possibleModels
;
QString
message
=
"When using a State string, PLUGINNAME and MODELNAME must be specified"
;
for
(
const
csm
::
Plugin
*
plugin
:
csm
::
Plugin
::
getList
())
{
QString
currentPluginName
=
QString
::
fromStdString
(
plugin
->
getPluginName
());
if
(
ui
.
WasEntered
(
"PLUGINNAME"
)
&&
currentPluginName
!=
ui
.
GetString
(
"PLUGINNAME"
))
{
continue
;
}
for
(
size_t
modelIndex
=
0
;
modelIndex
<
plugin
->
getNumModels
();
modelIndex
++
)
{
QString
currentModelName
=
QString
::
fromStdString
(
plugin
->
getModelName
(
modelIndex
));
if
(
ui
.
WasEntered
(
"MODELNAME"
)
&&
currentModelName
!=
ui
.
GetString
(
"MODELNAME"
))
{
continue
;
}
if
(
plugin
->
canModelBeConstructedFromState
(
currentModelName
.
toStdString
(),
stateString
.
toStdString
())){
QStringList
modelSpec
=
{
currentPluginName
,
currentModelName
};
possibleModels
.
append
(
modelSpec
);
continue
;
}
}
}
if
(
possibleModels
.
size
()
>
1
)
{
QString
message
=
"Multiple models can be created from the State ["
+
stateFilePath
.
toString
()
+
"]. "
"Re-run with the PLUGINNAME and MODELNAME parameters. "
"Possible plugin & model names:
\n
"
;
for
(
const
QStringList
&
modelSpec
:
possibleModels
)
{
message
+=
"Plugin ["
+
modelSpec
[
0
]
+
"], Model ["
+
modelSpec
[
1
]
+
"]
\n
"
;
}
throw
IException
(
IException
::
User
,
message
,
_FILEINFO_
);
}
if
(
possibleModels
.
empty
())
{
QString
message
=
"No loaded model could be created from the State ["
+
stateFilePath
.
toString
()
+
"]."
"Loaded plugin & model names:
\n
"
;
for
(
const
csm
::
Plugin
*
plugin
:
csm
::
Plugin
::
getList
())
{
QString
currentPluginName
=
QString
::
fromStdString
(
plugin
->
getPluginName
());
for
(
size_t
modelIndex
=
0
;
modelIndex
<
plugin
->
getNumModels
();
modelIndex
++
)
{
QString
modelName
=
QString
::
fromStdString
(
plugin
->
getModelName
(
modelIndex
));
message
+=
"Plugin ["
+
currentPluginName
+
"], Model ["
+
modelName
+
"]
\n
"
;
}
}
throw
IException
(
IException
::
User
,
message
,
_FILEINFO_
);
}
// If we are here, then we have exactly 1 model
QStringList
modelSpec
=
possibleModels
.
front
();
if
(
modelSpec
.
size
()
!=
2
)
{
QString
message
=
"Model specification ["
+
modelSpec
.
join
(
" "
)
+
"] has ["
+
modelSpec
.
size
()
+
"] elements "
"when it should have 2 elements."
;
throw
IException
(
IException
::
Programmer
,
message
,
_FILEINFO_
);
throw
IException
(
IException
::
Programmer
,
message
,
_FILEINFO_
);
}
}
pluginName
=
ui
.
GetString
(
"PLUGINNAME"
)
;
pluginName
=
modelSpec
[
0
]
;
modelName
=
ui
.
GetString
(
"MODELNAME"
)
;
modelName
=
modelSpec
[
1
]
;
const
csm
::
Plugin
*
plugin
=
csm
::
Plugin
::
findPlugin
(
pluginName
.
toStdString
());
const
csm
::
Plugin
*
plugin
=
csm
::
Plugin
::
findPlugin
(
pluginName
.
toStdString
());
if
(
plugin
==
NULL
)
{
if
(
plugin
==
NULL
)
{
...
...
This diff is collapsed.
Click to expand it.
isis/tests/FunctionalTestsCsminit.cpp
+
2
−
20
View file @
4d7ef35c
...
@@ -428,31 +428,13 @@ TEST_F(CSMPluginFixture, CSMInitStateStringFails) {
...
@@ -428,31 +428,13 @@ TEST_F(CSMPluginFixture, CSMInitStateStringFails) {
csminit
(
options
);
csminit
(
options
);
}
}
catch
(
IException
&
e
)
{
catch
(
IException
&
e
)
{
EXPECT_THAT
(
e
.
what
(),
testing
::
HasSubstr
(
"When using a State string, PLUGINNAME and MODELNAME must be specified"
));
EXPECT_THAT
(
e
.
what
(),
testing
::
HasSubstr
(
"No loaded model could be created from the State"
));
}
QVector
<
QString
>
argsWithModel
=
{
"from="
+
filename
,
"state="
+
statePath
,
"modelname=TestCsmModel"
,
"pluginname=TestCsmPlugin"
};
UserInterface
optionsWithModel
(
APP_XML
,
argsWithModel
);
// Expect a failure due to a bad state string.
try
{
csminit
(
optionsWithModel
);
}
catch
(
IException
&
e
)
{
EXPECT_THAT
(
e
.
what
(),
testing
::
HasSubstr
(
"Could not construct sensor model using STATE string and MODELNAME"
));
}
}
QVector
<
QString
>
argsWithIsdAndState
=
{
QVector
<
QString
>
argsWithIsdAndState
=
{
"from="
+
filename
,
"from="
+
filename
,
"isd=fakePath"
,
"isd=fakePath"
,
"state="
+
statePath
,
"state="
+
statePath
};
"modelname=TestCsmModel"
,
"pluginname=TestCsmPlugin"
};
UserInterface
optionsWithIsdAndState
(
APP_XML
,
argsWithIsdAndState
);
UserInterface
optionsWithIsdAndState
(
APP_XML
,
argsWithIsdAndState
);
...
...
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