Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

gui: Make plate module optional

This gui is actually a very handy debug tool for me.
  • Loading branch information...
commit 6f6e1afbdc3893b005c6cd077cd7d8a2f458d469 1 parent c87d91f
@zmoratto zmoratto authored
Showing with 42 additions and 20 deletions.
  1. +1 −1  configure.ac
  2. +14 −7 src/vw/gui/Makefile.am
  3. +27 −12 src/vw/gui/TileGenerator.cc
View
2  configure.ac
@@ -447,7 +447,7 @@ AS_IF([test x"$MAKE_MODULE_PLATE" = "xyes"],
[AC_MSG_WARN([You have neither rabbitmq_c nor zeromq. Plate network support will be disabled.])])])])
AX_MODULE(TOOLS, [src/vw/tools], [], yes, [VW], [BOOST_FILESYSTEM BOOST_PROGRAM_OPTIONS THREADS])
-AX_MODULE(GUI, [src/vw/gui], [], no, [PLATE VW], [QT BOOST_PROGRAM_OPTIONS GL])
+AX_MODULE(GUI, [src/vw/gui], [], no, [VW], [QT BOOST_PROGRAM_OPTIONS GL], [PLATE])
AX_MODULE_PYTHON( [src/vw/Python], [no])
if test $host_vendor = apple; then
View
21 src/vw/gui/Makefile.am
@@ -30,19 +30,23 @@ vwv_SOURCES = \
GlPreviewWidget.cc \
ImageTileGenerator.cc \
MainWindow.cc \
- PlatefileTileGenerator.cc \
TestPatternTileGenerator.cc \
TextureCache.cc \
TileGenerator.cc \
- vwv.cc \
- WebTileGenerator.cc
+ vwv.cc
BUILT_SOURCES = \
GlPreviewWidget.moc.cc \
- MainWindow.moc.cc \
- WebTileGenerator.moc.cc
+ MainWindow.moc.cc
-vwv_LDADD = @PKG_GUI_LIBS@ @PKG_PLATE_LIBS@
+vwv_LDADD = @PKG_GUI_LIBS@
+
+if MAKE_MODULE_PLATE
+ vwv_LDADD += @PKG_PLATE_LIBS@
+ vwv_SOURCES += PlatefileTileGenerator.cc \
+ WebTileGenerator.cc
+ BUILT_SOURCES += WebTileGenerator.moc.cc
+endif
bin_PROGRAMS = vwv
@@ -52,7 +56,10 @@ endif
# general
########################################################################
-AM_CPPFLAGS = @VW_CPPFLAGS@ @PKG_GUI_CPPFLAGS@ @PKG_PLATE_CPPFLAGS@
+AM_CPPFLAGS = @VW_CPPFLAGS@ @PKG_GUI_CPPFLAGS@
+if MAKE_MODULE_PLATE
+ AM_CPPFLAGS += @PKG_PLATE_CPPFLAGS@
+endif
AM_LDFLAGS = @VW_LDFLAGS@
includedir = $(prefix)/include/vw
View
39 src/vw/gui/TileGenerator.cc
@@ -7,16 +7,19 @@
#include <vw/gui/TileGenerator.h>
#include <vw/gui/ImageTileGenerator.h>
-#include <vw/gui/PlatefileTileGenerator.h>
#include <vw/gui/TestPatternTileGenerator.h>
-#include <vw/gui/WebTileGenerator.h>
-#include <vw/Plate/HTTPUtils.h>
#include <vw/Core/Debugging.h>
#include <boost/filesystem/convenience.hpp>
-namespace fs = boost::filesystem;
+#if HAVE_PKG_VW_PLATE
+#include <vw/Plate/HTTPUtils.h>
+#include <vw/gui/WebTileGenerator.h>
+#include <vw/gui/PlatefileTileGenerator.h>
using namespace vw::platefile;
+#endif
+
+namespace fs = boost::filesystem;
namespace vw { namespace gui {
@@ -92,28 +95,40 @@ std::list<TileLocator> bbox_to_tiles(Vector2i tile_size, BBox2i bbox, int level,
boost::shared_ptr<TileGenerator> TileGenerator::create(std::string filename_) {
+ typedef boost::shared_ptr<TileGenerator> TileGenPtr;
+
+#if HAVE_PKG_PLATE
// Remove trailing /
boost::trim_right_if(filename_, boost::is_any_of("/"));
Url u(filename_);
try {
if (u.scheme() == "http") {
- return boost::shared_ptr<TileGenerator>( new WebTileGenerator(u.string(),17));
+ return TileGenPtr( new WebTileGenerator(u.string(),17));
} else if (u.scheme() == "file") {
- if (fs::extension(u.path()) == ".plate")
- return boost::shared_ptr<TileGenerator>( new PlatefileTileGenerator(u.path()) );
- else if (u.path() == "testpattern")
- return boost::shared_ptr<TileGenerator>( new TestPatternTileGenerator(256) );
+ if (u.path() == "testpattern")
+ return TileGenPtr( new TestPatternTileGenerator(256) );
+ else if (fs::extension(u.path()) == ".plate")
+ return TileGenPtr( new PlatefileTileGenerator(u.path()) );
else
- return boost::shared_ptr<TileGenerator>( new ImageTileGenerator(u.path()) );
+ return TileGenPtr( new ImageTileGenerator(u.path()) );
} else if (fs::extension(u.path()) == ".plate") {
- return boost::shared_ptr<TileGenerator>( new PlatefileTileGenerator(u.string()) );
+ return TileGenPtr( new PlatefileTileGenerator(u.string()) );
} else {
- std::cerr << "Could not open " << u << ":\n\t" << "No handler for url scheme " << u.scheme() << std::endl;
+ std::cerr << "Could not open " << u << ":\n\t"
+ << "No handler for url scheme " << u.scheme() << std::endl;
}
} catch (const vw::Exception& e) {
std::cerr << "Could not open " << u << ":\n\t" << e.what() << std::endl;
}
+#else
+ try {
+ return TileGenPtr( new ImageTileGenerator(filename_) );
+ } catch (const vw::Exception& e) {
+ std::cerr << "Could not open " << filename_ << ":\n\t" << e.what() << std::endl;
+ }
+#endif
+
exit(EXIT_FAILURE);
}
Please sign in to comment.
Something went wrong with that request. Please try again.