Skip to content

Commit 74cc85c

Browse files
author
russo
committed
Add a report name to the base class, and methods for getting and setting it.
Add default constructors. Still need to come up with report management functions so that reports can be deleted from the collection by specifying report name.
1 parent 2a2af80 commit 74cc85c

8 files changed

Lines changed: 64 additions & 4 deletions

DF_Abstract_Report.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#include "port.h"
44
#include <vector>
55
#include <cmath>
6+
#include <string>
7+
68
#include "DF_Abstract_Point.hpp"
79

810
using namespace std;
@@ -20,6 +22,8 @@ namespace DFLib
2022
// Forward declaration:
2123
class Report
2224
{
25+
private:
26+
string ReportName_;
2327
public:
2428
// pure virtual functions:
2529
virtual const CPL_DLL vector<double> &getReceiverLocation() = 0;
@@ -30,6 +34,13 @@ namespace DFLib
3034
/// \return bearing in radians, always in the range \f$0<\theta<2\pi\f$.
3135
virtual CPL_DLL double getReportBearingRadians() const = 0;
3236
virtual CPL_DLL double getBearingStandardDeviationRadians() const = 0;
37+
38+
///\brief Return the name of this report
39+
virtual const string &getReportName() { return ReportName_;};
40+
41+
///\brief set the name of this report
42+
virtual void setReportName(string &theName) { ReportName_=theName;};
43+
3344
/// \brief compute point at which the line from this report intersects that from another
3445
/// \param Report2 pointer to the other report
3546
/// \param returnPoint reference to place to store solution point

DF_LatLon_Point.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ namespace DFLib
1212
{
1313

1414
// class Point
15+
Point::Point()
16+
: llDirty(true),
17+
mercDirty(false)
18+
{
19+
theLatLon.resize(2,0.0);
20+
}
1521

1622
Point::Point(const vector<double> &aPosition)
1723
: theLatLon(aPosition),
@@ -38,7 +44,9 @@ namespace DFLib
3844
}
3945

4046
// Don't bother trying to force the mercator --- we'll do that if
41-
// we query, because we're setting llDirty to true.
47+
// we query, because we're setting llDirty to true, just initialize
48+
// to junk.
49+
theMerc.resize(2,0.0);
4250
}
4351

4452
Point::Point(const Point &right)

DF_LatLon_Point.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,16 @@ namespace DFLib
2121
bool llDirty;
2222
projPJ latlonProj, mercProj;
2323
public:
24+
/// \brief Default Constructor
25+
///
26+
Point();
27+
2428
/// \brief Constructor
2529
///
2630
/// \param llPosition coordinates <em>in Lat Lon</em>
2731
Point(const vector<double> &llPosition);
2832

33+
2934
/// \brief Copy Constructor
3035
Point(const Point &right);
3136

DF_LatLon_Report.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ namespace DFLib
2121
Point receiverLocation;
2222
double bearing,sigma;
2323
public:
24+
CPL_DLL Report(const double &theLon, const double &theLat,
25+
const double &bearing,const double &std_dev);
2426
CPL_DLL Report(const vector<double> &theLocationLL,
2527
const double &bearing,const double &std_dev);
2628
CPL_DLL ~Report();
@@ -38,6 +40,19 @@ namespace DFLib
3840
};
3941
}
4042

43+
/// \brief XY DF report constructor with defaults
44+
inline DFLib::LatLon::Report::Report(const double &theLon = 0,
45+
const double &theLat = 0,
46+
const double &Bearing = 0,
47+
const double &std_dev = 1)
48+
: bearing(Bearing), sigma(std_dev*M_PI/180)
49+
{
50+
vector<double> XY(2);
51+
XY[0]=theLon;
52+
XY[1]=theLat;
53+
receiverLocation.setLL(XY);
54+
}
55+
4156
/// \brief XYDF report constructor.
4257
/// \param theLocation position vector <em>in lat/lon</em> of this report.
4358
/// \param Bearing bearing IN DEGREES

DF_Report_Collection.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ namespace DFLib
8080
{
8181
double cutAngle;
8282
(*iterReportI)->computeFixCut(*iterReportJ,*tempPoint,cutAngle,fs);
83-
if (fs != GOOD_FIX)
84-
cout << " Fix failed for I=" << reportnumI << " and "
85-
<< " J=" << reportnumJ << endl;
8683
if (fs == GOOD_FIX && fabs(cutAngle) >= minAngle*M_PI/180.0)
8784
{
8885
numCuts++;

DF_XY_Point.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ namespace DFLib
1010

1111
// class Point
1212

13+
Point::Point()
14+
{
15+
myXY.resize(2,0.0);
16+
}
17+
1318
Point::Point(const vector<double> &aPosition)
1419
:myXY(aPosition)
1520
{

DF_XY_Point.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ namespace DFLib
1414
private:
1515
vector<double> myXY;
1616
public:
17+
/// Default
18+
CPL_DLL Point();
19+
1720
/// Constructor
1821
CPL_DLL Point(const vector<double> &aPosition);
1922
/// Copy Constructor

DF_XY_Report.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ namespace DFLib
2323
Point receiverLocation;
2424
double bearing,sigma;
2525
public:
26+
CPL_DLL Report(const double &theLon, const double &theLat,
27+
const double &bearing,const double &std_dev);
2628
CPL_DLL Report(const vector<double> &theLocation,
2729
const double &bearing,const double &std_dev);
2830
CPL_DLL ~Report();
@@ -39,6 +41,20 @@ namespace DFLib
3941
};
4042
}
4143

44+
45+
/// \brief XY DF report constructor with defaults
46+
inline DFLib::XY::Report::Report(const double &theX = 0,
47+
const double &theY = 0,
48+
const double &Bearing = 0,
49+
const double &std_dev = 1)
50+
: bearing(Bearing), sigma(std_dev*M_PI/180)
51+
{
52+
vector<double> XY(2);
53+
XY[0]=theX;
54+
XY[1]=theY;
55+
receiverLocation.setXY(XY);
56+
}
57+
4258
/// \brief XYDF report constructor.
4359
/// \param theLocation position vector of this report.
4460
/// \param Bearing bearing IN DEGREES

0 commit comments

Comments
 (0)