示例#1
0
        /// <summary> Interface method to remove a drawing from the group
        ///
        /// </summary>
        /// <param name="d">the drawing to remove
        /// </param>
        public virtual void  remove(Drawing d)
        {
            if (origin == READ)
            {
                origin   = READ_WRITE;
                numBlips = BStoreContainer.NumBlips;
                Dgg dgg = (Dgg)escherData.Children[0];
                drawingGroupId = dgg.getCluster(1).drawingGroupId - numBlips - 1;
            }

            // Get the blip
            EscherRecord[] children = BStoreContainer.Children;
            BlipStoreEntry bse      = (BlipStoreEntry)children[d.BlipId - 1];

            bse.dereference();

            if (bse.ReferenceCount == 0)
            {
                // Remove the blip
                BStoreContainer.remove(bse);

                // Adjust blipId on the other blips
                foreach (Drawing drawing in drawings)
                {
                    if (drawing.BlipId > d.BlipId)
                    {
                        drawing.setObjectId(drawing.getObjectId(), drawing.BlipId - 1);
                    }
                }


                numBlips--;
            }
        }