Documentation ¶
Overview ¶
package graph the graph to describe the hierarchical relationship between geometric objects.
Index ¶
- Constants
- func GenerateSteric(g Graph) (matrix.Steric, error)
- func IntersectLine(m1, m2 matrix.LineMatrix) chain.CorrelationNodeResult
- func IntersectLinePolygon(line matrix.LineMatrix, poly matrix.PolygonMatrix) chain.CorrelationNodeResult
- func IntersectPolygons(poly1, poly2 matrix.PolygonMatrix) []chain.CorrelationNodeResult
- func IntersectionHandle(m1, m2 matrix.Steric, g1, g2 Graph) error
- func IntersectmultiLines(m1 matrix.LineMatrix, m2 []matrix.LineMatrix) chain.CorrelationNodeResult
- func RingNodeHandle(m1, m2 matrix.PolygonMatrix, g1, g2 Graph)
- type Clip
- type Graph
- type IntersectionNodeUniqueArrayFilter
- type MatrixGraph
- func (g *MatrixGraph) AddEdge(n1, n2 *Node)
- func (g *MatrixGraph) AddEdgeCost(n1, n2 *Node, value int)
- func (g *MatrixGraph) AddNode(n *Node)
- func (g *MatrixGraph) AddNodeType(n *Node, nodeType int)
- func (g *MatrixGraph) Connected(index int) int
- func (g *MatrixGraph) Degree(index int) int
- func (g *MatrixGraph) DeleteEdge(n1, n2 *Node)
- func (g *MatrixGraph) DeleteEdgeByIndex(n1, n2 int)
- func (g *MatrixGraph) DeleteNode(n *Node)
- func (g *MatrixGraph) Difference(graph Graph) (Graph, error)
- func (g *MatrixGraph) Edge(n1, n2 *Node) bool
- func (g *MatrixGraph) Edges() []map[int]int
- func (g *MatrixGraph) Equals(g1 Graph) bool
- func (g *MatrixGraph) EqualsExact(g1 Graph, tolerance float64) bool
- func (g *MatrixGraph) Intersection(graph Graph) (Graph, error)
- func (g *MatrixGraph) Node(n *Node) (*Node, bool)
- func (g *MatrixGraph) NodeByIndex(index int) (*Node, bool)
- func (g *MatrixGraph) NodeIndex(n *Node) (int, bool)
- func (g *MatrixGraph) Nodes() []*Node
- func (g *MatrixGraph) Order() int
- func (g *MatrixGraph) Proximity(g1 Graph) bool
- func (g *MatrixGraph) String() string
- func (g *MatrixGraph) SymDifference(graph Graph) (Graph, error)
- func (g *MatrixGraph) Union(graph Graph) (Graph, error)
- type Merge
- type Node
Constants ¶
const ( PNode = 1 LNode = 2 CNode = 4 ANode = 8 // DefaultCost default cost. DefaultCost = 1 )
node type
const ( PointPoint = PNode + PNode PointLine = PNode + LNode PointCLine = PNode + CNode PointPoly = PNode + ANode LineLine = LNode + LNode LineCLine = LNode + CNode LinePoly = LNode + ANode )
edge cost
Variables ¶
This section is empty.
Functions ¶
func IntersectLine ¶
func IntersectLine(m1, m2 matrix.LineMatrix) chain.CorrelationNodeResult
IntersectLine returns a Collection that represents that part of geometry A intersect with geometry B.
func IntersectLinePolygon ¶
func IntersectLinePolygon(line matrix.LineMatrix, poly matrix.PolygonMatrix) chain.CorrelationNodeResult
IntersectLinePolygon returns a Collection that represents that part of geometry A intersect with geometry B.
func IntersectPolygons ¶
func IntersectPolygons(poly1, poly2 matrix.PolygonMatrix) []chain.CorrelationNodeResult
IntersectPolygons returns a Collection that represents that part of geometry A intersect with geometry B.
func IntersectionHandle ¶
IntersectionHandle handle graph with m1 and m2.
func IntersectmultiLines ¶
func IntersectmultiLines(m1 matrix.LineMatrix, m2 []matrix.LineMatrix) chain.CorrelationNodeResult
IntersectmultiLines returns a Collection that represents that part of geometry A intersect with geometry B.
func RingNodeHandle ¶
func RingNodeHandle(m1, m2 matrix.PolygonMatrix, g1, g2 Graph)
RingNodeHandle handle graph with m1 and m2.
Types ¶
type Clip ¶
type Clip struct { Arg []matrix.Steric // the arg(s) of the operation ArgGraph []Graph IsDesc bool }
Clip ...
func ClipHandle ¶
ClipHandle handle graph with m1 and m2,returns graph of intersection , union, difference and sym difference.
func (*Clip) Difference ¶
Difference returns a Graph that represents that part of Graph A that does not intersect with Graph B. One can think of this as GraphA - Intersection(A,B).
func (*Clip) Intersection ¶
Intersection Computes the Intersection of two Graph.
func (*Clip) SymDifference ¶
SymDifference returns a Graph that represents the portions of A and B that do not intersect. It is called a symmetric difference because SymDifference(A,B) = SymDifference(B,A).
One can think of this as Union(A,B) - Intersection(A,B).
type Graph ¶
type Graph interface { // Nodes Returns nodes. Nodes() []*Node // Edges Returns edges. Edges() []map[int]int // Degree Returns degrees(num Connected) of node. Degree(index int) int // Connected Returns degree of node. Connected(index int) int // AddNode add a node. AddNode(n *Node) // AddNodeType add a node with type. AddNodeType(n *Node, nodeType int) // AddEdge add a edge. AddEdge(n1, n2 *Node) // AddEdgeCost add a edge. AddEdgeCost(n1, n2 *Node, value int) // DeleteNode removes a node . DeleteNode(n *Node) // DeleteEdge removes an edge from n1 to n2. DeleteEdge(n1, n2 *Node) // Node tells if there is an node . Node(n *Node) (*Node, bool) // NodeIndex tells if there is an node index. NodeIndex(n *Node) (int, bool) // NodeByIndex tells if there is an node by index. NodeByIndex(index int) (*Node, bool) // Edge tells if there is an edge from n1 to n2. Edge(n1, n2 *Node) bool // Order returns the number of vertices in the graph. Order() int // Equals returns the true if g==g1. Equals(g1 Graph) bool // Proximity returns true if if g-g1<DefaultTolerance. Proximity(g1 Graph) bool // Union Computes the Union of two Graph. Union(graph Graph) (Graph, error) // Intersection Computes the Intersection of two Graph. Intersection(graph Graph) (Graph, error) // Difference returns a Graph that represents that part of Graph A that does not intersect with Graph B. // One can think of this as GraphA - Intersection(A,B). Difference(graph Graph) (Graph, error) // SymDifference returns a Graph that represents the portions of A and B that do not intersect. // It is called a symmetric difference because SymDifference(A,B) = SymDifference(B,A). // // One can think of this as Union(A,B) - Intersection(A,B). SymDifference(graph Graph) (Graph, error) // String ... String() string }
Graph represents a graph with a geometry of vertices and weighted edges that can be added or removed. The implementation uses hash maps to associate each vertex in the graph with its adjacent vertices. This gives constant time performance for all basic operations.
func GenerateGraph ¶
GenerateGraph create graph with matrix.
type IntersectionNodeUniqueArrayFilter ¶
type IntersectionNodeUniqueArrayFilter struct {
// contains filtered or unexported fields
}
IntersectionNodeUniqueArrayFilter A Filter that extracts a unique array.
func (*IntersectionNodeUniqueArrayFilter) Entities ¶
func (u *IntersectionNodeUniqueArrayFilter) Entities() interface{}
Entities Returns the gathered Matrixes.
func (*IntersectionNodeUniqueArrayFilter) Filter ¶
func (u *IntersectionNodeUniqueArrayFilter) Filter(entity interface{}) bool
Filter Performs an operation with the provided .
type MatrixGraph ¶
type MatrixGraph struct {
// contains filtered or unexported fields
}
MatrixGraph represents a graph with a geometry of vertices and weighted edges that can be added or removed. The implementation uses hash maps to associate each vertex in the graph with its adjacent vertices. This gives constant time performance for all basic operations.
func (*MatrixGraph) AddEdgeCost ¶
func (g *MatrixGraph) AddEdgeCost(n1, n2 *Node, value int)
AddEdgeCost add a edge.
func (*MatrixGraph) AddNodeType ¶
func (g *MatrixGraph) AddNodeType(n *Node, nodeType int)
AddNodeType add a node with type.
func (*MatrixGraph) Connected ¶
func (g *MatrixGraph) Connected(index int) int
Connected Returns num Connected of node.
func (*MatrixGraph) Degree ¶
func (g *MatrixGraph) Degree(index int) int
Degree Returns degree of node.
func (*MatrixGraph) DeleteEdge ¶
func (g *MatrixGraph) DeleteEdge(n1, n2 *Node)
DeleteEdge removes an edge from n1 to n2.
func (*MatrixGraph) DeleteEdgeByIndex ¶
func (g *MatrixGraph) DeleteEdgeByIndex(n1, n2 int)
DeleteEdgeByIndex removes an edge from n1 to n2.
func (*MatrixGraph) DeleteNode ¶
func (g *MatrixGraph) DeleteNode(n *Node)
DeleteNode removes a node.
func (*MatrixGraph) Difference ¶
func (g *MatrixGraph) Difference(graph Graph) (Graph, error)
Difference returns a Graph that represents that part of Graph A that does not intersect with Graph B. One can think of this as GraphA - Intersection(A,B).
func (*MatrixGraph) Edge ¶
func (g *MatrixGraph) Edge(n1, n2 *Node) bool
Edge tells if there is an edge from n1 to n2.
func (*MatrixGraph) Equals ¶
func (g *MatrixGraph) Equals(g1 Graph) bool
Equals returns the true if g==g1.
func (*MatrixGraph) EqualsExact ¶
func (g *MatrixGraph) EqualsExact(g1 Graph, tolerance float64) bool
EqualsExact returns the true if g-g1<tolerance.
func (*MatrixGraph) Intersection ¶
func (g *MatrixGraph) Intersection(graph Graph) (Graph, error)
Intersection Computes the Intersection of two Graph.
func (*MatrixGraph) Node ¶
func (g *MatrixGraph) Node(n *Node) (*Node, bool)
Node tells if there is an node .
func (*MatrixGraph) NodeByIndex ¶
func (g *MatrixGraph) NodeByIndex(index int) (*Node, bool)
NodeByIndex tells if there is an node by index.
func (*MatrixGraph) NodeIndex ¶
func (g *MatrixGraph) NodeIndex(n *Node) (int, bool)
NodeIndex tells if there is an node index.
func (*MatrixGraph) Order ¶
func (g *MatrixGraph) Order() int
Order returns the number of vertices in the graph.
func (*MatrixGraph) Proximity ¶
func (g *MatrixGraph) Proximity(g1 Graph) bool
Proximity returns true if if g-g1<DefaultTolerance.
func (*MatrixGraph) SymDifference ¶
func (g *MatrixGraph) SymDifference(graph Graph) (Graph, error)
SymDifference returns a Graph that represents the portions of A and B that do not intersect. It is called a symmetric difference because SymDifference(A,B) = SymDifference(B,A).
One can think of this as Union(A,B) - Intersection(A,B).
type Merge ¶ added in v1.1.1
type Merge struct { Arg []matrix.Steric // the arg(s) of the operation ArgGraph []Graph IsDesc bool }
Merge ...
func MergeHandle ¶ added in v1.1.1
MergeHandle handle graph with m1 and m2,returns graph of intersection , union, difference and sym difference.
func (*Merge) Difference ¶ added in v1.1.1
Difference returns a Graph that represents that part of Graph A that does not intersect with Graph B. One can think of this as GraphA - Intersection(A,B).
func (*Merge) Intersection ¶ added in v1.1.1
Intersection Computes the Intersection of two Graph.
func (*Merge) SymDifference ¶ added in v1.1.1
SymDifference returns a Graph that represents the portions of A and B that do not intersect. It is called a symmetric difference because SymDifference(A,B) = SymDifference(B,A).
One can think of this as Union(A,B) - Intersection(A,B).
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package clipping the spatial geometric operation and reconstruction between entities is realized.
|
Package clipping the spatial geometric operation and reconstruction between entities is realized. |
package de9im the criteria for judging the various topological relations between points, line and surface entities in DE-9IM model are given.
|
package de9im the criteria for judging the various topological relations between points, line and surface entities in DE-9IM model are given. |
Package dissovle Slice a geometric polygon.
|
Package dissovle Slice a geometric polygon. |
package graphtests is include test datas.
|
package graphtests is include test datas. |