Esempio n. 1
0
        /// <summary>
        /// 合并相关墙体
        /// </summary>
        /// <param name="spatialWalls"></param>
        private List <LineModel> MergeSpatialLines(List <LineModel> spatialLines, List <LineModel> separateInterior, out List <Line2D> boundary)
        {
            List <LineModel> interiorLines = new List <LineModel>();

            List <Line2D> Line3ds = new List <Line2D>();

            foreach (LineModel v in spatialLines)
            {
                //获取当前所有的线段
                Line3ds.Add(v.Line);
            }
            //排除不需要合并的点
            List <Vector2D> withoutpoint = new List <Vector2D>();

            separateInterior.ForEach(x =>
            {
                withoutpoint.Add(x.Line.Start);
                withoutpoint.Add(x.Line.End);
            });
            //合并所有的线段
            List <Line2D> mergeLines = GraphicAlgorithm.MergeLinesWithoutpoints(Line3ds, withoutpoint);

            boundary = mergeLines;

            //循环所有的合并后的线段
            for (int i = 0; i < mergeLines.Count; i++)
            {
                //键值信息
                List <LineModel> kvps = new List <LineModel>();

                foreach (LineModel v in spatialLines)
                {
                    if (v.Line.IsPartOf(mergeLines[i]))
                    {
                        kvps.Add(v);
                    }
                }
                kvps.ForEach(x => { spatialLines.Remove(x); });

                List <LineModel> mergeW = this.CreateMergeInteriorLine(kvps, mergeLines[i]);
                interiorLines.AddRange(mergeW);
            }


            return(interiorLines);
        }