Isis 3 Programmer Reference
Isis::ControlNetVersioner Class Reference

Handle various control network file format versions. More...

#include <ControlNetVersioner.h>

Collaboration diagram for Isis::ControlNetVersioner:
Collaboration graph

Classes

struct  ControlNetHeaderV0001
 Versioned container for general information about a control network. More...
 

Public Member Functions

 ControlNetVersioner (ControlNet *net)
 Construct a ControlNetVersioner from a control network.
 
 ControlNetVersioner (const FileName netFile, Progress *progress=NULL)
 Construct a ControlNetVersioner from a file.
 
 ~ControlNetVersioner ()
 Destroy a ControlNetVersioner.
 
QString netId () const
 Returns the ID for the network.
 
QString targetName () const
 Returns the target for the network.
 
QString creationDate () const
 Returns the date and time that the network was created.
 
QString lastModificationDate () const
 Returns the date and time of the last modification to the network.
 
QString description () const
 Returns the network's description.
 
QString userName () const
 Returns the name of the last person or program to modify the network.
 
int numPoints () const
 Returns the number of points that have been read in or are ready to write out.
 
ControlPointtakeFirstPoint ()
 Returns the first point stored in the versioner's internal list.
 
void write (FileName netFile)
 This will write a control net file object to disk.
 
Pvl toPvl ()
 Generates a Pvl file from the currently stored control points and header.
 

Private Types

typedef ControlNetHeaderV0001 ControlNetHeaderV0002
 Typedef for consistent naming of containers for version 2.
 
typedef ControlNetHeaderV0001 ControlNetHeaderV0003
 Typedef for consistent naming of containers for version 3.
 
typedef ControlNetHeaderV0001 ControlNetHeaderV0004
 Typedef for consistent naming of containers for version 4.
 
typedef ControlNetHeaderV0001 ControlNetHeaderV0005
 Typedef for consistent naming of containers for version 5.
 
typedef ControlPointV0003 ControlPointV0004
 Typedef for consistent naming of containers for version 4.
 
typedef ControlPointV0003 ControlPointV0005
 Typedef for consistent naming of containers for version 5.
 

Private Member Functions

 ControlNetVersioner ()
 Default constructor. Intentially un-implemented.
 
 ControlNetVersioner (const ControlNetVersioner &other)
 Copy constructor.
 
ControlNetVersioneroperator= (const ControlNetVersioner &other)
 Asssignment operator.
 
void read (const FileName netFile, Progress *progress=NULL)
 Read a control network file and prepare the data to be converted into a control network.
 
void readPvl (const Pvl &network, Progress *progress=NULL)
 Read a Pvl control network and prepare the data to be converted into a control network.
 
void readPvlV0001 (const PvlObject &network, Progress *progress=NULL)
 read a version 1 Pvl control network and convert the data into control points.
 
void readPvlV0002 (const PvlObject &network, Progress *progress=NULL)
 read a version 2 Pvl control network and convert the data into control points.
 
void readPvlV0003 (const PvlObject &network, Progress *progress=NULL)
 read a version 3 Pvl control network and convert the data into control points.
 
void readPvlV0004 (const PvlObject &network, Progress *progress=NULL)
 read a version 4 Pvl control network and convert the data into control points.
 
void readPvlV0005 (const PvlObject &network, Progress *progress=NULL)
 read a version 5 Pvl control network and convert the data into control points.
 
void readProtobuf (const Pvl &header, const FileName netFile, Progress *progress=NULL)
 Read a protobuf control network and prepare the data to be converted into a control network.
 
void readProtobufV0001 (const Pvl &header, const FileName netFile, Progress *progress=NULL)
 Read a protobuf version 1 control network and prepare the data to be converted into a control network.
 
void readProtobufV0002 (const Pvl &header, const FileName netFile, Progress *progress=NULL)
 Read a protobuf version 2 control network and prepare the data to be converted into a control network.
 
void readProtobufV0005 (const Pvl &header, const FileName netFile, Progress *progress=NULL)
 Read a protobuf version 5 control network and prepare the data to be converted into a control network.
 
ControlPointcreatePoint (ControlPointV0001 &point)
 Create a pointer to a latest version ControlPoint from an object in a V0001 control net file.
 
ControlPointcreatePoint (ControlPointV0002 &point)
 Create a pointer to a latest version ControlPoint from an object in a V0002 control net file.
 
ControlPointcreatePoint (ControlPointV0003 &point)
 Create a pointer to a latest version ControlPoint from an object in a V0003 control net file.
 
ControlMeasurecreateMeasure (const ControlPointFileEntryV0002_Measure &)
 Create a pointer to a ControlMeasure from a V0006 file.
 
void createHeader (const ControlNetHeaderV0001 header)
 Create the internal header from a V0001 header.
 
void writeHeader (std::fstream *output)
 This will read the binary protobuffer control network header to an fstream.
 
int writeFirstPoint (std::fstream *output)
 This will write the first control point to a file stream.
 

Private Attributes

ControlNetHeaderV0005 m_header
 Header containing information about the whole network.
 
QList< ControlPoint * > m_points
 ControlPoints that are read in from a file or ready to be written out to a file.
 
bool m_ownsPoints
 Flag if the versioner owns the control points stored in it.
 

Detailed Description

Handle various control network file format versions.

Overview

This class is used to read all versions of control networks and write out the most recent version in Pvl and protobuf format. When reading a control net file, the ControlNeVersioner is initialized with the filename. When writing a control net file or generating a Pvl network, the ControlNetVersioner is initialized from a ControlNet object.

This class exists to isolate the code dealing with control network file formats. ControlNet can then interface with this class and only has to work with the current ControlPoint object.

Reading Control Network Files

The read routine is as follows:

  1. Read the Pvl file header
  2. Determine if the network is stored in Pvl or protobuf format
  3. Determine the version of the network
  4. Read in the general ControlNet information such as network description, last modification date, etc. For Pvl networks, this information is in a PvlObject at the start of the network. For protobuf objects this information is stored in a header protobuf message after the Pvl file header.
  5. For each control point do the following:
    1. Read the control point into the appropriate ControlPointV#### object.
    2. If the ControlPointV#### object is not the most recent version, upgrade it to the latest version.
    3. Convert the final ControlPointV#### object into a ControlPoint object and store it in the ControlNetVersioner.

Once the ControlNet file is read into the ControlNetVersioner, the ControlPoints can be accessed through the takeFirstPoint method. This will remove the first ControlPoint stored in the ControlNetVersioner and give it to the caller. At this point, the caller is given ownership of the ControlPoint and is expected to delete it when finished. General information about the control network can be accessed directly from the ControlNetVersioner.

Writing Control Network Files

The protobuf file write routine is as follows:

  1. Copy the general ControlNet information such as network description, last modification date, etc. into the ControlNetVersioner.
  2. Copy the pointers to the ControlPoints and store them in the ControlNetVersioner. The ControlNetVersioner does not assume ownership of the ControlPoints when it does this. The ControlNet or what the ControlNet got the points from retains ownership.
  3. Write a 65536 byte blank header to the file.
  4. Write the general ControlNet information to a protobuf message header after the blank header.
  5. For each control point do the following:
    1. Convert the control point into a protobuf message.
    2. Write the size of the protobuf message to the file.
    3. Write the protobuf message to the file.
  6. Write a Pvl header into the original blank header at the start of the file. This header contains: a flag indicating the network is a protobuf formatted network, the version of the format, the byte offset and size of the protobuf header, the byte offset and size of the block of protobuf control points, and general information about the control network.

Once the ControlNetVersioner is initialized from a file or a ControlNet, a Pvl formatted version of the control network can be created by the toPvl method. This will always output the control network in the latest Pvl format. From here, the Pvl network can be written to a file with Pvl::write(filename).

Modifying the Control Network File Format

If the control network file format is changed the following changes need to be made to ControlNetVersioner and its supporting classes:

  • New containers need to be added to interface with the new format. These containers should try to match the format of the data in the file, then the versioner will convert from that format to ControlNet, ControlPoint, ControlMeasure, and ControlMeasureLogData. General information about the control network should be stored in the ControlNetHeaderV#### structs. Data for control points should be stored in ControlPointV#### objects.
  • If a new control point container was created, code needs to be added to create ControlPoint objects from them. A new createPoint method that takes the new container should be added to do this. The createMeasure method should also be changed to create ControlMeasures from the new containers.
  • If a new header container was created, code needs to be added to store its information in the ControlNetVersioner. A new createHeader method that takes the new header container should be added to do this.
  • New code needs to be added to update the previous containers to the new containers. Updating control point containers should happen in the new ControlPointV#### container class. It should have a constructor that takes a container for the previous version. Then, the createPoint method for the previous version needs to be changed to create a new container with this and then call the createPoint method for the new version. Updating header containers should happen in the createHeader method that takes the previous version. If the headers become more complicated, this may need to change to match how control point containers are updated.
  • New methods need to be added to read the new file format. Methods for reading Pvl formatted files and protobuf formatted files need to be added; they should match the naming convention of readPvlV#### and readProtobufV#### respectively.
  • New methods need to be added to write out the new file format. The write method should be changed to write out the new protobuf format. If a new header container is added, the writeHeader method should be changed to write the new protobuf header to the file. If a new control point container is added, the writeFirstPoint method should be changed to write a new protobuf control point to the file.
  • Update the documentation on this class under the Control Network File Format History heading. This should include a description of the new file format and how it differs from the previous version.

Control Network File Format History

Prior to the creation of this versioning class, which was released with ISIS 3.2.2, all control network files were Pvl formatted text files. Reading and writing these files was handled by the ControlNet, ControlPoint, and ControlMeasure classes. As the file format was changed, those classes were modified to account for the new format. Because of this, the history of the control network file format prior to ISIS 3.2.2 is not well documented.

The following are descriptions of the different control network file format versions that are currently supported. Each description also describes how that version differs from the previous.

Version 1

This version maintains backwards compatibility with all files created prior to versioning. If a control network file does not have a version flag, then it is assumed to be a version 1 file. Because this version supports all files created prior to ISIS 3.2.2, there is no standardized Pvl format associated with it.

Originally, there was no version 1 binary format. When version 2 was added, version 1 was changed to use the version 2 binary format.

Version 2

This version was the first to have a standardized format. The following were standardized with this format:

  • The Held flag was replaced by point types. Points could be either Tie points or Ground points. Points that were previously flagged as Held were changed to Ground points.
  • A posteriori was replaced with adjusted in several keyword names.
  • The a priori and adjusted ground points were changed from (latitude, longitude, radius) format to body fixed (X, Y, Z) format.
  • Ground point sigmas were replaced with covariance matrices.
  • Latitude, longitude, and radius constrained flags were added.
  • Estimated measures were renamed to Candidate measures.
  • Unmeasured measures were renamed to Candidate measures, had their line and sample set to 0, and were flagged as ignored.
  • Automatic, ValidatedManual and AutomaticPixel measures were renamed to RegisteredPixel measures.
  • ValidatedAutomatic and AutomaticSubPixel measures were renamed to RegisteredSubPixel measures.
  • ErrorSample and ErrorLine were renamed to SampleResidual and LineResidual respectively.
  • Diameter, ZScore, and ErrorMagnitude were no longer saved in measures.

Version 2 was the first version to support a binary protobuf format. Version 1 was retroactively changed to use the version 2 binary format. Version 2 binary control network files consist of three parts:

  1. Pvl File Header: The file starts with a Pvl formatted header that contains offsets to the binary components of the file and the version number of the file. This header may also contain general information about the control network that is only for user reference is not used when reading the file.
  2. Protobuf Core: After the Pvl header is the protobuf core that contains the majority of the network data. This is a hierarchical structure with general network information such as the network description at the top level. Below that is the control point information. The lowest level contains the control measure information. This structure is defined by ControlNetFileProtoV0001.proto.
  3. Protobuf Log Data: The final component of the file contains the control measure log data. This is structured the same as the protobuf core. So, the log data for the ith measure in the jth point in the core is in the ith measure of the jth point in this structure. This structure is defined by ControlNetLogDataProtoV0001.proto.

Version 3

This version was created to avoid file size limits imposed by the version 2 binary file format. Protobuf messages are limited to 2GB for security reasons. So, version 2 binary files can only contain 2GB of information in their Protobuf Core. In version 3, the Protobuf Core was changed from a single message to a header message and individual messages for each control point. This way, the Protobuf Core could contain an arbitrary amount of information as long as any single point does not exceed 2GB. At the same time, control measure log data was moved into the Protobuf Core so that each measure contains its own log data.

Version 3 binary control network files are formatted as follows:

  • pvl File Header: The Pvl Header in version 3 binary files is the same as the Pvl Header in version 2 binary files, except it has offsets to the Protobuf Header and Protobuf Core instead of the Protobuf Core and Protobuf Log Data.
  • Protobuf Header: The binary component of version 3 binary control network files starts with a protobuf message header that contains general information about the network and the size of each control point's protobuf message. The size of each control point message is required to parse the Protobuf Core because protobuf messages are not self-delimiting. This structure is defined by ControlNetFileHeaderV0002.proto.
  • Protobuf Core: Immediately after the Protobuf Header is the Protobuf Core which contains all of the control point and control measure information. This is structured as consecutive protobuf messages where each message contains all of the information for a control point and its control measures. Because protobuf messages are not self-delimiting, the size of each message must be known prior to parsing the Protobuf Core. The control point messages are defined by ControlPointFileEntryV0002.proto.

Version 3 also further differentiated control point types. Control points that had their latitude, longitude, and/or radius constrained were changed from Tie points to Constrained points.

Version 4

This version was created when Ground and Tie control points were renamed to Fixed and Free respectively. Version 4 Pvl control network files are identical to version 3 Pvl control network files, except for the new control point type values. When version 4 was created, the .proto file that defined control point protobuf messages was modified to allow for the new control point type names and the old names were flagged as deprecated. So, version 3 and version 4 binary control network files are formatted exactly the same.

Version 5

This version was created to allow for progressive reading and writing of binary control network files. Previous versions required the entire contents of binary control network files to be read into memory before the ControlNet, ControlPoint, and ControlMeasure objects could be created. Version 5 was created to allow binary control network files to be read one control point at a time. Similarly, previous versions required all of the information in the control network to be copied into protobuf structures before any of it could be written to a file.

Version 5 Pvl control network files are identical to version 4 Pvl control network files.

Version 5 binary control network files are formatted the same as version 4 binary control network files except for how they store the sizes of the control point messages in the Protobuf Core. In a version 5 binary control network file, each control point message is prepended by an unsigned, 32 bit, LSB, integer (c++ uint32_t) that contains the size of the message. This design was modeled after the delimited read and write functionality in the Java protobuf library. Additionally, the Protobuf Header contains the number of control points in the network instead of a list of all the control point message sizes. The structure of the Protobuf Header is defined by ControlNetFileHeaderV0005.proto. The structure of the protobuf messages in the Protobuf Core is defined by ControlPointFileEntryV0002.proto, the same as in version 4.

Starting with version 5, the naming scheme for .proto files was changed to use the same version number as the control net file format. So, the new .proto file defining the Protobuf Header was named ControlNetFileHeaderV0005.proto instead of ControlNetFileHeaderV0003.proto.

Author
2011-04-05 Steven Lambright
History

2011-04-14 Steven Lambright - Improved handling of V1 networks

2011-05-02 Tracie Sucharski - If Held=True exists in input net, set PointType=Ground.

2011-05-02 Debbie A. Cook - Created pvl version 3 which added point type of constrained.

2012-08-14 Steven Lambright - Simplified error handling of invalid target names in V1 networks (V1->V2 code).

2012-11-22 Debbie A. Cook - Changed to use TProjection instead of Projection. References #775.

2013-03-13 Steven Lambright and Stuart Sides - Added support for more V1 Pvl networks (specifically, isis3.2.1 hijitreg output networks with measures that lack Sample/Line and are set to unmeasured). Fixes #1554.

2016-04-22 Jeannie Backer - Updated error message in ConvertVersion1ToVersion2() to make it specific to this class call. This was done to reduce redundancy since the original message for this error was very similar to the caught exception to which it is appended. References #3892

2017-12-11 Jeannie Backer & Jesse Mapel - Created class skeleton for refactor.

2017-12-11 Jesse Mapel - Added VersionedControlNetHeaders.

2017-12-12 Kristin Berry - Added initial toPvl for refactor.

2017-12-12 Jeannie Backer - Added VersionedControlPoints.

2017-12-12 Jeannie Backer - Implemented createPoint() methods.

2017-12-13 Jeannie Backer - Added target radii to createPoint(V0006).

2017-12-18 Adam Goins and Kristin Berry - Added new write() method.

2017-12-19 Kristin Berry - Corrected method names and general cleanup in toPvl and write for refactor.

2017-12-20 Jesse Mapel - Made read and createPoint methods match new ControlPointV#### classes.

2017-12-20 Jeannie Backer - Updated toPvl and write methods to get surface point information from the ControlPoint.

2018-01-03 Jesse Mapel - Updated class documentation.

2018-01-04 Adam Goins - Updated read/write methods to read/write protobuf messages correctly.

2018-01-12 Adam Goins - Added the ControlPoint radii to the header to avoid Target::GetRadii calls to speed up createPoint().

2018-01-12 Adam Goins - Added Progress during reads.

2018-01-24 Jesse Mapel - Fixed c++11 build warnings.

History

2018-01-27 Jesse Mapel - Fixed some documentation formatting. Added a section describing the different file format versions.

2018-01-30 Adam Goins - Ensured point sizes are written/read as lsb by using EndianSwapper.

2018-02-25 Debbie A. Cook - Generalized calls to ControlPoint::IsLatitudeConstrained to IsCoord1Constained and added or updated a few comments. *** TODO *** make sure the new methods are fully functional for either coordinate type once the new header keyword is added.

2018-03-28 Adam Goins - Added targetRadii groups to the header. Changed the versioner to write these values out in a targetRadii group for both binary V0005 and PvlV0005 networks. Fixes #5361.

2018-04-05 Adam Goins - Added hasTargetRadii() and targetRadii() to the versioner so that these values can be grabbed from a ControlNet on read. Also Fixes #5361.

2018-06-01 Debbie A. Cook - (added to BundleXYZ 2018-02-25) Generalized calls to ControlPoint::IsLatitudeConstrained to IsCoord1Constained and added or updated a few comments. *** TODO *** make sure the new methods are fully functional for either coordinate type once the new header keyword is added.

History
2018-07-03 Jesse Mapel - Removed target radii from versioner. References #5457.

Definition at line 412 of file ControlNetVersioner.h.

Member Typedef Documentation

◆ ControlNetHeaderV0002

Typedef for consistent naming of containers for version 2.

Definition at line 478 of file ControlNetVersioner.h.

◆ ControlNetHeaderV0003

Typedef for consistent naming of containers for version 3.

Definition at line 480 of file ControlNetVersioner.h.

◆ ControlNetHeaderV0004

Typedef for consistent naming of containers for version 4.

Definition at line 482 of file ControlNetVersioner.h.

◆ ControlNetHeaderV0005

Typedef for consistent naming of containers for version 5.

Definition at line 484 of file ControlNetVersioner.h.

◆ ControlPointV0004

Typedef for consistent naming of containers for version 4.

Definition at line 487 of file ControlNetVersioner.h.

◆ ControlPointV0005

Typedef for consistent naming of containers for version 5.

Definition at line 489 of file ControlNetVersioner.h.

Constructor & Destructor Documentation

◆ ControlNetVersioner() [1/4]

Isis::ControlNetVersioner::ControlNetVersioner ( ControlNet * net)

Construct a ControlNetVersioner from a control network.

This versioner can only be used to write out the control points in the control network. It is expected that the control points in the control network will not be deleted while the control net versioner persists.

Parameters
netA pointer to the network that will be written out.

Definition at line 63 of file ControlNetVersioner.cpp.

References createHeader(), m_points, and Isis::ControlNetVersioner::ControlNetHeaderV0001::networkID.

◆ ControlNetVersioner() [2/4]

Isis::ControlNetVersioner::ControlNetVersioner ( const FileName netFile,
Progress * progress = NULL )

Construct a ControlNetVersioner from a file.

The file will be read in and converted into a header object that contains general information about the network and a list of ControlPoints.

Parameters
netFileThe control network file to read in.
progressThe progress object to track reading points.
See also
ControlNetVersioner::Read

Definition at line 90 of file ControlNetVersioner.cpp.

References read().

◆ ~ControlNetVersioner()

Isis::ControlNetVersioner::~ControlNetVersioner ( )

Destroy a ControlNetVersioner.

If the versioner owns the control points stored in it, they will also be deleted.

Definition at line 100 of file ControlNetVersioner.cpp.

References m_ownsPoints, and m_points.

◆ ControlNetVersioner() [3/4]

Isis::ControlNetVersioner::ControlNetVersioner ( )
private

Default constructor. Intentially un-implemented.

◆ ControlNetVersioner() [4/4]

Isis::ControlNetVersioner::ControlNetVersioner ( const ControlNetVersioner & other)
private

Copy constructor.

Intentially un-implemented.

Parameters
otherThe other ControlNetVersioner to create a copy of.

Member Function Documentation

◆ createHeader()

void Isis::ControlNetVersioner::createHeader ( const ControlNetHeaderV0001 header)
private

Create the internal header from a V0001 header.

The latest version is V0001, so this will check for an old issue with Mars target names and then internalize the header.

Parameters
headerThe V0001 header

Definition at line 1642 of file ControlNetVersioner.cpp.

References m_header, and Isis::ControlNetVersioner::ControlNetHeaderV0001::targetName.

Referenced by ControlNetVersioner(), readProtobufV0001(), readProtobufV0002(), readProtobufV0005(), readPvlV0001(), readPvlV0002(), readPvlV0003(), readPvlV0004(), and readPvlV0005().

◆ createMeasure()

◆ createPoint() [1/3]

ControlPoint * Isis::ControlNetVersioner::createPoint ( ControlPointV0001 & point)
private

Create a pointer to a latest version ControlPoint from an object in a V0001 control net file.

This method converts a ControlPointV0001 to the latest ControlPontV#### version and uses the latest versioned point to construct and fill an Isis::ControlPoint.

Parameters
pointThe versioned control point to be updated.
Returns
ControlPoint* The ControlPoint constructed from the given point.

Definition at line 1306 of file ControlNetVersioner.cpp.

References createPoint().

Referenced by createPoint(), createPoint(), readProtobufV0001(), readProtobufV0002(), readProtobufV0005(), readPvlV0001(), readPvlV0002(), readPvlV0003(), readPvlV0004(), and readPvlV0005().

◆ createPoint() [2/3]

ControlPoint * Isis::ControlNetVersioner::createPoint ( ControlPointV0002 & point)
private

Create a pointer to a latest version ControlPoint from an object in a V0002 control net file.

This method converts a ControlPointV0002 to the latest ControlPontV#### version and uses the latest versioned point to construct and fill an Isis::ControlPoint.

Parameters
pointThe versioned control point to be updated.
Returns
ControlPoint* The ControlPoint constructed from the given point.

Definition at line 1323 of file ControlNetVersioner.cpp.

References createPoint().

◆ createPoint() [3/3]

◆ creationDate()

QString Isis::ControlNetVersioner::creationDate ( ) const

Returns the date and time that the network was created.

Returns
QString The date and time the network was created as a string

Definition at line 136 of file ControlNetVersioner.cpp.

References Isis::ControlNetVersioner::ControlNetHeaderV0001::created, and m_header.

◆ description()

QString Isis::ControlNetVersioner::description ( ) const

Returns the network's description.

Returns
QString A description of the network.

Definition at line 156 of file ControlNetVersioner.cpp.

References Isis::ControlNetVersioner::ControlNetHeaderV0001::description, and m_header.

◆ lastModificationDate()

QString Isis::ControlNetVersioner::lastModificationDate ( ) const

Returns the date and time of the last modification to the network.

Returns
QString The date and time of the last modfication as a string

Definition at line 146 of file ControlNetVersioner.cpp.

References Isis::ControlNetVersioner::ControlNetHeaderV0001::lastModified, and m_header.

◆ netId()

QString Isis::ControlNetVersioner::netId ( ) const

Returns the ID for the network.

Returns
QString The network ID as a string

Definition at line 116 of file ControlNetVersioner.cpp.

References m_header, and Isis::ControlNetVersioner::ControlNetHeaderV0001::networkID.

◆ numPoints()

int Isis::ControlNetVersioner::numPoints ( ) const

Returns the number of points that have been read in or are ready to write out.

Returns
int The number of control points stored internally.

Definition at line 176 of file ControlNetVersioner.cpp.

References m_points.

Referenced by readProtobufV0002(), and write().

◆ operator=()

ControlNetVersioner & Isis::ControlNetVersioner::operator= ( const ControlNetVersioner & other)
private

Asssignment operator.

Intentially un-implemented.

Parameters
otherThe other ControlNetVersione to assign from.
Returns
ControlNetVersioner& A reference to this after assignment.

◆ read()

void Isis::ControlNetVersioner::read ( const FileName netFile,
Progress * progress = NULL )
private

Read a control network file and prepare the data to be converted into a control network.

Parameters
netFileThe control network file to read.
progressThe progress object to track reading points.

Definition at line 553 of file ControlNetVersioner.cpp.

References Isis::IException::Io, readProtobuf(), and readPvl().

Referenced by ControlNetVersioner().

◆ readProtobuf()

void Isis::ControlNetVersioner::readProtobuf ( const Pvl & header,
const FileName netFile,
Progress * progress = NULL )
private

Read a protobuf control network and prepare the data to be converted into a control network.

Parameters
headerThe Pvl network header that contains the version number.
netFileThe filename of the control network file.
progressThe progress object to track reading points.

Definition at line 877 of file ControlNetVersioner.cpp.

References Isis::PvlObject::findObject(), Isis::IException::Io, readProtobufV0001(), readProtobufV0002(), readProtobufV0005(), Isis::toInt(), and Isis::toString().

Referenced by read().

◆ readProtobufV0001()

void Isis::ControlNetVersioner::readProtobufV0001 ( const Pvl & header,
const FileName netFile,
Progress * progress = NULL )
private

Read a protobuf version 1 control network and prepare the data to be converted into a control network.

Parameters
headerThe Pvl file header that contains byte offsets for the protobuf messages
netFileThe filename of the control network file.
progressThe progress object to track reading points.

Definition at line 914 of file ControlNetVersioner.cpp.

References Isis::Progress::CheckStatus(), createHeader(), createPoint(), Isis::PvlObject::findObject(), m_points, Isis::ControlNetVersioner::ControlNetHeaderV0001::networkID, Isis::IException::Programmer, Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), Isis::toString(), and Isis::IException::User.

Referenced by readProtobuf().

◆ readProtobufV0002()

void Isis::ControlNetVersioner::readProtobufV0002 ( const Pvl & header,
const FileName netFile,
Progress * progress = NULL )
private

Read a protobuf version 2 control network and prepare the data to be converted into a control network.

Parameters
headerThe Pvl file header that contains byte offsets for the protobuf messages
netFileThe filename of the control network file.
progressThe progress object to track reading points.

Definition at line 1037 of file ControlNetVersioner.cpp.

References Isis::Progress::CheckStatus(), createHeader(), createPoint(), Isis::PvlObject::findObject(), Isis::IException::Io, m_points, Isis::ControlNetVersioner::ControlNetHeaderV0001::networkID, numPoints(), Isis::IException::Programmer, Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), and Isis::toString().

Referenced by readProtobuf().

◆ readProtobufV0005()

void Isis::ControlNetVersioner::readProtobufV0005 ( const Pvl & header,
const FileName netFile,
Progress * progress = NULL )
private

Read a protobuf version 5 control network and prepare the data to be converted into a control network.

Parameters
headerThe Pvl file header that contains byte offsets for the protobuf messages
netFileThe filename of the control network file.
progressThe progress object to track reading points.

Definition at line 1154 of file ControlNetVersioner.cpp.

References Isis::Progress::CheckStatus(), createHeader(), createPoint(), Isis::PvlObject::findObject(), Isis::IException::Io, m_points, Isis::ControlNetVersioner::ControlNetHeaderV0001::networkID, Isis::IException::Programmer, Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), and Isis::toString().

Referenced by readProtobuf().

◆ readPvl()

void Isis::ControlNetVersioner::readPvl ( const Pvl & network,
Progress * progress = NULL )
private

Read a Pvl control network and prepare the data to be converted into a control network.

Parameters
networkThe Pvl network data
progressThe progress object to track reading points.

Definition at line 584 of file ControlNetVersioner.cpp.

References Isis::PvlObject::findObject(), readPvlV0001(), readPvlV0002(), readPvlV0003(), readPvlV0004(), readPvlV0005(), Isis::toInt(), Isis::toString(), and Isis::IException::Unknown.

Referenced by read().

◆ readPvlV0001()

void Isis::ControlNetVersioner::readPvlV0001 ( const PvlObject & network,
Progress * progress = NULL )
private

read a version 1 Pvl control network and convert the data into control points.

Parameters
networkThe control network PvlObject.
progressThe progress object to track reading points.

Definition at line 623 of file ControlNetVersioner.cpp.

References Isis::Progress::CheckStatus(), createHeader(), createPoint(), Isis::IException::Io, m_header, m_points, Isis::ControlNetVersioner::ControlNetHeaderV0001::networkID, Isis::PvlObject::object(), Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), Isis::ControlNetVersioner::ControlNetHeaderV0001::targetName, and Isis::toString().

Referenced by readPvl().

◆ readPvlV0002()

void Isis::ControlNetVersioner::readPvlV0002 ( const PvlObject & network,
Progress * progress = NULL )
private

read a version 2 Pvl control network and convert the data into control points.

Parameters
networkThe control network PvlObject.
progressThe progress object to track reading points.

Definition at line 676 of file ControlNetVersioner.cpp.

References Isis::Progress::CheckStatus(), createHeader(), createPoint(), Isis::IException::Io, m_points, Isis::ControlNetVersioner::ControlNetHeaderV0001::networkID, Isis::PvlObject::object(), Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), and Isis::toString().

Referenced by readPvl().

◆ readPvlV0003()

void Isis::ControlNetVersioner::readPvlV0003 ( const PvlObject & network,
Progress * progress = NULL )
private

read a version 3 Pvl control network and convert the data into control points.

Parameters
networkThe control network PvlObject.
progressThe progress object to track reading points.

Definition at line 727 of file ControlNetVersioner.cpp.

References Isis::Progress::CheckStatus(), createHeader(), createPoint(), Isis::IException::Io, m_points, Isis::ControlNetVersioner::ControlNetHeaderV0001::networkID, Isis::PvlObject::object(), Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), and Isis::toString().

Referenced by readPvl().

◆ readPvlV0004()

void Isis::ControlNetVersioner::readPvlV0004 ( const PvlObject & network,
Progress * progress = NULL )
private

read a version 4 Pvl control network and convert the data into control points.

Parameters
networkThe control network PvlObject.
progressThe progress object to track reading points.

Definition at line 777 of file ControlNetVersioner.cpp.

References Isis::Progress::CheckStatus(), createHeader(), createPoint(), Isis::IException::Io, m_points, Isis::ControlNetVersioner::ControlNetHeaderV0001::networkID, Isis::PvlObject::object(), Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), and Isis::toString().

Referenced by readPvl().

◆ readPvlV0005()

void Isis::ControlNetVersioner::readPvlV0005 ( const PvlObject & network,
Progress * progress = NULL )
private

read a version 5 Pvl control network and convert the data into control points.

Parameters
networkThe control network PvlObject.
progressThe progress object to track reading points.

Definition at line 826 of file ControlNetVersioner.cpp.

References Isis::Progress::CheckStatus(), createHeader(), createPoint(), Isis::IException::Io, m_points, Isis::ControlNetVersioner::ControlNetHeaderV0001::networkID, Isis::PvlObject::object(), Isis::Progress::SetMaximumSteps(), Isis::Progress::SetText(), and Isis::toString().

Referenced by readPvl().

◆ takeFirstPoint()

ControlPoint * Isis::ControlNetVersioner::takeFirstPoint ( )

Returns the first point stored in the versioner's internal list.

This method passes ownership of the point to the caller who is expected to delete it when done with it.

Returns
ControlPoint* A pointer to the control point. The caller assumes ownership of the ControlPoint and is expected to delete it when done. If there are no points to return, a NULL pointer is returned.

Definition at line 189 of file ControlNetVersioner.cpp.

References m_points.

◆ targetName()

QString Isis::ControlNetVersioner::targetName ( ) const

Returns the target for the network.

Returns
QString The target name as a string

Definition at line 126 of file ControlNetVersioner.cpp.

References m_header, and Isis::ControlNetVersioner::ControlNetHeaderV0001::targetName.

◆ toPvl()

Pvl Isis::ControlNetVersioner::toPvl ( )

Generates a Pvl file from the currently stored control points and header.

Returns
Pvl The Pvl version of the network

Definition at line 204 of file ControlNetVersioner.cpp.

References Isis::PvlKeyword::addComment(), Isis::PvlObject::addObject(), Isis::ControlMeasure::Candidate, Isis::ControlPoint::Constrained, Isis::ControlNetVersioner::ControlNetHeaderV0001::created, Isis::Angle::degrees(), Isis::ControlNetVersioner::ControlNetHeaderV0001::description, Isis::PvlObject::findObject(), Isis::ControlPoint::Fixed, Isis::ControlPoint::GetId(), Isis::SurfacePoint::GetLatitude(), Isis::SurfacePoint::GetLatSigmaDistance(), Isis::SurfacePoint::GetLocalRadius(), Isis::SurfacePoint::GetLongitude(), Isis::SurfacePoint::GetLonSigmaDistance(), Isis::ControlPoint::GetMeasure(), Isis::ControlPoint::GetType(), Isis::ControlPoint::HasAprioriRadiusSourceFile(), Isis::ControlPoint::HasAprioriSurfacePointSourceFile(), Isis::ControlPoint::HasRefMeasure(), Isis::ControlPoint::IndexOfRefMeasure(), Isis::ControlPoint::IsCoord1Constrained(), Isis::ControlPoint::IsCoord2Constrained(), Isis::ControlPoint::IsReferenceExplicit(), Isis::ControlNetVersioner::ControlNetHeaderV0001::lastModified, m_header, m_points, Isis::ControlMeasure::Manual, Isis::Displacement::meters(), Isis::Distance::meters(), Isis::ControlNetVersioner::ControlNetHeaderV0001::networkID, Isis::Null, Isis::ControlMeasure::RegisteredPixel, Isis::ControlMeasure::RegisteredSubPixel, Isis::ControlNetVersioner::ControlNetHeaderV0001::targetName, Isis::toString(), Isis::IException::Unknown, and Isis::ControlNetVersioner::ControlNetHeaderV0001::userName.

◆ userName()

QString Isis::ControlNetVersioner::userName ( ) const

Returns the name of the last person or program to modify the network.

Returns
QString The name of the last person or program to modify the network.

Definition at line 166 of file ControlNetVersioner.cpp.

References m_header, and Isis::ControlNetVersioner::ControlNetHeaderV0001::userName.

◆ write()

◆ writeFirstPoint()

◆ writeHeader()

void Isis::ControlNetVersioner::writeHeader ( std::fstream * output)
private

Member Data Documentation

◆ m_header

ControlNetHeaderV0005 Isis::ControlNetVersioner::m_header
private

Header containing information about the whole network.

Definition at line 516 of file ControlNetVersioner.h.

Referenced by createHeader(), creationDate(), description(), lastModificationDate(), netId(), readPvlV0001(), targetName(), toPvl(), userName(), write(), and writeHeader().

◆ m_ownsPoints

bool Isis::ControlNetVersioner::m_ownsPoints
private

Flag if the versioner owns the control points stored in it.

This will be true when the versioner created the points from a file. This will be false when the versioner copied the points from an esiting control network.

Definition at line 520 of file ControlNetVersioner.h.

Referenced by writeFirstPoint(), and ~ControlNetVersioner().

◆ m_points

QList<ControlPoint *> Isis::ControlNetVersioner::m_points
private

The documentation for this class was generated from the following files: