コード例 #1
0
ファイル: SQUtils.cs プロジェクト: ming91915/CADDev
        private static List <SlopeLine> ConstructSlopeLinesFromPlines(DocumentModifier docMdf, List <Polyline> plines,
                                                                      bool sort)
        {
            var    slpLines = new List <SlopeLine>();
            string errMsg;

            foreach (var sl in plines)
            {
                var slpLine = SlopeLine.Create(docMdf, sl, out errMsg);
                if (slpLine != null)
                {
                    // 将存储的数据导入边坡对象
                    slpLine.ImportSlopeData(slpLine.XData);
                    //
                    if (!slpLine.XData.FullyCalculated)
                    {
                        slpLine.CalculateXData();
                    }
                    slpLines.Add(slpLine);
                }
                else
                {
                    docMdf.WriteNow(errMsg);
                }
            }
            if (sort)
            {
                slpLines.Sort(CompareStation);
            }
            return(slpLines);
        }
コード例 #2
0
ファイル: SlopeConstructor.cs プロジェクト: sunjini/CADDev
        /// <summary> 根据边坡多段线进行道路边坡的筛选、信息提取、防护方式的设置等操作 </summary>
        public void ConfigerSlopes(IList <Polyline> slopeLines, bool justModifyCalculated)
        {
            if (slopeLines == null || slopeLines.Count == 0)
            {
                return;
            }
            //
            var app = SymbolTableUtils.GetOrCreateAppName(_docMdf.acDataBase, _docMdf.acTransaction, SlopeData.AppName);

            var    selectedSlpLines = new List <SlopeLine>();
            string errMsg;

            foreach (var sl in slopeLines)
            {
                var slpLine = SlopeLine.Create(_docMdf, sl, out errMsg);
                if (slpLine != null)
                {
                    // 将存储的数据导入边坡对象
                    slpLine.ImportSlopeData(slpLine.XData);
                    //
                    if (!slpLine.XData.FullyCalculated || !justModifyCalculated)
                    {
                        slpLine.CalculateXData();
                    }
                    selectedSlpLines.Add(slpLine);
                }
                else
                {
                    _docMdf.WriteNow(errMsg);
                }
            }
            if (selectedSlpLines.Count == 0)
            {
                return;
            }

            var slopesWithSlopesegs    = new List <SlopeLine>();
            var slopesWithoutSlopesegs = new List <SlopeLine>();

            foreach (var slp in selectedSlpLines)
            {
                if (slp.XData.Slopes.Count + slp.XData.Platforms.Count > 0)
                {
                    slopesWithSlopesegs.Add(slp);
                }
                else
                {
                    slopesWithoutSlopesegs.Add(slp);
                }
            }
            //
            var es = EditStateIdentifier.GetCurrentEditState(_docMdf);

            es.CurrentBTR.UpgradeOpen();
            //var layer_Slope = Utils.GetOrCreateLayer(_docMdf, ProtectionConstants.LayerName_ProtectionMethod_Slope);
            //var layer_Platform = Utils.GetOrCreateLayer(_docMdf, ProtectionConstants.LayerName_ProtectionMethod_Platform);
            // _docMdf.acDataBase.Clayer = layer_Slope.ObjectId;
            //
            // 1. 对有子边坡的边坡对象进行操作:显示界面,以进行填挖方与防护设置
            var listerForm = new SlopeSegLister(slopesWithSlopesegs);

            listerForm.ShowDialog(null);
            if (listerForm.ValueChanged)
            {
                var protLayers = ProtectionTags.MapProtectionLayers(_docMdf, slopesWithSlopesegs);
                foreach (var slp in slopesWithSlopesegs)
                {
                    slp.Pline.UpgradeOpen();
                    SetSlopeUI(slp);
                    slp.PrintProtectionMethod(es.CurrentBTR, protLayers);
                    //
                    slp.FlushXData();
                    slp.Pline.DowngradeOpen();

                    if (slp.XDataToBeCleared)
                    {
                        slp.ClearXData();
                    }
                }
            }
            // 2. 对没有子边坡的边坡对象进行操作
            foreach (var slp in slopesWithoutSlopesegs)
            {
                slp.Pline.UpgradeOpen();
                SetSlopeUI(slp);
                slp.FlushXData();
                slp.Pline.DowngradeOpen();
            }

            es.CurrentBTR.DowngradeOpen();
        }