Scroom  0.14
tiledbitmapviewdata.hh
Go to the documentation of this file.
1 /*
2  * Scroom - Generic viewer for 2D data
3  * Copyright (C) 2009-2022 Kees-Jan Dijkzeul
4  *
5  * SPDX-License-Identifier: LGPL-2.1
6  */
7 
8 #pragma once
9 
10 #include <boost/shared_ptr.hpp>
11 
12 #include <gtk/gtk.h>
13 
14 #include <scroom/bookkeeping.hh>
15 #include <scroom/observable.hh>
17 #include <scroom/viewinterface.hh>
18 
20  : virtual public Scroom::Utils::Base
21  , public TileLoadingObserver
22  , public ProgressInterface
23 {
24 public:
25  using Ptr = boost::shared_ptr<TiledBitmapViewData>;
26 
27 public:
31 
32 private:
34  int imin{0};
35  int imax{0};
36  int jmin{0};
37  int jmax{0};
38  int zoom{0};
40 
49 
57 
58  bool redrawPending{false};
59 
61  boost::mutex mut;
62 
63 private:
65 
66 public:
68 
69  void
71  void resetNeededTiles();
73  void clearVolatileStuff();
74 
75  // TileLoadingObserver ////////////////////////////////////////////////
76  void tileLoaded(ConstTile::Ptr tile) override;
77 
78  // ProgressInterface ///////////////////////////////////////////////////
79  void setIdle() override;
80  void setWaiting(double progress = 0.0) override;
81  void setWorking(double progress) override;
82  void setFinished() override;
83 };
TiledBitmapViewData::resetNeededTiles
void resetNeededTiles()
Definition: tiledbitmapviewdata.cc:65
TiledBitmapViewData::setFinished
void setFinished() override
Definition: tiledbitmapviewdata.cc:163
tiledbitmapviewdata.hh
TiledBitmapViewData::setIdle
void setIdle() override
Definition: tiledbitmapviewdata.cc:157
Scroom::Metadata::showMetaData
void showMetaData(GtkWindow *parent, std::string title, Metadata data)
Definition: showmetadata.cc:68
TiledBitmapViewData::setNeededTiles
void setNeededTiles(Layer::Ptr const &l, int imin, int imax, int jmin, int jmax, int zoom, LayerOperations::Ptr layerOperations)
Definition: tiledbitmapviewdata.cc:32
TiledBitmapViewData::viewInterface
ViewInterface::WeakPtr viewInterface
Definition: tiledbitmapviewdata.hh:28
OpenPresentationInterface::Ptr
boost::shared_ptr< OpenPresentationInterface > Ptr
Definition: scroominterface.hh:56
Scroom::Utils::StuffList
std::list< Stuff > StuffList
Definition: stuff.hh:20
load
void load(GtkFileFilterInfo const &info)
Definition: loader.cc:238
anonymous_namespace{tiledbitmappresentation.cc}::TiledBitmapPresentation
Definition: tiledbitmappresentation.cc:56
Scroom::GtkHelpers::async_on_ui_thread
void async_on_ui_thread(T f)
Definition: gtk-helpers.hh:42
PipetteLayerOperations::PipetteColor
std::vector< std::pair< std::string, double > > PipetteColor
Definition: pipettelayeroperations.hh:22
Layer::Ptr
boost::shared_ptr< Layer > Ptr
Definition: tiledbitmaplayer.hh:247
anonymous_namespace{tiledbitmappresentation.cc}::TiledBitmapPresentation::tbi
TiledBitmapInterface::Ptr tbi
Definition: tiledbitmappresentation.cc:70
TiledBitmapViewData::mut
boost::mutex mut
Definition: tiledbitmapviewdata.hh:61
anonymous_namespace{tiledbitmappresentation.cc}::TiledBitmapPresentation::colormapHelper
ColormapHelperBase::Ptr colormapHelper
Definition: tiledbitmappresentation.cc:73
anonymous_namespace{tiledbitmappresentation.cc}::TiledBitmapPresentation::pipetteLayerOperation
PipetteLayerOperations::Ptr pipetteLayerOperation
Definition: tiledbitmappresentation.cc:74
anonymous_namespace{tiledbitmappresentation.cc}::TiledBitmapPresentation::TiledBitmapPresentation
TiledBitmapPresentation(std::string &&name_, BitmapMetaData &&bmd_, TiledBitmapInterface::Ptr &&tbi_, std::map< std::string, std::string > &&properties_, ColormapHelperBase::Ptr &&colormapHelper_, PipetteLayerOperations::Ptr &&pipetteLayerOperation_)
Definition: tiledbitmappresentation.cc:144
TiledBitmap::create
static Ptr create(int bitmapWidth, int bitmapHeight, LayerSpec const &ls)
Definition: tiled-bitmap.cc:70
progressinterfacehelpers.hh
anonymous_namespace{tiledbitmappresentation.cc}::dividePipetteColors
PipetteLayerOperations::PipetteColor dividePipetteColors(PipetteLayerOperations::PipetteColor elements, const int divisor)
Definition: tiledbitmappresentation.cc:47
Scroom::TiledBitmap::LayerSpecForBitmap
LayerSpecResult LayerSpecForBitmap(const BitmapMetaData &bitmapMetaData)
Definition: layerspecforbitmap.cc:228
Scroom::MemoryBlocks::RawPageData::Ptr
boost::shared_ptr< uint8_t > Ptr
Definition: blockallocator.hh:23
showmetadata.hh
TiledBitmapViewData::clearVolatileStuff
void clearVolatileStuff()
Definition: tiledbitmapviewdata.cc:128
ConstTile::Ptr
boost::shared_ptr< ConstTile > Ptr
Definition: tile.hh:47
TiledBitmapViewData::progressInterface
ProgressInterface::Ptr progressInterface
Definition: tiledbitmapviewdata.hh:29
TiledBitmapViewData::volatileStuff
Scroom::Utils::StuffList volatileStuff
Definition: tiledbitmapviewdata.hh:56
Scroom::TiledBitmap::ToOpenPresentationInterface
OpenPresentationInterface::Ptr ToOpenPresentationInterface(OpenTiledBitmapInterface::Ptr openTiledBitmapInterface)
Definition: tiledbitmappresentation.cc:424
TiledBitmapViewData::Ptr
boost::shared_ptr< TiledBitmapViewData > Ptr
Definition: tiledbitmapviewdata.hh:25
ProgressInterface::Ptr
boost::shared_ptr< ProgressInterface > Ptr
Definition: progressinterface.hh:20
PipetteViewInterface
Definition: pipetteviewinterface.hh:16
Scroom::Utils::Rectangle::intersection
Rectangle intersection(const Rectangle &other) const
Definition: rectangle.hh:95
ViewInterface::Ptr
boost::shared_ptr< ViewInterface > Ptr
Definition: viewinterface.hh:193
anonymous_namespace{tiledbitmappresentation.cc}::TiledBitmapPresentation::add
void add(Scroom::Utils::Stuff s)
Definition: tiledbitmappresentation.cc:132
showmetadatainterface.hh
LayerSpec
std::vector< LayerOperations::Ptr > LayerSpec
Definition: tiledbitmapinterface.hh:190
ProgressInterface
Definition: progressinterface.hh:17
pipetteviewinterface.hh
observable.hh
require
#define require(expr)
Definition: assertions.hh:28
TileViewState::Ptr
boost::shared_ptr< TileViewState > Ptr
Definition: tileviewstate.hh:27
Scroom::TiledBitmap::to_metadata
Metadata::Metadata to_metadata(const BitmapMetaData &bmd)
Definition: layerspecforbitmap.cc:37
TiledBitmapViewData::layer
Layer::Ptr layer
Definition: tiledbitmapviewdata.hh:33
Scroom::TiledBitmap::BitmapMetaData
Definition: opentiledbitmapinterface.hh:41
PIPETTE_PROPERTY_NAME
const std::string PIPETTE_PROPERTY_NAME
Definition: pipetteviewinterface.hh:14
Scroom::GtkHelpers::sync_on_ui_thread
void sync_on_ui_thread(T f)
Definition: gtk-helpers.hh:59
anonymous_namespace{tiledbitmappresentation.cc}::TiledBitmapPresentation::Ptr
boost::shared_ptr< TiledBitmapPresentation > Ptr
Definition: tiledbitmappresentation.cc:63
TiledBitmapViewData::setWaiting
void setWaiting(double progress=0.0) override
Definition: tiledbitmapviewdata.cc:159
Scroom::TiledBitmap::ReloadFunction
std::function< Scroom::Utils::Stuff(const ProgressInterface::Ptr &)> ReloadFunction
Definition: opentiledbitmapinterface.hh:39
anonymous_namespace{tiledbitmappresentation.cc}::TiledBitmapPresentation::Views
std::set< ViewInterface::WeakPtr > Views
Definition: tiledbitmappresentation.cc:66
TransformationData::create
static Ptr create()
Definition: transformpresentation.cc:28
Scroom::TiledBitmap::OpenTiledBitmapInterface::Ptr
boost::shared_ptr< OpenTiledBitmapInterface > Ptr
Definition: opentiledbitmapinterface.hh:58
anonymous_namespace{tiledbitmappresentation.cc}::TiledBitmapPresentation::properties
std::map< std::string, std::string > properties
Definition: tiledbitmappresentation.cc:71
Scroom::TiledBitmap::BitmapMetaData::aspectRatio
boost::optional< Scroom::Utils::Point< double > > aspectRatio
Definition: opentiledbitmapinterface.hh:47
tiled-bitmap.hh
OpenPresentationInterface
Definition: scroominterface.hh:53
TiledBitmapViewData::create
static Ptr create(const ViewInterface::WeakPtr &viewInterface)
Definition: tiledbitmapviewdata.cc:20
METADATA_PROPERTY_NAME
const std::string METADATA_PROPERTY_NAME
Definition: showmetadatainterface.hh:16
Colormappable
Definition: colormappable.hh:113
opentiledbitmapinterface.hh
PresentationInterface::Ptr
boost::shared_ptr< PresentationInterface > Ptr
Definition: presentationinterface.hh:74
ViewInterface::WeakPtr
boost::weak_ptr< ViewInterface > WeakPtr
Definition: viewinterface.hh:194
Colormap::Ptr
boost::shared_ptr< Colormap > Ptr
Definition: colormappable.hh:31
TiledBitmapViewData::redrawPending
bool redrawPending
Definition: tiledbitmapviewdata.hh:58
colormap
const Colormap::Ptr colormap
Definition: colormaphelpers_test.cc:54
Scroom::TiledBitmap
Definition: opentiledbitmapinterface.hh:21
anonymous_namespace{tiledbitmappresentation.cc}::OpenTiledBitmapAsPresentation
Definition: tiledbitmappresentation.cc:351
anonymous_namespace{tiledbitmappresentation.cc}::OpenTiledBitmapAsPresentation::openTiledBitmapInterface
OpenTiledBitmapInterface::Ptr openTiledBitmapInterface
Definition: tiledbitmappresentation.cc:357
tiledbitmaplayer.hh
TiledBitmapViewData::imin
int imin
Definition: tiledbitmapviewdata.hh:34
Scroom::Utils::Base
Definition: utilities.hh:30
ColormapHelperBase::Ptr
boost::shared_ptr< ColormapHelperBase > Ptr
Definition: colormappable.hh:160
anonymous_namespace{tiledbitmappresentation.cc}::OpenTiledBitmapAsPresentation::OpenTiledBitmapAsPresentation
OpenTiledBitmapAsPresentation(OpenTiledBitmapInterface::Ptr openTiledBitmapInterface_)
Definition: tiledbitmappresentation.cc:371
TransformPresentation::create
static Ptr create(PresentationInterface::Ptr const &presentation, TransformationData::Ptr const &transformationData)
Definition: transformpresentation.cc:51
invalidate_view
static void invalidate_view(const ViewInterface::WeakPtr &vi)
Definition: tiledbitmapviewdata.cc:113
Scroom::Utils::Stuff
boost::shared_ptr< void > Stuff
Definition: stuff.hh:18
TiledBitmapViewData::imax
int imax
Definition: tiledbitmapviewdata.hh:35
PresentationBase
Definition: presentationinterface.hh:113
views
static Views views
Definition: callbacks.cc:56
viewinterface.hh
TiledBitmapViewData::stuff
Scroom::Utils::StuffList stuff
Definition: tiledbitmapviewdata.hh:48
anonymous_namespace{tiledbitmappresentation.cc}::TiledBitmapPresentation::name
std::string name
Definition: tiledbitmappresentation.cc:68
TiledBitmapViewData::layerOperations
LayerOperations::Ptr layerOperations
Definition: tiledbitmapviewdata.hh:39
drawOutOfBoundsWithoutBackground
void drawOutOfBoundsWithoutBackground(cairo_t *cr, Scroom::Utils::Rectangle< double > const &requestedPresentationArea, Scroom::Utils::Rectangle< double > const &actualPresentationArea, double pixelSize)
Definition: cairo-helpers.cc:93
anonymous_namespace{tiledbitmappresentation.cc}::OpenTiledBitmapAsPresentation::create
static Ptr create(OpenTiledBitmapInterface::Ptr openTiledBitmapInterface_)
Definition: tiledbitmappresentation.cc:360
Scroom::TiledBitmap::BitmapMetaData::colormapHelper
ColormapHelperBase::Ptr colormapHelper
Definition: opentiledbitmapinterface.hh:48
pixelSizeFromZoom
double pixelSizeFromZoom(int zoom)
Definition: cairo-helpers.cc:112
anonymous_namespace{tiledbitmappresentation.cc}::TiledBitmapPresentation::views
Views views
Definition: tiledbitmappresentation.cc:72
Colormappable::Ptr
boost::shared_ptr< Colormappable > Ptr
Definition: colormappable.hh:116
gtk-helpers.hh
anonymous_namespace{tiledbitmappresentation.cc}::TiledBitmapPresentation::bmd
Scroom::TiledBitmap::BitmapMetaData bmd
Definition: tiledbitmappresentation.cc:69
TiledBitmapViewData::storeVolatileStuff
void storeVolatileStuff(const Scroom::Utils::Stuff &stuff)
Definition: tiledbitmapviewdata.cc:122
CompressedTile::Ptr
boost::shared_ptr< CompressedTile > Ptr
Definition: tiledbitmaplayer.hh:108
TILESIZE
#define TILESIZE
Definition: tiledbitmaplayer.hh:28
TiledBitmapViewData::tileLoaded
void tileLoaded(ConstTile::Ptr tile) override
Definition: tiledbitmapviewdata.cc:142
LayerOperations::Ptr
boost::shared_ptr< LayerOperations > Ptr
Definition: tiledbitmapinterface.hh:53
TiledBitmapViewData::TiledBitmapViewData
TiledBitmapViewData(const ViewInterface::WeakPtr &viewInterface)
Definition: tiledbitmapviewdata.cc:25
TiledBitmapInterface::Ptr
boost::shared_ptr< TiledBitmapInterface > Ptr
Definition: tiledbitmapinterface.hh:239
TiledBitmapViewData::jmin
int jmin
Definition: tiledbitmapviewdata.hh:36
Scroom::Tiff::open
boost::optional< std::tuple< Scroom::TiledBitmap::BitmapMetaData, TIFFPtr > > open(const std::string &fileName)
Definition: tiffsource.cc:119
transformpresentation.hh
TiledBitmapViewData
Definition: tiledbitmapviewdata.hh:19
TiledBitmapViewData::setWorking
void setWorking(double progress) override
Definition: tiledbitmapviewdata.cc:161
Scroom::Bookkeeping::Token
Definition: bookkeeping.hh:37
Scroom::Utils::Rectangle< double >
ShowMetadataInterface
Definition: showmetadatainterface.hh:18
Scroom::Utils::roundOutward
Segment< double > roundOutward(Segment< double > s)
Definition: linearsegment.hh:240
TiledBitmapViewData::zoom
int zoom
Definition: tiledbitmapviewdata.hh:38
Color
Definition: color.hh:34
tileviewstate.hh
cairo-helpers.hh
TiledBitmapViewData::token
Scroom::Bookkeeping::Token token
Definition: tiledbitmapviewdata.hh:30
anonymous_namespace{tiledbitmappresentation.cc}::TiledBitmapPresentation::stuff
Scroom::Utils::StuffList stuff
Definition: tiledbitmappresentation.cc:75
create
void create(NewPresentationInterface *interface)
Definition: loader.cc:175
anonymous_namespace{tiledbitmappresentation.cc}::TiledBitmapPresentation::create
static TiledBitmapPresentation::Ptr create(std::string name_, BitmapMetaData bmd_, TiledBitmapInterface::Ptr tbi_, std::map< std::string, std::string > properties_, ColormapHelperBase::Ptr colormapHelper_, PipetteLayerOperations::Ptr pipetteLayerOperation_)
Definition: tiledbitmappresentation.cc:78
anonymous_namespace{tiledbitmappresentation.cc}::OpenTiledBitmapAsPresentation::getFilters
std::list< GtkFileFilter * > getFilters() override
Definition: tiledbitmappresentation.cc:366
bookkeeping.hh
TileLoadingObserver
Definition: tiledbitmaplayer.hh:80
TiledBitmapViewData::jmax
int jmax
Definition: tiledbitmapviewdata.hh:37
PipetteLayerOperations::Ptr
boost::shared_ptr< PipetteLayerOperations > Ptr
Definition: pipettelayeroperations.hh:21
anonymous_namespace{tiledbitmappresentation.cc}::sumPipetteColors
PipetteLayerOperations::PipetteColor sumPipetteColors(const PipetteLayerOperations::PipetteColor &lhs, const PipetteLayerOperations::PipetteColor &rhs)
Definition: tiledbitmappresentation.cc:29
Scroom::Utils::Point< int >