Ejemplo n.º 1
0
 public PointRegionQuadTreeNodeBranch(
     BoundingBox bb,
     int level,
     PointRegionQuadTreeNode nw,
     PointRegionQuadTreeNode ne,
     PointRegionQuadTreeNode sw,
     PointRegionQuadTreeNode se)
     : base(bb, level)
 {
     Nw = nw;
     Ne = ne;
     Sw = sw;
     Se = se;
 }
Ejemplo n.º 2
0
        public static PointRegionQuadTreeNode Navigate(
            PointRegionQuadTreeNode current,
            string directions)
        {
            if (string.IsNullOrEmpty(directions))
            {
                return(current);
            }

            var split = directions.SplitCsv();

            for (var i = 0; i < split.Length; i++)
            {
                var branch = (PointRegionQuadTreeNodeBranch)current;
                switch (split[i])
                {
                case "nw":
                    current = branch.Nw;
                    break;

                case "ne":
                    current = branch.Ne;
                    break;

                case "sw":
                    current = branch.Sw;
                    break;

                case "se":
                    current = branch.Se;
                    break;

                default:
                    throw new ArgumentException("Invalid direction " + split[i]);
                }
            }

            return(current);
        }
Ejemplo n.º 3
0
 public static PointRegionQuadTreeNodeLeaf <object> NavigateLeaf(
     PointRegionQuadTreeNode node,
     string directions)
 {
     return((PointRegionQuadTreeNodeLeaf <object>)Navigate(node, directions));
 }