Scroom 0.14-48-ga0fee447
Loading...
Searching...
No Matches
SizeDeterminer Class Reference

#include <sizedeterminer.hh>

Collaboration diagram for SizeDeterminer:
Collaboration graph

Classes

class  PresentationData
 

Public Types

using Ptr = std::shared_ptr< SizeDeterminer >
 

Public Member Functions

void add (PresentationInterface::Ptr const &p)
 
Scroom::Utils::Rectangle< double > getRect () const
 
void open (PresentationInterface::Ptr const &p, ViewInterface::WeakPtr const &vi)
 
void close (PresentationInterface::Ptr const &p, ViewInterface::WeakPtr const &vi)
 

Static Public Member Functions

static Ptr create ()
 

Private Member Functions

 SizeDeterminer ()=default
 
void sendUpdates ()
 

Private Attributes

std::list< PresentationInterface::Ptrpresentations
 
std::map< PresentationInterface::Ptr, PresentationDataresizablePresentationData
 

Member Typedef Documentation

◆ Ptr

using SizeDeterminer::Ptr = std::shared_ptr<SizeDeterminer>

Constructor & Destructor Documentation

◆ SizeDeterminer()

SizeDeterminer::SizeDeterminer ( )
privatedefault

Referenced by create().

Here is the caller graph for this function:

Member Function Documentation

◆ add()

void SizeDeterminer::add ( PresentationInterface::Ptr const &  p)
69{
70 ResizablePresentationInterface::Ptr const r = std::dynamic_pointer_cast<ResizablePresentationInterface>(p);
71 if(r)
72 {
73 resizablePresentationData.insert(std::make_pair(p, PresentationData(r)));
74 }
75 else
76 {
77 presentations.push_back(p);
78 }
79
81}
std::shared_ptr< ResizablePresentationInterface > Ptr
Definition resizablepresentationinterface.hh:27
std::map< PresentationInterface::Ptr, PresentationData > resizablePresentationData
Definition sizedeterminer.hh:37
std::list< PresentationInterface::Ptr > presentations
Definition sizedeterminer.hh:36
void sendUpdates()
Definition sizedeterminer.cc:126
PresentationInterfaceStub::Ptr const p
Definition determine-size-test.cc:172
Scroom::Utils::Rectangle< double > const r
Definition transformpresentation_test.cc:65
Here is the call graph for this function:

◆ close()

void SizeDeterminer::close ( PresentationInterface::Ptr const &  p,
ViewInterface::WeakPtr const &  vi 
)
113{
115 {
116 PresentationData& d = resizablePresentationData[p];
117 require(d.views.count(vi));
118 d.views.erase(vi);
119 }
120 else
121 {
122 require(!std::dynamic_pointer_cast<ResizablePresentationInterface>(p));
123 }
124}
#define require(expr)
Definition assertions.hh:30
ViewInterface::Ptr const vi
Definition pipette-tests.cc:186

◆ create()

SizeDeterminer::Ptr SizeDeterminer::create ( )
static
66{ return Ptr(new SizeDeterminer()); }
std::shared_ptr< SizeDeterminer > Ptr
Definition sizedeterminer.hh:21
SizeDeterminer()=default
Here is the call graph for this function:

◆ getRect()

Scroom::Utils::Rectangle< double > SizeDeterminer::getRect ( ) const
84{
85 if(!presentations.empty())
86 {
88 }
89 if(!resizablePresentationData.empty())
90 {
92 }
93 return {};
94}
Scroom::Utils::Rectangle< double > DetermineSize(const std::list< PresentationInterface::Ptr > &presentations)
Definition sizedeterminer.cc:18
std::list< K > keys(std::map< K, V > const &m)
Definition sizedeterminer.cc:37

Referenced by open(), and sendUpdates().

Here is the caller graph for this function:

◆ open()

void SizeDeterminer::open ( PresentationInterface::Ptr const &  p,
ViewInterface::WeakPtr const &  vi 
)
97{
99 {
100 PresentationData& d = resizablePresentationData[p];
101 require(!d.views.count(vi));
102 d.views.insert(vi);
103
104 d.resizablePresentationInterface->setRect(vi, getRect());
105 }
106 else
107 {
108 require(!std::dynamic_pointer_cast<ResizablePresentationInterface>(p));
109 }
110}
Scroom::Utils::Rectangle< double > getRect() const
Definition sizedeterminer.cc:83
Here is the call graph for this function:

◆ sendUpdates()

void SizeDeterminer::sendUpdates ( )
private
127{
129
130 for(auto const& data: resizablePresentationData)
131 {
132 for(auto const& view: data.second.views)
133 {
134 data.second.resizablePresentationInterface->setRect(view, rect);
135 }
136 }
137}
uint8_t data
Definition blob-tests.cc:36
static Views views
Definition callbacks.cc:58
Definition rectangle.hh:29
const auto view
Definition pipette-tests.cc:227
const auto rect
Definition rectangletests.cc:335

Referenced by add().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ presentations

std::list<PresentationInterface::Ptr> SizeDeterminer::presentations
private

Referenced by add(), and getRect().

◆ resizablePresentationData

std::map<PresentationInterface::Ptr, PresentationData> SizeDeterminer::resizablePresentationData
private

Referenced by add(), close(), getRect(), open(), and sendUpdates().


The documentation for this class was generated from the following files: