Isis 3 Programmer Reference
Isis::FeatureNomenclature Class Reference

Feature nomenclature database querier. More...

#include <FeatureNomenclature.h>

Inheritance diagram for Isis::FeatureNomenclature:
Inheritance graph
Collaboration diagram for Isis::FeatureNomenclature:
Collaboration graph

Classes

class  Feature
 A named feature on a target. More...
 

Public Types

enum  IAUStatus { NoStatus, Approved, Dropped, Unapproved }
 Enumeration of approval statuses. More...
 

Signals

void featuresIdentified (FeatureNomenclature *)
 This is emitted when a query is completed. More...
 

Public Member Functions

 FeatureNomenclature ()
 Instantiate a feature nomenclature. More...
 
 FeatureNomenclature (const FeatureNomenclature &other)
 Copy a feature nomenclature. More...
 
 ~FeatureNomenclature ()
 Frees allocated memory. More...
 
void queryFeatures (QString target, Latitude startLat, Longitude startLon, Latitude endLat, Longitude endLon)
 Makes sure the longitudinal ranges are correct. More...
 
QList< Featurefeatures () const
 This gives you the features found in all of the queries so far. More...
 
bool hasResult () const
 Test if any understandable results have been received from the nomenclature database. More...
 
void swap (FeatureNomenclature &other)
 Swap the instances *this and other. More...
 
FeatureNomenclatureoperator= (const FeatureNomenclature &other)
 This takes on the data from rhs. More...
 

Static Public Member Functions

static bool featureDiameterGreaterThan (const FeatureNomenclature::Feature &lhs, const FeatureNomenclature::Feature &rhs)
 Compare the diameter of two features. More...
 

Private Slots

void requestFinished (QNetworkReply *)
 This is called when a query is done. More...
 

Private Member Functions

void readSearchResults (QDomElement)
 This is a helper method for requestFinished. More...
 
void runQuery (QString target, Latitude startLat, Longitude startLon, Latitude endLat, Longitude endLon)
 Query the nomenclature database for features inside the given range on the target. More...
 

Private Attributes

QNetworkAccessManager * m_networkMgr
 Network manager does request. More...
 
QNetworkRequest * m_request
 Network request sent. More...
 
QList< Feature > * m_features
 These are the features identified by the nomenclature database. More...
 
IAUStatus m_statusApproval
 The approval status of the feature from the database. More...
 
bool m_lastQuery
 True if all queries have finished. More...
 

Detailed Description

Feature nomenclature database querier.

This class queries the nomenclature database for features. To use this class, you create a blank instance. Then you connect to the featuresIdentified() signal. Finally, you call query with the appropriate input data. You can call query as many times as you want; featuresIdentified() will be emitted the same number of times. Finally, you can access the features with features().

Author
2012-03-14 Steven Lambright
History:
2012-06-06 Steven Lambright and Kimbelry Oyama - Added an enumerator for the approval status of each feature. Modified queryFeatures() to ensure the correct longitude domain is used. References #852. Fixes #892. Fixes #855.
History:
2012-06-29 Steven Lambright and Kimberly Oyama - Separated queryFeatures() into: 1) queryFeatures(), which makes sure the longitude range is between 0 and 360 and that it is in the 360 domain, and calls the request method, and 2) runQuery(), which makes the request. Fixes #958.
History:
2018-01-05 Cole Neubauer - The URL for request was moved. Updated the URL to the new URL and added an error to be thrown if it is moved again Fixes #4963.

Definition at line 51 of file FeatureNomenclature.h.

Member Enumeration Documentation

◆ IAUStatus

Enumeration of approval statuses.

Enumerator
NoStatus 

When this status is assigned to a feature, there will be no status displayed and the feature will not be shown if the IAU approved only checkbox is checked.

Approved 

When this status is assigned to a feature, the displayed status will be "Adopted by the IAU" and the feature will always be shown.

Dropped 

When this status is assigned to a feature, the displayed status will be "Dropped, disallowed" and the feature will not be shown if the IAU approved only checkbox is checked.

Unapproved 

When this status is assigned to a feature, the displayed status will be "Never approved by the IAU" and the feature will not be shown if the IAU approved only checkbox checked.

Definition at line 57 of file FeatureNomenclature.h.

Constructor & Destructor Documentation

◆ FeatureNomenclature() [1/2]

Isis::FeatureNomenclature::FeatureNomenclature ( )

Instantiate a feature nomenclature.

This prepares to make network requests.

Definition at line 29 of file FeatureNomenclature.cpp.

References m_features, m_lastQuery, m_networkMgr, m_request, and requestFinished().

◆ FeatureNomenclature() [2/2]

Isis::FeatureNomenclature::FeatureNomenclature ( const FeatureNomenclature other)

Copy a feature nomenclature.

Data being queried currently will not be available in the copy, but ready results will be available.

Parameters
otherThe feature nomenclature to copy

Definition at line 56 of file FeatureNomenclature.cpp.

References m_features, m_lastQuery, m_networkMgr, m_request, and requestFinished().

◆ ~FeatureNomenclature()

Isis::FeatureNomenclature::~FeatureNomenclature ( )

Frees allocated memory.

Definition at line 77 of file FeatureNomenclature.cpp.

References m_features, m_networkMgr, and m_request.

Member Function Documentation

◆ featureDiameterGreaterThan()

bool Isis::FeatureNomenclature::featureDiameterGreaterThan ( const FeatureNomenclature::Feature lhs,
const FeatureNomenclature::Feature rhs 
)
static

Compare the diameter of two features.

This is very useful for sorting with qSort(). If lhs > rhs, then this returns true. This considers valid data

invalid data.

Parameters
lhsThe left hand side of the '>' operator
rhsThe right hand side of the '>' operator
Returns
lhs > rhs

Definition at line 193 of file FeatureNomenclature.cpp.

References Isis::FeatureNomenclature::Feature::diameter(), and Isis::Distance::isValid().

Referenced by Isis::FeatureNomenclatureTool::ViewportFeatureDisplay::ViewportFeatureDisplay().

◆ features()

QList< FeatureNomenclature::Feature > Isis::FeatureNomenclature::features ( ) const

This gives you the features found in all of the queries so far.

If all of the queries are finished, then this list will contain all of the results. The list will be empty if no queries have succeeded so far.

Returns
a cumulative list of all of the features found so far.

Definition at line 136 of file FeatureNomenclature.cpp.

References m_features.

◆ featuresIdentified

void Isis::FeatureNomenclature::featuresIdentified ( FeatureNomenclature )
signal

This is emitted when a query is completed.

When emitted, the this pointer is provided.

Referenced by requestFinished().

◆ hasResult()

bool Isis::FeatureNomenclature::hasResult ( ) const

Test if any understandable results have been received from the nomenclature database.

Returns
True if any queries have succeeded.

Definition at line 152 of file FeatureNomenclature.cpp.

References m_features.

◆ operator=()

FeatureNomenclature & Isis::FeatureNomenclature::operator= ( const FeatureNomenclature rhs)

This takes on the data from rhs.

Active queries will not be copied. This is exception safe.

Parameters
rhsThe FeatureNomenclature on the right hand side of the '='
Returns
*this

Definition at line 176 of file FeatureNomenclature.cpp.

References swap().

◆ queryFeatures()

void Isis::FeatureNomenclature::queryFeatures ( QString  target,
Latitude  startLat,
Longitude  startLon,
Latitude  endLat,
Longitude  endLon 
)

Makes sure the longitudinal ranges are correct.

If the range intersects with the 0 line the range is split into two ranges, the minimum to 360 and 0 to the maximum. Then it runs a query on each range.

Parameters
targetThe target for which features might be present
startLatThe minimum latitude of the ground range to search
startLonThe minimum longitude of the ground range to search
endLatThe maximum latitude of the ground range to search
endLonThe maximum longitude of the ground range to search

Definition at line 100 of file FeatureNomenclature.cpp.

References m_lastQuery, runQuery(), and Isis::Longitude::to360Range().

◆ readSearchResults()

void Isis::FeatureNomenclature::readSearchResults ( QDomElement  xmlSearchResults)
private

This is a helper method for requestFinished.

This takes the search results and creates a Feature for each equivalent XML feature element.

Parameters
xmlSearchResultsThe searchresults XML from the nomenclature server.

Definition at line 860 of file FeatureNomenclature.cpp.

References Approved, Dropped, m_features, m_statusApproval, NoStatus, and Unapproved.

Referenced by requestFinished().

◆ requestFinished

void Isis::FeatureNomenclature::requestFinished ( QNetworkReply *  reply)
privateslot

This is called when a query is done.

This adds the features to our feature list and emits featuresIdentified().

Parameters
replyThe server's response to our request, containing features in XML form.

Definition at line 801 of file FeatureNomenclature.cpp.

References featuresIdentified(), m_lastQuery, Isis::IException::Programmer, and readSearchResults().

Referenced by FeatureNomenclature().

◆ runQuery()

void Isis::FeatureNomenclature::runQuery ( QString  target,
Latitude  startLat,
Longitude  startLon,
Latitude  endLat,
Longitude  endLon 
)
private

Query the nomenclature database for features inside the given range on the target.

When the last query for the cube is done, featuresIdentified() will be emitted.

You can call query as many times as you'd like, but the results will be cumulative. Errors are reported in the form of a message box.

Parameters
targetThe target for which features might be present
startLatThe minimum latitude of the ground range to search
startLonThe minimum longitude of the ground range to search
endLatThe maximum latitude of the ground range to search
endLonThe maximum longitude of the ground range to search

Definition at line 907 of file FeatureNomenclature.cpp.

References Isis::Angle::degrees(), m_networkMgr, and m_request.

Referenced by queryFeatures().

◆ swap()

void Isis::FeatureNomenclature::swap ( FeatureNomenclature other)

Swap the instances *this and other.

This cannot throw an exception.

Parameters
otherThe FeatureNomenclature to trade data with.

Definition at line 162 of file FeatureNomenclature.cpp.

References m_features, m_networkMgr, and m_request.

Referenced by Isis::FeatureNomenclature::Feature::operator=(), and operator=().

Member Data Documentation

◆ m_features

QList<Feature>* Isis::FeatureNomenclature::m_features
private

These are the features identified by the nomenclature database.

Definition at line 196 of file FeatureNomenclature.h.

Referenced by FeatureNomenclature(), features(), hasResult(), readSearchResults(), swap(), and ~FeatureNomenclature().

◆ m_lastQuery

bool Isis::FeatureNomenclature::m_lastQuery
private

True if all queries have finished.

Definition at line 200 of file FeatureNomenclature.h.

Referenced by FeatureNomenclature(), queryFeatures(), and requestFinished().

◆ m_networkMgr

QNetworkAccessManager* Isis::FeatureNomenclature::m_networkMgr
private

Network manager does request.

Definition at line 192 of file FeatureNomenclature.h.

Referenced by FeatureNomenclature(), runQuery(), swap(), and ~FeatureNomenclature().

◆ m_request

QNetworkRequest* Isis::FeatureNomenclature::m_request
private

Network request sent.

Definition at line 193 of file FeatureNomenclature.h.

Referenced by FeatureNomenclature(), runQuery(), swap(), and ~FeatureNomenclature().

◆ m_statusApproval

IAUStatus Isis::FeatureNomenclature::m_statusApproval
private

The approval status of the feature from the database.

Definition at line 198 of file FeatureNomenclature.h.

Referenced by readSearchResults().


The documentation for this class was generated from the following files: