예제 #1
0
        public override void ProcessEntity(PicEntity entity)
        {
            PicDrawable drawable = entity as PicDrawable;

            // non drawable not taken into account
            if (null == drawable)
            {
                return;
            }
            if (drawable is PicBlockRef)
            {
                PicBlockRef blockRef = entity as PicBlockRef;
                _box.Extend(blockRef.Box);
            }
            else if ((drawable is PicBlock))
            {
                if (_takePicBlocsIntoAccount)
                {
                    PicBlock block = entity as PicBlock;
                    _box.Extend(block.Box);
                }
            }
            else
            {
                PicTypedDrawable typedDrawable = drawable as PicTypedDrawable;
                if (null != typedDrawable && typedDrawable.LineType != PicGraphics.LT.LT_CONSTRUCTION)
                {
                    _box.Extend(drawable.Box);
                }
            }
        }
예제 #2
0
            /// <summary>
            /// Drawing method used to draw factory content
            /// </summary>
            /// <param name="graphics">Graphic environment parameters</param>
            public void Draw(PicGraphics graphics, PicFilter filter)
            {
                graphics.Initialize();

                // bounding box
                if (!graphics.DrawingBox.IsValid)
                {
                    // compute bounding box
                    using (PicVisitorBoundingBox visitor = new PicVisitorBoundingBox())
                    {
                        ProcessVisitor(visitor);
                        Box2D box = visitor.Box;
                        box.AddMarginRatio(0.01);
                        // set as drawing box
                        graphics.DrawingBox = box;
                    }
                }

                // first, draw cotation
                foreach (PicEntity entity in _entities)
                {
                    try
                    {
                        // cotation
                        PicCotation cotation = entity as PicCotation;
                        if (cotation != null && !cotation.Deleted && filter.Accept(entity))
                        {
                            cotation.Draw(graphics);
                        }
                    }
                    catch (Exception ex)
                    {
                        _log.Error(ex.Message);
                    }
                }
                // then other entities
                foreach (Object o in _entities)
                {
                    try
                    {
                        // drawable entities
                        PicDrawable drawable = o as PicDrawable;
                        if (drawable != null && !drawable.Deleted && !(drawable is PicCotation) && filter.Accept(drawable))
                        {
                            drawable.Draw(graphics);
                        }
                    }
                    catch (Exception ex)
                    {
                        _log.Error(ex.Message);
                    }
                }
                // cardboard format
                if (null != _cardboardFormat)
                {
                    _cardboardFormat.Draw(graphics);
                }

                graphics.Finish();
            }
예제 #3
0
        public override void ProcessEntity(PicEntity entity)
        {
            PicDrawable picDrawable = entity as PicDrawable;

            if (null != picDrawable)
            {
                _box.Extend(picDrawable.Box);
                _segList.AddRange(picDrawable.Segments);
            }
        }
예제 #4
0
 protected override void DrawSpecific(PicGraphics graphics, Transform2D transform)
 {
     foreach (PicEntity entity in _block)
     {
         PicDrawable drawable = entity as PicDrawable;
         if (null != drawable && !(drawable is PicCotation))
         {
             drawable.Draw(graphics, transform * BlockTransformation);
         }
     }
 }
예제 #5
0
 public override void Transform(Transform2D transf)
 {
     foreach (PicEntity entity in _entities)
     {
         PicDrawable drawable = entity as PicDrawable;
         if (null != drawable)
         {
             drawable.Transform(transf);
         }
     }
 }
예제 #6
0
 protected override void DrawSpecific(PicGraphics graphics)
 {
     foreach (PicEntity entity in _entities)
     {
         PicDrawable drawable = entity as PicDrawable;
         if (null != drawable && !(drawable is PicCotation))
         {
             drawable.Draw(graphics);
         }
     }
 }
예제 #7
0
        public override Box2D ComputeBox(Transform2D transf)
        {
            Box2D box = new Box2D();

            foreach (PicEntity entity in _entities)
            {
                PicDrawable drawable = entity as PicDrawable;
                if (null != drawable)
                {
                    box.Extend(drawable.ComputeBox(transf));
                }
            }
            return(box);
        }
예제 #8
0
 protected override bool Evaluate()
 {
     _box.Reset();
     foreach (PicEntity entity in _entities)
     {
         PicDrawable drawable = entity as PicDrawable;
         if (null != drawable)
         {
             PicTypedDrawable typeDrawable = drawable as PicTypedDrawable;
             if (null == typeDrawable || typeDrawable.LineType != PicGraphics.LT.LT_CONSTRUCTION)
             {
                 _box.Extend(drawable.ComputeBox(Transform2D.Identity));
             }
         }
     }
     return(true);
 }
예제 #9
0
        public override Box2D ComputeBox(Transform2D transform)
        {
            Box2D box = Box2D.Initial;

            foreach (PicEntity entity in _block)
            {
                PicDrawable drawable = entity as PicDrawable;
                if (null != drawable)
                {
                    PicTypedDrawable typeDrawable = drawable as PicTypedDrawable;
                    if (null == typeDrawable || typeDrawable.LineType != PicGraphics.LT.LT_CONSTRUCTION)
                    {
                        box.Extend(drawable.ComputeBox(transform * BlockTransformation));
                    }
                }
            }
            return(box);
        }
        public override void ProcessEntity(PicEntity entity)
        {
            PicDrawable drawable = entity as PicDrawable;

            if (null == drawable)
            {
                return;
            }
            PicBlock picBlock = drawable as PicBlock;

            if (null != picBlock)
            {
                foreach (PicEntity e in picBlock)
                {
                    if (e is PicTypedDrawable)
                    {
                        AddEntityLength(e as PicTypedDrawable, Transform2D.Identity);
                    }
                }
            }
            PicBlockRef blockRef = drawable as PicBlockRef;

            if (null != blockRef)
            {
                PicBlock block = blockRef.Block;
                foreach (PicEntity e in block)
                {
                    if (e is PicTypedDrawable)
                    {
                        AddEntityLength(e as PicTypedDrawable, blockRef.BlockTransformation);
                    }
                }
            }
            else if (drawable is PicTypedDrawable)
            {
                AddEntityLength(drawable as PicTypedDrawable, Transform2D.Identity);
            }
        }