Esempio n. 1
0
 private static void Subdivide(
     XYWHRectangleMultiType rectangle,
     MXCIFQuadTreeNodeBranch branch,
     MXCIFQuadTree tree,
     bool unique,
     string indexName)
 {
     var x = rectangle.X;
     var y = rectangle.Y;
     var w = rectangle.W;
     var h = rectangle.H;
     var quadrant = branch.Bb.GetQuadrantApplies(x, y, w, h);
     if (quadrant == QuadrantAppliesEnum.NW) {
         branch.Nw = AddToNode(x, y, w, h, rectangle, branch.Nw, tree, unique, indexName);
     }
     else if (quadrant == QuadrantAppliesEnum.NE) {
         branch.Ne = AddToNode(x, y, w, h, rectangle, branch.Ne, tree, unique, indexName);
     }
     else if (quadrant == QuadrantAppliesEnum.SW) {
         branch.Sw = AddToNode(x, y, w, h, rectangle, branch.Sw, tree, unique, indexName);
     }
     else if (quadrant == QuadrantAppliesEnum.SE) {
         branch.Se = AddToNode(x, y, w, h, rectangle, branch.Se, tree, unique, indexName);
     }
     else if (quadrant == QuadrantAppliesEnum.SOME) {
         var numAdded = AddToData(branch, x, y, w, h, rectangle, unique, indexName);
         branch.IncCount(numAdded);
     }
     else {
         throw new IllegalStateException("No intersection");
     }
 }
        private static ICollection<object> Visit(
            XYWHRectangleMultiType rectangle,
            double x,
            double y,
            double width,
            double height,
            ICollection<object> result)
        {
            if (!BoundingBox.IntersectsBoxIncludingEnd(
                x,
                y,
                x + width,
                y + height,
                rectangle.X,
                rectangle.Y,
                rectangle.W,
                rectangle.H)) {
                return result;
            }

            if (result == null) {
                result = new ArrayDeque<object>(4);
            }

            rectangle.CollectInto(result);
            return result;
        }
Esempio n. 3
0
 private static EPException HandleUniqueViolation(
     string indexName,
     XYWHRectangleMultiType other)
 {
     return PropertyHashedEventTableUnique.HandleUniqueIndexViolation(
         indexName,
         string.Format("({0},{1},{2},{3})", 
             other.X.RenderAny(),
             other.Y.RenderAny(), 
             other.W.RenderAny(), 
             other.H.RenderAny()));
 }
 internal static void Compare(
     double x,
     double y,
     double width,
     double height,
     string expected,
     XYWHRectangleMultiType rectangle)
 {
     Assert.AreEqual(x, rectangle.X);
     Assert.AreEqual(y, rectangle.Y);
     Assert.AreEqual(width, rectangle.W);
     Assert.AreEqual(height, rectangle.H);
     Assert.AreEqual(expected, rectangle.Multityped.RenderAny());
 }
Esempio n. 5
0
        public void AddMultiType(XYWHRectangleMultiType other)
        {
            if (other.X != X || other.Y != Y) throw new ArgumentException("Coordinate mismatch");
            if (!(other.Multityped is Collection)) {
                AddSingleValue(other.Multityped);
                return;
            }

            var otherCollection = (Collection) other.Multityped;
            if (Multityped is Collection collection) {
                collection.AddAll(otherCollection);
                return;
            }

            var coll = new LinkedList<object>();
            coll.AddLast(Multityped);
            coll.AddAll(otherCollection);
            Multityped = coll;
        }