本文整理汇总了C++中Cube::Projection方法的典型用法代码示例。如果您正苦于以下问题:C++ Cube::Projection方法的具体用法?C++ Cube::Projection怎么用?C++ Cube::Projection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cube
的用法示例。
在下文中一共展示了Cube::Projection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IsisMain
void IsisMain() {
// Open the input cube
Process p;
UserInterface &ui = Application::GetUserInterface();
CubeAttributeInput cai;
Cube *icube = p.SetInputCube(ui.GetFilename("FROM"), cai, ReadWrite);
// Make sure at least one CK & SPK quality was selected
if (!ui.GetBoolean("CKPREDICTED") && !ui.GetBoolean("CKRECON") && !ui.GetBoolean("CKSMITHED") && !ui.GetBoolean("CKNADIR")) {
string msg = "At least one CK quality must be selected";
throw iException::Message(iException::User,msg,_FILEINFO_);
}
if (!ui.GetBoolean("SPKPREDICTED") && !ui.GetBoolean("SPKRECON") && !ui.GetBoolean("SPKSMITHED")) {
string msg = "At least one SPK quality must be selected";
throw iException::Message(iException::User,msg,_FILEINFO_);
}
// Make sure it is not projected
Projection *proj = NULL;
try {
proj = icube->Projection();
} catch (iException &e) {
proj = NULL;
e.Clear();
}
if (proj != NULL) {
string msg = "Can not initialize SPICE for a map projected cube";
throw iException::Message(iException::User,msg,_FILEINFO_);
}
Pvl lab = *icube->Label();
// if cube has existing polygon delete it
if (icube->Label()->HasObject("Polygon")) {
icube->Label()->DeleteObject("Polygon");
}
// Set up for getting the mission name
// Get the directory where the system missions translation table is.
string transFile = p.MissionData("base", "translations/MissionName2DataDir.trn");
// Get the mission translation manager ready
PvlTranslationManager missionXlater (lab, transFile);
// Get the mission name so we can search the correct DB's for kernels
string mission = missionXlater.Translate ("MissionName");
// Get system base kernels
unsigned int allowed = 0;
unsigned int allowedCK = 0;
unsigned int allowedSPK = 0;
if (ui.GetBoolean("CKPREDICTED")) allowedCK |= spiceInit::kernelTypeEnum("PREDICTED");
if (ui.GetBoolean("CKRECON")) allowedCK |= spiceInit::kernelTypeEnum("RECONSTRUCTED");
if (ui.GetBoolean("CKSMITHED")) allowedCK |= spiceInit::kernelTypeEnum("SMITHED");
if (ui.GetBoolean("CKNADIR")) allowedCK |= spiceInit::kernelTypeEnum("NADIR");
if (ui.GetBoolean("SPKPREDICTED")) allowedSPK |= spiceInit::kernelTypeEnum("PREDICTED");
if (ui.GetBoolean("SPKRECON")) allowedSPK |= spiceInit::kernelTypeEnum("RECONSTRUCTED");
if (ui.GetBoolean("SPKSMITHED")) allowedSPK |= spiceInit::kernelTypeEnum("SMITHED");
KernelDb baseKernels (allowed);
KernelDb ckKernels (allowedCK);
KernelDb spkKernels (allowedSPK);
baseKernels.LoadSystemDb(mission);
ckKernels.LoadSystemDb(mission);
spkKernels.LoadSystemDb(mission);
Kernel lk, pck, targetSpk, fk, ik, sclk, spk, iak, dem, exk;
std::priority_queue< Kernel > ck;
lk = baseKernels.LeapSecond(lab);
pck = baseKernels.TargetAttitudeShape(lab);
targetSpk = baseKernels.TargetPosition(lab);
ik = baseKernels.Instrument(lab);
sclk = baseKernels.SpacecraftClock(lab);
iak = baseKernels.InstrumentAddendum(lab);
fk = ckKernels.Frame(lab);
ck = ckKernels.SpacecraftPointing(lab);
spk = spkKernels.SpacecraftPosition(lab);
if (ui.GetBoolean("CKNADIR")) {
// Only add nadir if no spacecraft pointing found
std::vector<std::string> kernels;
kernels.push_back("Nadir");
ck.push(Kernel((spiceInit::kernelTypes)0, kernels));
}
// Get user defined kernels and override ones already found
GetUserEnteredKernel("LS", lk);
GetUserEnteredKernel("PCK", pck);
GetUserEnteredKernel("TSPK", targetSpk);
GetUserEnteredKernel("FK", fk);
GetUserEnteredKernel("IK", ik);
GetUserEnteredKernel("SCLK", sclk);
GetUserEnteredKernel("SPK", spk);
GetUserEnteredKernel("IAK", iak);
GetUserEnteredKernel("EXTRA", exk);
// Get shape kernel
if (ui.GetString ("SHAPE") == "USER") {
GetUserEnteredKernel("MODEL", dem);
//.........这里部分代码省略.........
示例2: 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->GetGroup("Mapping");
Projection *inproj = 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", ui.GetDouble("MINLAT")), Pvl::Replace );
}
if(ui.WasEntered("MAXLAT") && !ui.GetBoolean("MATCHMAP")) {
userMappingGrp.AddKeyword( PvlKeyword("MaximumLatitude", ui.GetDouble("MAXLAT")), Pvl::Replace );
}
if(ui.WasEntered("MINLON") && !ui.GetBoolean("MATCHMAP")) {
userMappingGrp.AddKeyword( PvlKeyword("MinimumLongitude", ui.GetDouble("MINLON")), Pvl::Replace );
}
if(ui.WasEntered("MAXLON") && !ui.GetBoolean("MATCHMAP")) {
userMappingGrp.AddKeyword( PvlKeyword("MaximumLongitude", 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(((string)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"] = minLon;
outMappingGrp["MinimumLongitude"] = 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")); {
//.........这里部分代码省略.........