Skip to content

Commit

Permalink
Remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerfraser committed May 1, 2021
1 parent d64b721 commit a5c52a4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 132 deletions.
129 changes: 0 additions & 129 deletions dynadjust/dynadjust/dnageoid/dnageoid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2793,58 +2793,6 @@ void dna_geoid_interpolation::PrintSubGridHeaderInfoBinary(std::ofstream* f_out,
}


// Sets up the temporary grid file buffers with default parameters (based on national grid file)
//
// Default AUSGEOID parameters (whole continent
// ----------- deg sec
// S_LAT -46 -165600
// N_LAT -8 -28800
// E_LONG -160 -576000
// W_LONG -108 -388800
//
// ----------- min sec
// LAT_INC 1 60
// LONG_INC 1 60
//
void dna_geoid_interpolation::SetDefaultGridFileParametersTmp(n_file_par* ntv2_params)
{
// set grid file settings
sprintf(ntv2_params->filename, "%s", "."); // NULL path
sprintf(ntv2_params->filetype, "%s", "GSB"); // file type

// set Overview Header information
ntv2_params->iH_info = 11; // NUM_OREC
ntv2_params->iSubH_info = 11; // NUM_SREC
ntv2_params->iNumsubgrids = 1; // NUM_FILE
sprintf(ntv2_params->chGs_type, "%s", "SECONDS "); // GS_TYPE
sprintf(ntv2_params->chVersion, "%s", "GEOID98 "); // VERSION
sprintf(ntv2_params->chSystem_f, "%s", "ANS "); // SYSTEM_F
sprintf(ntv2_params->chSystem_t, "%s", "ORTHOMET"); // SYSTEM_T
ntv2_params->daf = 6378137.000; // MAJOR_F
ntv2_params->dbf = 6356752.314; // MINOR_F
ntv2_params->dat = 6378137.000; // MAJOR_T
ntv2_params->dbt = 6356752.314; // MINOR_T

if (!ntv2_params->ptrIndex)
{
ntv2_params->ptrIndex = new n_gridfileindex;
//memset(ntv2_params->ptrIndex, 0, sizeof(n_gridfileindex));

sprintf(ntv2_params->ptrIndex[0].chSubname, "%s", "AUSGEOID"); // SUB_NAME
sprintf(ntv2_params->ptrIndex[0].chParent, "%s", "NONE "); // PARENT
sprintf(ntv2_params->ptrIndex[0].chCreated, "%s", "20012010"); // CREATED
sprintf(ntv2_params->ptrIndex[0].chUpdated, "%s", "20012010"); // UPDATED
ntv2_params->ptrIndex[0].dSlat = -165600.; // S_LAT (-45* 60')
ntv2_params->ptrIndex[0].dNlat = -28800.; // N_LAT (- 8* 00')
ntv2_params->ptrIndex[0].dElong = -576000.; // E_LONG (160* 00')
ntv2_params->ptrIndex[0].dWlong = -388800.; // W_LONG (108* 00')
ntv2_params->ptrIndex[0].dLatinc = 60.; // LAT_INC ( 0* 01')
ntv2_params->ptrIndex[0].dLonginc = 60.; // LONG_INC ( 0* 01')
ntv2_params->ptrIndex[0].lGscount = -1; // GS_COUNT
ntv2_params->ptrIndex[0].iGridPos = 0; // file pointer to file position of this subgrid
}
}

void dna_geoid_interpolation::WriteBinaryRecords(std::ofstream* f_out, float n_value, float dDefl_meridian, float dDefl_primev)
{
//float fGSRecord[5];
Expand Down Expand Up @@ -2902,83 +2850,6 @@ void dna_geoid_interpolation::ScanNodeLocations(char* szLine, double* latitude,
}


void dna_geoid_interpolation::UpdateHeaderInfo(std::ofstream* f_out)
{
// move the file pointer to S_LAT and update
f_out->seekp(248, ios::beg);
f_out->write(reinterpret_cast<char *>(&m_pGridfile->ptrIndex[0].dSlat), sizeof(double));

// set the file pointer to E_LONG and update
f_out->seekp(280, ios::beg);
f_out->write(reinterpret_cast<char *>(&m_pGridfile->ptrIndex[0].dElong), sizeof(double));

// set the file pointer to LAT_INC and update
f_out->seekp(312, ios::beg);
f_out->write(reinterpret_cast<char *>(&m_pGridfile->ptrIndex[0].dLatinc), sizeof(double));

// set the file pointer to LONG_INC and update
f_out->seekp(328, ios::beg);
f_out->write(reinterpret_cast<char *>(&m_pGridfile->ptrIndex[0].dLonginc), sizeof(double));

char cPad[NULL_PAD + 1];
memset(cPad, '\0', NULL_PAD);

// set the file pointer to GS_COUNT and update
f_out->seekp(344, ios::beg);
f_out->write(reinterpret_cast<char *>(&m_pGridfile->ptrIndex[0].lGscount), sizeof(int));
f_out->write(reinterpret_cast<char *>(cPad), NULL_PAD); // Pad out extra 4 bytes of null space
}


void dna_geoid_interpolation::ComputeLatLong(double* dlat_initial, const char& c_northsouth, const int& lat_deg, const int& lat_min, const double& lat_sec, double* dlon_initial, const char& c_eastwest, const int& lon_deg, const int& lon_min, const double& lon_sec)
{
*dlat_initial = (double)lat_deg + ((double)lat_min)/100. + (lat_sec)/10000.;
if (c_northsouth == 'S')
*dlat_initial *= -1;

DmstoDeg(*dlat_initial, dlat_initial);

// *** NOTE *** NTv2 uses a positive west system
*dlon_initial = (double)lon_deg + ((double)lon_min)/100. + (lon_sec)/10000.;
if (c_eastwest == 'E')
*dlon_initial *= -1;

DmstoDeg(*dlon_initial, dlon_initial);
}

// When the file is first read, it is likely that m_gfIndex->dLatinc will equal 0.
// On the next pass, m_gfIndex->dLatinc will either equal dlat_separation, or 0, depending
// on whether increments progress column-wise first or row-wise first.
// AusGeoid files typically run column-wise first (left to right on longitude), then
// row-wise (top to bottom on latitude). However, this assumption will not be used for the benefit of doubt!!!
// Every record following needs to be tested to see whether:
// 1. the increment is significant (i.e. 160�00'00" - 160�02'00"), AND
// 2. that the current grid node record is not on the opposite edge of the grid to the last node.
// That is, last_long = 160�00'00", and current_long = 108�00'00".
// TOLERANCE is set to 1.0 seconds. The default interval is 2 minutes (or 120 seconds).
void dna_geoid_interpolation::ReComputeGridSeparation(const double& dlat_current, const double& dlon_current, const double& dlat_previous, const double& dlon_previous)
{
double dlat_separation = fabs(dlat_current - dlat_previous) * DEG_TO_SEC;
double dlon_separation = fabs(dlon_current - dlon_previous) * DEG_TO_SEC;

// has there been an increment?
if ((dlat_separation - 0.0) > TOLERANCE_ZERO)
{
// is the increment of a significant size, but not excessive (i.e. the width of the grid)
// Yes - this is fraught with disaster, but AusGeoid files do not store the latitude grid interval
if (fabs(dlat_separation - m_pGridfile->ptrIndex[0].dLatinc) > TOLERANCE_SEC_MIN && fabs(dlat_separation - m_pGridfile->ptrIndex[0].dLatinc) < TOLERANCE_SEC_MAX)
m_pGridfile->ptrIndex[0].dLatinc = dlat_separation;
}
// has there been an increment?
if ((dlon_separation - 0.0) > TOLERANCE_ZERO)
{
// is the increment of a significant size, but not excessive (i.e. limit the sepatation to two degrees)
// Yes - this is fraught with disaster, but AusGeoid files do not store the longitude grid interval
if (fabs(dlon_separation - m_pGridfile->ptrIndex[0].dLonginc) > TOLERANCE_SEC_MIN && fabs(dlon_separation - m_pGridfile->ptrIndex[0].dLonginc) < TOLERANCE_SEC_MAX)
m_pGridfile->ptrIndex[0].dLonginc = dlon_separation;
}
}

string dna_geoid_interpolation::ErrorString(const int& error, const string& data)
{
switch(error)
Expand Down
3 changes: 0 additions & 3 deletions dynadjust/dynadjust/dnageoid/dnageoid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,16 +205,13 @@ class dna_geoid_interpolation {
n_file_par* pGridfile, bool isTEMP=true);

// NTv2 File creation
void SetDefaultGridFileParametersTmp(n_file_par* ntv2_params);
void PrintGridHeaderInfoAscii(std::ofstream* f_out, n_file_par* pGridfile);
void PrintGridHeaderInfoBinary(std::ofstream* f_out, n_file_par* pGridfile);
void PrintSubGridHeaderInfoAscii(std::ofstream* f_out, n_gridfileindex* m_gfIndex, const string& shiftType);
void PrintSubGridHeaderInfoBinary(std::ofstream* f_out, n_gridfileindex* m_gfIndex, const string& shiftType);
void UpdateHeaderInfo(std::ofstream* f_out);
void ScanDatFileValues(char* szLine, float* n_value, char* c_northsouth, int* lat_deg, int* lat_min, float* lat_sec, char* c_eastwest, int* lon_deg, int* lon_min, float* lon_sec, float* defl_meridian, float* defl_primev);
void ScanNodeLocations(char* szLine, double* latitude, double* longitude, const UINT32& lNodeRead);
void ComputeLatLong(double* dlat_initial, const char& c_northsouth, const int& lat_deg, const int& lat_min, const double& lat_sec, double* dlon_initial, const char& c_eastwest, const int& lon_deg, const int& lon_min, const double& lon_sec);
void ReComputeGridSeparation(const double& dlat_current, const double& dlon_current, const double& dlat_previous, const double& dlon_previous);
void WriteBinaryRecords(std::ofstream* f_out, float n_value, float defl_meridian, float defl_primev);

// NTv2 interpolation
Expand Down

0 comments on commit a5c52a4

Please sign in to comment.