示例#1
0
        /// <summary> 从AutoCAD界面中的防护文字中提取对应的防护数据 </summary>
        /// <param name="seg"></param>
        /// <param name="db"></param>
        public static void ExtractProtectionFromText(ISlopeSeg seg, Database db)
        {
            DBText text = null;

            text = seg.ProtectionMethodText.GetDBObject <DBText>(db);

            if (text != null && !string.IsNullOrEmpty(text.TextString))
            {
                seg.ProtectionMethod = text.TextString;
            }
            else
            {
                seg.ProtectionMethod     = null;
                seg.ProtectionMethodText = default(Handle);
            }
        }
示例#2
0
        /// <summary> 删除子边坡所绑定的防护文字 </summary>
        /// <param name="seg"></param>
        /// <param name="db"></param>
        public static void EraseText(ISlopeSeg seg, Database db)
        {
            DBText originalText = null;

            try
            {
                originalText = seg.ProtectionMethodText.GetDBObject <DBText>(db);
            }
            catch (Exception)
            {
            }
            if (originalText != null)
            {
                originalText.UpgradeOpen();
                originalText.Erase(true);
                originalText.DowngradeOpen();
                seg.ProtectionMethodText = default(Handle);
            }
        }
示例#3
0
        private DBText CreateProtectionMethodText(ISlopeSeg ss)
        {
            var rota = Math.Atan((ss.OuterPoint.Y - ss.InnerPoint.Y) / (ss.OuterPoint.X - ss.InnerPoint.X));// / 2 / Math.PI * 360;
            var txt  = new DBText();

            //
            //txt.HorizontalMode = TextHorizontalMode.TextCenter;
            //txt.VerticalMode = TextVerticalMode.TextVerticalMid;
            txt.Justify = AttachmentPoint.TopCenter;
            // 如果要设置对齐,则一定要先设置 HorizontalMode 与 VerticalMode,最后设置 AlignmentPoint。设置了对齐后,Position属性被屏蔽,不论设置为什么值都不起作用。
            txt.AlignmentPoint = ss.MiddlePoint;
            //
            txt.TextString  = ss.ProtectionMethod;
            txt.Rotation    = rota; // 弧度
            txt.Height      = 0.72;
            txt.WidthFactor = 0.7;
            //
            return(txt);
        }
示例#4
0
        private static int SlopeSegComparison(ISlopeSeg s1, ISlopeSeg s2)
        {
            var mainLevel1 = (int)s1.Index;
            var mainLevel2 = (int)s2.Index;

            if (mainLevel1 < mainLevel2)
            {
                return(-1);
            }
            else if (mainLevel1 > mainLevel2)
            {
                return(1);
            }
            else // 两者的主编号相同
            {
                if (s1 is Platform)
                {
                    return(1);
                }
                else
                {
                    // 说明 s1 为边坡
                    if (s2 is Platform)
                    {
                        //  s1 为边坡,s2 为平台
                        return(-1);
                    }

                    // s1 、 s2 均为边坡,且位于同一级子边坡中
                    if (s1.Index < s2.Index)
                    {
                        return(-1);
                    }
                    else
                    {
                        return(1);
                    }
                }
            }
        }
示例#5
0
        private void ChangeSelectedSlopeProtection(ISlopeSeg baseSeg)
        {
            var changedSlp      = dgv.Tag as SlopeLine;
            var changedXdata    = changedSlp.XData;
            var seperateFillCut = checkBox_SeperateFillCut.Checked; // 在统一修改时区分填方与挖方

            //
            foreach (SlopeLine slp in listBox_slopes.SelectedItems)
            {
                var xdata = slp.XData;
                if (!seperateFillCut || changedXdata.FillCut == xdata.FillCut)
                {
                    var slopes = SlopeData.Combine(slp.XData.Slopes, slp.XData.Platforms, false);
                    foreach (var s in slopes)
                    {
                        if (s.Type == baseSeg.Type && s.Index == baseSeg.Index)
                        {
                            s.ProtectionMethod = baseSeg.ProtectionMethod;
                        }
                    }
                }
            }
        }