Tulip  5.3.0
Large graphs analysis and drawing
tlp::GlLayer Class Reference

#include <GlLayer.h>

Public Member Functions

 GlLayer (const std::string &name, bool workingLayer=false)
 
 GlLayer (const std::string &name, Camera *camera, bool workingLayer=false)
 
 ~GlLayer ()
 
void addGlEntity (GlSimpleEntity *entity, const std::string &name)
 
void addGraph (tlp::Graph *graph, const std::string &name)
 
void clear ()
 
void deleteGlEntity (const std::string &key)
 
void deleteGlEntity (GlSimpleEntity *entity)
 
GlSimpleEntityfindGlEntity (const std::string &key)
 
CameragetCamera ()
 
GlCompositegetComposite ()
 
const std::map< std::string, GlSimpleEntity * > & getGlEntities () const
 
std::string getName ()
 
GlScenegetScene ()
 
void getXML (std::string &outString)
 
void getXMLOnlyForCameras (std::string &outString)
 
bool isAWorkingLayer ()
 
bool isVisible ()
 
void set2DMode ()
 
void setCamera (Camera *camera)
 
void setSharedCamera (Camera *camera)
 
void setVisible (bool visible)
 
void setWithXML (const std::string &inString, unsigned int &currentPosition)
 
bool useSharedCamera ()
 

Protected Member Functions

void setScene (GlScene *scene)
 

Friends

class GlScene
 

Detailed Description

A GlLayer is like an 2D drawing software layer system.

A layer is an entity with a Camera and a GlComposite to store GlEntity Layers are used with GlScene : you can add a layer to a scene and a scene can have many layers

See also
Camera
GlComposite
GlSimpleEntity
GlScene

You have two constructor for GlLayer : one with a camera pointer and one without The constructor without camera pointer create a layer with a new camera and delete this camera at the destruction The constructor with camera pointer create a layer and use the camera pointer but you have the responsibility of camera destruction

After you have created a layer, you can populate the layer with GlEntity and addGlEntity() functions

Examples:
graph_display/graph_display.cpp.

Definition at line 54 of file GlLayer.h.

Constructor & Destructor Documentation

◆ GlLayer() [1/2]

tlp::GlLayer::GlLayer ( const std::string &  name,
bool  workingLayer = false 
)

Layer constructor : construct a layer with his name A new camera is created for this layer and this camera will be deleted in the GlLayer destructor.

Parameters
namelayer name
workingLayera working layer is not displayed on overview

◆ GlLayer() [2/2]

tlp::GlLayer::GlLayer ( const std::string &  name,
Camera camera,
bool  workingLayer = false 
)

Layer constructor : construct a layer with his name and use the camera : camera You have the responsibility of camera destruction.

Parameters
namelayer name
cameracamera to use in this layer
workingLayera working layer is not displayed on overview

◆ ~GlLayer()

tlp::GlLayer::~GlLayer ( )

Destructor.

Member Function Documentation

◆ addGlEntity()

void tlp::GlLayer::addGlEntity ( GlSimpleEntity entity,
const std::string &  name 
)

Add an entity to GlComposite of the layer.

◆ addGraph()

void tlp::GlLayer::addGraph ( tlp::Graph graph,
const std::string &  name 
)

A Convienience function that adds a graph to the layer.

This method will automatically create a GlGraphComposite entity and add it to the layer.

Examples:
graph_display/graph_display.cpp.

◆ clear()

void tlp::GlLayer::clear ( )
inline

Remove all entities of the layer Entities are not deleted so before call this function you have to get the entities list and you have the responsibility of entities destruction.

Definition at line 178 of file GlLayer.h.

◆ deleteGlEntity() [1/2]

void tlp::GlLayer::deleteGlEntity ( const std::string &  key)

Remove entity with name : key This entity is not deleted.

◆ deleteGlEntity() [2/2]

void tlp::GlLayer::deleteGlEntity ( GlSimpleEntity entity)

Remove entity This entity is not deleted.

◆ findGlEntity()

GlSimpleEntity* tlp::GlLayer::findGlEntity ( const std::string &  key)

Return entity with name : key.

◆ getCamera()

Camera& tlp::GlLayer::getCamera ( )
inline

Return the layer's camera.

Definition at line 114 of file GlLayer.h.

◆ getComposite()

GlComposite* tlp::GlLayer::getComposite ( )
inline

Return the GlComposite used by the layer A GlLayer is only a container of a camera and a composite, so to manipulate GlEntity on this layer you can get the GlComposite and add/remove entities on this composite.

Definition at line 169 of file GlLayer.h.

◆ getGlEntities()

const std::map<std::string, GlSimpleEntity *>& tlp::GlLayer::getGlEntities ( ) const

Return the map of layer's entities.

◆ getName()

std::string tlp::GlLayer::getName ( )
inline

Return the layer's name.

Definition at line 90 of file GlLayer.h.

◆ getScene()

GlScene* tlp::GlLayer::getScene ( )
inline

Return the scene where the layer is.

Definition at line 83 of file GlLayer.h.

◆ getXML()

void tlp::GlLayer::getXML ( std::string &  outString)

Get XML description of the layer and children and store it in out string

◆ getXMLOnlyForCameras()

void tlp::GlLayer::getXMLOnlyForCameras ( std::string &  outString)

Get XML description of cameras of the layer and store it in out string.

◆ isAWorkingLayer()

bool tlp::GlLayer::isAWorkingLayer ( )
inline

Return if this layer is a working layer A working layer is not displayed on overview.

Definition at line 186 of file GlLayer.h.

◆ isVisible()

bool tlp::GlLayer::isVisible ( )
inline

Return if the layer is visible.

Definition at line 126 of file GlLayer.h.

◆ set2DMode()

void tlp::GlLayer::set2DMode ( )

Replace the layer's camera with a new 2D one.

◆ setCamera()

void tlp::GlLayer::setCamera ( Camera camera)

Set the layer's camera GlLayer now use a copy of the camera parameters.

◆ setScene()

void tlp::GlLayer::setScene ( GlScene scene)
protected

Set the scene where the layer is

◆ setSharedCamera()

void tlp::GlLayer::setSharedCamera ( Camera camera)

Set the layer's camera GlLayer now use camera parameters and you have the resposibility of camera destruction

◆ setVisible()

void tlp::GlLayer::setVisible ( bool  visible)

Set if the layer is visible.

◆ setWithXML()

void tlp::GlLayer::setWithXML ( const std::string &  inString,
unsigned int &  currentPosition 
)

Function to set data with inString (in XML format)

◆ useSharedCamera()

bool tlp::GlLayer::useSharedCamera ( )
inline

Return if this layer use a shared camera A shared camera is a camera used by more than one Layer, so if this layer use a shared camera we don't have to delete it when the layer is destroyed.

Definition at line 195 of file GlLayer.h.