overlay

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2022 License: LGPL-2.1 Imports: 10 Imported by: 0

Documentation

Overview

Package overlay the spatial geometric operation and reconstruction between entities is realized.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPointToVertexSlice

func AddPointToVertexSlice(edges []*Edge, pStart, pEnd, ip *Vertex)

AddPointToVertexSlice add point to vertex slice

func Difference

func Difference(m0, m1 matrix.Steric) (matrix.Steric, error)

Difference returns a geometry that represents that part of geometry A that does not intersect with geometry B. One can think of this as GeometryA - Intersection(A,B). If A is completely contained in B then an empty geometry collection is returned.

func IntersectLine

func IntersectLine(m, m1 matrix.LineMatrix) []relate.IntersectionResult

IntersectLine returns a array that represents that part of geometry A intersect with geometry B.

func Intersection

func Intersection(m0, m1 matrix.Steric) (matrix.Steric, error)

Intersection Computes the Intersection of two geometries,either or both of which may be null.

func LineMerge

func LineMerge(ml matrix.Collection) matrix.Collection

LineMerge returns a Geometry containing the LineMerges.

or an empty atomic geometry, or an empty GEOMETRYCOLLECTION

todo Rewrite with monotone chain

func MergeLine

func MergeLine(ml matrix.Collection, i, j int) (matrix.Collection, bool)

MergeLine Computes the Merge of two geometries.

func MergeMatrix added in v1.0.1

func MergeMatrix(ml matrix.Collection, i, j int, result matrix.Collection) (matrix.Collection, bool)

MergeMatrix Computes the Merge of two geometries,either or both of which may be matrix.

func SliceContains

func SliceContains(list []Vertex, p *Vertex) (int, error)

SliceContains Returns index of slice.

func SymDifference

func SymDifference(m0, m1 matrix.Steric) (matrix.Steric, error)

SymDifference returns a geometry 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(geomA,geomB) - Intersection(A,B).

func ToPolygonMatrix

func ToPolygonMatrix(poly *Plane) matrix.PolygonMatrix

ToPolygonMatrix ...

func UnaryUnion

func UnaryUnion(matrix4 matrix.Steric) matrix.Steric

UnaryUnion returns a Geometry containing the union.

or an empty atomic geometry, or an empty GEOMETRYCOLLECTION

func UnaryUnionByHalf

func UnaryUnionByHalf(matrix4 matrix.Collection, start, end int) matrix.Steric

UnaryUnionByHalf returns Unions a section of a list using a recursive binary union on each half of the section.

func Union

func Union(m0, m1 matrix.Steric) (result matrix.Steric)

Union Computes the Union of two geometries,either or both of which may be null.

func UnionLine

func UnionLine(m0, m1 matrix.LineMatrix) matrix.Steric

UnionLine Computes the Union of two geometries,either or both of which may be null.

func UnionPolygon added in v1.0.2

func UnionPolygon(m0, m1 matrix.PolygonMatrix) matrix.Steric

UnionPolygon Computes the UnionPolygon of two geometries,either or both of which may be null.

Types

type ComputeClipOverlay

type ComputeClipOverlay struct {
	*PolygonOverlay
}

ComputeClipOverlay merge overlay polygon.

func (*ComputeClipOverlay) Compute

func (c *ComputeClipOverlay) Compute(pol *Plane, start *Vertex, which bool) *Vertex

Compute overlay polygon.

func (*ComputeClipOverlay) Next

func (c *ComputeClipOverlay) Next(pol *Plane, start *Vertex) *Vertex

Next overlay polygon.

type ComputeMainOverlay

type ComputeMainOverlay struct {
	*PolygonOverlay
}

ComputeMainOverlay merge overlay polygon.

func (*ComputeMainOverlay) Compute

func (c *ComputeMainOverlay) Compute(pol *Plane, start *Vertex, which bool) *Vertex

Compute overlay polygon.

func (*ComputeMainOverlay) Next

func (c *ComputeMainOverlay) Next(pol *Plane, start *Vertex) *Vertex

Next overlay polygon.

type ComputeMergeOverlay

type ComputeMergeOverlay struct {
	*PolygonOverlay
}

ComputeMergeOverlay merge overlay polygon.

func (*ComputeMergeOverlay) Compute

func (c *ComputeMergeOverlay) Compute(pol *Plane, start *Vertex, which bool) *Vertex

Compute overlay polygon.

func (*ComputeMergeOverlay) Next

func (c *ComputeMergeOverlay) Next(pol *Plane, start *Vertex) *Vertex

Next overlay polygon.

type ComputePolyOverlay

type ComputePolyOverlay interface {
	Next(pol *Plane, start *Vertex) *Vertex
	Compute(pol *Plane, start *Vertex, which bool) *Vertex
}

ComputePolyOverlay overlay polygon.

type Edge

type Edge struct {
	Vertexes    []Vertex
	IsClockwise bool
	NowStatus   int
}

Edge ...

func (*Edge) AreaDirection

func (e *Edge) AreaDirection() float64

AreaDirection Returns area <0 if direction is true, area > 0 else.

func (*Edge) SetClockwise

func (e *Edge) SetClockwise()

SetClockwise with AreaDirection.

type Line

type Line struct {
	Start, End *Vertex
	IsMain     bool
}

Line straight line .

type LineOverlay

type LineOverlay struct {
	*PointOverlay
}

LineOverlay Computes the overlay of two geometries,either or both of which may be nil.

func (*LineOverlay) Difference

func (p *LineOverlay) Difference() (matrix.Steric, error)

Difference returns a geometry that represents that part of geometry A that does not intersect with geometry B. One can think of this as GeometryA - Intersection(A,B). If A is completely contained in B then an empty geometry collection is returned.

func (*LineOverlay) DifferenceReverse

func (p *LineOverlay) DifferenceReverse() (matrix.Steric, error)

DifferenceReverse returns a geometry that represents reverse that part of geometry A that does not intersect with geometry B . One can think of this as GeometryB - Intersection(A,B). If B is completely contained in A then an empty geometry collection is returned.

func (*LineOverlay) Intersection

func (p *LineOverlay) Intersection() (matrix.Steric, error)

Intersection Computes the Intersection of two geometries,either or both of which may be nil.

func (*LineOverlay) SymDifference

func (p *LineOverlay) SymDifference() (matrix.Steric, error)

SymDifference returns a geometry 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(geomA,geomB) - Intersection(A,B).

func (*LineOverlay) Union

func (p *LineOverlay) Union() (matrix.Steric, error)

Union Computes the Union of two geometries,either or both of which may be nil.

type Overlay

type Overlay interface {

	// Union  Computes the Union of two geometries,either or both of which may be nil.
	Union() (matrix.Steric, error)

	// Intersection  Computes the Intersection of two geometries,either or both of which may be nil.
	Intersection() (matrix.Steric, error)

	// Difference returns a geometry that represents that part of geometry A that does not intersect with geometry B.
	// One can think of this as GeometryA - Intersection(A,B).
	// If A is completely contained in B then an empty geometry collection is returned.
	Difference() (matrix.Steric, error)

	// SymDifference returns a geometry 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(geomA,geomB) - Intersection(A,B).
	SymDifference() (matrix.Steric, error)
}

Overlay Computes the overlay of two geometries,either or both of which may be nil.

type Plane

type Plane struct {
	Lines []Line
	Rings []*Edge
	Edge  *Edge
	Rank  int
}

Plane is a closed area. The first edge is the outer ring. The others are the holes. Each edge is expected to be closed ie. the first point matches the last.

func (*Plane) AddPoint

func (p *Plane) AddPoint(point *Vertex)

AddPoint add a point in polyon.

func (*Plane) AddPointWhich

func (p *Plane) AddPointWhich(point *Vertex, which bool)

AddPointWhich add a point in polyon with which.

func (*Plane) ChangeRank

func (p *Plane) ChangeRank()

ChangeRank change rank .

func (*Plane) CloseRing

func (p *Plane) CloseRing()

CloseRing close edge to ring.

func (*Plane) Equal

func (p *Plane) Equal(pol *Plane) bool

Equal Returns p == pol .

func (*Plane) IsVertexInHole added in v1.0.2

func (p *Plane) IsVertexInHole(v *Vertex) (inHole bool)

IsVertexInHole ...

func (*Plane) Reverse added in v1.0.2

func (p *Plane) Reverse()

Reverse reverse vertexes

func (*Plane) ToString

func (p *Plane) ToString() string

ToString printf polygon to string

type PointOverlay

type PointOverlay struct {
	Subject, Clipping matrix.Steric
}

PointOverlay Computes the overlay of two geometries,either or both of which may be nil.

func (*PointOverlay) Difference

func (p *PointOverlay) Difference() (matrix.Steric, error)

Difference returns a geometry that represents that part of geometry A that does not intersect with geometry B. One can think of this as GeometryA - Intersection(A,B). If A is completely contained in B then an empty geometry collection is returned.

func (*PointOverlay) DifferenceReverse

func (p *PointOverlay) DifferenceReverse() (matrix.Steric, error)

DifferenceReverse returns a geometry that represents reverse that part of geometry A that does not intersect with geometry B . One can think of this as GeometryB - Intersection(A,B). If B is completely contained in A then an empty geometry collection is returned.

func (*PointOverlay) Intersection

func (p *PointOverlay) Intersection() (matrix.Steric, error)

Intersection Computes the Intersection of two geometries,either or both of which may be nil.

func (*PointOverlay) SymDifference

func (p *PointOverlay) SymDifference() (matrix.Steric, error)

SymDifference returns a geometry 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(geomA,geomB) - Intersection(A,B).

func (*PointOverlay) Union

func (p *PointOverlay) Union() (matrix.Steric, error)

Union Computes the Union of two geometries,either or both of which may be nil.

type PolygonOverlay

type PolygonOverlay struct {
	*PointOverlay
	// contains filtered or unexported fields
}

PolygonOverlay Computes the overlay of two geometries,either or both of which may be nil.

func (*PolygonOverlay) ComputePolygon

func (p *PolygonOverlay) ComputePolygon(exitingPoints []Vertex, cpo ComputePolyOverlay) *Plane

ComputePolygon compute overlay.

func (*PolygonOverlay) Difference

func (p *PolygonOverlay) Difference() (matrix.Steric, error)

Difference returns a geometry that represents that part of geometry A that does not intersect with geometry B. One can think of this as GeometryA - Intersection(A,B). If A is completely contained in B then an empty geometry collection is returned.

func (*PolygonOverlay) DifferenceReverse

func (p *PolygonOverlay) DifferenceReverse() (matrix.Steric, error)

DifferenceReverse returns a geometry that represents reverse that part of geometry A that does not intersect with geometry B . One can think of this as GeometryB - Intersection(A,B). If B is completely contained in A then an empty geometry collection is returned.

func (*PolygonOverlay) Intersection

func (p *PolygonOverlay) Intersection() (matrix.Steric, error)

Intersection Computes the Intersection of two geometries,either or both of which may be nil.

func (*PolygonOverlay) SymDifference

func (p *PolygonOverlay) SymDifference() (matrix.Steric, error)

SymDifference returns a geometry 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(geomA,geomB) - Intersection(A,B).

func (*PolygonOverlay) Union

func (p *PolygonOverlay) Union() (matrix.Steric, error)

Union Computes the Union of two geometries,either or both of which may be nil.

func (*PolygonOverlay) Weiler

func (p *PolygonOverlay) Weiler() (enteringPoints, exitingPoints []Vertex)

Weiler Weiler overlay.

type UniqueVertexFilter

type UniqueVertexFilter struct {
	Ips []Vertex
}

UniqueVertexFilter A Filter that extracts a unique array.

func (*UniqueVertexFilter) Entities added in v1.0.2

func (u *UniqueVertexFilter) Entities() interface{}

Entities Returns the gathered Matrixes.

func (*UniqueVertexFilter) Filter

func (u *UniqueVertexFilter) Filter(ip interface{}) bool

Filter Performs an operation with the provided .

type Vertex

type Vertex struct {
	matrix.Matrix
	IsIntersectionPoint, IsEntering, IsChecked bool
}

Vertex overlay point.

func (*Vertex) Equals added in v1.0.2

func (v *Vertex) Equals(point *Vertex) bool

Equals Returns p == point .

func (*Vertex) Sub

func (v *Vertex) Sub(point *Vertex) *Vertex

Sub Returns p - point .

func (*Vertex) X

func (v *Vertex) X() float64

X Returns x .

func (*Vertex) Y

func (v *Vertex) Y() float64

Y Returns y .

Directories

Path Synopsis
Package chain Define Monotone Chains,it is a way of partitioning the segments of a linestring to allow for fast searching of intersections.
Package chain Define Monotone Chains,it is a way of partitioning the segments of a linestring to allow for fast searching of intersections.
Package snap Snaps the vertices and segments of a Geometry's vertices to another Geometry's vertices.
Package snap Snaps the vertices and segments of a Geometry's vertices to another Geometry's vertices.
Package sweepline Contains struct which implement a sweepline algorithm for scanning geometric data structures.
Package sweepline Contains struct which implement a sweepline algorithm for scanning geometric data structures.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL