// //You can use the following additional attributes as you write your tests: // //Use ClassInitialize to run code before running the first test in the class //[ClassInitialize()] //public static void MyClassInitialize(TestContext testContext) //{ //} // //Use ClassCleanup to run code after all tests in a class have run //[ClassCleanup()] //public static void MyClassCleanup() //{ //} // //Use TestInitialize to run code before running each test //[TestInitialize()] //public void MyTestInitialize() //{ //} // //Use TestCleanup to run code after each test has run //[TestCleanup()] //public void MyTestCleanup() //{ //} // #endregion internal virtual IRTreeDataContainer CreateIRTreeDataContainer() { // TODO: Instantiate an appropriate concrete class. IRTreeDataContainer target = null; return(target); }
public void GraphElementUnitTest() { Assert.Inconclusive("TODO"); IRTreeDataContainer target = CreateIRTreeDataContainer(); // TODO: Initialize to an appropriate value AGraphElement expected = null; // TODO: Initialize to an appropriate value AGraphElement actual; target.GraphElement = expected; actual = target.GraphElement; Assert.AreEqual(expected, actual); }
private ReadOnlyCollection<AGraphElement> Searching(IRTreeDataContainer element, SpatialFilter spatialPredicate, SpatialFilter dataContainerPredicate) { var stack = new Stack<ARTreeContainer>(); var currentResult = new List<AGraphElement>(); if (spatialPredicate(_root, element)) stack.Push(_root); while (stack.Count > 0) { var currentContainer = stack.Pop(); if (!currentContainer.IsLeaf) { foreach (var value in ((RTreeNode)currentContainer).Children) { if (spatialPredicate(value, element)) stack.Push(value); } } else { foreach (var value in ((RTreeLeaf)currentContainer).Data) { if (dataContainerPredicate(value, element)) { currentResult.Add(value.GraphElement); } } } } return currentResult.AsReadOnly(); }
/// <summary> /// searching of distance /// </summary> /// <param name="searchContainer"> /// container for searching /// </param> /// <returns> /// list of result /// </returns> private ReadOnlyCollection<AGraphElement> OverlapSearch(IRTreeDataContainer searchContainer) { var stack = new Stack<ARTreeContainer>(); var currentResult = new List<AGraphElement>(); if (_root.Intersection(searchContainer)) stack.Push(_root); while (stack.Count > 0) { var currentContainer = stack.Pop(); if (!currentContainer.IsLeaf) { foreach (var value in ((RTreeNode)currentContainer).Children) { if (value.Intersection(searchContainer)) stack.Push(value); } } else { var container = (RTreeLeaf) currentContainer; for (var i = 0; i < container.Data.Count; i++) { if (container.Data[i].Intersection(searchContainer)) { currentResult.Add(container.Data[i].GraphElement); } } } } return currentResult.AsReadOnly(); }
private void InsertData(IRTreeDataContainer container) { // for (int i = 1; i < this.levelForOverflowStrategy.Count; i++) // levelForOverflowStrategy[i] = true; Insert(container, _levelForOverflowStrategy.Count - 1); // for (int i = 1; i < this.levelForOverflowStrategy.Count; i++) // levelForOverflowStrategy[i] = false; }
/// <summary> /// create new search container /// </summary> /// <param name="element"> /// container of data with element of graph /// </param> /// <param name="distance"> /// distance /// </param> /// <returns> /// container for searching /// </returns> private SpatialDataContainer CreateSearchContainer(IRTreeDataContainer element, float distance) { return CreateSearchContainer(new MBR(element.LowerPoint, element.UpperPoint), distance); }