本文整理汇总了C++中IString::ToQt方法的典型用法代码示例。如果您正苦于以下问题:C++ IString::ToQt方法的具体用法?C++ IString::ToQt怎么用?C++ IString::ToQt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IString
的用法示例。
在下文中一共展示了IString::ToQt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
void Preference::Load(const QString &file) {
// Read the input PVL preference file
Isis::Pvl pvl;
if(Isis::FileName(file).fileExists()) {
pvl.read(file);
}
// Override parameters each time load is called
for(int i = 0; i < pvl.groups(); i++) {
Isis::PvlGroup &inGroup = pvl.group(i);
if(this->hasGroup(inGroup.name())) {
Isis::PvlGroup &outGroup = this->findGroup(inGroup.name());
for(int k = 0; k < inGroup.keywords(); k++) {
Isis::PvlKeyword &inKey = inGroup[k];
while(outGroup.hasKeyword(inKey.name())) {
outGroup.deleteKeyword(inKey.name());
}
outGroup += inKey;
}
}
else {
this->addGroup(inGroup);
}
}
// Configure Isis to use the user performance preferences where
// appropriate.
if (hasGroup("Performance")) {
PvlGroup &performance = findGroup("Performance");
if (performance.hasKeyword("GlobalThreads")) {
IString threadsPreference = performance["GlobalThreads"][0];
if (threadsPreference.DownCase() != "optimized") {
// We need a no-iException conversion here
int threads = threadsPreference.ToQt().toInt();
if (threads > 0) {
QThreadPool::globalInstance()->setMaxThreadCount(threads);
}
}
}
}
}
示例2: attIn
/**
* This method opens a cube. If the cube is already opened, this method will
* return the cube from memory. The CubeManager class retains ownership of this
* cube pointer, so do not close the cube, destroy the pointer, or otherwise
* modify the cube object or pointer such that another object using them would
* fail. This method does not guarantee you are the only one with this pointer,
* nor is it recommended to keep this pointer out of a local (method) scope.
*
* @param cubeFileName The filename of the cube you wish to open
*
* @return Cube* A pointer to the cube object that CubeManager retains ownership
* to and may delete at any time
*/
Cube *CubeManager::OpenCube(const QString &cubeFileName) {
CubeAttributeInput attIn(cubeFileName);
IString attri = attIn.toString();
IString expName = FileName(cubeFileName).expanded();
// If there are attributes, we need a plus sign on the name
if(attri.size() > 0) {
expName += "+";
}
IString fullName = expName + attri;
QString fileName(fullName.ToQt());
QMap<QString, Cube *>::iterator searchResult = p_cubes.find(fileName);
if(searchResult == p_cubes.end()) {
p_cubes.insert(fileName, new Cube());
searchResult = p_cubes.find(fileName);
// Bands are the only thing input attributes can affect
(*searchResult)->setVirtualBands(attIn.bands());
try {
(*searchResult)->open(fileName);
}
catch(IException &e) {
CleanCubes(fileName);
throw;
}
}
// Keep track of the newly opened cube in our queue
p_opened.removeAll(fileName);
p_opened.enqueue(fileName);
// cleanup if necessary
if(p_minimumCubes != 0) {
while(p_opened.size() > (int)(p_minimumCubes)) {
QString needsCleaned = p_opened.dequeue();
CleanCubes(needsCleaned);
}
}
return (*searchResult);
}
示例3: getEnvironmentValue
Environment::Environment() {
// Set the Qt plugin directory
QStringList pluginPaths;
IString root = getEnvironmentValue("ISISROOT", "");
if (root != "") {
IString thirdPartyPluginPath = root + "/3rdParty/plugins";
pluginPaths << thirdPartyPluginPath.ToQt();
QCoreApplication::setLibraryPaths(pluginPaths);
}
#ifndef __APPLE__
// We need to force the correct QDBus library to be loaded... to do that, just
// use a symbol in it's library. This only applies to linux and fixes #1228.
// Long explanation:
// When we run GUI apps, the system (and Qt) work together to figure out
// which runtime libraries are necessary on-the-fly. When QApplication is
// instantiated, it goes into QtGui's style code. The styles ignore our plugin
// path setting (above) on all OS's. So Qt GUI grabs a style from the OS's styles,
// which is a shared library in the kde area. These styles require a version (any version)
// of QtDBus loaded. If QtDBus is not yet loaded, then the style library will grab it.
// However, on Ubuntu 12.04, the style library grabs the system (OS) QDBus library. QDBus
// detects that you've already loaded Isis' QtCore, so the library versions mismatch, and
// it crashes. The problem becomes more interesting because sometimes it picks up the system
// QDBus, and sometimes it picks up Isis' QDBus, and I have no good reason why we pick up
// one versus another; currently, installed apps pick up the system and locally built apps
// pick up Isis' (even when the executables are made to be identical). The end result is no
// installed GUI applications will run and our automated tests fail to catch it. This solution
// bypasses the entire issue by forcing QDBus to be loaded long before any styles are loaded,
// so the style plugins do not need to go and get their own QDBus library.
//
// The root cause is that Ubuntu's run time loader is failing to respect
// our executable's rpaths when loading a style library. However, when we link against the
// QBus library directly, we get the right one.
QDBusArgument();
#endif
}
示例4: IsisMain
//.........这里部分代码省略.........
QString sfname;
sfname.clear();
sfname += "Isis " + Application::Version() + " " +
Application::GetUserInterface().ProgramName();
pdsLabel += PvlKeyword("SOFTWARE_NAME", sfname);
// Add the PRODUCT_VERSION_ID from the user parameter VERSION
pdsLabel += PvlKeyword("PRODUCT_VERSION_ID", ui.GetString("VERSION"));
// Add MRO:CCD_FLAG, MRO:BINNING, MRO:TDI
// As pulled from the input Isis cube, the values are in CPMM order, so
// convert them to CCD order
PvlKeyword ccdFlag("MRO:CCD_FLAG");
PvlKeyword &cpmmFlag = origLabel.findObject("OriginalLabelObject").
findGroup("INSTRUMENT_SETTING_PARAMETERS").
findKeyword("MRO:POWERED_CPMM_FLAG");
PvlKeyword ccdBin("MRO:BINNING");
PvlKeyword &cpmmBin = icube2->label()->findObject("IsisCube").
findGroup("Mosaic")["cpmmSummingFlag"];
PvlKeyword ccdTdi("MRO:TDI");
PvlKeyword &cpmmTdi = icube2->label()->findObject("IsisCube").
findGroup("Mosaic")["cpmmTdiFlag"];
PvlKeyword ccdSpecial("MRO:SPECIAL_PROCESSING_FLAG");
PvlKeyword &cpmmSpecial = icube2->label()->findObject("IsisCube").
findGroup("Mosaic")["SpecialProcessingFlag"];
for (int ccd = 0; ccd < 14; ++ccd) {
const unsigned int cpmmByCcd[] = {0, 1, 2, 3, 5, 8, 10,
11, 12, 13, 6, 7, 4, 9};
ccdFlag.addValue(cpmmFlag[cpmmByCcd[ccd]]);
ccdBin.addValue(cpmmBin[cpmmByCcd[ccd]] != "Null" ? cpmmBin[cpmmByCcd[ccd]] : "-9998");
ccdTdi.addValue(cpmmTdi[cpmmByCcd[ccd]] != "Null" ? cpmmTdi[cpmmByCcd[ccd]] : "-9998");
IString tmp = cpmmSpecial[cpmmByCcd[ccd]];
tmp.Trim("\"");
ccdSpecial.addValue(tmp.ToQt());
}
if (!pdsLabel.hasGroup("INSTRUMENT_SETTING_PARAMETERS")) {
pdsLabel.addGroup(PvlGroup("INSTRUMENT_SETTING_PARAMETERS"));
}
pdsLabel.findGroup("INSTRUMENT_SETTING_PARAMETERS") += ccdFlag;
pdsLabel.findGroup("INSTRUMENT_SETTING_PARAMETERS") += ccdBin;
pdsLabel.findGroup("INSTRUMENT_SETTING_PARAMETERS") += ccdTdi;
pdsLabel.findGroup("INSTRUMENT_SETTING_PARAMETERS") += ccdSpecial;
// Add/modify projection info if there is a projection
if (pdsLabel.hasObject("IMAGE_MAP_PROJECTION")) {
PvlObject &mapObject = pdsLabel.findObject("IMAGE_MAP_PROJECTION");
mapObject += PvlKeyword("^DATA_SET_MAP_PROJECTION", "DSMAP.CAT");
// Add the HiRISE comment to the CENTER_LATITUDE keyword
PvlKeyword &clat = mapObject["CENTER_LATITUDE"];
clat.addComment("/* NOTE: CENTER_LATITUDE and CENTER_LONGITUDE describe the location */");
clat.addComment("/* of the center of projection, which is not necessarily equal to the */");
clat.addComment("/* location of the center point of the image. */");
if (mapObject.hasKeyword("CENTER_LATITUDE")) {
PvlKeyword ¢erLat = mapObject["CENTER_LATITUDE"];
// if (centerLat[0] == "N/A") centerLat = -9998;
if (centerLat[0] == "N/A") mapObject.deleteKeyword("CENTER_LATITUDE");
}
if (mapObject.hasKeyword("CENTER_LONGITUDE")) {
PvlKeyword ¢erLon = mapObject["CENTER_LONGITUDE"];
// if (centerLon[0] == "N/A") centerLon = -9998;
if (centerLon[0] == "N/A") mapObject.deleteKeyword("CENTER_LONGITUDE");
}
if (mapObject.hasKeyword("REFERENCE_LATITUDE")) {
示例5: IsisMain
void IsisMain() {
// Get the projection
UserInterface &ui = Application::GetUserInterface();
Pvl pvl(ui.GetFileName("FROM"));
proj = (TProjection *) ProjectionFactory::CreateFromCube(pvl);
// Determine ground range to crop and/or trim
if(ui.WasEntered("MINLAT")) {
slat = ui.GetDouble("MINLAT");
elat = ui.GetDouble("MAXLAT");
slon = ui.GetDouble("MINLON");
elon = ui.GetDouble("MAXLON");
}
else if(proj->HasGroundRange()) {
slat = proj->MinimumLatitude();
elat = proj->MaximumLatitude();
slon = proj->MinimumLongitude();
elon = proj->MaximumLongitude();
}
else {
string msg = "Latitude and longitude range not defined in projection";
throw IException(IException::User, msg, _FILEINFO_);
}
QString mode = ui.GetString("MODE");
IString tempFileName;
if(mode != "TRIM") {
smallestLine = smallestSample = INT_MAX;
biggestLine = biggestSample = -INT_MAX;
ProcessByLine p;
p.SetInputCube("FROM");
p.StartProcess(getSize);
p.EndProcess();
int samples = biggestSample - smallestSample + 1;
int lines = biggestLine - smallestLine + 1;
// Run external crop
QString cropParams = "";
cropParams += "from=" + ui.GetFileName("FROM");
if(mode == "CROP") {
cropParams += " to=" + ui.GetAsString("TO");
}
else {
tempFileName = FileName::createTempFile("TEMPORARYcropped.cub").name();
cropParams += " to=" + tempFileName.ToQt();
}
cropParams += " sample= " + toString(smallestSample);
cropParams += " nsamples= " + toString(samples);
cropParams += " line= " + toString(smallestLine);
cropParams += " nlines= " + toString(lines);
try {
ProgramLauncher::RunIsisProgram("crop", cropParams);
}
catch(IException &e) {
QString msg = "Could not execute crop with params: [" + cropParams + "]";
throw IException(IException::Programmer, msg, _FILEINFO_);
}
if(mode == "BOTH") {
delete proj;
proj = NULL;
Pvl pvl(tempFileName.ToQt());
proj = (TProjection *) ProjectionFactory::CreateFromCube(pvl);
}
}
// Trim image if necessary
if(mode != "CROP") {
ProcessByLine p;
CubeAttributeInput att;
if(mode == "BOTH") {
p.SetInputCube(tempFileName.ToQt(), att);
}
else { //if its trim
p.SetInputCube("FROM");
}
p.SetOutputCube("TO");
p.StartProcess(trim);
p.EndProcess();
if(mode == "BOTH") {
remove(tempFileName.c_str());
}
}
// Add mapping to print.prt
PvlGroup mapping = proj->Mapping();
Application::Log(mapping);
delete proj;
proj = NULL;
}