41 : m_pointData(new ControlPointFileEntryV0002) {
44 copy(pointObject,
"PointId",
46 copy(pointObject,
"ChooserName",
47 m_pointData, &ControlPointFileEntryV0002::set_choosername);
48 copy(pointObject,
"DateTime",
49 m_pointData, &ControlPointFileEntryV0002::set_datetime);
50 copy(pointObject,
"AprioriXYZSourceFile",
51 m_pointData, &ControlPointFileEntryV0002::set_apriorisurfpointsourcefile);
52 copy(pointObject,
"AprioriRadiusSourceFile",
53 m_pointData, &ControlPointFileEntryV0002::set_aprioriradiussourcefile);
54 copy(pointObject,
"JigsawRejected",
55 m_pointData, &ControlPointFileEntryV0002::set_jigsawrejected);
56 copy(pointObject,
"EditLock",
57 m_pointData, &ControlPointFileEntryV0002::set_editlock);
58 copy(pointObject,
"Ignore",
59 m_pointData, &ControlPointFileEntryV0002::set_ignore);
60 copy(pointObject,
"AprioriX",
61 m_pointData, &ControlPointFileEntryV0002::set_apriorix);
62 copy(pointObject,
"AprioriY",
63 m_pointData, &ControlPointFileEntryV0002::set_aprioriy);
64 copy(pointObject,
"AprioriZ",
65 m_pointData, &ControlPointFileEntryV0002::set_aprioriz);
66 copy(pointObject,
"AdjustedX",
67 m_pointData, &ControlPointFileEntryV0002::set_adjustedx);
68 copy(pointObject,
"AdjustedY",
69 m_pointData, &ControlPointFileEntryV0002::set_adjustedy);
70 copy(pointObject,
"AdjustedZ",
71 m_pointData, &ControlPointFileEntryV0002::set_adjustedz);
72 copy(pointObject,
"LatitudeConstrained",
73 m_pointData, &ControlPointFileEntryV0002::set_latitudeconstrained);
74 copy(pointObject,
"LongitudeConstrained",
75 m_pointData, &ControlPointFileEntryV0002::set_longitudeconstrained);
76 copy(pointObject,
"RadiusConstrained",
77 m_pointData, &ControlPointFileEntryV0002::set_radiusconstrained);
86 if (pointObject[
"PointType"][0] ==
"Fixed"
87 || pointObject[
"PointType"][0] ==
"Ground") {
88 m_pointData->set_type(ControlPointFileEntryV0002::Fixed);
90 else if (pointObject[
"PointType"][0] ==
"Constrained") {
91 m_pointData->set_type(ControlPointFileEntryV0002::Constrained);
93 else if (pointObject[
"PointType"][0] ==
"Free"
94 || pointObject[
"PointType"][0] ==
"Tie") {
95 m_pointData->set_type(ControlPointFileEntryV0002::Free);
98 QString msg =
"Invalid ControlPoint type [" + pointObject[
"PointType"][0] +
"].";
102 if (pointObject.hasKeyword(
"AprioriXYZSource")) {
103 QString source = pointObject[
"AprioriXYZSource"][0];
105 if (source ==
"None") {
106 m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::None);
108 else if (source ==
"User") {
109 m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::User);
111 else if (source ==
"AverageOfMeasures") {
112 m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::AverageOfMeasures);
114 else if (source ==
"Reference") {
115 m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::Reference);
117 else if (source ==
"Basemap") {
118 m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::Basemap);
120 else if (source ==
"BundleSolution") {
121 m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::BundleSolution);
124 QString msg =
"Invalid AprioriXYZSource [" + source +
"]";
129 if (pointObject.hasKeyword(
"AprioriRadiusSource")) {
130 QString source = pointObject[
"AprioriRadiusSource"][0];
132 if (source ==
"None") {
133 m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::None);
135 else if (source ==
"User") {
136 m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::User);
138 else if (source ==
"AverageOfMeasures") {
139 m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::AverageOfMeasures);
141 else if (source ==
"Ellipsoid") {
142 m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::Ellipsoid);
144 else if (source ==
"DEM") {
145 m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::DEM);
147 else if (source ==
"BundleSolution") {
148 m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::BundleSolution);
151 QString msg =
"Invalid AprioriRadiusSource, [" + source +
"]";
157 if (pointObject.hasKeyword(
"AprioriCovarianceMatrix")) {
158 PvlKeyword &matrix = pointObject[
"AprioriCovarianceMatrix"];
168 if (pointObject.hasKeyword(
"AdjustedCovarianceMatrix")) {
169 PvlKeyword &matrix = pointObject[
"AdjustedCovarianceMatrix"];
180 for (
int groupIndex = 0; groupIndex < pointObject.groups(); groupIndex ++) {
181 PvlGroup &group = pointObject.group(groupIndex);
182 ControlPointFileEntryV0002_Measure measure;
185 copy(group,
"SerialNumber",
186 measure, &ControlPointFileEntryV0002_Measure::set_serialnumber);
187 copy(group,
"ChooserName",
188 measure, &ControlPointFileEntryV0002_Measure::set_choosername);
189 copy(group,
"Sample",
190 measure, &ControlPointFileEntryV0002_Measure::set_sample);
192 measure, &ControlPointFileEntryV0002_Measure::set_line);
193 copy(group,
"SampleResidual",
194 measure, &ControlPointFileEntryV0002_Measure::set_sampleresidual);
195 copy(group,
"LineResidual",
196 measure, &ControlPointFileEntryV0002_Measure::set_lineresidual);
197 copy(group,
"DateTime",
198 measure, &ControlPointFileEntryV0002_Measure::set_datetime);
199 copy(group,
"Diameter",
200 measure, &ControlPointFileEntryV0002_Measure::set_diameter);
201 copy(group,
"EditLock",
202 measure, &ControlPointFileEntryV0002_Measure::set_editlock);
203 copy(group,
"Ignore",
204 measure, &ControlPointFileEntryV0002_Measure::set_ignore);
205 copy(group,
"JigsawRejected",
206 measure, &ControlPointFileEntryV0002_Measure::set_jigsawrejected);
207 copy(group,
"AprioriSample",
208 measure, &ControlPointFileEntryV0002_Measure::set_apriorisample);
209 copy(group,
"AprioriLine",
210 measure, &ControlPointFileEntryV0002_Measure::set_aprioriline);
211 copy(group,
"SampleSigma",
212 measure, &ControlPointFileEntryV0002_Measure::set_samplesigma);
213 copy(group,
"LineSigma",
214 measure, &ControlPointFileEntryV0002_Measure::set_linesigma);
217 if (group[
"Reference"][0].toLower() ==
"true") {
223 QString type = group[
"MeasureType"][0].toLower();
224 if (type ==
"candidate") {
225 measure.set_type(ControlPointFileEntryV0002_Measure::Candidate);
227 else if (type ==
"manual") {
228 measure.set_type(ControlPointFileEntryV0002_Measure::Manual);
230 else if (type ==
"registeredpixel") {
231 measure.set_type(ControlPointFileEntryV0002_Measure::RegisteredPixel);
233 else if (type ==
"registeredsubpixel") {
234 measure.set_type(ControlPointFileEntryV0002_Measure::RegisteredSubPixel);
238 "Unknown measure type [" + type +
"]",
243 for (
int key = 0; key < group.
keywords(); key++) {
245 if (!interpreter.IsValid()) {
246 QString msg =
"Unhandled or duplicate keywords in control measure ["
247 + group[key].
name() +
"]";
251 ControlPointFileEntryV0002_Measure_MeasureLogData protoBufDataEntry;
253 protoBufDataEntry.set_doubledatatype(interpreter.GetDataType());
254 protoBufDataEntry.set_doubledatavalue(interpreter.GetNumericalValue());
256 *measure.add_log() = protoBufDataEntry;
264 QString msg =
"There is missing required information in the control "
265 "points or measures";
277 : m_pointData(new ControlPointFileEntryV0002) {
278 QSharedPointer<ControlNetFileProtoV0001_PBControlPoint> oldPointData = oldPoint.pointData();
280 QString msg =
"Version 2 control point is missing point data.";
283 QSharedPointer<ControlNetLogDataProtoV0001_Point> oldLogData = oldPoint.logData();
285 QString msg =
"Version 2 control point is missing measure log data.";
290 if ( oldPointData->has_id() ) {
293 if ( oldPointData->has_choosername() ) {
294 m_pointData->set_choosername( oldPointData->choosername() );
296 if ( oldPointData->has_datetime() ) {
297 m_pointData->set_datetime( oldPointData->datetime() );
299 if ( oldPointData->has_apriorisurfpointsourcefile() ) {
300 m_pointData->set_apriorisurfpointsourcefile( oldPointData->apriorisurfpointsourcefile() );
302 if ( oldPointData->has_aprioriradiussourcefile() ) {
303 m_pointData->set_aprioriradiussourcefile( oldPointData->aprioriradiussourcefile() );
305 if ( oldPointData->has_jigsawrejected() ) {
306 m_pointData->set_jigsawrejected( oldPointData->jigsawrejected() );
308 if ( oldPointData->has_editlock() ) {
309 m_pointData->set_editlock( oldPointData->editlock() );
311 if ( oldPointData->has_ignore() ) {
314 if ( oldPointData->has_apriorix() ) {
315 m_pointData->set_apriorix( oldPointData->apriorix() );
317 if ( oldPointData->has_aprioriy() ) {
318 m_pointData->set_aprioriy( oldPointData->aprioriy() );
320 if ( oldPointData->has_aprioriz() ) {
321 m_pointData->set_aprioriz( oldPointData->aprioriz() );
323 if ( oldPointData->has_adjustedx() ) {
324 m_pointData->set_adjustedx( oldPointData->adjustedx() );
326 if ( oldPointData->has_adjustedy() ) {
327 m_pointData->set_adjustedy( oldPointData->adjustedy() );
329 if ( oldPointData->has_adjustedz() ) {
330 m_pointData->set_adjustedz( oldPointData->adjustedz() );
332 if ( oldPointData->has_latitudeconstrained() ) {
333 m_pointData->set_latitudeconstrained( oldPointData->latitudeconstrained() );
335 if ( oldPointData->has_longitudeconstrained() ) {
336 m_pointData->set_longitudeconstrained( oldPointData->longitudeconstrained() );
338 if ( oldPointData->has_radiusconstrained() ) {
339 m_pointData->set_radiusconstrained( oldPointData->radiusconstrained() );
341 if ( oldPointData->has_referenceindex() ) {
342 m_pointData->set_referenceindex( oldPointData->referenceindex() );
350 if ( oldPointData->has_type() ) {
351 ControlNetFileProtoV0001_PBControlPoint_PointType pointType = oldPointData->type();
352 if (pointType == ControlNetFileProtoV0001_PBControlPoint::Ground) {
353 m_pointData->set_type(ControlPointFileEntryV0002::Fixed);
355 else if (pointType == ControlNetFileProtoV0001_PBControlPoint::Tie) {
356 m_pointData->set_type(ControlPointFileEntryV0002::Free);
359 QString msg =
"Invalid ControlPoint type.";
364 if ( oldPointData->has_apriorisurfpointsource() ) {
365 ControlNetFileProtoV0001_PBControlPoint_AprioriSource surfacePointSource;
366 surfacePointSource = oldPointData->apriorisurfpointsource();
367 if (surfacePointSource == ControlNetFileProtoV0001_PBControlPoint::None) {
368 m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::None);
370 else if (surfacePointSource == ControlNetFileProtoV0001_PBControlPoint::User) {
371 m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::User);
373 else if (surfacePointSource == ControlNetFileProtoV0001_PBControlPoint::AverageOfMeasures) {
374 m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::AverageOfMeasures);
376 else if (surfacePointSource == ControlNetFileProtoV0001_PBControlPoint::Reference) {
377 m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::Reference);
379 else if (surfacePointSource == ControlNetFileProtoV0001_PBControlPoint::Basemap) {
380 m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::Basemap);
382 else if (surfacePointSource == ControlNetFileProtoV0001_PBControlPoint::BundleSolution) {
383 m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::BundleSolution);
386 QString msg =
"Invalid ControlPoint apriori surface point source.";
391 if ( oldPointData->has_aprioriradiussource() ) {
392 ControlNetFileProtoV0001_PBControlPoint_AprioriSource radiusSource;
393 radiusSource = oldPointData->aprioriradiussource();
394 if (radiusSource == ControlNetFileProtoV0001_PBControlPoint::None) {
395 m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::None);
397 else if (radiusSource == ControlNetFileProtoV0001_PBControlPoint::User) {
398 m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::User);
400 else if (radiusSource == ControlNetFileProtoV0001_PBControlPoint::AverageOfMeasures) {
401 m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::AverageOfMeasures);
403 else if (radiusSource == ControlNetFileProtoV0001_PBControlPoint::Ellipsoid) {
404 m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::Ellipsoid);
406 else if (radiusSource == ControlNetFileProtoV0001_PBControlPoint::DEM) {
407 m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::DEM);
409 else if (radiusSource == ControlNetFileProtoV0001_PBControlPoint::BundleSolution) {
410 m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::BundleSolution);
413 QString msg =
"Invalid AprioriRadiusSource.";
421 if (oldPointData->aprioricovar_size() > 0) {
422 m_pointData->set_type(ControlPointFileEntryV0002::Constrained);
423 m_pointData->add_aprioricovar( oldPointData->aprioricovar(0) );
424 m_pointData->add_aprioricovar( oldPointData->aprioricovar(1) );
425 m_pointData->add_aprioricovar( oldPointData->aprioricovar(2) );
426 m_pointData->add_aprioricovar( oldPointData->aprioricovar(3) );
427 m_pointData->add_aprioricovar( oldPointData->aprioricovar(4) );
428 m_pointData->add_aprioricovar( oldPointData->aprioricovar(5) );
431 if (oldPointData->adjustedcovar_size() > 0) {
432 m_pointData->add_adjustedcovar( oldPointData->adjustedcovar(0) );
433 m_pointData->add_adjustedcovar( oldPointData->adjustedcovar(1) );
434 m_pointData->add_adjustedcovar( oldPointData->adjustedcovar(2) );
435 m_pointData->add_adjustedcovar( oldPointData->adjustedcovar(3) );
436 m_pointData->add_adjustedcovar( oldPointData->adjustedcovar(4) );
437 m_pointData->add_adjustedcovar( oldPointData->adjustedcovar(5) );
441 for (
int i = 0; i < oldPointData->measures_size(); i++) {
442 ControlPointFileEntryV0002_Measure *newMeasure =
m_pointData->add_measures();
443 ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure oldMeasure;
444 oldMeasure = oldPointData->measures(i);
447 if ( oldMeasure.has_serialnumber() ) {
448 newMeasure->set_serialnumber( oldMeasure.serialnumber() );
450 if ( oldMeasure.has_choosername() ) {
451 newMeasure->set_choosername( oldMeasure.choosername() );
453 if ( oldMeasure.has_datetime() ) {
454 newMeasure->set_datetime( oldMeasure.datetime() );
456 if ( oldMeasure.has_diameter() ) {
457 newMeasure->set_diameter( oldMeasure.diameter() );
459 if ( oldMeasure.has_editlock() ) {
460 newMeasure->set_editlock( oldMeasure.editlock() );
462 if ( oldMeasure.has_ignore() ) {
463 newMeasure->set_ignore( oldMeasure.ignore() );
465 if ( oldMeasure.has_jigsawrejected() ) {
466 newMeasure->set_jigsawrejected( oldMeasure.jigsawrejected() );
468 if ( oldMeasure.has_apriorisample() ) {
469 newMeasure->set_apriorisample( oldMeasure.apriorisample() );
471 if ( oldMeasure.has_aprioriline() ) {
472 newMeasure->set_aprioriline( oldMeasure.aprioriline() );
474 if ( oldMeasure.has_samplesigma() ) {
475 newMeasure->set_samplesigma( oldMeasure.samplesigma() );
477 if ( oldMeasure.has_linesigma() ) {
478 newMeasure->set_linesigma( oldMeasure.linesigma() );
482 if ( oldMeasure.has_measurement() ) {
483 ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure_PBMeasure oldMeasurement;
484 oldMeasurement = oldMeasure.measurement();
485 if ( oldMeasurement.has_sample() ) {
486 newMeasure->set_sample( oldMeasurement.sample() );
488 if ( oldMeasurement.has_line() ) {
489 newMeasure->set_line( oldMeasurement.line() );
491 if ( oldMeasurement.has_sampleresidual() ) {
492 newMeasure->set_sampleresidual( oldMeasurement.sampleresidual() );
494 if ( oldMeasurement.has_lineresidual() ) {
495 newMeasure->set_lineresidual( oldMeasurement.lineresidual() );
500 if ( oldMeasure.has_type() ) {
501 ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure_MeasureType oldType;
502 oldType = oldMeasure.type();
503 if (oldType == ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure_MeasureType_Candidate) {
504 newMeasure->set_type(ControlPointFileEntryV0002_Measure_MeasureType_Candidate);
506 else if (oldType == ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure_MeasureType_Manual) {
507 newMeasure->set_type(ControlPointFileEntryV0002_Measure_MeasureType_Manual);
509 else if (oldType == ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure_MeasureType_RegisteredPixel) {
510 newMeasure->set_type(ControlPointFileEntryV0002_Measure_MeasureType_RegisteredPixel);
512 else if (oldType == ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure_MeasureType_RegisteredSubPixel) {
513 newMeasure->set_type(ControlPointFileEntryV0002_Measure_MeasureType_RegisteredSubPixel);
516 QString msg =
"Invalid measure type";
521 ControlNetLogDataProtoV0001_Point_Measure measureLogData = oldLogData->measures(i);
522 for (
int j = 0; j < measureLogData.loggedmeasuredata_size(); j++) {
524 ControlNetLogDataProtoV0001_Point_Measure_DataEntry oldData =
525 measureLogData.loggedmeasuredata(j);
527 ControlPointFileEntryV0002_Measure_MeasureLogData newData;
529 newData.set_doubledatatype( oldData.datatype() );
530 newData.set_doubledatavalue( oldData.datavalue() );
532 *newMeasure->add_log() = newData;
536 if ( !newMeasure->IsInitialized() ) {
537 QString msg =
"Measure file entry at index [" +
toString(i)
538 +
"] is missing required fields.";
546 QString msg =
"Control point file entry is missing required fields.";