Commit c47aca72 authored by Jeannie Backer's avatar Jeannie Backer Committed by Makayla Shepherd
Browse files

Merged with other updates.

parent 16fd2163
Loading
Loading
Loading
Loading
+83 −89
Original line number Diff line number Diff line
@@ -90,28 +90,28 @@ namespace Isis {
  }


  //! Initialize pointers and other data to NULL
  //! initialize pointers and other data to NULL
  void ControlMeasure::InitializeToNull() {
    p_serialNumber = NULL;
    p_chooserName = NULL;
    p_dateTime = NULL;
    p_loggedData = NULL;

    p_diameter = NULL;
    p_aprioriSample = NULL;
    p_aprioriLine = NULL;
    p_computedEphemerisTime = NULL;
    p_sampleSigma = NULL;
    p_lineSigma = NULL;
    p_sampleResidual = NULL;
    p_lineResidual = NULL;
    p_diameter = Null;
    p_aprioriSample = Null;
    p_aprioriLine = Null;
    p_computedEphemerisTime = Null;
    p_sampleSigma = Null;
    p_lineSigma = Null;
    p_sampleResidual = Null;
    p_lineResidual = Null;

    p_camera = NULL;
    p_focalPlaneMeasuredX = NULL;
    p_focalPlaneMeasuredY = NULL;
    p_focalPlaneComputedX = NULL;
    p_focalPlaneComputedY = NULL;
    p_measuredEphemerisTime = NULL; 
    p_focalPlaneMeasuredX = Null;
    p_focalPlaneMeasuredY = Null;
    p_focalPlaneComputedX = Null;
    p_focalPlaneComputedY = Null;
    p_measuredEphemerisTime = Null;

    parentPoint = NULL;
    associatedCSN = NULL;
@@ -965,81 +965,75 @@ namespace Isis {
    return sPrintable;
  }

  //! Returns true if the ControlMeasure has a choosername
  bool ControlMeasure::HasChooserName() const {
    return !p_chooserName->isEmpty();
  }

  //! Returns true if the ControlMeasure has a datetime
  bool ControlMeasure::HasDateTime() const {
    return !p_dateTime->isEmpty();
  }

  //! Returns true if the ControlMeasure has a sample
  bool ControlMeasure::HasSample() const {
    return p_sample ? true : false;
  }

  //! Returns true if the ControlMeasure has a line
  bool ControlMeasure::HasLine() const {
    return p_line ? true : false;
  }

  //! Returns true if the ControlMeasure has a diameter
  bool ControlMeasure::HasDiameter() const {
    return p_diameter ? true : false;
  }

  //! Returns true if the ControlMeasure has apriorisample
  bool ControlMeasure::HasAprioriSample() const {
    if (p_aprioriSample) {
      return true;
    }
    else {
      return false;
      //    return p_aprioriSample ? true : false;
      }
    }

  //! Returns true if the ControlMeasure has aprioriline
  bool ControlMeasure::HasAprioriLine() const {
    return p_aprioriLine ? true : false;
  }

  //! Returns true if the ControlMeasure has a sample sigma
  bool ControlMeasure::HasSampleSigma() const {
    return p_sampleSigma ? true : false;
  }

  //! Returns true if the ControlMeasure has a line sigma
  bool ControlMeasure::HasLineSigma() const {
    return p_lineSigma ? true : false;
  }

  //! Returns true if the ControlMeasure has a sample residual
  bool ControlMeasure::HasSampleResidual() const {
    return p_sampleResidual ? true : false;
  }

  //! Returns true if the ControlMeasure has a line residual
  bool ControlMeasure::HasLineResidual() const {
    return p_lineResidual ? true : false;
  }

  //! Returns true if the ControlMeasure's jigsaw rejected is initialized
  bool ControlMeasure::HasJigsawRejected() const {
    return p_jigsawRejected ? true : false;
  }

  //! Returns true if the ControlMeasure is jigsaw rejected
  bool ControlMeasure::JigsawRejected() const {
    return p_jigsawRejected ? true : false;
  }

  //! Returns the logsize of the ControlMeasure logged data.
  int ControlMeasure::LogSize() const {
    return p_loggedData->size();
  }
//???  //! Returns true if the ControlMeasure has a choosername
//???  bool ControlMeasure::HasChooserName() const {
//???    return !p_chooserName->isEmpty();
//???  }
//???
//???  //! Returns true if the ControlMeasure has a datetime
//???  bool ControlMeasure::HasDateTime() const {
//???    return !p_dateTime->isEmpty();
//???  }
//???
//???  //! Returns true if the ControlMeasure has a sample
//???  bool ControlMeasure::HasSample() const {
//???    return p_sample ? true : false;
//???  }
//???
//???  //! Returns true if the ControlMeasure has a line
//???  bool ControlMeasure::HasLine() const {
//???    return p_line ? true : false;
//???  }
//???
//???  //! Returns true if the ControlMeasure has a diameter
//???  bool ControlMeasure::HasDiameter() const {
//???    return p_diameter ? true : false;
//???  }
//???
//???  //! Returns true if the ControlMeasure has apriorisample
//???  bool ControlMeasure::HasAprioriSample() const {
//???    return p_aprioriSample ? true : false;
//???  }
//???
//???  //! Returns true if the ControlMeasure has aprioriline
//???  bool ControlMeasure::HasAprioriLine() const {
//???    return p_aprioriLine ? true : false;
//???  }
//???
//???  //! Returns true if the ControlMeasure has a sample sigma
//???  bool ControlMeasure::HasSampleSigma() const {
//???    return p_sampleSigma ? true : false;
//???  }
//???
//???  //! Returns true if the ControlMeasure has a line sigma
//???  bool ControlMeasure::HasLineSigma() const {
//???    return p_lineSigma ? true : false;
//???  }
//???
//???  //! Returns true if the ControlMeasure has a sample residual
//???  bool ControlMeasure::HasSampleResidual() const {
//???    return p_sampleResidual ? true : false;
//???  }
//???
//???  //! Returns true if the ControlMeasure has a line residual
//???  bool ControlMeasure::HasLineResidual() const {
//???    return p_lineResidual ? true : false;
//???  }
//???
//???  //! Returns true if the ControlMeasure's jigsaw rejected is initialized
//???  bool ControlMeasure::HasJigsawRejected() const {
//???    return p_jigsawRejected ? true : false;
//???  }
//???
//???  //! Returns true if the ControlMeasure is jigsaw rejected
//???  bool ControlMeasure::JigsawRejected() const {
//???    return p_jigsawRejected ? true : false;
//???  }
//???
//???  //! Returns the logsize of the ControlMeasure logged data.
//???  int ControlMeasure::LogSize() const {
//???    return p_loggedData->size();
//???  }

  /**
   * Obtain a string representation of the MeasureType
+165 −127
Original line number Diff line number Diff line
@@ -441,9 +441,14 @@ namespace Isis {
          pvlMeasure += PvlKeyword("Ignore", "True");
        }

        // Sample, Line are always initialized to 0. 
        if ( controlMeasure.HasSample() ) {
          pvlMeasure += PvlKeyword("Sample", toString(controlMeasure.GetSample()));

        }

        if ( controlMeasure.HasLine() ) {
          pvlMeasure += PvlKeyword("Line", toString(controlMeasure.GetLine()));
        }

        if ( controlMeasure.HasDiameter() ) {
          pvlMeasure += PvlKeyword("Diameter", toString(controlMeasure.GetDiameter()));
@@ -1090,7 +1095,7 @@ namespace Isis {
    int pointIndex = -1;
    while (pointInStream.ByteCount() < pointsLength) {
      pointIndex += 1;
      QSharedPointer<ControlPointFileEntryV0002> newPoint(new ControlPointFileEntryV0002);
      QSharedPointer<ControlPointFileEntryV0002> newPoint;

      try {
        CodedInputStream* pointCodedInStream = new CodedInputStream(&pointInStream);
@@ -1181,10 +1186,14 @@ namespace Isis {
    ControlPointFileEntryV0002 protoPoint = point.pointData();
    ControlPoint *controlPoint = new ControlPoint;

    // ID is required, no need for if-statement here
    controlPoint->SetId(QString(protoPoint.id().c_str()));

    if ( protoPoint.has_choosername() ) {
      controlPoint->SetChooserName(protoPoint.choosername().c_str());
    }

    // setting point type
    // point type is required, no need for if statement here
    ControlPoint::PointType pointType;
    switch ( protoPoint.type() ) {
      case ControlPointFileEntryV0002_PointType_obsolete_Tie:
@@ -1374,6 +1383,7 @@ namespace Isis {
      controlPoint->SetEditLock(protoPoint.editlock());
    }
    return controlPoint;

  }


@@ -1386,10 +1396,12 @@ namespace Isis {
   *         file.
   */
  ControlMeasure *ControlNetVersioner::createMeasure(const ControlPointFileEntryV0002_Measure &measure) {

    ControlMeasure *newMeasure = new ControlMeasure;
    if ( measure.has_serialnumber() ) {

    // serial number is required, no need for if-statement
    newMeasure->SetCubeSerialNumber(QString(measure.serialnumber().c_str()));
    }

    if ( measure.has_choosername() ) {
      newMeasure->SetChooserName(QString(measure.choosername().c_str()));
    }
@@ -1397,6 +1409,7 @@ namespace Isis {
      newMeasure->SetDateTime(QString(measure.datetime().c_str()));
    }

    // measure type is required, no need for if-statement
    ControlMeasure::MeasureType measureType;
    switch ( measure.type() ) {
      case ControlPointFileEntryV0002_Measure::Candidate:
@@ -1607,7 +1620,7 @@ namespace Isis {


 /**
  * This will write the first control control point to a ZeroCopyOutputStream.
  * This will write the first control point to a ZeroCopyOutputStream.
  * The written point will be removed from the versioner and deleted if the versioner
  * has ownership of it.
  *
@@ -1622,9 +1635,15 @@ namespace Isis {
      ControlPointFileEntryV0002 protoPoint;
      ControlPoint *controlPoint = m_points.takeFirst();

      if ( !controlPoint->GetId().isEmpty() ) {
      if ( controlPoint->GetId().isEmpty() ) {
        QString msg = "Unbable to write first point of control net. "
                      "Invalid control point has no point ID value.";
        throw IException(IException::Unknown, msg, _FILEINFO_);
      }
      else {
        protoPoint.set_id(controlPoint->GetId().toLatin1().data());
      }

      if ( !controlPoint->GetChooserName().isEmpty() ) {
        protoPoint.set_choosername(controlPoint->GetChooserName().toLatin1().data());
      }
@@ -1632,7 +1651,7 @@ namespace Isis {
        protoPoint.set_datetime(controlPoint->GetDateTime().toLatin1().data());
      }
      if ( controlPoint->IsEditLocked() ) {
        protoPoint.set_editlock(controlPoint->IsEditLocked());
        protoPoint.set_editlock(true);
      }

      ControlPointFileEntryV0002_PointType pointType;
@@ -1655,11 +1674,20 @@ namespace Isis {
      protoPoint.set_type(pointType);

      if ( controlPoint->IsIgnored() ) {
        protoPoint.set_ignore(controlPoint->IsIgnored());
        protoPoint.set_ignore(true);
      }

      if ( controlPoint->IsRejected() ) {
        protoPoint.set_jigsawrejected(true);
      }

      if ( controlPoint->HasRefMeasure() && controlPoint->IsReferenceExplicit() ) {
        protoPoint.set_referenceindex(controlPoint->IndexOfRefMeasure());
      }

      if ( controlPoint->HasAprioriSurfacePointSourceFile() ) {
        protoPoint.set_apriorisurfpointsourcefile(controlPoint->GetAprioriSurfacePointSourceFile().toLatin1().data());
        protoPoint.set_apriorisurfpointsourcefile(
                   controlPoint->GetAprioriSurfacePointSourceFile().toLatin1().data());
      }

      // Apriori Surf Point Source ENUM settting
@@ -1717,7 +1745,8 @@ namespace Isis {
      }

      if ( controlPoint->HasAprioriRadiusSourceFile() ) {
        protoPoint.set_aprioriradiussourcefile(controlPoint->GetAprioriRadiusSourceFile().toLatin1().data());
        protoPoint.set_aprioriradiussourcefile(
                   controlPoint->GetAprioriRadiusSourceFile().toLatin1().data());
      }

      SurfacePoint aprioriSurfacePoint = controlPoint->GetAprioriSurfacePoint();
@@ -1737,6 +1766,7 @@ namespace Isis {
        }
      }

      // this might be redundant... determined by covariance matrix???
      if ( controlPoint->IsLatitudeConstrained() ) {
        protoPoint.set_latitudeconstrained(controlPoint->IsLatitudeConstrained());
      }
@@ -1773,9 +1803,9 @@ namespace Isis {

        ControlPointFileEntryV0002_Measure protoMeasure;

        if (controlPoint->HasRefMeasure() && controlPoint->IndexOfRefMeasure() == j) {
             protoPoint.set_referenceindex(j);
        }
//??? moved        if ( controlPoint->HasRefMeasure() && controlPoint->IndexOfRefMeasure() == j ) {
//??? moved             protoPoint.set_referenceindex(j);
//??? moved        }

        protoMeasure.set_serialnumber(controlMeasure.GetCubeSerialNumber().toLatin1().data());

@@ -1806,16 +1836,24 @@ namespace Isis {
        }

        if ( controlMeasure.IsEditLocked() ) {
          protoMeasure.set_editlock(controlMeasure.IsEditLocked());
          protoMeasure.set_editlock(true);
        }

        if ( controlMeasure.IsIgnored() ) {
          protoMeasure.set_ignore(controlMeasure.IsIgnored());
          protoMeasure.set_ignore(true);
        }

        // Always set
        if ( controlMeasure.IsRejected() ) {
          protoMeasure.set_jigsawrejected(true);
        }

        if ( controlMeasure.HasSample() ) {
          protoMeasure.set_sample(controlMeasure.GetSample());
        }

        if ( controlMeasure.HasLine() ) {
          protoMeasure.set_line(controlMeasure.GetLine());
        }

        if ( controlMeasure.HasDiameter() ) {
          protoMeasure.set_diameter(controlMeasure.GetDiameter());
@@ -1845,9 +1883,9 @@ namespace Isis {
          protoMeasure.set_lineresidual(controlMeasure.GetLineResidual());
        }

        // I removed the if statement because we always initialize jigsawRejected to false
        // in ControlPoint.
        protoMeasure.set_jigsawrejected(controlMeasure.JigsawRejected());
        if ( controlMeasure.IsRejected() ) {
          protoMeasure.set_jigsawrejected(true);
        }

        QVector<ControlMeasureLogData> measureLogs = controlMeasure.GetLogDataEntries();
        for (int logEntry = 0;
@@ -1870,9 +1908,9 @@ namespace Isis {
          *protoMeasure.add_log() = logData;
        }

        if (controlPoint->HasRefMeasure() && controlPoint->IndexOfRefMeasure() == j) {
             protoPoint.set_referenceindex(j);
        }
//???        if ( controlPoint->HasRefMeasure() && controlPoint->IndexOfRefMeasure() == j ) {
//???             protoPoint.set_referenceindex(j);
//???        }
        *protoPoint.add_measures() = protoMeasure;
      }

@@ -1891,6 +1929,6 @@ namespace Isis {
      }

      // return size of message
      return ( fileStream.ByteCount() );
      return fileStream.ByteCount();
  }
}