Skip to content

Commit

Permalink
Allows CSMCamera to pickup naif target radii
Browse files Browse the repository at this point in the history
  • Loading branch information
acpaquette committed Jan 22, 2024
1 parent 9d7f213 commit 510cf52
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
17 changes: 11 additions & 6 deletions isis/src/base/objs/CSMCamera/CSMCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,18 +651,23 @@ namespace Isis {

/**
* Set the Target object for the camera model.
*
* If no radii can be found in the label from the naif keywords
* use the radii from the csm model
*
* @param label The label containing information to create the Target from
*/
void CSMCamera::setTarget(Pvl label) {
Target *target = new Target(label);

// get radii from CSM
csm::Ellipsoid targetEllipsoid = csm::SettableEllipsoid::getEllipsoid(m_model);
std::vector<Distance> radii = {Distance(targetEllipsoid.getSemiMajorRadius(), Distance::Meters),
Distance(targetEllipsoid.getSemiMajorRadius(), Distance::Meters),
Distance(targetEllipsoid.getSemiMinorRadius(), Distance::Meters)};
target->setRadii(radii);
if (target->radii().size() == 0) {
// get radii from CSM
csm::Ellipsoid targetEllipsoid = csm::SettableEllipsoid::getEllipsoid(m_model);
std::vector<Distance> radii = {Distance(targetEllipsoid.getSemiMajorRadius(), Distance::Meters),
Distance(targetEllipsoid.getSemiMajorRadius(), Distance::Meters),
Distance(targetEllipsoid.getSemiMinorRadius(), Distance::Meters)};
target->setRadii(radii);
}

// Target needs to be able to access the camera to do things like
// compute resolution
Expand Down
12 changes: 12 additions & 0 deletions isis/src/base/objs/Target/Target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ namespace Isis {
QString targetName = inst["TargetName"][0];
setName(targetName);

if (label.hasObject("NaifKeywords")) {
PvlObject naifKeywords = label.findObject("NaifKeywords");
QString m_bodyCode = naifKeywords["BODY_CODE"];
PvlKeyword radiiKey = naifKeywords.findKeyword("BODY" + m_bodyCode + "_RADII");
std::vector<Distance> radii(3, Distance());
radii[0] = Distance(radiiKey[0].toDouble(), Distance::Kilometers);
radii[1] = Distance(radiiKey[1].toDouble(), Distance::Kilometers);
radii[2] = Distance(radiiKey[2].toDouble(), Distance::Kilometers);

setRadii(radii);
}

m_shape = ShapeModelFactory::create(this, label);
}

Expand Down

0 comments on commit 510cf52

Please sign in to comment.