diff --git a/.gitignore b/.gitignore index 19c5aa9cc..8a056137b 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,4 @@ six/projects/csm/external/csm-master/ # Giant test files regression_files/ six/modules/c++/cphd/tests/sample_cphd/ + diff --git a/six/modules/c++/six.sicd/include/six/sicd/Grid.h b/six/modules/c++/six.sicd/include/six/sicd/Grid.h index c573ed176..6cbdfa88e 100644 --- a/six/modules/c++/six.sicd/include/six/sicd/Grid.h +++ b/six/modules/c++/six.sicd/include/six/sicd/Grid.h @@ -19,8 +19,9 @@ * see . * */ -#ifndef __SIX_GRID_H__ -#define __SIX_GRID_H__ +#ifndef SIX_six_sicd_Grid_h_INCLUDED_ +#define SIX_six_sicd_Grid_h_INCLUDED_ +#pragma once #include #include @@ -147,9 +148,9 @@ struct DirectionParameters void fillDerivedFields(const ImageData& imageData); void fillDerivedFields(const RgAzComp& rgAzComp, double offset = 0); -private: std::unique_ptr calculateWeightFunction() const; +private: bool validateWeights(const Functor& weightFunction, logging::Logger& log) const; @@ -278,5 +279,4 @@ struct Grid } } -#endif - +#endif // SIX_six_sicd_Grid_h_INCLUDED_ diff --git a/six/modules/c++/six.sicd/source/Grid.cpp b/six/modules/c++/six.sicd/source/Grid.cpp index ab6903918..2edbbbc45 100644 --- a/six/modules/c++/six.sicd/source/Grid.cpp +++ b/six/modules/c++/six.sicd/source/Grid.cpp @@ -19,8 +19,11 @@ * see . * */ -#include "six/sicd/GeoData.h" #include "six/sicd/Grid.h" + +#include + +#include "six/sicd/GeoData.h" #include "six/sicd/ImageData.h" #include "six/sicd/PFA.h" #include "six/sicd/SCPCOA.h" @@ -125,45 +128,45 @@ std::pair DirectionParameters::calculateDeltaKs( std::unique_ptr DirectionParameters::calculateWeightFunction() const { - std::unique_ptr weightFunction; - - if (weightType.get() != nullptr) + if (weightType.get() == nullptr) { - std::string windowName(weightType->windowName); - str::upper(windowName); + return nullptr; + } - if (windowName == "UNIFORM") - { - weightFunction.reset(new Identity()); - } - else if (windowName == "HAMMING") - { - double coef = 0.0; - if (weightType->parameters.empty() || weightType->parameters[0].str().empty()) - { - //A Hamming window is defined in many places as a raised cosine of weight .54, - //so this is the default. However, some data use a generalized raised cosine and - //call it HAMMING, so we allow for both uses. - coef = .54; - } - else - { - coef = weightType->parameters[0]; - } + std::string windowName(weightType->windowName); + str::upper(windowName); - weightFunction.reset(new RaisedCos(coef)); - } - else if (windowName == "HANNING") + if (windowName == "UNIFORM") + { + return std::make_unique(); + } + if (windowName == "HAMMING") + { + double coef = 0.0; + if (weightType->parameters.empty() || weightType->parameters[0].str().empty()) { - weightFunction.reset(new RaisedCos(0.50)); + //A Hamming window is defined in many places as a raised cosine of weight .54, + //so this is the default. However, some data use a generalized raised cosine and + //call it HAMMING, so we allow for both uses. + coef = .54; } - else if (windowName == "KAISER") + else { - weightFunction.reset(new Kaiser(double(weightType->parameters[0]))); + coef = weightType->parameters[0]; } + + return std::make_unique(coef); + } + if (windowName == "HANNING") + { + return std::make_unique(0.50); + } + if (windowName == "KAISER") + { + return std::make_unique(double(weightType->parameters[0])); } - return weightFunction; + return nullptr; } std::vector