Example #1
0
        public void DrawString(string s, Font font, Brush brush, PointF point)
        {
            DxfText dxfText = new DxfText(s, new WW.Math.Point3D((double)point.X, -(double)point.Y, 0.0), (double)font.Size);

            dxfText.AlignmentPoint2   = new WW.Math.Point3D?(dxfText.AlignmentPoint1);
            dxfText.VerticalAlignment = TextVerticalAlignment.Top;
            DxfTextStyle dxfTextStyle = (DxfTextStyle)null;

            foreach (DxfTextStyle textStyle in (DxfHandledObjectCollection <DxfTextStyle>) this.dxfModel_0.TextStyles)
            {
                if (textStyle.FontFilename == font.Name)
                {
                    dxfTextStyle = textStyle;
                    break;
                }
            }
            if (dxfTextStyle == null)
            {
                dxfTextStyle = new DxfTextStyle(font.Name, font.Name);
                this.dxfModel_0.TextStyles.Add(dxfTextStyle);
            }
            dxfText.Style = dxfTextStyle;
            SolidBrush solidBrush = brush as SolidBrush;

            if (solidBrush != null)
            {
                dxfText.Color = EntityColor.CreateFrom((ArgbColor)solidBrush.Color);
            }
            this.list_0.Add((DxfEntity)dxfText);
        }
Example #2
0
        public override void DrawInternal(
            DrawContext.Surface context,
            ISurfaceGraphicsFactory graphicsFactory)
        {
            DxfTextStyle textStyle = this.TextStyle;

            if (textStyle == null)
            {
                return;
            }
            ShxFile shxFile = textStyle.GetShxFile();

            if (shxFile == null)
            {
                return;
            }
            ShxShape shapeByIndex = shxFile.GetShapeByIndex(this.ushort_0);

            if (shapeByIndex == null)
            {
                return;
            }
            WW.Math.Point2D endPoint;
            new Class473((DxfEntity)this, context, graphicsFactory).DrawPath(shapeByIndex.GetGlyphShape(false, out endPoint), this.Transform, this.Color.ToColor(), context.GetLineWeight((DxfEntity)this), false, false, this.double_1);
        }
Example #3
0
 public void CopyFrom(DxfContentFormat from, CloneContext cloneContext)
 {
     if (from.TextStyle == null)
     {
         this.dxfTextStyle_0 = (DxfTextStyle)null;
     }
     else if (cloneContext.SourceModel == cloneContext.TargetModel)
     {
         this.dxfTextStyle_0 = from.dxfTextStyle_0;
     }
     else if (!cloneContext.TargetModel.TextStyles.TryGetValue(from.dxfTextStyle_0.Name, out this.dxfTextStyle_0))
     {
         if (cloneContext.ReferenceResolutionType == ReferenceResolutionType.CloneMissing)
         {
             this.dxfTextStyle_0 = (DxfTextStyle)from.dxfTextStyle_0.Clone(cloneContext);
             if (!cloneContext.CloneExact)
             {
                 cloneContext.TargetModel.TextStyles.Add(this.dxfTextStyle_0);
             }
         }
         else if (cloneContext.ReferenceResolutionType == ReferenceResolutionType.FailOnMissing)
         {
             throw new DxfException("Missing text style with name " + from.dxfTextStyle_0.Name + " in target model.");
         }
     }
     this.double_0         = from.double_0;
     this.cellAlignment_0  = from.cellAlignment_0;
     this.color_0          = from.color_0;
     this.dxfValueFormat_0 = from.dxfValueFormat_0.Clone();
     this.double_1         = from.double_1;
     this.short_0          = from.short_0;
     this.tableCellStylePropertyFlags_0 = from.tableCellStylePropertyFlags_0;
     this.tableCellStylePropertyFlags_1 = from.tableCellStylePropertyFlags_1;
     this.double_2 = from.double_2;
 }
Example #4
0
        public override void DrawInternal(
            DrawContext.Surface context,
            Graphics graphics,
            IGraphicElementBlock parentGraphicElementBlock)
        {
            DxfTextStyle textStyle = this.TextStyle;

            if (textStyle == null)
            {
                return;
            }
            ShxFile shxFile = textStyle.GetShxFile();

            if (shxFile == null)
            {
                return;
            }
            ShxShape shapeByIndex = shxFile.GetShapeByIndex(this.ushort_0);

            if (shapeByIndex == null)
            {
                return;
            }
            ArgbColor plotColor = context.GetPlotColor((DxfEntity)this);

            if (!graphics.AddExistingGraphicElement1(parentGraphicElementBlock, (DxfEntity)this, plotColor))
            {
                return;
            }
            WW.Math.Point2D endPoint;
            new Class355((DxfEntity)this, context, graphics, parentGraphicElementBlock).DrawPath(shapeByIndex.GetGlyphShape(false, out endPoint), this.Transform, this.Color.ToColor(), context.GetLineWeight((DxfEntity)this), false, false, this.double_1);
        }
Example #5
0
 internal virtual void vmethod_0(DxfModel modelContext, DxfTableStyle tableStyle)
 {
     if (this.dxfTextStyle_0 != null)
     {
         return;
     }
     this.dxfTextStyle_0 = modelContext.DefaultTextStyle;
 }
Example #6
0
        /// <summary>
        /// 方法,添加一个文字样式到模型空间
        /// </summary>
        /// <param name="_styleName">文字样式名称</param>
        /// <param name="_fontName">字体文件名称</param>
        /// <param name="_widthFactor">宽度因子</param>
        public DxfTextStyle AddStyle(string _styleName, string _fontName, double _widthFactor)
        {
            DxfTextStyle style = new DxfTextStyle(_styleName, _fontName);

            style.WidthFactor = _widthFactor;
            Model.TextStyles.Add(style);
            return(style);
        }
Example #7
0
        private void method_11()
        {
            this.class617_7.MaxDecompressedPageSize = 128;
            FileDependencyCollection dependencyCollection = new FileDependencyCollection();

            if (dependencyCollection.Count > 1)
            {
                this.class617_7.MaxDecompressedPageSize = 128 * dependencyCollection.Count;
            }
            this.class617_7.Encrypted = 2;
            MemoryStream  memoryStream = new MemoryStream();
            Class889      class889     = Class889.Create((Stream)memoryStream, this.dxfVersion_0, this.encoding_0);
            List <string> stringList   = new List <string>();

            foreach (FileDependency.Key key in dependencyCollection.Keys)
            {
                if (!stringList.Contains(key.FeatureName))
                {
                    stringList.Add(key.FeatureName);
                }
            }
            class889.vmethod_9(stringList.Count);
            foreach (string str in stringList)
            {
                class889.vmethod_22(str);
            }
            class889.vmethod_9(dependencyCollection.Count);
            DateTime dateTime = new DateTime(1980, 1, 1);

            foreach (FileDependency.Key key in dependencyCollection.Keys)
            {
                FileDependency fileDependency = dependencyCollection[key];
                if (fileDependency.FeatureName == "Acad:Text")
                {
                    string str = DxfTextStyle.smethod_2(Class1043.smethod_2(this.dxfModel_0.Filename), fileDependency.FullFilename);
                    if (!string.IsNullOrEmpty(str) && File.Exists(str))
                    {
                        FileInfo fileInfo = new FileInfo(str);
                        fileDependency.TimeStamp = fileInfo.LastWriteTime;
                        fileDependency.FileSize  = (int)fileInfo.Length;
                    }
                }
                class889.vmethod_22(fileDependency.FullFilename);
                class889.vmethod_22(fileDependency.FoundPath);
                class889.vmethod_22(fileDependency.FingerPrintGuid);
                class889.vmethod_22(fileDependency.VersionGuid);
                class889.vmethod_9(stringList.IndexOf(fileDependency.FeatureName));
                TimeSpan timeSpan = fileDependency.TimeStamp - dateTime;
                class889.vmethod_9((int)timeSpan.TotalSeconds);
                class889.vmethod_9(fileDependency.FileSize);
                class889.vmethod_5(fileDependency.AffectsGraphics ? (short)1 : (short)0);
                class889.vmethod_9(fileDependency.References.Count);
            }
            this.method_23(this.class617_7, memoryStream, false);
        }
Example #8
0
 internal static IList <Class908> smethod_0(
     string text,
     double height,
     DxfTextStyle style,
     double widthFactor,
     Color color,
     short lineWeight,
     Matrix4D insertionTransformation,
     Class985 resultLayoutInfo,
     Enum24 whiteSpaceHandlingFlags)
 {
     return(Class666.smethod_1(text, 0.0, height, AttachmentPoint.MiddleLeft, 1.0, LineSpacingStyle.Exact, style, widthFactor, color, DrawingDirection.LeftToRight, lineWeight, insertionTransformation, resultLayoutInfo, whiteSpaceHandlingFlags));
 }
Example #9
0
 internal void SetShape(
     DxfModel model,
     DxfTextStyle textStyle,
     ushort shapeIndex,
     bool updateName)
 {
     this.TextStyle = textStyle;
     this.ushort_0  = shapeIndex;
     if (!updateName)
     {
         return;
     }
     this.method_13(model.GetShxFile(textStyle.FontFilename));
 }
Example #10
0
        public override void ResolveReferences(Class374 modelBuilder)
        {
            base.ResolveReferences(modelBuilder);
            if (this.ulong_6 == 0UL)
            {
                return;
            }
            DxfTextStyle dxfTextStyle = modelBuilder.method_4 <DxfTextStyle>(this.ulong_6);

            if (dxfTextStyle == null)
            {
                return;
            }
            ((DxfText)this.Entity).Style = dxfTextStyle;
        }
Example #11
0
        public DxfShape(DxfTextStyle textStyle, ushort shapeIndex, WW.Math.Point3D insertionPoint)
        {
            if (textStyle == null)
            {
                throw new ArgumentNullException(nameof(textStyle));
            }
            this.TextStyle = textStyle;
            this.ushort_0  = shapeIndex;
            this.point3D_0 = insertionPoint;
            ShxFile shxFile = textStyle.GetShxFile();

            if (shxFile == null)
            {
                throw new ArgumentException("Shx file with name " + textStyle.FontFilename + " not found.");
            }
            this.method_13(shxFile);
        }
Example #12
0
        internal static DxfTextStyle GetTextStyle(
            CloneContext cloneContext,
            DxfTextStyle from)
        {
            if (from == null)
            {
                return((DxfTextStyle)null);
            }
            if (from.Name == null)
            {
                throw new Exception("Table record name is null.");
            }
            if (cloneContext.SourceModel == cloneContext.TargetModel)
            {
                return(from);
            }
            DxfTextStyle textStyle = (DxfTextStyle)cloneContext.GetExistingClone((IGraphCloneable)from);

            if (textStyle == null)
            {
                cloneContext.TargetModel.TextStyles.TryGetValue(from.Name, out textStyle);
            }
            if (textStyle == null)
            {
                switch (cloneContext.ReferenceResolutionType)
                {
                case ReferenceResolutionType.IgnoreMissing:
                    textStyle = cloneContext.TargetModel.DefaultTextStyle;
                    break;

                case ReferenceResolutionType.CloneMissing:
                    DxfTextStyle dxfTextStyle = (DxfTextStyle)from.Clone(cloneContext);
                    if (!cloneContext.CloneExact)
                    {
                        cloneContext.TargetModel.TextStyles.Add(dxfTextStyle);
                    }
                    textStyle = dxfTextStyle;
                    break;

                case ReferenceResolutionType.FailOnMissing:
                    throw new DxfException(string.Format("Could not resolve reference to text style with name {0}.", (object)from.Name));
                }
            }
            return(textStyle);
        }
Example #13
0
        public override void ResolveReferences(Class374 modelBuilder)
        {
            base.ResolveReferences(modelBuilder);
            if (this.ulong_6 == 0UL)
            {
                return;
            }
            DxfHandledObject dxfHandledObject = modelBuilder.method_3(this.ulong_6);

            if (dxfHandledObject == null)
            {
                return;
            }
            DxfTextStyle dxfTextStyle = dxfHandledObject as DxfTextStyle;

            if (dxfTextStyle != null)
            {
                ((DxfMText)this.Entity).Style = dxfTextStyle;
            }
            else
            {
                modelBuilder.Messages.Add(new DxfMessage(DxfStatus.WrongType, Severity.Error)
                {
                    Parameters =
                    {
                        {
                            "Handle",
                            (object)this.ulong_6
                        },
                        {
                            "Type",
                            (object)dxfHandledObject.GetType()
                        },
                        {
                            "ExpectedType",
                            (object)typeof(DxfTextStyle)
                        },
                        {
                            "ReferencingObjectHandle",
                            (object)this.Entity.Handle
                        }
                    }
                });
            }
        }
Example #14
0
        /// <summary>
        /// 绘制钻孔柱状图函数
        /// </summary>
        /// <param name="_path">输出文件的路径</param>
        /// <param name="_checkedZkList">选中的钻孔列表</param>
        /// <param name="_checkedScaleList">选中的比例尺列表</param>
        public static void OutputToCad(string _path, List <Borehole> _checkedZkList, List <double> _checkedScaleList)
        {
            // 实例化CAD对象
            CAD cad = new CAD();

            // 添加文字样式
            DxfTextStyle style1 = cad.AddStyle("GB2312", "仿宋_GB2312.ttf", 1);
            DxfTextStyle style2 = cad.AddStyle("GB2312_08", "仿宋_GB2312.ttf", 0.8);

            // 循环绘图
            for (int i = 0; i < _checkedZkList.Count; i++)
            {
                cad.DrawZk(i, Program.currentProject, ProjectDataBase.ReadProjectCompany(Program.currentProject), _checkedZkList[i], _checkedScaleList, style1, style2);
            }

            // 保存CAD文件
            cad.SaveAsDwg(_path, 195 * _checkedZkList.Count / 8, 280, 195 * _checkedZkList.Count);
        }
Example #15
0
 public void ResolveReferences(Class374 modelBuilder)
 {
     if (this.ulong_0 != 0UL)
     {
         DxfHandledObject dxfHandledObject = modelBuilder.method_3(this.ulong_0);
         if (dxfHandledObject != null)
         {
             DxfTextStyle dxfTextStyle = dxfHandledObject as DxfTextStyle;
             if (dxfTextStyle != null)
             {
                 this.element_0.TextStyle = dxfTextStyle;
             }
             else
             {
                 modelBuilder.Messages.Add(new DxfMessage(DxfStatus.WrongType, Severity.Error)
                 {
                     Parameters =
                     {
                         {
                             "Handle",
                             (object)this.ulong_0
                         },
                         {
                             "Type",
                             (object)dxfHandledObject.GetType()
                         },
                         {
                             "ExpectedType",
                             (object)typeof(DxfTextStyle)
                         },
                         {
                             "ReferencingObjectHandle",
                             (object)this.dxfLineType_0.Handle
                         }
                     }
                 });
             }
         }
     }
     this.element_0.method_0(modelBuilder.Model);
 }
Example #16
0
        public override void ResolveReferences(Class374 modelBuilder)
        {
            base.ResolveReferences(modelBuilder);
            DxfShape handledObject = (DxfShape)this.HandledObject;

            if (this.ulong_6 != 0UL)
            {
                DxfTextStyle textStyle = modelBuilder.method_4 <DxfTextStyle>(this.ulong_6);
                if (textStyle == null)
                {
                    return;
                }
                handledObject.SetShape(modelBuilder.Model, textStyle, handledObject.ShapeIndex, true);
            }
            else
            {
                if (handledObject.Name == null)
                {
                    return;
                }
                foreach (DxfTextStyle textStyle in (DxfHandledObjectCollection <DxfTextStyle>)modelBuilder.Model.TextStyles)
                {
                    if (textStyle.IsShape)
                    {
                        ShxFile shxFile = modelBuilder.Model.GetShxFile(textStyle.FontFilename);
                        if (shxFile != null)
                        {
                            ushort?indexByDescription = shxFile.GetShapeIndexByDescription(handledObject.Name);
                            if (indexByDescription.HasValue)
                            {
                                handledObject.SetShape(modelBuilder.Model, textStyle, indexByDescription.Value, false);
                                break;
                            }
                        }
                    }
                }
            }
        }
Example #17
0
        public override void ResolveReferences(Class374 modelBuilder)
        {
            base.ResolveReferences(modelBuilder);
            DxfDimensionStyle handledObject = (DxfDimensionStyle)this.HandledObject;

            if (this.ulong_2 != 0UL)
            {
                DxfTextStyle dxfTextStyle = modelBuilder.method_4 <DxfTextStyle>(this.ulong_2);
                if (dxfTextStyle != null)
                {
                    handledObject.TextStyle = dxfTextStyle;
                }
            }
            else if (!string.IsNullOrEmpty(this.string_0))
            {
                DxfTextStyle textStyleWithName = modelBuilder.Model.GetTextStyleWithName(this.string_0);
                if (textStyleWithName != null)
                {
                    handledObject.TextStyle = textStyleWithName;
                }
            }
            if (this.ulong_3 != 0UL)
            {
                DxfBlock dxfBlock = modelBuilder.method_4 <DxfBlock>(this.ulong_3);
                handledObject.LeaderArrowBlock = dxfBlock;
            }
            else if (!string.IsNullOrEmpty(this.string_1))
            {
                DxfBlock blockWithName = modelBuilder.Model.GetBlockWithName(this.string_1);
                handledObject.LeaderArrowBlock = blockWithName;
            }
            if (this.ulong_4 != 0UL)
            {
                DxfBlock dxfBlock = modelBuilder.method_4 <DxfBlock>(this.ulong_4);
                handledObject.ArrowBlock = dxfBlock;
            }
            else if (!string.IsNullOrEmpty(this.string_2))
            {
                DxfBlock blockWithName = modelBuilder.Model.GetBlockWithName(this.string_2);
                handledObject.ArrowBlock = blockWithName;
            }
            if (this.ulong_5 != 0UL)
            {
                DxfBlock dxfBlock = modelBuilder.method_4 <DxfBlock>(this.ulong_5);
                handledObject.FirstArrowBlock = dxfBlock;
            }
            else if (!string.IsNullOrEmpty(this.string_3))
            {
                DxfBlock blockWithName = modelBuilder.Model.GetBlockWithName(this.string_3);
                handledObject.FirstArrowBlock = blockWithName;
            }
            if (this.ulong_6 != 0UL)
            {
                DxfBlock dxfBlock = modelBuilder.method_4 <DxfBlock>(this.ulong_6);
                handledObject.SecondArrowBlock = dxfBlock;
            }
            else if (!string.IsNullOrEmpty(this.string_4))
            {
                DxfBlock blockWithName = modelBuilder.Model.GetBlockWithName(this.string_4);
                handledObject.SecondArrowBlock = blockWithName;
            }
            if (this.ulong_7 != 0UL)
            {
                handledObject.DimensionLineLineType = modelBuilder.method_4 <DxfLineType>(this.ulong_7);
            }
            else if (!string.IsNullOrEmpty(this.string_5))
            {
                handledObject.DimensionLineLineType = modelBuilder.Model.GetLineTypeWithName(this.string_5);
            }
            if (this.ulong_8 != 0UL)
            {
                handledObject.FirstExtensionLineLineType = modelBuilder.method_4 <DxfLineType>(this.ulong_8);
            }
            else if (!string.IsNullOrEmpty(this.string_6))
            {
                handledObject.FirstExtensionLineLineType = modelBuilder.Model.GetLineTypeWithName(this.string_6);
            }
            if (this.ulong_9 != 0UL)
            {
                handledObject.SecondExtensionLineLineType = modelBuilder.method_4 <DxfLineType>(this.ulong_9);
            }
            else
            {
                if (string.IsNullOrEmpty(this.string_7))
                {
                    return;
                }
                handledObject.SecondExtensionLineLineType = modelBuilder.Model.GetLineTypeWithName(this.string_7);
            }
        }
Example #18
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;
                }
            }
        }
Example #19
0
        internal static IList <Class908> smethod_1(
            string text,
            double width,
            double height,
            AttachmentPoint attachmentPoint,
            double lineSpacingFactor,
            LineSpacingStyle lineSpacingStyle,
            DxfTextStyle style,
            double widthFactor,
            Color color,
            DrawingDirection drawingDirection,
            short lineWeight,
            Matrix4D insertionTransformation,
            Class985 resultLayoutInfo,
            Enum24 whiteSpaceHandlingFlags)
        {
            Class1023[]      class1023Array = Class594.smethod_12(text, width, height, attachmentPoint, lineSpacingFactor, lineSpacingStyle, style, widthFactor, color, drawingDirection);
            Vector2D         zero           = Vector2D.Zero;
            IList <Class908> class908List   = (IList <Class908>) new List <Class908>();
            Bounds2D         bounds         = new Bounds2D();

            foreach (Class1023 class1023 in class1023Array)
            {
                class1023.imethod_0(ref zero, class1023.Settings.Height, whiteSpaceHandlingFlags);
                bounds.Update(class1023.GetBounds(whiteSpaceHandlingFlags, resultLayoutInfo));
            }
            double num1 = 0.0;
            double num2 = 0.0;

            if (bounds.Initialized)
            {
                switch (attachmentPoint)
                {
                case AttachmentPoint.TopLeft:
                    num1 = -bounds.Corner1.X;
                    num2 = -bounds.Corner2.Y;
                    break;

                case AttachmentPoint.TopCenter:
                    num1 = -bounds.Center.X;
                    num2 = -bounds.Corner2.Y;
                    break;

                case AttachmentPoint.TopRight:
                    num1 = -bounds.Corner2.X;
                    num2 = -bounds.Corner2.Y;
                    break;

                case AttachmentPoint.MiddleLeft:
                    num1 = -bounds.Corner1.X;
                    num2 = -bounds.Center.Y;
                    break;

                case AttachmentPoint.MiddleCenter:
                    num1 = -bounds.Center.X;
                    num2 = -bounds.Center.Y;
                    break;

                case AttachmentPoint.MiddleRight:
                    num1 = -bounds.Corner2.X;
                    num2 = -bounds.Center.Y;
                    break;

                case AttachmentPoint.BottomLeft:
                    num1 = -bounds.Corner1.X;
                    num2 = -bounds.Corner1.Y;
                    break;

                case AttachmentPoint.BottomCenter:
                    num1 = -bounds.Center.X;
                    num2 = -bounds.Corner1.Y;
                    break;

                case AttachmentPoint.BottomRight:
                    num1 = -bounds.Corner2.X;
                    num2 = -bounds.Corner1.Y;
                    break;
                }
            }
            if (width == 0.0)
            {
                num1 = 0.0;
            }
            Vector2D vector2D = new Vector2D(num1, num2);

            foreach (Class1023 class1023 in class1023Array)
            {
                class1023.Offset += vector2D;
                class1023.imethod_3((ICollection <Class908>)class908List, insertionTransformation, lineWeight);
            }
            if (resultLayoutInfo != null)
            {
                bounds.Move(num1, num2);
                resultLayoutInfo.Bounds.Update(bounds);
                if (resultLayoutInfo.FirstLineBounds != null)
                {
                    resultLayoutInfo.FirstLineBounds.Move(num1, num2);
                }
                if (resultLayoutInfo.LastLineBounds != null && resultLayoutInfo.LastLineBounds != resultLayoutInfo.FirstLineBounds)
                {
                    resultLayoutInfo.LastLineBounds.Move(num1, num2);
                }
            }
            return(class908List);
        }
Example #20
0
 public void Visit(DxfTextStyle value)
 {
     this.dxfHandledObject_0 = (DxfHandledObject)Class906.GetTextStyle(this.cloneContext_0, value);
 }
Example #21
0
        /// <summary>
        /// 方法,向模型空间添加一个多行文本,居中对齐
        /// </summary>
        /// <param name="_model">模型</param>
        /// <param name="_text">文本内容</param>
        /// <param name="_x">起点X坐标</param>
        /// <param name="_y">起点Y坐标</param>
        /// <param name="_width">文本宽度</param>
        /// <param name="_height">文本高度</param>
        /// <param name="_style">文字样式</param>
        /// <returns></returns>
        public DxfMText AddMText(string _text, double _x, double _y, double _width, double _height, DxfTextStyle _style)
        {
            DxfMText mText = new DxfMText(_text, new Point3D(_x, _y, 0d), _height);

            mText.ReferenceRectangleWidth = _width;
            mText.Height          = _height;
            mText.Style           = _style;
            mText.AttachmentPoint = AttachmentPoint.MiddleCenter;

            Model.Entities.Add(mText);
            return(mText);
        }
Example #22
0
        /// <summary>
        /// 方法,绘制单个钻孔柱状图
        /// </summary>
        /// <param name="_drawIndex">柱状图编号,从0开始,用于绘制多个柱状图时计算其摆放位置</param>
        /// <param name="_projectName">工程名称</param>
        /// <param name="_companyName">公司名称</param>
        /// <param name="_zk">钻孔数据</param>
        /// <param name="_scaleList">比例尺列表</param>
        /// <param name="_style1">钻孔柱状图的文字样式</param>
        /// <param name="_style2">剖面图钻孔的文字样式</param>
        public void DrawZk(int _drawIndex, string _projectName, string[] _company, Borehole _zk, List <double> _scaleList, DxfTextStyle _style1, DxfTextStyle _style2)
        {
            // 当钻孔内没有分层时退出
            if (_zk.Layers.Count == 0)
            {
                return;
            }

            // 计算图形横向偏移量,用于绘制多个柱状图时的空间摆放距离
            double xDis = _drawIndex * 195;

            // 绘制钻孔柱状图框架
            AddRectangle(0 + xDis, 0, 195 + xDis, 280);
            AddRectangle(10 + xDis, 20, 185 + xDis, 261);
            Model.Entities[Model.Entities.Count - 1].LineWeight = 30;

            double[,] pointKJ = new double[25, 4]
            {
                { 10, 254, 185, 254 }, { 10, 247, 57, 247 }, { 63, 247, 185, 247 }, { 10, 240, 185, 240 }, { 10, 220, 185, 220 },
                { 131.5, 233, 185, 233 }, { 132.5, 225, 150.5, 225 }, { 152.5, 225, 170.5, 225 }, { 172.5, 225, 184, 225 },
                { 30, 261, 30, 240 }, { 57, 254, 57, 240 }, { 63, 254, 63, 240 }, { 90, 261, 90, 240 }, { 110, 261, 110, 240 },
                { 137, 254, 137, 240 }, { 157, 254, 157, 240 }, { 22, 240, 22, 20 }, { 30, 240, 30, 20 }, { 42, 240, 42, 20 },
                { 52, 240, 52, 20 }, { 62, 240, 62, 20 }, { 77, 240, 77, 20 }, { 131.5, 240, 131.5, 20 },
                { 151.5, 240, 151.5, 20 }, { 171.5, 240, 171.5, 20 }
            };
            for (int i = 0; i < 25; i++)
            {
                AddLine(pointKJ[i, 0] + xDis, pointKJ[i, 1], pointKJ[i, 2] + xDis, pointKJ[i, 3]);
            }

            string[] textKJ = new string[31]
            {
                "工程名称", "钻孔编号", "孔口高程", "勘察单位", "钻孔深度", "钻孔日期", "初见水位", "稳定水位", "地\n质\n年\n代", "及\n成\n因", "层\n \n序",
                "层\n底\n标\n高\n(m)", "层\n底\n深\n度\n(m)", "分\n层\n厚\n度\n(m)", "岩  土  描  述", "标贯/动探", "取 样", "注水试验", "击 数", "深 度(m)",
                "编 号", "深 度(m)", "渗透系数\n(cm/s)", "深度(m)", "钻 孔 柱 状 图", "制图:", "校核:", "审查:", "核定:", "X:", "Y:"
            };
            double[,] ptextKJ = new double[31, 3]
            {
                { 20, 257.5, 20 }, { 20, 250.5, 20 }, { 20, 243.5, 20 }, { 100, 257.5, 20 }, { 100, 250.5, 20 }, { 100, 243.5, 20 }, { 147, 250.5, 20 }, { 147, 243.5, 20 },
                { 13, 230, 6 }, { 19, 230, 6 }, { 26, 230, 8 }, { 36, 230, 12 }, { 47, 230, 10 }, { 57, 230, 10 }, { 104.25, 230, 54.5 }, { 141.5, 236.5, 20 },
                { 161.5, 236.5, 20 }, { 178.25, 236.5, 13.5 }, { 141.5, 229, 20 }, { 141.5, 222.5, 20 }, { 161.5, 229, 20 }, { 161.5, 222.5, 20 }, { 178.25, 229, 13.5 },
                { 178.25, 222.5, 13.5 }, { 97.5, 270, 31 }, { 32, 13, 10 }, { 70, 13, 10 }, { 106, 13, 10 }, { 144, 13, 10 }, { 65.5, 252, 5 }, { 65.5, 245, 5 }
            };
            for (int i = 0; i < textKJ.Length; i++)
            {
                DxfMText t = AddMText(textKJ[i], ptextKJ[i, 0] + xDis, ptextKJ[i, 1], ptextKJ[i, 2], 2.5, _style1);
                if (i == 11 || i == 12 || i == 13 || i == 22)
                {
                    t.LineSpacingFactor = 0.8;
                }
            }

            // 绘制表头信息
            AddMText(_projectName, 60 + xDis, 257.5, 60, 2.5, _style1);
            AddMText(_zk.Name, 43.5 + xDis, 250.5, 27, 2.5, _style1);
            AddMText(_zk.Altitude.ToString("0.00") + "      m", 43.5 + xDis, 243.5, 27, 2.5, _style1);
            AddMText(_company[0], 147.5 + xDis, 257.5, 75, 2.5, _style1);
            AddMText(_zk.Layers[_zk.Layers.Count - 1].Depth.ToString("0.00") + "   m", 123.5 + xDis, 250.5, 27, 2.5, _style1);

            // 计算比例尺
            double scale;

            if (_zk.Layers[_zk.Layers.Count - 1].Depth <= 20)
            {
                scale = 100;
            }
            else if (_zk.Layers[_zk.Layers.Count - 1].Depth <= 40)
            {
                scale = 200;
            }
            else if (_zk.Layers[_zk.Layers.Count - 1].Depth <= 100)
            {
                scale = 500;
            }
            else
            {
                scale = 1000;
            }
            AddMText("柱\n状\n图\n1:" + scale, 69.5 + xDis, 230, 12, 2.5, _style1);

            // 绘制分层
            for (int i = 0; i < _zk.Layers.Count; i++)
            {
                // 分层线及深度标签
                double drawY = 220 - _zk.Layers[i].Depth / scale * 1000;

                AddLine(10 + xDis, drawY, 131.5 + xDis, drawY);
                AddMText(_zk.Layers[i].Number, 26 + xDis, drawY + 3, 8, 2.5, _style1);
                AddMText((_zk.Altitude - _zk.Layers[i].Depth).ToString("0.00"), 36 + xDis, drawY + 3, 8, 2.5, _style1);
                AddMText(_zk.Layers[i].Depth.ToString("0.00"), 47 + xDis, drawY + 3, 8, 2.5, _style1);
                if (i > 0)
                {
                    AddMText((_zk.Layers[i].Depth - _zk.Layers[i - 1].Depth).ToString("0.00"), 57 + xDis, drawY + 3, 8, 2.5, _style1);
                }
                else
                {
                    AddMText(_zk.Layers[i].Depth.ToString("0.00"), 57 + xDis, drawY + 3, 8, 2.5, _style1);
                }

                // 地质填充
                double hatchY1 = drawY;
                double hatchY2;
                if (i > 0)
                {
                    hatchY2 = 220 - _zk.Layers[i - 1].Depth / scale * 1000;
                }
                else
                {
                    hatchY2 = 220;
                }

                try
                {
                    string s = _zk.Layers[i].Name;
                    if (s.Contains("黏"))
                    {
                        s = s.Replace("黏", "粘");
                    }
                    AddRecHatch(HatchTrans(s), 62 + xDis, hatchY1, 77 + xDis, hatchY2);
                }
                catch
                {
                    AddRecHatch("SOLID", 62 + xDis, hatchY1, 77 + xDis, hatchY2);
                }

                // 岩土描述
                double presY = hatchY2 - 0.7;

                DxfMText t = AddMText(_zk.Layers[i].Name + ":" + _zk.Layers[i].Description, 78 + xDis, presY, 54.5, 1.5, _style1);
                t.AttachmentPoint = AttachmentPoint.TopLeft;
            }

            // 绘制标贯/动探
            for (int i = 0; i < _zk.NTests.Count; i++)
            {
                double drawY = 220 - _zk.NTests[i].Depth / scale * 1000;

                AddLine(131.5 + xDis, drawY, 151.5 + xDis, drawY);
                AddMText(_zk.NTests[i].Value.ToString("0"), 141.5 + xDis, drawY + 2, 20, 2.5, _style1);
                AddMText(_zk.NTests[i].Depth.ToString("0.00"), 141.5 + xDis, drawY - 2, 20, 2.5, _style1);
            }

            // 绘制取样
            for (int i = 0; i < _zk.Samples.Count; i++)
            {
                double drawY = 220 - _zk.Samples[i].Depth * 1000 / scale;

                AddLine(151.5 + xDis, drawY, 171.5 + xDis, drawY);
                AddMText(_zk.Samples[i].Name, 161.5 + xDis, drawY + 2, 20, 2.5, _style1);
                AddMText(_zk.Samples[i].Depth.ToString("0.00"), 161.5 + xDis, drawY - 2, 20, 2.5, _style1);
            }

            // 绘制人员信息
            AddMText(_company[2], 44 + xDis, 13, 10, 2.5, _style1);
            AddMText(_company[4], 82 + xDis, 13, 10, 2.5, _style1);
            AddMText(_company[5], 118 + xDis, 13, 10, 2.5, _style1);
            AddMText(_company[6], 156 + xDis, 13, 10, 2.5, _style1);

            // 绘制剖面图钻孔
            double distanceY = 280;

            for (int i = 0; i < _scaleList.Count; i++)
            {
                // 计算绘图起始位置
                distanceY = distanceY + 40 + _zk.Layers[_zk.Layers.Count - 1].Depth * 1000 / _scaleList[i];

                // 绘制钻孔编号、孔口高程、钻孔轴线
                AddLine(124 + xDis, distanceY + 10, 136 + xDis, distanceY + 10);
                AddMText(_zk.Name, 130 + xDis, distanceY + 13.5, 12, 4, _style2);
                AddMText(_zk.Altitude.ToString("0.00"), 130 + xDis, distanceY + 7, 12, 4, _style2);
                DxfPolyline2D l = AddLine(130 + xDis, distanceY, 130 + xDis, distanceY - _zk.Layers[_zk.Layers.Count - 1].Depth * 1000 / _scaleList[i]);
                l.LineWeight = 50;

                // 绘制分层
                for (int j = 0; j < _zk.Layers.Count; j++)
                {
                    double layerY    = distanceY - _zk.Layers[j].Depth * 1000 / _scaleList[i];
                    double layerYold = distanceY;
                    if (j > 0)
                    {
                        layerYold = distanceY - _zk.Layers[j - 1].Depth * 1000 / _scaleList[i];
                    }

                    if (j < _zk.Layers.Count - 1)
                    {
                        AddLine(120 + xDis, layerY, 130 + xDis, layerY);
                    }
                    DxfMText text = AddMText(_zk.Layers[j].Depth.ToString("0.00") + "(" + (_zk.Altitude - _zk.Layers[j].Depth).ToString("0.00") + ")", 132 + xDis, layerY, 25, 3, _style2);
                    text.AttachmentPoint = AttachmentPoint.MiddleLeft;

                    try
                    {
                        string s = _zk.Layers[j].Name;
                        if (s.Contains("黏"))
                        {
                            s = s.Replace("黏", "粘");
                        }
                        AddRecHatch(HatchTrans(s), 120 + xDis, layerY, 130 + xDis, layerYold);
                    }
                    catch
                    {
                        AddRecHatch("SOLID", 120 + xDis, layerY, 130 + xDis, layerYold);
                    }
                }

                // 绘制取样
                for (int j = 0; j < _zk.Samples.Count; j++)
                {
                    double sampleY = distanceY - _zk.Samples[j].Depth * 1000 / _scaleList[i];

                    if (_zk.Samples[j].IsDisturbed)
                    {
                        AddCircle(127.5 + xDis, sampleY, 1, false);
                    }
                    else
                    {
                        AddCircle(127.5 + xDis, sampleY, 1, true);
                    }
                }

                // 绘制标贯/动探
                for (int j = 0; j < _zk.NTests.Count; j++)
                {
                    double bgY = distanceY - _zk.NTests[j].Depth * 1000 / _scaleList[i];

                    DxfMText text = AddMText(_zk.NTests[j].Type.ToString() + "=" + _zk.NTests[j].Value, 120.5 + xDis, bgY, 6, 2.5, _style2);
                    text.AttachmentPoint = AttachmentPoint.MiddleLeft;
                }

                // 绘制比例尺标记
                double scY = distanceY - _zk.Layers[_zk.Layers.Count - 1].Depth * 1000 / _scaleList[i] / 2;

                DxfMText t = AddMText("1:" + _scaleList[i], 20 + xDis, scY, 80, 20, _style2);
                t.AttachmentPoint = AttachmentPoint.MiddleLeft;
            }
        }
Example #23
0
        /// <summary>
        /// 方法,绘制单个静力触探曲线图
        /// </summary>
        /// <param name="_drawIndex">曲线图编号,从0开始,用于绘制多个曲线图时计算其摆放位置</param>
        /// <param name="_projectName">工程名称</param>
        /// <param name="_companyName">公司名称</param>
        /// <param name="_jk">触探孔数据</param>
        /// <param name="_scaleList">比例尺列表</param>
        /// <param name="_style1">曲线图的文字样式</param>
        /// <param name="_style2">剖面图触探孔的文字样式</param>
        public void DrawJk(int _drawIndex, string _projectName, string[] _company, CPT _jk, List <double> _scaleList, DxfTextStyle _style1, DxfTextStyle _style2)
        {
            // 当触探孔内没有分层时退出
            if (_jk.Layers.Count == 0)
            {
                return;
            }

            // 计算图形横向偏移量,用于绘制多个柱状图时的空间摆放距离
            double xDis = _drawIndex * 195;

            // 绘制钻孔柱状图框架
            AddRectangle(0 + xDis, 0, 195 + xDis, 280);
            AddRectangle(10 + xDis, 20, 185 + xDis, 261);
            Model.Entities[Model.Entities.Count - 1].LineWeight = 30;

            double[,] pointKJ = new double[28, 4]
            {
                { 10, 254, 185, 254 }, { 10, 247, 57, 247 }, { 63, 247, 185, 247 }, { 10, 240, 185, 240 }, { 10, 220, 185, 220 },
                { 30, 261, 30, 240 }, { 57, 254, 57, 240 }, { 63, 254, 63, 240 }, { 90, 261, 90, 240 }, { 110, 261, 110, 240 },
                { 137, 254, 137, 240 }, { 157, 254, 157, 240 }, { 22, 240, 22, 20 }, { 30, 240, 30, 20 }, { 42, 240, 42, 20 },
                { 52, 240, 52, 20 }, { 62, 240, 62, 20 }, { 77, 240, 77, 20 },
                { 87, 220, 87, 222 }, { 97, 220, 97, 222 }, { 107, 220, 107, 222 }, { 117, 220, 117, 222 }, { 127, 220, 127, 222 },
                { 137, 220, 137, 222 }, { 147, 220, 147, 222 }, { 157, 220, 157, 222 }, { 167, 220, 167, 222 }, { 177, 220, 177, 222 }
            };
            for (int i = 0; i < 28; i++)
            {
                AddLine(pointKJ[i, 0] + xDis, pointKJ[i, 1], pointKJ[i, 2] + xDis, pointKJ[i, 3]);
            }

            string[] textKJ = new string[32]
            {
                "工程名称", "钻孔编号", "孔口高程", "勘察单位", "钻孔深度", "钻孔日期", "初见水位", "稳定水位", "地\n质\n年\n代", "及\n成\n因", "层\n \n序",
                "层\n底\n标\n高\n(m)", "层\n底\n深\n度\n(m)", "分\n层\n厚\n度\n(m)", "比 贯 入 阻 力 (MPa)", "1", "2", "3", "4", "5",
                "6", "7", "8", "9", "10", "静 力 触 探 曲 线 图", "制图:", "校核:", "审查:", "核定:", "X:", "Y:"
            };
            double[,] ptextKJ = new double[32, 3]
            {
                { 20, 257.5, 20 }, { 20, 250.5, 20 }, { 20, 243.5, 20 }, { 100, 257.5, 20 }, { 100, 250.5, 20 }, { 100, 243.5, 20 }, { 147, 250.5, 20 }, { 147, 243.5, 20 },
                { 13, 230, 6 }, { 19, 230, 6 }, { 26, 230, 8 }, { 36, 230, 12 }, { 47, 230, 10 }, { 57, 230, 10 }, { 131, 234.5, 108 }, { 87, 227, 2 },
                { 97, 227, 2 }, { 107, 227, 2 }, { 117, 227, 2 }, { 127, 227, 2 }, { 137, 227, 2 }, { 147, 227, 2 }, { 157, 227, 2 },
                { 167, 227, 2 }, { 177, 227, 2 }, { 97.5, 270, 175 }, { 32, 13, 10 }, { 70, 13, 10 }, { 106, 13, 10 }, { 144, 13, 10 }, { 65.5, 252, 5 }, { 65.5, 245, 5 }
            };
            for (int i = 0; i < textKJ.Length; i++)
            {
                DxfMText t = AddMText(textKJ[i], ptextKJ[i, 0] + xDis, ptextKJ[i, 1], ptextKJ[i, 2], 2.5, _style1);
                if (i == 11 || i == 12 || i == 13)
                {
                    t.LineSpacingFactor = 0.8;
                }
            }

            // 绘制表头信息
            AddMText(_projectName, 60 + xDis, 257.5, 60, 2.5, _style1);
            AddMText(_jk.Name, 43.5 + xDis, 250.5, 27, 2.5, _style1);
            AddMText(_jk.Altitude.ToString("0.00") + "      m", 43.5 + xDis, 243.5, 27, 2.5, _style1);
            AddMText(_company[0], 147.5 + xDis, 257.5, 75, 2.5, _style1);
            AddMText(_jk.Layers[_jk.Layers.Count - 1].Depth.ToString("0.00") + "   m", 123.5 + xDis, 250.5, 27, 2.5, _style1);

            // 计算比例尺
            double scale;

            if (_jk.Layers[_jk.Layers.Count - 1].Depth <= 20)
            {
                scale = 100;
            }
            else if (_jk.Layers[_jk.Layers.Count - 1].Depth <= 40)
            {
                scale = 200;
            }
            else if (_jk.Layers[_jk.Layers.Count - 1].Depth <= 100)
            {
                scale = 500;
            }
            else
            {
                scale = 1000;
            }
            AddMText("柱\n状\n图\n1:" + scale, 69.5 + xDis, 230, 12, 2.5, _style1);

            // 绘制分层
            for (int i = 0; i < _jk.Layers.Count; i++)
            {
                // 分层线及深度标签
                double drawY = 220 - _jk.Layers[i].Depth / scale * 1000;

                AddLine(10 + xDis, drawY, 77 + xDis, drawY);
                AddMText(_jk.Layers[i].Number, 26 + xDis, drawY + 3, 8, 2.5, _style1);
                AddMText((_jk.Altitude - _jk.Layers[i].Depth).ToString("0.00"), 36 + xDis, drawY + 3, 8, 2.5, _style1);
                AddMText(_jk.Layers[i].Depth.ToString("0.00"), 47 + xDis, drawY + 3, 8, 2.5, _style1);
                if (i > 0)
                {
                    AddMText((_jk.Layers[i].Depth - _jk.Layers[i - 1].Depth).ToString("0.00"), 57 + xDis, drawY + 3, 8, 2.5, _style1);
                }
                else
                {
                    AddMText(_jk.Layers[i].Depth.ToString("0.00"), 57 + xDis, drawY + 3, 8, 2.5, _style1);
                }

                // 地质填充
                double hatchY1 = drawY;
                double hatchY2;
                if (i > 0)
                {
                    hatchY2 = 220 - _jk.Layers[i - 1].Depth / scale * 1000;
                }
                else
                {
                    hatchY2 = 220;
                }

                try
                {
                    string s = _jk.Layers[i].Name;
                    if (s.Contains("黏"))
                    {
                        s = s.Replace("黏", "粘");
                    }
                    AddRecHatch(HatchTrans(s), 62 + xDis, hatchY1, 77 + xDis, hatchY2);
                }
                catch
                {
                    AddRecHatch("SOLID", 62 + xDis, hatchY1, 77 + xDis, hatchY2);
                }
            }

            // 绘制Ps曲线
            int n1 = _jk.PsList.Count;

            DxfVertex2D[] pointList = new DxfVertex2D[n1];
            for (int i = 0; i < n1; i++)
            {
                double drawY = 220 - Convert.ToDouble(i) / scale * 100;
                double drawX = 77 + _jk.PsList[i] * 10 + xDis;
                pointList[i] = new DxfVertex2D(drawX, drawY);
            }
            AddPline(pointList);

            // 绘制人员信息
            AddMText(_company[2], 44 + xDis, 13, 10, 2.5, _style1);
            AddMText(_company[4], 82 + xDis, 13, 10, 2.5, _style1);
            AddMText(_company[5], 118 + xDis, 13, 10, 2.5, _style1);
            AddMText(_company[6], 156 + xDis, 13, 10, 2.5, _style1);

            // 绘制剖面静力触探曲线图
            double distanceY = 280;

            for (int i = 0; i < _scaleList.Count; i++)
            {
                // 计算绘图起始位置
                distanceY = distanceY + 40 + _jk.Layers[_jk.Layers.Count - 1].Depth * 1000 / _scaleList[i];

                // 绘制钻孔编号、孔口高程、钻孔轴线
                AddLine(124 + xDis, distanceY + 10, 136 + xDis, distanceY + 10);
                AddMText(_jk.Name, 130 + xDis, distanceY + 13.5, 12, 4, _style2);
                AddMText(_jk.Altitude.ToString("0.00"), 130 + xDis, distanceY + 7, 12, 4, _style2);
                DxfPolyline2D l = AddLine(130 + xDis, distanceY, 130 + xDis, distanceY - _jk.Layers[_jk.Layers.Count - 1].Depth * 1000 / _scaleList[i]);
                l.LineWeight = 50;

                // 绘制分层
                for (int j = 0; j < _jk.Layers.Count; j++)
                {
                    double layerY    = distanceY - _jk.Layers[j].Depth * 1000 / _scaleList[i];
                    double layerYold = distanceY;
                    if (j > 0)
                    {
                        layerYold = distanceY - _jk.Layers[j - 1].Depth * 1000 / _scaleList[i];
                    }

                    if (j < _jk.Layers.Count - 1)
                    {
                        AddLine(123 + xDis, layerY, 130 + xDis, layerY);
                    }
                    DxfMText text = AddMText(_jk.Layers[j].Depth.ToString("0.00") + "(" + (_jk.Altitude - _jk.Layers[j].Depth).ToString("0.00") + ")", 121 + xDis, layerY + 1.5, 33, 3, _style2);
                    text.AttachmentPoint = AttachmentPoint.MiddleLeft;

                    try
                    {
                        string s = _jk.Layers[j].Name;
                        if (s.Contains("黏"))
                        {
                            s = s.Replace("黏", "粘");
                        }
                        AddRecHatch(HatchTrans(s), 123 + xDis, layerY, 130 + xDis, layerYold);
                    }
                    catch
                    {
                        AddRecHatch("SOLID", 123 + xDis, layerY, 130 + xDis, layerYold);
                    }
                }

                // 绘制Ps值曲线
                int           n2         = _jk.PsList.Count;
                DxfVertex2D[] pointList2 = new DxfVertex2D[n2];
                for (int j = 0; j < n2; j++)
                {
                    double drawY = distanceY - Convert.ToDouble(j) / _scaleList[i] * 100;
                    double drawX = 130 + _jk.PsList[j] * 10 + xDis;
                    pointList2[j] = new DxfVertex2D(drawX, drawY);
                }
                AddPline(pointList2);

                // 绘制Ps刻度
                double kdY = distanceY - _jk.Layers[_jk.Layers.Count - 1].Depth * 1000 / _scaleList[i] - 15;
                AddLine(130 + xDis, kdY, 180 + xDis, kdY);
                AddLine(130 + xDis, kdY, 130 + xDis, kdY + 8);
                for (int j = 1; j <= 5; j++)
                {
                    AddLine(130 + 10 * j + xDis, kdY, 130 + 10 * j + xDis, kdY + 2);
                    AddMText(j.ToString(), 130 + 10 * j + xDis, kdY + 7, 2, 3, _style2);
                }

                // 绘制比例尺标记
                double scY = distanceY - _jk.Layers[_jk.Layers.Count - 1].Depth * 1000 / _scaleList[i] / 2;

                DxfMText t = AddMText("1:" + _scaleList[i], 20 + xDis, scY, 80, 20, _style2);
                t.AttachmentPoint = AttachmentPoint.MiddleLeft;
            }
        }
Example #24
0
 internal void method_0(DxfTextStyle textStyle)
 {
     this.dxfTextStyle_0 = textStyle;
 }
Example #25
0
        private void method_1(Class374 modelBuilder, ulong handle, int i)
        {
            DxfModel         model            = modelBuilder.Model;
            DxfHandledObject dxfHandledObject = modelBuilder.method_3(handle);
            DxfTextStyle     dxfTextStyle     = dxfHandledObject as DxfTextStyle;

            if (dxfTextStyle != null)
            {
                if (!string.IsNullOrEmpty(dxfTextStyle.Name) && model.TextStyles.Contains(dxfTextStyle.Name))
                {
                    string name = dxfTextStyle.Name;
                    do
                    {
                        dxfTextStyle.Name = string.Format("AUDIT_{0}", (object)modelBuilder.method_21());
                    }while (model.TextStyles.Contains(dxfTextStyle.Name));
                    model.TextStyles.Add(dxfTextStyle);
                    modelBuilder.Messages.Add(new DxfMessage(DxfStatus.AuditRepairedDuplicateName, Severity.Warning)
                    {
                        Parameters =
                        {
                            {
                                "Class",
                                (object)"AcDbTextStyleTableRecord"
                            },
                            {
                                "OriginalName",
                                (object)name
                            },
                            {
                                "RepairedName",
                                (object)dxfTextStyle.Name
                            }
                        }
                    });
                }
                else
                {
                    model.TextStyles.Add(dxfTextStyle);
                }
            }
            else
            {
                if (dxfHandledObject == null)
                {
                    return;
                }
                modelBuilder.Messages.Add(new DxfMessage(DxfStatus.WrongType, Severity.Error)
                {
                    Parameters =
                    {
                        {
                            "Handle",
                            (object)handle
                        },
                        {
                            "Type",
                            (object)dxfHandledObject.GetType()
                        },
                        {
                            "ExpectedType",
                            (object)typeof(DxfAppId)
                        },
                        {
                            "Index",
                            (object)i
                        }
                    }
                });
            }
        }
Example #26
0
 public void SetShape(DxfTextStyle textStyle, ushort shapeIndex)
 {
     this.SetShape(this.Model, textStyle, shapeIndex, true);
 }