-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #167 from Astroua/develop
New 0.6.2 release
- Loading branch information
Showing
160 changed files
with
8,948 additions
and
1,661 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#include <CartaLib/Hooks/ProfileResult.h> | ||
#include <QDebug> | ||
|
||
namespace Carta { | ||
namespace Lib { | ||
namespace Hooks { | ||
|
||
ProfileResult::ProfileResult( double restFrequency, const QString& restUnits, | ||
const std::vector< std::pair<double,double> > data){ | ||
m_data = data; | ||
m_restUnits = restUnits; | ||
m_restFrequency = restFrequency; | ||
} | ||
|
||
std::vector< std::pair<double,double> > ProfileResult::getData() const { | ||
return m_data; | ||
} | ||
|
||
QString ProfileResult::getError() const { | ||
return m_errorMessage; | ||
} | ||
|
||
QString ProfileResult::getRestUnits() const { | ||
return m_restUnits; | ||
} | ||
|
||
double ProfileResult::getRestFrequency() const { | ||
return m_restFrequency; | ||
} | ||
|
||
|
||
void ProfileResult::setData( const std::vector< std::pair<double,double> >& data ){ | ||
m_data = data; | ||
} | ||
|
||
void ProfileResult::setRestFrequency( double restFreq ){ | ||
m_restFrequency = restFreq; | ||
} | ||
|
||
void ProfileResult::setRestUnits( const QString& restUnits ){ | ||
m_restUnits = restUnits; | ||
} | ||
|
||
void ProfileResult::setError( const QString& errorMsg ){ | ||
m_errorMessage = errorMsg; | ||
} | ||
|
||
QDataStream &operator<<(QDataStream& out, const ProfileResult& result ){ | ||
out << result.getRestUnits()<< result.getRestFrequency(); | ||
std::vector<std::pair<double,double>> data = result.getData(); | ||
int dataCount = data.size(); | ||
out << dataCount; | ||
for ( int i = 0; i < dataCount; i++ ){ | ||
out << data[i].first << data[i].second; | ||
} | ||
return out; | ||
} | ||
|
||
|
||
QDataStream &operator>>(QDataStream& in, ProfileResult& result ){ | ||
QString name; | ||
QString unitsX; | ||
QString unitsY; | ||
|
||
double restFrequency; | ||
QString restUnits; | ||
int dataCount; | ||
in >> restUnits >> restFrequency; | ||
in >> dataCount; | ||
std::vector<std::pair<double,double> > data( dataCount ); | ||
for ( int i = 0; i < dataCount; i++ ){ | ||
double firstEle; | ||
double secondEle; | ||
in >> firstEle >> secondEle; | ||
data[i] = std::pair<double,double>( firstEle, secondEle ); | ||
} | ||
result = ProfileResult( restFrequency, restUnits, data ); | ||
return in; | ||
} | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/** | ||
* Stores profile data and associated information needed to display a profile and | ||
* information about the profile. | ||
*/ | ||
#pragma once | ||
#include <QString> | ||
#include <vector> | ||
#include "CartaLib/ProfileInfo.h" | ||
|
||
namespace Carta{ | ||
namespace Lib{ | ||
|
||
namespace Hooks { | ||
|
||
class ProfileResult { | ||
|
||
|
||
public: | ||
ProfileResult( double imageRest = 0, const QString& restUnits = "", | ||
const std::vector< std::pair<double, double> > data = std::vector< std::pair<double,double> >()); | ||
|
||
/** | ||
* Return (x,y) data pairs that comprise a profile. | ||
* @return - (x,y) data pairs that comprise a profile curve. | ||
*/ | ||
std::vector< std::pair<double,double> > getData() const; | ||
|
||
/** | ||
* Return information about any errors that prevented the computation of a profile. | ||
* @return - an error message or an empty string if no errors were encountered. | ||
*/ | ||
QString getError() const; | ||
|
||
/** | ||
* Returns the image rest frequency units. | ||
* @return - the image rest frequency units. | ||
*/ | ||
QString getRestUnits() const; | ||
|
||
/** | ||
* Returns the image rest frequency. | ||
* @return - the image rest frequency. | ||
*/ | ||
double getRestFrequency() const; | ||
|
||
/** | ||
* Store the (x,y) data pairs that comprise a profile. | ||
* @param data - the (x,y) data pairs that make up a profile. | ||
*/ | ||
void setData( const std::vector< std::pair<double,double> >& data ); | ||
|
||
/** | ||
* Set an error message if there was a problem computing the profile. | ||
* @param errorMessage - a description of the problem. | ||
*/ | ||
void setError( const QString& errorMsg ); | ||
|
||
/** | ||
* Store the image rest frequency. | ||
* @param restFreq - the image rest frequency. | ||
*/ | ||
void setRestFrequency( double restFreq ); | ||
|
||
/** | ||
* Store the image rest units. | ||
* @param restUnits - the image rest units. | ||
*/ | ||
void setRestUnits( const QString& restUnits ); | ||
|
||
virtual ~ProfileResult(){} | ||
|
||
private: | ||
std::vector< std::pair<double,double> > m_data; | ||
double m_restFrequency; | ||
QString m_restUnits; | ||
QString m_errorMessage; | ||
}; | ||
|
||
//Serialization so that the profile result can be generated in a separate process. | ||
QDataStream &operator<<(QDataStream& out, const Carta::Lib::Hooks::ProfileResult& result ); | ||
QDataStream &operator>>(QDataStream& in, Carta::Lib::Hooks::ProfileResult& result ); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.