/** 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); } } // If we have both left and right images in the control point, save it if ( (cmLeft != 0) && (cmRight != 0) ) { Coordinate left = Coordinate(cmLeft->GetLine(), cmLeft->GetSample()); Coordinate right = Coordinate(cmRight->GetLine(), cmRight->GetSample()); SmtkPoint spnt = matcher.Create(left, right); // Insert the point (unregistered) if ( spnt.isValid() ) { int line = (int) cmLeft->GetLine(); int samp = (int) cmLeft->GetSample(); matcher.isValid(spnt); gstack.insert(qMakePair(line, samp), spnt); lastEigen = spnt.GoodnessOfFit(); } } } prog.CheckStatus(); } } else { // We want to create a grid of control points that is N rows by M columns. int rows = (lhImage.lineCount() + linc - 1)/linc; int cols = (lhImage.sampleCount() + sinc - 1)/sinc; prog.SetMaximumSteps(rows * cols); prog.CheckStatus(); // First pass stack and eigen value statistics SmtkQStack fpass; fpass.reserve(rows * cols); Statistics temp_mev; // Loop through grid of points and get statistics to compute // initial set of points for (int line = linc / 2 + 1; line < nl; line += linc) { for (int samp = sinc / 2 + 1 ; samp < ns; samp += sinc) { numAttemptedInitialPoints ++; SmtkPoint spnt = matcher.Register(Coordinate(line,samp)); if ( spnt.isValid() ) { matcher.isValid(spnt); fpass.insert(qMakePair(line, samp), spnt); temp_mev.AddData(spnt.GoodnessOfFit()); } prog.CheckStatus(); } } // Now select a subset of fpass points as the seed points cout << "Number of Potential Seed Points: " << fpass.size() << "\n"; cout << "Min / Max Eigenvalues Matched: " << temp_mev.Minimum() << ", " << temp_mev.Maximum() << "\n"; // How many seed points are requested double nseed = ui.GetDouble("NSEED"); int inseed; if (nseed >= 1.0) inseed = (int) nseed; else if (nseed > 0.0) inseed = (int) (nseed * (double) (fpass.size())); else inseed = (int) ((double) (fpass.size()) * 0.05); double seedsample = ui.GetDouble("SEEDSAMPLE"); // Generate a new stack gstack.reserve(inseed); while ((gstack.size() < inseed) && (!fpass.isEmpty() )) { SmtkQStack::iterator bestm; if (seedsample <= 0.0) { bestm = matcher.FindSmallestEV(fpass); } else { bestm = matcher.FindExpDistEV(fpass, seedsample, temp_mev.Minimum(), temp_mev.Maximum()); } // Add point to stack if (bestm != fpass.end()) { Coordinate right = bestm.value().getRight(); matcher.isValid(bestm.value()); gstack.insert(bestm.key(), bestm.value()); lastEigen = bestm.value().GoodnessOfFit(); fpass.erase(bestm); } } // If a user wants to see the seed network, write it out here if (ui.WasEntered("OSEEDNET")) { WriteCnet(ui.GetFileName("OSEEDNET"), gstack, lhCamera->target()->name(), serialLeft, serialRight); } } /////////////////////////////////////////////////////////////////////// // All done with seed points. Sanity check ensures we actually found // some. /////////////////////////////////////////////////////////////////////// if (gstack.size() <= 0) { QString msg = "No seed points found - may need to check Gruen parameters."; throw IException(IException::User, msg, _FILEINFO_); } // Report seed point status if (!useseed) { cout << "Number of Seed Points used: " << gstack.size() << "\n"; cout << "EV of last Seed Point: " << lastEigen << "\n"; } else { cout << "Number of Manual Seed Points: " << gstack.size() << "\n"; } // Use seed points (in stack) to grow SmtkQStack bmf; bmf.reserve(gstack.size()); // Probably need much more but for starters... BigInt numOrigPoints = gstack.size(); BigInt passpix2 = 0; int subcbox = ui.GetInteger("SUBCBOX"); int halfBox((subcbox-1)/2); while (!gstack.isEmpty()) { SmtkQStackIter cstack = matcher.FindSmallestEV(gstack); // Print number on stack if ((gstack.size() % 1000) == 0) { cout << "Number on Stack: " << gstack.size() << ". " << cstack.value().GoodnessOfFit() << "\n"; } // Test to see if already determined SmtkQStackIter bmfPt = bmf.find(cstack.key()); if (bmfPt == bmf.end()) { // Its not in the final stack, process it // Retrieve the point SmtkPoint spnt = cstack.value(); // Register if its not already registered if (!spnt.isRegistered()) { spnt = matcher.Register(spnt, spnt.getAffine()); } // Still must check for validity if the point was just registered, // otherwise should be good if ( spnt.isValid() ) { passpix2++; bmf.insert(cstack.key(), spnt); // inserts (0,0) offset excluded below int line = cstack.key().first; int sample = cstack.key().second; // Determine match points double eigen(spnt.GoodnessOfFit()); for (int sampBox = -halfBox ; sampBox <= halfBox ; sampBox++ ) { int csamp = sample + sampBox; for (int lineBox = -halfBox ; lineBox <= halfBox ; lineBox++) { int cline = line + lineBox; if ( !( (sampBox == 0) && (lineBox == 0)) ) {// Already added above SmtkQPair dupPair(cline, csamp); SmtkQStackIter temp = bmf.find(dupPair); SmtkPoint bmfpnt; if (temp != bmf.end()) { if (temp.value().GoodnessOfFit() > eigen) { // Create cloned point with better fit bmfpnt = matcher.Clone(spnt, Coordinate(cline,csamp)); } } else { // ISIS2 is BMF(SAMP,LINE,7) .EQ VALID_MAX4) // Clone new point for insert bmfpnt = matcher.Clone(spnt, Coordinate(cline,csamp)); } // Add if good point if (bmfpnt.isValid()) { bmf.insert(dupPair, bmfpnt); } } } } // Grow stack with spacing adding info to stack for (int i = -1 ; i <= 1 ; i ++) { // Sample for (int j = -1 ; j <= 1 ; j ++) { // Line // Don't re-add the original sample, line if ( !((i == 0) && (j == 0)) ) { // Grow based upon spacing double ssamp = sample + (i * space); double sline = line + (j * space); Coordinate pnt = Coordinate(sline, ssamp); SmtkPoint gpnt = matcher.Clone(spnt, pnt); if ( gpnt.isValid() ) { SmtkQPair growpt((int) sline, (int) ssamp); // double check we don't have a finalized result at this position SmtkQStackIter temp = bmf.find(growpt); if(temp == bmf.end()) { gstack.insert(growpt, gpnt); } } } } } } } // Remove the current point from the grow stack (hole) gstack.erase(cstack); } ///////////////////////////////////////////////////////////////////////// // All done with creating points. Perform output options. ///////////////////////////////////////////////////////////////////////// // If a TO parameter was specified, create DEM with errors if (ui.WasEntered("TO")) { // Create the output DEM cout << "\nCreating output DEM from " << bmf.size() << " points.\n"; Process p; Cube *icube = p.SetInputCube("FROM"); Cube *ocube = p.SetOutputCube("TO", icube->sampleCount(), icube->lineCount(), 3); p.ClearInputCubes(); int boxsize = ui.GetInteger("BOXSIZE"); double plotdist = ui.GetDouble("PLOTDIST"); TileManager dem(*ocube), eigen(*ocube), stErr(*ocube); dem.SetTile(1, 1); // DEM Data/elevation stErr.SetTile(1, 2); // Error in stereo computation eigen.SetTile(1, 3); // Eigenvalue of the solution int nBTiles(eigen.Tiles()/3); // Total tiles / 3 bands prog.SetText("Creating DEM"); prog.SetMaximumSteps(nBTiles); prog.CheckStatus(); Statistics stAng; while ( !eigen.end() ) { // Must use the last band for this!! PointPlot tm = for_each(bmf.begin(), bmf.end(), PointPlot(dem, plotdist)); tm.FillPoints(*lhCamera, *rhCamera, boxsize, dem, stErr, eigen, &stAng); ocube->write(dem); ocube->write(stErr); ocube->write(eigen); dem.next(); stErr.next(); eigen.next(); prog.CheckStatus(); } // Report Stereo separation angles PvlGroup stresultsPvl("StereoSeparationAngle"); stresultsPvl += PvlKeyword("Minimum", toString(stAng.Minimum()), "deg"); stresultsPvl += PvlKeyword("Average", toString(stAng.Average()), "deg"); stresultsPvl += PvlKeyword("Maximum", toString(stAng.Maximum()), "deg"); stresultsPvl += PvlKeyword("StandardDeviation", toString(stAng.StandardDeviation()), "deg"); Application::Log(stresultsPvl); // Update the label with BandBin keywords PvlKeyword filter("FilterName", "Elevation", "meters"); filter.addValue("ElevationError", "meters"); filter.addValue("GoodnessOfFit", "unitless"); PvlKeyword center("Center", "1.0"); center.addValue("1.0"); center.addValue("1.0"); PvlGroup &bandbin = ocube->label()->findGroup("BandBin", PvlObject::Traverse); bandbin.addKeyword(filter, PvlContainer::Replace); bandbin.addKeyword(center, PvlContainer::Replace); center.setName("Width"); bandbin.addKeyword(center, PvlContainer::Replace); p.EndProcess(); } // If a cnet file was entered, write the ControlNet pvl to the file if (ui.WasEntered("ONET")) { WriteCnet(ui.GetFileName("ONET"), bmf, lhCamera->target()->name(), serialLeft, serialRight); } // Create output data PvlGroup totalPointsPvl("Totals"); totalPointsPvl += PvlKeyword("AttemptedPoints", toString(numAttemptedInitialPoints)); totalPointsPvl += PvlKeyword("InitialSuccesses", toString(numOrigPoints)); totalPointsPvl += PvlKeyword("GrowSuccesses", toString(passpix2)); totalPointsPvl += PvlKeyword("ResultingPoints", toString(bmf.size())); Application::Log(totalPointsPvl); Pvl arPvl = matcher.RegistrationStatistics(); PvlGroup smtkresultsPvl("SmtkResults"); smtkresultsPvl += PvlKeyword("SpiceOffImage", toString(matcher.OffImageErrorCount())); smtkresultsPvl += PvlKeyword("SpiceDistanceError", toString(matcher.SpiceErrorCount())); arPvl.addGroup(smtkresultsPvl); for(int i = 0; i < arPvl.groups(); i++) { Application::Log(arPvl.group(i)); } // add the auto registration information to print.prt PvlGroup autoRegTemplate = matcher.RegTemplate(); Application::Log(autoRegTemplate); // Don't need the cubes opened anymore lhImage.close(); rhImage.close(); }
/** * FindCnetRef traverses all the control points and measures in the network and checks for * valid Measure which passes the Emission Incidence Angle, DN value tests and chooses the * measure with the best Resolution criteria as the reference. Creates a new control network * with these adjustments. * * @author Sharmila Prasad (5/25/2010) * @history 2010-10-04 Sharmila Prasad - Modified for Binary CNet (Edit Lock) * * @param pNewNet - Modified output Control Net * */ void CnetRefByResolution::FindCnetRef(ControlNet &pNewNet) { // Process each existing control point in the network int iPointsModified = 0; int iMeasuresModified = 0; int iRefChanged = 0; //Status Report mStatus.SetText("Choosing Reference by Resolution..."); mStatus.SetMaximumSteps(pNewNet.GetNumPoints()); mStatus.CheckStatus(); //mPvlLog += GetStdOptions(); for (int point = 0; point < pNewNet.GetNumPoints(); ++point) { ControlPoint *newPnt = pNewNet.GetPoint(point); bool bError = false; // Create a copy of original control point const ControlPoint origPnt(*newPnt); mdResVector.clear(); // Logging PvlObject pvlPointObj("PointDetails"); pvlPointObj += Isis::PvlKeyword("PointId", newPnt->GetId()); // Edit Lock Option bool bPntEditLock = newPnt->IsEditLocked(); if (!bPntEditLock) { newPnt->SetDateTime(Application::DateTime()); } else { pvlPointObj += Isis::PvlKeyword("Reference", "No Change, PointEditLock"); } int iNumMeasuresLocked = newPnt->GetNumLockedMeasures(); bool bRefLocked = newPnt->GetRefMeasure()->IsEditLocked(); int numMeasures = newPnt->GetNumMeasures(); int iRefIndex = -1; if (newPnt->IsReferenceExplicit()) iRefIndex = newPnt->IndexOfRefMeasure(); QString istrTemp; std::vector <PvlGroup> pvlGrpVector; int iBestIndex = 0; // Only perform the interest operation on points of type "Free" and // Points having atleast 1 measure and Point is not Ignored // Check for EditLock in the Measures and also verfify that // only a Reference Measure can be Locked else error if (!newPnt->IsIgnored() && newPnt->GetType() == ControlPoint::Free && numMeasures > 0 && (iNumMeasuresLocked == 0 || (iNumMeasuresLocked > 0 && bRefLocked))) { int iNumIgnore = 0; QString istrTemp; for (int measure = 0; measure < newPnt->GetNumMeasures(); ++measure) { ControlMeasure *newMsr = newPnt->GetMeasure(measure); bool bMeasureLocked = newMsr->IsEditLocked(); double dSample = newMsr->GetSample(); double dLine = newMsr->GetLine(); QString sn = newMsr->GetCubeSerialNumber(); if (!bPntEditLock && !bMeasureLocked) { newMsr->SetDateTime(Application::DateTime()); newMsr->SetChooserName("Application cnetref(Resolution)"); } // Log PvlGroup pvlMeasureGrp("MeasureDetails"); pvlMeasureGrp += Isis::PvlKeyword("SerialNum", sn); pvlMeasureGrp += Isis::PvlKeyword("OriginalLocation", LocationString(dSample, dLine)); if (bMeasureLocked) pvlMeasureGrp += Isis::PvlKeyword("EditLock", "True"); if (!newMsr->IsIgnored()) { Cube *measureCube = mCubeMgr.OpenCube(mSerialNumbers.FileName(sn)); MeasureValidationResults results = ValidStandardOptions(newMsr, measureCube, &pvlMeasureGrp); if (!results.isValid()) { if (bPntEditLock) { pvlMeasureGrp += Isis::PvlKeyword("UnIgnored", "Failed Validation Test but not Ignored as Point EditLock is True"); } else if (bMeasureLocked) { pvlMeasureGrp += Isis::PvlKeyword("UnIgnored", "Failed Validation Test but not Ignored as Measure EditLock is True"); } else { pvlMeasureGrp += Isis::PvlKeyword("Ignored", "Failed Validation Test"); newMsr->SetIgnored(true); iNumIgnore++; } } // valid measure else { if (!bPntEditLock && !bRefLocked) { newMsr->SetType(ControlMeasure::Candidate); newMsr->SetIgnored(false); mdResVector.push_back(mdResolution); } } } // Ignore == false else { pvlMeasureGrp += Isis::PvlKeyword("Ignored", "Originally Ignored"); iNumIgnore++; } if (newMsr != origPnt.GetMeasure(measure)) { iMeasuresModified++; } //newPnt.UpdateMeasure(newMsr); // Redesign fixed this pvlGrpVector.push_back(pvlMeasureGrp); }// end Measure if ((newPnt->GetNumMeasures() - iNumIgnore) < 2) { if (bPntEditLock) { pvlPointObj += Isis::PvlKeyword("UnIgnored", "Good Measures less than 2 but not Ignored as Point EditLock is True"); } else { newPnt->SetIgnored(true); pvlPointObj += Isis::PvlKeyword("Ignored", "Good Measures less than 2"); } } // Set the Reference if the Point is unlocked and Reference measure is unlocked if (!newPnt->IsIgnored() && !bPntEditLock && !bRefLocked) { iBestIndex = GetReferenceByResolution(newPnt); if (iBestIndex >= 0 && !newPnt->GetMeasure(iBestIndex)->IsIgnored()) { newPnt->SetRefMeasure(iBestIndex); //newPnt.UpdateMeasure(cm); // Redesign fixed this pvlGrpVector[iBestIndex] += Isis::PvlKeyword("Reference", "true"); } else { if (iBestIndex < 0 && meType == Range) { pvlPointObj += Isis::PvlKeyword("NOTE", "No Valid Measures within the Resolution Range. Reference defaulted to the first Measure"); } iBestIndex = 0; newPnt->SetRefMeasure(iBestIndex); //newPnt.UpdateMeasure(cm); // Redesign fixed this // Log info, if Point not locked, apriori source == Reference and a new reference if (iRefIndex != iBestIndex && newPnt->GetAprioriSurfacePointSource() == ControlPoint::SurfacePointSource::Reference) { pvlGrpVector[iBestIndex] += Isis::PvlKeyword("AprioriSource", "Reference is the source and has changed"); } } } for (int i = 0; i < newPnt->GetNumMeasures(); i++) { pvlPointObj += pvlGrpVector[i]; } } // end Free else { int iComment = 0; if (numMeasures == 0) { QString sComment = "Comment"; sComment += QString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "No Measures in the Point"); } if (newPnt->IsIgnored()) { QString sComment = "Comment"; sComment += QString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Point was originally Ignored"); } if (newPnt->GetType() == ControlPoint::Fixed) { QString sComment = "Comment"; sComment += QString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Fixed Point"); } else if (newPnt->GetType() == ControlPoint::Constrained) { QString sComment = "Comment"; sComment += QString(++iComment); pvlPointObj += Isis::PvlKeyword(sComment, "Constrained Point"); } if (iNumMeasuresLocked > 0 && !bRefLocked) { pvlPointObj += Isis::PvlKeyword("Error", "Point has a Measure with EditLock set to true " "but the Reference is not Locked"); bError = true; } else { for (int measure = 0; measure < newPnt->GetNumMeasures(); measure++) { ControlMeasure *cm = newPnt->GetMeasure(iBestIndex); cm->SetDateTime(Application::DateTime()); cm->SetChooserName("Application cnetref(Resolution)"); //newPnt.UpdateMeasure(cm); // Redesign fixed this } } } if (*newPnt != origPnt) { iPointsModified++; } if (!bError && !newPnt->IsIgnored() && newPnt->IsReferenceExplicit() && iBestIndex != iRefIndex && !bPntEditLock && !bRefLocked) { iRefChanged++; PvlGroup pvlRefChangeGrp("ReferenceChangeDetails"); if (iRefIndex >= 0) { pvlRefChangeGrp += Isis::PvlKeyword("PrevSerialNumber", origPnt.GetMeasure(iRefIndex)->GetCubeSerialNumber()); pvlRefChangeGrp += Isis::PvlKeyword("PrevResolution", toString(mdResVector[iRefIndex])); istrTemp = QString((int)origPnt.GetMeasure(iRefIndex)->GetSample()); istrTemp += ","; istrTemp += QString((int)origPnt.GetMeasure(iRefIndex)->GetLine()); pvlRefChangeGrp += Isis::PvlKeyword("PrevLocation", istrTemp); } else { pvlRefChangeGrp += Isis::PvlKeyword("PrevReference", "Not Set"); } pvlRefChangeGrp += Isis::PvlKeyword("NewSerialNumber", newPnt->GetMeasure(iBestIndex)->GetCubeSerialNumber()); QString sKeyName = "NewHighestResolution"; if (meType == Low) { sKeyName = "NewLeastResolution"; } else if (meType == Mean) { pvlRefChangeGrp += Isis::PvlKeyword("MeanResolution", toString(GetMeanResolution())); sKeyName = "NewResolutionNeartoMean"; } else if (meType == Nearest) { sKeyName = "NewResolutionNeartoValue"; } else if (meType == Range) { sKeyName = "NewResolutionInRange"; } pvlRefChangeGrp += Isis::PvlKeyword(sKeyName, toString(mdResVector[iBestIndex])); istrTemp = QString((int)newPnt->GetMeasure(iBestIndex)->GetSample()); istrTemp += ","; istrTemp += QString((int)newPnt->GetMeasure(iBestIndex)->GetLine()); pvlRefChangeGrp += Isis::PvlKeyword("NewLocation", istrTemp); pvlPointObj += pvlRefChangeGrp; } else { pvlPointObj += Isis::PvlKeyword("Reference", "No Change"); } //pNewNet.UpdatePoint(newPnt); // Redesign fixed this mPvlLog += pvlPointObj; mStatus.CheckStatus(); }// end Point // CnetRef Change Statistics mStatisticsGrp += Isis::PvlKeyword("PointsModified", toString(iPointsModified)); mStatisticsGrp += Isis::PvlKeyword("ReferenceChanged", toString(iRefChanged)); mStatisticsGrp += Isis::PvlKeyword("MeasuresModified", toString(iMeasuresModified)); mPvlLog += mStatisticsGrp; }
/** * Repaint the viewport * * @internal * @history 2011-08-23 Tracie Sucharski - Use the GetMeasuresInCube method * from ControlNet to get list of measures rather * than searching through entire net. * @history 2011-11-09 Tracie Sucharski - If there are no measures for * this cube, return. */ void ChipViewport::paintEvent(QPaintEvent *e) { QPainter painter(this); if (p_tempView != NULL) { painter.drawImage(0, 0, *(p_tempView->p_image)); } else { painter.drawImage(0, 0, *p_image); } if (p_cross == true) { painter.setPen(Qt::red); painter.drawLine(0, (p_height - 1) / 2, p_width - 1, (p_height - 1) / 2); painter.drawLine((p_width - 1) / 2, 0, (p_width - 1) / 2, p_height - 1); } if (p_circle == true) { painter.setPen(Qt::red); painter.drawEllipse((p_height - 1) / 2 - p_circleSize / 2, (p_width - 1) / 2 - p_circleSize / 2, p_circleSize, p_circleSize); } QString serialNumber = p_chipCube? SerialNumber::Compose(*p_chipCube) : QString(); if (p_controlNet && !serialNumber.isEmpty() && p_controlNet->GetCubeSerials().contains( serialNumber)) { // draw measure locations if we have a control network // If the serial number is Unknown, we probably have a ground source // file or level 2 which means it does not exist in the network // TODO: Is there a better way to handle this? if (p_showPoints && serialNumber.compare("Unknown") && p_controlNet->GetNumPoints() != 0) { QList<ControlMeasure *> measures = p_controlNet->GetMeasuresInCube(serialNumber); // loop through all points in the control net for (int i = 0; i < measures.count(); i++) { ControlMeasure *m = measures[i]; // Find the measurments on the viewport double samp = m->GetSample(); double line = m->GetLine(); int x, y; cubeToViewport(samp, line, x, y); // Determine pen color // if the point or measure is ignored set to yellow if (m->Parent()->IsIgnored() || (!m->Parent()->IsIgnored() && m->IsIgnored())) { painter.setPen(QColor(255, 255, 0)); // set point marker yellow } // check for ground measure else if (m->Parent()->GetType() == ControlPoint::Fixed) { painter.setPen(Qt::magenta);// set point marker magenta } else { painter.setPen(Qt::green); // set all other point markers green } // draw points which are not under cross if (x != (p_width - 1) / 2 || y != (p_height - 1) / 2) { painter.drawLine(x - 5, y, x + 5, y); painter.drawLine(x, y - 5, x, y + 5); } } } } p_tempView = NULL; //painter.end(); }