9#include "ControlNetVersioner.h"
11#include <boost/numeric/ublas/symmetric.hpp>
12#include <boost/numeric/ublas/io.hpp>
17#include "ControlNetFileHeaderV0002.pb.h"
18#include "ControlNetFileHeaderV0005.pb.h"
19#include "ControlNetLogDataProtoV0001.pb.h"
20#include "ControlPointFileEntryV0002.pb.h"
22#include "ControlMeasure.h"
23#include "ControlNet.h"
24#include "ControlMeasureLogData.h"
26#include "EndianSwapper.h"
28#include "IException.h"
30#include "LinearAlgebra.h"
32#include "NaifStatus.h"
36#include "PvlKeyword.h"
38#include "SpecialPixel.h"
39#include "SurfacePoint.h"
43#include <google/protobuf/io/zero_copy_stream_impl.h>
44#include <google/protobuf/io/zero_copy_stream.h>
45#include <google/protobuf/io/coded_stream.h>
46#include <google/protobuf/message_lite.h>
49using boost::numeric::ublas::symmetric_matrix;
50using boost::numeric::ublas::upper;
51using namespace google::protobuf::io;
64 : m_ownsPoints(false) {
71 header.targetName = net->GetTarget();
72 header.created = net->CreatedDate();
73 header.lastModified = net->GetLastModified();
74 header.description = net->Description();
75 header.userName = net->GetUserName();
91 : m_ownsPoints(true) {
92 read(netFile, progress);
227 pvlPoint +=
PvlKeyword(
"PointType",
"Constrained");
234 if ( controlPoint->
GetId().isEmpty() ) {
235 QString msg =
"Unable to write control net to PVL file. "
236 "Invalid control point has no point ID value.";
242 if ( QString::compare(controlPoint->GetChooserName(),
"Null", Qt::CaseInsensitive) != 0 ) {
243 pvlPoint +=
PvlKeyword(
"ChooserName", controlPoint->GetChooserName());
245 if ( QString::compare(controlPoint->GetDateTime(),
"Null", Qt::CaseInsensitive) != 0 ) {
246 pvlPoint +=
PvlKeyword(
"DateTime", controlPoint->GetDateTime());
248 if ( controlPoint->IsEditLocked() ) {
251 if ( controlPoint->IsIgnored() ) {
255 switch ( controlPoint->GetAprioriSurfacePointSource() ) {
256 case ControlPoint::SurfacePointSource::None:
258 case ControlPoint::SurfacePointSource::User:
259 pvlPoint +=
PvlKeyword(
"AprioriXYZSource",
"User");
261 case ControlPoint::SurfacePointSource::AverageOfMeasures:
262 pvlPoint +=
PvlKeyword(
"AprioriXYZSource",
"AverageOfMeasures");
264 case ControlPoint::SurfacePointSource::Reference:
265 pvlPoint +=
PvlKeyword(
"AprioriXYZSource",
"Reference");
267 case ControlPoint::SurfacePointSource::Basemap:
268 pvlPoint +=
PvlKeyword(
"AprioriXYZSource",
"Basemap");
270 case ControlPoint::SurfacePointSource::BundleSolution:
271 pvlPoint +=
PvlKeyword(
"AprioriXYZSource",
"BundleSolution");
276 pvlPoint +=
PvlKeyword(
"AprioriXYZSourceFile",
277 controlPoint->GetAprioriSurfacePointSourceFile());
280 switch ( controlPoint->GetAprioriRadiusSource() ) {
281 case ControlPoint::RadiusSource::None:
283 case ControlPoint::RadiusSource::User:
284 pvlPoint +=
PvlKeyword(
"AprioriRadiusSource",
"User");
286 case ControlPoint::RadiusSource::AverageOfMeasures:
287 pvlPoint +=
PvlKeyword(
"AprioriRadiusSource",
"AverageOfMeasures");
289 case ControlPoint::RadiusSource::BundleSolution:
290 pvlPoint +=
PvlKeyword(
"AprioriRadiusSource",
"BundleSolution");
292 case ControlPoint::RadiusSource::Ellipsoid:
293 pvlPoint +=
PvlKeyword(
"AprioriRadiusSource",
"Ellipsoid");
295 case ControlPoint::RadiusSource::DEM:
296 pvlPoint +=
PvlKeyword(
"AprioriRadiusSource",
"DEM");
301 pvlPoint +=
PvlKeyword(
"AprioriRadiusSourceFile",
302 controlPoint->GetAprioriRadiusSourceFile());
306 SurfacePoint aprioriSurfacePoint = controlPoint->GetAprioriSurfacePoint();
307 if ( aprioriSurfacePoint.Valid() ) {
312 aprioriX.addComment(
"AprioriLatitude = "
315 aprioriY.addComment(
"AprioriLongitude = "
319 aprioriZ.addComment(
"AprioriRadius = "
323 pvlPoint += aprioriX;
324 pvlPoint += aprioriY;
325 pvlPoint += aprioriZ;
327 symmetric_matrix<double, upper> aprioriCovarianceMatrix =
328 aprioriSurfacePoint.GetRectangularMatrix();
330 if ( aprioriCovarianceMatrix.size1() > 0 ) {
334 matrix +=
toString(aprioriCovarianceMatrix(0, 0));
335 matrix +=
toString(aprioriCovarianceMatrix(0, 1));
336 matrix +=
toString(aprioriCovarianceMatrix(0, 2));
337 matrix +=
toString(aprioriCovarianceMatrix(1, 1));
338 matrix +=
toString(aprioriCovarianceMatrix(1, 2));
339 matrix +=
toString(aprioriCovarianceMatrix(2, 2));
347 QString sigmas =
"AprioriLatitudeSigma = "
349 +
" <meters> AprioriLongitudeSigma = "
351 +
" <meters> AprioriRadiusSigma = "
358 if ( aprioriCovarianceMatrix(0, 0) != 0.0
359 || aprioriCovarianceMatrix(0, 1) != 0.0
360 || aprioriCovarianceMatrix(0, 2) != 0.0
361 || aprioriCovarianceMatrix(1, 1) != 0.0
362 || aprioriCovarianceMatrix(1, 2) != 0.0
363 || aprioriCovarianceMatrix(2, 2) != 0.0 ) {
373 pvlPoint +=
PvlKeyword(
"LatitudeConstrained",
"True");
377 pvlPoint +=
PvlKeyword(
"LongitudeConstrained",
"True");
381 pvlPoint +=
PvlKeyword(
"RadiusConstrained",
"True");
385 SurfacePoint adjustedSurfacePoint = controlPoint->GetAdjustedSurfacePoint();
386 if ( adjustedSurfacePoint.Valid() ) {
394 adjustedX.addComment(
"AdjustedLatitude = "
397 adjustedY.addComment(
"AdjustedLongitude = "
400 adjustedZ.addComment(
"AdjustedRadius = "
404 pvlPoint += adjustedX;
405 pvlPoint += adjustedY;
406 pvlPoint += adjustedZ;
408 symmetric_matrix<double, upper> adjustedCovarianceMatrix =
409 adjustedSurfacePoint.GetRectangularMatrix();
411 if ( adjustedCovarianceMatrix.size1() > 0 ) {
413 PvlKeyword matrix(
"AdjustedCovarianceMatrix");
414 matrix +=
toString(adjustedCovarianceMatrix(0, 0));
415 matrix +=
toString(adjustedCovarianceMatrix(0, 1));
416 matrix +=
toString(adjustedCovarianceMatrix(0, 2));
417 matrix +=
toString(adjustedCovarianceMatrix(1, 1));
418 matrix +=
toString(adjustedCovarianceMatrix(1, 2));
419 matrix +=
toString(adjustedCovarianceMatrix(2, 2));
425 QString sigmas =
"AdjustedLatitudeSigma = "
427 +
" <meters> AdjustedLongitudeSigma = "
429 +
" <meters> AdjustedRadiusSigma = "
436 if ( adjustedCovarianceMatrix(0, 0) != 0.0
437 || adjustedCovarianceMatrix(0, 1) != 0.0
438 || adjustedCovarianceMatrix(0, 2) != 0.0
439 || adjustedCovarianceMatrix(1, 1) != 0.0
440 || adjustedCovarianceMatrix(1, 2) != 0.0
441 || adjustedCovarianceMatrix(2, 2) != 0.0 ) {
448 for (
int j = 0; j < controlPoint->GetNumMeasures(); j++) {
449 PvlGroup pvlMeasure(
"ControlMeasure");
451 pvlMeasure +=
PvlKeyword(
"SerialNumber", controlMeasure.GetCubeSerialNumber());
453 switch ( controlMeasure.GetType() ) {
455 pvlMeasure +=
PvlKeyword(
"MeasureType",
"Candidate");
458 pvlMeasure +=
PvlKeyword(
"MeasureType",
"Manual");
461 pvlMeasure +=
PvlKeyword(
"MeasureType",
"RegisteredPixel");
464 pvlMeasure +=
PvlKeyword(
"MeasureType",
"RegisteredSubPixel");
468 if (QString::compare(controlMeasure.GetChooserName(),
"Null", Qt::CaseInsensitive) != 0) {
469 pvlMeasure +=
PvlKeyword(
"ChooserName", controlMeasure.GetChooserName());
471 if (QString::compare(controlMeasure.GetDateTime(),
"Null", Qt::CaseInsensitive) != 0) {
472 pvlMeasure +=
PvlKeyword(
"DateTime", controlMeasure.GetDateTime());
474 if ( controlMeasure.IsEditLocked() ) {
478 if ( controlMeasure.IsIgnored() ) {
482 if ( controlMeasure.GetSample() !=
Isis::Null) {
487 if ( controlMeasure.GetLine() !=
Isis::Null ) {
491 if ( controlMeasure.GetDiameter() !=
Isis::Null
492 && controlMeasure.GetDiameter() != 0. ) {
496 if ( controlMeasure.GetAprioriSample() !=
Isis::Null ) {
497 pvlMeasure +=
PvlKeyword(
"AprioriSample",
toString(controlMeasure.GetAprioriSample()));
500 if ( controlMeasure.GetAprioriLine() !=
Isis::Null ) {
504 if ( controlMeasure.GetSampleSigma() !=
Isis::Null ) {
509 if ( controlMeasure.GetLineSigma() !=
Isis::Null ) {
514 if ( controlMeasure.GetSampleResidual() !=
Isis::Null ) {
516 toString(controlMeasure.GetSampleResidual()),
520 if ( controlMeasure.GetLineResidual() !=
Isis::Null ) {
525 if ( controlMeasure.IsRejected() ) {
530 pvlMeasure += log.ToKeyword();
536 pvlMeasure +=
PvlKeyword(
"Reference",
"True");
538 pvlPoint.addGroup(pvlMeasure);
540 network.addObject(pvlPoint);
556 const Pvl &network(netFile.expanded());
558 if ( network.hasObject(
"ProtoBuffer") ) {
561 else if ( network.hasObject(
"ControlNetwork") ) {
565 QString msg =
"Could not determine the control network file type";
570 QString msg =
"Reading the control network [" + netFile.name()
589 if ( controlNetwork.hasKeyword(
"Version") ) {
590 version =
toInt(controlNetwork[
"Version"][0]);
610 QString msg =
"The Pvl file version [" +
toString(version)
611 +
"] is not supported";
628 header.
networkID = network.findKeyword(
"NetworkId")[0];
629 header.targetName = network.findKeyword(
"TargetName")[0];
630 header.created = network.findKeyword(
"Created")[0];
631 header.lastModified = network.findKeyword(
"LastModified")[0];
632 header.description = network.findKeyword(
"Description")[0];
633 header.userName = network.findKeyword(
"UserName")[0];
637 QString msg =
"Missing required header information.";
642 progress->
SetText(
"Reading Control Points...");
648 for (
int objectIndex = 0; objectIndex < network.objects(); objectIndex ++) {
662 QString msg =
"Failed to initialize control point at index ["
680 header.
networkID = network.findKeyword(
"NetworkId")[0];
681 header.targetName = network.findKeyword(
"TargetName")[0];
682 header.created = network.findKeyword(
"Created")[0];
683 header.lastModified = network.findKeyword(
"LastModified")[0];
684 header.description = network.findKeyword(
"Description")[0];
685 header.userName = network.findKeyword(
"UserName")[0];
689 QString msg =
"Missing required header information.";
694 progress->
SetText(
"Reading Control Points...");
700 for (
int objectIndex = 0; objectIndex < network.objects(); objectIndex ++) {
713 QString msg =
"Failed to initialize control point at index ["
731 header.
networkID = network.findKeyword(
"NetworkId")[0];
732 header.targetName = network.findKeyword(
"TargetName")[0];
733 header.created = network.findKeyword(
"Created")[0];
734 header.lastModified = network.findKeyword(
"LastModified")[0];
735 header.description = network.findKeyword(
"Description")[0];
736 header.userName = network.findKeyword(
"UserName")[0];
740 QString msg =
"Missing required header information.";
745 progress->
SetText(
"Reading Control Points...");
751 for (
int objectIndex = 0; objectIndex < network.objects(); objectIndex ++) {
763 QString msg =
"Failed to initialize control point at index ["
781 header.
networkID = network.findKeyword(
"NetworkId")[0];
782 header.targetName = network.findKeyword(
"TargetName")[0];
783 header.created = network.findKeyword(
"Created")[0];
784 header.lastModified = network.findKeyword(
"LastModified")[0];
785 header.description = network.findKeyword(
"Description")[0];
786 header.userName = network.findKeyword(
"UserName")[0];
790 QString msg =
"Missing required header information.";
795 progress->
SetText(
"Reading Control Points...");
801 for (
int objectIndex = 0; objectIndex < network.objects(); objectIndex ++) {
812 QString msg =
"Failed to initialize control point at index ["
830 header.
networkID = network.findKeyword(
"NetworkId")[0];
831 header.targetName = network.findKeyword(
"TargetName")[0];
832 header.created = network.findKeyword(
"Created")[0];
833 header.lastModified = network.findKeyword(
"LastModified")[0];
834 header.description = network.findKeyword(
"Description")[0];
835 header.userName = network.findKeyword(
"UserName")[0];
839 QString msg =
"Missing required header information.";
844 progress->
SetText(
"Reading Control Points...");
850 for (
int objectIndex = 0; objectIndex < network.objects(); objectIndex ++) {
861 QString msg =
"Failed to initialize control point at index ["
883 const PvlGroup &netInfo = protoBuf.findGroup(
"ControlNetworkInfo");
885 if ( netInfo.hasKeyword(
"Version") ) {
886 version =
toInt(netInfo[
"Version"][0]);
899 QString msg =
"The Protobuf file version [" +
toString(version)
900 +
"] is not supported";
920 BigInt coreStartPos = protoBufferCore[
"StartByte"];
921 BigInt coreLength = protoBufferCore[
"Bytes"];
923 fstream input(netFile.expanded().toLatin1().data(), ios::in | ios::binary);
924 if ( !input.is_open() ) {
925 QString msg =
"Failed to open protobuf file [" + netFile.name() +
"].";
929 input.seekg(coreStartPos, ios::beg);
930 IstreamInputStream inStream(&input);
931 CodedInputStream codedInStream(&inStream);
932 codedInStream.PushLimit(coreLength);
934 codedInStream.SetTotalBytesLimit(1024 * 1024 * 512);
937 ControlNetFileProtoV0001 protoNet;
939 if ( !protoNet.ParseFromCodedStream(&codedInStream) ) {
940 QString msg =
"Failed to read input PB file [" + netFile.name() +
"].";
945 QString msg =
"Cannot parse binary protobuf file";
949 QString msg =
"Cannot parse binary PB file";
954 BigInt logStartPos = logDataInfo[
"StartByte"];
955 BigInt logLength = logDataInfo[
"Bytes"];
958 input.seekg(logStartPos, ios::beg);
959 IstreamInputStream logInStream(&input);
960 CodedInputStream codedLogInStream(&logInStream);
961 codedLogInStream.PushLimit(logLength);
963 codedLogInStream.SetTotalBytesLimit(1024 * 1024 * 512);
966 ControlNetLogDataProtoV0001 protoLogData;
968 if ( !protoLogData.ParseFromCodedStream(&codedLogInStream) ) {
969 QString msg =
"Failed to read log data in protobuf file [" + netFile.name() +
"].";
974 QString msg =
"Cannot parse binary protobuf file's log data";
981 header.
networkID = protoNet.networkid().c_str();
982 if ( protoNet.has_targetname() ) {
983 header.targetName = protoNet.targetname().c_str();
986 header.targetName =
"";
988 header.created = protoNet.created().c_str();
989 header.lastModified = protoNet.lastmodified().c_str();
990 header.description = protoNet.description().c_str();
991 header.userName = protoNet.username().c_str();
995 QString msg =
"Failed to parse the header from the protobuf control network file.";
1000 progress->
SetText(
"Reading Control Points...");
1006 for (
int i = 0; i < protoNet.points_size(); i++) {
1008 QSharedPointer<ControlNetFileProtoV0001_PBControlPoint>
1009 protoPoint(
new ControlNetFileProtoV0001_PBControlPoint(protoNet.points(i)));
1010 QSharedPointer<ControlNetLogDataProtoV0001_Point>
1011 protoPointLogData(
new ControlNetLogDataProtoV0001_Point(protoLogData.points(i)));
1021 QString msg =
"Failed to convert version 1 protobuf control point at index ["
1022 +
toString(i) +
"] into a ControlPoint.";
1044 BigInt headerStartPos = protoBufferCore[
"HeaderStartByte"];
1045 BigInt headerLength = protoBufferCore[
"HeaderBytes"];
1047 fstream input(netFile.expanded().toLatin1().data(), ios::in | ios::binary);
1048 if ( !input.is_open() ) {
1049 QString msg =
"Failed to open control network file" + netFile.name();
1053 input.seekg(headerStartPos, ios::beg);
1054 streampos filePos = input.tellg();
1056 ControlNetFileHeaderV0002 protoHeader;
1058 IstreamInputStream headerInStream(&input);
1059 CodedInputStream headerCodedInStream(&headerInStream);
1061 headerCodedInStream.SetTotalBytesLimit(1024 * 1024 * 512);
1062 CodedInputStream::Limit oldLimit = headerCodedInStream.PushLimit(headerLength);
1063 if ( !protoHeader.ParseFromCodedStream(&headerCodedInStream) ) {
1064 QString msg =
"Failed to parse protobuf header from input control net file ["
1065 + netFile.name() +
"]";
1068 headerCodedInStream.PopLimit(oldLimit);
1069 filePos += headerLength;
1072 QString msg =
"An error occured while reading the protobuf control network header.";
1079 header.
networkID = protoHeader.networkid().c_str();
1080 if ( protoHeader.has_targetname() ) {
1081 header.targetName = protoHeader.targetname().c_str();
1084 header.targetName =
"";
1086 header.created = protoHeader.created().c_str();
1087 header.lastModified = protoHeader.lastmodified().c_str();
1088 header.description = protoHeader.description().c_str();
1089 header.userName = protoHeader.username().c_str();
1093 QString msg =
"Missing required header information.";
1100 input.open(netFile.expanded().toLatin1().data(), ios::in | ios::binary);
1101 input.seekg(filePos, ios::beg);
1102 IstreamInputStream pointInStream(&input);
1103 int numPoints = protoHeader.pointmessagesizes_size();
1106 progress->
SetText(
"Reading Control Points...");
1111 for (
int pointIndex = 0; pointIndex <
numPoints; pointIndex ++) {
1112 QSharedPointer<ControlPointFileEntryV0002> newPoint(
new ControlPointFileEntryV0002);
1115 CodedInputStream pointCodedInStream(&pointInStream);
1116 pointCodedInStream.SetTotalBytesLimit(1024 * 1024 * 512);
1117 int pointSize = protoHeader.pointmessagesizes(pointIndex);
1118 CodedInputStream::Limit oldPointLimit = pointCodedInStream.PushLimit(pointSize);
1119 newPoint->ParseFromCodedStream(&pointCodedInStream);
1120 pointCodedInStream.PopLimit(oldPointLimit);
1123 QString msg =
"Failed to read protobuf version 2 control point at index ["
1138 QString msg =
"Failed to convert protobuf version 2 control point at index ["
1139 +
toString(pointIndex) +
"] into a ControlPoint.";
1162 BigInt headerStartPos = protoBufferCore[
"HeaderStartByte"];
1163 BigInt headerLength = protoBufferCore[
"HeaderBytes"];
1164 BigInt pointsLength = protoBufferCore[
"PointsBytes"];
1166 fstream input(netFile.expanded().toLatin1().data(), ios::in | ios::binary);
1167 if ( !input.is_open() ) {
1168 QString msg =
"Failed to open control network file" + netFile.name();
1172 input.seekg(headerStartPos, ios::beg);
1174 streampos filePos = input.tellg();
1176 ControlNetFileHeaderV0005 protoHeader;
1179 IstreamInputStream headerInStream(&input);
1180 CodedInputStream headerCodedInStream(&headerInStream);
1183 headerCodedInStream.SetTotalBytesLimit(1024 * 1024 * 512);
1185 CodedInputStream::Limit oldLimit = headerCodedInStream.PushLimit(headerLength);
1187 if ( !protoHeader.ParseFromCodedStream(&headerCodedInStream) ) {
1188 QString msg =
"Failed to parse protobuf header from input control net file ["
1189 + netFile.name() +
"]";
1193 headerCodedInStream.PopLimit(oldLimit);
1195 filePos += headerLength;
1198 QString msg =
"An error occured while reading the protobuf control network header.";
1204 header.
networkID = protoHeader.networkid().c_str();
1205 if ( protoHeader.has_targetname() ) {
1206 header.targetName = protoHeader.targetname().c_str();
1209 header.targetName =
"";
1211 header.created = protoHeader.created().c_str();
1212 header.lastModified = protoHeader.lastmodified().c_str();
1213 header.description = protoHeader.description().c_str();
1214 header.userName = protoHeader.username().c_str();
1218 QString msg =
"Missing required header information.";
1225 input.open(netFile.expanded().toLatin1().data(), ios::in | ios::binary);
1226 input.seekg(filePos, ios::beg);
1228 IstreamInputStream pointInStream(&input);
1230 BigInt numberOfPoints = 0;
1232 if ( protoBufferInfo.hasGroup(
"ControlNetworkInfo") ) {
1233 const PvlGroup &networkInfo = protoBufferInfo.findGroup(
"ControlNetworkInfo");
1235 if ( networkInfo.hasKeyword(
"NumberOfPoints") ) {
1237 numberOfPoints = networkInfo[
"NumberOfPoints"];
1245 if (progress && numberOfPoints != 0) {
1246 progress->
SetText(
"Reading Control Points...");
1252 int pointIndex = -1;
1253 while (pointInStream.ByteCount() < pointsLength) {
1255 QSharedPointer<ControlPointFileEntryV0002> newPoint(
new ControlPointFileEntryV0002);
1259 CodedInputStream pointCodedInStream(&pointInStream);
1260 pointCodedInStream.SetTotalBytesLimit(1024 * 1024 * 512);
1263 pointCodedInStream.ReadRaw(
reinterpret_cast<char *
>(&size),
sizeof(size));
1265 size = lsb.Uint32_t(&size);
1267 CodedInputStream::Limit oldPointLimit = pointCodedInStream.PushLimit(size);
1268 newPoint->ParseFromCodedStream(&pointCodedInStream);
1269 pointCodedInStream.PopLimit(oldPointLimit);
1272 QString msg =
"Failed to read protobuf version 2 control point at index ["
1281 if (progress && numberOfPoints != 0) {
1287 QString msg =
"Failed to convert protobuf version 2 control point at index ["
1288 +
toString(pointIndex) +
"] into a ControlPoint.";
1344 ControlPointFileEntryV0002 protoPoint = point.
pointData();
1348 controlPoint->
SetId(QString(protoPoint.id().c_str()));
1350 if ( protoPoint.has_choosername() ) {
1356 switch ( protoPoint.type() ) {
1357 case ControlPointFileEntryV0002_PointType_obsolete_Tie:
1358 case ControlPointFileEntryV0002_PointType_Free:
1361 case ControlPointFileEntryV0002_PointType_Constrained:
1364 case ControlPointFileEntryV0002_PointType_obsolete_Ground:
1365 case ControlPointFileEntryV0002_PointType_Fixed:
1369 QString msg =
"Unable to create ControlPoint [" +
toString(protoPoint.id().c_str())
1370 +
"] from file. Type enumeration [" +
toString((
int)(protoPoint.type()))
1375 controlPoint->
SetType(pointType);
1377 if ( protoPoint.has_ignore() ) {
1378 controlPoint->
SetIgnored(protoPoint.ignore());
1380 if ( protoPoint.has_jigsawrejected() ) {
1381 controlPoint->
SetRejected(protoPoint.jigsawrejected());
1385 if ( protoPoint.has_aprioriradiussource() ) {
1387 switch ( protoPoint.aprioriradiussource() ) {
1388 case ControlPointFileEntryV0002_AprioriSource_None:
1391 case ControlPointFileEntryV0002_AprioriSource_User:
1394 case ControlPointFileEntryV0002_AprioriSource_AverageOfMeasures:
1397 case ControlPointFileEntryV0002_AprioriSource_Ellipsoid:
1400 case ControlPointFileEntryV0002_AprioriSource_DEM:
1403 case ControlPointFileEntryV0002_AprioriSource_BundleSolution:
1408 QString msg =
"Unknown control point apriori radius source.";
1414 if ( protoPoint.has_aprioriradiussourcefile() ) {
1419 if ( protoPoint.has_apriorisurfpointsource() ) {
1420 switch ( protoPoint.apriorisurfpointsource() ) {
1421 case ControlPointFileEntryV0002_AprioriSource_None:
1425 case ControlPointFileEntryV0002_AprioriSource_User:
1429 case ControlPointFileEntryV0002_AprioriSource_AverageOfMeasures:
1431 ControlPoint::SurfacePointSource::AverageOfMeasures);
1434 case ControlPointFileEntryV0002_AprioriSource_Reference:
1438 case ControlPointFileEntryV0002_AprioriSource_Basemap:
1442 case ControlPointFileEntryV0002_AprioriSource_BundleSolution:
1444 ControlPoint::SurfacePointSource::BundleSolution);
1448 QString msg =
"Unknown control point aprioir surface point source.";
1454 if ( protoPoint.has_apriorisurfpointsourcefile() ) {
1456 protoPoint.apriorisurfpointsourcefile().c_str());
1459 if ( protoPoint.has_apriorix()
1460 && protoPoint.has_aprioriy()
1461 && protoPoint.has_aprioriz() ) {
1467 if ( protoPoint.aprioricovar_size() > 0 ) {
1468 symmetric_matrix<double, upper> aprioriCovarianceMatrix;
1469 aprioriCovarianceMatrix.resize(3);
1470 aprioriCovarianceMatrix.clear();
1471 aprioriCovarianceMatrix(0, 0) = protoPoint.aprioricovar(0);
1472 aprioriCovarianceMatrix(0, 1) = protoPoint.aprioricovar(1);
1473 aprioriCovarianceMatrix(0, 2) = protoPoint.aprioricovar(2);
1474 aprioriCovarianceMatrix(1, 1) = protoPoint.aprioricovar(3);
1475 aprioriCovarianceMatrix(1, 2) = protoPoint.aprioricovar(4);
1476 aprioriCovarianceMatrix(2, 2) = protoPoint.aprioricovar(5);
1485 if ( protoPoint.has_adjustedx()
1486 && protoPoint.has_adjustedy()
1487 && protoPoint.has_adjustedz() ) {
1493 if ( protoPoint.adjustedcovar_size() > 0 ) {
1494 symmetric_matrix<double, upper> adjustedCovarianceMatrix;
1495 adjustedCovarianceMatrix.resize(3);
1496 adjustedCovarianceMatrix.clear();
1497 adjustedCovarianceMatrix(0, 0) = protoPoint.adjustedcovar(0);
1498 adjustedCovarianceMatrix(0, 1) = protoPoint.adjustedcovar(1);
1499 adjustedCovarianceMatrix(0, 2) = protoPoint.adjustedcovar(2);
1500 adjustedCovarianceMatrix(1, 1) = protoPoint.adjustedcovar(3);
1501 adjustedCovarianceMatrix(1, 2) = protoPoint.adjustedcovar(4);
1502 adjustedCovarianceMatrix(2, 2) = protoPoint.adjustedcovar(5);
1509 SurfacePoint aprioriSurfacePoint = controlPoint->GetAprioriSurfacePoint();
1510 SurfacePoint adjustedSurfacePoint = controlPoint->GetAdjustedSurfacePoint();
1515 for (
int m = 0 ; m < protoPoint.measures_size(); m++) {
1519 if ( protoPoint.has_referenceindex() ) {
1524 if ( protoPoint.has_datetime() ) {
1525 controlPoint->
SetDateTime(protoPoint.datetime().c_str());
1528 if ( protoPoint.has_editlock() ) {
1532 return controlPoint;
1546 const ControlPointFileEntryV0002_Measure &measure) {
1555 switch ( measure.type() ) {
1556 case ControlPointFileEntryV0002_Measure::Candidate:
1559 case ControlPointFileEntryV0002_Measure::Manual:
1562 case ControlPointFileEntryV0002_Measure::RegisteredPixel:
1565 case ControlPointFileEntryV0002_Measure::RegisteredSubPixel:
1569 QString msg =
"Unknown control measure type.";
1573 newMeasure->
SetType(measureType);
1575 if ( measure.has_jigsawrejected() ) {
1576 newMeasure->
SetRejected(measure.jigsawrejected());
1578 if ( measure.has_ignore() ) {
1579 newMeasure->SetIgnored(measure.ignore());
1581 if ( measure.has_line() ) {
1582 newMeasure->
SetCoordinate(measure.sample(), measure.line());
1584 if ( measure.has_diameter() ) {
1587 if ( measure.has_apriorisample() ) {
1588 newMeasure->SetAprioriSample(measure.apriorisample());
1590 if ( measure.has_aprioriline() ) {
1591 newMeasure->SetAprioriLine(measure.aprioriline());
1593 if ( measure.has_samplesigma() ) {
1594 newMeasure->SetSampleSigma(measure.samplesigma());
1596 if ( measure.has_linesigma() ) {
1597 newMeasure->SetLineSigma(measure.linesigma());
1599 if ( measure.has_sampleresidual()
1600 && measure.has_lineresidual() ) {
1601 newMeasure->
SetResidual(measure.sampleresidual(), measure.lineresidual());
1604 for (
int i = 0; i < measure.log_size(); i++) {
1606 const ControlPointFileEntryV0002_Measure_MeasureLogData &protoLog = measure.log(i);
1608 if ( protoLog.has_doubledatatype() ) {
1611 if ( protoLog.has_doubledatavalue() ) {
1612 logEntry.SetNumericalValue( protoLog.doubledatavalue() );
1617 if ( measure.has_choosername() ) {
1618 newMeasure->
SetChooserName(QString(measure.choosername().c_str()));
1621 if ( measure.has_datetime() ) {
1622 newMeasure->
SetDateTime(QString(measure.datetime().c_str()));
1627 if ( measure.has_editlock() ) {
1628 newMeasure->SetEditLock(measure.editlock());
1660 const int labelBytes = 65536;
1661 fstream output(netFile.expanded().toLatin1().data(), ios::out | ios::trunc | ios::binary);
1662 char *blankLabel =
new char[labelBytes];
1663 memset(blankLabel, 0, labelBytes);
1664 output.write(blankLabel, labelBytes);
1665 delete [] blankLabel;
1667 int numMeasures = 0;
1670 numMeasures += point->GetNumMeasures();
1673 streampos startCoreHeaderPos = output.tellp();
1677 BigInt pointByteTotal = 0;
1683 ControlNetFileHeaderV0005 protobufHeader;
1692 streampos coreHeaderSize = protobufHeader.ByteSizeLong();
1699 protoCore.addKeyword(
PvlKeyword(
"HeaderStartByte",
1703 BigInt pointsStartByte = (
BigInt) (startCoreHeaderPos + coreHeaderSize);
1707 protoCore.addKeyword(
PvlKeyword(
"PointsBytes",
1709 protoObj.addObject(protoCore);
1711 PvlGroup netInfo(
"ControlNetworkInfo");
1712 netInfo.addComment(
"This group is for informational purposes only");
1713 netInfo +=
PvlKeyword(
"NetworkId", protobufHeader.networkid().c_str());
1714 netInfo +=
PvlKeyword(
"TargetName", protobufHeader.targetname().c_str());
1715 netInfo +=
PvlKeyword(
"UserName", protobufHeader.username().c_str());
1716 netInfo +=
PvlKeyword(
"Created", protobufHeader.created().c_str());
1717 netInfo +=
PvlKeyword(
"LastModified", protobufHeader.lastmodified().c_str());
1718 netInfo +=
PvlKeyword(
"Description", protobufHeader.description().c_str());
1722 protoObj.addGroup(netInfo);
1724 p.addObject(protoObj);
1726 output.seekp(0, ios::beg);
1733 QString msg =
"Can't write control net file";
1746 ControlNetFileHeaderV0005 protobufHeader;
1756 if ( !protobufHeader.SerializeToOstream(output) ) {
1757 QString msg =
"Failed to write output control network file.";
1774 BigInt startPos = output->tellp();
1776 ControlPointFileEntryV0002 protoPoint;
1779 if ( controlPoint->
GetId().isEmpty() ) {
1780 QString msg =
"Unbable to write first point of control net. "
1781 "Invalid control point has no point ID value.";
1785 protoPoint.set_id(controlPoint->
GetId().toLatin1().data());
1788 if ( QString::compare(controlPoint->GetChooserName(),
"Null", Qt::CaseInsensitive) != 0 ) {
1789 protoPoint.set_choosername(controlPoint->GetChooserName().toLatin1().data());
1791 if ( QString::compare(controlPoint->GetDateTime(),
"Null", Qt::CaseInsensitive) != 0 ) {
1792 protoPoint.set_datetime(controlPoint->GetDateTime().toLatin1().data());
1794 if ( controlPoint->IsEditLocked() ) {
1795 protoPoint.set_editlock(
true);
1798 ControlPointFileEntryV0002_PointType pointType;
1799 switch ( controlPoint->
GetType() ) {
1801 pointType = ControlPointFileEntryV0002_PointType_Free;
1804 pointType = ControlPointFileEntryV0002_PointType_Constrained;
1807 pointType = ControlPointFileEntryV0002_PointType_Fixed;
1810 pointType = ControlPointFileEntryV0002_PointType_Free;
1813 protoPoint.set_type(pointType);
1815 if ( controlPoint->IsIgnored() ) {
1816 protoPoint.set_ignore(
true);
1819 if ( controlPoint->IsRejected() ) {
1820 protoPoint.set_jigsawrejected(
true);
1828 protoPoint.set_apriorisurfpointsourcefile(
1829 controlPoint->GetAprioriSurfacePointSourceFile().toLatin1().data());
1833 switch ( controlPoint->GetAprioriSurfacePointSource() ) {
1834 case ControlPoint::SurfacePointSource::None:
1835 protoPoint.set_apriorisurfpointsource(ControlPointFileEntryV0002_AprioriSource_None);
1837 case ControlPoint::SurfacePointSource::User:
1838 protoPoint.set_apriorisurfpointsource(ControlPointFileEntryV0002_AprioriSource_User);
1840 case ControlPoint::SurfacePointSource::AverageOfMeasures:
1841 protoPoint.set_apriorisurfpointsource(
1842 ControlPointFileEntryV0002_AprioriSource_AverageOfMeasures);
1844 case ControlPoint::SurfacePointSource::Reference:
1845 protoPoint.set_apriorisurfpointsource(
1846 ControlPointFileEntryV0002_AprioriSource_Reference);
1848 case ControlPoint::SurfacePointSource::Basemap:
1849 protoPoint.set_apriorisurfpointsource(ControlPointFileEntryV0002_AprioriSource_Basemap);
1851 case ControlPoint::SurfacePointSource::BundleSolution:
1852 protoPoint.set_apriorisurfpointsource(
1853 ControlPointFileEntryV0002_AprioriSource_BundleSolution);
1856 protoPoint.set_apriorisurfpointsource(ControlPointFileEntryV0002_AprioriSource_None);
1861 switch ( controlPoint->GetAprioriRadiusSource() ) {
1862 case ControlPoint::RadiusSource::None:
1863 protoPoint.set_aprioriradiussource(ControlPointFileEntryV0002_AprioriSource_None);
1865 case ControlPoint::RadiusSource::User:
1866 protoPoint.set_aprioriradiussource(ControlPointFileEntryV0002_AprioriSource_User);
1868 case ControlPoint::RadiusSource::AverageOfMeasures:
1869 protoPoint.set_aprioriradiussource(
1870 ControlPointFileEntryV0002_AprioriSource_AverageOfMeasures);
1872 case ControlPoint::RadiusSource::BundleSolution:
1873 protoPoint.set_aprioriradiussource(
1874 ControlPointFileEntryV0002_AprioriSource_BundleSolution);
1876 case ControlPoint::RadiusSource::Ellipsoid:
1877 protoPoint.set_aprioriradiussource(ControlPointFileEntryV0002_AprioriSource_Ellipsoid);
1879 case ControlPoint::RadiusSource::DEM:
1880 protoPoint.set_aprioriradiussource(ControlPointFileEntryV0002_AprioriSource_DEM);
1883 protoPoint.set_aprioriradiussource(ControlPointFileEntryV0002_AprioriSource_None);
1888 protoPoint.set_aprioriradiussourcefile(
1889 controlPoint->GetAprioriRadiusSourceFile().toLatin1().data());
1892 SurfacePoint aprioriSurfacePoint = controlPoint->GetAprioriSurfacePoint();
1893 if ( aprioriSurfacePoint.Valid() ) {
1894 protoPoint.set_apriorix(aprioriSurfacePoint.GetX().
meters());
1895 protoPoint.set_aprioriy(aprioriSurfacePoint.GetY().
meters());
1896 protoPoint.set_aprioriz(aprioriSurfacePoint.GetZ().
meters());
1898 symmetric_matrix<double, upper> aprioriCovarianceMatrix =
1899 aprioriSurfacePoint.GetRectangularMatrix();
1900 if ( aprioriCovarianceMatrix.size1() > 0 &&
1905 protoPoint.add_aprioricovar(aprioriCovarianceMatrix(0, 0));
1906 protoPoint.add_aprioricovar(aprioriCovarianceMatrix(0, 1));
1907 protoPoint.add_aprioricovar(aprioriCovarianceMatrix(0, 2));
1908 protoPoint.add_aprioricovar(aprioriCovarianceMatrix(1, 1));
1909 protoPoint.add_aprioricovar(aprioriCovarianceMatrix(1, 2));
1910 protoPoint.add_aprioricovar(aprioriCovarianceMatrix(2, 2));
1925 SurfacePoint adjustedSurfacePoint = controlPoint->GetAdjustedSurfacePoint();
1926 if ( adjustedSurfacePoint.Valid() ) {
1928 protoPoint.set_adjustedx(adjustedSurfacePoint.GetX().
meters());
1929 protoPoint.set_adjustedy(adjustedSurfacePoint.GetY().
meters());
1930 protoPoint.set_adjustedz(adjustedSurfacePoint.GetZ().
meters());
1932 symmetric_matrix<double, upper> adjustedCovarianceMatrix =
1933 adjustedSurfacePoint.GetRectangularMatrix();
1934 if ( adjustedCovarianceMatrix.size1() > 0 ) {
1935 protoPoint.add_adjustedcovar(adjustedCovarianceMatrix(0, 0));
1936 protoPoint.add_adjustedcovar(adjustedCovarianceMatrix(0, 1));
1937 protoPoint.add_adjustedcovar(adjustedCovarianceMatrix(0, 2));
1938 protoPoint.add_adjustedcovar(adjustedCovarianceMatrix(1, 1));
1939 protoPoint.add_adjustedcovar(adjustedCovarianceMatrix(1, 2));
1940 protoPoint.add_adjustedcovar(adjustedCovarianceMatrix(2, 2));
1945 for (
int j = 0; j < controlPoint->GetNumMeasures(); j++) {
1949 ControlPointFileEntryV0002_Measure protoMeasure;
1951 protoMeasure.set_serialnumber(controlMeasure.GetCubeSerialNumber().toLatin1().data());
1953 switch ( controlMeasure.GetType() ) {
1955 protoMeasure.set_type(ControlPointFileEntryV0002_Measure_MeasureType_Candidate);
1959 protoMeasure.set_type(ControlPointFileEntryV0002_Measure_MeasureType_Manual);
1963 protoMeasure.set_type(
1964 ControlPointFileEntryV0002_Measure_MeasureType_RegisteredPixel);
1968 protoMeasure.set_type(
1969 ControlPointFileEntryV0002_Measure_MeasureType_RegisteredSubPixel);
1973 if (QString::compare(controlMeasure.GetChooserName(),
"Null", Qt::CaseInsensitive) != 0) {
1974 protoMeasure.set_choosername(controlMeasure.GetChooserName().toLatin1().data());
1977 if (QString::compare(controlMeasure.GetDateTime(),
"Null", Qt::CaseInsensitive) != 0) {
1978 protoMeasure.set_datetime(controlMeasure.GetDateTime().toLatin1().data());
1981 if ( controlMeasure.IsEditLocked() ) {
1982 protoMeasure.set_editlock(
true);
1985 if ( controlMeasure.IsIgnored() ) {
1986 protoMeasure.set_ignore(
true);
1989 if ( controlMeasure.IsRejected() ) {
1990 protoMeasure.set_jigsawrejected(
true);
1993 if ( controlMeasure.GetSample() !=
Isis::Null ) {
1994 protoMeasure.set_sample(controlMeasure.GetSample());
1997 if ( controlMeasure.GetLine() !=
Isis::Null ) {
1998 protoMeasure.set_line(controlMeasure.GetLine());
2001 if ( controlMeasure.GetDiameter() !=
Isis::Null ) {
2002 protoMeasure.set_diameter(controlMeasure.GetDiameter());
2005 if ( controlMeasure.GetAprioriSample() !=
Isis::Null ) {
2006 protoMeasure.set_apriorisample(controlMeasure.GetAprioriSample());
2009 if ( controlMeasure.GetAprioriLine() !=
Isis::Null ) {
2010 protoMeasure.set_aprioriline(controlMeasure.GetAprioriLine());
2013 if ( controlMeasure.GetSampleSigma() !=
Isis::Null ) {
2014 protoMeasure.set_samplesigma(controlMeasure.GetSampleSigma());
2017 if ( controlMeasure.GetLineSigma() !=
Isis::Null ) {
2018 protoMeasure.set_linesigma(controlMeasure.GetLineSigma());
2021 if ( controlMeasure.GetSampleResidual() !=
Isis::Null ) {
2022 protoMeasure.set_sampleresidual(controlMeasure.GetSampleResidual());
2025 if ( controlMeasure.GetLineResidual() !=
Isis::Null ) {
2026 protoMeasure.set_lineresidual(controlMeasure.GetLineResidual());
2029 if ( controlMeasure.IsRejected() ) {
2030 protoMeasure.set_jigsawrejected(
true);
2033 QVector<ControlMeasureLogData> measureLogs = controlMeasure.GetLogDataEntries();
2034 for (
int logEntry = 0; logEntry < measureLogs.size(); logEntry ++) {
2038 ControlPointFileEntryV0002_Measure_MeasureLogData logData;
2040 if ( log.IsValid() ) {
2041 logData.set_doubledatatype( (
int) log.GetDataType() );
2042 logData.set_doubledatavalue( log.GetNumericalValue() );
2045 *protoMeasure.add_log() = logData;
2048 *protoPoint.add_measures() = protoMeasure;
2051 uint32_t byteSize = protoPoint.ByteSizeLong();
2054 byteSize = lsb.Uint32_t(&byteSize);
2056 output->write(
reinterpret_cast<char *
>(&byteSize),
sizeof(byteSize));
2058 if ( !protoPoint.SerializeToOstream(output) ) {
2059 QString err =
"Error writing to coded protobuf stream";
2065 delete controlPoint;
2066 controlPoint = NULL;
2068 BigInt currentPos = output->tellp();
2069 BigInt byteCount = currentPos - startPos;
double degrees() const
Get the angle in units of Degrees.
Status SetCubeSerialNumber(QString newSerialNumber)
Set cube serial number.
Status SetCoordinate(double sample, double line)
Set the coordinate of the measurement.
MeasureType
Control network measurement types.
@ Manual
Hand Measured (e.g., qnet)
@ Candidate
(e.g., autoseed, interest) AKA predicted, unmeasured, unverified
@ RegisteredSubPixel
Registered to sub-pixel (e.g., pointreg)
@ RegisteredPixel
Registered to whole pixel (e.g.,pointreg)
Status SetType(MeasureType type)
Set how the coordinate was obtained.
Status SetDiameter(double diameter)
Set the crater diameter at the coordinate.
void SetLogData(ControlMeasureLogData)
This adds or updates the log data information associated with data's type.
Status SetDateTime()
Date Time - Creation Time.
Status SetResidual(double sampResidual, double lineResidual)
Set the BundleAdjust Residual of the coordinate.
Status SetRejected(bool rejected)
Set "jigsaw" rejected flag for a measure.
Status SetChooserName()
Set chooser name to a user who last changed the coordinate.
Statistical and similar ControlMeasure associated information.
NumericLogDataType
Please do not change existing values in this list except the size - it will break backwards compadibi...
void SetDataType(NumericLogDataType newDataType)
This changes the type of this log data.
ControlNetHeaderV0005 m_header
Header containing information about the whole network.
int numPoints() const
Returns the number of points that have been read in or are ready to write out.
QString netId() const
Returns the ID for the network.
Pvl toPvl()
Generates a Pvl file from the currently stored control points and header.
void readPvlV0002(const PvlObject &network, Progress *progress=NULL)
read a version 2 Pvl control network and convert the data into control points.
ControlPoint * createPoint(ControlPointV0001 &point)
Create a pointer to a latest version ControlPoint from an object in a V0001 control net file.
QString creationDate() const
Returns the date and time that the network was created.
void readPvl(const Pvl &network, Progress *progress=NULL)
Read a Pvl control network and prepare the data to be converted into a control network.
QString targetName() const
Returns the target for the 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...
ControlMeasure * createMeasure(const ControlPointFileEntryV0002_Measure &)
Create a pointer to a ControlMeasure from a V0006 file.
bool m_ownsPoints
Flag if the versioner owns the control points stored in it.
void writeHeader(std::fstream *output)
This will read the binary protobuffer control network header to an fstream.
void createHeader(const ControlNetHeaderV0001 header)
Create the internal header from a V0001 header.
void readPvlV0001(const PvlObject &network, Progress *progress=NULL)
read a version 1 Pvl control network and convert the data into control points.
ControlPoint * takeFirstPoint()
Returns the first point stored in the versioner's internal list.
~ControlNetVersioner()
Destroy a ControlNetVersioner.
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 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...
int writeFirstPoint(std::fstream *output)
This will write the first control point to a file stream.
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...
QString userName() const
Returns the name of the last person or program to modify the network.
ControlNetVersioner()
Default constructor. Intentially un-implemented.
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.
QString lastModificationDate() const
Returns the date and time of the last modification to the network.
void write(FileName netFile)
This will write a control net file object to disk.
QList< ControlPoint * > m_points
ControlPoints that are read in from a file or ready to be written out to a file.
QString description() const
Returns the network's description.
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.
Status SetEditLock(bool editLock)
Set the EditLock state.
Status SetAprioriSurfacePoint(SurfacePoint aprioriSP)
This updates the apriori surface point.
Status SetId(QString id)
Sets the Id of the control point.
Status SetAprioriRadiusSource(RadiusSource::Source source)
This updates the source of the radius of the apriori surface point.
bool IsReferenceExplicit() const
Status SetChooserName(QString name)
Set the point's chooser name.
bool HasRefMeasure() const
Checks to see if a reference measure is set.
Status SetRejected(bool rejected)
Set the jigsawRejected state.
void Add(ControlMeasure *measure)
Add a measurement to the control point, taking ownership of the measure in the process.
PointType GetType() const
Status SetAdjustedSurfacePoint(SurfacePoint newSurfacePoint)
Set or update the surface point relating to this control point.
PointType
These are the valid 'types' of point.
@ Constrained
A Constrained point is a Control Point whose lat/lon/radius is somewhat established and should not be...
@ Free
A Free point is a Control Point that identifies common measurements between two or more cubes.
@ Fixed
A Fixed point is a Control Point whose lat/lon is well established and should not be changed.
Status SetType(PointType newType)
Updates the control point's type.
Status SetAprioriSurfacePointSourceFile(QString sourceFile)
This updates the filename of where the apriori surface point came from.
int IndexOfRefMeasure() const
Status SetAprioriSurfacePointSource(SurfacePointSource::Source source)
This updates the source of the surface point.
const ControlMeasure * GetMeasure(QString serialNumber) const
Get a control measure based on its cube's serial number.
bool IsCoord2Constrained()
Return bool indicating if 2nd coordinate is Constrained or not.
bool HasAprioriRadiusSourceFile() const
Checks to see if the radius source file has been set.
bool IsCoord1Constrained()
Return bool indicating if 1st coordinate is Constrained or not.
Status SetIgnored(bool newIgnoreStatus)
Set whether to ignore or use control point.
Status SetDateTime(QString newDateTime)
Set the point's last modified time.
bool IsCoord3Constrained()
Return bool indicating if 3rd coordinate is Constrained or not.
QString GetId() const
Return the Id of the control point.
bool HasAprioriSurfacePointSourceFile() const
Checks to see if the surface point source file has been set.
Status SetRefMeasure(ControlMeasure *cm)
Set the point's reference measure.
Status SetAprioriRadiusSourceFile(QString sourceFile)
This updates the filename of the DEM that the apriori radius came from.
A container for the information stored in a version 1 ControlPoint.
A container for the information stored in a version 2 ControlPoint.
A container for the information stored in a version 3 and 4 ControlPoint.
const ControlPointFileEntryV0002 & pointData()
Access the protobuf control point data.
Displacement is a signed length, usually in meters.
@ Meters
The distance is being specified in meters.
double meters() const
Get the displacement in meters.
double meters() const
Get the distance in meters.
File name manipulation and expansion.
@ Unknown
A type of error that cannot be classified as any of the other error types.
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
@ Programmer
This error is for when a programmer made an API call that was illegal.
@ Io
A type of error that occurred when performing an actual I/O operation.
Program progress reporter.
void SetMaximumSteps(const int steps)
This sets the maximum number of steps in the process.
void SetText(const QString &text)
Changes the value of the text string reported just before 0% processed.
void CheckStatus()
Checks and updates the status.
Contains multiple PvlContainers.
Container for cube-like labels.
A single keyword-value pair.
void addComment(QString comment)
Add a comment to the PvlKeyword.
Contains Pvl Groups and Pvl Objects.
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
PvlObject & object(const int index)
Return the object at the specified index.
void addObject(const PvlObject &object)
Add a PvlObject.
This class defines a body-fixed surface point.
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
Distance GetLonSigmaDistance() const
Return the longitude sigma in meters.
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
void SetRectangularMatrix(const boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &covar, SurfacePoint::CoordUnits units=SurfacePoint::Meters)
Set rectangular covariance matrix and store in units of km**2.
Distance GetLatSigmaDistance() const
Return the latitude sigma as a Distance.
Distance GetLocalRadius() const
Return the radius of the surface point.
This is free and unencumbered software released into the public domain.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
int toInt(const QString &string)
Global function to convert from a string to an integer.
const double Null
Value for an Isis Null pixel.
long long int BigInt
Big int.
Namespace for the standard library.