Envision
A visual programming IDE for object-oriented languages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
Visualization::ModelRenderer Class Reference

Public Member Functions

 ModelRenderer ()
 
virtual ~ModelRenderer ()
 
QPair< int, VisualizationGroup::ItemConstructorbestVisualizationForContext (Item *parent, Model::Node *, int purpose=-1, int semanticZoomLevel=-1)
 
int getCoarserSemanticZoomLevel (int currentSemanticZoomLevel)
 
int getFinerSemanticZoomLevel (int currentSemanticZoomLevel)
 
bool hasVisualization (int nodeTypeId, int purpose=0, int semanticZoomLevel=0)
 Returns whether a specific visualization has been registered for nodes of type nodeTypeId and the provided purpose. More...
 
int numRegisteredPurposes () const
 
int numRegisteredSemanticZoomLevels () const
 
int purposeId (QString name)
 
QString purposeName (int purpose)
 
void registerGroup (int nodeTypeId, int purpose, int semanticZoomLevel, VisualizationGroup *group)
 
void registerGroup (int nodeTypeId, VisualizationGroup *group)
 
int registerSemanticZoomLevel (const QString &name, int orderingNumber)
 
void registerVisualization (int nodeTypeId, int purpose, int semanticZoomLevel, VisualizationGroup::ItemConstructor visualization, int itemTypeId)
 
void registerVisualization (int nodeTypeId, int purpose, VisualizationGroup::ItemConstructor visualization, int itemTypeId)
 
void registerVisualization (int nodeTypeId, QString purpose, QString semanticZoomLevel, VisualizationGroup::ItemConstructor visualization, int itemTypeId)
 
void registerVisualization (int nodeTypeId, QString purpose, VisualizationGroup::ItemConstructor visualization, int itemTypeId)
 
void registerVisualization (int nodeTypeId, VisualizationGroup::ItemConstructor visualization, int itemTypeId)
 
int registerVisualizationPurpose (const QString &name)
 
Itemrender (Item *parent, Model::Node *node, int purpose=-1, int semanticZoomLevel=-1)
 Returns an Item which has a parent parent and is a rendering of node. More...
 
int semanticZoomLevelId (QString name)
 
QString semanticZoomLevelName (int semanticZoomLevel)
 
bool sync (Item *&item, Item *parent, Model::Node *node)
 (Re)renders an item in the context of a parent item. More...
 

Static Public Member Functions

static QImage renderToImage (Model::Node *aNode)
 
static void renderToSVG (Model::Node *aNode, QString path)
 

Private Member Functions

QPair< int, VisualizationGroup::ItemConstructorbasicStrategy (Item *parent, Model::Node *node, int purpose, int semanticZoomLevel, std::function< QVector< VisualizationGroup * >((int, int, int))> option1, std::function< QVector< VisualizationGroup * >((int, int, int))> option2, std::function< QVector< VisualizationGroup * >((int, int, int))> option3)
 Returns a visualization that is most suitable for the given parameter values. More...
 
QPair< int, VisualizationGroup::ItemConstructorvisualizationChoiceStrategyTypeOverPurposeOverSemanticZoomLevel (Item *parent, Model::Node *node, int purpose, int semanticZoomLevel)
 
QPair< int, VisualizationGroup::ItemConstructorvisualizationChoiceStrategyTypeOverSemanticZoomLevelOverPurpose (Item *parent, Model::Node *node, int purpose, int semanticZoomLevel)
 

Private Attributes

QVector< QString > purposes_
 
QVector< QString > semanticZoomLevels_
 
SzLevelOrderingManager szLevelOrderingManager_
 
int visualizationChoiceStrategy_ {VISUALIZATION_CHOICE_STRATEGY_TYPE_OVER_SEMANTIC_ZOOM_LEVEL_OVER_PURPOSE}
 
VisualizationGroupsManager visualizationGroupsManager_
 

Static Private Attributes

static const int VISUALIZATION_CHOICE_STRATEGY_TYPE_OVER_PURPOSE_OVER_SEMANTIC_ZOOM_LEVEL = 2
 
static const int VISUALIZATION_CHOICE_STRATEGY_TYPE_OVER_SEMANTIC_ZOOM_LEVEL_OVER_PURPOSE = 1
 

Constructor & Destructor Documentation

◆ ModelRenderer()

Visualization::ModelRenderer::ModelRenderer ( )

◆ ~ModelRenderer()

Visualization::ModelRenderer::~ModelRenderer ( )
virtual

Member Function Documentation

◆ basicStrategy()

QPair< int, VisualizationGroup::ItemConstructor > Visualization::ModelRenderer::basicStrategy ( Item parent,
Model::Node node,
int  purpose,
int  semanticZoomLevel,
std::function< QVector< VisualizationGroup * >((int, int, int))>  option1,
std::function< QVector< VisualizationGroup * >((int, int, int))>  option2,
std::function< QVector< VisualizationGroup * >((int, int, int))>  option3 
)
private

Returns a visualization that is most suitable for the given parameter values.

It uses a priority based approach that first searches for a match according to a function provided as option1. If no match was found it proceeds with option2 then with option3.

◆ bestVisualizationForContext()

QPair< int, VisualizationGroup::ItemConstructor > Visualization::ModelRenderer::bestVisualizationForContext ( Item parent,
Model::Node node,
int  purpose = -1,
int  semanticZoomLevel = -1 
)

◆ getCoarserSemanticZoomLevel()

int Visualization::ModelRenderer::getCoarserSemanticZoomLevel ( int  currentSemanticZoomLevel)

◆ getFinerSemanticZoomLevel()

int Visualization::ModelRenderer::getFinerSemanticZoomLevel ( int  currentSemanticZoomLevel)

◆ hasVisualization()

bool Visualization::ModelRenderer::hasVisualization ( int  nodeTypeId,
int  purpose = 0,
int  semanticZoomLevel = 0 
)

Returns whether a specific visualization has been registered for nodes of type nodeTypeId and the provided purpose.

◆ numRegisteredPurposes()

int Visualization::ModelRenderer::numRegisteredPurposes ( ) const
inline

◆ numRegisteredSemanticZoomLevels()

int Visualization::ModelRenderer::numRegisteredSemanticZoomLevels ( ) const
inline

◆ purposeId()

int Visualization::ModelRenderer::purposeId ( QString  name)
inline

◆ purposeName()

QString Visualization::ModelRenderer::purposeName ( int  purpose)
inline

◆ registerGroup() [1/2]

void Visualization::ModelRenderer::registerGroup ( int  nodeTypeId,
int  purpose,
int  semanticZoomLevel,
VisualizationGroup group 
)

◆ registerGroup() [2/2]

void Visualization::ModelRenderer::registerGroup ( int  nodeTypeId,
VisualizationGroup group 
)
inline

◆ registerSemanticZoomLevel()

int Visualization::ModelRenderer::registerSemanticZoomLevel ( const QString &  name,
int  orderingNumber 
)

◆ registerVisualization() [1/5]

void Visualization::ModelRenderer::registerVisualization ( int  nodeTypeId,
int  purpose,
int  semanticZoomLevel,
VisualizationGroup::ItemConstructor  visualization,
int  itemTypeId 
)

◆ registerVisualization() [2/5]

void Visualization::ModelRenderer::registerVisualization ( int  nodeTypeId,
int  purpose,
VisualizationGroup::ItemConstructor  visualization,
int  itemTypeId 
)
inline

◆ registerVisualization() [3/5]

void Visualization::ModelRenderer::registerVisualization ( int  nodeTypeId,
QString  purpose,
QString  semanticZoomLevel,
VisualizationGroup::ItemConstructor  visualization,
int  itemTypeId 
)
inline

◆ registerVisualization() [4/5]

void Visualization::ModelRenderer::registerVisualization ( int  nodeTypeId,
QString  purpose,
VisualizationGroup::ItemConstructor  visualization,
int  itemTypeId 
)
inline

◆ registerVisualization() [5/5]

void Visualization::ModelRenderer::registerVisualization ( int  nodeTypeId,
VisualizationGroup::ItemConstructor  visualization,
int  itemTypeId 
)
inline

◆ registerVisualizationPurpose()

int Visualization::ModelRenderer::registerVisualizationPurpose ( const QString &  name)

◆ render()

Item * Visualization::ModelRenderer::render ( Item parent,
Model::Node node,
int  purpose = -1,
int  semanticZoomLevel = -1 
)

Returns an Item which has a parent parent and is a rendering of node.

If purpose is specified (purpose >= 0) it is used as the target purpose when determining an appropriate visualization. Otherwise the purpose of parent is used. If parent is nullptr the default purpose is used.

◆ renderToImage()

QImage Visualization::ModelRenderer::renderToImage ( Model::Node aNode)
static

◆ renderToSVG()

void Visualization::ModelRenderer::renderToSVG ( Model::Node aNode,
QString  path 
)
static

◆ semanticZoomLevelId()

int Visualization::ModelRenderer::semanticZoomLevelId ( QString  name)
inline

◆ semanticZoomLevelName()

QString Visualization::ModelRenderer::semanticZoomLevelName ( int  semanticZoomLevel)
inline

◆ sync()

bool Visualization::ModelRenderer::sync ( Item *&  item,
Item parent,
Model::Node node 
)

(Re)renders an item in the context of a parent item.

Returns true is the item was destroyed or rerendered. If nothing happened to the item, the return value is false.

◆ visualizationChoiceStrategyTypeOverPurposeOverSemanticZoomLevel()

QPair< int, VisualizationGroup::ItemConstructor > Visualization::ModelRenderer::visualizationChoiceStrategyTypeOverPurposeOverSemanticZoomLevel ( Item parent,
Model::Node node,
int  purpose,
int  semanticZoomLevel 
)
private

◆ visualizationChoiceStrategyTypeOverSemanticZoomLevelOverPurpose()

QPair< int, VisualizationGroup::ItemConstructor > Visualization::ModelRenderer::visualizationChoiceStrategyTypeOverSemanticZoomLevelOverPurpose ( Item parent,
Model::Node node,
int  purpose,
int  semanticZoomLevel 
)
private

Member Data Documentation

◆ purposes_

QVector<QString > Visualization::ModelRenderer::purposes_
private

◆ semanticZoomLevels_

QVector<QString > Visualization::ModelRenderer::semanticZoomLevels_
private

◆ szLevelOrderingManager_

SzLevelOrderingManager Visualization::ModelRenderer::szLevelOrderingManager_
private

◆ VISUALIZATION_CHOICE_STRATEGY_TYPE_OVER_PURPOSE_OVER_SEMANTIC_ZOOM_LEVEL

const int Visualization::ModelRenderer::VISUALIZATION_CHOICE_STRATEGY_TYPE_OVER_PURPOSE_OVER_SEMANTIC_ZOOM_LEVEL = 2
staticprivate

◆ VISUALIZATION_CHOICE_STRATEGY_TYPE_OVER_SEMANTIC_ZOOM_LEVEL_OVER_PURPOSE

const int Visualization::ModelRenderer::VISUALIZATION_CHOICE_STRATEGY_TYPE_OVER_SEMANTIC_ZOOM_LEVEL_OVER_PURPOSE = 1
staticprivate

◆ visualizationChoiceStrategy_

int Visualization::ModelRenderer::visualizationChoiceStrategy_ {VISUALIZATION_CHOICE_STRATEGY_TYPE_OVER_SEMANTIC_ZOOM_LEVEL_OVER_PURPOSE}
private

◆ visualizationGroupsManager_

VisualizationGroupsManager Visualization::ModelRenderer::visualizationGroupsManager_
private