Example #1
0
        public void ExportEntity(ExpBlock block, PicEntity entity)
        {
            PicTypedDrawable drawable = entity as PicTypedDrawable;
            ExpLayer         layer    = null;
            ExpPen           pen      = null;

            if (null != drawable)
            {
                pen   = _exporter.GetPenByAttribute(LineTypeToExpPen(drawable.LineType));
                layer = _exporter.GetLayerByName(string.Format("Layer {0}", drawable.Layer));
            }
            PicSegment seg = entity as PicSegment;

            if (null != seg)
            {
                _exporter.AddSegment(block, layer, pen, seg.Pt0.X, seg.Pt0.Y, seg.Pt1.X, seg.Pt1.Y);
            }
            PicArc arc = entity as PicArc;

            if (null != arc)
            {
                // using dxf conversions
                double ang = arc.AngleEnd - arc.AngleBeg, angd = arc.AngleBeg, ango = arc.AngleEnd - arc.AngleBeg;
                if (ang < 0.0)
                {
                    angd += ang; ango = -ang;
                }
                else
                {
                    ango = ang;
                }
                _exporter.AddArc(block, layer, pen, arc.Center.X, arc.Center.Y, arc.Radius, angd, angd + ango);
            }
        }
Example #2
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);
                }
            }
        }
 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;
     }
 }
Example #4
0
        public override void ProcessEntity(PicEntity entity)
        {
            if (entity is PicTypedDrawable drawable)
            {
                switch (drawable.Code)
                {
                case PicEntity.ECode.PE_POINT:
                    break;

                case PicEntity.ECode.PE_SEGMENT:
                    break;

                case PicEntity.ECode.PE_ARC:
                    break;

                case PicEntity.ECode.PE_COTATIONDISTANCE:
                    break;

                case PicEntity.ECode.PE_COTATIONHORIZONTAL:
                    break;

                case PicEntity.ECode.PE_COTATIONVERTICAL:
                    break;

                case PicEntity.ECode.PE_ELLIPSE:
                    break;

                case PicEntity.ECode.PE_NURBS:
                    break;

                default:
                    break;
                }
            }
        }
Example #5
0
        public ActionResult Index(HttpPostedFileBase file)
        {
            System.Diagnostics.Trace.TraceInformation("Received request at " + DateTime.Now + "!");

            try
            {
                var container = StorageHelper.getPhotoContainer();
                var id = Guid.NewGuid().ToString();
                var blob = container.GetBlockBlobReference(id);
                blob.UploadFromStream(Request.Files[0].InputStream);

                var table = StorageHelper.getTable();
                var pic = new PicEntity(id);
                pic.DateCreated = DateTime.Now;
                var insertOp = TableOperation.Insert(pic);
                table.Execute(insertOp);

                Response.Write(blob.Uri);
                Response.End();

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Example #6
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);
            }
		}
		public override void ProcessEntity(PicEntity entity)
		{
            if (entity.Code != PicEntity.eCode.PE_BLOCKREF)
            {
                PicTypedDrawable drawable = entity as PicTypedDrawable;
                if (null == drawable)
                    return;
                double totalLength = drawable.Length;
                if (_dictionnaryLength.ContainsKey(drawable.LineType))
                    totalLength += _dictionnaryLength[drawable.LineType];
                _dictionnaryLength[drawable.LineType] = totalLength;
            }
            else
            {
                PicBlockRef blockRef = entity as PicBlockRef;
                PicBlock block = blockRef.Block;

                foreach (PicEntity blockEntity in block)
                {
                    PicTypedDrawable innerDrawable = blockEntity as PicTypedDrawable;
                    if (null == innerDrawable)
                        continue;

                    double totalLength = innerDrawable.Length;
                    if (_dictionnaryLength.ContainsKey(innerDrawable.LineType))
                        totalLength += _dictionnaryLength[innerDrawable.LineType];
                    _dictionnaryLength[innerDrawable.LineType] = totalLength;
                }
            }
		}
Example #8
0
 public override void ProcessEntity(PicEntity entity)
 {
     if (entity is PicDrawable picDrawable)
     {
         _box.Extend(picDrawable.Box);
         _segList.AddRange(picDrawable.Segments);
     }
 }
        public override void ProcessEntity(PicEntity entity)
        {
            PicTypedDrawable drawable = entity as PicTypedDrawable;

            if (null != drawable)
            {
                _entities.Add(drawable);
            }
        }
Example #10
0
 /// <summary>
 /// Returns a value indicating whether this instance is equal to
 /// the specified object.
 /// </summary>
 /// <param name="obj">An object to compare to this instance.</param>
 /// <returns><see langword="true"/> if <paramref name="obj"/> is a <see cref="PicEntity"/> and has the same values as this instance; otherwise, <see langword="false"/>.</returns>
 public override bool Equals(object obj)
 {
     if (obj is PicEntity)
     {
         PicEntity e = (PicEntity)obj;
         return(_id == e._id);
     }
     return(false);
 }
Example #11
0
        public override void ProcessEntity(PicEntity entity)
        {
            PicTypedDrawable drawable = (PicTypedDrawable)entity;

            if (null != drawable)
            {
                drawable.Transform(_transform);
            }
        }
Example #12
0
 public override void  ProcessEntity(PicEntity entity)
 {
     if (entity is PicTypedDrawable typedDrawable &&
         typedDrawable.Group == Grp &&
         -1 == Array.IndexOf(ExcludedLineTypes, typedDrawable.LineType) &&
         typedDrawable.Code == PicEntity.ECode.PE_SEGMENT)
     {
         Entities.Add(typedDrawable);
     }
 }
Example #13
0
        public override bool Accept(PicEntity entity)
        {
            PicTypedDrawable typedDrawable = entity as PicTypedDrawable;

            if (null == typedDrawable)
            {
                return(false);
            }
            return(typedDrawable.Group == _grp);
        }
Example #14
0
        public override bool Accept(PicEntity entity)
        {
            PicTypedDrawable typedDrawable = entity as PicTypedDrawable;

            if (null == typedDrawable)
            {
                return(true);
            }
            return(typedDrawable.Length > _epsilon);
        }
Example #15
0
 public override bool Accept(PicEntity entity)
 {
     if (null != entity)
     {
         return(entity.Code == _code);
     }
     else
     {
         return(false);
     }
 }
Example #16
0
        public override void  ProcessEntity(PicEntity entity)
        {
            PicTypedDrawable typedDrawable = entity as PicTypedDrawable;

            if (null != typedDrawable &&
                typedDrawable.Group == _grp &&
                typedDrawable.LineType != PicGraphics.LT.LT_CONSTRUCTION &&
                typedDrawable.Code == PicEntity.eCode.PE_SEGMENT)
            {
                _entities.Add(typedDrawable);
            }
        }
Example #17
0
        // override PicFilter
        public override bool Accept(PicEntity entity)
        {
            PicTypedDrawable drawable = entity as PicTypedDrawable;

            if (null == drawable)
            {
                return(false);
            }
            else
            {
                return(drawable.LineType == _lt);
            }
        }
Example #18
0
        public override bool Accept(PicEntity entity)
        {
            if (null == _layers)
            {
                return(true);
            }
            PicTypedDrawable typedDrawable = entity as PicTypedDrawable;

            if (null == typedDrawable)
            {
                return(false);
            }
            return(_layers.Contains(typedDrawable.Layer));
        }
        public void ExportEntity(ExpBlock block, PicEntity entity)
        {
            PicTypedDrawable drawable = entity as PicTypedDrawable;
            ExpLayer         layer    = null;
            ExpPen           pen      = null;

            if (null != drawable)
            {
                pen   = _exporter.GetPenByAttribute(LineTypeToExpPen(drawable.LineType));
                layer = _exporter.GetLayerByName(string.Format("Layer {0}", drawable.Layer));
            }
            PicSegment seg = entity as PicSegment;

            if (null != seg)
            {
                _exporter.AddSegment(block, layer, pen, seg.Pt0.X, seg.Pt0.Y, seg.Pt1.X, seg.Pt1.Y);
            }
            PicArc arc = entity as PicArc;

            if (null != arc)
            {
                // using dxf conversions
                double ang = arc.AngleEnd - arc.AngleBeg, angd = arc.AngleBeg, ango = arc.AngleEnd - arc.AngleBeg;
                if (ang < 0.0)
                {
                    angd += ang; ango = -ang;
                }
                else
                {
                    ango = ang;
                }
                _exporter.AddArc(block, layer, pen, arc.Center.X, arc.Center.Y, arc.Radius, angd, angd + ango);
            }
            PicCotationDistance cotation = drawable as PicCotationDistance;

            if (null != cotation)
            {
                List <Segment> segments = new List <Segment>();
                Vector2D       textPt   = Vector2D.Zero;
                double         textSize = 0.0;
                cotation.DrawSeg(ref segments, ref textPt, ref textSize);
                foreach (Segment cotSeg in segments)
                {
                    _exporter.AddSegment(block, layer, pen, cotSeg.P0.X, cotSeg.P0.Y, cotSeg.P1.X, cotSeg.P1.Y);
                }
                _exporter.AddText(block, layer, pen, textPt.X, textPt.Y, cotation.Text);
            }
        }
        public override void ProcessEntity(PicEntity entity)
        {
            if (PicEntity.ECode.PE_BLOCKREF == entity.Code)
            {
                PicBlockRef blockRef = entity as PicBlockRef;
                PicBlock    block    = blockRef.Block;

                foreach (var blockEntity in block)
                {
                    if (blockEntity is PicTypedDrawable innerDrawable)
                    {
                        double totalLength = innerDrawable.Length;
                        if (_dictionnaryLength.ContainsKey(innerDrawable.LineType))
                        {
                            totalLength += _dictionnaryLength[innerDrawable.LineType];
                        }
                        _dictionnaryLength[innerDrawable.LineType] = totalLength;
                    }
                }
            }
            else if (PicEntity.ECode.PE_BLOCK == entity.Code)
            {
                PicBlock block = entity as PicBlock;
                foreach (var blockEntity in block)
                {
                    if (blockEntity is PicTypedDrawable innerDrawable)
                    {
                        double totalLength = innerDrawable.Length;
                        if (_dictionnaryLength.ContainsKey(innerDrawable.LineType))
                        {
                            totalLength += _dictionnaryLength[innerDrawable.LineType];
                        }
                        _dictionnaryLength[innerDrawable.LineType] = totalLength;
                    }
                }
            }
            else if (entity is PicTypedDrawable drawable)
            {
                double totalLength = drawable.Length;
                if (_dictionnaryLength.ContainsKey(drawable.LineType))
                {
                    totalLength += _dictionnaryLength[drawable.LineType];
                }
                _dictionnaryLength[drawable.LineType] = totalLength;
            }
        }
Example #21
0
 public void ExportEntity(ExpBlock block, PicEntity entity)
 {
     PicTypedDrawable drawable = entity as PicTypedDrawable;
     ExpLayer layer = null;
     ExpPen pen = null;
     if (null != drawable)
     {
         pen = _exporter.GetPenByAttribute(LineTypeToExpPen(drawable.LineType));
         layer = _exporter.GetLayerByName(string.Format("Layer {0}", drawable.Layer));
     }
     PicSegment seg = entity as PicSegment;
     if (null != seg)
         _exporter.AddSegment(block, layer, pen, seg.Pt0.X, seg.Pt0.Y, seg.Pt1.X, seg.Pt1.Y);
     PicArc arc = entity as PicArc;
     if (null != arc)
     {
         // using dxf conversions
         double ang = arc.AngleEnd - arc.AngleBeg, angd = arc.AngleBeg, ango = arc.AngleEnd - arc.AngleBeg;
         if (ang < 0.0) {   angd += ang; ango = -ang;   } else ango = ang;
         _exporter.AddArc(block, layer, pen, arc.Center.X, arc.Center.Y, arc.Radius, angd, angd+ango);
     }
 }
        public override void ProcessEntity(PicEntity entity)
        {
            if (entity.Code != PicEntity.eCode.PE_BLOCKREF)
            {
                PicTypedDrawable drawable = entity as PicTypedDrawable;
                if (null == drawable)
                {
                    return;
                }
                double totalLength = drawable.Length;
                if (_dictionnaryLength.ContainsKey(drawable.LineType))
                {
                    totalLength += _dictionnaryLength[drawable.LineType];
                }
                _dictionnaryLength[drawable.LineType] = totalLength;
            }
            else
            {
                PicBlockRef blockRef = entity as PicBlockRef;
                PicBlock    block    = blockRef.Block;

                foreach (PicEntity blockEntity in block)
                {
                    PicTypedDrawable innerDrawable = blockEntity as PicTypedDrawable;
                    if (null == innerDrawable)
                    {
                        continue;
                    }

                    double totalLength = innerDrawable.Length;
                    if (_dictionnaryLength.ContainsKey(innerDrawable.LineType))
                    {
                        totalLength += _dictionnaryLength[innerDrawable.LineType];
                    }
                    _dictionnaryLength[innerDrawable.LineType] = totalLength;
                }
            }
        }
        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);
            }
        }
Example #24
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;
            }
        }
Example #25
0
 public override void ProcessEntity(PicEntity entity)
 {
     if (entity is PicPoint point)
     {
         FactoryOut.AddPoint(point.LineType, point.Group, point.Layer, Multiplicator * point.Coord);
     }
     else if (entity is PicSegment seg)
     {
         FactoryOut.AddSegment(seg.LineType, seg.Group, seg.Layer, Multiplicator * seg.Pt0, Multiplicator * seg.Pt1);
     }
     else if (entity is PicArc arc)
     {
         FactoryOut.AddArc(arc.LineType, arc.Group, arc.Layer, Multiplicator * arc.Center, Multiplicator * arc.Radius, arc.AngleBeg, arc.AngleEnd);
     }
     else if (entity is PicNurb nurb)
     {
         FactoryOut.AddNurb(nurb.LineType, nurb.Group, nurb.Layer);
     }
     else if (entity is PicCotationDistance cotDist)
     {
         PicCotation.CotType eCotType = PicCotation.CotType.COT_DISTANCE;;
         if (entity is PicCotationDistance)
         {
             eCotType = PicCotation.CotType.COT_DISTANCE;
         }
         else if (entity is PicCotationHorizontal)
         {
             eCotType = PicCotation.CotType.COT_HORIZONTAL;
         }
         else if (entity is PicCotationVertical)
         {
             eCotType = PicCotation.CotType.COT_VERTICAL;
         }
         FactoryOut.AddCotation(eCotType, cotDist.Group, cotDist.Layer, Multiplicator * cotDist.Pt0, Multiplicator * cotDist.Pt1, Multiplicator * cotDist.Offset, cotDist.Text, 1);
     }
 }
Example #26
0
 private PicEntity(PicEntity entity)
 {
 }
Example #27
0
 public override bool Accept(PicEntity entity)
 {
     return(entity is PicTypedDrawable);
 }
Example #28
0
 public virtual bool Accept(PicEntity entity)
 {
     return(true);
 }
Example #29
0
			public abstract void ProcessEntity(PicEntity entity);
Example #30
0
        /// <summary>
        /// ProcessEntity : write entity corresponding des description
        /// </summary>
        /// <param name="entity"></param>
        public override void ProcessEntity(PicEntity entity)
        {
            switch (entity.Code)
            {
                case PicEntity.eCode.PE_POINT:
                    break;
                case PicEntity.eCode.PE_SEGMENT:
                    {
                        PicSegment seg = (PicSegment)entity;
                        _desWriter.WriteSegment(
                            new DES_Segment(
                            (float)seg.Pt0.X
                            , (float)seg.Pt0.Y
                            , (float)seg.Pt1.X
                            , (float)seg.Pt1.Y
                            , LineTypeToDesPen(seg.LineType)
                            , (byte)seg.Group
                            , (byte)seg.Layer
                            )
                        );
                    }
                    break;
                case PicEntity.eCode.PE_ARC:
                    {
                        PicArc arc = (PicArc)entity;
                        _desWriter.WriteArc(
                            new DES_Arc(
                            (float)arc.Center.X
                            , (float)arc.Center.Y
                            , (float)arc.Radius
                            , (float)arc.AngleBeg
                            , (float)arc.AngleEnd
                            , LineTypeToDesPen(arc.LineType)
                            , (byte)arc.Group
                            , (byte)arc.Layer
                            )
                        );
                    }
                    break;
                case PicEntity.eCode.PE_COTATIONDISTANCE:
                    {
                        PicCotationDistance cotation = entity as PicCotationDistance;
                        /*
                        _desWriter.WriteCotationDistance(
                            new DES_CotationDistance(
                                (float)cotation.Pt0.X
                                , (float)cotation.Pt0.Y
                                , (float)cotation.Pt1.X
                                , (float)cotation.Pt1.Y
                                , (float)cotation.Offset
                                , (byte)cotation.Group
                                , (byte)cotation.Layer
                                )
                            );
                         */ 
                    }
                    break;
                case PicEntity.eCode.PE_COTATIONHORIZONTAL:
                    {
                    }
                    break;
                case PicEntity.eCode.PE_COTATIONVERTICAL:
                    {
                    }
                    break;
                case PicEntity.eCode.PE_COTATIONRADIUSEXT:
                    {
                    }
                    break;
                case PicEntity.eCode.PE_COTATIONRADIUSINT:
                    {
                    }
                    break;
                case PicEntity.eCode.PE_BLOCK:
                    {
                        PicBlock block = entity as PicBlock;
                        foreach (PicEntity blockEntity in block)
                        {
                            ProcessEntity(blockEntity);
                        }
                    }
                    break;
                case PicEntity.eCode.PE_BLOCKREF:
                    {
                        PicBlockRef blockRef = entity as PicBlockRef;
                        _desWriter.WriteBlockRef(
                            new DES_Pose(
                                (float)blockRef.Position.X
                                , (float)blockRef.Position.Y
                                , (float)blockRef.Angle
                                , (byte)blockRef.Block.ExportedGroup)
                                );
                    }
                    break;
                case PicEntity.eCode.PE_CARDBOARDFORMAT:
                    {

                    }
                    break;
                default:
                    throw new Exception("Can not export this kind of entity!");
            }
        }
Example #31
0
 public override bool Accept(PicEntity entity)
 {
     return(!_filter.Accept(entity));
 }
Example #32
0
        /// <summary>
        /// ProcessEntity : write entity corresponding dxf description in line buffer 
        /// </summary>
        /// <param name="entity">Entity</param>
        public override void ProcessEntity(PicEntity entity)
        {
            PicTypedDrawable drawable = (PicTypedDrawable)entity;
            if (null != drawable)
            {
                switch (drawable.Code)
                {
                    case PicEntity.eCode.PE_POINT:
                        break;
                    case PicEntity.eCode.PE_SEGMENT:
                        {
                            PicSegment seg = (PicSegment)entity;
                             dxf.writeLine(
                                dw
                                , new DL_LineData(
                                    seg.Pt0.X		// start point
                                    , seg.Pt0.Y
                                    , 0.0
                                    , seg.Pt1.X	// end point
                                    , seg.Pt1.Y
                                    , 0.0
                                    , 256
                                    , LineTypeToDxfLayer(seg.LineType)
                                    )
                                , new DL_Attributes(LineTypeToDxfLayer(seg.LineType), 256, -1, "BYLAYER")
                                );

                        }
                        break;
                    case PicEntity.eCode.PE_ARC:
                        {
                            PicArc arc = (PicArc)entity;
                            double ang = arc.AngleEnd - arc.AngleBeg, angd = arc.AngleBeg, ango = arc.AngleEnd - arc.AngleBeg;
                           	if ( ang <  0.0 )
	                        {
		                        angd += ang;
		                        ango = - ang;
	                        }
	                        else
		                        ango = ang;
                            
                            dxf.writeArc(dw,
                                new DL_ArcData(
                                    arc.Center.X, arc.Center.Y, 0.0,
                                    arc.Radius,
                                    angd, angd + ango,
                                    256,
                                    LineTypeToDxfLayer(arc.LineType)
                                    ),
                                new DL_Attributes(LineTypeToDxfLayer(arc.LineType), 256, -1, "BYLAYER")
                            );
                        }
                        break;
                    case PicEntity.eCode.PE_ELLIPSE:
                        break;
                    case PicEntity.eCode.PE_NURBS:
                        break;
                    default:
                        throw new Exception("Can not export this kind of entity!");
                }
            }
        }
Example #33
0
 /// <summary>
 /// instantiate the tool with 2 segments and a radius
 /// </summary>
 /// <param name="seg0">first segment (order does not matter)</param>
 /// <param name="seg1">second segment (order does not matter)</param>
 /// <param name="radius"></param>
 public PicToolRound(PicEntity seg0, PicEntity seg1, double radius)
 {
     _picSeg0 = seg0 as PicSegment;
     _picSeg1 = seg1 as PicSegment;
     _radius = radius;
 }
Example #34
0
 public PicFilterCode(PicEntity.eCode code)
 {
     _code = code;
 }
Example #35
0
        /// <summary>
        /// ProcessEntity : write entity corresponding des description
        /// </summary>
        /// <param name="entity"></param>
        public override void ProcessEntity(PicEntity entity)
        {
            switch (entity.Code)
            {
            case PicEntity.ECode.PE_POINT:
                break;

            case PicEntity.ECode.PE_SEGMENT:
            {
                PicSegment seg = (PicSegment)entity;
                _desWriter.WriteSegment(
                    new DES_Segment(
                        (float)seg.Pt0.X
                        , (float)seg.Pt0.Y
                        , (float)seg.Pt1.X
                        , (float)seg.Pt1.Y
                        , LineTypeToDesPen(seg.LineType)
                        , (byte)seg.Group
                        , (byte)seg.Layer
                        )
                    );
            }
            break;

            case PicEntity.ECode.PE_ARC:
            {
                PicArc arc = (PicArc)entity;
                _desWriter.WriteArc(
                    new DES_Arc(
                        (float)arc.Center.X
                        , (float)arc.Center.Y
                        , (float)arc.Radius
                        , (float)arc.AngleBeg
                        , (float)arc.AngleEnd
                        , LineTypeToDesPen(arc.LineType)
                        , (byte)arc.Group
                        , (byte)arc.Layer
                        )
                    );
            }
            break;

            case PicEntity.ECode.PE_COTATIONDISTANCE:
            {
                PicCotationDistance cotation = entity as PicCotationDistance;
                _desWriter.WriteCotationDistance(
                    new DES_CotationDistance(
                        (float)cotation.Pt0.X, (float)cotation.Pt0.Y, (float)cotation.Pt1.X, (float)cotation.Pt1.Y
                        , LineTypeToDesPen(cotation.LineType)
                        , (byte)cotation.Group
                        , (byte)cotation.Layer
                        , (float)cotation.Offset
                        , 0.0f
                        , 0.0f
                        , 0.0f
                        , false, false, false, false, 1, cotation.Text, ' ')
                    );
            }
            break;

            case PicEntity.ECode.PE_COTATIONHORIZONTAL:
            {
                PicCotationHorizontal cotation = entity as PicCotationHorizontal;
                // get offset points
                Vector2D offsetPt0, offsetPt1;
                cotation.GetOffsetPoints(out offsetPt0, out offsetPt1);

                _desWriter.WriteCotationDistance(
                    new DES_CotationDistance(
                        (float)offsetPt0.X, (float)offsetPt0.Y, (float)offsetPt1.X, (float)offsetPt1.Y
                        , LineTypeToDesPen(cotation.LineType)
                        , (byte)cotation.Group
                        , (byte)cotation.Layer
                        , (float)(cotation.Pt0.Y - offsetPt0.Y + cotation.Offset)
                        , 0.0f
                        , 0.0f
                        , 0.0f
                        , false, false, false, false, 1, cotation.Text, ' ')
                    );
            }
            break;

            case PicEntity.ECode.PE_COTATIONVERTICAL:
            {
                PicCotationVertical cotation = entity as PicCotationVertical;
                // get offset points
                Vector2D offsetPt0, offsetPt1;
                cotation.GetOffsetPoints(out offsetPt0, out offsetPt1);

                _desWriter.WriteCotationDistance(
                    new DES_CotationDistance(
                        (float)offsetPt0.X, (float)offsetPt0.Y, (float)offsetPt1.X, (float)offsetPt1.Y
                        , LineTypeToDesPen(cotation.LineType)
                        , (byte)cotation.Group
                        , (byte)cotation.Layer
                        , (float)(offsetPt0.X - cotation.Pt0.X + cotation.Offset)
                        , 0.0f
                        , 0.0f
                        , 0.0f
                        , false, false, false, false, 1, cotation.Text, ' ')
                    );
            }
            break;

            case PicEntity.ECode.PE_COTATIONRADIUSEXT:
            {
            }
            break;

            case PicEntity.ECode.PE_COTATIONRADIUSINT:
            {
            }
            break;

            case PicEntity.ECode.PE_BLOCK:
            {
                PicBlock block = entity as PicBlock;
                foreach (PicEntity blockEntity in block)
                {
                    ProcessEntity(blockEntity);
                }
            }
            break;

            case PicEntity.ECode.PE_BLOCKREF:
            {
                PicBlockRef blockRef = entity as PicBlockRef;
                _desWriter.WriteBlockRef(
                    new DES_Pose(
                        (float)blockRef.Position.X
                        , (float)blockRef.Position.Y
                        , (float)blockRef.Angle
                        , (byte)blockRef.Block.ExportedGroup)
                    );
            }
            break;

            case PicEntity.ECode.PE_CARDBOARDFORMAT:
            {
            }
            break;

            default:
                throw new Exception("Can not export this kind of entity!");
            }
        }
Example #36
0
 public override bool Accept(PicEntity entity)
 {
     PicTypedDrawable typedDrawable = entity as PicTypedDrawable;
     if (null == typedDrawable) return false;
     return typedDrawable.Group == _grp;            
 }
Example #37
0
 public override void ProcessEntity(PicEntity entity)
 {
     PicTypedDrawable drawable = (PicTypedDrawable)entity;
     if (null != drawable)
         drawable.Transform(_transform);
 }
Example #38
0
 public override bool Accept(PicEntity entity)
 {
     if (null == _layers) return true;
     PicTypedDrawable typedDrawable = entity as PicTypedDrawable;
     if (null == typedDrawable) return false;
     return _layers.Contains(typedDrawable.Layer);
 }
Example #39
0
 public override bool Accept(PicEntity entity)
 {
     return !_filter.Accept(entity);
 }
Example #40
0
 public abstract void ProcessEntity(PicEntity entity);
Example #41
0
        /// <summary>
        /// ProcessEntity : write entity corresponding dxf description in line buffer
        /// </summary>
        /// <param name="entity">Entity</param>
        public override void ProcessEntity(PicEntity entity)
        {
            PicTypedDrawable drawable = (PicTypedDrawable)entity;

            if (null != drawable)
            {
                switch (drawable.Code)
                {
                case PicEntity.eCode.PE_POINT:
                    break;

                case PicEntity.eCode.PE_SEGMENT:
                {
                    PicSegment seg = (PicSegment)entity;
                    dxf.writeLine(
                        dw
                        , new DL_LineData(
                            seg.Pt0.X                   // start point
                            , seg.Pt0.Y
                            , 0.0
                            , seg.Pt1.X         // end point
                            , seg.Pt1.Y
                            , 0.0
                            , 256
                            , LineTypeToDxfLayer(seg.LineType)
                            )
                        , new DL_Attributes(LineTypeToDxfLayer(seg.LineType), 256, -1, "BYLAYER")
                        );
                }
                break;

                case PicEntity.eCode.PE_ARC:
                {
                    PicArc arc = (PicArc)entity;
                    double ang = arc.AngleEnd - arc.AngleBeg, angd = arc.AngleBeg, ango = arc.AngleEnd - arc.AngleBeg;
                    if (ang < 0.0)
                    {
                        angd += ang;
                        ango  = -ang;
                    }
                    else
                    {
                        ango = ang;
                    }

                    dxf.writeArc(dw,
                                 new DL_ArcData(
                                     arc.Center.X, arc.Center.Y, 0.0,
                                     arc.Radius,
                                     angd, angd + ango,
                                     256,
                                     LineTypeToDxfLayer(arc.LineType)
                                     ),
                                 new DL_Attributes(LineTypeToDxfLayer(arc.LineType), 256, -1, "BYLAYER")
                                 );
                }
                break;

                case PicEntity.eCode.PE_ELLIPSE:
                    break;

                case PicEntity.eCode.PE_NURBS:
                    break;

                default:
                    throw new Exception("Can not export this kind of entity!");
                }
            }
        }
Example #42
0
 public override bool Accept(PicEntity entity)
 {
     return(_filter1.Accept(entity) || _filter2.Accept(entity));
 }
Example #43
0
        /// <summary>
        /// ProcessEntity : write entity corresponding dxf description in line buffer
        /// </summary>
        /// <param name="entity">Entity</param>
        public override void ProcessEntity(PicEntity entity)
        {
            PicTypedDrawable drawable = (PicTypedDrawable)entity;

            if (null != drawable)
            {
                switch (drawable.Code)
                {
                case PicEntity.ECode.PE_POINT:
                    break;

                case PicEntity.ECode.PE_SEGMENT:
                {
                    PicSegment seg = (PicSegment)entity;
                    dxf.WriteLine(
                        dw
                        , new DL_LineData(
                            seg.Pt0.X                   // start point
                            , seg.Pt0.Y
                            , 0.0
                            , seg.Pt1.X         // end point
                            , seg.Pt1.Y
                            , 0.0
                            , InternalLineTypeToDxfColor(seg.LineType)
                            , "0"
                            )
                        , new DL_Attributes("0", InternalLineTypeToDxfColor(seg.LineType), -1, InternalLineTypeToDxfLineType(seg.LineType))
                        );
                }
                break;

                case PicEntity.ECode.PE_ARC:
                {
                    PicArc arc = (PicArc)entity;
                    double ang = arc.AngleEnd - arc.AngleBeg, angd = arc.AngleBeg, ango = arc.AngleEnd - arc.AngleBeg;
                    if (ang < 0.0)
                    {
                        angd += ang;
                        ango  = -ang;
                    }
                    else
                    {
                        ango = ang;
                    }

                    dxf.WriteArc(dw,
                                 new DL_ArcData(
                                     arc.Center.X, arc.Center.Y, 0.0,
                                     arc.Radius,
                                     angd, angd + ango,
                                     InternalLineTypeToDxfColor(arc.LineType),
                                     "0"
                                     ),
                                 new DL_Attributes("0", InternalLineTypeToDxfColor(arc.LineType), -1, InternalLineTypeToDxfLineType(arc.LineType))
                                 );
                }
                break;

                case PicEntity.ECode.PE_COTATIONDISTANCE:
                case PicEntity.ECode.PE_COTATIONHORIZONTAL:
                case PicEntity.ECode.PE_COTATIONVERTICAL:
                {
                    PicCotationDistance cotation = entity as PicCotationDistance;
                    List <Segment>      segments = new List <Segment>();
                    Vector2D            textPt   = Vector2D.Zero;
                    double textSize = 0.0;
                    cotation.DrawSeg(ref segments, ref textPt, ref textSize);
                    // draw segments
                    foreach (Segment seg in segments)
                    {
                        dxf.WriteLine(dw,
                                      new DL_LineData(
                                          seg.P0.X, seg.P0.Y, 0.0,
                                          seg.P1.X, seg.P1.Y, 0.0,
                                          InternalLineTypeToDxfColor(cotation.LineType),
                                          "0"
                                          ),
                                      new DL_Attributes("0", InternalLineTypeToDxfColor(cotation.LineType), -1, InternalLineTypeToDxfLineType(cotation.LineType))
                                      );
                    }
                    // draw text
                    dxf.WriteText(dw,
                                  new DL_TextData(
                                      textPt.X, textPt.Y, 0.0,
                                      textPt.X, textPt.Y, 0.0,
                                      textSize, 1.0, 0,
                                      1, 2, cotation.Text, "STANDARD", 0.0),
                                  new DL_Attributes("0", InternalLineTypeToDxfColor(cotation.LineType), -1, InternalLineTypeToDxfLineType(cotation.LineType)));
                }
                break;

                case PicEntity.ECode.PE_ELLIPSE:
                    break;

                case PicEntity.ECode.PE_NURBS:
                    break;

                default:
                    throw new Exception("Can not export this kind of entity!");
                }
            }
        }
Example #44
0
 public override bool Accept(PicEntity entity)
 {
     if (null != entity)
         return entity.Code == _code;
     else
         return false;
 }
Example #45
0
 public override void ProcessEntity(PicEntity entity)
 {
     PicDrawable picDrawable = entity as PicDrawable;
     if (null != picDrawable)
     {
         _box.Extend(picDrawable.Box);
         _segList.AddRange(picDrawable.Segments);
     }
 }
Example #46
0
 public virtual bool Accept(PicEntity entity)
 {
     return true;
 }
Example #47
0
        /// <summary>
        /// ProcessEntity : write entity corresponding des description
        /// </summary>
        /// <param name="entity"></param>
        public override void ProcessEntity(PicEntity entity)
        {
            switch (entity.Code)
            {
            case PicEntity.eCode.PE_POINT:
                break;

            case PicEntity.eCode.PE_SEGMENT:
            {
                PicSegment seg = (PicSegment)entity;
                _desWriter.WriteSegment(
                    new DES_Segment(
                        (float)seg.Pt0.X
                        , (float)seg.Pt0.Y
                        , (float)seg.Pt1.X
                        , (float)seg.Pt1.Y
                        , LineTypeToDesPen(seg.LineType)
                        , (byte)seg.Group
                        , (byte)seg.Layer
                        )
                    );
            }
            break;

            case PicEntity.eCode.PE_ARC:
            {
                PicArc arc = (PicArc)entity;
                _desWriter.WriteArc(
                    new DES_Arc(
                        (float)arc.Center.X
                        , (float)arc.Center.Y
                        , (float)arc.Radius
                        , (float)arc.AngleBeg
                        , (float)arc.AngleEnd
                        , LineTypeToDesPen(arc.LineType)
                        , (byte)arc.Group
                        , (byte)arc.Layer
                        )
                    );
            }
            break;

            case PicEntity.eCode.PE_COTATIONDISTANCE:
            {
                PicCotationDistance cotation = entity as PicCotationDistance;

                /*
                 * _desWriter.WriteCotationDistance(
                 *  new DES_CotationDistance(
                 *      (float)cotation.Pt0.X
                 *      , (float)cotation.Pt0.Y
                 *      , (float)cotation.Pt1.X
                 *      , (float)cotation.Pt1.Y
                 *      , (float)cotation.Offset
                 *      , (byte)cotation.Group
                 *      , (byte)cotation.Layer
                 *      )
                 *  );
                 */
            }
            break;

            case PicEntity.eCode.PE_COTATIONHORIZONTAL:
            {
            }
            break;

            case PicEntity.eCode.PE_COTATIONVERTICAL:
            {
            }
            break;

            case PicEntity.eCode.PE_COTATIONRADIUSEXT:
            {
            }
            break;

            case PicEntity.eCode.PE_COTATIONRADIUSINT:
            {
            }
            break;

            case PicEntity.eCode.PE_BLOCK:
            {
                PicBlock block = entity as PicBlock;
                foreach (PicEntity blockEntity in block)
                {
                    ProcessEntity(blockEntity);
                }
            }
            break;

            case PicEntity.eCode.PE_BLOCKREF:
            {
                PicBlockRef blockRef = entity as PicBlockRef;
                _desWriter.WriteBlockRef(
                    new DES_Pose(
                        (float)blockRef.Position.X
                        , (float)blockRef.Position.Y
                        , (float)blockRef.Angle
                        , (byte)blockRef.Block.ExportedGroup)
                    );
            }
            break;

            case PicEntity.eCode.PE_CARDBOARDFORMAT:
            {
            }
            break;

            default:
                throw new Exception("Can not export this kind of entity!");
            }
        }
Example #48
0
 public override bool Accept(PicEntity entity)
 {
     PicTypedDrawable typedDrawable = entity as PicTypedDrawable;
     if (null == typedDrawable) return true;
     return (typedDrawable.Length > _epsilon);
 }
Example #49
0
 private PicEntity(PicEntity entity)
 {
 }
Example #50
0
 public override bool Accept(PicEntity entity)
 {
     return _filter1.Accept(entity) && _filter2.Accept(entity);
 }
Example #51
0
 public virtual void ProcessEntity(PicEntity entity) { }