Example #1
0
        private double GetBottomElevation()
        {
            var maxY = Math.Min(Pline.StartPoint.Y, Pline.EndPoint.Y);

            return(Section.GetEleFromY(maxY));

            //
            var segms = SlopeData.Combine(_slopes, _platforms, sort: false);

            if (segms.Count == 0)
            {
                var bottomPt = _isFill
                    ? Pline.GetLineSegment2dAt(Pline.NumberOfVertices - 2).EndPoint
                    : Pline.GetLineSegment2dAt(0).StartPoint;
                return(Section.GetEleFromY(bottomPt.Y));
            }
            else
            {
                var bottomS = _isFill ? segms[segms.Count - 1] : segms[0];
                if (bottomS is Slope)
                {
                    return(Section.GetEleFromY((bottomS as Slope).BottomPoint.Y));
                }
                else
                {
                    return(Section.GetEleFromY((bottomS as Platform).MiddlePoint.Y));
                }
            }
        }
Example #2
0
        /// <summary> 将<seealso cref="SlopeData" />的信息灌注到对象中 </summary>
        public void ImportSlopeData(SlopeData newData)
        {
            if (newData.FullyCalculated)
            {
                XData = newData;

                // 对可以被用户通过界面进行修改的项进行赋值(主要是对用户自行设置的防护方式与防护长度进行赋值)
                _slopes    = newData.Slopes;
                _platforms = newData.Platforms;
            }
        }
Example #3
0
        private static bool MatchSide(SlopeData slopeData, Distribution distr)
        {
            switch (distr)
            {
            case Distribution.左侧:
                return(slopeData.OnLeft);

            case Distribution.右侧:
                return(!slopeData.OnLeft);

            default:
                return(true);
            }
        }
Example #4
0
        /// <summary> 根据边坡线对象中可能存储的轴线对象句柄值来提取对应的轴线对象 </summary>
        /// <param name="pl"></param>
        /// <remarks>未找到则返回 null </remarks>
        private static SubgradeSection FindCenterAxisOnHandle(DocumentModifier docMdf, Polyline pl)
        {
            var data = SlopeData.FromEntity(pl);

            if (data != null && data.FullyCalculated)
            {
                var cl = data.CenterAxisHandle.GetDBObject <Line>(docMdf.acDataBase);
                if (cl != null)
                {
                    var si = SectionInfo.FromCenterLine(cl);
                    if (si != null)
                    {
                        var ss = new SubgradeSection(docMdf, cl, si);
                        return(ss);
                    }
                }
            }
            return(null);
        }
Example #5
0
        /// <summary>
        /// 将边坡从第一条规则开始过滤,如果任何一整条规则都不符合,则返回 null
        /// </summary>
        /// <param name="criterions"></param>
        /// <returns></returns>
        private string GetFirstSlopeProtection(AutoProtectionCriterions criterions, SlopeData data)
        {
            // 将边坡从第一条规则开始过滤,如果任何一整条规则都不符合,则返回 null
            foreach (var cr in criterions.SlopeCriterions)
            {
                // 填挖方
                if ((cr.Fill == Operator_Bool.是 && !_isFill) || (cr.Fill == Operator_Bool.否 && _isFill))
                {
                    continue;
                }
                // 首级边坡坡比
                if (data.Slopes.Count == 0)
                {
                    continue;
                }
                var firstSlopeRatio = Math.Abs(data.Slopes[0].SlopeRatio);
                if (!InRangeCollection(cr.FirstSlopeRatio.AndRange, firstSlopeRatio))
                {
                    continue;
                }

                // 边坡高度
                var slopeHeight = Math.Abs(Pline.StartPoint.Y - Pline.EndPoint.Y);
                if (!InRangeCollection(cr.SlopeHeight.AndRange, slopeHeight))
                {
                    continue;
                }

                // 边坡总坡级
                var slopeLevelCount = data.Slopes.Count;
                if (!InRangeCollection(cr.SlopeLevel.AndRange, slopeLevelCount))
                {
                    continue;
                }

                // 所有条件都满足,确定防护方式
                return(cr.ProtectionMethod);
            }
            return(null);
        }
Example #6
0
        public static SlopeData FromEntity(Entity ent)
        {
            var data = new SlopeData()
            {
                FullyCalculated = false
            };

            if (ent.ExtensionDictionary.IsNull)
            {
                return(data);
            }
            // 总的字典
            var extensionDict = ent.ExtensionDictionary.GetObject(OpenMode.ForRead) as DBDictionary;
            int baseId;

            // 一般数据
            var rec = SymbolTableUtils.GetDictionaryValue <Xrecord>(extensionDict, DictKey_General);

            if (rec == null)
            {
                return(data);
            }

            var buffs = rec.Data.AsArray();

            try
            {
                data.FullyCalculated  = Utils.GetExtendedDataBool(buffs[0]);
                data.CenterAxisHandle = Utils.ConvertToHandle(buffs[1].Value.ToString());
                data.FillCut          = Utils.GetExtendedDataBool(buffs[2]);
                data.Station          = (double)buffs[3].Value;
                data.OnLeft           = Utils.GetExtendedDataBool(buffs[4]);
                data.SoilOrRock       = Utils.GetExtendedDataEnum <SubgradeType>(buffs[5]);//  (SubgradeType)Enum.ToObject(typeof(SubgradeType), (short)buffs[5].Value);

                //  标高与长度
                baseId                   = 5;
                data.TopElevation        = (double)buffs[baseId + 1].Value;
                data.BottomElevation     = (double)buffs[baseId + 2].Value;
                data.RetainingWallHeight = (double)buffs[baseId + 3].Value;
                //data.SlopeLengthBelowWaterLevel = (double)buffs[baseId + 3].Value;
                //data.SlopeLengthBelowFillTop = (double)buffs[baseId + 4].Value;
            }
            catch (Exception ex)
            {
                Debug.Print("数据转换出错:" + ex.Message + "\r\n" + ex.StackTrace);
            }
            // 边坡
            var dbSlopes = SymbolTableUtils.GetDictionaryValue <DBDictionary>(extensionDict, DictKey_Slopes);

            if (dbSlopes != null)
            {
                for (int i = 0; i < dbSlopes.Count; i++)
                {
                    var v   = SymbolTableUtils.GetDictionaryValue <Xrecord>(dbSlopes, i.ToString());
                    var slp = Slope.FromResultBuffer(v.Data);
                    if (slp != null)
                    {
                        data.Slopes.Add(slp);
                    }
                }
            }
            // 平台
            var dbPlatforms = SymbolTableUtils.GetDictionaryValue <DBDictionary>(extensionDict, DictKey_Platforms);

            if (dbPlatforms != null)
            {
                for (int i = 0; i < dbPlatforms.Count; i++)
                {
                    var v   = SymbolTableUtils.GetDictionaryValue <Xrecord>(dbPlatforms, i.ToString());
                    var slp = Platform.FromResultBuffer(v.Data);
                    if (slp != null)
                    {
                        data.Platforms.Add(slp);
                    }
                }
            }
            // 水位线

            // 一般数据
            var wl = SymbolTableUtils.GetDictionaryValue <Xrecord>(extensionDict, DictKey_Waterlines);

            if (wl == null || wl.Data == null)
            {
                return(data);
            }
            buffs = wl.Data.AsArray();
            var waterlines = buffs.Select(r => Utils.ConvertToHandle(r.Value.ToString())).ToList();

            data.Waterlines = waterlines;
            //
            return(data);
        }