Permalink
Browse files

Move ASP Common implementations into a source file

This allows for use of Common objects inside other libraries.
  • Loading branch information...
1 parent 7e52275 commit 618caf1cc30dd078f149ebac5f714aa5608957c2 Zack Moratto committed Jun 17, 2011
Showing with 97 additions and 73 deletions.
  1. +13 −13 configure.ac
  2. +76 −0 src/asp/Core/Common.cc
  3. +6 −58 src/asp/Core/Common.h
  4. +2 −2 src/asp/Core/Makefile.am
View
@@ -364,23 +364,23 @@ AX_APP(STEREO, [src/asp/Tools], yes, [SESSIONS])
AX_APP(ORTHOPROJECT, [src/asp/Tools], yes, [SESSIONS])
AX_APP(BUNDLEADJUST, [src/asp/Tools], no, [VW_BUNDLEADJUSTMENT SESSIONS])
AX_APP(ORBITVIZ, [src/asp/Tools], yes, [SESSIONS])
-AX_APP(DISPARITYDEBUG, [src/asp/Tools], yes, [VW_STEREO])
-AX_APP(POINT2MESH, [src/asp/Tools], yes, [OPENSCENEGRAPH VW])
+AX_APP(DISPARITYDEBUG, [src/asp/Tools], yes, [VW_STEREO CORE])
+AX_APP(POINT2MESH, [src/asp/Tools], yes, [OPENSCENEGRAPH VW CORE])
AX_APP(POINT2DEM, [src/asp/Tools], yes, [CORE])
AX_APP(RMAX2CAHVOR, [src/asp/Tools], no, [SESSIONS])
AX_APP(RMAXADJUST, [src/asp/Tools], no, [VW_BUNDLEADJUSTMENT SESSIONS])
-AX_APP(BUNDLEVIS, [src/asp/Tools], no, [OPENSCENEGRAPH VW_BUNDLEADJUSTMENT])
+AX_APP(BUNDLEVIS, [src/asp/Tools], no, [OPENSCENEGRAPH VW_BUNDLEADJUSTMENT CORE])
AX_APP(ISISADJUST, [src/asp/Tools], yes, [VW_BUNDLEADJUSTMENT ISISIO CORE])
-AX_APP(RESULTS, [src/asp/Tools], no, [ISISIO])
-AX_APP(RECONSTRUCT, [src/asp/Tools], no, [VW_PHOTOMETRY VW_CARTOGRAPHY VW])
-AX_APP(ALIGNDEM, [src/asp/Tools], no, [VW_MOSAIC VW_CARTOGRAPHY VW_INTEREST_POINT])
-AX_APP(GEODIFF, [src/asp/Tools], no, [VW_CARTOGRAPHY VW BOOST])
-AX_APP(DEMPROFILE, [src/asp/Tools], no, [VW_CARTOGRAPHY VW])
-AX_APP(PLATEORTHOPROJECT,[src/asp/Tools], no, [SESSIONS ISISIO VW_PLATE])
-AX_APP(HSVMERGE, [src/asp/Tools], yes, [VW_CARTOGRAPHY VW])
-AX_APP(ISISADJUSTCAMERAERR, [src/asp/Tools], no, [ISISIO CORE VW_BUNDLEADJUSTMENT])
-AX_APP(ISISADJUSTCNETCLIP, [src/asp/Tools], no, [ISISIO CORE VW_BUNDLEADJUSTMENT])
-AX_APP(MER2CAMERA, [src/asp/Tools], yes, [VW_CAMERA VW])
+AX_APP(RESULTS, [src/asp/Tools], no, [CORE ISISIO])
+AX_APP(RECONSTRUCT, [src/asp/Tools], no, [VW VW_PHOTOMETRY VW_CARTOGRAPHY ])
+AX_APP(ALIGNDEM, [src/asp/Tools], no, [VW_MOSAIC VW_CARTOGRAPHY VW_INTEREST_POINT CORE])
+AX_APP(GEODIFF, [src/asp/Tools], no, [BOOST VW VW_CARTOGRAPHY CORE])
+AX_APP(DEMPROFILE, [src/asp/Tools], no, [VW VW_CARTOGRAPHY CORE])
+AX_APP(PLATEORTHOPROJECT,[src/asp/Tools], no, [VW_PLATE CORE SESSIONS ISISIO])
+AX_APP(HSVMERGE, [src/asp/Tools], yes, [VW VW_CARTOGRAPHY CORE])
+AX_APP(ISISADJUSTCAMERAERR, [src/asp/Tools], no, [VW_BUNDLEADJUSTMENT CORE ISISIO])
+AX_APP(ISISADJUSTCNETCLIP, [src/asp/Tools], no,[VW_BUNDLEADJUSTMENT CORE ISISIO])
+AX_APP(MER2CAMERA, [src/asp/Tools], yes, [VW VW_CAMERA CORE])
# Toolkits (like module, but doesn't build a library)
AX_MODULE(CONTROLNETTK, [src/asp/ControlNetTK], [], no, [VW_BUNDLEADJUSTMENT ISISIO], [BOOST])
View
@@ -0,0 +1,76 @@
+// __BEGIN_LICENSE__
+// Copyright (C) 2006-2011 United States Government as represented by
+// the Administrator of the National Aeronautics and Space Administration.
+// All Rights Reserved.
+// __END_LICENSE__
+
+#include <asp/Core/Common.h>
+
+using namespace vw;
+namespace po = boost::program_options;
+
+asp::BaseOptions::BaseOptions() {
+#if defined(VW_HAS_BIGTIFF) && VW_HAS_BIGTIFF == 1
+ gdal_options["COMPRESS"] = "LZW";
+#else
+ gdal_options["COMPRESS"] = "NONE";
+ gdal_options["BIGTIFF"] = "NO";
+#endif
+ raster_tile_size =
+ Vector2i(vw_settings().default_tile_size(),
+ vw_settings().default_tile_size());
+}
+
+asp::BaseOptionsDescription::BaseOptionsDescription( asp::BaseOptions& opt ) {
+ namespace po = boost::program_options;
+ (*this).add_options()
+ ("threads", po::value(&opt.num_threads)->default_value(0),
+ "Select the number of processors (threads) to use.")
+ ("no-bigtiff", "Tell GDAL to not create bigtiffs.")
+ ("help,h", "Display this help message");
+}
+
+po::variables_map
+asp::check_command_line( int argc, char *argv[], BaseOptions& opt,
+ po::options_description const& public_options,
+ po::options_description const& hidden_options,
+ po::positional_options_description const& positional,
+ std::string const& help ) {
+ po::variables_map vm;
+ try {
+ po::options_description all_options;
+ all_options.add(public_options).add(hidden_options);
+ po::store( po::command_line_parser( argc, argv ).options(all_options).positional(positional).run(), vm );
+ po::notify( vm );
+ } catch (po::error const& e) {
+ vw::vw_throw( vw::ArgumentErr() << "Error parsing input:\n"
+ << e.what() << "\n" << help << "\n" << public_options );
+ }
+ // We really don't want to use BIGTIFF unless we have to. It's
+ // hard to find viewers for bigtiff.
+ if ( vm.count("no-bigtiff") ) {
+ opt.gdal_options["BIGTIFF"] = "NO";
+ } else {
+ opt.gdal_options["BIGTIFF"] = "IF_SAFER";
+ }
+ if ( vm.count("help") )
+ vw::vw_throw( vw::ArgumentErr() << help << "\n" << public_options );
+ if ( opt.num_threads != 0 ) {
+ vw::vw_out() << "\t--> Setting number of processing threads to: "
+ << opt.num_threads << std::endl;
+ vw::vw_settings().set_default_num_threads(opt.num_threads);
+ }
+
+ return vm;
+}
+
+bool asp::has_cam_extension( std::string const& input ) {
+ boost::filesystem::path ipath( input );
+ std::string ext = ipath.extension();
+ if ( ext == ".cahvor" || ext == ".cahv" ||
+ ext == ".pin" || ext == ".pinhole" ||
+ ext == ".tsai" || ext == ".cmod" ||
+ ext == ".cahvore" )
+ return true;
+ return false;
+}
View
@@ -21,80 +21,28 @@
namespace asp {
+ // Standard Options
struct BaseOptions {
vw::DiskImageResourceGDAL::Options gdal_options;
vw::Vector2i raster_tile_size;
vw::uint32 num_threads;
- BaseOptions() {
-#if defined(VW_HAS_BIGTIFF) && VW_HAS_BIGTIFF == 1
- gdal_options["COMPRESS"] = "LZW";
-#else
- gdal_options["COMPRESS"] = "NONE";
- gdal_options["BIGTIFF"] = "NO";
-#endif
- raster_tile_size =
- vw::Vector2i(vw::vw_settings().default_tile_size(),
- vw::vw_settings().default_tile_size());
- }
+ BaseOptions();
};
+ // An object to let Program Options know about our standard options
struct BaseOptionsDescription : public boost::program_options::options_description {
- BaseOptionsDescription( BaseOptions& opt) {
- namespace po = boost::program_options;
- (*this).add_options()
- ("threads", po::value(&opt.num_threads)->default_value(0),
- "Select the number of processors (threads) to use.")
- ("no-bigtiff", "Tell GDAL to not create bigtiffs.")
- ("help,h", "Display this help message");
- }
+ BaseOptionsDescription( BaseOptions& opt);
};
boost::program_options::variables_map
check_command_line( int argc, char *argv[], BaseOptions& opt,
boost::program_options::options_description const& public_options,
boost::program_options::options_description const& hidden_options,
boost::program_options::positional_options_description const& positional,
- std::string const& help ) {
- namespace po = boost::program_options;
- po::variables_map vm;
- try {
- po::options_description all_options;
- all_options.add(public_options).add(hidden_options);
- po::store( po::command_line_parser( argc, argv ).options(all_options).positional(positional).run(), vm );
- po::notify( vm );
- } catch (po::error const& e) {
- vw::vw_throw( vw::ArgumentErr() << "Error parsing input:\n"
- << e.what() << "\n" << help << "\n" << public_options );
- }
- // We really don't want to use BIGTIFF unless we have to. It's
- // hard to find viewers for bigtiff.
- if ( vm.count("no-bigtiff") ) {
- opt.gdal_options["BIGTIFF"] = "NO";
- } else {
- opt.gdal_options["BIGTIFF"] = "IF_SAFER";
- }
- if ( vm.count("help") )
- vw::vw_throw( vw::ArgumentErr() << help << "\n" << public_options );
- if ( opt.num_threads != 0 ) {
- vw::vw_out() << "\t--> Setting number of processing threads to: "
- << opt.num_threads << std::endl;
- vw::vw_settings().set_default_num_threads(opt.num_threads);
- }
-
- return vm;
- }
+ std::string const& help );
- bool has_cam_extension( std::string input ) {
- boost::filesystem::path ipath( input );
- std::string ext = ipath.extension();
- if ( ext == ".cahvor" || ext == ".cahv" ||
- ext == ".pin" || ext == ".pinhole" ||
- ext == ".tsai" || ext == ".cmod" ||
- ext == ".cahvore" )
- return true;
- return false;
- }
+ bool has_cam_extension( std::string const& input );
template <class ImageT>
vw::DiskImageResourceGDAL*
View
@@ -23,8 +23,8 @@ include_HEADERS = BlobIndexThreaded.h StereoSettings.h SparseView.h \
SoftwareRenderer.h ErodeView.h $(ba_headers) Macros.h \
Common.h ThreadedEdgeMask.h
-libaspCore_la_SOURCES = BlobIndexThreaded.cc SoftwareRenderer.cc \
- StereoSettings.cc $(ba_sources)
+libaspCore_la_SOURCES = BlobIndexThreaded.cc Common.cc \
+ SoftwareRenderer.cc StereoSettings.cc $(ba_sources)
libaspCore_la_LIBADD = @MODULE_CORE_LIBS@

0 comments on commit 618caf1

Please sign in to comment.