SOMHunter Core
sh::CanvasQuery Class Reference

Type representing query related to the canvas (atm text & bitmap) rectangles. More...

#include <query-types.h>

Public Member Functions

void emplace_back (const RelativeRect &rect, const std::string &text_query)
 Emplace new subregion TEXT query. More...
 
void emplace_back (const RelativeRect &rect, size_t bitmap_w, size_t bitmap_h, size_t num_channels, uint8_t *bitmap_RGBA_data)
 Emplace new subregion BITMAP query. More...
 
size_t size () const
 
bool empty () const
 
const std::vector< CanvasSubquery > & subqueries () const
 
std::vector< CanvasSubquery > & subqueries ()
 
template<class Archive >
void serialize (Archive &archive)
 This allows portable binary serialization of Collage instances to files. More...
 
nlohmann::json to_JSON () const
 
CanvasSubqueryoperator[] (size_t idx)
 
const CanvasSubqueryoperator[] (size_t idx) const
 
bool operator== (const CanvasQuery &b) const
 

Static Public Member Functions

static std::vector< CanvasQueryparse_json (const std::string &filepath)
 Parses JSON file created by to_JSON. More...
 
static std::vector< CanvasQueryparse_json_contents (const std::string &contents, const std::filesystem::path parentPath)
 Parses JSON string created by to_JSON. More...
 

Private Attributes

std::vector< CanvasSubquery_subqueries
 Subregion queries. More...
 

Detailed Description

Type representing query related to the canvas (atm text & bitmap) rectangles.

Member Function Documentation

◆ emplace_back() [1/2]

void CanvasQuery::emplace_back ( const RelativeRect rect,
const std::string &  text_query 
)

Emplace new subregion TEXT query.

◆ emplace_back() [2/2]

void CanvasQuery::emplace_back ( const RelativeRect rect,
size_t  bitmap_w,
size_t  bitmap_h,
size_t  num_channels,
uint8_t *  bitmap_RGBA_data 
)

Emplace new subregion BITMAP query.

During this function the input integral RGBA data are converted to RGB float data.

◆ empty()

bool sh::CanvasQuery::empty ( ) const
inline
Here is the call graph for this function:

◆ operator==()

bool sh::CanvasQuery::operator== ( const CanvasQuery b) const
inline
Here is the call graph for this function:

◆ operator[]() [1/2]

CanvasSubquery& sh::CanvasQuery::operator[] ( size_t  idx)
inline

◆ operator[]() [2/2]

const CanvasSubquery& sh::CanvasQuery::operator[] ( size_t  idx) const
inline

◆ parse_json()

std::vector< CanvasQuery > CanvasQuery::parse_json ( const std::string &  filepath)
static

Parses JSON file created by to_JSON.

◆ parse_json_contents()

std::vector< CanvasQuery > CanvasQuery::parse_json_contents ( const std::string &  contents,
const std::filesystem::path  parentPath 
)
static

Parses JSON string created by to_JSON.

◆ serialize()

template<class Archive >
void sh::CanvasQuery::serialize ( Archive &  archive)
inline

This allows portable binary serialization of Collage instances to files.

by Cereal header-only lib https://uscilab.github.io/cereal/quickstart.html https://uscilab.github.io/cereal/stl_support.html

◆ size()

size_t sh::CanvasQuery::size ( ) const
inline

◆ subqueries() [1/2]

std::vector<CanvasSubquery>& sh::CanvasQuery::subqueries ( )
inline

◆ subqueries() [2/2]

const std::vector<CanvasSubquery>& sh::CanvasQuery::subqueries ( ) const
inline

◆ to_JSON()

nlohmann::json CanvasQuery::to_JSON ( ) const

Member Data Documentation

◆ _subqueries

std::vector<CanvasSubquery> sh::CanvasQuery::_subqueries
private

Subregion queries.


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