Show / Hide Table of Contents

Class LayoutUtils

Utilities for layout operations.

Inheritance
System.Object
LayoutUtils
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: GraphShape.Algorithms.Layout
Assembly: GraphShape.dll
Syntax
public static class LayoutUtils

Methods

| Improve this Doc View Source

FillWithRandomPositions<TVertex>(Double, Double, Double, Double, IEnumerable<TVertex>, IDictionary<TVertex, Point>, Random)

Initializes the positions of the vertices. Assigns a random position inside the 'bounding box' to the vertices without positions. It does NOT modify the position of the other vertices. Bounding box: x coordinates: double.Epsilon - width y coordinates: double.Epsilon - height

Declaration
public static void FillWithRandomPositions<TVertex>(double width, double height, double translateX, double translateY, IEnumerable<TVertex> vertices, IDictionary<TVertex, Point> verticesPositions, Random random)
Parameters
Type Name Description
System.Double width

Width of the bounding box.

System.Double height

Height of the bounding box.

System.Double translateX

Translates the generated x coordinate.

System.Double translateY

Translates the generated y coordinate.

System.Collections.Generic.IEnumerable<TVertex> vertices

Vertices to fill positions.

System.Collections.Generic.IDictionary<TVertex, Point> verticesPositions

Initial vertices positions.

System.Random random

Random number generator to use.

Type Parameters
Name Description
TVertex

Vertex type.

| Improve this Doc View Source

GetClippingPoint(Size, Point, Point)

Computes the clipping point based on clipping rectangle size and two points (center and p)).

Declaration
public static Point GetClippingPoint(Size size, Point center, Point p)
Parameters
Type Name Description
Size size

Clipping zone size.

Point center

Center of the clipping zone.

Point p

Point to clip.

Returns
Type Description
Point

Clipping point.

| Improve this Doc View Source

IsSameDirection(Vector, Vector)

Checks if both Vectors have the same direction.

Declaration
public static bool IsSameDirection(Vector a, Vector b)
Parameters
Type Name Description
Vector a

First vector.

Vector b

Second vector.

Returns
Type Description
System.Boolean

True if both vectors have the same direction, false otherwise.

| Improve this Doc View Source

NormalizePositions<TVertex>(IDictionary<TVertex, Point>)

Normalizes the given verticesPositions.

Declaration
public static void NormalizePositions<TVertex>(IDictionary<TVertex, Point> verticesPositions)
Parameters
Type Name Description
System.Collections.Generic.IDictionary<TVertex, Point> verticesPositions

Vertices positions to normalize.

Type Parameters
Name Description
TVertex

Vertex type.

  • Improve this Doc
  • View Source
In This Article
Back to top GraphShape