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

"samples" and "projects" from main #406

Merged
merged 68 commits into from
Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
a619451
build with VS2019
Jan 16, 2021
fe7af28
add "Test" directory
Jan 16, 2021
3681761
add WAF to externals/coda-oss for building with Visual Studio
Jan 16, 2021
78f324d
/W3 and no "Warnings as Errors" (for now)
Jan 16, 2021
d5d7546
dummy value for DEFAULT_SCHEMA_PATH
Jan 16, 2021
64e5c20
default value for DEFAULT_SCHEMA_PATH
Jan 16, 2021
1a6b538
"Test" project builds (with all files excluded)
Jan 16, 2021
9ea2d4a
build some cphd unit-tests
Jan 16, 2021
bb907f7
build "cphd" unittests
Jan 16, 2021
0b12bca
run cphd03 unittests
Jan 16, 2021
af8f56e
build "six" unittests
Jan 16, 2021
45f6c11
run six.sidd unittests
Jan 16, 2021
b5415df
build all but the two new six.sicd unttests
Jan 16, 2021
079c211
fix build error on Linux
Jan 16, 2021
8b341df
Merge branch 'master' into develop/main-to-master
Jan 18, 2021
56ec6f4
"scene" changes from main
Jan 18, 2021
7ea6d44
scene/include changes from main
Jan 18, 2021
9ace5f0
scene/tests changes from main
Jan 18, 2021
0c64da1
simple six/source changes from main
Jan 18, 2021
bdbb68f
Merge branch 'master' into develop/main-to-master
Jan 18, 2021
4e4ca03
more six/ changes from "main"
Jan 18, 2021
b6755d3
more six/six changes from "main"
Jan 18, 2021
c92a0f9
tweak XML routines from six/six in "main"
Jan 18, 2021
abe00c4
ReadControl from six/six @ main
Jan 18, 2021
d76e4b0
std::auto_ptr -> mem::auto_ptr for C++17
Jan 18, 2021
ca82882
easy .h changes from six/six @ main
Jan 18, 2021
1de34d6
get six/six closer to "main"
Jan 18, 2021
5832d67
simplify Enums, from "main"
Jan 18, 2021
02b1392
a few more changes from six/six on "main"
Jan 18, 2021
c5e6d86
add std::byte overload from "main"
Jan 18, 2021
7b5746c
Merge branch 'master' into develop/main-to-master
Jan 18, 2021
3f05568
restore setBuffer() utility from "main"
Jan 18, 2021
a4aa930
simple CPP changes from six.sidd/main
Jan 19, 2021
f4e264b
std::auto_ptr -> mem::auto_ptr for C++17
Jan 19, 2021
9fea2f7
six.sidd changes from "main"
Jan 19, 2021
7696286
.h file changes from six.sidd @ main
Jan 19, 2021
f025140
Revert ".h file changes from six.sidd @ main"
Jan 19, 2021
ad372d3
Revert "Revert ".h file changes from six.sidd @ main""
Jan 19, 2021
19869f8
fix six.sidd/tests after last submission
Jan 19, 2021
f756a59
can't use std::make_shared with mem::SharedPtr
Jan 19, 2021
d7726ab
use six/Enum.h to make six.sidd enums
Jan 19, 2021
af6ae36
minimize diffs
Jan 19, 2021
0e184f4
Merge branch 'master' into develop/main-to-master
Jan 19, 2021
c4d8f95
Merge branch 'master' into develop/main-to-master
Jan 20, 2021
22a130a
six.convert changes from "main"
Jan 20, 2021
905b6fc
bring over cphd03 changes from "main"
Jan 20, 2021
e496ae3
instantiate more templates
Jan 20, 2021
0a4164f
cphd changes from "main"
Jan 20, 2021
4d6b3ff
remaining cphd changes from "main"
Jan 20, 2021
c4ee70d
fix build errors on Linux
Jan 20, 2021
7ef3bd7
Merge branch 'master' into develop/main-to-master
Jan 20, 2021
5e08c71
preserve existing interface
Jan 20, 2021
3ae0ae3
gsl::span -> std::span
Jan 20, 2021
c4b3394
gsl::span -> std::span
Jan 20, 2021
b1c5e40
turn on all warnings and "warnings as errors" for code that has been …
Jan 20, 2021
d285c96
Merge branch 'master' into develop/main-to-master
Jan 20, 2021
006a19d
easy CPP changes from six.sicd in "main"
Jan 20, 2021
751055e
more six.sicd changes from "main"
Jan 20, 2021
af82745
fix build error on Linux
Jan 20, 2021
2dbfb03
remaiing code changes from six.sicd on "main" branch
Jan 20, 2021
a4ea9dd
turn on all warnings and "warnings as errors" for six.sicd
Jan 20, 2021
d54e4ee
tests and unittests from six.sicd on "main" branch
Jan 20, 2021
5e8a383
fix build errors on Linux
Jan 20, 2021
a1a5242
need to use mem::SharedPtr instead of std::unique_ptr
Jan 25, 2021
07f4160
Merge branch 'master' into develop/main-to-master
Jan 25, 2021
4029339
projects\csm changes from "main"
Jan 25, 2021
b61316e
"samples" from main branch
Jan 25, 2021
152624f
need to use mem::SharedPtr instead of std::shared_ptr
Jan 25, 2021
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
512 changes: 284 additions & 228 deletions six/modules/c++/samples/check_valid_six.cpp

Large diffs are not rendered by default.

29 changes: 13 additions & 16 deletions six/modules/c++/samples/crop_sicd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
* see <http://www.gnu.org/licenses/>.
*
*/
#include <six/sicd/CropUtils.h>

#include <memory>
#include <iostream>
#include <stdexcept>

#include <six/sicd/CropUtils.h>

#include <cli/ArgumentParser.h>
#include <except/Exception.h>
#include <str/Convert.h>
Expand All @@ -34,6 +33,9 @@
#include <six/XMLControlFactory.h>
#include "utils.h"

#include <sys/Filesystem.h>
namespace fs = std::filesystem;

namespace
{
void parseECEF(cli::Results& options, std::vector<scene::Vector3>& ecef)
Expand All @@ -48,7 +50,7 @@ void parseECEF(cli::Results& options, std::vector<scene::Vector3>& ecef)
if (values.size() != 3)
{
throw except::Exception(Ctxt("Expected 3 values but got " +
str::toString(values.size())));
std::to_string(values.size())));
}

scene::Vector3& ecefCur(ecef[ii]);
Expand All @@ -71,7 +73,7 @@ void parseLatLon(cli::Results& options, std::vector<scene::LatLonAlt>& latLon)
if (values.size() != 2 && values.size() != 3)
{
throw except::Exception(Ctxt("Expected 2 or 3 values but got " +
str::toString(values.size())));
std::to_string(values.size())));
}

scene::LatLonAlt& latLonCur(latLon[ii]);
Expand All @@ -89,16 +91,11 @@ int main(int argc, char** argv)
{
try
{
sys::OS os;
const sys::Path::StringPair splitName(sys::Path::splitPath(
os.getCurrentExecutable(argv[0])));
const sys::Path progDirname(splitName.first);
const sys::Path installPath(progDirname.join("..").getAbsolutePath());

const sys::Path nitroDir(
installPath.join("share").join("nitf").join("plugins"));
const sys::Path schemaDir(
installPath.join("conf").join("schema").join("six"));
const fs::path argv0(argv[0]);
const auto progDirname = argv0.parent_path();
const auto installPath = fs::absolute(progDirname.parent_path());
const auto nitroDir = installPath / "share" / "nitf" / "plugins";
const auto schemaDir = installPath / "conf" / "schema" / "six";

// Parse the command line
cli::ArgumentParser parser;
Expand Down Expand Up @@ -126,7 +123,7 @@ int main(int argc, char** argv)
"Specify a schema or directory of schemas "
"(or set SIX_SCHEMA_PATH). Use \"\" as value to "
"skip schema validation.",
cli::STORE)->setDefault(schemaDir);
cli::STORE)->setDefault(schemaDir.string());
parser.addArgument("--require-aoi-in-bounds",
"When the AOI is specified in ECEF or lat/lon, by "
"default it will be trimmed to be within the "
Expand All @@ -141,7 +138,7 @@ int main(int argc, char** argv)
parser.addArgument("output", "Output SICD pathname", cli::STORE,
"output", "<output SICD pathname>", 1, 1);

const std::auto_ptr<cli::Results> options(parser.parse(argc, argv));
const std::unique_ptr<cli::Results> options(parser.parse(argc, argv));
const std::string inPathname(options->get<std::string> ("input"));
const std::string outPathname(options->get<std::string> ("output"));
const bool trimCornersIfNeeded =
Expand Down
5 changes: 2 additions & 3 deletions six/modules/c++/samples/crop_sidd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
* see <http://www.gnu.org/licenses/>.
*
*/
#include <six/sidd/CropUtils.h>

#include <memory>
#include <iostream>
#include <stdexcept>

#include <six/sidd/CropUtils.h>

#include <cli/ArgumentParser.h>
#include <except/Exception.h>
#include <str/Convert.h>
Expand Down Expand Up @@ -58,7 +57,7 @@ int main(int argc, char** argv)
parser.addArgument("output", "Output SIDD pathname", cli::STORE,
"output", "<output SIDD pathname>", 1, 1);

const std::auto_ptr<cli::Results> options(parser.parse(argc, argv));
const std::unique_ptr<cli::Results> options(parser.parse(argc, argv));
const types::RowCol<size_t> aoiOffset(options->get<size_t>("sRow"),
options->get<size_t>("sCol"));
const types::RowCol<size_t> aoiDims(options->get<size_t>("numRows"),
Expand Down
14 changes: 8 additions & 6 deletions six/modules/c++/samples/extract_cphd_xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@
#include <string.h>
#include <vector>
#include <iostream>
#include <thread>

#define CODA_OSS_AUGMENT_std_namespace 1
#include <sys/Path.h>
#include <nitf/coda-oss.hpp>
#include <import/cli.h>
#include <import/io.h>

#include <cphd/CPHDReader.h>
#include <cphd/CPHDXMLControl.h>

#include <sys/Filesystem.h>
namespace fs = std::filesystem;

/*!
* This extracts raw XML from a CPHD file using the CPHD module
*/
Expand All @@ -52,7 +54,7 @@ int main(int argc, char** argv)
"", 1, 1, false)->setDefault("");

// Parse!
const std::auto_ptr<cli::Results>
const std::unique_ptr<cli::Results>
options(parser.parse(argc, (const char**) argv));

const bool prettyPrint = options->get<bool>("prettyPrint");
Expand All @@ -71,7 +73,7 @@ int main(int argc, char** argv)
// Fill out basename if not user specified
if (basename.empty())
{
basename = sys::Path::basename(inputFile, true);
basename = fs::path(inputFile).stem();
}
std::string outPathname = basename + ".xml";

Expand All @@ -82,7 +84,7 @@ int main(int argc, char** argv)
}

// Reads in CPHD and verifies XML using schema
cphd::CPHDReader reader(inputFile, sys::OS().getNumCPUs());
cphd::CPHDReader reader(inputFile, std::thread::hardware_concurrency());
cphd::CPHDXMLControl xmlControl;
std::string xml = xmlControl.toXMLString(reader.getMetadata(), schemaPathnames, prettyPrint);

Expand Down
14 changes: 8 additions & 6 deletions six/modules/c++/samples/image_to_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
#include <six/sicd/ComplexXMLControl.h>
#include <six/sidd/DerivedXMLControl.h>

#include <sys/Filesystem.h>
namespace fs = std::filesystem;

namespace
{
void usage(const std::string& progname, std::ostream& ostr)
Expand All @@ -48,9 +51,8 @@ void usage(const std::string& progname, std::ostream& ostr)
<< "-image_to_ground must be specified\n\n";
}

class Converter
struct Converter final
{
public:
Converter(const std::string& pathname);

void groundToImage(const scene::Vector3& groundPt) const;
Expand All @@ -63,8 +65,8 @@ class Converter
void imageToGround(double row, double col) const;

private:
std::auto_ptr<const scene::SceneGeometry> mGeometry;
std::auto_ptr<const scene::ProjectionModel> mProjModel;
std::unique_ptr<const scene::SceneGeometry> mGeometry;
std::unique_ptr<const scene::ProjectionModel> mProjModel;
scene::Vector3 mGroundPlaneNormal;

types::RowCol<double> mSampleSpacing;
Expand All @@ -89,7 +91,7 @@ Converter::Converter(const std::string& pathname)
reader.load(pathname);

// Verify it's a SICD
mem::SharedPtr<const six::Container> container(reader.getContainer());
auto container(reader.getContainer());
if (container->getDataType() != six::DataType::COMPLEX)
{
throw except::InvalidFormatException(Ctxt("Expected a SICD NITF"));
Expand Down Expand Up @@ -164,7 +166,7 @@ int main(int argc, char** argv)
try
{
// Parse the command line
const std::string progname(sys::Path::basename(argv[0]));
const std::string progname(fs::path(argv[0]).filename());
if (argc < 2)
{
usage(progname, std::cerr);
Expand Down
8 changes: 4 additions & 4 deletions six/modules/c++/samples/project_slant_to_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void findOutputToSlantPolynomials(const six::sicd::ComplexData& complexData,
size_t polyOrderX, size_t polyOrderY,
six::Poly2D& toSlantRow, six::Poly2D& toSlantCol)
{
std::auto_ptr<scene::ProjectionPolynomialFitter> polynomialFitter(
std::unique_ptr<scene::ProjectionPolynomialFitter> polynomialFitter(
six::sicd::Utilities::getPolynomialFitter(complexData));
const six::RowColDouble sampleSpacing(
complexData.grid->row->sampleSpacing,
Expand Down Expand Up @@ -89,7 +89,7 @@ int main(int argc, char** argv)
parser.addArgument("output", "Output SIO Pathname", cli::STORE,
"output", "OUTPUT", 1, 1);

const std::auto_ptr<cli::Results> options(parser.parse(argc, argv));
const std::unique_ptr<cli::Results> options(parser.parse(argc, argv));

const std::string sicdPathname(options->get<std::string>("input"));
const std::string outputPathname(options->get<std::string>("output"));
Expand All @@ -102,7 +102,7 @@ int main(int argc, char** argv)
registry.addCreator(six::DataType::COMPLEX,
new six::XMLControlCreatorT<six::sicd::ComplexXMLControl>());

std::auto_ptr<six::sicd::ComplexData> complexData;
std::unique_ptr<six::sicd::ComplexData> complexData;
std::vector<std::complex<float> > buffer;
six::sicd::Utilities::readSicd(sicdPathname, schemaPaths, complexData,
buffer);
Expand All @@ -123,7 +123,7 @@ int main(int argc, char** argv)

toSlantRow = toSlantRow.flipXY();
toSlantCol = toSlantCol.flipXY();
mem::ScopedArray<float> outputArray(new float[
std::unique_ptr<float[]> outputArray(new float[
plane.xDirection->elements * plane.yDirection->elements]);
// Iterate over output plane, grabbing the appropriate input point
for (size_t outRow = 0; outRow < plane.xDirection->elements; ++outRow)
Expand Down
Loading