Unverified Commit e614dae2 authored by Kristin's avatar Kristin Committed by GitHub
Browse files

More linter-suggested formatting changes, warnings added for non-intersection,...

More linter-suggested formatting changes, warnings added for non-intersection, and clean up duplicate code (#311)

* More cpplint suggested changes

* call computeallsensorpartials from parent

* Added warning for when imageToGround doesn't intersect target

* More cpplint-suggested changes

* Add README.md explaining that we use a pared-down version of the Google Style Guide
parent ad280522
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -64,3 +64,21 @@ and are run via ctest. To run all of the tests simply run `ctest` in the build.

All of the tests are purposefully written to use generic data that values have
been hand validated for. This data can be found under `tests/data`.

## Code Style

This software package uses a modified form of the 
[Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). 

Here are some exceptions:

1. Non-const pass-by-reference is allowed.
2. No copyright notice is necessary
3. Static/global string constants are allowed to be std::strings, rather than C-style strings

To attempt to automatically format any new code to this style, run:
`clang-format -style=Google -i file.cpp`
For more information see: [ClangFormat](https://clang.llvm.org/docs/ClangFormat.html)

To check for compliance, run: `cpplint file.cpp` and ignore errors in the list of exclusions above.
For more information, see: [cpplint](https://github.com/cpplint/cpplint)
+3 −3
Original line number Diff line number Diff line
#ifndef Distortion_h
#define Distortion_h
#ifndef INCLUDE_USGSCSM_DISTORTION_H_
#define INCLUDE_USGSCSM_DISTORTION_H_

#include <math.h>
#include <iostream>
@@ -25,4 +25,4 @@ void applyDistortion(double ux, double uy, double &dx, double &dy,
                     DistortionType distortionType,
                     const double desiredPrecision = 1.0E-6,
                     const double tolerance = 1.0E-6);
#endif
#endif  // INCLUDE_USGSCSM_DISTORTION_H_
+10 −6
Original line number Diff line number Diff line
#ifndef INCLUDE_USGSCSM_USGSASTROFRAMESENSORMODEL_H_
#define INCLUDE_USGSCSM_USGSASTROFRAMESENSORMODEL_H_

#ifndef UsgsAstroFrameSensorModel_h
#define UsgsAstroFrameSensorModel_h

#include <SettableEllipsoid.h>
#include <cmath>
#include <iostream>
#include <vector>
#include <utility>
#include <memory>
#include <string>

#include "SettableEllipsoid.h"
#include "CorrelationModel.h"
#include "Distortion.h"
#include "RasterGM.h"
@@ -331,7 +334,8 @@ class UsgsAstroFrameSensorModel : public csm::RasterGM,

  void losEllipsoidIntersect(double height, double xc, double yc, double zc,
                             double xl, double yl, double zl, double &x,
                             double &y, double &z) const;
                             double &y, double &z,
                             csm::WarningList *warnings = NULL) const;

  static const std::string _SENSOR_MODEL_NAME;

@@ -393,4 +397,4 @@ class UsgsAstroFrameSensorModel : public csm::RasterGM,
  csm::NoCorrelationModel _no_corr_model;
};

#endif
#endif  // INCLUDE_USGSCSM_USGSASTROFRAMESENSORMODEL_H_
+12 −6
Original line number Diff line number Diff line
@@ -25,14 +25,19 @@
//
//-----------------------------------------------------------------------------

#ifndef __USGS_ASTRO_LINE_SCANNER_SENSORMODEL_H
#define __USGS_ASTRO_LINE_SCANNER_SENSORMODEL_H
#ifndef INCLUDE_USGSCSM_USGSASTROLSSENSORMODEL_H_
#define INCLUDE_USGSCSM_USGSASTROLSSENSORMODEL_H_

#include <CorrelationModel.h>
#include <RasterGM.h>
#include <SettableEllipsoid.h>
#include "Distortion.h"

#include<utility>
#include<memory>
#include<string>
#include<vector>

#include "ale/Distortion.h"
#include "ale/Orientations.h"
#include "ale/States.h"
@@ -939,7 +944,8 @@ class UsgsAstroLsSensorModel : public csm::RasterGM,
                             const double& xl, const double& yl,
                             const double& zl, double& x, double& y, double& z,
                             double& achieved_precision,
                             const double& desired_precision) const;
                             const double& desired_precision,
                             csm::WarningList* warnings = NULL) const;

  // determines the sensor velocity accounting for parameter adjustments.
  void getAdjSensorPosVel(const double& time, const std::vector<double>& adj,
@@ -951,8 +957,8 @@ class UsgsAstroLsSensorModel : public csm::RasterGM,
  std::vector<double> computeDetectorView(
      const double& time,                 // The time to use the EO at
      const csm::EcefCoord& groundPoint,  // The ground coordinate
      const std::vector<double>& adj      // Parameter Adjustments for partials
      ) const;
      const std::vector<double>& adj)      // Parameter Adjustments for partials
      const;

  // The linear approximation for the sensor model is used as the starting point
  // for iterative rigorous calculations.
@@ -982,4 +988,4 @@ class UsgsAstroLsSensorModel : public csm::RasterGM,
  bool _linear;  // flag indicating if linear approximation is useful.
};

#endif
#endif  // INCLUDE_USGSCSM_USGSASTROLSSENSORMODEL_H_
+5 −5
Original line number Diff line number Diff line
#ifndef UsgsAstroPlugin_h
#define UsgsAstroPlugin_h
#ifndef INCLUDE_USGSCSM_USGSASTROPLUGIN_H_
#define INCLUDE_USGSCSM_USGSASTROPLUGIN_H_

#include <string>
#include<map>
#include<memory>

#include <Plugin.h>
#include <Version.h>
@@ -47,8 +49,6 @@ class UsgsAstroPlugin : public csm::Plugin {
  std::string loadImageSupportData(
      const csm::Isd &imageSupportDataOriginal) const;

  // TODO when implementing, add any other necessary members.

 private:
  static const UsgsAstroPlugin m_registeredPlugin;
  static const std::string _PLUGIN_NAME;
@@ -61,4 +61,4 @@ class UsgsAstroPlugin : public csm::Plugin {
  std::shared_ptr<spdlog::logger> m_logger;
};

#endif
#endif   // INCLUDE_USGSCSM_USGSASTROPLUGIN_H_
Loading