Skip to content

Commit

Permalink
add ostream ops, some doc fixes, and bugfix transaction ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
novas0x2a committed Oct 18, 2011
1 parent df65fc4 commit 9e28159
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 9 deletions.
6 changes: 5 additions & 1 deletion src/vw/Plate/FundamentalTypes.cc
Expand Up @@ -85,7 +85,11 @@ TransactionOrNeg TransactionRange::last() const {
if (second.newest())
return second;
else
return second.promote()+1;
return second.promote();
}

std::ostream& operator<<(std::ostream& o, const vw::platefile::TransactionRange& range) {
return (o << "range(" << range.first() << "," << range.last() << ")");
}

std::ostream& operator<<(std::ostream& o, const vw::platefile::TileHeader& hdr) {
Expand Down
2 changes: 2 additions & 0 deletions src/vw/Plate/FundamentalTypes.h
Expand Up @@ -133,6 +133,8 @@ class TransactionRange : private std::pair<TransactionOrNeg, TransactionOrNeg> {
TransactionOrNeg last() const;
};

std::ostream& operator<<(std::ostream& o, const vw::platefile::TransactionRange& range);

// We can't edit the protobuf-generated code, so this is next best place for this
class TileHeader;
std::ostream& operator<<(std::ostream& o, const vw::platefile::TileHeader& hdr);
Expand Down
3 changes: 1 addition & 2 deletions src/vw/Plate/PlateFile.h
Expand Up @@ -260,8 +260,7 @@ namespace platefile {

/// Read one ore more images at a specified location in the
/// platefile by specifying a range of transaction ids of
/// interest. This range is inclusive of the first entry, but not
/// the last entry: [ begin_transaction_id, end_transaction_id )
/// interest. This range is inclusive at both ends.
///
/// This is mostly useful when compositing tiles during mipmapping.
std::list<TileHeader>
Expand Down
13 changes: 13 additions & 0 deletions src/vw/Plate/detail/Blobstore.cc
Expand Up @@ -68,6 +68,13 @@ Datastore::meta_range Blobstore::head(uint32 level, uint32 row, uint32 col, Tran
typedef std::vector<TileHeader> vec_t;
boost::shared_ptr<vec_t> tiles;

vw_out(VerboseDebugMessage, "datastore") << "Blobstore::head("
<< "level=" << level
<< ", row=" << row
<< ", col=" << col
<< ", range=" << range
<< ", limit=" << limit << ")" << std::endl;

{
std::list<TileHeader> hdrs = m_index->search_by_location(col, row, level, range.first(), range.last(), false);
size_t len = hdrs.size();
Expand All @@ -86,6 +93,12 @@ Datastore::meta_range Blobstore::head(uint32 level, const BBox2u& region, Tran
typedef std::vector<TileHeader> vec_t;
boost::shared_ptr<vec_t> tiles;

vw_out(VerboseDebugMessage, "datastore") << "Blobstore::head("
<< "level=" << level
<< ", region=" << region
<< ", range=" << range
<< ", limit=" << limit << ")" << std::endl;

{
std::list<TileHeader> hdrs = m_index->search_by_region(level, region, range.first(), range.last(), 0, false);
size_t len = hdrs.size();
Expand Down
3 changes: 1 addition & 2 deletions src/vw/Plate/detail/Index.h
Expand Up @@ -103,8 +103,7 @@ namespace detail {
bool fetch_one_additional_entry = false) const = 0;

/// Return multiple tile headers that match the specified
/// transaction id range. This range is inclusive of the first
/// entry, but not the last entry: [ begin_transaction_id, end_transaction_id )
/// transaction id range. This range is inclusive at both ends.
virtual std::list<TileHeader> search_by_location(int col, int row, int level,
TransactionOrNeg start_transaction_id,
TransactionOrNeg end_transaction_id,
Expand Down
2 changes: 1 addition & 1 deletion src/vw/Plate/image2plate.cc
Expand Up @@ -117,7 +117,7 @@ int main( int argc, char *argv[] ) {
po::store( po::command_line_parser( argc, argv ).options(options).positional(p).run(), vm );
po::notify( vm );
} catch (const po::error &e) {
std::cout << "An error occured while parsing command line arguments.\n\n";
std::cout << "An error occured while parsing command line arguments: " << e.what() << std::endl;
std::cout << usage.str();
return 0;
}
Expand Down
2 changes: 2 additions & 0 deletions src/vw/gui/GlPreviewWidget.cc
Expand Up @@ -826,10 +826,12 @@ void GlPreviewWidget::keyPressEvent(QKeyEvent *event) {

switch (event->key()) {
case Qt::Key_Plus: // Increase transaction id
case Qt::Key_Equal:
m_current_transaction_id++;
m_gl_texture_cache->clear();
break;
case Qt::Key_Minus: // Decrease transaction id
case Qt::Key_Underscore:
m_current_transaction_id--;
m_gl_texture_cache->clear();
break;
Expand Down
4 changes: 1 addition & 3 deletions src/vw/gui/PlatefileTileGenerator.cc
Expand Up @@ -126,9 +126,7 @@ boost::shared_ptr<SrcImageResource> generate_tile_impl(TileLocator const& tile_i

boost::shared_ptr<SrcImageResource> PlatefileTileGenerator::generate_tile(TileLocator const& tile_info) {

vw_out(DebugMessage, "gui") << "Request to generate platefile tile "
<< tile_info.col << " " << tile_info.row
<< " @ " << tile_info.level << "\n";
vw_out(DebugMessage, "gui.platefile") << "generate_tile: " << tile_info << std::endl;

VW_DELEGATE_BY_PIXEL_TYPE(generate_tile_impl, tile_info, m_platefile)

Expand Down
4 changes: 4 additions & 0 deletions src/vw/gui/TileGenerator.cc
Expand Up @@ -36,6 +36,10 @@ void ConstantSrc::read( ImageBuffer const& dst, BBox2i const& bbox ) const {
convert(dst, src, true);
}

std::ostream& operator<<(std::ostream& o, const TileLocator& l) {
o << l.col << "," << l.row << "@" << l.level << ", t=" << l.transaction_id << " exact=" << (l.exact_transaction_id_match ? "YES" : "NO");
return o;
}

BBox2i tile_to_bbox(Vector2i tile_size, int col, int row, int level, int max_level) {
if (col < 0 || row < 0 || col >= (1 << max_level) || row >= (1 << max_level) ) {
Expand Down
2 changes: 2 additions & 0 deletions src/vw/gui/TileGenerator.h
Expand Up @@ -52,6 +52,8 @@ namespace gui {
}
};

std::ostream& operator<<(std::ostream& o, const TileLocator& l);

// Given a tile index, return the bounding box of that tile coverage
// in the bottom (i.e. highest resolution) level of the source image
// pyramid.
Expand Down

0 comments on commit 9e28159

Please sign in to comment.