Tulip  5.7.4
Large graphs analysis and drawing
tlp::LayoutProperty Class Reference

#include <LayoutProperty.h>

+ Inheritance diagram for tlp::LayoutProperty:
+ Collaboration diagram for tlp::LayoutProperty:

Public Member Functions

 LayoutProperty (Graph *graph, const std::string &name="")
 
std::vector< double > angularResolutions (const node n, const Graph *subgraph=nullptr) const
 
double averageAngularResolution (const Graph *subgraph=nullptr) const
 
double averageAngularResolution (const node n, const Graph *subgraph=nullptr) const
 
double averageEdgeLength (const Graph *subgraph=nullptr) const
 
void center (const Graph *subgraph=nullptr)
 
void center (const Vec3f &newCenter, const Graph *subgraph=nullptr)
 
PropertyInterfaceclonePrototype (Graph *, const std::string &) const override
 
void computeEmbedding (const node n, Graph *subgraph=nullptr)
 
void computeEmbedding (Graph *subgraph=nullptr)
 
double edgeLength (const edge e) const
 
Coord getMax (const Graph *subgraph=nullptr)
 
Coord getMin (const Graph *subgraph=nullptr)
 
const std::string & getTypename () const override
 
void normalize (const Graph *subgraph=nullptr)
 
void perfectAspectRatio (const Graph *subgraph=nullptr)
 
void rotateX (const double &alpha, const Graph *subgraph=nullptr)
 
void rotateX (const double &alpha, Iterator< node > *itNodes, Iterator< edge > *itEdges)
 
void rotateY (const double &alpha, const Graph *subgraph=nullptr)
 
void rotateY (const double &alpha, Iterator< node > *itNodes, Iterator< edge > *itEdges)
 
void rotateZ (const double &alpha, const Graph *subgraph=nullptr)
 
void rotateZ (const double &alpha, Iterator< node > *itNodes, Iterator< edge > *itEdges)
 
void scale (const Vec3f &scaleFactors, const Graph *subgraph=nullptr)
 
void scale (const Vec3f &scaleFactors, Iterator< node > *itNodes, Iterator< edge > *itEdges)
 
void setAllEdgeValue (tlp::StoredType< tlp::LineType::RealType >::ReturnedConstValue v) override
 
void setAllNodeValue (tlp::StoredType< tlp::PointType::RealType >::ReturnedConstValue v) override
 
void setEdgeValue (const edge, tlp::StoredType< tlp::LineType::RealType >::ReturnedConstValue v) override
 
void setNodeValue (const node, tlp::StoredType< tlp::PointType::RealType >::ReturnedConstValue v) override
 
void setValueToGraphEdges (tlp::StoredType< tlp::LineType::RealType >::ReturnedConstValue v, const Graph *graph) override
 
void setValueToGraphNodes (tlp::StoredType< tlp::PointType::RealType >::ReturnedConstValue v, const Graph *graph) override
 
void translate (const Vec3f &move, const Graph *subgraph=nullptr)
 
void translate (const Vec3f &move, Iterator< node > *itNodes, Iterator< edge > *itEdges)
 
- Public Member Functions inherited from tlp::MinMaxProperty< nodeType, edgeType, propType >
 MinMaxProperty (tlp::Graph *graph, const std::string &name, NODE_VALUE NodeMin, NODE_VALUE NodeMax, EDGE_VALUE EdgeMin, EDGE_VALUE EdgeMax)
 
CONST_EDGE_VALUE getEdgeMax (const Graph *graph=nullptr)
 
CONST_EDGE_VALUE getEdgeMin (const Graph *graph=nullptr)
 
CONST_NODE_VALUE getNodeMax (const Graph *graph=nullptr)
 
CONST_NODE_VALUE getNodeMin (const Graph *graph=nullptr)
 
void treatEvent (const tlp::Event &ev) override
 
void updateAllEdgesValues (CONST_EDGE_VALUE newValue)
 
void updateAllNodesValues (CONST_NODE_VALUE newValue)
 
void updateEdgeValue (tlp::edge e, const tlp::LineType::RealType &newValue)
 
void updateEdgeValue (tlp::edge e, CONST_EDGE_VALUE newValue)
 
void updateNodeValue (tlp::node n, CONST_NODE_VALUE newValue)
 
- Public Member Functions inherited from tlp::AbstractProperty< nodeType, edgeType, PropertyInterface >
 AbstractProperty (Graph *, const std::string &n="")
 
int compare (const edge e1, const edge e2) const override
 
int compare (const node n1, const node n2) const override
 
void computeMetaValue (edge e, tlp::Iterator< edge > *itE, Graph *mg) override
 
void computeMetaValue (node n, Graph *sg, Graph *mg) override
 
bool copy (const edge destination, const edge source, PropertyInterface *property, bool ifNotDefault=false) override
 
bool copy (const node destination, const node source, PropertyInterface *property, bool ifNotDefault=false) override
 
void copy (PropertyInterface *property) override
 
unsigned int edgeValueSize () const override
 
void erase (const edge e) override
 
void erase (const node n) override
 
DataMem * getEdgeDataMemValue (const edge e) const override
 
DataMem * getEdgeDefaultDataMemValue () const override
 
std::string getEdgeDefaultStringValue () const override
 
Tedge::RealType getEdgeDefaultValue () const
 
virtual tlp::Iterator< edge > * getEdgesEqualTo (typename tlp::StoredType< typename Tedge::RealType >::ReturnedConstValue v, const Graph *g=nullptr) const
 
std::string getEdgeStringValue (const edge e) const override
 
tlp::StoredType< typename Tedge::RealType >::ReturnedConstValue getEdgeValue (const edge e) const
 
DataMem * getNodeDataMemValue (const node n) const override
 
DataMem * getNodeDefaultDataMemValue () const override
 
std::string getNodeDefaultStringValue () const override
 
Tnode::RealType getNodeDefaultValue () const
 
virtual tlp::Iterator< node > * getNodesEqualTo (typename tlp::StoredType< typename Tnode::RealType >::ReturnedConstValue v, const Graph *g=nullptr) const
 
std::string getNodeStringValue (const node n) const override
 
tlp::StoredType< typename Tnode::RealType >::ReturnedConstValue getNodeValue (const node n) const
 
DataMem * getNonDefaultDataMemValue (const edge e) const override
 
DataMem * getNonDefaultDataMemValue (const node n) const override
 
tlp::Iterator< edge > * getNonDefaultValuatedEdges (const Graph *g=nullptr) const override
 
tlp::Iterator< node > * getNonDefaultValuatedNodes (const Graph *g=nullptr) const override
 
bool hasNonDefaultValuatedEdges (const Graph *g=nullptr) const override
 
bool hasNonDefaultValuatedNodes (const Graph *g=nullptr) const override
 
unsigned int nodeValueSize () const override
 
unsigned int numberOfNonDefaultValuatedEdges (const Graph *=nullptr) const override
 
unsigned int numberOfNonDefaultValuatedNodes (const Graph *g=nullptr) const override
 
virtual AbstractProperty< nodeType, edgeType, PropertyInterface > & operator= (AbstractProperty< nodeType, edgeType, PropertyInterface > &prop)
 
bool readEdgeDefaultValue (std::istream &) override
 
bool readEdgeValue (std::istream &, edge) override
 
bool readNodeDefaultValue (std::istream &) override
 
bool readNodeValue (std::istream &, node) override
 
void setAllEdgeDataMemValue (const DataMem *v) override
 
bool setAllEdgeStringValue (const std::string &inV) override
 
virtual void setAllEdgeValue (typename tlp::StoredType< typename Tedge::RealType >::ReturnedConstValue v)
 
void setAllNodeDataMemValue (const DataMem *v) override
 
bool setAllNodeStringValue (const std::string &inV) override
 
virtual void setAllNodeValue (typename tlp::StoredType< typename Tnode::RealType >::ReturnedConstValue v)
 
void setEdgeDataMemValue (const edge e, const DataMem *v) override
 
bool setEdgeDefaultStringValue (const std::string &inV) override
 
virtual void setEdgeDefaultValue (typename tlp::StoredType< typename Tedge::RealType >::ReturnedConstValue v)
 
bool setEdgeStringValue (const edge inE, const std::string &inV) override
 
virtual void setEdgeValue (const edge e, typename tlp::StoredType< typename Tedge::RealType >::ReturnedConstValue v)
 
void setMetaValueCalculator (PropertyInterface::MetaValueCalculator *mvCalc) override
 
void setNodeDataMemValue (const node n, const DataMem *v) override
 
bool setNodeDefaultStringValue (const std::string &inV) override
 
virtual void setNodeDefaultValue (typename tlp::StoredType< typename Tnode::RealType >::ReturnedConstValue v)
 
bool setNodeStringValue (const node inN, const std::string &inV) override
 
virtual void setNodeValue (const node n, typename tlp::StoredType< typename Tnode::RealType >::ReturnedConstValue v)
 
bool setStringValueToGraphEdges (const std::string &inV, const Graph *graph) override
 
bool setStringValueToGraphNodes (const std::string &inV, const Graph *graph) override
 
virtual void setValueToGraphEdges (typename tlp::StoredType< typename Tedge::RealType >::ReturnedConstValue v, const Graph *graph)
 
virtual void setValueToGraphNodes (typename tlp::StoredType< typename Tnode::RealType >::ReturnedConstValue v, const Graph *graph)
 
void writeEdgeDefaultValue (std::ostream &) const override
 
void writeEdgeValue (std::ostream &, edge) const override
 
void writeNodeDefaultValue (std::ostream &) const override
 
void writeNodeValue (std::ostream &, node) const override
 
- Public Member Functions inherited from tlp::PropertyInterface
virtual const std::string & getCppClassName () const =0
 
tlp::GraphgetGraph () const
 
MetaValueCalculatorgetMetaValueCalculator ()
 
const std::string & getName () const
 
bool rename (const std::string &newName)
 
- Public Member Functions inherited from tlp::Observable
void addListener (Observable &listener) const
 
void addListener (Observable *const listener) const
 
void addObserver (Observable &observer) const
 
void addObserver (Observable *const observer) const
 
unsigned int countListeners () const
 
unsigned int countObservers () const
 
unsigned int getReceived () const
 
unsigned int getSent () const
 
void removeListener (Observable &listener) const
 
void removeListener (Observable *const listener) const
 
void removeObserver (Observable &observer) const
 
void removeObserver (Observable *const observer) const
 

Public Attributes

 DEFINE_GET_CPP_CLASS_NAME
 
unsigned int nbBendedEdges
 

Static Public Attributes

static const std::string propertyTypename
 

Protected Member Functions

void clone_handler (AbstractProperty< tlp::PointType, tlp::LineType > &) override
 
- Protected Member Functions inherited from tlp::MinMaxProperty< nodeType, edgeType, propType >
 MINMAX_MAP (edgeType) minMaxEdge
 
 MINMAX_MAP (nodeType) minMaxNode
 
const MINMAX_PAIR (edgeType) &computeMinMaxEdge(const Graph *graph)
 
const MINMAX_PAIR (nodeType) &computeMinMaxNode(const Graph *graph)
 
void removeListenersAndClearEdgeMap ()
 
void removeListenersAndClearNodeMap ()
 
- Protected Member Functions inherited from tlp::AbstractProperty< nodeType, edgeType, PropertyInterface >
virtual void clone_handler (AbstractProperty< nodeType, edgeType, PropertyInterface > &)
 
- Protected Member Functions inherited from tlp::PropertyInterface
void notifyAfterSetAllEdgeValue ()
 
void notifyAfterSetAllNodeValue ()
 
void notifyAfterSetEdgeValue (const edge e)
 
void notifyAfterSetNodeValue (const node n)
 
void notifyBeforeSetAllEdgeValue ()
 
void notifyBeforeSetAllNodeValue ()
 
void notifyBeforeSetEdgeValue (const edge e)
 
void notifyBeforeSetNodeValue (const node n)
 
void notifyDestroy ()
 
void notifyRename (const std::string &newName)
 
- Protected Member Functions inherited from tlp::Observable
 Observable (const Observable &)
 
bool hasOnlookers () const
 
void observableDeleted ()
 
Observableoperator= (const Observable &)
 
void sendEvent (const Event &message)
 
virtual void treatEvents (const std::vector< Event > &events)
 

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 ObservablegetObject (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 Attributes inherited from tlp::MinMaxProperty< nodeType, edgeType, propType >
EDGE_VALUE _edgeMax
 
EDGE_VALUE _edgeMin
 
NODE_VALUE _nodeMax
 
NODE_VALUE _nodeMin
 
bool needGraphListener
 
- Protected Attributes inherited from tlp::AbstractProperty< nodeType, edgeType, PropertyInterface >
Tedge::RealType edgeDefaultValue
 
MutableContainer< typename Tedge::RealType > edgeProperties
 
Tnode::RealType nodeDefaultValue
 
MutableContainer< typename Tnode::RealType > nodeProperties
 
- Protected Attributes inherited from tlp::PropertyInterface
Graphgraph
 
MetaValueCalculatormetaValueCalculator
 
std::string name
 

Detailed Description

A graph property that maps a tlp::Coord value to graph nodes and std::vector<tlp::Coord> for edges.

Definition at line 50 of file LayoutProperty.h.

Member Function Documentation

◆ angularResolutions()

std::vector<double> tlp::LayoutProperty::angularResolutions ( const node  n,
const Graph subgraph = nullptr 
) const

Returns a vector of all angular resolution of a node. It is only defined for 2D drawing, meaning the third coordinate is omitted

Parameters
nthe graph node on which to compute the angular resolution
subgraphIf not null, only computes the average angular resolution for the node in that subgraph

◆ averageAngularResolution() [1/2]

double tlp::LayoutProperty::averageAngularResolution ( const Graph subgraph = nullptr) const

Returns the average angular resolution of the layout. It is only defined for 2D drawing, meaning the third coordinate is omitted

Parameters
subgraphIt not null, only computes the average angular resolution for that subgraph

◆ averageAngularResolution() [2/2]

double tlp::LayoutProperty::averageAngularResolution ( const node  n,
const Graph subgraph = nullptr 
) const

Returns the average angular resolution of a node. It is only defined for 2D drawing, meaning the third coordinate is omitted

Parameters
nthe graph node on which to compute the angular resolution
subgraphIf not null, only computes the average angular resolution for the node in that subgraph

◆ averageEdgeLength()

double tlp::LayoutProperty::averageEdgeLength ( const Graph subgraph = nullptr) const

Returns the average edge length of the layout, the bends are taken into account

Parameters
subgraphIf not null, only compute the average edge length for that subgraph

◆ center() [1/2]

void tlp::LayoutProperty::center ( const Graph subgraph = nullptr)

Centers the layout, meaning translating it in order that the center of its bounding box is (0,0,0)

Parameters
subgraphIf not null, only centers the layout of that subgraph

◆ center() [2/2]

void tlp::LayoutProperty::center ( const Vec3f &  newCenter,
const Graph subgraph = nullptr 
)

Centers the layout to newCenter, meaning translating it in order that the center of its bounding box is equal to newCenter

Parameters
newCenterthe coordinate of the new layout center
subgraphIf not null, only centers the layout of that subgraph

◆ clonePrototype()

PropertyInterface* tlp::LayoutProperty::clonePrototype ( Graph graph,
const std::string &  name 
) const
overridevirtual

Creates a property of the same type (e.g. tlp::DoubleProperty) in the graph. The new property will not contain a copy of this property's values.

Parameters
graphThe Graph in which to create the new property.
nameThe name of the new property.
Returns
The newly created property.

Implements tlp::PropertyInterface.

◆ computeEmbedding() [1/2]

void tlp::LayoutProperty::computeEmbedding ( const node  n,
Graph subgraph = nullptr 
)

Fixes embedding of the node according to the layout ie. sort edges around the node according to its neighbors/bends position in the layout/ Only work in 2D, the third coordinate is not taken into account.

Parameters
nthe graph node on which to fix embedding
subgraphIf not null, only fixes the embedding of the node in that subgraph

◆ computeEmbedding() [2/2]

void tlp::LayoutProperty::computeEmbedding ( Graph subgraph = nullptr)

Fixes embedding of the graph according to the layout ie. sort edges around nodes according to their neighbors/bends position in the layout/ Only works in 2D, the third coordinate is not taken into account.

Parameters
subgraphIt not null, only fixes embedding in that subgraph

◆ edgeLength()

double tlp::LayoutProperty::edgeLength ( const edge  e) const

Returns the length of an edge, the bends are taken into account. Thus, it measure the length of a polyline.

Parameters
ethe graph edge on which to compute its length
Warning
this function only measure the length of the polyline between bends, when using curves like Bézier etc... the result will not be the length of the curve.

◆ getMax()

Coord tlp::LayoutProperty::getMax ( const Graph subgraph = nullptr)

Returns the maximum coordinate of the layout, i.e. the top-right corner of the induced bounding box

Parameters
subgraphIf not null, returns the maximum coordinate for a subgraph layout

◆ getMin()

Coord tlp::LayoutProperty::getMin ( const Graph subgraph = nullptr)

Returns the minimum coordinate of the layout, i.e. the bottom-left corner of the induced bounding box

Parameters
subgraphIf not null, returns the minimum coordinate for a subgraph layout

◆ getTypename()

const std::string& tlp::LayoutProperty::getTypename ( ) const
inlineoverridevirtual

Gets a string describing the type of the property value (e.g. "graph", "double", "layout", "string", "integer", "color", "size").

Returns
The name of this property's type.

Implements tlp::PropertyInterface.

Definition at line 57 of file LayoutProperty.h.

◆ normalize()

void tlp::LayoutProperty::normalize ( const Graph subgraph = nullptr)

Normalizes the layout, meaning dividing each nodes and edges coordinate by the maximum magnitude of the whole coordinates set

Parameters
subgraphIf not null, only normalizes the layout of that subgraph

◆ perfectAspectRatio()

void tlp::LayoutProperty::perfectAspectRatio ( const Graph subgraph = nullptr)

Scales the layout in order to approach an aspect ratio (width / height) of 1.0 .

Parameters
subgraphIf not null, only scales the layout of that subgraph

◆ rotateX() [1/2]

void tlp::LayoutProperty::rotateX ( const double &  alpha,
const Graph subgraph = nullptr 
)

Rotates the layout around the X-axis according to an angle in degrees.

Parameters
alphaan angle in degrees
subgraphIf not null, only rotates the layout of that subgraph

◆ rotateX() [2/2]

void tlp::LayoutProperty::rotateX ( const double &  alpha,
Iterator< node > *  itNodes,
Iterator< edge > *  itEdges 
)

Rotates the layout around the X-axis of the nodes and edges provided through iterators according to an angle in degrees.

Parameters
alphaan angle in degrees
itNodesan iterator on graph nodes
itEdgesan iterator on graph edges
Warning
The iterators are not deleted

◆ rotateY() [1/2]

void tlp::LayoutProperty::rotateY ( const double &  alpha,
const Graph subgraph = nullptr 
)

Rotates the layout around the Y-axis according to an angle in degrees.

Parameters
alphaan angle in degrees
subgraphIf not null, only rotates the layout of that subgraph

◆ rotateY() [2/2]

void tlp::LayoutProperty::rotateY ( const double &  alpha,
Iterator< node > *  itNodes,
Iterator< edge > *  itEdges 
)

Rotates the layout around the Y-axis of the nodes and edges provided through iterators according to an angle in degrees.

Parameters
alphaan angle in degrees
itNodesan iterator on graph nodes
itEdgesan iterator on graph edges
Warning
The iterators are not deleted

◆ rotateZ() [1/2]

void tlp::LayoutProperty::rotateZ ( const double &  alpha,
const Graph subgraph = nullptr 
)

Rotates the layout around the Z-axis according to an angle in degrees.

Parameters
alphaan angle in degrees
subgraphIf not null, only rotates the layout of that subgraph

◆ rotateZ() [2/2]

void tlp::LayoutProperty::rotateZ ( const double &  alpha,
Iterator< node > *  itNodes,
Iterator< edge > *  itEdges 
)

Rotates the layout around the Z-axis of the nodes and edges provided through iterators according to an angle in degrees.

Parameters
alphaan angle in degrees
itNodesan iterator on graph nodes
itEdgesan iterator on graph edges
Warning
The iterators are not deleted

◆ scale() [1/2]

void tlp::LayoutProperty::scale ( const Vec3f &  scaleFactors,
const Graph subgraph = nullptr 
)

Scales the current layout according to a vector of scale factors (sx, sy, sz).

Parameters
scaleFactorsa vector of scale factors
subgraphIf not null, only scales the layout of that subgraph

◆ scale() [2/2]

void tlp::LayoutProperty::scale ( const Vec3f &  scaleFactors,
Iterator< node > *  itNodes,
Iterator< edge > *  itEdges 
)

Scales the layout of a set of nodes and edges provided through iterators according to a vector of scale factors (sx, sy, sz).

Parameters
scaleFactorsa vector of scale factors
itNodesan iterator on graph nodes
itEdgesan iterator on graph edges
Warning
The iterators are not deleted

◆ setNodeValue()

void tlp::LayoutProperty::setNodeValue ( const  node,
tlp::StoredType< tlp::PointType::RealType >::ReturnedConstValue  v 
)
override

Returns the number of crossings in the layout

◆ translate() [1/2]

void tlp::LayoutProperty::translate ( const Vec3f &  move,
const Graph subgraph = nullptr 
)

Translates the current layout according to a movement vector

Parameters
movea movement vector
subgraphIf not null, only translates the layout of that subgraph

◆ translate() [2/2]

void tlp::LayoutProperty::translate ( const Vec3f &  move,
Iterator< node > *  itNodes,
Iterator< edge > *  itEdges 
)

Translates the layout of a set of nodes and edges provided through iterators according to a movement vector

Parameters
movea movement vector
itNodesan iterator on graph nodes
itEdgesan iterator on graph edges
Warning
The iterators are not deleted