Isis 3 Programmer Reference
ControlPoint.h
1#ifndef ControlPoint_h
2#define ControlPoint_h
3
10/* SPDX-License-Identifier: CC0-1.0 */
11
12#include <bitset>
13
14#include <QObject>
15#include <QString>
16
17#include "ControlMeasure.h"
18#include "SurfacePoint.h"
19
20template< typename A, typename B > class QHash;
21
22class QStringList;
23
24namespace Isis {
25 class ControlNet;
26 class ControlPointFileEntryV0002;
27 class Latitude;
28 class Longitude;
29 class PBControlNet_PBControlPoint;
30 class PBControlNetLogData_Point;
31 class PvlObject;
32 class Statistics;
33
356 class ControlPoint : public QObject {
357
358 Q_OBJECT
359
360 friend class ControlNet;
361 public:
373 Fixed = 0,
386 Free = 2
387 };
388 static const int PointTypeCount = 3;
389
412
418 Coord1Constrained = 0,
419 Coord2Constrained = 1,
420 Coord3Constrained = 2
421 };
422
433 enum ModType {
434 EditLockModified,
435 IgnoredModified,
436 TypeModified
437 };
438
439 // This stuff input to jigsaw
440 // How did apriori source get computed??
442 enum Source {
443 None,
444 User,
445 AverageOfMeasures,
446 Reference,
447 Basemap,
448 BundleSolution
449 };
450 };
451
453 enum Source {
454 None,
455 User,
456 AverageOfMeasures,
457 Ellipsoid,
458 DEM,
459 BundleSolution
460 };
461 };
462
463 ControlPoint();
464 ControlPoint(const ControlPoint &);
465 ControlPoint(const QString &id);
466 virtual ~ControlPoint();
467
468 ControlNet *Parent() { return parentNetwork; }
469
470 void Load(PvlObject &p);
471
472 void Add(ControlMeasure *measure);
473 int Delete(ControlMeasure *measure);
474 int Delete(QString serialNumber);
475 int Delete(int index);
477
478 const ControlMeasure *GetMeasure(QString serialNumber) const;
479 ControlMeasure *GetMeasure(QString serialNumber);
480
481 const ControlMeasure *GetMeasure(int index) const;
482 ControlMeasure *GetMeasure(int index);
483
484 bool HasRefMeasure() const;
485 const ControlMeasure *GetRefMeasure() const;
487
488 Status SetChooserName(QString name);
489 Status SetDateTime(QString newDateTime);
491 Status SetId(QString id);
493 Status SetRefMeasure(int index);
494 Status SetRefMeasure(QString sn);
495 Status SetRejected(bool rejected);
496 Status SetIgnored(bool newIgnoreStatus);
498 Status SetType(PointType newType);
499
500 Status SetAprioriRadiusSource(RadiusSource::Source source);
501 Status SetAprioriRadiusSourceFile(QString sourceFile);
503 Status SetAprioriSurfacePointSource(SurfacePointSource::Source source);
504 Status SetAprioriSurfacePointSourceFile(QString sourceFile);
505
506// Status UpdateSphericalPointCoordinates(const Latitude &lat, const Longitude &lon,
507// const Distance &radius);
508
512
513 SurfacePoint GetAdjustedSurfacePoint() const;
514
516 QString GetChooserName() const;
517 QString GetDateTime() const;
518 bool IsEditLocked() const;
519 bool IsRejected() const;
520 QString GetId() const;
521 bool IsIgnored() const;
522 bool IsValid() const;
523 // Can we get rid of this? It doesn't appear to be used anywhere. *** ToDo ***
524 bool IsInvalid() const;
525 bool IsFree() const;
526 bool IsFixed() const;
527 bool HasAprioriCoordinates();
528
529 bool IsConstrained();
530 bool IsCoord1Constrained();
531 bool IsCoord2Constrained();
532 bool IsCoord3Constrained();
534
535 static QString PointTypeToString(PointType type);
536 static PointType StringToPointType(QString pointTypeString);
537
538 QString GetPointTypeString() const;
539 PointType GetType() const;
540
541 static QString RadiusSourceToString(RadiusSource::Source source);
542 static RadiusSource::Source StringToRadiusSource(QString str);
543 QString GetRadiusSourceString() const;
544 static QString SurfacePointSourceToString(SurfacePointSource::Source source);
545 static SurfacePointSource::Source StringToSurfacePointSource(QString str);
546 QString GetSurfacePointSourceString() const;
547 SurfacePoint GetAprioriSurfacePoint() const;
548
549 RadiusSource::Source GetAprioriRadiusSource() const;
550 bool HasAprioriRadiusSourceFile() const;
551 QString GetAprioriRadiusSourceFile() const;
552 SurfacePointSource::Source GetAprioriSurfacePointSource() const;
554 QString GetAprioriSurfacePointSourceFile() const;
555
556 int GetNumMeasures() const;
557 int GetNumValidMeasures() const;
558 int GetNumLockedMeasures() const;
559 bool HasSerialNumber(QString serialNumber) const;
560 bool HasChooserName() const;
561 bool HasDateTime() const;
562 int IndexOf(ControlMeasure *, bool throws = true) const;
563 int IndexOf(QString sn, bool throws = true) const;
564 int IndexOfRefMeasure() const;
565 bool IsReferenceExplicit() const;
566 QString GetReferenceSN() const;
567 void emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType modType, QVariant oldValue, QVariant newValue);
568
569
570
571 Statistics GetStatistic(double(ControlMeasure::*statFunc)() const) const;
572 Statistics GetStatistic(long dataType) const;
573
574 QList< ControlMeasure * > getMeasures(bool excludeIgnored = false) const;
576
577 const ControlMeasure *operator[](QString serialNumber) const;
578 ControlMeasure *operator[](QString serialNumber);
579
580 const ControlMeasure *operator[](int index) const;
581 ControlMeasure *operator[](int index);
582
583 bool operator!=(const ControlPoint &pPoint) const;
584 bool operator==(const ControlPoint &pPoint) const;
585 const ControlPoint &operator=(const ControlPoint &pPoint);
586
587 // The next 7 methods are specifically to support BundleAdjust
589 void SetNumberOfRejectedMeasures(int numRejected);
590 int GetNumberOfRejectedMeasures() const;
591 double GetSampleResidualRms() const;
592 double GetLineResidualRms() const;
593 double GetResidualRms() const;
594 void ClearJigsawRejected();
595
596 protected:
597 void PointModified();
599 QHash< QString, ControlMeasure * > * measures;
600
601 private:
603 void ValidateMeasure(QString serialNumber) const;
604 void AddMeasure(ControlMeasure *measure);
605
606
607 ControlNet *parentNetwork;
608
609 QStringList *cubeSerials;
610
611 ControlMeasure *referenceMeasure;
612
618 QString id;
619
628 QString chooserName;
629
634 QString dateTime;
635
641
648
654
660
665 std::bitset<3> constraintStatus;
666
674
679 bool ignore;
680
682 SurfacePointSource::Source aprioriSurfacePointSource;
683
686
691 RadiusSource::Source aprioriRadiusSource;
692
697
707
713
720 };
721}
722
723#endif
a control measurement
ModType
Control Measure Modification Types.
a control network
Definition ControlNet.h:258
A single control point.
const ControlMeasure * GetRefMeasure() const
Get the reference control measure.
static QString RadiusSourceToString(RadiusSource::Source source)
Obtain a string representation of a given RadiusSource.
static SurfacePointSource::Source StringToSurfacePointSource(QString str)
Obtain a SurfacePoint::Source from a string.
Status
This is a return status for many of the mutating (setter) method calls.
@ PointLocked
This is returned when the operation requires Edit Lock to be false but it is currently true.
@ Success
This is returned when the operation successfully took effect.
@ Failure
This is returned when an operation cannot be performed due to a problem such as the point is ignored ...
int NumberOfConstrainedCoordinates()
Return bool indicating if point is Constrained or not.
Status SetEditLock(bool editLock)
Set the EditLock state.
QString dateTime
This is the last modified date and time.
const ControlPoint & operator=(const ControlPoint &pPoint)
bool editLock
This stores the edit lock state.
bool IsFree() const
Return bool indicating if point is Free or not.
static RadiusSource::Source StringToRadiusSource(QString str)
Obtain a RadiusSource::Source from a string.
ConstraintStatus
This is a convenience member for checking number of constrained coordinates in the SurfacePoint.
bool invalid
If we forced a build that we would normally have thrown an exception for then this is set to true.
bool operator==(const ControlPoint &pPoint) const
Compare two Control Points for equality.
void ClearJigsawRejected()
Set jigsaw rejected flag for all measures to false and set the jigsaw rejected flag for the point its...
Status SetAprioriSurfacePoint(SurfacePoint aprioriSP)
This updates the apriori surface point.
QString id
This is the control point ID.
void ValidateMeasure(QString serialNumber) const
Throws an exception if none of the point's measures have the given serial number.
QString aprioriRadiusSourceFile
The name of the file that derives the apriori surface point's radius.
ModType
Control Point Modification Types.
Status SetId(QString id)
Sets the Id of the control point.
QString aprioriSurfacePointSourceFile
FileName where the apriori surface point originated from.
Status SetAprioriRadiusSource(RadiusSource::Source source)
This updates the source of the radius of the apriori surface point.
double GetResidualRms() const
Get rms of residuals.
SurfacePoint aprioriSurfacePoint
The apriori surface point.
bool jigsawRejected
This stores the jigsaw rejected state.
RadiusSource::Source aprioriRadiusSource
Where the apriori surface point's radius originated from, most commonly used by jigsaw.
bool IsReferenceExplicit() const
Status ComputeResiduals_Millimeters()
This method computes the residuals for a point.
virtual ~ControlPoint()
This destroys the current instance and cleans up any and all allocated memory.
bool HasDateTime() const
Returns true if the datetime is not empty.
Status SetChooserName(QString name)
Set the point's chooser name.
bool HasRefMeasure() const
Checks to see if a reference measure is set.
int GetNumValidMeasures() const
QList< QString > getCubeSerialNumbers() const
int GetNumLockedMeasures() const
Returns the number of locked control measures.
int Delete(ControlMeasure *measure)
Remove a measurement from the control point, deleting reference measure is allowed.
Status SetRejected(bool rejected)
Set the jigsawRejected state.
SurfacePoint adjustedSurfacePoint
This is the calculated, or aposterori, surface point.
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.
void SetExplicitReference(ControlMeasure *measure)
Explicitly defines a new reference measure by pointer.
int numberOfRejectedMeasures
This parameter is used and maintained by BundleAdjust for the jigsaw application.
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.
PointType type
What this control point is tying together.
bool ignore
True if we should preserve but ignore the entire control point and its measures.
double GetLineResidualRms() const
Get rms of line residuals.
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.
QString GetPointTypeString() const
Obtain a string representation of the PointType.
double GetSampleResidualRms() const
Get rms of sample residuals.
bool HasChooserName() const
Returns true if the choosername is not empty.
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.
ControlPoint()
Construct a control point.
Statistics GetStatistic(double(ControlMeasure::*statFunc)() const) const
This function will call a given method on every control measure that this point has.
bool IsConstrained()
Return bool indicating if point is Constrained or not.
void PointModified()
List of Control Measures.
QString chooserName
This is the user name of the person who last modified this control point.
static QString PointTypeToString(PointType type)
Obtain a string representation of a given PointType.
void AddMeasure(ControlMeasure *measure)
Do the actual work of adding a measure to this point, without changing any extra data.
static PointType StringToPointType(QString pointTypeString)
Obtain a PointType given a string representation of it.
bool referenceExplicitlySet
This indicates if a program has explicitely set the reference in this point or the implicit reference...
bool operator!=(const ControlPoint &pPoint) const
Compare two Control Points for inequality.
Status ComputeResiduals()
This method computes the BundleAdjust residuals for a point.
QString GetId() const
Return the Id of the control point.
static QString SurfacePointSourceToString(SurfacePointSource::Source source)
Obtain a string representation of a given SurfacePointSource.
std::bitset< 3 > constraintStatus
This stores the constraint status of the a priori SurfacePoint.
QList< ControlMeasure * > getMeasures(bool excludeIgnored=false) const
Status ResetApriori()
Reset all the Apriori info to defaults.
void ZeroNumberOfRejectedMeasures()
Initialize the number of rejected measures to 0.
int GetNumberOfRejectedMeasures() const
Get the number of rejected measures on the control point.
bool HasSerialNumber(QString serialNumber) const
Return true if given serial number exists in point.
int IndexOf(ControlMeasure *, bool throws=true) const
void SetNumberOfRejectedMeasures(int numRejected)
Set (update) the number of rejected measures for the control point.
bool HasAprioriSurfacePointSourceFile() const
Checks to see if the surface point source file has been set.
void Load(PvlObject &p)
Loads the PvlObject into a ControlPoint.
const ControlMeasure * operator[](QString serialNumber) const
Same as GetMeasure (provided for convenience)
SurfacePoint GetBestSurfacePoint() const
Returns the adjusted surface point if it exists, otherwise returns the a priori surface point.
Status SetRefMeasure(ControlMeasure *cm)
Set the point's reference measure.
Status ComputeApriori()
Computes a priori lat/lon/radius point coordinates by determining the average lat/lon/radius of all m...
bool IsFixed() const
Return bool indicating if point is Fixed or not.
Status SetAprioriRadiusSourceFile(QString sourceFile)
This updates the filename of the DEM that the apriori radius came from.
SurfacePointSource::Source aprioriSurfacePointSource
Where the apriori surface point originated from.
QString GetRadiusSourceString() const
Obtain a string representation of the RadiusSource.
void emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType modType, QVariant oldValue, QVariant newValue)
This method is a wrapper to emit the measureModified() signal in the parent network is called wheneve...
QString GetReferenceSN() const
QString GetSurfacePointSourceString() const
Obtain a string representation of the SurfacePointSource.
Contains Pvl Groups and Pvl Objects.
Definition PvlObject.h:61
This class is used to accumulate statistics on double arrays.
Definition Statistics.h:94
This class defines a body-fixed surface point.
This is free and unencumbered software released into the public domain.
Definition ControlNet.h:32
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16