Class K2DTree<T>
Inheritance
System.Object
Mars.Common.Core.Collections.SimpleTree.BinaryTree<K2dTreeNode<T>>
K2DTree<T>
Inherited Members
Mars.Common.Core.Collections.SimpleTree.BinaryTree<Mars.Common.Collections.K2dTreeNode<T>>.Root
Mars.Common.Core.Collections.SimpleTree.BinaryTree<Mars.Common.Collections.K2dTreeNode<T>>.GetEnumerator()
Mars.Common.Core.Collections.SimpleTree.BinaryTree<Mars.Common.Collections.K2dTreeNode<T>>.System.Collections.IEnumerable.GetEnumerator()
Mars.Common.Core.Collections.SimpleTree.BinaryTree<Mars.Common.Collections.K2dTreeNode<T>>.SerializeJson()
Mars.Common.Core.Collections.SimpleTree.BinaryTree<Mars.Common.Collections.K2dTreeNode<T>>.Traverse(Mars.Common.Core.Collections.SimpleTree.BinaryTraversalMethod<Mars.Common.Collections.K2dTreeNode<T>>)
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: Mars.Common.Collections
Assembly: Mars.Common.dll
Syntax
[Serializable]
public class K2DTree<T> : KdTreeBase<K2dTreeNode<T>>, IEnumerable<K2dTreeNode<T>>, IEnumerable
Type Parameters
Name | Description |
---|---|
T |
Constructors
| Improve this Doc View SourceK2DTree()
Creates a new KdTree<T>.
Declaration
public K2DTree()
K2DTree(K2dTreeNode<T>, Int32, Int32)
Creates a new KdTree<T>.
Declaration
public K2DTree(K2dTreeNode<T> root, int count, int leaves)
Parameters
Type | Name | Description |
---|---|---|
K2dTreeNode<T> | root | The Root node, if already existent. |
System.Int32 | count | The number of elements in the Root node. |
System.Int32 | leaves | The number of leaves linked through the Root node. |
K2DTree(K2dTreeNode<T>)
Creates a new KdTree<T>.
Declaration
public K2DTree(K2dTreeNode<T> root)
Parameters
Type | Name | Description |
---|---|---|
K2dTreeNode<T> | root | The Root node, if already existent. |
Methods
| Improve this Doc View SourceAdd(T, Double[])
Inserts a value in the tree at the desired position.
Declaration
public void Add(T value, params double[] position)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to be inserted. |
System.Double[] | position | A double-vector with the same number of elements as dimensions in the tree. |
Add(Position, T)
Adds a new Position to this tree
Declaration
public void Add(Position position, T value)
Parameters
Type | Name | Description |
---|---|---|
Position | position | A Position with respective coordinate, geospatial or not |
T | value | The value to be inserted |
Add(Double[], T)
Inserts a value in the tree at the desired position.
Declaration
public void Add(double[] position, T value)
Parameters
Type | Name | Description |
---|---|---|
System.Double[] | position | A double-vector with the same number of elements as dimensions in the tree. |
T | value | The value to be inserted. |
CreateTreeFrom(Double[][], T[], IMetric<Double[]>)
Creates a new K2DTree<T> for geospatial points with the Haversine distance
function used to distinct the coordinates with spherical background more precisely.
Declaration
public static K2DTree<T> CreateTreeFrom(double[][] points, T[] data, IMetric<double[]> metric = null)
Parameters
Type | Name | Description |
---|---|---|
System.Double[][] | points | The multi-dimensional points from which to create the space. |
T[] | data | The data set for each respective point entry. |
IMetric<System.Double[]> | metric | The distance function used to separate the coordinates. |
Returns
Type | Description |
---|---|
K2DTree<T> |
Returns a new K2DTree<T> containing all points associated to the data elements.
|
Deserialize(TreeDataContainer<T>)
Declaration
public static K2DTree<T> Deserialize(TreeDataContainer<T> container)
Parameters
Type | Name | Description |
---|---|---|
TreeDataContainer<T> | container |
Returns
Type | Description |
---|---|
K2DTree<T> |
Deserialize(String)
Declaration
public static K2DTree<T> Deserialize(string binaryFile)
Parameters
Type | Name | Description |
---|---|---|
System.String | binaryFile |
Returns
Type | Description |
---|---|
K2DTree<T> |
Serialize()
Converts the K2DTree<T> into managed message type as TreeDataContainer<T>.
Declaration
public TreeDataContainer<T> Serialize()
Returns
Type | Description |
---|---|
TreeDataContainer<T> | Returns a new TreeDataContainer<T> which is prepared to serialize it into binary format using MessagePack.MessagePackSerializer. |
Implements
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable