3 #include "AbstractPointItem.h"    10 #include "CnetDisplayProperties.h"    17 #include "TableColumn.h"    18 #include "TableColumnList.h"    22   QString AbstractPointItem::getColumnName(Column col) {
    29         return "Chooser Name";
    39         return "Adjusted SP Lat";
    41         return "Adjusted SP Lon";
    42       case AdjustedSPRadius:
    43         return "Adjusted SP Radius";
    44       case AdjustedSPLatSigma:
    45         return "Adjusted SP Lat Sigma";
    46       case AdjustedSPLonSigma:
    47         return "Adjusted SP Lon Sigma";
    48       case AdjustedSPRadiusSigma:
    49         return "Adjusted SP Radius Sigma";
    51         return "A Priori SP Lat";
    53         return "A Priori SP Lon";
    55         return "A Priori SP Radius";
    56       case APrioriSPLatSigma:
    57         return "A Priori SP Lat Sigma";
    58       case APrioriSPLonSigma:
    59         return "A Priori SP Lon Sigma";
    60       case APrioriSPRadiusSigma:
    61         return "A Priori SP Radius Sigma";
    63         return "A Priori SP Source";
    64       case APrioriSPSourceFile:
    65         return "A Priori SP Source File";
    66       case APrioriRadiusSource:
    67         return "A Priori Radius Source";
    68       case APrioriRadiusSourceFile:
    69         return "A Priori Radius Source File";
    71         return "Jigsaw Rejected";
    79   AbstractPointItem::Column AbstractPointItem::getColumn(QString columnTitle) {
    80     for (
int i = 0; i < COLS; i++) {
    81       if (columnTitle == getColumnName((Column)i))
    85     QString msg = 
"Column title [" + columnTitle + 
"] does not match any of "    86         "the defined column types";
    91   TableColumnList *AbstractPointItem::createColumns() {
    92     TableColumnList *columnList = 
new TableColumnList;
    94     columnList->append(
new TableColumn(getColumnName(Id), 
false, 
false));
    96       new TableColumn(getColumnName(PointType), 
false, 
false));
    98       new TableColumn(getColumnName(ChooserName), 
false, 
false));
   100       new TableColumn(getColumnName(DateTime), 
true, 
false));
   102       new TableColumn(getColumnName(EditLock), 
false, 
false));
   104       new TableColumn(getColumnName(Ignored), 
false, 
true));
   106       new TableColumn(getColumnName(Reference), 
false, 
false));
   108       new TableColumn(getColumnName(AdjustedSPLat), 
true, 
false));
   110       new TableColumn(getColumnName(AdjustedSPLon), 
true, 
false));
   112       new TableColumn(getColumnName(AdjustedSPRadius), 
true, 
false));
   114       new TableColumn(getColumnName(AdjustedSPLatSigma), 
true, 
false));
   116       new TableColumn(getColumnName(AdjustedSPLonSigma), 
true, 
false));
   118       new TableColumn(getColumnName(AdjustedSPRadiusSigma), 
true, 
false));
   120       new TableColumn(getColumnName(APrioriSPLat), 
false, 
false));
   122       new TableColumn(getColumnName(APrioriSPLon), 
false, 
false));
   124       new TableColumn(getColumnName(APrioriSPRadius), 
false, 
false));
   126       new TableColumn(getColumnName(APrioriSPLatSigma), 
false, 
false));
   128       new TableColumn(getColumnName(APrioriSPLonSigma), 
false, 
false));
   130       new TableColumn(getColumnName(APrioriSPRadiusSigma), 
false, 
false));
   132       new TableColumn(getColumnName(APrioriSPSource), 
false, 
false));
   134       new TableColumn(getColumnName(APrioriSPSourceFile), 
false, 
false));
   136       new TableColumn(getColumnName(APrioriRadiusSource), 
false, 
false));
   137     columnList->append(
new TableColumn(
   138         getColumnName(APrioriRadiusSourceFile), 
false, 
false));
   140       new TableColumn(getColumnName(JigsawRejected), 
true, 
false));
   146   AbstractPointItem::AbstractPointItem(ControlPoint *cp,
   147       int avgCharWidth, AbstractTreeItem *parent)
   148     : AbstractTreeItem(parent) {
   151     calcDataWidth(avgCharWidth);
   153     connect(m_point, SIGNAL(destroyed(
QObject *)), 
this, SLOT(sourceDeleted()));
   157   AbstractPointItem::~AbstractPointItem() {
   162   QVariant AbstractPointItem::getData()
 const {
   163     return getData(getColumnName(Id));
   167   QVariant AbstractPointItem::getData(QString columnTitle)
 const {
   169       Column column = getColumn(columnTitle);
   171       switch ((Column) column) {
   173           return QVariant((QString)m_point->
GetId());
   177           return QVariant((QString)m_point->GetChooserName());
   181           return QVariant((QString)m_point->GetDateTime());
   183           if (m_point->IsEditLocked())
   184             return QVariant(
"Yes");
   186             return QVariant(
"No");
   189           if (m_point->IsIgnored())
   190             return QVariant(
"Yes");
   192             return QVariant(
"No");
   194           if (m_point->GetNumMeasures())
   196                 CnetDisplayProperties::getInstance()->getImageName(
   206         case AdjustedSPRadius:
   209         case AdjustedSPLatSigma:
   211               m_point->GetAdjustedSurfacePoint().
   212               GetLatSigmaDistance().meters());
   213         case AdjustedSPLonSigma:
   215               m_point->GetAdjustedSurfacePoint().
   216               GetLonSigmaDistance().meters());
   217         case AdjustedSPRadiusSigma:
   219               m_point->GetAdjustedSurfacePoint().
   220               GetLocalRadiusSigma().meters());
   227         case APrioriSPRadius:
   230         case APrioriSPLatSigma:
   232               m_point->GetAprioriSurfacePoint().
   233               GetLatSigmaDistance().meters());
   234         case APrioriSPLonSigma:
   236               m_point->GetAprioriSurfacePoint().
   237               GetLonSigmaDistance().meters());
   238         case APrioriSPRadiusSigma:
   240               m_point->GetAprioriSurfacePoint().
   241               GetLocalRadiusSigma().meters());
   242         case APrioriSPSource:
   244         case APrioriSPSourceFile:
   245           return QVariant((QString)m_point->GetAprioriSurfacePointSourceFile());
   246         case APrioriRadiusSource:
   248         case APrioriRadiusSourceFile:
   249           return QVariant((QString)m_point->GetAprioriRadiusSourceFile());
   251           if (m_point->IsRejected())
   252             return QVariant(
"Yes");
   254             return QVariant(
"No");
   262   void AbstractPointItem::setData(QString 
const &columnTitle,
   263       QString 
const &newData) {
   265       Column column = getColumn(columnTitle);
   267       switch ((Column) column) {
   269           m_point->
SetId(newData);
   281           if (newData == 
"Yes")
   305         case AdjustedSPRadius:
   311         case AdjustedSPLatSigma: {
   312           QString msg = 
"Cannot set adjusted surface point latitude sigma";
   316         case AdjustedSPLonSigma: {
   317           QString msg = 
"Cannot set adjusted surface point longitude sigma";
   321         case AdjustedSPRadiusSigma: {
   322           QString msg = 
"Cannot set adjusted surface point radius sigma";
   328           SurfacePoint newSurfacePoint(prepareSurfacePoint(newLat,
   329               m_point->GetAprioriSurfacePoint()));
   331           newSurfacePoint.SetSphericalCoordinates(newLat,
   332               newSurfacePoint.GetLongitude(),
   333               newSurfacePoint.GetLocalRadius());
   339           SurfacePoint newSurfacePoint(prepareSurfacePoint(newLon,
   340               m_point->GetAprioriSurfacePoint()));
   342           newSurfacePoint.SetSphericalCoordinates(
   343             newSurfacePoint.GetLatitude(),
   345             newSurfacePoint.GetLocalRadius());
   349         case APrioriSPRadius: {
   351           SurfacePoint newSurfacePoint(prepareSurfacePoint(newRadius,
   352               m_point->GetAprioriSurfacePoint()));
   354           newSurfacePoint.SetSphericalCoordinates(
   355             newSurfacePoint.GetLatitude(),
   356             newSurfacePoint.GetLongitude(),
   361         case APrioriSPLatSigma: {
   363           SurfacePoint newSurfacePoint(prepareSigmas(newSigma,
   364               m_point->GetAprioriSurfacePoint()));
   366           newSurfacePoint.SetSphericalSigmasDistance(
   367             newSigma, newSurfacePoint.GetLonSigmaDistance(),
   368             newSurfacePoint.GetLocalRadiusSigma());
   373         case APrioriSPLonSigma: {
   375           SurfacePoint newSurfacePoint(prepareSigmas(newSigma,
   376               m_point->GetAprioriSurfacePoint()));
   378           newSurfacePoint.SetSphericalSigmasDistance(
   379             newSurfacePoint.GetLatSigmaDistance(), newSigma,
   380             newSurfacePoint.GetLocalRadiusSigma());
   385         case APrioriSPRadiusSigma: {
   387           SurfacePoint newSurfacePoint(prepareSigmas(newSigma,
   388               m_point->GetAprioriSurfacePoint()));
   390           newSurfacePoint.SetSphericalSigmasDistance(
   391             newSurfacePoint.GetLatSigmaDistance(),
   392             newSurfacePoint.GetLonSigmaDistance(),
   398         case APrioriSPSource:
   402         case APrioriSPSourceFile:
   405         case APrioriRadiusSource:
   409         case APrioriRadiusSourceFile:
   423   bool AbstractPointItem::isDataEditable(QString columnTitle)
 const {
   425     if (m_point->IsEditLocked()) {
   426       if (getColumn(columnTitle) == EditLock)
   437   void AbstractPointItem::deleteSource() {
   439       if (m_point->IsEditLocked()) {
   440         QString msg = 
"Point [" + getFormattedData() + 
"] is edit locked and "   445         QString msg = 
"Point [" + getFormattedData() + 
"] has at least one "   446             "edit locked measure and cannot be deleted";
   450       ControlPoint *tempPoint = m_point;
   457   AbstractTreeItem::InternalPointerType AbstractPointItem::getPointerType()
 const {
   458     return AbstractTreeItem::Point;
   462   void *AbstractPointItem::getPointer()
 const {
   467   bool AbstractPointItem::hasPoint(ControlPoint *p)
 const {
   471   void AbstractPointItem::sourceDeleted() {
   476   SurfacePoint AbstractPointItem::prepareSigmas(Distance newSigma,
   477       SurfacePoint surfacePoint) {
   479     Distance latSigDist = surfacePoint.GetLatSigmaDistance();
   480     Distance lonSigDist = surfacePoint.GetLonSigmaDistance();
   481     Distance radiusSigDist = surfacePoint.GetLocalRadiusSigma();
   483     if (newSigma.isValid()) {
   484       if (!latSigDist.isValid())
   486       if (!lonSigDist.isValid())
   488       if (!radiusSigDist.isValid())
   489         radiusSigDist = free;
   492       latSigDist = Distance();
   493       lonSigDist = Distance();
   494       radiusSigDist = Distance();
   497     surfacePoint.SetSphericalSigmasDistance(
   498       latSigDist, lonSigDist, radiusSigDist);
   503   SurfacePoint AbstractPointItem::prepareSurfacePoint(Latitude newLat,
   504       SurfacePoint surfacePoint) {
   505     if (newLat.isValid()) {
   506       surfacePoint = prepareSurfacePoint(surfacePoint);
   509       surfacePoint.SetSphericalCoordinates(Latitude(), Longitude(),
   517   SurfacePoint AbstractPointItem::prepareSurfacePoint(Longitude newLon,
   518       SurfacePoint surfacePoint) {
   519     if (newLon.isValid()) {
   520       surfacePoint = prepareSurfacePoint(surfacePoint);
   523       surfacePoint.SetSphericalCoordinates(Latitude(), Longitude(),
   531   SurfacePoint AbstractPointItem::prepareSurfacePoint(
   532     Distance newRadius, SurfacePoint surfacePoint) {
   533     if (newRadius.isValid()) {
   534       surfacePoint = prepareSurfacePoint(surfacePoint);
   537       surfacePoint.SetSphericalCoordinates(Latitude(), Longitude(),
   545   SurfacePoint AbstractPointItem::prepareSurfacePoint(
   546     SurfacePoint surfacePoint) {
   547     Latitude lat = surfacePoint.GetLatitude();
   548     Longitude lon = surfacePoint.GetLongitude();
   549     Distance radius = surfacePoint.GetLocalRadius();
   555     if (!radius.isValid())
   558     surfacePoint.SetSphericalCoordinates(lat, lon, radius);
 Status SetAprioriSurfacePointSource(SurfacePointSource::Source source)
This updates the source of the surface point. 
 
bool HasSerialNumber(QString serialNumber) const
Return true if given serial number exists in point. 
 
double meters() const
Get the distance in meters. 
 
Status SetAprioriRadiusSourceFile(QString sourceFile)
This updates the filename of the DEM that the apriori radius came from. 
 
Status SetIgnored(bool newIgnoreStatus)
Set whether to ignore or use control point. 
 
QString GetRadiusSourceString() const
Obtain a string representation of the RadiusSource. 
 
Status SetChooserName(QString name)
Set the point's chooser name. 
 
This error is for when a programmer made an API call that was illegal. 
 
Status SetEditLock(bool editLock)
Set the EditLock state. 
 
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point. 
 
double degrees() const
Get the angle in units of Degrees. 
 
Status SetAdjustedSurfacePoint(SurfacePoint newSurfacePoint)
Set or update the surface point relating to this control point. 
 
Status SetAprioriSurfacePointSourceFile(QString sourceFile)
This updates the filename of where the apriori surface point came from. 
 
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
 
QString GetSurfacePointSourceString() const
Obtain a string representation of the SurfacePointSource. 
 
int GetNumLockedMeasures() const
Returns the number of locked control measures. 
 
QString GetId() const
Return the Id of the control point. 
 
static RadiusSource::Source StringToRadiusSource(QString str)
Obtain a RadiusSource::Source from a string. 
 
Status SetDateTime(QString newDateTime)
Set the point's last modified time. 
 
#define _FILEINFO_
Macro for the filename and line number. 
 
Status SetRefMeasure(ControlMeasure *cm)
Set the point's reference measure. 
 
A type of error that could only have occurred due to a mistake on the user's part (e...
 
Status SetAprioriSurfacePoint(SurfacePoint aprioriSP)
This updates the apriori surface point. 
 
int DeletePoint(ControlPoint *point)
Delete a ControlPoint from the network by the point's address. 
 
Status SetType(PointType newType)
Updates the control point's type. 
 
Status SetId(QString id)
Sets the Id of the control point. 
 
static SurfacePointSource::Source StringToSurfacePointSource(QString str)
Obtain a SurfacePoint::Source from a string. 
 
const ControlMeasure * GetRefMeasure() const
Get the reference control measure. 
 
Unless noted otherwise, the portions of Isis written by the USGS are public domain. 
 
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point. 
 
QString GetPointTypeString() const
Obtain a string representation of the PointType. 
 
Namespace for ISIS/Bullet specific routines. 
 
The distance is being specified in meters. 
 
Distance GetLocalRadius() const
Return the radius of the surface point. 
 
Status SetAprioriRadiusSource(RadiusSource::Source source)
This updates the source of the radius of the apriori surface point. 
 
QString GetCubeSerialNumber() const
Return the serial number of the cube containing the coordinate. 
 
static PointType StringToPointType(QString pointTypeString)
Obtain a PointType given a string representation of it. 
 
Unless noted otherwise, the portions of Isis written by the USGS are public domain.