Tulip
5.3.1
Large graphs analysis and drawing
|
#include <GlScene.h>
Public Member Functions | |
GlScene (GlLODCalculator *calculator=nullptr) | |
void | addExistingLayer (GlLayer *layer) |
bool | addExistingLayerAfter (GlLayer *layer, const std::string &afterLayerWithName) |
bool | addExistingLayerBefore (GlLayer *layer, const std::string &beforeLayerWithName) |
void | adjustSceneToSize (int width, int height) |
void | ajustSceneToSize (int width, int height) |
void | centerScene () |
void | clearLayersList () |
void | computeAdjustSceneToSize (int width, int height, Coord *center, Coord *eye, float *sceneRadius, float *xWhiteFactor, float *yWhiteFactor, BoundingBox *sceneBoundingBox=nullptr, float *zoomFactor=nullptr) |
void | computeAjustSceneToSize (int width, int height, Coord *center, Coord *eye, float *sceneRadius, float *xWhiteFactor, float *yWhiteFactor, BoundingBox *sceneBoundingBox=nullptr, float *zoomFactor=nullptr) |
GlLayer * | createLayer (const std::string &name) |
GlLayer * | createLayerAfter (const std::string &layerName, const std::string &afterLayerWithName) |
GlLayer * | createLayerBefore (const std::string &layerName, const std::string &beforeLayerWithName) |
void | draw () |
Color | getBackgroundColor () const |
BoundingBox | getBoundingBox () |
GlLODCalculator * | getCalculator () |
bool | getClearBufferAtDraw () const |
bool | getClearDepthBufferAtDraw () const |
bool | getClearStencilBufferAtDraw () const |
GlGraphComposite * | getGlGraphComposite () |
Camera & | getGraphCamera () |
GlLayer * | getGraphLayer () |
unsigned char * | getImage () |
GlLayer * | getLayer (const std::string &name) |
const std::vector< std::pair< std::string, GlLayer * > > & | getLayersList () |
Vector< int, 4 > | getViewport () const |
void | getXML (std::string &out) |
void | getXMLOnlyForCameras (std::string &out) |
void | initGlParameters () |
bool | isViewOrtho () |
void | outputEPS (unsigned int size, const std::string &filename) |
void | outputSVG (unsigned int size, const std::string &filename) |
void | removeLayer (const std::string &name, bool deleteLayer=true) |
void | removeLayer (GlLayer *layer, bool deleteLayer=true) |
void | rotateCamera (const int x, const int y, const int z) |
void | rotateScene (const int x, const int y, const int z) |
bool | selectEntities (RenderingEntitiesFlag type, int x, int y, int h, int w, GlLayer *layer, std::vector< SelectedEntity > &selectedEntities) |
void | setBackgroundColor (const Color &color) |
void | setCalculator (GlLODCalculator *calculator) |
void | setClearBufferAtDraw (bool clear) |
void | setClearDepthBufferAtDraw (bool clear) |
void | setClearStencilBufferAtDraw (bool clear) |
void | setGraphCamera (Camera *camera) |
void | setViewOrtho (bool viewOrtho) |
void | setViewport (Vector< int, 4 > &newViewport) |
void | setViewport (int x, int y, int width, int height) |
void | setWithXML (std::string &in, Graph *graph) |
void | translateCamera (const int x, const int y, const int z) |
void | zoom (float factor, const Coord &dest) |
void | zoom (int step) |
void | zoomFactor (float factor) |
void | zoomXY (int step, const int x, const int y) |
Public Member Functions inherited from tlp::Observable | |
void | addListener (Observable *const listener) const |
void | addListener (Observable &listener) const |
void | addObserver (Observable *const observer) const |
void | addObserver (Observable &observer) const |
unsigned int | countListeners () const |
unsigned int | countObservers () const |
unsigned int | getReceived () const |
unsigned int | getSent () const |
void | removeListener (Observable *const listener) const |
void | removeListener (Observable &listener) const |
void | removeObserver (Observable *const observer) const |
void | removeObserver (Observable &observer) const |
Additional Inherited Members | |
Static Public Member Functions inherited from tlp::Observable | |
static void | disableEventNotification () |
static void | enableEventNotification () |
static tlp::node | getNode (const tlp::Observable *obs) |
static Observable * | getObject (tlp::node n) |
static const tlp::VectorGraph & | getObservableGraph () |
static unsigned int | getScheduled (tlp::node n) |
static void | holdObservers () |
static bool | isAlive (tlp::node n) |
static unsigned int | observersHoldCounter () |
static void | unholdObservers () |
Protected Member Functions inherited from tlp::Observable | |
Observable (const Observable &) | |
bool | hasOnlookers () const |
void | observableDeleted () |
Observable & | operator= (const Observable &) |
void | sendEvent (const Event &message) |
virtual void | treatEvent (const Event &message) |
virtual void | treatEvents (const std::vector< Event > &events) |
Tulip scene class.
The GlScene class is the core of the tulip rendering system This class is used to render entities and graph in OpenGL
If you want to render entities and graph, you have to use GlLayer system. You just have to create GlLayer and add GlEntity in. If you create more than one GlLayer, layers are rendered one after one, so the first GlLayer added is rendered in first.
After adding layers you can do a centerScene() and a draw()
If you want to create a widget with a visualisation is better to use GlMainWidget class (this class use a GlScene inside)
tlp::GlScene::GlScene | ( | GlLODCalculator * | calculator = nullptr | ) |
Constructor Default scene is empty.
calculator | By default GlScene use a GlCPULODCalculator to compute LOD but you can change this default lod calculator, to do that : put your calculator in constructor parameters Available calculators are : GlCPULODCalculator and GlQuadTreeLODCalculator |
void tlp::GlScene::addExistingLayer | ( | GlLayer * | layer | ) |
bool tlp::GlScene::addExistingLayerAfter | ( | GlLayer * | layer, |
const std::string & | afterLayerWithName | ||
) |
bool tlp::GlScene::addExistingLayerBefore | ( | GlLayer * | layer, |
const std::string & | beforeLayerWithName | ||
) |
void tlp::GlScene::adjustSceneToSize | ( | int | width, |
int | height | ||
) |
Adjust camera to have entities near borders
width | requested width |
height | requested height |
void tlp::GlScene::centerScene | ( | ) |
Center scene After this function all entities are visible on the screen
|
inline |
void tlp::GlScene::computeAdjustSceneToSize | ( | int | width, |
int | height, | ||
Coord * | center, | ||
Coord * | eye, | ||
float * | sceneRadius, | ||
float * | xWhiteFactor, | ||
float * | yWhiteFactor, | ||
BoundingBox * | sceneBoundingBox = nullptr , |
||
float * | zoomFactor = nullptr |
||
) |
Compute information for adjustSceneToSize
width | request width |
height | request height |
center | the result center will be stored in (if center != nullptr) |
eye | the result eye will be stored in (if eye != nullptr) |
sceneRadius | the result sceneRadius will be stored in (if sceneRadius != nullptr) |
xWhiteFactor | the white part on x borders (left and right), the computed empty space size will be stored in (if xWhiteFactor != nullptr) |
yWhiteFactor | the white part on y borders (top and bottom), the computed empty space size will be stored in (if yWhiteFactor != nullptr) |
sceneBoundingBox | the computed sceneBoundingBox will be stored in (if sceneBoundingBox != nullptr) |
zoomFactor | the computed zoomFactor will be stored in (if zoomFactor != nullptr) |
GlLayer* tlp::GlScene::createLayer | ( | const std::string & | name | ) |
Create a layer with the given name in the scene This layer is added to the layers list Now the scene have the ownership of this GlLayer so you don't have to delete this GlLayer.
GlLayer* tlp::GlScene::createLayerAfter | ( | const std::string & | layerName, |
const std::string & | afterLayerWithName | ||
) |
GlLayer* tlp::GlScene::createLayerBefore | ( | const std::string & | layerName, |
const std::string & | beforeLayerWithName | ||
) |
void tlp::GlScene::draw | ( | ) |
Draw the scene This function is the most important function of GlScene. If you want to render a scene into an OpenGL widget : call this function.
|
inline |
BoundingBox tlp::GlScene::getBoundingBox | ( | ) |
Return the bouding box of the scene (in 3D coordinates)
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return the current GlGraphComposite used by the scene.
|
inline |
|
inline |
Return the layer containing the current GlGraphComposite.
unsigned char* tlp::GlScene::getImage | ( | ) |
Return the RGB image of GlScene.
GlLayer* tlp::GlScene::getLayer | ( | const std::string & | name | ) |
Return the layer with name : name Return nullptr if the layer doesn't exist in the scene.
|
inline |
|
inline |
void tlp::GlScene::getXML | ( | std::string & | out | ) |
Get XML description of the scene and children and store it in out string.
void tlp::GlScene::getXMLOnlyForCameras | ( | std::string & | out | ) |
Get XML description of cameras of the scene and store it in out string.
void tlp::GlScene::initGlParameters | ( | ) |
Init scene's OpenGL parameters. You don't have to call this function, it is call when you do a draw.
|
inline |
void tlp::GlScene::outputEPS | ( | unsigned int | size, |
const std::string & | filename | ||
) |
Output the scene in EPS.
void tlp::GlScene::outputSVG | ( | unsigned int | size, |
const std::string & | filename | ||
) |
Output the scene in SVG.
void tlp::GlScene::removeLayer | ( | const std::string & | name, |
bool | deleteLayer = true |
||
) |
void tlp::GlScene::removeLayer | ( | GlLayer * | layer, |
bool | deleteLayer = true |
||
) |
void tlp::GlScene::rotateCamera | ( | const int | x, |
const int | y, | ||
const int | z | ||
) |
Rotate camera by (x,y,z)
x | rotation over X axis in degree |
y | rotation over Y axis in degree |
z | rotation over Z axis in degree |
bool tlp::GlScene::selectEntities | ( | RenderingEntitiesFlag | type, |
int | x, | ||
int | y, | ||
int | h, | ||
int | w, | ||
GlLayer * | layer, | ||
std::vector< SelectedEntity > & | selectedEntities | ||
) |
Select entities in scene.
type | Entities type to select (SelectSimpleEntities,SelectNodes,SelectEdges) |
x | screen coordinates |
y | screen coordinates |
h | height in screen coordinates |
w | width in screen coordinates |
layer | where the selection will be performed |
selectedEntities | the result of the selection is stored on it |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void tlp::GlScene::setWithXML | ( | std::string & | in, |
Graph * | graph | ||
) |
Set scene's data and children with a XML.
void tlp::GlScene::translateCamera | ( | const int | x, |
const int | y, | ||
const int | z | ||
) |
Translate camera by (x,y,z)
void tlp::GlScene::zoom | ( | float | factor, |
const Coord & | dest | ||
) |
Zoom to given world coordinate.
|
inline |
void tlp::GlScene::zoomFactor | ( | float | factor | ) |
Zoom by factor.
factor | of zoom |
void tlp::GlScene::zoomXY | ( | int | step, |
const int | x, | ||
const int | y | ||
) |
Zoom by step to given x,y screen coordinates.
step | of zoom |