![]() |
Geometrize
1.0
An application for geometrizing images into geometric primitives
|
The GeometrizerEngine class encapsulates script-based setup and mutation methods for geometrizing shapes. More...
#include <geometrizerengine.h>
Signals | |
void | signal_scriptEvaluationSucceeded (const std::string &functionName, const std::string &code) |
signal_scriptEvaluationSucceeded Signal dispatched when a script is successfully parsed/evaluated. More... | |
void | signal_scriptEvaluationFailed (const std::string &functionName, const std::string &code, const std::string &errorMessage) |
signal_scriptEvaluationFailed Signal dispatched when a script fails to parse/evaluate. More... | |
Public Member Functions | |
GeometrizerEngine () | |
GeometrizerEngine (const chaiscript::ChaiScript::State &state) | |
virtual | ~GeometrizerEngine ()=default |
GeometrizerEngine & | operator= (const GeometrizerEngine &)=delete |
GeometrizerEngine (const GeometrizerEngine &)=delete | |
void | installScripts (const std::map< std::string, std::string > &scripts) |
geometrize::core::EnergyFunction | makeEnergyFunction () const |
makeEnergyFunction Returns a custom energy function for the core geometrization algorithm. More... | |
std::function< std::shared_ptr < geometrize::Shape >)> | makeShapeCreator (geometrize::ShapeTypes types, std::int32_t w, std::int32_t h) const |
makeShapeCreator Returns a function that generates shapes for the core geometrization algorithm This is passed to the geometrization algorithm and called across many threads. So it's unsafe to change any state used by the script engine while we're busy adding shapes. It also captures "this", meaning the engine won't be destroyed until the shape creation code is finished using it. More... | |
chaiscript::ChaiScript * | getEngine () |
getEngine Gets a pointer to the script engine used by the shape mutation engine. More... | |
Private Member Functions | |
template<class T > | |
void | installShapeScript (const std::string &functionName, const std::map< std::string, std::string > &scripts) |
void | installCustomEnergyScript (const std::string &functionName, const std::string &scriptCode) |
void | setup (geometrize::Circle &shape) const |
void | mutate (geometrize::Circle &shape) const |
void | setSetupFunction (const std::function< void(geometrize::Circle &)> &f) |
void | setMutatorFunction (const std::function< void(geometrize::Circle &)> &f) |
void | setup (geometrize::Ellipse &shape) const |
void | mutate (geometrize::Ellipse &shape) const |
void | setSetupFunction (const std::function< void(geometrize::Ellipse &)> &f) |
void | setMutatorFunction (const std::function< void(geometrize::Ellipse &)> &f) |
void | setup (geometrize::Line &shape) const |
void | mutate (geometrize::Line &shape) const |
void | setSetupFunction (const std::function< void(geometrize::Line &)> &f) |
void | setMutatorFunction (const std::function< void(geometrize::Line &)> &f) |
void | setup (geometrize::Polyline &shape) const |
void | mutate (geometrize::Polyline &shape) const |
void | setSetupFunction (const std::function< void(geometrize::Polyline &)> &f) |
void | setMutatorFunction (const std::function< void(geometrize::Polyline &)> &f) |
void | setup (geometrize::QuadraticBezier &shape) const |
void | mutate (geometrize::QuadraticBezier &shape) const |
void | setSetupFunction (const std::function< void(geometrize::QuadraticBezier &)> &f) |
void | setMutatorFunction (const std::function< void(geometrize::QuadraticBezier &)> &f) |
void | setup (geometrize::Rectangle &shape) const |
void | mutate (geometrize::Rectangle &shape) const |
void | setSetupFunction (const std::function< void(geometrize::Rectangle &)> &f) |
void | setMutatorFunction (const std::function< void(geometrize::Rectangle &)> &f) |
void | setup (geometrize::RotatedEllipse &shape) const |
void | mutate (geometrize::RotatedEllipse &shape) const |
void | setSetupFunction (const std::function< void(geometrize::RotatedEllipse &)> &f) |
void | setMutatorFunction (const std::function< void(geometrize::RotatedEllipse &)> &f) |
void | setup (geometrize::RotatedRectangle &shape) const |
void | mutate (geometrize::RotatedRectangle &shape) const |
void | setSetupFunction (const std::function< void(geometrize::RotatedRectangle &)> &f) |
void | setMutatorFunction (const std::function< void(geometrize::RotatedRectangle &)> &f) |
void | setup (geometrize::Triangle &shape) const |
void | mutate (geometrize::Triangle &shape) const |
void | setSetupFunction (const std::function< void(geometrize::Triangle &)> &f) |
void | setMutatorFunction (const std::function< void(geometrize::Triangle &)> &f) |
void | setCustomEnergyFunction (const geometrize::core::EnergyFunction &f) |
Private Attributes | |
std::function< void(geometrize::Circle &)> | m_setupCircle |
std::function< void(geometrize::Ellipse &)> | m_setupEllipse |
std::function< void(geometrize::Line &)> | m_setupLine |
std::function< void(geometrize::Polyline &)> | m_setupPolyline |
std::function< void(geometrize::QuadraticBezier &)> | m_setupQuadraticBezier |
std::function< void(geometrize::Rectangle &)> | m_setupRectangle |
std::function< void(geometrize::RotatedEllipse &)> | m_setupRotatedEllipse |
std::function< void(geometrize::RotatedRectangle &)> | m_setupRotatedRectangle |
std::function< void(geometrize::Triangle &)> | m_setupTriangle |
std::function< void(geometrize::Circle &)> | m_mutateCircle |
std::function< void(geometrize::Ellipse &)> | m_mutateEllipse |
std::function< void(geometrize::Line &)> | m_mutateLine |
std::function< void(geometrize::Polyline &)> | m_mutatePolyline |
std::function< void(geometrize::QuadraticBezier &)> | m_mutateQuadraticBezier |
std::function< void(geometrize::Rectangle &)> | m_mutateRectangle |
std::function< void(geometrize::RotatedEllipse &)> | m_mutateRotatedEllipse |
std::function< void(geometrize::RotatedRectangle &)> | m_mutateRotatedRectangle |
std::function< void(geometrize::Triangle &)> | m_mutateTriangle |
geometrize::core::EnergyFunction | m_customEnergyFunction |
std::unique_ptr < chaiscript::ChaiScript > | m_engine |
The GeometrizerEngine class encapsulates script-based setup and mutation methods for geometrizing shapes.
geometrize::script::GeometrizerEngine::GeometrizerEngine | ( | ) |
geometrize::script::GeometrizerEngine::GeometrizerEngine | ( | const chaiscript::ChaiScript::State & | state | ) |
|
virtualdefault |
|
delete |
chaiscript::ChaiScript * geometrize::script::GeometrizerEngine::getEngine | ( | ) |
getEngine Gets a pointer to the script engine used by the shape mutation engine.
|
inlineprivate |
void geometrize::script::GeometrizerEngine::installScripts | ( | const std::map< std::string, std::string > & | scripts | ) |
|
inlineprivate |
|
inline |
makeEnergyFunction Returns a custom energy function for the core geometrization algorithm.
|
inline |
makeShapeCreator Returns a function that generates shapes for the core geometrization algorithm This is passed to the geometrization algorithm and called across many threads. So it's unsafe to change any state used by the script engine while we're busy adding shapes. It also captures "this", meaning the engine won't be destroyed until the shape creation code is finished using it.
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
delete |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
inlineprivate |
|
signal |
signal_scriptEvaluationFailed Signal dispatched when a script fails to parse/evaluate.
functionName | The name of the function. |
code | The code of the function. |
error | The text of the error message, if any. |
|
signal |
signal_scriptEvaluationSucceeded Signal dispatched when a script is successfully parsed/evaluated.
functionName | The name of the function. |
code | The code of the function. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |