コード例 #1
0
        /// <summary>
        /// first and count denine the segment  needed to be split into two groups
        /// </summary>
        /// <param name="first"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        BBNode ProcessGroup(int first, int count)
        {
            if (count > 1)
            {
                int            seed0;
                MsaglRectangle b0;
                int            seed1;
                FindSeeds(first, count, out seed0, out b0, out seed1);
                MsaglRectangle b1;
                int            count0;
                int            count1;
                SplitOnGroups(first, count, seed0, ref b0, seed1, out b1, out count0, out count1);
                BBNode node = new BBNode();
                node.bBox         = new MsaglRectangle(b0, b1);
                node.left         = ProcessGroup(first, count0);
                node.left.parent  = node;
                node.right        = ProcessGroup(first + count0, count1);
                node.right.parent = node;
                return(node);
            }

            if (count == 1)
            {
                Geometry geom = geometries[first] as Geometry;
                if (geom != null)
                {
                    BBNode node = new BBNode();
                    node.geometry = geom;
                    return(node);
                }

                DObject dObject = geometries[first] as DObject;

                if (dObject != null)
                {
                    return(dObject.BBNode);
                }
            }

            return(null);
        }
コード例 #2
0
        /// <summary>
        /// first and count denine the segment  needed to be split into two groups
        /// </summary>
        /// <param name="first"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        BBNode ProcessGroup(int first, int count)
        {
            if (count > 1)
            {
                int seed0;
                MsaglRectangle b0;
                int seed1;
                FindSeeds(first, count, out seed0, out b0, out seed1);
                MsaglRectangle b1;
                int count0;
                int count1;
                SplitOnGroups(first, count, seed0, ref b0, seed1, out b1, out count0, out count1);
                BBNode node = new BBNode();
                node.bBox = new MsaglRectangle(b0, b1);
                node.left = ProcessGroup(first, count0);
                node.left.parent = node;
                node.right = ProcessGroup(first + count0, count1);
                node.right.parent = node;
                return node;
            }

            if (count == 1)
            {
                Geometry geom = geometries[first] as Geometry;
                if (geom != null)
                {
                    BBNode node = new BBNode();
                    node.geometry = geom;
                    return node;
                }

                DObject dObject = geometries[first] as DObject;

                if (dObject != null)
                    return dObject.BBNode;

            }

            return null;
        }
コード例 #3
0
 static BBNode BuildBBHierarchyUnderDNode(DNode dNode)
 {
     var bbNode = new BBNode();
     bbNode.geometry = new Geometry(dNode);
     bbNode.bBox = dNode.DrawingNode.BoundingBox;
     return bbNode;
 }
コード例 #4
0
 private void UpdateBoxes(BBNode bbNode)
 {
     if (bbNode != null)
     {
         if (bbNode.Box.IsEmpty)
         {
             if (bbNode.geometry != null)
                 bbNode.bBox = bbNode.geometry.Box;
             else
             {
                 UpdateBoxes(bbNode.left);
                 UpdateBoxes(bbNode.right);
                 bbNode.bBox = bbNode.left.Box;
                 bbNode.bBox.Add(bbNode.right.Box);
             }
         }
     }
 }
コード例 #5
0
 static BBNode BuildBBHierarchyUnderDLabel(DLabel dLabel)
 {
     var bbNode = new BBNode();
     bbNode.geometry = new Geometry(dLabel);
     bbNode.bBox = dLabel.Label.BoundingBox;
     return bbNode;
 }