Exemplo n.º 1
0
        public override void DrawInternal(
            DrawContext.Surface context,
            Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            ArgbColor   plotColor     = context.GetPlotColor((DxfEntity)this);
            DxfLineType lineType      = this.GetLineType((DrawContext)context);
            bool        plinegen      = (this.Flags & Enum21.flag_8) != Enum21.flag_0;
            double      lineTypeScale = context.TotalLineTypeScale * this.LineTypeScale;

            if (!graphics.AddExistingGraphicElement2(parentGraphicElementBlock, (DxfEntity)this, plotColor, lineType, lineTypeScale, plinegen))
            {
                return;
            }
            GraphicElement2 graphicElement2 = new GraphicElement2(plotColor, lineType, lineTypeScale, plinegen);

            graphics.AddNewGraphicElement((DxfEntity)this, parentGraphicElementBlock, (GraphicElement1)graphicElement2);
            bool approximationPointsDrawn;

            WW.Math.Geometry.Polyline3D polyline = this.method_14(context.Config, out approximationPointsDrawn);
            graphicElement2.Geometry.Add(WW.Cad.Drawing.Surface.Polyline3D.CreatePrimitive(polyline));
            if (context.Config.ShowSplineControlPoints)
            {
                graphicElement2.Geometry.Add(WW.Cad.Drawing.Surface.Polyline3D.CreatePrimitive(this.method_16()));
            }
            if (!context.Config.ShowSplineApproximationPoints || approximationPointsDrawn)
            {
                return;
            }
            graphicElement2.Geometry.Add(WW.Cad.Drawing.Surface.Polyline3D.CreatePrimitive(this.method_17()));
        }
Exemplo n.º 2
0
        public override void ResolveReferences(Class374 modelBuilder)
        {
            base.ResolveReferences(modelBuilder);
            DxfLayer handledObject = (DxfLayer)this.HandledObject;

            if (this.ulong_3 != 0UL)
            {
                DxfLineType dxfLineType = modelBuilder.method_4 <DxfLineType>(this.ulong_3);
                if (dxfLineType != null)
                {
                    handledObject.LineType = dxfLineType;
                }
            }
            if (string.IsNullOrEmpty(this.string_0))
            {
                return;
            }
            string[] strArray = this.string_0.Split('$');
            if (strArray == null || strArray.Length != 2)
            {
                return;
            }
            string colorBookName = strArray[0];
            string name          = strArray[1];

            handledObject.Color = Color.smethod_1(handledObject.Color.Data, colorBookName, name);
        }
Exemplo n.º 3
0
 protected DrawContext(DrawContext from)
 {
     this.image_0               = from.image_0;
     this.graphics_0            = from.graphics_0;
     this.dxfModel_0            = from.dxfModel_0;
     this.dxfLayout_0           = from.dxfLayout_0;
     this.graphicsConfig_0      = from.graphicsConfig_0;
     this.dxfLayer_0            = from.dxfLayer_0;
     this.dxfLayer_1            = from.dxfLayer_1;
     this.dxfEntity_0           = from.dxfEntity_0;
     this.dxfBlock_0            = from.dxfBlock_0;
     this.drawContext_0         = from.drawContext_0;
     this.dxfEntity_1           = from.dxfEntity_1;
     this.entityColor_0         = from.entityColor_0;
     this.transparency_0        = from.transparency_0;
     this.dxfColor_0            = from.dxfColor_0;
     this.dxfLineType_0         = from.dxfLineType_0;
     this.short_0               = from.short_0;
     this.int_0                 = from.int_0;
     this.int_1                 = from.int_1;
     this.dxfWipeoutVariables_0 = from.dxfWipeoutVariables_0;
     this.dictionary_0          = from.dictionary_0;
     this.double_0              = from.double_0;
     this.double_1              = from.double_1;
 }
Exemplo n.º 4
0
        protected void DrawInternal(
            DrawContext.Surface context,
            WW.Cad.Drawing.Surface.Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock,
            double startAngle,
            double endAngle)
        {
            ArgbColor   plotColor     = context.GetPlotColor((DxfEntity)this);
            DxfLineType lineType      = this.GetLineType((DrawContext)context);
            double      lineTypeScale = context.TotalLineTypeScale * this.LineTypeScale;

            if (!graphics.AddExistingGraphicElement2(parentGraphicElementBlock, (DxfEntity)this, plotColor, lineType, lineTypeScale, false))
            {
                return;
            }
            GraphicElement2 graphicElement2 = new GraphicElement2(plotColor, lineType, lineTypeScale, true);

            graphics.AddNewGraphicElement((DxfEntity)this, parentGraphicElementBlock, (GraphicElement1)graphicElement2);
            if (this.double_2 != 0.0)
            {
                graphicElement2.Geometry.Extrusion = this.double_2 * this.vector3D_0;
            }
            WW.Math.Geometry.Polyline3D polyline = this.method_14(context.Config, startAngle, endAngle);
            graphicElement2.Geometry.Add(WW.Cad.Drawing.Surface.Polyline3D.CreatePrimitive(polyline));
        }
Exemplo n.º 5
0
 public bool Matches(DxfLayer layer, EntityColor byBlockColor, DxfLineType byBlockLineType)
 {
     if (layer.Enabled == this.bool_0 && layer.Frozen == this.bool_1 && (layer.Color.ToArgb() == this.color_0.ToArgb() && layer.LineType == this.ByLayerLineType && byBlockColor.ToArgb() == this.entityColor_0.ToArgb()))
     {
         return(byBlockLineType == this.ByBlockLineType);
     }
     return(false);
 }
Exemplo n.º 6
0
 public bool Matches(DxfLayer layer, EntityColor byBlockColor, DxfLineType byBlockLineType)
 {
     if (this.graphicElementBlock2_0 == null)
     {
         return(false);
     }
     return(this.graphicElementBlock2_0.Matches(layer, byBlockColor, byBlockLineType));
 }
Exemplo n.º 7
0
 public void SetAllBordersLineType(DxfLineType lineType)
 {
     this.dxfTableBorder_0.LineType = lineType;
     this.dxfTableBorder_1.LineType = lineType;
     this.dxfTableBorder_2.LineType = lineType;
     this.dxfTableBorder_3.LineType = lineType;
     this.dxfTableBorder_4.LineType = lineType;
     this.dxfTableBorder_5.LineType = lineType;
 }
Exemplo n.º 8
0
 public GraphicElement2(
     ArgbColor color,
     DxfLineType lineType,
     double lineTypeScale,
     bool plinegen)
     : base(color)
 {
     this.dxfLineType_0 = lineType;
     this.double_0      = lineTypeScale;
     this.bool_0        = plinegen;
 }
Exemplo n.º 9
0
 public bool Matches(
     ArgbColor color,
     DxfLineType lineType,
     double lineTypeScale,
     bool plinegen)
 {
     if (this.Matches(color) && lineType == this.dxfLineType_0 && plinegen == this.bool_0)
     {
         return(MathUtil.AreApproxEqual(lineTypeScale, this.double_0, 8.88178419700125E-16));
     }
     return(false);
 }
Exemplo n.º 10
0
 public Class1001(
     DxfEntity entity,
     Color byLayerColor,
     DxfLineType byLayerLineType,
     EntityColor byBlockColor,
     DxfLineType byBlockLineType)
 {
     this.dxfEntity_0   = entity;
     this.color_0       = byLayerColor;
     this.dxfLineType_0 = byLayerLineType;
     this.entityColor_0 = byBlockColor;
     this.dxfLineType_1 = byBlockLineType;
 }
Exemplo n.º 11
0
 public GraphicElementBlock2 GetGraphicElementBlock(
     DxfLayer layer,
     EntityColor byBlockColor,
     DxfLineType byBlockLineType)
 {
     foreach (GraphicElementBlock2 graphicElementBlock2 in this.list_0)
     {
         if (graphicElementBlock2.Matches(layer, byBlockColor, byBlockLineType))
         {
             return(graphicElementBlock2);
         }
     }
     return((GraphicElementBlock2)null);
 }
Exemplo n.º 12
0
        internal static void smethod_4(
            DrawContext context,
            ILineTypeScaler lineTypeScaler,
            ILeader leader,
            IList <WW.Math.Point3D> vertices,
            DxfLineType lineType,
            Vector3D zAxis,
            double lineTypeScale,
            out IList <Polyline3D> polylines,
            out IList <FlatShape4D> shapes)
        {
            Polyline3D polyline = DxfLeader.smethod_3(context, leader, vertices);

            if (context.Config.ApplyLineType)
            {
                polylines = (IList <Polyline3D>) new List <Polyline3D>();
                if (polyline != null)
                {
                    shapes = (IList <FlatShape4D>) new List <FlatShape4D>();
                    DxfUtil.smethod_4(context.Config, polylines, shapes, polyline, lineType, zAxis, context.TotalLineTypeScale * lineTypeScale, lineTypeScaler);
                    if (shapes.Count != 0)
                    {
                        return;
                    }
                    shapes = (IList <FlatShape4D>)null;
                }
                else
                {
                    shapes = (IList <FlatShape4D>)null;
                }
            }
            else
            {
                ref IList <Polyline3D> local = ref polylines;
                List <Polyline3D>      polyline3DList;
                if (polyline == null)
                {
                    polyline3DList = new List <Polyline3D>();
                }
                else
                {
                    polyline3DList = new List <Polyline3D>()
                    {
                        polyline
                    }
                };
                local  = (IList <Polyline3D>)polyline3DList;
                shapes = (IList <FlatShape4D>)null;
            }
        }
Exemplo n.º 13
0
        public override void ResolveReferences(Class374 modelBuilder)
        {
            base.ResolveReferences(modelBuilder);
            DxfEntity entity = this.Entity;

            if (this.ulong_2 != 0UL)
            {
                DxfLayer dxfLayer = modelBuilder.method_4 <DxfLayer>(this.ulong_2);
                if (dxfLayer != null)
                {
                    entity.Layer = dxfLayer;
                }
            }
            if (this.nullable_0.HasValue)
            {
                byte?    nullable0      = this.nullable_0;
                ref byte?local          = ref nullable0;
                byte     valueOrDefault = local.GetValueOrDefault();
                if (local.HasValue)
                {
                    switch (valueOrDefault)
                    {
                    case 0:
                        entity.LineType = modelBuilder.Model.ByLayerLineType;
                        break;

                    case 1:
                        entity.LineType = modelBuilder.Model.ByBlockLineType;
                        break;

                    case 2:
                        entity.LineType = modelBuilder.Model.ContinuousLineType;
                        break;

                    case 3:
                        if (this.ulong_3 != 0UL)
                        {
                            DxfLineType dxfLineType = modelBuilder.method_4 <DxfLineType>(this.ulong_3);
                            if (dxfLineType != null)
                            {
                                entity.LineType = dxfLineType;
                                break;
                            }
                            break;
                        }
                        break;
                    }
                }
            }
Exemplo n.º 14
0
 public GraphicElementInsert GetGraphicElementInsert(
     DxfLayer layer,
     EntityColor byBlockColor,
     DxfLineType byBlockLineType)
 {
     foreach (IGraphicElement graphicElement in this.list_0)
     {
         GraphicElementInsert graphicElementInsert = graphicElement as GraphicElementInsert;
         if (graphicElementInsert != null && graphicElementInsert.Matches(layer, byBlockColor, byBlockLineType))
         {
             return(graphicElementInsert);
         }
     }
     return((GraphicElementInsert)null);
 }
Exemplo n.º 15
0
 protected DrawContext(DxfModel model, DxfLayout layout, GraphicsConfig config)
 {
     this.dxfModel_0            = model;
     this.dxfLayout_0           = layout;
     this.graphicsConfig_0      = config;
     this.dxfLineType_0         = model.ContinuousLineType;
     this.short_0               = (short)-3;
     this.dxfLayer_0            = model.ZeroLayer;
     this.dxfLayer_1            = model.method_14();
     this.dxfWipeoutVariables_0 = model.DictionaryRoot.Entries.GetFirstValue("ACAD_WIPEOUT_VARS") as DxfWipeoutVariables ?? new DxfWipeoutVariables();
     this.dictionary_0          = new Dictionary <DxfEntity, object>();
     this.image_0               = (Image) new Bitmap(1, 1);
     this.graphics_0            = Class940.smethod_0(this.image_0);
     this.method_0();
 }
Exemplo n.º 16
0
        protected DoubleCollection GetDashArray(DxfLineType lineType)
        {
            if (lineType == null || lineType.Elements.Count <= 0)
            {
                return((DoubleCollection)null);
            }
            DoubleCollection dashArray;

            if (!this.idictionary_0.TryGetValue(lineType, out dashArray))
            {
                dashArray = this.CreateDashArray(lineType);
                this.idictionary_0.Add(lineType, dashArray);
            }
            return(dashArray);
        }
Exemplo n.º 17
0
 public GraphicElementBlock2(
     Matrix4D transform,
     DxfLayer layer,
     EntityColor byBlockColor,
     DxfLineType byBlockLineType)
 {
     this.matrix4D_0       = transform;
     this.bool_0           = layer.Enabled;
     this.bool_1           = layer.Frozen;
     this.color_0          = layer.Color;
     this.dxfLineType_0    = layer.LineType;
     this.entityColor_0    = byBlockColor;
     this.dxfLineType_1    = byBlockLineType;
     this.linkedListNode_0 = this.linkedList_0.AddLast((IGraphicElement)NullGraphicElement.Instance);
     this.linkedList_0.AddLast((IGraphicElement)NullGraphicElement.Instance);
 }
Exemplo n.º 18
0
 public GraphicElement2 GetGraphicElement2(
     ArgbColor color,
     DxfLineType lineType,
     double lineTypeScale,
     bool plinegen)
 {
     foreach (IGraphicElement graphicElement in this.list_0)
     {
         GraphicElement2 graphicElement2 = graphicElement as GraphicElement2;
         if (graphicElement2 != null && graphicElement2.Matches(color, lineType, lineTypeScale, plinegen))
         {
             return(graphicElement2);
         }
     }
     return((GraphicElement2)null);
 }
Exemplo n.º 19
0
 public Class732(
     GraphicsConfig graphicsConfig,
     GraphicElement1 graphicElementWithoutLineType,
     GraphicElement1 graphicElementWithLineType,
     Matrix4D toPseudoWcsTransform,
     DxfLineType lineType,
     double lineTypeScale,
     bool plinegen)
 {
     this.graphicsConfig_0  = graphicsConfig;
     this.graphicElement1_0 = graphicElementWithoutLineType;
     this.graphicElement1_1 = graphicElementWithLineType;
     this.matrix4D_0        = toPseudoWcsTransform;
     this.dxfLineType_0     = lineType;
     this.double_0          = lineTypeScale;
     this.bool_0            = plinegen;
 }
Exemplo n.º 20
0
        public override void DrawInternal(
            DrawContext.Surface context,
            Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            ArgbColor   plotColor     = context.GetPlotColor((DxfEntity)this);
            DxfLineType lineType      = this.GetLineType((DrawContext)context);
            double      lineTypeScale = context.TotalLineTypeScale * this.LineTypeScale;

            if (!graphics.AddExistingGraphicElement2(parentGraphicElementBlock, (DxfEntity)this, plotColor, lineType, lineTypeScale, false))
            {
                return;
            }
            GraphicElement2 graphicElement2 = new GraphicElement2(plotColor, lineType, lineTypeScale, true);

            graphics.AddNewGraphicElement((DxfEntity)this, parentGraphicElementBlock, (GraphicElement1)graphicElement2);
            WW.Math.Geometry.Polyline3D polyline = this.method_14(context.Config);
            graphicElement2.Geometry.Add(WW.Cad.Drawing.Surface.Polyline3D.CreatePrimitive(polyline));
        }
Exemplo n.º 21
0
        public void ResolveReferences(Class374 modelBuilder, DxfMLineStyle mlineStyle)
        {
            DxfLineType lineType1 = (DxfLineType)null;

            if (this.nullable_1.HasValue)
            {
                lineType1 = modelBuilder.method_4 <DxfLineType>(this.nullable_1.Value);
            }
            else if (this.nullable_0.HasValue)
            {
                if (this.nullable_0.Value == (int)short.MaxValue)
                {
                    lineType1 = modelBuilder.Model.ByLayerLineType;
                }
                else if (this.nullable_0.Value == 32766)
                {
                    lineType1 = modelBuilder.Model.ByBlockLineType;
                }
                else
                {
                    int num = -1;
                    foreach (DxfLineType lineType2 in (KeyedDxfHandledObjectCollection <string, DxfLineType>)modelBuilder.Model.LineTypes)
                    {
                        if (lineType2 != modelBuilder.Model.ByLayerLineType && lineType2 != modelBuilder.Model.ByBlockLineType)
                        {
                            ++num;
                        }
                        if (num == this.nullable_0.Value)
                        {
                            lineType1 = lineType2;
                            break;
                        }
                    }
                }
            }
            else
            {
                lineType1 = modelBuilder.Model.ByLayerLineType;
            }
            mlineStyle.Elements.Add(new DxfMLineStyle.Element(this.double_0, this.color_0, lineType1));
        }
Exemplo n.º 22
0
        public bool GetGraphicElementInsert(
            IGraphicElementBlock graphicElementBlock,
            DxfEntity insert,
            DxfLayer layer,
            EntityColor byBlockColor,
            DxfLineType byBlockLineType,
            out GraphicElementInsert graphicElement)
        {
            Graphics.EntityInfo entityInfo;
            bool flag;

            if (this.dictionary_0.TryGetValue(insert, out entityInfo))
            {
                graphicElement = entityInfo.GetGraphicElementInsert(layer, byBlockColor, byBlockLineType);
                if (graphicElement == null)
                {
                    flag           = true;
                    graphicElement = new GraphicElementInsert();
                    entityInfo.GraphicElements.Add((IGraphicElement)graphicElement);
                }
                else
                {
                    flag = false;
                }
            }
            else
            {
                graphicElement = new GraphicElementInsert();
                this.dictionary_0.Add(insert, new Graphics.EntityInfo()
                {
                    GraphicElements =
                    {
                        (IGraphicElement)graphicElement
                    }
                });
                flag = true;
            }
            graphicElementBlock.Add((IGraphicElement)graphicElement);
            return(flag);
        }
Exemplo n.º 23
0
        internal static DxfLineType GetLineType(CloneContext cloneContext, DxfLineType from)
        {
            if (from == null)
            {
                return((DxfLineType)null);
            }
            if (from.Name == null)
            {
                throw new Exception("Table record name is null.");
            }
            if (cloneContext.SourceModel == cloneContext.TargetModel)
            {
                return(from);
            }
            DxfLineType dxfLineType1 = (DxfLineType)cloneContext.GetExistingClone((IGraphCloneable)from) ?? cloneContext.TargetModel.GetLineTypeWithName(from.Name);

            if (dxfLineType1 == null)
            {
                switch (cloneContext.ReferenceResolutionType)
                {
                case ReferenceResolutionType.IgnoreMissing:
                    dxfLineType1 = cloneContext.TargetModel.ContinuousLineType;
                    break;

                case ReferenceResolutionType.CloneMissing:
                    DxfLineType dxfLineType2 = (DxfLineType)from.Clone(cloneContext);
                    if (!cloneContext.CloneExact)
                    {
                        cloneContext.TargetModel.LineTypes.Add(dxfLineType2);
                    }
                    dxfLineType1 = dxfLineType2;
                    break;

                case ReferenceResolutionType.FailOnMissing:
                    throw new DxfException(string.Format("Could not resolve reference to line type with name {0}", (object)from.Name));
                }
            }
            return(dxfLineType1);
        }
Exemplo n.º 24
0
        public override void DrawInternal(
            DrawContext.Surface context,
            WW.Cad.Drawing.Surface.Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            ArgbColor   plotColor     = context.GetPlotColor((DxfEntity)this);
            DxfLineType lineType      = this.GetLineType((DrawContext)context);
            double      lineTypeScale = context.TotalLineTypeScale * this.LineTypeScale;

            if (!graphics.AddExistingGraphicElement2(parentGraphicElementBlock, (DxfEntity)this, plotColor, lineType, lineTypeScale, false))
            {
                return;
            }
            GraphicElement2 graphicElement2 = new GraphicElement2(plotColor, lineType, lineTypeScale, false);

            graphics.AddNewGraphicElement((DxfEntity)this, parentGraphicElementBlock, (GraphicElement1)graphicElement2);
            if (this.double_1 != 0.0)
            {
                graphicElement2.Geometry.Extrusion = this.double_1 * this.vector3D_0;
            }
            graphicElement2.Geometry.Add((IPrimitive) new WW.Cad.Drawing.Surface.Segment(this.point3D_0, this.point3D_1));
        }
Exemplo n.º 25
0
        public bool GetGraphicElementBlock2(
            DxfBlock block,
            DxfLayer layer,
            EntityColor byBlockColor,
            DxfLineType byBlockLineType,
            out GraphicElementBlock2 graphicElementBlock)
        {
            Graphics.BlockInfo blockInfo;
            bool flag;

            if (this.dictionary_1.TryGetValue(block, out blockInfo))
            {
                graphicElementBlock = blockInfo.GetGraphicElementBlock(layer, byBlockColor, byBlockLineType);
                if (graphicElementBlock == null)
                {
                    flag = true;
                    graphicElementBlock = new GraphicElementBlock2(block.BaseTransformation, layer, byBlockColor, byBlockLineType);
                    blockInfo.GraphicElementBlocks.Add(graphicElementBlock);
                }
                else
                {
                    flag = false;
                }
            }
            else
            {
                graphicElementBlock = new GraphicElementBlock2(block.BaseTransformation, layer, byBlockColor, byBlockLineType);
                this.dictionary_1.Add(block, new Graphics.BlockInfo()
                {
                    GraphicElementBlocks =
                    {
                        graphicElementBlock
                    }
                });
                flag = true;
            }
            return(flag);
        }
Exemplo n.º 26
0
        internal static DxfTable ReadFromBuffer(DxfCodePairBufferReader buffer)
        {
            var table = new DxfLTypeTable();

            table.Items.Clear();
            while (buffer.ItemsRemain)
            {
                var pair = buffer.Peek();
                buffer.Advance();
                if (DxfTablesSection.IsTableEnd(pair))
                {
                    break;
                }

                if (pair.Code == 0 && pair.StringValue == DxfTable.LTypeText)
                {
                    var item = DxfLineType.FromBuffer(buffer);
                    table.Items.Add(item);
                }
            }

            return(table);
        }
Exemplo n.º 27
0
        public override void DrawInternal(
            DrawContext.Surface context,
            Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            ArgbColor   plotColor     = context.GetPlotColor((DxfEntity)this);
            DxfLineType lineType      = this.GetLineType((DrawContext)context);
            bool        plinegen      = (this.Flags & Enum21.flag_8) != Enum21.flag_0;
            double      lineTypeScale = context.TotalLineTypeScale * this.LineTypeScale;

            if (!graphics.AddExistingGraphicElement2(parentGraphicElementBlock, (DxfEntity)this, plotColor, lineType, lineTypeScale, plinegen))
            {
                return;
            }
            GraphicElement2 graphicElement2 = new GraphicElement2(plotColor, lineType, lineTypeScale, plinegen);

            graphics.AddNewGraphicElement((DxfEntity)this, parentGraphicElementBlock, (GraphicElement1)graphicElement2);
            if (this.Thickness != 0.0)
            {
                graphicElement2.Geometry.Extrusion = this.Thickness * Vector3D.ZAxis;
            }
            Class940.smethod_12((DrawContext)context, (IVertex2DCollection)this.dxfVertex2DCollection_0, this.Closed, this.Transform, this.Thickness, this.DefaultStartWidth, this.DefaultEndWidth, graphicElement2.Geometry);
        }
Exemplo n.º 28
0
        protected void DrawWave(DataTable dt, DxfModel model, DxfBlock block)
        {
            for (int i = 1; i < dt.Rows.Count; i++)
            {
                //高度换算比例尺
                ScaleConversion dac = new ScaleConversion();

                double spY = dac.getPaintNumber(double.Parse(dt.Rows[i - 1][0].ToString()), 500); //起始点x 深度
                double spX = double.Parse(dt.Rows[i - 1][1].ToString()) / 1000;                   //起始点y 波速

                double epY = dac.getPaintNumber(double.Parse(dt.Rows[i][0].ToString()), 500);     //结束点x
                double epX = double.Parse(dt.Rows[i][1].ToString()) / 1000;                       //结束点y

                DxfLineType drillCodeLineType = new DxfLineType("TestLine1" + i);
                model.LineTypes.Add(drillCodeLineType);
                DxfLine drillCodeine = new DxfLine();
                drillCodeine.Start = new Point3D(134 + spX * 5, -23 - spY, 0d);
                drillCodeine.End   = new Point3D(134 + epX * 5, -23 - epY, 0d);
                //drillCodeine.Color = EntityColors.Gray;
                drillCodeine.LineType = drillCodeLineType;
                block.Entities.Add(drillCodeine);
            }
        }
Exemplo n.º 29
0
        public bool AddExistingGraphicElement2(
            IGraphicElementBlock graphicElementBlock,
            DxfEntity entity,
            ArgbColor color,
            DxfLineType lineType,
            double lineTypeScale,
            bool plinegen)
        {
            bool flag = true;

            Graphics.EntityInfo entityInfo;
            if (this.dictionary_0.TryGetValue(entity, out entityInfo))
            {
                GraphicElement2 graphicElement2 = entityInfo.GetGraphicElement2(color, lineType, lineTypeScale, plinegen);
                if (graphicElement2 == null)
                {
                    graphicElement2 = new GraphicElement2(entityInfo.Geometry, color, lineType, lineTypeScale, plinegen);
                    entityInfo.GraphicElements.Add((IGraphicElement)graphicElement2);
                }
                graphicElementBlock.Add((IGraphicElement)graphicElement2);
                flag = false;
            }
            return(flag);
        }
Exemplo n.º 30
0
        public static void smethod_0(
            DxfDimensionStyleOverrides dimensionStyle,
            DxfExtendedData extendedData,
            Class374 modelBuilder)
        {
            DxfExtendedData.ValueCollection valueCollection = (DxfExtendedData.ValueCollection)null;
            for (int index1 = 0; index1 < extendedData.Values.Count; ++index1)
            {
                DxfExtendedData.String @string = extendedData.Values[index1] as DxfExtendedData.String;
                if (@string != null && @string.Value == "DSTYLE")
                {
                    int index2 = index1 + 1;
                    if (index2 < extendedData.Values.Count)
                    {
                        valueCollection = extendedData.Values[index2] as DxfExtendedData.ValueCollection;
                        break;
                    }
                    break;
                }
            }
            if (valueCollection == null)
            {
                return;
            }
            for (int index1 = 0; index1 < valueCollection.Count; index1 += 2)
            {
                DxfExtendedData.Int16 int16 = valueCollection[index1] as DxfExtendedData.Int16;
                if (int16 != null)
                {
                    short num    = int16.Value;
                    int   index2 = index1 + 1;
                    if (index2 < valueCollection.Count)
                    {
                        IExtendedDataValue extendedDataValue = valueCollection[index2];
                        switch (num)
                        {
                        case 3:
                            dimensionStyle.PostFix = ((DxfExtendedData.String)extendedDataValue).Value;
                            continue;

                        case 4:
                            dimensionStyle.AlternateDimensioningSuffix = ((DxfExtendedData.String)extendedDataValue).Value;
                            continue;

                        case 5:
                            string blockName1 = ((DxfExtendedData.String)extendedDataValue).Value;
                            if (!string.IsNullOrEmpty(blockName1))
                            {
                                dimensionStyle.ArrowBlock = Class309.smethod_1(modelBuilder, blockName1);
                                continue;
                            }
                            continue;

                        case 6:
                            string blockName2 = ((DxfExtendedData.String)extendedDataValue).Value;
                            if (!string.IsNullOrEmpty(blockName2))
                            {
                                dimensionStyle.FirstArrowBlock = Class309.smethod_1(modelBuilder, blockName2);
                                continue;
                            }
                            continue;

                        case 7:
                            string blockName3 = ((DxfExtendedData.String)extendedDataValue).Value;
                            if (!string.IsNullOrEmpty(blockName3))
                            {
                                dimensionStyle.SecondArrowBlock = Class309.smethod_1(modelBuilder, blockName3);
                                continue;
                            }
                            continue;

                        case 40:
                            dimensionStyle.ScaleFactor = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 41:
                            dimensionStyle.ArrowSize = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 42:
                            dimensionStyle.ExtensionLineOffset = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 43:
                            dimensionStyle.DimensionLineIncrement = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 44:
                            dimensionStyle.ExtensionLineExtension = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 45:
                            dimensionStyle.Rounding = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 46:
                            dimensionStyle.DimensionLineExtension = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 47:
                            dimensionStyle.PlusTolerance = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 48:
                            dimensionStyle.MinusTolerance = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 49:
                            dimensionStyle.FixedExtensionLineLength = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 50:
                            dimensionStyle.JoggedRadiusDimensionTransverseSegmentAngle = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 69:
                            dimensionStyle.TextBackgroundFillMode = (DimensionTextBackgroundFillMode)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 70:
                            dimensionStyle.TextBackgroundColor = Color.CreateFromColorIndex(((DxfExtendedData.Int16)extendedDataValue).Value);
                            continue;

                        case 71:
                            dimensionStyle.GenerateTolerances = ((DxfExtendedData.Int16)extendedDataValue).Value == (short)1;
                            continue;

                        case 72:
                            dimensionStyle.LimitsGeneration = ((DxfExtendedData.Int16)extendedDataValue).Value == (short)1;
                            continue;

                        case 73:
                            dimensionStyle.TextInsideHorizontal = ((DxfExtendedData.Int16)extendedDataValue).Value == (short)1;
                            continue;

                        case 74:
                            dimensionStyle.TextOutsideHorizontal = ((DxfExtendedData.Int16)extendedDataValue).Value == (short)1;
                            continue;

                        case 75:
                            dimensionStyle.SuppressFirstExtensionLine = ((DxfExtendedData.Int16)extendedDataValue).Value == (short)1;
                            continue;

                        case 76:
                            dimensionStyle.SuppressSecondExtensionLine = ((DxfExtendedData.Int16)extendedDataValue).Value == (short)1;
                            continue;

                        case 77:
                            dimensionStyle.TextVerticalAlignment = (DimensionTextVerticalAlignment)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 78:
                            dimensionStyle.ZeroHandling = (ZeroHandling)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 79:
                            dimensionStyle.AngularZeroHandling = (ZeroHandling)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 90:
                            dimensionStyle.ArcLengthSymbolPosition = (ArcLengthSymbolPosition)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 140:
                            dimensionStyle.TextHeight = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 141:
                            dimensionStyle.CenterMarkSize = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 142:
                            dimensionStyle.TickSize = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 143:
                            dimensionStyle.AlternateUnitScaleFactor = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 144:
                            dimensionStyle.LinearScaleFactor = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 145:
                            dimensionStyle.TextVerticalPosition = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 146:
                            dimensionStyle.ToleranceScaleFactor = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 147:
                            dimensionStyle.DimensionLineGap = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 148:
                            dimensionStyle.AlternateUnitRounding = ((DxfExtendedData.Double)extendedDataValue).Value;
                            continue;

                        case 170:
                            dimensionStyle.AlternateUnitDimensioning = ((DxfExtendedData.Int16)extendedDataValue).Value == (short)1;
                            continue;

                        case 171:
                            dimensionStyle.AlternateUnitDecimalPlaces = ((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 172:
                            dimensionStyle.TextOutsideExtensions = ((DxfExtendedData.Int16)extendedDataValue).Value == (short)1;
                            continue;

                        case 173:
                            dimensionStyle.SeparateArrowBlocks = ((DxfExtendedData.Int16)extendedDataValue).Value == (short)1;
                            continue;

                        case 174:
                            dimensionStyle.TextInsideExtensions = ((DxfExtendedData.Int16)extendedDataValue).Value == (short)1;
                            continue;

                        case 175:
                            dimensionStyle.SuppressOutsideExtensions = ((DxfExtendedData.Int16)extendedDataValue).Value == (short)1;
                            continue;

                        case 176:
                            short colorIndex1 = ((DxfExtendedData.Int16)extendedDataValue).Value;
                            dimensionStyle.DimensionLineColor = Color.CreateFromColorIndex(colorIndex1);
                            continue;

                        case 177:
                            short colorIndex2 = ((DxfExtendedData.Int16)extendedDataValue).Value;
                            dimensionStyle.ExtensionLineColor = Color.CreateFromColorIndex(colorIndex2);
                            continue;

                        case 178:
                            short colorIndex3 = ((DxfExtendedData.Int16)extendedDataValue).Value;
                            dimensionStyle.TextColor = Color.CreateFromColorIndex(colorIndex3);
                            continue;

                        case 179:
                            dimensionStyle.AngularDimensionDecimalPlaces = ((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 271:
                            dimensionStyle.DecimalPlaces = Convert.ToInt16(extendedDataValue.ValueObject);
                            continue;

                        case 272:
                            dimensionStyle.ToleranceDecimalPlaces = ((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 273:
                            dimensionStyle.AlternateUnitFormat = (AlternateUnitFormat)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 274:
                            dimensionStyle.AlternateUnitToleranceDecimalPlaces = ((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 275:
                            dimensionStyle.AngularUnit = (AngularUnit)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 276:
                            dimensionStyle.FractionFormat = (FractionFormat)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 277:
                            dimensionStyle.LinearUnitFormat = (LinearUnitFormat)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 278:
                            dimensionStyle.DecimalSeparator = (char)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 279:
                            dimensionStyle.TextMovement = (TextMovement)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 280:
                            dimensionStyle.TextHorizontalAlignment = (DimensionTextHorizontalAlignment)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 281:
                            dimensionStyle.SuppressFirstDimensionLine = ((DxfExtendedData.Int16)extendedDataValue).Value == (short)1;
                            continue;

                        case 282:
                            dimensionStyle.SuppressSecondDimensionLine = ((DxfExtendedData.Int16)extendedDataValue).Value == (short)1;
                            continue;

                        case 283:
                            dimensionStyle.ToleranceAlignment = (ToleranceAlignment)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 284:
                            dimensionStyle.ToleranceZeroHandling = (ZeroHandling)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 285:
                            dimensionStyle.AlternateUnitZeroHandling = (ZeroHandling)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 286:
                            dimensionStyle.AlternateUnitToleranceZeroHandling = (ZeroHandling)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 288:
                            dimensionStyle.CursorUpdate = (CursorUpdate)((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 290:
                            dimensionStyle.IsExtensionLineLengthFixed = ((DxfExtendedData.Int16)extendedDataValue).Value != (short)0;
                            continue;

                        case 340:
                            DxfTextStyle dxfTextStyle = Class309.smethod_2(modelBuilder, extendedDataValue) as DxfTextStyle;
                            if (dxfTextStyle != null)
                            {
                                dimensionStyle.TextStyle = dxfTextStyle;
                                continue;
                            }
                            continue;

                        case 341:
                            DxfBlock dxfBlock1 = Class309.smethod_2(modelBuilder, extendedDataValue) as DxfBlock;
                            if (dxfBlock1 != null)
                            {
                                dimensionStyle.LeaderArrowBlock = dxfBlock1;
                                continue;
                            }
                            continue;

                        case 342:
                            DxfBlock dxfBlock2 = Class309.smethod_2(modelBuilder, extendedDataValue) as DxfBlock;
                            if (dxfBlock2 != null)
                            {
                                dimensionStyle.ArrowBlock = dxfBlock2;
                                continue;
                            }
                            continue;

                        case 343:
                            DxfBlock dxfBlock3 = Class309.smethod_2(modelBuilder, extendedDataValue) as DxfBlock;
                            if (dxfBlock3 != null)
                            {
                                dimensionStyle.FirstArrowBlock = dxfBlock3;
                                continue;
                            }
                            continue;

                        case 344:
                            DxfBlock dxfBlock4 = Class309.smethod_2(modelBuilder, extendedDataValue) as DxfBlock;
                            if (dxfBlock4 != null)
                            {
                                dimensionStyle.SecondArrowBlock = dxfBlock4;
                                continue;
                            }
                            continue;

                        case 345:
                            DxfLineType dxfLineType1 = Class309.smethod_2(modelBuilder, extendedDataValue) as DxfLineType;
                            if (dxfLineType1 != null)
                            {
                                dimensionStyle.DimensionLineLineType = dxfLineType1;
                                continue;
                            }
                            continue;

                        case 346:
                            DxfLineType dxfLineType2 = Class309.smethod_2(modelBuilder, extendedDataValue) as DxfLineType;
                            if (dxfLineType2 != null)
                            {
                                dimensionStyle.FirstExtensionLineLineType = dxfLineType2;
                                continue;
                            }
                            continue;

                        case 347:
                            DxfLineType dxfLineType3 = Class309.smethod_2(modelBuilder, extendedDataValue) as DxfLineType;
                            if (dxfLineType3 != null)
                            {
                                dimensionStyle.SecondExtensionLineLineType = dxfLineType3;
                                continue;
                            }
                            continue;

                        case 371:
                            dimensionStyle.DimensionLineWeight = ((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        case 372:
                            dimensionStyle.ExtensionLineWeight = ((DxfExtendedData.Int16)extendedDataValue).Value;
                            continue;

                        default:
                            continue;
                        }
                    }
                }
                else
                {
                    modelBuilder.Messages.Add(new DxfMessage(DxfStatus.InvalidXDataValueType, Severity.Warning, "ValueType", (object)valueCollection[index1].GetType())
                    {
                        Parameters =
                        {
                            {
                                "ExpectedValueType",
                                (object)typeof(DxfExtendedData.Int16)
                            },
                            {
                                "Target",
                                (object)dimensionStyle
                            }
                        }
                    });
                    break;
                }
            }
        }
Exemplo n.º 31
0
        internal static DxfLineType FromBuffer(DxfCodePairBufferReader buffer)
        {
            var item = new DxfLineType();
            while (buffer.ItemsRemain)
            {
                var pair = buffer.Peek();
                if (pair.Code == 0)
                {
                    break;
                }

                buffer.Advance();
                switch (pair.Code)
                {
                    case 70:
                        item.StandardFlags = (int)pair.ShortValue;
                        break;
                    case DxfCodePairGroup.GroupCodeNumber:
                        var groupName = DxfCodePairGroup.GetGroupName(pair.StringValue);
                        item.ExtensionDataGroups.Add(DxfCodePairGroup.FromBuffer(buffer, groupName));
                        break;
                    case 3:
                        item.Description = (pair.StringValue);
                        break;
                    case 72:
                        item.AlignmentCode = (pair.ShortValue);
                        break;
                    case 73:
                        item.ElementCount = (pair.ShortValue);
                        break;
                    case 40:
                        item.TotalPatternLength = (pair.DoubleValue);
                        break;
                    case 49:
                        item.DashDotSpaceLengths.Add((pair.DoubleValue));
                        break;
                    case 74:
                        item.ComplexLinetypeElementTypes.Add((pair.ShortValue));
                        break;
                    case 75:
                        item.ShapeNumbers.Add((pair.ShortValue));
                        break;
                    case 340:
                        item.StylePointers.Add((pair.StringValue));
                        break;
                    case 46:
                        item.ScaleValues.Add((pair.DoubleValue));
                        break;
                    case 50:
                        item.RotationAngles.Add((pair.DoubleValue));
                        break;
                    case 44:
                        item.XOffsets.Add((pair.DoubleValue));
                        break;
                    case 45:
                        item.YOffsets.Add((pair.DoubleValue));
                        break;
                    case 9:
                        item.TextStrings.Add((pair.StringValue));
                        break;
                    case (int)DxfXDataType.ApplicationName:
                        item.XData = DxfXData.FromBuffer(buffer, pair.StringValue);
                        break;
                    default:
                        item.TrySetPair(pair);
                        break;
                }
            }

            return item;
        }