Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
ogdf::GridLayout Class Reference

Representation of a graph's grid layout. More...

#include <ogdf/basic/GridLayout.h>

+ Inheritance diagram for ogdf::GridLayout:

Public Member Functions

 GridLayout ()
 Creates an instance of a grid layout (associated with no graph).
 
 GridLayout (const Graph &G)
 Creates an instance of a grid layout associated with G.
 
virtual ~GridLayout ()
 Destruction.
 
EdgeArray< IPolyline > & bends ()
 Returns a reference to the array storing the bend points of edges.
 
const EdgeArray< IPolyline > & bends () const
 Returns a reference to the array storing the bend points of edges.
 
IPolylinebends (edge e)
 Returns a reference to the bend point list of edge e.
 
const IPolylinebends (edge e) const
 Returns a reference to the bend point list of edge e.
 
bool checkLayout ()
 Checks if the grid layout is reasonable.
 
void compactAllBends ()
 Removes all unnecessary bends.
 
void computeBoundingBox (int &xmin, int &xmax, int &ymin, int &ymax)
 Computes the bounding box of the grid layout.
 
IPolyline getCompactBends (edge e) const
 Returns the bend point list of edge e without unnecessary bends.
 
void init ()
 Initializes the grid layout for no graph (frees memory).
 
void init (const Graph &G)
 Initializes the grid layout for graph G.
 
int manhattanEdgeLength (edge e) const
 
int maxManhattanEdgeLength () const
 
int numberOfBends () const
 Computes the total number of bends in the grid layout.
 
IPolyline polyline (edge e) const
 Returns the polyline of edge e (including start and end point!).
 
virtual void remap (Layout &drawing)
 Transforms the grid layout to a layout.
 
double totalEdgeLength () const
 Computes the total (euclidean) edge length of the grid layout.
 
int totalManhattanEdgeLength () const
 Computes the total manhattan edge length of the grid layout.
 
NodeArray< int > & x ()
 Returns a reference to the array storing the x-coordinates of nodes.
 
const NodeArray< int > & x () const
 Returns a reference to the array storing the x-coordinates of nodes.
 
intx (node v)
 Returns a reference to the x-coordinate of node v.
 
const intx (node v) const
 Returns a reference to the x-coordinate of node v.
 
NodeArray< int > & y ()
 Returns a reference to the array storing the y-coordinates of nodes.
 
const NodeArray< int > & y () const
 Returns a reference to the array storing the y-coordinates of nodes.
 
inty (node v)
 Returns a reference to the y-coordinate of node v.
 
const inty (node v) const
 Returns a reference to the y-coordinate of node v.
 

Static Public Member Functions

static double euclideanDistance (const IPoint &ip1, const IPoint &ip2)
 
static int manhattanDistance (const IPoint &ip1, const IPoint &ip2)
 

Protected Attributes

EdgeArray< IPolylinem_bends
 The bend points of edges.
 
NodeArray< intm_x
 The x-coordinates of nodes.
 
NodeArray< intm_y
 The y-coordinates of nodes.
 

Static Private Member Functions

static void compact (IPolyline &ip)
 
static bool isRedundant (IPoint &p1, IPoint &p2, IPoint &p3)
 

Detailed Description

Representation of a graph's grid layout.

Definition at line 46 of file GridLayout.h.

Constructor & Destructor Documentation

◆ GridLayout() [1/2]

ogdf::GridLayout::GridLayout ( )
inline

Creates an instance of a grid layout (associated with no graph).

Definition at line 49 of file GridLayout.h.

◆ GridLayout() [2/2]

ogdf::GridLayout::GridLayout ( const Graph G)
inlineexplicit

Creates an instance of a grid layout associated with G.

Definition at line 52 of file GridLayout.h.

◆ ~GridLayout()

virtual ogdf::GridLayout::~GridLayout ( )
inlinevirtual

Destruction.

Definition at line 55 of file GridLayout.h.

Member Function Documentation

◆ bends() [1/4]

EdgeArray< IPolyline > & ogdf::GridLayout::bends ( )
inline

Returns a reference to the array storing the bend points of edges.

Definition at line 73 of file GridLayout.h.

◆ bends() [2/4]

const EdgeArray< IPolyline > & ogdf::GridLayout::bends ( ) const
inline

Returns a reference to the array storing the bend points of edges.

Definition at line 70 of file GridLayout.h.

◆ bends() [3/4]

IPolyline & ogdf::GridLayout::bends ( edge  e)
inline

Returns a reference to the bend point list of edge e.

Definition at line 91 of file GridLayout.h.

◆ bends() [4/4]

const IPolyline & ogdf::GridLayout::bends ( edge  e) const
inline

Returns a reference to the bend point list of edge e.

Definition at line 88 of file GridLayout.h.

◆ checkLayout()

bool ogdf::GridLayout::checkLayout ( )

Checks if the grid layout is reasonable.

In particular, the following checks are performed:

  • All nodes have to be assigned to distinct grid points.
  • All bend points have to be assigned to distinct points.
  • No bend point coincides with the position of a node.

◆ compact()

static void ogdf::GridLayout::compact ( IPolyline ip)
staticprivate

◆ compactAllBends()

void ogdf::GridLayout::compactAllBends ( )

Removes all unnecessary bends.

◆ computeBoundingBox()

void ogdf::GridLayout::computeBoundingBox ( int xmin,
int xmax,
int ymin,
int ymax 
)

Computes the bounding box of the grid layout.

The returned bounding box is (0,0,0,0) if the associated graph is empty or no graph is associated with the grid layout.

Parameters
xminis assigned the minimum x-coordinate in the grid layout.
xmaxis assigned the maximum x-coordinate in the grid layout.
yminis assigned the minimum y-coordinate in the grid layout.
ymaxis assigned the maximum y-coordinate in the grid layout.

◆ euclideanDistance()

static double ogdf::GridLayout::euclideanDistance ( const IPoint ip1,
const IPoint ip2 
)
static

◆ getCompactBends()

IPolyline ogdf::GridLayout::getCompactBends ( edge  e) const

Returns the bend point list of edge e without unnecessary bends.

◆ init() [1/2]

void ogdf::GridLayout::init ( )
inline

Initializes the grid layout for no graph (frees memory).

Definition at line 104 of file GridLayout.h.

◆ init() [2/2]

void ogdf::GridLayout::init ( const Graph G)
inline

Initializes the grid layout for graph G.

Definition at line 97 of file GridLayout.h.

◆ isRedundant()

static bool ogdf::GridLayout::isRedundant ( IPoint p1,
IPoint p2,
IPoint p3 
)
staticprivate

◆ manhattanDistance()

static int ogdf::GridLayout::manhattanDistance ( const IPoint ip1,
const IPoint ip2 
)
static

◆ manhattanEdgeLength()

int ogdf::GridLayout::manhattanEdgeLength ( edge  e) const

◆ maxManhattanEdgeLength()

int ogdf::GridLayout::maxManhattanEdgeLength ( ) const

◆ numberOfBends()

int ogdf::GridLayout::numberOfBends ( ) const

Computes the total number of bends in the grid layout.

◆ polyline()

IPolyline ogdf::GridLayout::polyline ( edge  e) const

Returns the polyline of edge e (including start and end point!).

◆ remap()

virtual void ogdf::GridLayout::remap ( Layout drawing)
virtual

Transforms the grid layout to a layout.

This implementation only copies the grid coordinates to drawing; the derived class GridLayoutMapped performs the actual transformation of coordinates.

Reimplemented in ogdf::GridLayoutMapped.

◆ totalEdgeLength()

double ogdf::GridLayout::totalEdgeLength ( ) const

Computes the total (euclidean) edge length of the grid layout.

◆ totalManhattanEdgeLength()

int ogdf::GridLayout::totalManhattanEdgeLength ( ) const

Computes the total manhattan edge length of the grid layout.

◆ x() [1/4]

NodeArray< int > & ogdf::GridLayout::x ( )
inline

Returns a reference to the array storing the x-coordinates of nodes.

Definition at line 61 of file GridLayout.h.

◆ x() [2/4]

const NodeArray< int > & ogdf::GridLayout::x ( ) const
inline

Returns a reference to the array storing the x-coordinates of nodes.

Definition at line 58 of file GridLayout.h.

◆ x() [3/4]

int & ogdf::GridLayout::x ( node  v)
inline

Returns a reference to the x-coordinate of node v.

Definition at line 79 of file GridLayout.h.

◆ x() [4/4]

const int & ogdf::GridLayout::x ( node  v) const
inline

Returns a reference to the x-coordinate of node v.

Definition at line 76 of file GridLayout.h.

◆ y() [1/4]

NodeArray< int > & ogdf::GridLayout::y ( )
inline

Returns a reference to the array storing the y-coordinates of nodes.

Definition at line 67 of file GridLayout.h.

◆ y() [2/4]

const NodeArray< int > & ogdf::GridLayout::y ( ) const
inline

Returns a reference to the array storing the y-coordinates of nodes.

Definition at line 64 of file GridLayout.h.

◆ y() [3/4]

int & ogdf::GridLayout::y ( node  v)
inline

Returns a reference to the y-coordinate of node v.

Definition at line 85 of file GridLayout.h.

◆ y() [4/4]

const int & ogdf::GridLayout::y ( node  v) const
inline

Returns a reference to the y-coordinate of node v.

Definition at line 82 of file GridLayout.h.

Member Data Documentation

◆ m_bends

EdgeArray<IPolyline> ogdf::GridLayout::m_bends
protected

The bend points of edges.

Definition at line 164 of file GridLayout.h.

◆ m_x

NodeArray<int> ogdf::GridLayout::m_x
protected

The x-coordinates of nodes.

Definition at line 162 of file GridLayout.h.

◆ m_y

NodeArray<int> ogdf::GridLayout::m_y
protected

The y-coordinates of nodes.

Definition at line 163 of file GridLayout.h.


The documentation for this class was generated from the following file: