本文整理汇总了C++中Progress::SetText方法的典型用法代码示例。如果您正苦于以下问题:C++ Progress::SetText方法的具体用法?C++ Progress::SetText怎么用?C++ Progress::SetText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Progress
的用法示例。
在下文中一共展示了Progress::SetText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FinishSave
bool FinishSave(String tmpfile, String outfile)
{
if(IsDeactivationSave()) {
FileMove(tmpfile, outfile);
return true;
}
Progress progress;
int time = GetTickCount();
for(;;) {
progress.SetTotal(10000);
progress.SetText("Saving '" + GetFileName(outfile) + "'");
if(!FileExists(tmpfile))
return false;
FileDelete(outfile);
if(FileMove(tmpfile, outfile))
return true;
IdeConsoleFlush();
Sleep(200);
if(progress.SetPosCanceled((GetTickCount() - time) % progress.GetTotal())) {
int art = Prompt(Ctrl::GetAppName(), CtrlImg::exclamation(),
"Unable to save current file.&"
"Retry save, ignore it or save file to another location?",
"Save as...", "Retry", "Ignore");
if(art < 0)
return false;
if(art && AnySourceFs().ExecuteSaveAs())
outfile = AnySourceFs();
progress.SetPos(0);
}
}
}
示例2: Licenses
void Ide::Licenses()
{
Progress pi;
const Workspace& wspc = IdeWorkspace();
pi.SetTotal(wspc.GetCount());
VectorMap<String, String> license_package;
for(int i = 0; i < wspc.GetCount(); i++) {
String n = wspc[i];
pi.SetText(n);
if(pi.StepCanceled()) return;
String l = LoadFile(SourcePath(n, "Copying"));
if(l.GetCount())
MergeWith(license_package.GetAdd(l), ", ", n);
}
if(license_package.GetCount() == 0) {
Exclamation("No license files ('Copying') have been found.");
return;
}
String qtf;
for(int i = 0; i < license_package.GetCount(); i++) {
bool m = license_package[i].Find(',') >= 0;
qtf << (m ? "Packages [* \1" : "Package [* \1")
<< license_package[i]
<< (m ? "\1] have" : "\1] has")
<< " following licence notice:&"
<< "{{@Y [C1 " << DeQtf(license_package.GetKey(i)) << "]}}&&";
}
ShowQTF(qtf, "Licenses");
}
示例3: OpenDB
bool PostgreSQLTest::OpenDB()
{
if(!m_session.Open("host=localhost dbname=test user=test password=test"))
{
Exclamation(Format("Error in open: %s", DeQtf(m_session.GetLastError())));
return false;
}
m_array.SetSession(m_session);
#ifdef _DEBUG
m_session.SetTrace();
#endif
SQL = m_session;
//schema
Progress p;
p.SetText(t_("Creating _DEBUG database"));
SqlSchema sch(PGSQL);
All_Tables(sch);
if(sch.ScriptChanged(SqlSchema::UPGRADE))
SqlPerformScript(sch.Upgrade(), p);
if(sch.ScriptChanged(SqlSchema::ATTRIBUTES)) {
SqlPerformScript(sch.Attributes(), p);
}
if(sch.ScriptChanged(SqlSchema::CONFIG)) {
SqlPerformScript(sch.ConfigDrop(), p);
SqlPerformScript(sch.Config(), p);
}
sch.SaveNormal();
return true;
}
示例4: SyncRefsDir
void SyncRefsDir(const char *dir, const String& rel, Progress& pi)
{
SyncRefsRunning++;
for(FindFile pff(AppendFileName(dir, "*.*")); pff && !IdeExit; pff.Next()) {
if(pff.IsFolder() && *pff.GetName() != '.') {
if(SyncRefsShowProgress)
pi.Step();
TopicLink tl;
tl.package = rel + pff.GetName();
String pdir = AppendFileName(dir, pff.GetName());
for(FindFile ff(AppendFileName(pdir, "*.tpp")); ff && !IdeExit; ff.Next()) {
if(ff.IsFolder()) {
String group = GetFileTitle(ff.GetName());
tl.group = group;
String dir = AppendFileName(pdir, ff.GetName());
LSLOW();
for(FindFile ft(AppendFileName(dir, "*.tpp")); ft && !IdeExit; ft.Next()) {
if(ft.IsFile()) {
String path = AppendFileName(dir, ft.GetName());
tl.topic = GetFileTitle(ft.GetName());
String link = TopicLinkString(tl);
if(SyncRefsShowProgress)
pi.SetText("Indexing topic " + tl.topic);
SyncTopicFile(link);
}
if(!SyncRefsFinished && !SyncRefsShowProgress && !IdeExit)
Ctrl::ProcessEvents();
}
}
}
SyncRefsDir(pdir, tl.package + '/', pi);
}
}
SyncRefsRunning--;
}
示例5: setControlPointLatLon
/**
* Calculates the lat/lon of the ControlNet.
*
* @param incubes The filename of the list of cubes in the ControlNet
* @param cnet The filename of the ControlNet
*/
void setControlPointLatLon(SerialNumberList &snl, ControlNet &cnet) {
CubeManager manager;
manager.SetNumOpenCubes(50); //Should keep memory usage to around 1GB
Progress progress;
progress.SetText("Calculating Lat/Lon");
progress.SetMaximumSteps(cnet.GetNumPoints());
progress.CheckStatus();
for (int cp = 0; cp < cnet.GetNumPoints(); cp++) {
ControlPoint *point = cnet.GetPoint(cp);
ControlMeasure *cm = point->GetRefMeasure();
Cube *cube = manager.OpenCube(snl.FileName(cm->GetCubeSerialNumber()));
try {
cube->camera()->SetImage(cm->GetSample(), cm->GetLine());
g_surfacePoints[point->GetId()] = cube->camera()->GetSurfacePoint();
}
catch (IException &e) {
QString msg = "Unable to create camera for cube file [";
msg += snl.FileName(cm->GetCubeSerialNumber()) + "]";
throw IException(e, IException::Unknown, msg, _FILEINFO_);
}
cube = NULL; //Do not delete, manager still has ownership
progress.CheckStatus();
}
manager.CleanCubes();
}
示例6: OpenDB
bool PostgreSQLTest::OpenDB()
{
if(!m_session.Open("host=localhost dbname=test user=postgres password=pepicek12A"))
{
Exclamation(Format("Error in open: %s", DeQtf(m_session.GetLastError())));
return false;
}
m_array.SetSession(m_session);
SQLCommander(m_session);
return false;
#ifdef _DEBUG
m_session.SetTrace();
#endif
SQL = m_session;
//schema
Progress p;
p.SetText(t_("Creating _DEBUG database"));
SqlSchema sch(PGSQL);
StdStatementExecutor se(m_session);
All_Tables(sch);
PostgreSQLPerformScript(sch.Upgrade(),se, p);
PostgreSQLPerformScript(sch.Attributes(),se, p);
sch.SaveNormal();
return true;
}
示例7: CheckFramelets
/**
* This method performs pass1 on one image. It analyzes each framelet's
* statistics and populates the necessary global variable.
*
* @param progress Progress message
* @param theCube Current cube that needs processing
*
* @return bool True if the file contains a valid framelet
*/
bool CheckFramelets(string progress, Cube &theCube) {
bool foundValidFramelet = false;
LineManager mgr(theCube);
Progress prog;
prog.SetText(progress);
prog.SetMaximumSteps(theCube.Lines());
prog.CheckStatus();
vector<double> frameletAvgs;
// We need to store off the framelet information, because if no good
// framelets were found then no data should be added to the
// global variable for framelets, just files.
vector< pair<int,double> > excludedFrameletsTmp;
Statistics frameletStats;
for(int line = 1; line <= theCube.Lines(); line++) {
if((line-1) % numFrameLines == 0) {
frameletStats.Reset();
}
mgr.SetLine(line);
theCube.Read(mgr);
frameletStats.AddData(mgr.DoubleBuffer(), mgr.size());
if((line-1) % numFrameLines == numFrameLines-1) {
if(IsSpecial(frameletStats.StandardDeviation()) ||
frameletStats.StandardDeviation() > maxStdev) {
excludedFrameletsTmp.push_back(
pair<int,double>((line-1)/numFrameLines, frameletStats.StandardDeviation())
);
}
else {
foundValidFramelet = true;
}
frameletAvgs.push_back(frameletStats.Average());
}
prog.CheckStatus();
}
inputFrameletAverages.push_back(frameletAvgs);
if(foundValidFramelet) {
for(unsigned int i = 0; i < excludedFrameletsTmp.size(); i++) {
excludedFramelets.insert(pair< pair<int,int>, double>(
pair<int,int>(currImage, excludedFrameletsTmp[i].first),
excludedFrameletsTmp[i].second
)
);
}
}
return foundValidFramelet;
}
示例8: IsisMain
void IsisMain() {
latLonGrid = NULL;
// We will be processing by line
ProcessByLine p;
Cube *icube = p.SetInputCube("FROM");
UserInterface &ui = Application::GetUserInterface();
string mode = ui.GetString("MODE");
outline = ui.GetBoolean("OUTLINE");
inputSamples = icube->Samples();
inputLines = icube->Lines();
// Line & sample based grid
if(mode == "IMAGE") {
p.SetOutputCube ("TO");
baseLine = ui.GetInteger("BASELINE");
baseSample = ui.GetInteger("BASESAMPLE");
lineInc = ui.GetInteger("LINC");
sampleInc = ui.GetInteger("SINC");
p.StartProcess(imageGrid);
p.EndProcess();
}
// Lat/Lon based grid
else {
CubeAttributeOutput oatt("+32bit");
p.SetOutputCube (ui.GetFilename("TO"), oatt, icube->Samples(),
icube->Lines(), icube->Bands());
baseLat = ui.GetDouble("BASELAT");
baseLon = ui.GetDouble("BASELON");
latInc = ui.GetDouble("LATINC");
lonInc = ui.GetDouble("LONINC");
UniversalGroundMap *gmap = new UniversalGroundMap(*icube);
latLonGrid = new GroundGrid(gmap, icube->Samples(), icube->Lines());
Progress progress;
progress.SetText("Calculating Grid");
latLonGrid->CreateGrid(baseLat, baseLon, latInc, lonInc, &progress);
p.StartProcess(groundGrid);
p.EndProcess();
delete latLonGrid;
latLonGrid = NULL;
delete gmap;
gmap = NULL;
}
}
示例9: Statistics
void Ide::Statistics()
{
Vector< ArrayMap<String, FileStat> > stat;
Progress pi;
const Workspace& wspc = IdeWorkspace();
pi.SetTotal(wspc.GetCount());
Date now = GetSysDate();
for(int i = 0; i < wspc.GetCount(); i++) {
const Package& pk = wspc.GetPackage(i);
String n = wspc[i];
pi.SetText(n);
if(pi.StepCanceled()) return;
ArrayMap<String, FileStat>& pfs = stat.Add();
for(int i = 0; i < pk.GetCount(); i++)
if(!pk[i].separator) {
String file = SourcePath(n, pk[i]);
if(FileExists(file)) {
FileStat& fs = pfs.GetAdd(GetFileExt(file));
int d = minmax(now - FileGetTime(file), 0, 9999);
fs.oldest = max(d, fs.oldest);
fs.newest = min(d, fs.newest);
String data = LoadFile(file);
for(const char *s = data; *s; s++)
if(*s == '\n')
fs.lines++;
fs.len += data.GetCount();
fs.days += d;
fs.count++;
}
}
}
String qtf = "[1 ";
ArrayMap<String, FileStat> all;
String tab = "{{45:20:25:20:35:30:30:30:[email protected] [* ";
String hdr = "]:: [= Files:: Lines:: - avg.:: Length:: - avg.:: Oldest:: Newest:: Avg. age]";
for(int i = 0; i < wspc.GetCount(); i++) {
qtf << tab << DeQtf(wspc[i]) << hdr;
sPut(qtf, stat[i], all);
}
qtf << tab << "All packages" << hdr;
sPut(qtf, all, all);
WithStatLayout<TopWindow> dlg;
CtrlLayoutOK(dlg, "Statistics");
dlg.stat = qtf;
dlg.Sizeable().Zoomable();
dlg.Run();
}
示例10: LoadTree
void LoadTree(int parent, const String& path, Progress& pi)
{
pi.SetText(DeFormat(path));
for(FindFile ff(AppendFileName(path, "*.*")); ff; ff.Next()) {
if(pi.StepCanceled())
return;
String n = ff.GetName();
if(n != "." && n != "..") {
edit.Add();
edit.Top() <<= n;
int q;
static int x;
if(++x & 1)
q = tree2.Add(parent, ff.IsFolder() ? CtrlImg::Dir() : CtrlImg::File(),
edit.Top(), 150);
else
q = tree2.Add(parent, ff.IsFolder() ? CtrlImg::Dir() : CtrlImg::File(), n);
if(ff.IsFolder())
LoadTree(q, AppendFileName(path, n), pi);
}
}
}
示例11: WriteCubeOutList
/**
* Finds and writes all input cubes contained within the given Control Network
* to the output file list
*
* @param cnet The Control Network to list the filenames contained within
* @param sn2file The map for converting the Control Network's serial numbers
* to filenames
*/
void WriteCubeOutList( ControlNet cnet, map<iString,iString> sn2file ) {
UserInterface &ui = Application::GetUserInterface();
if( ui.WasEntered("TOLIST") ) {
Progress p;
p.SetText("Writing Cube List");
try {
p.SetMaximumSteps(cnet.Size());
p.CheckStatus();
} catch( iException &e ) {
e.Clear();
string msg = "The provided filters have resulted in an empty Control Network.";
throw Isis::iException::Message(Isis::iException::User,msg, _FILEINFO_);
}
set<iString> outputsn;
for( int cp = 0; cp < cnet.Size(); cp ++ ) {
for( int cm = 0; cm < cnet[cp].Size(); cm ++ ) {
outputsn.insert( cnet[cp][cm].CubeSerialNumber() );
}
p.CheckStatus();
}
std::string toList = ui.GetFilename("TOLIST");
ofstream out_stream;
out_stream.open(toList.c_str(), std::ios::out);
out_stream.seekp(0,std::ios::beg); //Start writing from beginning of file
for( set<iString>::iterator sn = outputsn.begin(); sn != outputsn.end(); sn ++ ) {
if( !sn2file[(*sn)].empty() ) {
out_stream << sn2file[(*sn)] << endl;
}
}
out_stream.close();
}
}
示例12: onSend
void bigmailer::onSend()
{
const String enter = "\r\n" ;
if (messagePage.editor.IsModified())
messagePage.Save() ;
// mapa de los campos
VectorMap<String, int> fldMap ;
for (int i = 0; i < theDefList.fields.GetCount(); i++)
fldMap.Add(theDefList.fields[i], i) ;
String outHTML ;
Index<String> css ;
VectorMap<String, String> links ;
String path = "./" ;
String html = EncodeHtml(messagePage.editor.Get(), css, links, path ) ;
outHTML <<
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\r\n"
"<html>\r\n"
"<head>\r\n"
"<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\r\n"
"<style>\r\n"
<< AsCss( css ) << "\r\n"
<< "</style>\r\n"
"</head>\r\n"
"<body>\r\n"
<< html << "\r\n"
<< "</body>\r\n"
"</html>\r\n" ;
Progress prog ;
prog.Set(0, theDefList.data.GetCount()) ;
prog.Show() ;
theDefList.errors.Clear() ;
String theHtml ;
for (int row = 0; row < theDefList.data.GetCount(); row++)
{
String addrTo = theDefList.data[row][1] ;
if (addrTo.IsEmpty())
{
theDefList.errors.Add(t_("dirección incorrecta")) ;
continue ;
}
if (prog.Canceled())
break ;
theHtml = outHTML ;
String s = AsString(row+1) + " / " + AsString( theDefList.data.GetCount() ) ;
prog.SetText(s) ;
for (int i = 0; i < theDefList.fields.GetCount(); i++)
{
String toFind = "[%" + theDefList.fields[i] + "%]" ;
int from = 0 ;
while( (from = theHtml.Find(toFind, from )) != -1)
{
theHtml.Remove( from, toFind.GetCount() ) ;
theHtml.Insert( from, theDefList.data[row][ fldMap.Get(theDefList.fields[i])] ) ;
}
}
prog.SetPos(row+1) ;
SmtpMailEx mail ;
mail.Host( theCfg.smtpServer )
.User( theCfg.user )
.Password( theCfg.pass )
.From( theMsg.from )
.ReplyTo( theMsg.from )
.To( addrTo )
.Subject( theMsg.subject )
.Text( "" )
.Attach("MENSAJE", theHtml, "text/html; charset=utf-8") ;
if ( ! mail.Send() )
theDefList.errors.Add(mail.GetError()) ;
else
theDefList.errors.Add("OK") ;
}
theDefList.Save() ;
}
示例13: IsisMain
void IsisMain() {
UserInterface &ui = Application::GetUserInterface();
FileList addList(ui.GetFileName("ADDLIST"));
bool log = false;
FileName logFile;
if (ui.WasEntered("LOG")) {
log = true;
logFile = ui.GetFileName("LOG");
}
Pvl results;
results.setName("cnetadd_Results");
PvlKeyword added("FilesAdded");
PvlKeyword omitted("FilesOmitted");
PvlKeyword pointsModified("PointsModified");
bool checkMeasureValidity = ui.WasEntered("DEFFILE");
ControlNetValidMeasure validator;
if (checkMeasureValidity) {
Pvl deffile(ui.GetFileName("DEFFILE"));
validator = ControlNetValidMeasure(deffile);
}
SerialNumberList *fromSerials = ui.WasEntered("FROMLIST") ?
new SerialNumberList(ui.GetFileName("FROMLIST")) : new SerialNumberList();
ControlNet inNet = ControlNet(ui.GetFileName("CNET"));
inNet.SetUserName(Application::UserName());
inNet.SetModifiedDate(iTime::CurrentLocalTime()); //This should be done in ControlNet's Write fn
QString retrievalOpt = ui.GetString("RETRIEVAL");
PvlKeyword duplicates("DupSerialNumbers");
if (retrievalOpt == "REFERENCE") {
FileList list1(ui.GetFileName("FROMLIST"));
SerialNumberList addSerials(ui.GetFileName("ADDLIST"));
//Check for duplicate files in the lists by serial number
for (int i = 0; i < addSerials.Size(); i++) {
// Check for duplicate SNs accross the lists
if (fromSerials->HasSerialNumber(addSerials.SerialNumber(i))) {
duplicates.addValue(addSerials.FileName(i));
}
// Check for duplicate SNs within the addlist
for (int j = i + 1; j < addSerials.Size(); j++) {
if (addSerials.SerialNumber(i) == addSerials.SerialNumber(j)) {
QString msg = "Add list files [" + addSerials.FileName(i) + "] and [";
msg += addSerials.FileName(j) + "] share the same serial number.";
throw IException(IException::User, msg, _FILEINFO_);
}
}
}
// Get the lat/long coords from the existing reference measure
setControlPointLatLon(*fromSerials, inNet);
}
else {
for (int cp = 0; cp < inNet.GetNumPoints(); cp++) {
// Get the surface point from the current control point
ControlPoint *point = inNet.GetPoint(cp);
SurfacePoint surfacePoint = point->GetBestSurfacePoint();
if (!surfacePoint.Valid()) {
QString msg = "Unable to retreive lat/lon from Control Point [";
msg += point->GetId() + "]. RETREIVAL=POINT cannot be used unless ";
msg += "all Control Points have Latitude/Longitude keywords.";
throw IException(IException::User, msg, _FILEINFO_);
}
g_surfacePoints[point->GetId()] = surfacePoint;
}
}
FileName outNetFile(ui.GetFileName("ONET"));
Progress progress;
progress.SetText("Adding Images");
progress.SetMaximumSteps(addList.size());
progress.CheckStatus();
STRtree coordTree;
QList<ControlPoint *> pointList;
bool usePolygon = ui.GetBoolean("POLYGON");
if (usePolygon) {
for (int cp = 0; cp < inNet.GetNumPoints(); cp++) {
ControlPoint *point = inNet.GetPoint(cp);
SurfacePoint surfacePoint = g_surfacePoints[point->GetId()];
Longitude lon = surfacePoint.GetLongitude();
Latitude lat = surfacePoint.GetLatitude();
Coordinate *coord = new Coordinate(lon.degrees(), lat.degrees());
Envelope *envelope = new Envelope(*coord);
coordTree.insert(envelope, point);
}
}
else {
//.........这里部分代码省略.........
示例14: IsisMain
//.........这里部分代码省略.........
//copy the patternS chip (the entire ApolloPanFiducialMark.cub)
FileName fiducialFileName("$apollo15/calibration/ApolloPanFiducialMark.cub");
fidC.open(fiducialFileName.expanded(),"r");
if( !fidC.isOpen() ) {
QString msg = "Unable to open the fiducial patternS cube: ApolloPanFiducialMark.cub\n";
throw IException(IException::User, msg, _FILEINFO_);
}
refL = fidC.lineCount();
refS = fidC.sampleCount();
//scaled pattern chip for fast matching
patternS.SetSize(int((refS-2)/SCALE), int((refL-2)/SCALE));
patternS.TackCube((refS-1)/2, (refL-1)/2);
patternS.Load(fidC, 0, SCALE);
//parameters for maximum correlation autoregestration
// see: file:///usgs/pkgs/isis3nightly2011-09-21/isis/doc/documents/patternSMatch/patternSMatch.html#DistanceTolerance
FileName fiducialPvl("$apollo15/templates/apolloPanFiducialFinder.pvl");
pvl.read(fiducialPvl.expanded()); //read in the autoreg parameters
AutoReg *arS = AutoRegFactory::Create(pvl);
*arS->PatternChip() = patternS; //patternS chip is constant
//set up a centroid measurer
CentroidApolloPan centroid(resolution);
Chip inputChip,selectionChip;
inputChip.SetSize(int(ceil(200*5.0/resolution)), int(ceil(200*5.0/resolution)));
fileName = ui.GetFileName("FROM");
if( panCube.pixelType() == 1) //UnsignedByte
centroid.setDNRange(12, 1e99); //8 bit bright target
else
centroid.setDNRange(3500, 1e99); //16 bit bright target
Progress progress;
progress.SetText("Locating Fiducials");
progress.SetMaximumSteps(91);
//Search for the first fiducial, search sizes are constanst
searchS.SetSize(int(searchCellSize/scale),int(searchCellSize/scale));
//now start searching along a horizontal line for the first fiducial mark
for(l = searchCellSize/2;
l<searchHeight+searchCellSize/2.0 && !foundFirst;
l+=searchCellSize-125*5.0/resolution) {
for (s = searchCellSize/2;
s < averageSamples + searchCellSize/2.0 && !foundFirst;
s += searchCellSize-125*5.0/resolution) {
searchS.TackCube(s, l);
searchS.Load(panCube, 0, scale);
*arS->SearchChip() = searchS;
regStatus = arS->Register();
if (regStatus == AutoReg::SuccessPixel) {
inputChip.TackCube(arS->CubeSample(), arS->CubeLine());
inputChip.Load(panCube, 0, 1);
inputChip.SetCubePosition(arS->CubeSample(), arS->CubeLine());
//continuous dynamic range selection
centroid.selectAdaptive(&inputChip, &selectionChip);
//elliptical trimming/smoothing
if (centroid.elipticalReduction(&selectionChip, 95, play, 2000)) {
//center of mass to reduce selection to a single measure
centroid.centerOfMass(&selectionChip, &sample, &line);
inputChip.SetChipPosition(sample, line);
sampleInitial = inputChip.CubeSample();
lineInitial = inputChip.CubeLine();
foundFirst = true; //once the first fiducial is found stop
}
}
}
示例15: IsisMain
/** The ISIS smtk main application */
void IsisMain() {
UserInterface &ui = Application::GetUserInterface();
// Open the first cube. It is the left hand image.
Cube lhImage;
CubeAttributeInput &attLeft = ui.GetInputAttribute("FROM");
vector<QString> bandLeft = attLeft.bands();
lhImage.setVirtualBands(bandLeft);
lhImage.open(ui.GetFileName("FROM"),"r");
// Open the second cube, it is geomertricallty altered. We will be matching the
// first to this one by attempting to compute a sample/line offsets
Cube rhImage;
CubeAttributeInput &attRight = ui.GetInputAttribute("MATCH");
vector<QString> bandRight = attRight.bands();
rhImage.setVirtualBands(bandRight);
rhImage.open(ui.GetFileName("MATCH"),"r");
// Ensure only single bands
if (lhImage.bandCount() != 1 || rhImage.bandCount() != 1) {
QString msg = "Input Cubes must have only one band!";
throw IException(IException::User,msg,_FILEINFO_);
}
// Both images must have a Camera and can also have a Projection. We will
// only deal with a Camera, however as a projected, non-mosaicked image
// uses a Projection internal to the Camera object.
Camera *lhCamera = NULL;
Camera *rhCamera = NULL;
try {
lhCamera = lhImage.camera();
rhCamera = rhImage.camera();
}
catch (IException &ie) {
QString msg = "Both input images must have a camera";
throw IException(ie, IException::User, msg, _FILEINFO_);
}
// Since we are generating a DEM, we must turn off any existing
// DEM that may have been initialized with spiceinit.
lhCamera->IgnoreElevationModel(true);
rhCamera->IgnoreElevationModel(true);
// Get serial number
QString serialLeft = SerialNumber::Compose(lhImage, true);
QString serialRight = SerialNumber::Compose(rhImage, true);
// This still precludes band to band registrations.
if (serialLeft == serialRight) {
QString sLeft = FileName(lhImage.fileName()).name();
QString sRight = FileName(rhImage.fileName()).name();
if (sLeft == sRight) {
QString msg = "Cube Serial Numbers must be unique - FROM=" + serialLeft +
", MATCH=" + serialRight;
throw IException(IException::User,msg,_FILEINFO_);
}
serialLeft = sLeft;
serialRight = sRight;
}
Progress prog;
prog.SetText("Finding Initial Seeds");
int nl = lhImage.lineCount();
int ns = lhImage.sampleCount();
BigInt numAttemptedInitialPoints = 0;
// Declare Gruen matcher
SmtkMatcher matcher(ui.GetFileName("REGDEF"), &lhImage, &rhImage);
// Get line/sample linc/sinc parameters
int space = ui.GetInteger("SPACE");
int linc (space), sinc(space);
// Do we have a seed points from a control net file?
bool useseed = ui.WasEntered("CNET");
// Base points on an input cnet
SmtkQStack gstack;
double lastEigen(0.0);
if (useseed) {
ControlNet cnet(ui.GetFileName("CNET"));
prog.SetMaximumSteps(cnet.GetNumPoints());
prog.CheckStatus();
gstack.reserve(cnet.GetNumPoints());
for (int cpIndex = 0; cpIndex < cnet.GetNumPoints(); cpIndex ++) {
ControlPoint *cp = cnet.GetPoint(cpIndex);
if (!cp->IsIgnored()) {
ControlMeasure *cmLeft(0), *cmRight(0);
for(int cmIndex = 0; cmIndex < cp->GetNumMeasures(); cmIndex ++) {
ControlMeasure *cm = cp->GetMeasure(cmIndex);
if (!cm->IsIgnored()) {
if (cm->GetCubeSerialNumber() == serialLeft)
cmLeft = cp->GetMeasure(cmIndex);
if (cm->GetCubeSerialNumber() == serialRight)
cmRight = cp->GetMeasure(cmIndex);
//.........这里部分代码省略.........