27 ControlPointV0001::ControlPointV0001(
30 : m_pointData(pointData), m_logData(logData) {
42 : m_pointData(new ControlNetFileProtoV0001_PBControlPoint),
43 m_logData(new ControlNetLogDataProtoV0001_Point) {
46 for (
int cpKeyIndex = 0; cpKeyIndex < pointObject.
keywords(); cpKeyIndex ++) {
47 if (pointObject[cpKeyIndex][0] ==
"") {
53 copy(pointObject,
"PointId",
54 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_id);
55 copy(pointObject,
"ChooserName",
56 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_choosername);
57 copy(pointObject,
"DateTime",
58 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_datetime);
59 copy(pointObject,
"AprioriXYZSourceFile",
60 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_apriorisurfpointsourcefile);
61 copy(pointObject,
"AprioriLatLonSourceFile",
62 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_apriorisurfpointsourcefile);
63 copy(pointObject,
"AprioriRadiusSourceFile",
64 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_aprioriradiussourcefile);
65 copy(pointObject,
"JigsawRejected",
66 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_jigsawrejected);
67 copy(pointObject,
"EditLock",
68 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_editlock);
69 copy(pointObject,
"Ignore",
70 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_ignore);
71 copy(pointObject,
"LatitudeConstrained",
72 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_latitudeconstrained);
73 copy(pointObject,
"LongitudeConstrained",
74 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_longitudeconstrained);
75 copy(pointObject,
"RadiusConstrained",
76 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_radiusconstrained);
101 && pointObject.
hasKeyword(
"AprioriRadius") ) {
128 if ( (pointObject.
hasKeyword(
"Held") && pointObject[
"Held"][0] ==
"True")
129 || (pointObject[
"PointType"][0] ==
"Ground") ) {
130 m_pointData->set_type(ControlNetFileProtoV0001_PBControlPoint::Ground);
132 else if (pointObject[
"PointType"][0] ==
"Tie") {
133 m_pointData->set_type(ControlNetFileProtoV0001_PBControlPoint::Tie);
136 QString msg =
"Invalid ControlPoint type [" + pointObject[
"PointType"][0] +
"].";
140 if (pointObject.
hasKeyword(
"AprioriXYZSource")) {
141 QString source = pointObject[
"AprioriXYZSource"][0];
143 if (source ==
"None") {
144 m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::None);
146 else if (source ==
"User") {
147 m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::User);
149 else if (source ==
"AverageOfMeasures") {
151 ControlNetFileProtoV0001_PBControlPoint::AverageOfMeasures);
153 else if (source ==
"Reference") {
155 ControlNetFileProtoV0001_PBControlPoint::Reference);
157 else if (source ==
"Basemap") {
158 m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::Basemap);
160 else if (source ==
"BundleSolution") {
162 ControlNetFileProtoV0001_PBControlPoint::BundleSolution);
165 QString msg =
"Invalid AprioriXYZSource [" + source +
"]";
170 if (pointObject.
hasKeyword(
"AprioriLatLonSource")) {
171 QString source = pointObject[
"AprioriLatLonSource"][0];
173 if (source ==
"None") {
174 m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::None);
176 else if (source ==
"User") {
177 m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::User);
179 else if (source ==
"AverageOfMeasures") {
181 ControlNetFileProtoV0001_PBControlPoint::AverageOfMeasures);
183 else if (source ==
"Reference") {
185 ControlNetFileProtoV0001_PBControlPoint::Reference);
187 else if (source ==
"Basemap") {
188 m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::Basemap);
190 else if (source ==
"BundleSolution") {
192 ControlNetFileProtoV0001_PBControlPoint::BundleSolution);
195 QString msg =
"Invalid AprioriLatLonSource [" + source +
"]";
200 if (pointObject.
hasKeyword(
"AprioriRadiusSource")) {
201 QString source = pointObject[
"AprioriRadiusSource"][0];
203 if (source ==
"None") {
204 m_pointData->set_aprioriradiussource(ControlNetFileProtoV0001_PBControlPoint::None);
206 else if (source ==
"User") {
207 m_pointData->set_aprioriradiussource(ControlNetFileProtoV0001_PBControlPoint::User);
209 else if (source ==
"AverageOfMeasures") {
211 ControlNetFileProtoV0001_PBControlPoint::AverageOfMeasures);
213 else if (source ==
"Ellipsoid") {
214 m_pointData->set_aprioriradiussource(ControlNetFileProtoV0001_PBControlPoint::Ellipsoid);
216 else if (source ==
"DEM") {
217 m_pointData->set_aprioriradiussource(ControlNetFileProtoV0001_PBControlPoint::DEM);
219 else if (source ==
"BundleSolution") {
221 ControlNetFileProtoV0001_PBControlPoint::BundleSolution);
224 QString msg =
"Invalid AprioriRadiusSource, [" + source +
"]";
234 if ( pointObject.
hasKeyword(
"AprioriCovarianceMatrix") ) {
235 PvlKeyword &matrix = pointObject[
"AprioriCovarianceMatrix"];
248 else if ( pointObject.
hasKeyword(
"AprioriSigmaLatitude")
249 || pointObject.
hasKeyword(
"AprioriSigmaLongitude")
250 || pointObject.
hasKeyword(
"AprioriSigmaRadius") ) {
252 double sigmaLat = 10000.0;
253 double sigmaLon = 10000.0;
254 double sigmaRad = 10000.0;
256 if ( pointObject.
hasKeyword(
"AprioriSigmaLatitude") ) {
257 if (
toDouble(pointObject[
"AprioriSigmaLatitude"][0]) > 0
258 &&
toDouble(pointObject[
"AprioriSigmaLatitude"][0]) < sigmaLat) {
259 sigmaLat =
toDouble(pointObject[
"AprioriSigmaLatitude"][0]);
264 if ( pointObject.
hasKeyword(
"AprioriSigmaLongitude") ) {
265 if (
toDouble(pointObject[
"AprioriSigmaLongitude"][0]) > 0
266 &&
toDouble(pointObject[
"AprioriSigmaLongitude"][0]) < sigmaLon) {
267 sigmaLon =
toDouble(pointObject[
"AprioriSigmaLongitude"][0]);
272 if ( pointObject.
hasKeyword(
"AprioriSigmaRadius") ) {
273 if (
toDouble(pointObject[
"AprioriSigmaRadius"][0]) > 0
274 &&
toDouble(pointObject[
"AprioriSigmaRadius"][0]) < sigmaRad) {
275 sigmaRad =
toDouble(pointObject[
"AprioriSigmaRadius"][0]);
287 m_pointData->add_aprioricovar( aprioriPoint.GetRectangularMatrix()(0, 0) );
288 m_pointData->add_aprioricovar( aprioriPoint.GetRectangularMatrix()(0, 1) );
289 m_pointData->add_aprioricovar( aprioriPoint.GetRectangularMatrix()(0, 2) );
290 m_pointData->add_aprioricovar( aprioriPoint.GetRectangularMatrix()(1, 1) );
291 m_pointData->add_aprioricovar( aprioriPoint.GetRectangularMatrix()(1, 2) );
292 m_pointData->add_aprioricovar( aprioriPoint.GetRectangularMatrix()(2, 2) );
296 if ( pointObject.
hasKeyword(
"ApostCovarianceMatrix") ) {
297 PvlKeyword &matrix = pointObject[
"ApostCovarianceMatrix"];
310 else if ( pointObject.
hasKeyword(
"AdjustedSigmaLatitude")
311 || pointObject.
hasKeyword(
"AdjustedSigmaLongitude")
312 || pointObject.
hasKeyword(
"AdjustedSigmaRadius") ) {
314 double sigmaLat = 10000.0;
315 double sigmaLon = 10000.0;
316 double sigmaRad = 10000.0;
318 if ( pointObject.
hasKeyword(
"AdjustedSigmaLatitude") ) {
319 if (
toDouble(pointObject[
"AdjustedSigmaLatitude"][0]) > 0
320 &&
toDouble(pointObject[
"AdjustedSigmaLatitude"][0]) < sigmaLat) {
321 sigmaLat =
toDouble(pointObject[
"AdjustedSigmaLatitude"][0]);
325 if ( pointObject.
hasKeyword(
"AdjustedSigmaLongitude") ) {
326 if (
toDouble(pointObject[
"AdjustedSigmaLongitude"][0]) > 0
327 &&
toDouble(pointObject[
"AdjustedSigmaLongitude"][0]) < sigmaLon) {
328 sigmaLon =
toDouble(pointObject[
"AdjustedSigmaLongitude"][0]);
332 if ( pointObject.
hasKeyword(
"AdjustedSigmaRadius") ) {
333 if (
toDouble(pointObject[
"AdjustedSigmaRadius"][0]) > 0
334 &&
toDouble(pointObject[
"AdjustedSigmaRadius"][0]) < sigmaRad) {
335 sigmaRad =
toDouble(pointObject[
"AdjustedSigmaRadius"][0]);
346 m_pointData->add_adjustedcovar( adjustedPoint.GetRectangularMatrix()(0, 0) );
347 m_pointData->add_adjustedcovar( adjustedPoint.GetRectangularMatrix()(0, 1) );
348 m_pointData->add_adjustedcovar( adjustedPoint.GetRectangularMatrix()(0, 2) );
349 m_pointData->add_adjustedcovar( adjustedPoint.GetRectangularMatrix()(1, 1) );
350 m_pointData->add_adjustedcovar( adjustedPoint.GetRectangularMatrix()(1, 2) );
351 m_pointData->add_adjustedcovar( adjustedPoint.GetRectangularMatrix()(2, 2) );
355 for (
int groupIndex = 0; groupIndex < pointObject.
groups(); groupIndex ++) {
357 ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure measure;
360 copy(group,
"SerialNumber",
361 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_serialnumber);
362 copy(group,
"ChooserName",
363 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_choosername);
364 copy(group,
"DateTime",
365 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_datetime);
366 copy(group,
"Diameter",
367 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_diameter);
368 copy(group,
"EditLock",
369 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_editlock);
370 copy(group,
"Ignore",
371 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_ignore);
372 copy(group,
"JigsawRejected",
373 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_jigsawrejected);
374 copy(group,
"AprioriSample",
375 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_apriorisample);
376 copy(group,
"AprioriLine",
377 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_aprioriline);
378 copy(group,
"SampleSigma",
379 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_samplesigma);
380 copy(group,
"LineSigma",
381 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_linesigma);
390 value =
toDouble(group[
"Sample"][0]);
394 measure.set_ignore(
true);
396 measure.mutable_measurement()->set_sample(value);
408 measure.set_ignore(
true);
410 measure.mutable_measurement()->set_line(value);
417 double value =
toDouble(group[
"ErrorSample"][0]);
418 measure.mutable_measurement()->set_sampleresidual(value);
422 double value =
toDouble(group[
"ErrorLine"][0]);
423 measure.mutable_measurement()->set_lineresidual(value);
428 double value =
toDouble(group[
"SampleResidual"][0]);
429 measure.mutable_measurement()->set_sampleresidual(value);
434 double value =
toDouble(group[
"LineResidual"][0]);
435 measure.mutable_measurement()->set_lineresidual(value);
440 if (group[
"Reference"][0].toLower() ==
"true") {
448 QString type = group[
"MeasureType"][0].toLower();
449 if (type ==
"estimated" 450 || type ==
"unmeasured" 451 || type ==
"candidate") {
452 measure.set_type(ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::Candidate);
454 else if (type ==
"manual") {
455 measure.set_type(ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::Manual);
457 else if (type ==
"automatic" 458 || type ==
"validatedmanual" 459 || type ==
"automaticpixel") {
460 measure.set_type(ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::RegisteredPixel);
462 else if (type ==
"validatedautomatic" 463 || type ==
"automaticsubpixel") {
464 measure.set_type(ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::RegisteredSubPixel);
468 "Unknown measure type [" + type +
"]",
475 for (
int cmKeyIndex = 0; cmKeyIndex < group.
keywords(); cmKeyIndex++) {
476 if (group[cmKeyIndex][0] ==
"" 477 || group[cmKeyIndex].name() ==
"ZScore" 478 || group[cmKeyIndex].
name() ==
"ErrorMagnitude") {
485 ControlNetLogDataProtoV0001_Point_Measure measureLogData;
487 for (
int keyIndex = 0; keyIndex < group.
keywords(); keyIndex++) {
489 QString name = dataKeyword.
name();
493 if (name ==
"Obsolete_Eccentricity") {
496 else if (name ==
"GoodnessOfFit") {
499 else if (name ==
"MinimumPixelZScore") {
502 else if (name ==
"MaximumPixelZScore") {
505 else if (name ==
"PixelShift") {
508 else if (name ==
"WholePixelCorrelation") {
511 else if (name ==
"SubPixelCorrelation") {
514 else if (name ==
"Obsolete_AverageResidual") {
518 QString msg =
"Invalid control measure log data name [" + name +
"]";
526 QString msg =
"Invalid control measure log data value [" + dataKeyword[0] +
"]";
530 ControlNetLogDataProtoV0001_Point_Measure_DataEntry logEntry;
531 logEntry.set_datatype(dataType);
532 logEntry.set_datavalue(value);
533 *measureLogData.add_loggedmeasuredata() = logEntry;
538 *
m_logData->add_measures() = measureLogData;
542 QString msg =
"There is missing required information in the control " 543 "points or measures";
589 void (ControlNetFileProtoV0001_PBControlPoint::*setter)(
bool)) {
595 QString value = container[keyName][0];
597 value = value.toLower();
599 if (value ==
"true" || value ==
"yes") {
600 (point.data()->*setter)(
true);
622 void (ControlNetFileProtoV0001_PBControlPoint::*setter)(
double)) {
628 double value =
toDouble(container[keyName][0]);
630 (point.data()->*setter)(value);
651 void (ControlNetFileProtoV0001_PBControlPoint::*setter)(
const std::string&)) {
657 QString value = container[keyName][0];
659 (point.data()->*setter)(value.toLatin1().data());
679 ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure &measure,
680 void (ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::*setter)(
bool)) {
686 QString value = container[keyName][0];
688 value = value.toLower();
690 if (value ==
"true" || value ==
"yes") {
691 (measure.*setter)(
true);
712 ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure &measure,
713 void (ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::*setter)(
double)) {
721 value =
toDouble(container[keyName][0]);
726 (measure.*setter)(value);
746 ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure &measure,
747 void (ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::*setter)
748 (
const std::string &)) {
755 QString value = container[keyName][0];
757 (measure.*setter)(value.toLatin1().data());
This class defines a body-fixed surface point.
int keywords() const
Returns the number of keywords contained in the PvlContainer.
QSharedPointer< ControlNetLogDataProtoV0001_Point > m_logData
Protobuf container that holds log data for the control measures in the point.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
const double Null
Value for an Isis Null pixel.
QSharedPointer< ControlNetLogDataProtoV0001_Point > logData()
Access the protobuf log data for the control measures in the point.
Contains more than one keyword-value pair.
QSharedPointer< ControlNetFileProtoV0001_PBControlPoint > pointData()
Access the protobuf control point data.
double meters() const
Get the displacement in meters.
Namespace for the standard library.
This class is designed to encapsulate the concept of a Latitude.
ControlPointV0001()
Default constructor.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
double toDouble(const QString &string)
Global function to convert from a string to a double.
This error is for when a programmer made an API call that was illegal.
A type of error that occurred when performing an actual I/O operation.
The distance is being specified in meters.
Distance measurement, usually in meters.
bool hasKeyword(const QString &kname, FindOptions opts) const
See if a keyword is in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within ...
QString name() const
Returns the container name.
This class is designed to encapsulate the concept of a Longitude.
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
A type of error that could only have occurred due to a mistake on the user's part (e...
A single keyword-value pair.
QSharedPointer< ControlNetFileProtoV0001_PBControlPoint > m_pointData
Protobuf container that holds information used to create a control point.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
PvlGroup & group(const int index)
Return the group at the specified index.
Displacement is a signed length, usually in meters.
QString name() const
Returns the keyword name.
Namespace for ISIS/Bullet specific routines.
void SetSphericalSigmasDistance(const Distance &latSigma, const Distance &lonSigma, const Distance &radiusSigma)
Set the spherical sigmas (in Distance units) into the spherical variance/covariance matrix...
The distance is being specified in meters.
int groups() const
Returns the number of groups contained.
Contains Pvl Groups and Pvl Objects.
void copy(PvlContainer &container, QString keyName, QSharedPointer< ControlNetFileProtoV0001_PBControlPoint > point, void(ControlNetFileProtoV0001_PBControlPoint::*setter)(bool))
This convenience method takes a boolean value from a PvlKeyword and copies it into a version 1 protob...
void SetRectangular(const Displacement &x, const Displacement &y, const Displacement &z, const Distance &xSigma=Distance(), const Distance &ySigma=Distance(), const Distance &zSigma=Distance())
Set surface point in rectangular body-fixed coordinates wtih optional sigmas.
void deleteKeyword(const QString &name)
Remove a specified keyword.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.