Loading isis/src/control/objs/ControlNet/ControlNet.cpp +84 −108 Original line number Diff line number Diff line Loading @@ -236,48 +236,24 @@ namespace Isis { * they are read into memory instead of setting * parent prematurely to be able to set the radii * in ControlPoint. * @history 2017-12-21 Jesse Mapel - Modified to use the ControlNetVersioner. * */ void ControlNet::ReadControl(const QString &filename, Progress *progress) { LatestControlNetFile *fileData = ControlNetVersioner::Read(filename); ControlNetVersioner versionedReader(FileName(filename)); ControlNetFileHeaderV0002 &header = fileData->GetNetworkHeader(); p_networkId = header.networkid().c_str(); if (header.has_targetname()) { SetTarget(header.targetname().c_str()); } else { SetTarget(""); } p_userName = header.username().c_str(); p_created = header.created().c_str(); p_modified = header.lastmodified().c_str(); p_description = header.description().c_str(); SetTarget( versionedReader.targetName() ); p_networkId = versionedReader.netId(); p_userName = versionedReader.userName(); p_created = versionedReader.creationDate(); p_modified = versionedReader.lastModificationDate(); p_description = versionedReader.description(); QList< ControlPointFileEntryV0002 > &fileDataPoints = fileData->GetNetworkPoints(); if (fileDataPoints.size() > 0) { if (progress != NULL) { progress->SetText("Loading Control Points..."); progress->SetMaximumSteps(fileDataPoints.size()); progress->CheckStatus(); int numPoints = versionedReader.numPoints(); for (int i = 0; i < numPoints; i++) { AddPoint( versionedReader.takeFirstPoint().data() ); } ControlPointFileEntryV0002 fileDataPoint; foreach(fileDataPoint, fileDataPoints) { AddPoint(new ControlPoint(fileDataPoint, p_targetRadii[0], p_targetRadii[1], p_targetRadii[2])); if (progress != NULL) progress->CheckStatus(); } } delete fileData; fileData = NULL; } Loading isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.cpp +13 −2 Original line number Diff line number Diff line Loading @@ -136,12 +136,23 @@ namespace Isis { } QSharedPointer<ControlPoint> ControlNetVersioner::takeFirstPoint() { return m_points.takeFirst(); /** * Returns the number of points that have been read in or are ready to write out. * * @return @b int The number of control points stored internally. */ int ControlNetVersioner::numPoints() const { return m_points.size(); } QSharedPointer<ControlPoint> ControlNetVersioner::takeFirstPoint() { if (!m_points.isEmpty) { return m_points.takeFirst(); } return QSharedPointer<ControlPoint>; } /** Loading isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.h +1 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,7 @@ namespace Isis { QString description() const; QString userName() const; int numPoints() const; QSharedPointer<ControlPoint> takeFirstPoint(); void write(FileName netFile); Loading Loading
isis/src/control/objs/ControlNet/ControlNet.cpp +84 −108 Original line number Diff line number Diff line Loading @@ -236,48 +236,24 @@ namespace Isis { * they are read into memory instead of setting * parent prematurely to be able to set the radii * in ControlPoint. * @history 2017-12-21 Jesse Mapel - Modified to use the ControlNetVersioner. * */ void ControlNet::ReadControl(const QString &filename, Progress *progress) { LatestControlNetFile *fileData = ControlNetVersioner::Read(filename); ControlNetVersioner versionedReader(FileName(filename)); ControlNetFileHeaderV0002 &header = fileData->GetNetworkHeader(); p_networkId = header.networkid().c_str(); if (header.has_targetname()) { SetTarget(header.targetname().c_str()); } else { SetTarget(""); } p_userName = header.username().c_str(); p_created = header.created().c_str(); p_modified = header.lastmodified().c_str(); p_description = header.description().c_str(); SetTarget( versionedReader.targetName() ); p_networkId = versionedReader.netId(); p_userName = versionedReader.userName(); p_created = versionedReader.creationDate(); p_modified = versionedReader.lastModificationDate(); p_description = versionedReader.description(); QList< ControlPointFileEntryV0002 > &fileDataPoints = fileData->GetNetworkPoints(); if (fileDataPoints.size() > 0) { if (progress != NULL) { progress->SetText("Loading Control Points..."); progress->SetMaximumSteps(fileDataPoints.size()); progress->CheckStatus(); int numPoints = versionedReader.numPoints(); for (int i = 0; i < numPoints; i++) { AddPoint( versionedReader.takeFirstPoint().data() ); } ControlPointFileEntryV0002 fileDataPoint; foreach(fileDataPoint, fileDataPoints) { AddPoint(new ControlPoint(fileDataPoint, p_targetRadii[0], p_targetRadii[1], p_targetRadii[2])); if (progress != NULL) progress->CheckStatus(); } } delete fileData; fileData = NULL; } Loading
isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.cpp +13 −2 Original line number Diff line number Diff line Loading @@ -136,12 +136,23 @@ namespace Isis { } QSharedPointer<ControlPoint> ControlNetVersioner::takeFirstPoint() { return m_points.takeFirst(); /** * Returns the number of points that have been read in or are ready to write out. * * @return @b int The number of control points stored internally. */ int ControlNetVersioner::numPoints() const { return m_points.size(); } QSharedPointer<ControlPoint> ControlNetVersioner::takeFirstPoint() { if (!m_points.isEmpty) { return m_points.takeFirst(); } return QSharedPointer<ControlPoint>; } /** Loading
isis/src/control/objs/ControlNetVersioner/ControlNetVersioner.h +1 −0 Original line number Diff line number Diff line Loading @@ -161,6 +161,7 @@ namespace Isis { QString description() const; QString userName() const; int numPoints() const; QSharedPointer<ControlPoint> takeFirstPoint(); void write(FileName netFile); Loading