3 #include "AbstractPointItem.h"
10 #include "CnetDisplayProperties.h"
17 #include "TableColumn.h"
18 #include "TableColumnList.h"
23 QString AbstractPointItem::getColumnName(Column col) {
30 return "Chooser Name";
40 return "Adjusted SP Lat";
42 return "Adjusted SP Lon";
43 case AdjustedSPRadius:
44 return "Adjusted SP Radius";
45 case AdjustedSPLatSigma:
46 return "Adjusted SP Lat Sigma";
47 case AdjustedSPLonSigma:
48 return "Adjusted SP Lon Sigma";
49 case AdjustedSPRadiusSigma:
50 return "Adjusted SP Radius Sigma";
52 return "A Priori SP Lat";
54 return "A Priori SP Lon";
56 return "A Priori SP Radius";
57 case APrioriSPLatSigma:
58 return "A Priori SP Lat Sigma";
59 case APrioriSPLonSigma:
60 return "A Priori SP Lon Sigma";
61 case APrioriSPRadiusSigma:
62 return "A Priori SP Radius Sigma";
64 return "A Priori SP Source";
65 case APrioriSPSourceFile:
66 return "A Priori SP Source File";
67 case APrioriRadiusSource:
68 return "A Priori Radius Source";
69 case APrioriRadiusSourceFile:
70 return "A Priori Radius Source File";
72 return "Jigsaw Rejected";
80 AbstractPointItem::Column AbstractPointItem::getColumn(QString columnTitle) {
81 for (
int i = 0; i < COLS; i++) {
82 if (columnTitle == getColumnName((Column)i))
86 QString msg =
"Column title [" + columnTitle +
"] does not match any of "
87 "the defined column types";
92 TableColumnList *AbstractPointItem::createColumns() {
93 TableColumnList *columnList =
new TableColumnList;
95 columnList->append(
new TableColumn(getColumnName(Id),
false,
false));
97 new TableColumn(getColumnName(PointType),
false,
false));
99 new TableColumn(getColumnName(ChooserName),
false,
false));
101 new TableColumn(getColumnName(DateTime),
true,
false));
103 new TableColumn(getColumnName(EditLock),
false,
false));
105 new TableColumn(getColumnName(Ignored),
false,
true));
107 new TableColumn(getColumnName(Reference),
false,
false));
109 new TableColumn(getColumnName(AdjustedSPLat),
true,
false));
111 new TableColumn(getColumnName(AdjustedSPLon),
true,
false));
113 new TableColumn(getColumnName(AdjustedSPRadius),
true,
false));
115 new TableColumn(getColumnName(AdjustedSPLatSigma),
true,
false));
117 new TableColumn(getColumnName(AdjustedSPLonSigma),
true,
false));
119 new TableColumn(getColumnName(AdjustedSPRadiusSigma),
true,
false));
121 new TableColumn(getColumnName(APrioriSPLat),
false,
false));
123 new TableColumn(getColumnName(APrioriSPLon),
false,
false));
125 new TableColumn(getColumnName(APrioriSPRadius),
false,
false));
127 new TableColumn(getColumnName(APrioriSPLatSigma),
false,
false));
129 new TableColumn(getColumnName(APrioriSPLonSigma),
false,
false));
131 new TableColumn(getColumnName(APrioriSPRadiusSigma),
false,
false));
133 new TableColumn(getColumnName(APrioriSPSource),
false,
false));
135 new TableColumn(getColumnName(APrioriSPSourceFile),
false,
false));
137 new TableColumn(getColumnName(APrioriRadiusSource),
false,
false));
138 columnList->append(
new TableColumn(
139 getColumnName(APrioriRadiusSourceFile),
false,
false));
141 new TableColumn(getColumnName(JigsawRejected),
true,
false));
147 AbstractPointItem::AbstractPointItem(ControlPoint *cp,
148 int avgCharWidth, AbstractTreeItem *parent)
149 : AbstractTreeItem(parent) {
152 calcDataWidth(avgCharWidth);
154 connect(m_point, SIGNAL(destroyed(
QObject *)),
this, SLOT(sourceDeleted()));
158 AbstractPointItem::~AbstractPointItem() {
163 QVariant AbstractPointItem::getData()
const {
164 return getData(getColumnName(Id));
168 QVariant AbstractPointItem::getData(QString columnTitle)
const {
170 Column column = getColumn(columnTitle);
172 switch ((Column) column) {
174 return QVariant((QString)m_point->
GetId());
178 return QVariant((QString)m_point->GetChooserName());
182 return QVariant((QString)m_point->GetDateTime());
184 if (m_point->IsEditLocked())
185 return QVariant(
"Yes");
187 return QVariant(
"No");
190 if (m_point->IsIgnored())
191 return QVariant(
"Yes");
193 return QVariant(
"No");
195 if (m_point->GetNumMeasures())
197 CnetDisplayProperties::getInstance()->getImageName(
207 case AdjustedSPRadius:
210 case AdjustedSPLatSigma:
212 m_point->GetAdjustedSurfacePoint().
213 GetLatSigmaDistance().meters());
214 case AdjustedSPLonSigma:
216 m_point->GetAdjustedSurfacePoint().
217 GetLonSigmaDistance().meters());
218 case AdjustedSPRadiusSigma:
220 m_point->GetAdjustedSurfacePoint().
221 GetLocalRadiusSigma().meters());
228 case APrioriSPRadius:
231 case APrioriSPLatSigma:
233 m_point->GetAprioriSurfacePoint().
234 GetLatSigmaDistance().meters());
235 case APrioriSPLonSigma:
237 m_point->GetAprioriSurfacePoint().
238 GetLonSigmaDistance().meters());
239 case APrioriSPRadiusSigma:
241 m_point->GetAprioriSurfacePoint().
242 GetLocalRadiusSigma().meters());
243 case APrioriSPSource:
245 case APrioriSPSourceFile:
246 return QVariant((QString)m_point->GetAprioriSurfacePointSourceFile());
247 case APrioriRadiusSource:
249 case APrioriRadiusSourceFile:
250 return QVariant((QString)m_point->GetAprioriRadiusSourceFile());
252 if (m_point->IsRejected())
253 return QVariant(
"Yes");
255 return QVariant(
"No");
263 void AbstractPointItem::setData(QString
const &columnTitle,
264 QString
const &newData) {
266 Column column = getColumn(columnTitle);
268 switch ((Column) column) {
270 m_point->
SetId(newData);
282 if (newData ==
"Yes")
306 case AdjustedSPRadius:
312 case AdjustedSPLatSigma: {
313 QString msg =
"Cannot set adjusted surface point latitude sigma";
317 case AdjustedSPLonSigma: {
318 QString msg =
"Cannot set adjusted surface point longitude sigma";
322 case AdjustedSPRadiusSigma: {
323 QString msg =
"Cannot set adjusted surface point radius sigma";
329 SurfacePoint newSurfacePoint(prepareSurfacePoint(newLat,
330 m_point->GetAprioriSurfacePoint()));
332 newSurfacePoint.SetSphericalCoordinates(newLat,
333 newSurfacePoint.GetLongitude(),
334 newSurfacePoint.GetLocalRadius());
340 SurfacePoint newSurfacePoint(prepareSurfacePoint(newLon,
341 m_point->GetAprioriSurfacePoint()));
343 newSurfacePoint.SetSphericalCoordinates(
344 newSurfacePoint.GetLatitude(),
346 newSurfacePoint.GetLocalRadius());
350 case APrioriSPRadius: {
352 SurfacePoint newSurfacePoint(prepareSurfacePoint(newRadius,
353 m_point->GetAprioriSurfacePoint()));
355 newSurfacePoint.SetSphericalCoordinates(
356 newSurfacePoint.GetLatitude(),
357 newSurfacePoint.GetLongitude(),
362 case APrioriSPLatSigma: {
364 SurfacePoint newSurfacePoint(prepareSigmas(newSigma,
365 m_point->GetAprioriSurfacePoint()));
367 newSurfacePoint.SetSphericalSigmasDistance(
368 newSigma, newSurfacePoint.GetLonSigmaDistance(),
369 newSurfacePoint.GetLocalRadiusSigma());
374 case APrioriSPLonSigma: {
376 SurfacePoint newSurfacePoint(prepareSigmas(newSigma,
377 m_point->GetAprioriSurfacePoint()));
379 newSurfacePoint.SetSphericalSigmasDistance(
380 newSurfacePoint.GetLatSigmaDistance(), newSigma,
381 newSurfacePoint.GetLocalRadiusSigma());
386 case APrioriSPRadiusSigma: {
388 SurfacePoint newSurfacePoint(prepareSigmas(newSigma,
389 m_point->GetAprioriSurfacePoint()));
391 newSurfacePoint.SetSphericalSigmasDistance(
392 newSurfacePoint.GetLatSigmaDistance(),
393 newSurfacePoint.GetLonSigmaDistance(),
399 case APrioriSPSource:
403 case APrioriSPSourceFile:
406 case APrioriRadiusSource:
410 case APrioriRadiusSourceFile:
424 bool AbstractPointItem::isDataEditable(QString columnTitle)
const {
426 if (m_point->IsEditLocked()) {
427 if (getColumn(columnTitle) == EditLock)
438 void AbstractPointItem::deleteSource() {
440 if (m_point->IsEditLocked()) {
441 QString msg =
"Point [" + getFormattedData() +
"] is edit locked and "
446 QString msg =
"Point [" + getFormattedData() +
"] has at least one "
447 "edit locked measure and cannot be deleted";
451 ControlPoint *tempPoint = m_point;
458 AbstractTreeItem::InternalPointerType AbstractPointItem::getPointerType()
const {
459 return AbstractTreeItem::Point;
463 void *AbstractPointItem::getPointer()
const {
468 bool AbstractPointItem::hasPoint(ControlPoint *p)
const {
472 void AbstractPointItem::sourceDeleted() {
477 SurfacePoint AbstractPointItem::prepareSigmas(Distance newSigma,
478 SurfacePoint surfacePoint) {
480 Distance latSigDist = surfacePoint.GetLatSigmaDistance();
481 Distance lonSigDist = surfacePoint.GetLonSigmaDistance();
482 Distance radiusSigDist = surfacePoint.GetLocalRadiusSigma();
484 if (newSigma.isValid()) {
485 if (!latSigDist.isValid())
487 if (!lonSigDist.isValid())
489 if (!radiusSigDist.isValid())
490 radiusSigDist = free;
493 latSigDist = Distance();
494 lonSigDist = Distance();
495 radiusSigDist = Distance();
498 surfacePoint.SetSphericalSigmasDistance(
499 latSigDist, lonSigDist, radiusSigDist);
504 SurfacePoint AbstractPointItem::prepareSurfacePoint(Latitude newLat,
505 SurfacePoint surfacePoint) {
506 if (newLat.isValid()) {
507 surfacePoint = prepareSurfacePoint(surfacePoint);
510 surfacePoint.SetSphericalCoordinates(Latitude(), Longitude(),
518 SurfacePoint AbstractPointItem::prepareSurfacePoint(Longitude newLon,
519 SurfacePoint surfacePoint) {
520 if (newLon.isValid()) {
521 surfacePoint = prepareSurfacePoint(surfacePoint);
524 surfacePoint.SetSphericalCoordinates(Latitude(), Longitude(),
532 SurfacePoint AbstractPointItem::prepareSurfacePoint(
533 Distance newRadius, SurfacePoint surfacePoint) {
534 if (newRadius.isValid()) {
535 surfacePoint = prepareSurfacePoint(surfacePoint);
538 surfacePoint.SetSphericalCoordinates(Latitude(), Longitude(),
546 SurfacePoint AbstractPointItem::prepareSurfacePoint(
547 SurfacePoint surfacePoint) {
548 Latitude lat = surfacePoint.GetLatitude();
549 Longitude lon = surfacePoint.GetLongitude();
550 Distance radius = surfacePoint.GetLocalRadius();
556 if (!radius.isValid())
559 surfacePoint.SetSphericalCoordinates(lat, lon, radius);
Status SetAprioriSurfacePointSource(SurfacePointSource::Source source)
This updates the source of the surface point.
double degrees() const
Get the angle in units of Degrees.
Distance GetLocalRadius() const
Return the radius of the surface point.
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 GetPointTypeString() const
Obtain a string representation of the PointType.
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.
const ControlMeasure * GetRefMeasure() const
Get the reference control measure.
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
Status SetAdjustedSurfacePoint(SurfacePoint newSurfacePoint)
Set or update the surface point relating to this control point.
bool HasSerialNumber(QString serialNumber) const
Return true if given serial number exists in point.
Status SetAprioriSurfacePointSourceFile(QString sourceFile)
This updates the filename of where the apriori surface point came from.
QString GetRadiusSourceString() const
Obtain a string representation of the RadiusSource.
double meters() const
Get the distance in meters.
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
QString GetId() const
Return the Id of the control point.
static RadiusSource::Source StringToRadiusSource(QString str)
Obtain a RadiusSource::Source from a string.
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
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.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
QString GetCubeSerialNumber() const
Return the serial number of the cube containing the coordinate.
The distance is being specified in meters.
int GetNumLockedMeasures() const
Returns the number of locked control measures.
QString GetSurfacePointSourceString() const
Obtain a string representation of the SurfacePointSource.
Status SetAprioriRadiusSource(RadiusSource::Source source)
This updates the source of the radius of the apriori surface point.
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.