Example #1
0
        /**
         * Initialization
         */
        private void initialize()
        {
            EscherRecordData er = new EscherRecordData(this, 0);

            Assert.verify(er.isContainer());

            EscherContainer dgContainer = new EscherContainer(er);

            EscherRecord[] children = dgContainer.getChildren();

            children = dgContainer.getChildren();
            // Dg dg = (Dg) children[0];

            EscherContainer spgrContainer = null;

            for (int i = 0; i < children.Length && spgrContainer == null; i++)
            {
                EscherRecord child = children[i];
                if (child.getType() == EscherRecordType.SPGR_CONTAINER)
                {
                    spgrContainer = (EscherContainer)child;
                }
            }
            Assert.verify(spgrContainer != null);

            EscherRecord[] spgrChildren = spgrContainer.getChildren();

            // See if any of the spgrChildren are SpgrContainer
            bool nestedContainers = false;

            for (int i = 0; i < spgrChildren.Length && !nestedContainers; i++)
            {
                if (spgrChildren[i].getType() == EscherRecordType.SPGR_CONTAINER)
                {
                    nestedContainers = true;
                }
            }

            // If there are no nested containers, simply set the spContainer list
            // to be the list of children
            if (!nestedContainers)
            {
                spContainers = spgrChildren;
            }
            else
            {
                // Go through the hierarchy and dig out all the Sp containers
                ArrayList sps = new ArrayList();
                getSpContainers(spgrContainer, sps);

                spContainers = new EscherRecord[sps.Count];
                int pos = 0;
                foreach (EscherRecord record in sps)
                {
                    spContainers[pos++] = record;
                }
            }

            initialized = true;
        }
Example #2
0
        /**
         * Initializes the drawing data from the escher record read in
         */
        private void initialize()
        {
            EscherRecordData er = new EscherRecordData(this, 0);

            Assert.verify(er.isContainer());

            escherData = new EscherContainer(er);

            Assert.verify(escherData.getLength() == drawingData.Length);
            Assert.verify(escherData.getType() == EscherRecordType.DGG_CONTAINER);

            initialized = true;
        }
        /**
         * Initialization
         */
        private void initialize()
        {
            EscherRecordData er = new EscherRecordData(this,0);
            Assert.verify(er.isContainer());

            EscherContainer dgContainer = new EscherContainer(er);
            EscherRecord[] children = dgContainer.getChildren();

            children = dgContainer.getChildren();
            // Dg dg = (Dg) children[0];

            EscherContainer spgrContainer = null;

            for (int i = 0; i < children.Length && spgrContainer == null; i++)
                {
                EscherRecord child = children[i];
                if (child.getType() == EscherRecordType.SPGR_CONTAINER)
                    {
                    spgrContainer = (EscherContainer)child;
                    }
                }
            Assert.verify(spgrContainer != null);

            EscherRecord[] spgrChildren = spgrContainer.getChildren();

            // See if any of the spgrChildren are SpgrContainer
            bool nestedContainers = false;
            for (int i = 0; i < spgrChildren.Length && !nestedContainers; i++)
                {
                if (spgrChildren[i].getType() == EscherRecordType.SPGR_CONTAINER)
                    {
                    nestedContainers = true;
                    }
                }

            // If there are no nested containers, simply set the spContainer list
            // to be the list of children
            if (!nestedContainers)
                spContainers = spgrChildren;
            else
                {
                // Go through the hierarchy and dig out all the Sp containers
                ArrayList sps = new ArrayList();
                getSpContainers(spgrContainer,sps);

                spContainers = new EscherRecord[sps.Count];
                int pos = 0;
                foreach (EscherRecord record in sps)
                    spContainers[pos++] = record;
                }

            initialized = true;
        }