libosmscout 0.1
Loading...
Searching...
No Matches
osmscout::PatternLookup Class Referencefinal

Looks a pattern image up in the pattern image directories of a render parameter and classifies the outcome, so that every map backend can report a pattern fill it cannot serve in the same way. More...

#include <PatternLookup.h>

Public Types

enum class  Status : uint8_t { Found , NotFound , NoSourceConfigured }
 Outcome of searching the configured pattern image directories for a pattern. More...
 

Public Member Functions

 PatternLookup ()=delete
 

Static Public Member Functions

static std::string Describe (const std::list< std::string > &patternPaths, const std::string &patternName, const std::string &extension, Status status)
 Report for a lookup that did not resolve the pattern: names the pattern and either says that no pattern image source is configured or lists the directories that were searched.
 
static Status Resolve (const std::list< std::string > &patternPaths, const std::string &patternName, const std::string &extension, std::string &filename)
 Search the given directories for an image of the pattern.
 

Detailed Description

Looks a pattern image up in the pattern image directories of a render parameter and classifies the outcome, so that every map backend can report a pattern fill it cannot serve in the same way.

The lookup only answers where an image is and what should be reported if there is none; loading the image stays with the backend, because every backend keeps its images in its own type.

Member Enumeration Documentation

◆ Status

enum class osmscout::PatternLookup::Status : uint8_t
strong

Outcome of searching the configured pattern image directories for a pattern.

Enumerator
Found 

An image for the pattern was found in one of the configured directories.

NotFound 

The configured directories hold no image for the pattern.

NoSourceConfigured 

No pattern image directory is configured at all.

Constructor & Destructor Documentation

◆ PatternLookup()

osmscout::PatternLookup::PatternLookup ( )
delete

Member Function Documentation

◆ Describe()

std::string osmscout::PatternLookup::Describe ( const std::list< std::string > &  patternPaths,
const std::string &  patternName,
const std::string &  extension,
Status  status 
)
static

Report for a lookup that did not resolve the pattern: names the pattern and either says that no pattern image source is configured or lists the directories that were searched.

Parameters
patternPathsdirectories the lookup searched
patternNamepattern name as the style sheet uses it, without an extension
extensionimage file extension including the dot (for example ".png")
statusoutcome of the lookup
Returns
the report, empty for Status::Found

References Found, NoSourceConfigured, and NotFound.

Referenced by osmscout::MapPainterCairo::HasPattern(), and osmscout::MapPainterQt::HasPattern().

◆ Resolve()

PatternLookup::Status osmscout::PatternLookup::Resolve ( const std::list< std::string > &  patternPaths,
const std::string &  patternName,
const std::string &  extension,
std::string &  filename 
)
static

Search the given directories for an image of the pattern.

The directories are searched in their given order, so the first directory that holds the image wins.

Parameters
patternPathsdirectories to search, in the order to search them
patternNamepattern name as the style sheet uses it, without an extension
extensionimage file extension including the dot (for example ".png")
filenameset to the file that holds the image, empty otherwise
Returns
the classification of the lookup

References Found, NoSourceConfigured, and NotFound.

Referenced by osmscout::MapPainterCairo::HasPattern(), and osmscout::MapPainterQt::HasPattern().


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