Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WGS84 Reference Frames Enhancement #26

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions WGS84ReferenceFrame.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//####################################################################
//
// FILENAME: WGS84ReferenceFrame.cpp
//
// CLASSIFICATION: Unclassified
//
// DESCRIPTION:
//
// Implementation for WGS84 reference frame realization and epoch.
//
// LIMITATIONS: None
//
//
// SOFTWARE HISTORY:
// Date Author Comment
// ----------- ------ -------
// 31-December-2021 Eugene Rose CCB Change
//
// NOTES:
// As of writing this, these are the WGS84 realizations to date.
// WGS84 ORIGINAL 1984.0
// G730 1994.0
// G873 1997.0
// G1150 2001.0
// G1674 2005.0
// G1762 2005.0
//
//###################################################################
#define CSM_LIBRARY

#include "csm.h"
#include "WGS84ReferenceFrame.h"

namespace csm
{
//****************************************************************************
// WGS84ReferenceFrame::setDefinition()
//****************************************************************************
void WGS84ReferenceFrame::setDefinition(const std::string &name, const float epoch)
{
m_realization = RealizationDefinition(name, epoch);
}

//****************************************************************************
// WGS84ReferenceFrame::setDefinition()
//****************************************************************************
void WGS84ReferenceFrame::setDefinition(const RealizationDefinition& rd)
{
m_realization = rd;
}

//****************************************************************************
// WGS84ReferenceFrame::getDefinition()
//****************************************************************************
csm::WGS84ReferenceFrame::RealizationDefinition WGS84ReferenceFrame::getDefinition() const
{
return m_realization;
}
}
92 changes: 92 additions & 0 deletions WGS84ReferenceFrame.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
//####################################################################
//
// FILENAME: WGS84ReferenceFrame.h
//
// CLASSIFICATION: Unclassified
//
// DESCRIPTION:
//
// Header for WGS84 reference frame realization and epoch.
//
// LIMITATIONS: None
//
//
// SOFTWARE HISTORY:
// Date Author Comment
// ----------- ------ -------
// 31-December-2021 Eugene Rose CCB Change
//
// NOTES:
// As of writing this, these are the WGS84 realizations to date.
// WGS84 ORIGINAL 1984.0
// G730 1994.0
// G873 1997.0
// G1150 2001.0
// G1674 2005.0
// G1762 2005.0
//
//###################################################################

#ifndef __CSM_WGS84REFERENCEFRAME_H
#define __CSM_WGS84REFERENCEFRAME_H

#include "csm.h"
#include <string>

#define WGS84_ORIGINAL "WGS84 ORIGINAL"
#define WGS84_G730 "G730"
#define WGS84_G873 "G873"
#define WGS84_G1150 "G1150"
#define WGS84_G1674 "G1674"
#define WGS84_G1762 "G1762"

namespace csm
{

class CSM_EXPORT_API WGS84ReferenceFrame
{
public:

struct CSM_EXPORT_API RealizationDefinition
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that this inner struct provides much benefit. I think you should change WGSReferenceFrame to hold the two items (the string and float) and provides getter and setter methods for those. That would make this class simpler.

{
public:
RealizationDefinition() : m_name("WGS84_ORIGINAL"), m_epoch(1984.0) {};
RealizationDefinition(const std::string &name, float epoch) : m_name(name), m_epoch(epoch) {};
std::string m_name;
float m_epoch;
};
//> Realizations are defined by a string name and a float epoch which is in terms of years since 0AD.
// The default realization is the original one from 1984.0
//<

WGS84ReferenceFrame() {};
//> construct default realization
//<

WGS84ReferenceFrame(const std::string &name, const float epoch) : m_realization(name,epoch) {};
//> construct custom realization
//<

void setDefinition(const std::string &name, const float epoch);
//> convenience to set the internal structure (it is public)
//<

void setDefinition(const RealizationDefinition& rd);
//> convenience to set the internal structure (it is public)
//<

RealizationDefinition getDefinition() const;
//> convenience to get the internal structure (it is public)
//<

private:
RealizationDefinition m_realization;
//> the name and epoch of the realization are here
//<

};

} // namespace csm

#endif // __CSM_WGS84REFERENCEFRAME_H