Commit d9c96340 authored by Adam Goins's avatar Adam Goins Committed by Makayla Shepherd
Browse files

Added Progress in methods signatures and prototypes during read.

parent b11b9024
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -242,7 +242,7 @@ namespace Isis {
  void ControlNet::ReadControl(const QString &filename, Progress *progress) {

    FileName cnetFileName(filename);
    ControlNetVersioner versionedReader(cnetFileName);
    ControlNetVersioner versionedReader(cnetFileName, progress);

    SetTarget( versionedReader.targetName() );
    p_networkId   = versionedReader.netId();
+32 −20
Original line number Diff line number Diff line
@@ -72,12 +72,13 @@ namespace Isis {
   * ControlPoints.
   *
   * @param netFile The control network file to read in.
   * @param progress The progress object to track reading points.
   *
   * @see ControlNetVersioner::Read
   */
  ControlNetVersioner::ControlNetVersioner(const FileName netFile)
  ControlNetVersioner::ControlNetVersioner(const FileName netFile, Progress *progress)
      : m_ownsPoints(true) {
    read(netFile);
    read(netFile, progress);
  }


@@ -559,17 +560,18 @@ namespace Isis {
   * a control network.
   *
   * @param netFile The control network file to read.
   * @param progress The progress object to track reading points.
   */
  void ControlNetVersioner::read(const FileName netFile) {
  void ControlNetVersioner::read(const FileName netFile, Progress *progress) {
    try {

      const Pvl &network(netFile.expanded());

      if ( network.hasObject("ProtoBuffer") ) {
        readProtobuf(network, netFile);
        readProtobuf(network, netFile, progress);
      }
      else if ( network.hasObject("ControlNetwork") ) {
        readPvl(network);
        readPvl(network, progress);
      }
      else {
        QString msg = "Could not determine the control network file type";
@@ -589,8 +591,9 @@ namespace Isis {
   * control network.
   *
   * @param network The Pvl network data
   * @param progress The progress object to track reading points.
   */
  void ControlNetVersioner::readPvl(const Pvl &network) {
  void ControlNetVersioner::readPvl(const Pvl &network, Progress *progress) {
    const PvlObject &controlNetwork = network.findObject("ControlNetwork");

    int version = 1;
@@ -601,19 +604,19 @@ namespace Isis {

    switch ( version ) {
      case 1:
        readPvlV0001(controlNetwork);
        readPvlV0001(controlNetwork, progress);
        break;
      case 2:
        readPvlV0002(controlNetwork);
        readPvlV0002(controlNetwork, progress);
        break;
      case 3:
        readPvlV0003(controlNetwork);
        readPvlV0003(controlNetwork, progress);
        break;
      case 4:
        readPvlV0004(controlNetwork);
        readPvlV0004(controlNetwork, progress);
        break;
      case 5:
        readPvlV0005(controlNetwork);
        readPvlV0005(controlNetwork, progress);
        break;
      default:
        QString msg = "The Pvl file version [" + toString(version)
@@ -627,8 +630,9 @@ namespace Isis {
   * read a version 1 Pvl control network and convert the data into control points.
   *
   * @param network The control network PvlObject.
   * @param progress The progress object to track reading points.
   */
  void ControlNetVersioner::readPvlV0001(const PvlObject &network) {
  void ControlNetVersioner::readPvlV0001(const PvlObject &network, Progress *progress) {
    // initialize the header
    ControlNetHeaderV0001 header;

@@ -668,8 +672,9 @@ namespace Isis {
   * read a version 2 Pvl control network and convert the data into control points.
   *
   * @param network The control network PvlObject.
   * @param progress The progress object to track reading points.
   */
  void ControlNetVersioner::readPvlV0002(const PvlObject &network) {
  void ControlNetVersioner::readPvlV0002(const PvlObject &network, Progress *progress) {
    // initialize the header
    try {
      ControlNetHeaderV0002 header;
@@ -706,8 +711,9 @@ namespace Isis {
   * read a version 3 Pvl control network and convert the data into control points.
   *
   * @param network The control network PvlObject.
   * @param progress The progress object to track reading points.
   */
  void ControlNetVersioner::readPvlV0003(const PvlObject &network) {
  void ControlNetVersioner::readPvlV0003(const PvlObject &network, Progress *progress) {
    // initialize the header
    try {
      ControlNetHeaderV0003 header;
@@ -744,8 +750,9 @@ namespace Isis {
   * read a version 4 Pvl control network and convert the data into control points.
   *
   * @param network The control network PvlObject.
   * @param progress The progress object to track reading points.
   */
  void ControlNetVersioner::readPvlV0004(const PvlObject &network) {
  void ControlNetVersioner::readPvlV0004(const PvlObject &network, Progress *progress) {
    // initialize the header
    try {
      ControlNetHeaderV0004 header;
@@ -782,8 +789,9 @@ namespace Isis {
   * read a version 5 Pvl control network and convert the data into control points.
   *
   * @param network The control network PvlObject.
   * @param progress The progress object to track reading points.
   */
  void ControlNetVersioner::readPvlV0005(const PvlObject &network) {
  void ControlNetVersioner::readPvlV0005(const PvlObject &network, Progress *progress) {
    // initialize the header
    try {
      ControlNetHeaderV0005 header;
@@ -822,8 +830,9 @@ namespace Isis {
   *
   * @param header The Pvl network header that contains the version number.
   * @param netFile The filename of the control network file.
   * @param progress The progress object to track reading points.
   */
  void ControlNetVersioner::readProtobuf(const Pvl &header, const FileName netFile) {
  void ControlNetVersioner::readProtobuf(const Pvl &header, const FileName netFile, Progress *progress) {
    int version = 1;

    const PvlObject &protoBuf = header.findObject("ProtoBuffer");
@@ -855,8 +864,9 @@ namespace Isis {
   *  converted into a control network.
   *
   * @param netFile The filename of the control network file.
   * @param progress The progress object to track reading points.
   */
  void ControlNetVersioner::readProtobufV0001(const Pvl &header, const FileName netFile) {
  void ControlNetVersioner::readProtobufV0001(const Pvl &header, const FileName netFile, Progress *progress) {
    const PvlObject &protoBufferInfo = header.findObject("ProtoBuffer");
    const PvlObject &protoBufferCore = protoBufferInfo.findObject("Core");

@@ -963,8 +973,9 @@ namespace Isis {
   *  converted into a control network.
   *
   * @param netFile The filename of the control network file.
   * @param progress The progress object to track reading points.
   */
  void ControlNetVersioner::readProtobufV0002(const Pvl &header, const FileName netFile) {
  void ControlNetVersioner::readProtobufV0002(const Pvl &header, const FileName netFile, Progress *progress) {
    // read the header protobuf object
    const PvlObject &protoBufferInfo = header.findObject("ProtoBuffer");
    const PvlObject &protoBufferCore = protoBufferInfo.findObject("Core");
@@ -1066,8 +1077,9 @@ namespace Isis {
   *  converted into a control network.
   *
   * @param netFile The filename of the control network file.
   * @param progress The progress object to track reading points.
   */
  void ControlNetVersioner::readProtobufV0005(const Pvl &header, const FileName netFile) {
  void ControlNetVersioner::readProtobufV0005(const Pvl &header, const FileName netFile, Progress *progress) {
    // read the header protobuf object
    const PvlObject &protoBufferInfo = header.findObject("ProtoBuffer");
    const PvlObject &protoBufferCore = protoBufferInfo.findObject("Core");
+13 −12
Original line number Diff line number Diff line
@@ -198,12 +198,13 @@ namespace Isis {
   *                           correctly.
   *   @history 2018-01-12 Adam Goins - Added the ControlPoint radii to the header to avoid
   *                           Target::GetRadii calls to speed up createPoint().
   *   @history 2018-01-12 Adam Goins - Added Progress during reads.
   */
  class ControlNetVersioner {

    public:
      ControlNetVersioner(ControlNet *net);
      ControlNetVersioner(const FileName netFile);
      ControlNetVersioner(const FileName netFile, Progress *progress);
      ~ControlNetVersioner();

      QString netId() const;
@@ -246,19 +247,19 @@ namespace Isis {
      typedef ControlPointV0003 ControlPointV0004;
      typedef ControlPointV0003 ControlPointV0005;

      void read(const FileName netFile);
      void read(const FileName netFile, Progress *progress);

      void readPvl(const Pvl &network);
      void readPvlV0001(const PvlObject &network);
      void readPvlV0002(const PvlObject &network);
      void readPvlV0003(const PvlObject &network);
      void readPvlV0004(const PvlObject &network);
      void readPvlV0005(const PvlObject &network);
      void readPvl(const Pvl &network, Progress *progress);
      void readPvlV0001(const PvlObject &network, Progress *progress);
      void readPvlV0002(const PvlObject &network, Progress *progress);
      void readPvlV0003(const PvlObject &network, Progress *progress);
      void readPvlV0004(const PvlObject &network, Progress *progress);
      void readPvlV0005(const PvlObject &network, Progress *progress);

      void readProtobuf(const Pvl &header, const FileName netFile);
      void readProtobufV0001(const Pvl &header, const FileName netFile);
      void readProtobufV0002(const Pvl &header, const FileName netFile);
      void readProtobufV0005(const Pvl &header, const FileName netFile);
      void readProtobuf(const Pvl &header, const FileName netFile, Progress *progress);
      void readProtobufV0001(const Pvl &header, const FileName netFile, Progress *progress);
      void readProtobufV0002(const Pvl &header, const FileName netFile, Progress *progress);
      void readProtobufV0005(const Pvl &header, const FileName netFile, Progress *progress);

      ControlPoint *createPoint(ControlPointV0001 &point);
      ControlPoint *createPoint(ControlPointV0002 &point);