本文整理汇总了C++中ControlPoint::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ ControlPoint::Add方法的具体用法?C++ ControlPoint::Add怎么用?C++ ControlPoint::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControlPoint
的用法示例。
在下文中一共展示了ControlPoint::Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 {
//.........这里部分代码省略.........
示例2: IsisMain
void IsisMain() {
// Create a serial number list
UserInterface &ui = Application::GetUserInterface();
QString filename = ui.GetFileName("FROM");
SerialNumberList serialNumberList;
serialNumberList.Add(filename);
// Get the coordinate for updating the camera pointing
// We will want to make the camera pointing match the lat/lon at this
// line sample
double samp1 = ui.GetDouble("SAMP1");
double line1 = ui.GetDouble("LINE1");
Latitude lat1(ui.GetDouble("LAT1"), Angle::Degrees);
Longitude lon1(ui.GetDouble("LON1"), Angle::Degrees);
Distance rad1;
if(ui.WasEntered("RAD1")) {
rad1 = Distance(ui.GetDouble("RAD1"), Distance::Meters);
}
else {
rad1 = GetRadius(ui.GetFileName("FROM"), lat1, lon1);
}
// In order to use the bundle adjustment class we will need a control
// network
ControlMeasure * m = new ControlMeasure;
m->SetCubeSerialNumber(serialNumberList.SerialNumber(0));
m->SetCoordinate(samp1, line1);
// m->SetType(ControlMeasure::Manual);
m->SetType(ControlMeasure::RegisteredPixel);
ControlPoint * p = new ControlPoint;
p->SetAprioriSurfacePoint(SurfacePoint(lat1, lon1, rad1));
p->SetId("Point1");
p->SetType(ControlPoint::Fixed);
p->Add(m);
ControlNet cnet;
// cnet.SetType(ControlNet::ImageToGround);
cnet.AddPoint(p);
// We need the target body
Cube c;
c.open(filename, "rw");
//check for target name
if(c.label()->hasKeyword("TargetName", PvlObject::Traverse)) {
// c.Label()->findKeyword("TargetName");
PvlGroup inst = c.label()->findGroup("Instrument", PvlObject::Traverse);
QString targetName = inst["TargetName"];
cnet.SetTarget(targetName);
}
c.close();
// See if they wanted to solve for twist
if(ui.GetBoolean("TWIST")) {
double samp2 = ui.GetDouble("SAMP2");
double line2 = ui.GetDouble("LINE2");
Latitude lat2(ui.GetDouble("LAT2"), Angle::Degrees);
Longitude lon2(ui.GetDouble("LON2"), Angle::Degrees);
Distance rad2;
if(ui.WasEntered("RAD2")) {
rad2 = Distance(ui.GetDouble("RAD2"), Distance::Meters);
}
else {
rad2 = GetRadius(ui.GetFileName("FROM"), lat2, lon2);
}
ControlMeasure * m = new ControlMeasure;
m->SetCubeSerialNumber(serialNumberList.SerialNumber(0));
m->SetCoordinate(samp2, line2);
m->SetType(ControlMeasure::Manual);
ControlPoint * p = new ControlPoint;
p->SetAprioriSurfacePoint(SurfacePoint(lat2, lon2, rad2));
p->SetId("Point2");
p->SetType(ControlPoint::Fixed);
p->Add(m);
cnet.AddPoint(p);
}
// Bundle adjust to solve for new pointing
try {
BundleAdjust b(cnet, serialNumberList);
b.SetSolveTwist(ui.GetBoolean("TWIST"));
// double tol = ui.GetDouble("TOL");
//int maxIterations = ui.GetInteger("MAXITS");
//b.Solve(tol, maxIterations);
b.SetSolveCmatrix(BundleAdjust::AnglesOnly);
b.SetSolveSpacecraftPosition(BundleAdjust::Nothing);
b.SetErrorPropagation(false);
b.SetOutlierRejection(false);
b.SetSolutionMethod("SPECIALK");
b.SetStandardOutput(true);
b.SetCSVOutput(false);
b.SetResidualOutput(true);
b.SetConvergenceThreshold(ui.GetDouble("SIGMA0"));
b.SetMaxIterations(ui.GetInteger("MAXITS"));
b.SetDecompositionMethod(BundleAdjust::SPECIALK);
b.SolveCholesky();
//.........这里部分代码省略.........
示例3: IsisMain
void IsisMain() {
// Get user interface
UserInterface &ui = Application::GetUserInterface();
bool register_ignored = ui.GetBoolean("REGISTERIGNOREDONLY");
// Open the files list in a SerialNumberList for
// reference by SerialNumber
SerialNumberList files(ui.GetFilename("FILES"));
// Create a ControlNet from the input file
ControlNet inNet(ui.GetFilename("CNET"));
// Create an AutoReg from the template file
Pvl pvl(ui.GetFilename("TEMPLATE"));
AutoReg *ar = AutoRegFactory::Create(pvl);
// Create the output ControlNet
ControlNet outNet;
outNet.SetType(inNet.Type());
outNet.SetUserName(Application::UserName());
outNet.SetDescription(inNet.Description());
outNet.SetCreatedDate(iTime::CurrentLocalTime());
outNet.SetTarget(inNet.Target());
outNet.SetNetworkId(inNet.NetworkId());
Progress progress;
progress.SetMaximumSteps(inNet.Size());
progress.CheckStatus();
int ignored=0, unmeasured=0, registered=0, unregistered=0, validated=0;
CubeManager cubeMgr;
cubeMgr.SetNumOpenCubes(50);
// Register the points and create a new
// ControlNet containing the refined measurements
for (int i=0; i<inNet.Size(); i++) {
ControlPoint &inPoint = inNet[i];
ControlPoint outPoint;
outPoint.SetType(inPoint.Type());
outPoint.SetId(inPoint.Id());
outPoint.SetUniversalGround(inPoint.UniversalLatitude(), inPoint.UniversalLongitude(), inPoint.Radius());
outPoint.SetHeld(inPoint.Held());
outPoint.SetIgnore(inPoint.Ignore());
// CHECK TO SEE IF THE CONTROL POINT SHOULD BE REGISTERED
// "Ignore" point and we are not registering ignored
if (inPoint.Ignore() && !register_ignored){
ignored++;
// add "Ignored" to network only if indicated
if (ui.GetBoolean("OUTPUTIGNORED")) {
// only include appropriate control measures
for (int j = 0; j < inPoint.Size(); j++) {
if (inPoint[j].IsMeasured()){
outPoint.Add(inPoint[j]);
}
else{
unmeasured++;
if (ui.GetBoolean("OUTPUTUNMEASURED")){
outPoint.Add(inPoint[j]);
}
}
}
// only add this point if OUTPUTIGNORED
outNet.Add(outPoint);
}
// go to next control point
continue;
}
// Not "Ignore" point (i.e. "valid") and we are only registering "Ignored"
else if (!inPoint.Ignore() && register_ignored) {
// add all "valid" points to network
// only include appropriate control measures
for (int j = 0; j < inPoint.Size(); j++) {
if (inPoint[j].IsMeasured()){
outPoint.Add(inPoint[j]);
}
else{
unmeasured++;
if (ui.GetBoolean("OUTPUTUNMEASURED")) {
outPoint.Add(inPoint[j]);
}
}
}
// add this point since it is not ignored
outNet.Add(outPoint);
// go to next control point
continue;
}
// "Ignore" point or "valid" point to be registered
else { // if ( (inPoint.Ignore() && register_ignored) || (!inPoint.Ignore() && !register_ignored ) ) {
if (inPoint.Ignore()) { outPoint.SetIgnore(false); }
ControlMeasure &patternCM = inPoint[inPoint.ReferenceIndex()];
Cube &patternCube = *cubeMgr.OpenCube(files.Filename(patternCM.CubeSerialNumber()));
ar->PatternChip()->TackCube(patternCM.Sample(), patternCM.Line());
//.........这里部分代码省略.........