Example #1
0
        public override void ProcessEntity(PicEntity entity)
        {
            PicTypedDrawable drawable = entity as PicTypedDrawable;

            if (entity is PicSegment || entity is PicArc)
            {
                ExpBlock defblock = _exporter.GetBlockOrCreate("default");
                ExportEntity(defblock, entity);
            }
            PicBlock block = entity as PicBlock;

            if (null != block)
            {
                // create block
                ExpBlock expBlock = _exporter.CreateBlock(string.Format("Block_{0}", block.Id));
                // create _x=0.0 _y=0.0
                ExpBlockRef expBlockRef = _exporter.CreateBlockRef(expBlock);
                // create entities
                foreach (PicEntity blockEntity in block.Entities)
                {
                    ExportEntity(expBlock, blockEntity);
                }
            }
            PicBlockRef blockRef = entity as PicBlockRef;

            if (null != blockRef)
            {
                // retrieve previously created block
                ExpBlock    expBlock    = _exporter.GetBlock(string.Format("Block_{0}", blockRef.Block.Id));
                ExpBlockRef expBlockRef = _exporter.CreateBlockRef(expBlock);
                expBlockRef._x      = blockRef.Position.X;
                expBlockRef._y      = blockRef.Position.Y;
                expBlockRef._dir    = blockRef.Angle;
                expBlockRef._scaleX = 1.0;
                expBlockRef._scaleY = 1.0;
            }
        }