本文整理汇总了C++中PvlGroup类的典型用法代码示例。如果您正苦于以下问题:C++ PvlGroup类的具体用法?C++ PvlGroup怎么用?C++ PvlGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PvlGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TranslateLrocNacLabels
//Function to translate the labels
void TranslateLrocNacLabels ( Filename &labelFile, Cube *ocube ) {
//Pvl to store the labels
Pvl outLabel;
//Set up the directory where the translations are
PvlGroup dataDir(Preference::Preferences().FindGroup("DataDirectory"));
iString transDir = (string) dataDir["Lro"] + "/translations/";
Pvl labelPvl(labelFile.Expanded());
//Translate the Instrument group
Filename transFile(transDir + "lronacInstrument.trn");
PvlTranslationManager instrumentXlator(labelPvl, transFile.Expanded());
instrumentXlator.Auto(outLabel);
//Translate the Archive group
transFile = transDir + "lronacArchive.trn";
PvlTranslationManager archiveXlater(labelPvl, transFile.Expanded());
archiveXlater.Auto(outLabel);
// Set up the BandBin groups
PvlGroup bbin("BandBin");
bbin += PvlKeyword("FilterName", "BroadBand");
bbin += PvlKeyword("Center", 0.650, "micrometers");
bbin += PvlKeyword("Width", 0.150, "micrometers");
Pvl lab(labelFile.Expanded());
//Set up the Kernels group
PvlGroup kern("Kernels");
if (lab.FindKeyword("FRAME_ID")[0] == "LEFT")
kern += PvlKeyword("NaifFrameCode", -85600);
else
kern += PvlKeyword("NaifFrameCode", -85610);
PvlGroup inst = outLabel.FindGroup("Instrument", Pvl::Traverse);
if (lab.FindKeyword("FRAME_ID")[0] == "LEFT") {
inst.FindKeyword("InstrumentId") = "NACL";
inst.FindKeyword("InstrumentName") = "LUNAR RECONNAISSANCE ORBITER NARROW ANGLE CAMERA LEFT";
g_flip = false;
}
else {
inst.FindKeyword("InstrumentId") = "NACR";
inst.FindKeyword("InstrumentName") = "LUNAR RECONNAISSANCE ORBITER NARROW ANGLE CAMERA RIGHT";
}
inst += PvlKeyword("SpatialSumming", lab.FindKeyword("CROSSTRACK_SUMMING")[0] );
inst += PvlKeyword("SampleFirstPixel", 0 );
//Add all groups to the output cube
ocube->PutGroup(inst);
ocube->PutGroup(outLabel.FindGroup("Archive", Pvl::Traverse));
ocube->PutGroup(bbin);
ocube->PutGroup(kern);
}
示例2: UpdateBandKey
// Updates existing BandBin keywords with additional values to ensure
// label compilancy (which should support Camera models). It checks for the
// existance of the keyword and uses its (assumed) first value to set nvals
// values to a constant. If the keyword doesn't exist, it uses the default
// value.
void UpdateBandKey(const QString &keyname, PvlGroup &bb, const int &nvals,
const QString &default_value) {
QString defVal(default_value);
if ( bb.hasKeyword(keyname) ) {
defVal = bb[keyname][0];
}
bb.addKeyword(makeKey(keyname, nvals, defVal), PvlContainer::Replace);
return;
}
示例3: PvlGroup
void Stretch::Save(Isis::Pvl &pvl, QString &grpName) {
PvlGroup *grp = new PvlGroup(grpName);
PvlKeyword inputs("Input");
PvlKeyword outputs("Output");
for(int i = 0; i < Pairs(); i++) {
inputs.addValue(toString(Input(i)));
outputs.addValue(toString(Output(i)));
}
grp->addKeyword(inputs);
grp->addKeyword(outputs);
pvl.addGroup(*grp);
}
示例4: Load
/**
* Loads the stretch pairs from the pvl file into the Stretch
* object. The pvl should look similar to this:
* @code
* Group = Pairs
* Input = (0,100,255)
* Output = (255,100,0)
* EndGroup
* @endcode
*
* @param pvl - The pvl containing the stretch pairs
* @param grpName - The group name to get the input and output
* keywords from
*/
void Stretch::Load(Isis::Pvl &pvl, QString &grpName) {
PvlGroup grp = pvl.findGroup(grpName, Isis::PvlObject::Traverse);
PvlKeyword inputs = grp.findKeyword("Input");
PvlKeyword outputs = grp.findKeyword("Output");
if(inputs.size() != outputs.size()) {
QString msg = "Invalid Pvl file: The number of Input values must equal the number of Output values";
throw IException(IException::User, msg, _FILEINFO_);
}
for(int i = 0; i < inputs.size(); i++) {
AddPair(toDouble(inputs[i]), toDouble(outputs[i]));
}
}
示例5: ReadDefFile
/**
* Reads the DefFile having info about the different filters to
* be used on the Control Network.
*
* @author Sharmila Prasad (9/7/2010)
*
* @param pcNetFilter
* @param pvlDefFile
*/
void ReadDefFile(ControlNetFilter & pcNetFilter, Pvl & pvlDefFile)
{
// prototype to ControlNetFilter member function
void (ControlNetFilter::*pt2Filter)(const PvlGroup & pvlGrp, bool pbLastFilter);
// Parse the Groups in Point Object
PvlObject filtersObj = pvlDefFile.findObject("Filters", Pvl::Traverse);
int iNumGroups = filtersObj.groups();
for (int i=0; i<iNumGroups; i++) {
PvlGroup pvlGrp = filtersObj.group(i);
// Get the pointer to ControlNetFilter member function based on Group name
pt2Filter=GetPtr2Filter(pvlGrp.name());
if (pt2Filter != NULL) {
(pcNetFilter.*pt2Filter)(pvlGrp, ((i==(iNumGroups-1)) ? true : false));
}
}
}
示例6:
//! Constructs a HiLab Object
HiLab::HiLab(Cube *cube){
PvlGroup group = cube->GetGroup("Instrument");
p_cpmmNumber = group["CpmmNumber"];
p_channel = group["ChannelNumber"];
if (group.HasKeyword("Summing")) {
p_bin = group["Summing"];
}
else {
std::string msg = "Cannot find required Summing keyword in label";
throw Isis::iException::Message(Isis::iException::Io,msg,_FILEINFO_);
}
if (group.HasKeyword("Tdi")) {
p_tdi = group["Tdi"];
}
else {
std::string msg = "Cannot find required Tdi keyword in label";
throw Isis::iException::Message(Isis::iException::Io,msg,_FILEINFO_);
}
}
示例7: PvlCalStats
/**
* @brief Writes data specific to calibration statistics in Pvl Format
*
* This method is a compartmentalization of the writing of the contents of
* a HiImageClean object.
*
* This method dumps the calibration statistics computed from the HiRISE
* cube specifed on construction or through the load methods.
*/
void HiImageClean::PvlCalStats(PvlGroup &grp) const {
grp.SetName("CalibrationStatistics");
grp += PvlKeyword("Binning",_binning);
grp += PvlKeyword("TDI",_tdi);
grp += PvlKeyword("CPMM",_cpmm);
grp += PvlKeyword("Channel",_channelNo);
grp += PvlKeyword("FirstImageSample",_firstImageSample);
grp += PvlKeyword("FirstImageLine",_firstImageLine);
grp += PvlKeyword("FirstBufferSample",_firstBufferSample);
grp += PvlKeyword("FirstDarkSample",_firstDarkSample);
grp += PvlKeyword("MaskInducedNulls", _totalMaskNulled);
grp += PvlKeyword("DarkInducedNulls", _totalDarkNulled);
grp += PvlKeyword("LastGoodLine",_lastGoodLine+1);
}
示例8: Angle
/**
* Create and initialize a Latitude value using the mapping group's latitude
* units and radii.
*
* @see ErrorChecking
* @see CoordinateType
* @param latitude The latitude value this instance will represent,
* in the mapping group's units
* @param mapping A mapping group
* @param latitudeUnits The angular units of the latitude value (degs, rads)
* @param errors Error checking conditions
*/
Latitude::Latitude(double latitude,
PvlGroup mapping,
Angle::Units latitudeUnits,
ErrorChecking errors) : Angle(latitude, latitudeUnits) {
m_equatorialRadius = NULL;
m_polarRadius = NULL;
if (mapping.hasKeyword("EquatorialRadius") && mapping.hasKeyword("PolarRadius")) {
m_equatorialRadius = new Distance(toDouble(mapping["EquatorialRadius"][0]),
Distance::Meters);
m_polarRadius = new Distance(toDouble(mapping["PolarRadius"][0]),
Distance::Meters);
}
else {
PvlGroup radiiGrp = TProjection::TargetRadii(mapping["TargetName"]);
m_equatorialRadius = new Distance(toDouble(radiiGrp["EquatorialRadius"][0]),
Distance::Meters);
m_polarRadius = new Distance(toDouble(radiiGrp["PolarRadius"][0]),
Distance::Meters);
}
m_errors = errors;
if(mapping["LatitudeType"][0] == "Planetographic") {
setPlanetographic(latitude, latitudeUnits);
}
else if(mapping["LatitudeType"][0] == "Planetocentric") {
setPlanetocentric(latitude, latitudeUnits);
}
else {
IString msg = "Latitude type [" + IString(mapping["LatitudeType"][0]) +
"] is not recognized";
throw IException(IException::Programmer, msg, _FILEINFO_);
}
}
示例9: GetCCD_Channel_Coefficients
/**
* With the Channel, CCD in the isis label, find the coefficient values
* for this image
*
* @author Sharmila Prasad (11/24/2010)
*
* @param pCubeLabel
*/
void GetCCD_Channel_Coefficients(Pvl & pCubeLabel)
{
int iChannel=-1, iSumming=-1;
QString sCcd="";
PvlGroup instrGrp = pCubeLabel.findObject("IsisCube").findGroup("Instrument");
// Summing keyword
if (!instrGrp.hasKeyword("Summing")) {
QString sMsg = "Summing keyword not found";
throw IException(IException::User, sMsg, _FILEINFO_);
}
else {
PvlKeyword binKey = instrGrp.findKeyword("Summing");
iSumming = toInt(binKey[0]);
if (iSumming != 1 && iSumming != 2 && iSumming != 4) {
QString sMsg = "Invalid Summing value in input file, must be 1,2,or 4";
throw IException(IException::User, sMsg, _FILEINFO_);
}
}
// CCD Keyword
if (!instrGrp.hasKeyword("CcdId")) {
QString sMsg = "CcdId keyword not found";
throw IException(IException::User, sMsg, _FILEINFO_);
}
else {
PvlKeyword ccdKey = instrGrp.findKeyword("CcdId");
sCcd = ccdKey[0];
}
// Channel Keyword
if (!instrGrp.hasKeyword("ChannelNumber")) {
QString sMsg = "ChannelNumber keyword not found";
throw IException(IException::User, sMsg, _FILEINFO_);
}
else {
PvlKeyword channelKey = instrGrp.findKeyword("ChannelNumber");
iChannel = toInt(channelKey[0]);
}
// Get the coefficient file name
QString dCoeffFile = "$mro/calibration/HiRISE_Gain_Drift_Correction_Bin" + toString(iSumming) + ".0001.csv";
//QString dCoeffFile = "/home/sprasad/isis3/isis/src/mro/apps/hicalproc/HiRISE_Gain_Drift_Correction_Bin" + toString(iSumming) + ".0001.csv";
#ifdef _DEBUG_
cout << dCoeffFile << endl;
#endif
// Get the coefficients
ReadCoefficientFile(FileName(dCoeffFile).expanded(), sCcd, iChannel);
}
示例10: PvlImageStats
/**
* @brief Writes data specific to image statistics out in Pvl format
*
* This method creates a PvlGroup containing the image statistics
* acculated during line-by-line processing of raw image data.
*/
void HiImageClean::PvlImageStats(PvlGroup &grp) const {
grp.SetName("ImageStatistics");
grp += PvlKeyword("File",_filename.Name());
grp += PvlKeyword("Lines",_lines);
grp += PvlKeyword("Samples",_samples);
BigInt nBad = _maskStats.TotalPixels() - _maskStats.ValidPixels();
grp += PvlKeyword("MaskAverage", _maskStats.Average());
grp += PvlKeyword("MaskStdDev", _maskStats.StandardDeviation());
grp += PvlKeyword("BadMaskPixels", nBad);
grp += PvlKeyword("MaskInducedNulls", _totalMaskNulled);
nBad = _darkStats.TotalPixels() - _darkStats.ValidPixels();
grp += PvlKeyword("DarkAverage", _darkStats.Average());
grp += PvlKeyword("DarkStdDev", _darkStats.StandardDeviation());
grp += PvlKeyword("BadDarkPixels", nBad);
grp += PvlKeyword("DarkInducedNulls", _totalDarkNulled);
}
示例11: IsisMain
void IsisMain() {
// We will be processing by brick
ProcessByBrick p;
Isis::Cube *amatrixCube=NULL;
Isis::Cube *bmatrixCube=NULL;
// Setup the user input for the input/output files and the option
UserInterface &ui = Application::GetUserInterface();
// Setup the input HiRise cube
Isis::Cube *icube = p.SetInputCube("FROM");
if (icube->Bands() != 1) {
std::string msg = "Only single-band HiRise cubes can be calibrated";
throw Isis::iException::Message(Isis::iException::Io,msg,_FILEINFO_);
}
//Get pertinent label information to determine which band of matrix cube to use
HiLab hilab(icube);
int ccd = hilab.getCcd();
int channel = hilab.getChannel();
if (channel != 0 && channel != 1) {
std::string msg = "Only unstitched cubes can be calibrated";
throw Isis::iException::Message(Isis::iException::Io,msg,_FILEINFO_);
}
int band = 1 + ccd*2 + channel;
string option = ui.GetString("OPTION");
// Set attributes (input band number) for the matrix cube(s);
CubeAttributeInput att("+" + iString(band));
// Determine the file specification to the matrix file(s) if defaulted
// and open
if (ui.WasEntered ("MATRIX") ) {
if (option == "GAIN") {
string matrixFile = ui.GetFilename("MATRIX");
amatrixCube = p.SetInputCube(matrixFile, att);
}
else if (option == "OFFSET") {
string matrixFile = ui.GetFilename("MATRIX");
bmatrixCube = p.SetInputCube(matrixFile, att);
}
else { //(option == "BOTH")
std::string
msg = "The BOTH option cannot be used if a MATRIX is entered";
throw Isis::iException::Message(Isis::iException::Io,msg,_FILEINFO_);
}
}
else {
int tdi = hilab.getTdi();
int bin = hilab.getBin();
if (option == "OFFSET" || option == "BOTH") {
std::string bmatrixFile = "$mro/calibration";
bmatrixFile += "/B_matrix_tdi";
bmatrixFile += iString(tdi) + "_bin" + iString(bin);
bmatrixCube = p.SetInputCube(bmatrixFile, att);
}
if (option == "GAIN" || option == "BOTH") {
std::string amatrixFile = "$mro/calibration";
amatrixFile += "/A_matrix_tdi";
amatrixFile += iString(tdi) + "_bin" + iString(bin);
amatrixCube = p.SetInputCube(amatrixFile, att);
}
}
// Open the output file and set processing parameters
Cube *ocube = p.SetOutputCube ("TO");
p.SetWrap (true);
p.SetBrickSize ( icube->Samples(), 1, 1);
// Add the radiometry group if it is not there yet. Otherwise
// read the current value of the keyword CalibrationParameters.
// Then delete the keyword and rewrite it after appending the
// new value to it. Do it this way to avoid multiple Calibration
// Parameter keywords.
PvlGroup calgrp;
PvlKeyword calKey;
if (ocube->HasGroup("Radiometry")) {
calgrp = ocube->GetGroup ("Radiometry");
if (calgrp.HasKeyword("CalibrationParameters")) {
calKey = calgrp.FindKeyword("CalibrationParameters");
calgrp.DeleteKeyword( "CalibrationParameters" );
}
else {
calKey.SetName ("CalibrationParameters");
}
}
else {
calgrp.SetName("Radiometry");
calKey.SetName ("CalibrationParameters");
}
//.........这里部分代码省略.........
示例12: dataDir
/**
* Get Groups by translating from correct Translation table
*
* @param label A pvl formatted label to be used to generate the serial number
*/
PvlGroup ObservationNumber::FindObservationTranslation(Pvl &label) {
Pvl outLabel;
static PvlGroup dataDir(Preference::Preferences().findGroup("DataDirectory"));
// Get the mission name
static QString missionTransFile = (QString) dataDir["base"] + "/translations/MissionName2DataDir.trn";
static PvlTranslationManager missionXlater(missionTransFile);
missionXlater.SetLabel(label);
QString mission = missionXlater.Translate("MissionName");
// Get the instrument name
static QString instTransFile = (QString) dataDir["base"] + "/translations/Instruments.trn";
static PvlTranslationManager instrumentXlater(instTransFile);
instrumentXlater.SetLabel(label);
QString instrument = instrumentXlater.Translate("InstrumentName");
// We want to use this instrument's translation manager. It's much faster for
// ObservationNumberList if we keep the translation manager in memory, so re-reading
// from the disk is not necessary every time. To do this, we'll use a map to store
// the translation managers and observation number keys with a string identifier to find them.
// This identifier needs to have the mission name and the instrument name.
static std::map<QString, std::pair<PvlTranslationManager, PvlKeyword> > missionTranslators;
QString key = mission + "_" + instrument;
std::map<QString, std::pair<PvlTranslationManager, PvlKeyword> >::iterator
translationIterator = missionTranslators.find(key);
if(translationIterator == missionTranslators.end()) {
// Get the file
FileName snFile((QString) dataDir[mission] + "/translations/" +
instrument + "SerialNumber????.trn");
snFile = snFile.highestVersion();
// Delets the extra
Pvl translation(snFile.expanded());
PvlKeyword observationKeys;
if(translation.hasKeyword("ObservationKeys")) {
observationKeys = translation["ObservationKeys"];
}
// use the translation file to generate keywords
missionTranslators.insert(
std::pair<QString, std::pair<PvlTranslationManager, PvlKeyword> >
(key, std::pair<PvlTranslationManager, PvlKeyword>(PvlTranslationManager(snFile.expanded()), observationKeys))
);
translationIterator = missionTranslators.find(key);
}
translationIterator->second.first.SetLabel(label);
translationIterator->second.first.Auto(outLabel);
PvlGroup snGroup = outLabel.findGroup("SerialNumberKeywords");
// Delets the extra
if(!translationIterator->second.second.name().isEmpty()) {
snGroup += translationIterator->second.second;
}
else {
snGroup += PvlKeyword("ObservationKeys", toString(snGroup.keywords()));
}
return snGroup;
}
示例13: Latitude
/**
* Find the lat/lon range of the image. This will use the image footprint,
* camera, or projection in order to find a good result.
*
* @param Cube* This is required for estimation. You can pass in NULL (it will
* disable estimation).
* @param minLat This is an output: minimum latitude
* @param maxLat This is an output: maximum latitude
* @param minLon This is an output: minimum longitude
* @param maxLon This is an output: maximum longitude
* @param allowEstimation If this is true then extra efforts will be made to
* guess the ground range of the input. This can still fail.
* @return True if a ground range was found, false if no ground range could
* be determined. Some lat/lon results may still be populated; their
* values are undefined.
*/
bool UniversalGroundMap::GroundRange(Cube *cube, Latitude &minLat,
Latitude &maxLat, Longitude &minLon, Longitude &maxLon,
bool allowEstimation) {
// Do we need a RingRange method?
// For now just return false
if (HasCamera())
if (p_camera->target()->shape()->name() == "Plane") return false;
if (HasProjection())
if (p_projection->projectionType() == Projection::RingPlane) return false;
minLat = Latitude();
maxLat = Latitude();
minLon = Longitude();
maxLon = Longitude();
// If we have a footprint, use it
try {
if (cube) {
ImagePolygon poly;
cube->read(poly);
geos::geom::MultiPolygon *footprint = PolygonTools::MakeMultiPolygon(
poly.Polys()->clone());
geos::geom::Geometry *envelope = footprint->getEnvelope();
geos::geom::CoordinateSequence *coords = envelope->getCoordinates();
for (unsigned int i = 0; i < coords->getSize(); i++) {
const geos::geom::Coordinate &coord = coords->getAt(i);
Latitude coordLat(coord.y, Angle::Degrees);
Longitude coordLon(coord.x, Angle::Degrees);
if (!minLat.isValid() || minLat > coordLat)
minLat = coordLat;
if (!maxLat.isValid() || maxLat < coordLat)
maxLat = coordLat;
if (!minLon.isValid() || minLon > coordLon)
minLon = coordLon;
if (!maxLon.isValid() || maxLon < coordLon)
maxLon = coordLon;
}
delete coords;
coords = NULL;
delete envelope;
envelope = NULL;
delete footprint;
footprint = NULL;
}
}
catch (IException &) {
}
if (!minLat.isValid() || !maxLat.isValid() ||
!minLon.isValid() || !maxLon.isValid()) {
if (HasCamera()) {
// Footprint failed, ask the camera
PvlGroup mappingGrp("Mapping");
mappingGrp += PvlKeyword("LatitudeType", "Planetocentric");
mappingGrp += PvlKeyword("LongitudeDomain", "360");
mappingGrp += PvlKeyword("LongitudeDirection", "PositiveEast");
Pvl mappingPvl;
mappingPvl += mappingGrp;
double minLatDouble;
double maxLatDouble;
double minLonDouble;
double maxLonDouble;
p_camera->GroundRange(
minLatDouble, maxLatDouble,
minLonDouble, maxLonDouble, mappingPvl);
minLat = Latitude(minLatDouble, Angle::Degrees);
maxLat = Latitude(maxLatDouble, Angle::Degrees);
minLon = Longitude(minLonDouble, Angle::Degrees);
maxLon = Longitude(maxLonDouble, Angle::Degrees);
}
else if (HasProjection()) {
// Footprint failed, look in the mapping group
PvlGroup mappingGrp = p_projection->Mapping();
if (mappingGrp.hasKeyword("MinimumLatitude") &&
mappingGrp.hasKeyword("MaximumLatitude") &&
//.........这里部分代码省略.........
示例14: IsisMain
void IsisMain() {
// We will be warping a cube
ProcessRubberSheet p;
// Get the map projection file provided by the user
UserInterface &ui = Application::GetUserInterface();
Pvl userPvl(ui.GetFileName("MAP"));
PvlGroup &userMappingGrp = userPvl.findGroup("Mapping", Pvl::Traverse);
// Open the input cube and get the projection
Cube *icube = p.SetInputCube("FROM");
// Get the mapping group
PvlGroup fromMappingGrp = icube->group("Mapping");
TProjection *inproj = (TProjection *) icube->projection();
PvlGroup outMappingGrp = fromMappingGrp;
// If the default range is FROM, then wipe out any range data in user mapping file
if(ui.GetString("DEFAULTRANGE").compare("FROM") == 0 && !ui.GetBoolean("MATCHMAP")) {
if(userMappingGrp.hasKeyword("MinimumLatitude")) {
userMappingGrp.deleteKeyword("MinimumLatitude");
}
if(userMappingGrp.hasKeyword("MaximumLatitude")) {
userMappingGrp.deleteKeyword("MaximumLatitude");
}
if(userMappingGrp.hasKeyword("MinimumLongitude")) {
userMappingGrp.deleteKeyword("MinimumLongitude");
}
if(userMappingGrp.hasKeyword("MaximumLongitude")) {
userMappingGrp.deleteKeyword("MaximumLongitude");
}
}
// Deal with user overrides entered in the GUI. Do this by changing the user's mapping group, which
// will then overlay anything in the output mapping group.
if(ui.WasEntered("MINLAT") && !ui.GetBoolean("MATCHMAP")) {
userMappingGrp.addKeyword(PvlKeyword("MinimumLatitude", toString(ui.GetDouble("MINLAT"))), Pvl::Replace);
}
if(ui.WasEntered("MAXLAT") && !ui.GetBoolean("MATCHMAP")) {
userMappingGrp.addKeyword(PvlKeyword("MaximumLatitude", toString(ui.GetDouble("MAXLAT"))), Pvl::Replace);
}
if(ui.WasEntered("MINLON") && !ui.GetBoolean("MATCHMAP")) {
userMappingGrp.addKeyword(PvlKeyword("MinimumLongitude", toString(ui.GetDouble("MINLON"))), Pvl::Replace);
}
if(ui.WasEntered("MAXLON") && !ui.GetBoolean("MATCHMAP")) {
userMappingGrp.addKeyword(PvlKeyword("MaximumLongitude", toString(ui.GetDouble("MAXLON"))), Pvl::Replace);
}
/**
* If the user is changing from positive east to positive west, or vice-versa, the output minimum is really
* the input maximum. However, the user mapping group must be left unaffected (an input minimum must be the
* output minimum). To accomplish this, we swap the minimums/maximums in the output group ahead of time. This
* causes the minimums and maximums to correlate to the output minimums and maximums. That way when we copy
* the user mapping group into the output group a mimimum overrides a minimum and a maximum overrides a maximum.
*/
bool sameDirection = true;
if(userMappingGrp.hasKeyword("LongitudeDirection")) {
if(((QString)userMappingGrp["LongitudeDirection"]).compare(fromMappingGrp["LongitudeDirection"]) != 0) {
sameDirection = false;
}
}
// Since the out mapping group came from the from mapping group, which came from a valid cube,
// we can assume both min/max lon exists if min longitude exists.
if(!sameDirection && outMappingGrp.hasKeyword("MinimumLongitude")) {
double minLon = outMappingGrp["MinimumLongitude"];
double maxLon = outMappingGrp["MaximumLongitude"];
outMappingGrp["MaximumLongitude"] = toString(minLon);
outMappingGrp["MinimumLongitude"] = toString(maxLon);
}
if(ui.GetString("PIXRES").compare("FROM") == 0 && !ui.GetBoolean("MATCHMAP")) {
// Resolution will be in fromMappingGrp and outMappingGrp at this time
// delete from user mapping grp
if(userMappingGrp.hasKeyword("Scale")) {
userMappingGrp.deleteKeyword("Scale");
}
if(userMappingGrp.hasKeyword("PixelResolution")) {
userMappingGrp.deleteKeyword("PixelResolution");
}
}
else if(ui.GetString("PIXRES").compare("MAP") == 0 || ui.GetBoolean("MATCHMAP")) {
// Resolution will be in userMappingGrp - delete all others
if(outMappingGrp.hasKeyword("Scale")) {
outMappingGrp.deleteKeyword("Scale");
}
if(outMappingGrp.hasKeyword("PixelResolution")) {
outMappingGrp.deleteKeyword("PixelResolution");
}
if(fromMappingGrp.hasKeyword("Scale"));
//.........这里部分代码省略.........
示例15: TranslateApolloLabels
// Populate cube label using filname and film code
// Code decrypted as specified in film decoder document (July 23, 1971 Revision)
// available at ASU Apollo Resources archive
void TranslateApolloLabels (IString filename, Cube *opack) {
//Instrument group
PvlGroup inst("Instrument");
PvlGroup kern("Kernels");
PvlGroup codeGroup("Code");
inst += PvlKeyword("SpacecraftName", apollo->SpacecraftName());
inst += PvlKeyword("InstrumentId", apollo->InstrumentId());
inst += PvlKeyword("TargetName", apollo->TargetName());
if ( !IsValidCode() ){
PvlGroup error("ERROR");
error.addComment("The decrypted code is invalid.");
for (int i=0; i<4; i++) {
PvlKeyword keyword("Column"+toString(i+1));
for (int j=0; j<32; j++) {
keyword += toString((int)code[i][j]);
}
error.addKeyword(keyword);
codeGroup += keyword;
}
Application::Log(error);
}
else {
codeGroup += PvlKeyword("StartTime", FrameTime());
codeGroup += PvlKeyword("SpacecraftAltitude", toString(Altitude()),"meters");
if (apollo->IsMetric()){
codeGroup += PvlKeyword("ExposureDuration", toString(ShutterInterval()), "milliseconds");
codeGroup += PvlKeyword("ForwardMotionCompensation", FMC());
}
for (int i=0; i<4; i++) {
PvlKeyword keyword("Column"+toString(i+1));
for (int j=0; j<32; j++) {
keyword += toString((int)code[i][j]);
}
codeGroup += keyword;
}
}
PvlGroup bandBin("BandBin");
// There are no filters on the camera, so the default is clear with id # of 1
// the BandBin group is only included to work with the spiceinit application
bandBin += PvlKeyword("FilterName", "CLEAR");
bandBin += PvlKeyword("FilterId", "1");
kern += PvlKeyword("NaifFrameCode", apollo->NaifFrameCode());
// Set up the nominal reseaus group
Isis::PvlGroup &dataDir = Isis::Preference::Preferences().findGroup("DataDirectory");
Process p;
PvlTranslationTable tTable(
(QString)p.MissionData("base", "translations/MissionName2DataDir.trn"));
QString missionDir = dataDir[tTable.Translate("MissionName", apollo->SpacecraftName())][0];
Pvl resTemplate(missionDir + "/reseaus/" + apollo->InstrumentId() + "_NOMINAL.pvl");
PvlGroup *reseaus = &resTemplate.findGroup("Reseaus");
// Update reseau locations based on refined code location
for (int i=0; i<(reseaus->findKeyword("Type")).size(); i++) {
double x = toDouble(reseaus->findKeyword("Sample")[i]) + sampleTranslation + 2278,
y = toDouble(reseaus->findKeyword("Line")[i]) + lineTranslation - 20231;
if (apollo->IsApollo17()) {
x += 50;
y += 20;
}
reseaus->findKeyword("Sample")[i] = toString(
cos(rotation)*(x-sampleTranslation) - sin(rotation)*(y-lineTranslation) + sampleTranslation);
reseaus->findKeyword("Line")[i] = toString(
sin(rotation)*(x-sampleTranslation) + cos(rotation)*(y-lineTranslation) + lineTranslation);
}
inst += PvlKeyword("StartTime", utcTime);
opack->putGroup(inst);
opack->putGroup(bandBin);
opack->putGroup(kern);
opack->putGroup(*reseaus);
opack->putGroup(codeGroup);
}