cesium-native 0.55.0
Loading...
Searching...
No Matches
CesiumUtility::CreditSystem Class Referencefinal

Creates and manages Credit objects. Avoids repetitions and tracks which credits should be shown and which credits should be removed this frame. More...

#include <CesiumUtility/CreditSystem.h>

Public Member Functions

 CreditSystem () noexcept=default
 Constructs a new instance.
 
 CreditSystem (const CreditSystem &)=delete
 
CreditSystemoperator= (const CreditSystem &)=delete
 
Credit createCredit (const CreditSource &source, std::string &&html, bool showOnScreen=false)
 Inserts a credit string.
 
Credit createCredit (const CreditSource &source, const std::string &html, bool showOnScreen=false)
 Inserts a credit string.
 
Credit createCredit (std::string &&html, bool showOnScreen=false)
 Inserts a credit string associated with the getDefaultCreditSource.
 
Credit createCredit (const std::string &html, bool showOnScreen=false)
 Inserts a credit string associated with the getDefaultCreditSource.
 
bool shouldBeShownOnScreen (Credit credit) const noexcept
 Gets whether or not the credit should be shown on screen.
 
void setShowOnScreen (Credit credit, bool showOnScreen) noexcept
 Sets whether or not the credit should be shown on screen.
 
const std::string & getHtml (Credit credit) const noexcept
 Get the HTML string for this credit.
 
const CreditSourcegetCreditSource (Credit credit) const noexcept
 Gets the source of this credit.
 
bool addCreditReference (Credit credit)
 Adds a reference to a credit, incrementing its reference count. The referenced credit will be shown until its reference count goes back down to zero.
 
bool removeCreditReference (Credit credit)
 Removes a reference from a credit, decrementing its reference count. When the reference count goes to zero, this credit will no longer be shown.
 
const CreditsSnapshotgetSnapshot (CreditFilteringMode filteringMode=CreditFilteringMode::UniqueHtml) noexcept
 Gets a snapshot of the credits. The returned instance is only valid until the next call to this method.
 
const CreditSourcegetDefaultCreditSource () const noexcept
 Gets the default credit source used when no other source is specified.
 

Friends

class CreditReferencer
 
class CreditSource
 

Detailed Description

Creates and manages Credit objects. Avoids repetitions and tracks which credits should be shown and which credits should be removed this frame.

Definition at line 155 of file CreditSystem.h.

Member Function Documentation

◆ addCreditReference()

bool CesiumUtility::CreditSystem::addCreditReference ( Credit credit)

Adds a reference to a credit, incrementing its reference count. The referenced credit will be shown until its reference count goes back down to zero.

Parameters
creditThe credit to reference.
Returns
true if the credit was valid and the reference was added. false if the credit was created by a CreditSource that has been destroyed and so the reference could not be added.

◆ createCredit() [1/4]

Credit CesiumUtility::CreditSystem::createCredit ( const CreditSource & source,
const std::string & html,
bool showOnScreen = false )

Inserts a credit string.

Parameters
sourceThe source of the credit. This should be an instance created and owned by a tileset, raster overlay, or other data source.
htmlThe HTML string for the credit.
showOnScreenWhether or not the credit should be shown on screen. Credits not shown on the screen should be shown in a separate popup window.
Returns
If this string already exists from the same source, returns a Credit handle to the existing entry. Otherwise returns a Credit handle to a new entry.

◆ createCredit() [2/4]

Credit CesiumUtility::CreditSystem::createCredit ( const CreditSource & source,
std::string && html,
bool showOnScreen = false )

Inserts a credit string.

Parameters
sourceThe source of the credit. This should be an instance created and owned by a tileset, raster overlay, or other data source.
htmlThe HTML string for the credit.
showOnScreenWhether or not the credit should be shown on screen. Credits not shown on the screen should be shown in a separate popup window.
Returns
If this string already exists from the same source, returns a Credit handle to the existing entry. Otherwise returns a Credit handle to a new entry.

◆ createCredit() [3/4]

Credit CesiumUtility::CreditSystem::createCredit ( const std::string & html,
bool showOnScreen = false )

Inserts a credit string associated with the getDefaultCreditSource.

Returns
If this string already exists, returns a Credit handle to the existing entry. Otherwise returns a Credit handle to a new entry.
Deprecated
Use the overload that takes a CreditSource.

◆ createCredit() [4/4]

Credit CesiumUtility::CreditSystem::createCredit ( std::string && html,
bool showOnScreen = false )

Inserts a credit string associated with the getDefaultCreditSource.

Returns
If this string already exists, returns a Credit handle to the existing entry. Otherwise returns a Credit handle to a new entry.
Deprecated
Use the overload that takes a CreditSource.

◆ getCreditSource()

const CreditSource * CesiumUtility::CreditSystem::getCreditSource ( Credit credit) const
noexcept

Gets the source of this credit.

Returns
The source of this credit, or nullptr if the credit is invalid or was created by a CreditSource that has been destroyed.

◆ getDefaultCreditSource()

const CreditSource & CesiumUtility::CreditSystem::getDefaultCreditSource ( ) const
noexcept

Gets the default credit source used when no other source is specified.

Deprecated
Instead of using the default, create a CreditSource instance for each tileset, raster overlay, or other data source.

◆ getSnapshot()

const CreditsSnapshot & CesiumUtility::CreditSystem::getSnapshot ( CreditFilteringMode filteringMode = CreditFilteringMode::UniqueHtml)
noexcept

Gets a snapshot of the credits. The returned instance is only valid until the next call to this method.

The snapshot will include a sorted list of credits that are currently active, as well as a list of credits that have been removed since the last snapshot.

Parameters
filteringModeSpecifies how multiple credits with the same HTML string should be reported in the snapshot.

◆ removeCreditReference()

bool CesiumUtility::CreditSystem::removeCreditReference ( Credit credit)

Removes a reference from a credit, decrementing its reference count. When the reference count goes to zero, this credit will no longer be shown.

Parameters
creditThe credit from which to remove a reference.
Returns
true if the credit was valid and the reference was removed. false if the credit was created by a CreditSource that has been destroyed and so the reference could not be removed.

Friends And Related Symbol Documentation

◆ CreditReferencer

friend class CreditReferencer
friend

Definition at line 329 of file CreditSystem.h.

◆ CreditSource

friend class CreditSource
friend

Definition at line 330 of file CreditSystem.h.


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