Exemple #1
0
 private void PlaceHouseByRoad(roadStripedRow row, List<HouseManager> drawnHouseList)
 {
     List<House> tempHouseList = new List<House>();
     foreach (House house in houseList)
     {
         tempHouseList.Add(house);
     }
     tempHouseList.Sort(delegate(House house1, House house2)
     {
         return Comparer<double>.Default.Compare(house1.leftGap + house1.width + house1.rightGap
             , house2.leftGap + house2.width + house2.rightGap);
     });
     row.formatRow();
     double restRowWidth = row.rowWidth; //剩余的行宽.
     IPoint currentPoint = row.lowerLeftPt; //开始的左下角.
     int round = 0;
     while (restRowWidth > tempHouseList[tempHouseList.Count - 1].leftGap + tempHouseList[tempHouseList.Count - 1].width + tempHouseList[tempHouseList.Count - 1].rightGap)
     {
         while (true)
         {
             if (tempHouseList[0].leftGap + tempHouseList[0].width + tempHouseList[0].rightGap > restRowWidth)
             {
                 tempHouseList.RemoveAt(0);
                 round = 0;
                 continue;
             }
             else
             {
                 break;
             }
         }
         HouseManager houseManager = new HouseManager(currentPoint, tempHouseList[round], commonHouse);
         round++;
         if (round == tempHouseList.Count)
             round = 0;
         restRowWidth -= houseManager.totalHouseWidth;
         houseManager.rotate(houseManager.lowerLeftPt, row.rotateAngle);
         drawnHouseList.Add(houseManager);
         currentPoint = new PointClass();
         currentPoint.X = houseManager.lowerRightPt.X;
         currentPoint.Y = houseManager.lowerRightPt.Y;
     }
 }
Exemple #2
0
 private void PlaceHouse(stripedRow row, List<HouseManager>drawnHouseList)
 {
     List<House> tempHouseList = new List<House>();
     foreach (House house in houseList)
     {
         tempHouseList.Add(house);
     }
     tempHouseList.Sort(delegate(House house1, House house2)
     {
         return Comparer<double>.Default.Compare(house1.leftGap + house1.width + house1.rightGap
             , house2.leftGap + house2.width + house2.rightGap);
     });
     //将房子放在格子中, 如果没有被chosenAreaFeaCls包含, 则不保留.
     double restRowWidth = row.rowWidth; //剩余的行宽.
     IPoint currentPoint = row.stripedrow.Envelope.LowerLeft; //开始的左下角.
     int round = 0;
     while (restRowWidth > tempHouseList[tempHouseList.Count - 1].leftGap + tempHouseList[tempHouseList.Count - 1].width + tempHouseList[tempHouseList.Count - 1].rightGap)
     {
         while (true)
         {
             if (tempHouseList[0].leftGap + tempHouseList[0].width + tempHouseList[0].rightGap > restRowWidth)
             {
                 tempHouseList.RemoveAt(0);
                 round = 0;
                 continue;
             }
             else
             {
                 break;
             }
         }
         HouseManager houseManager = new HouseManager(currentPoint, tempHouseList[round], commonHouse);
         round++;
         if (round == tempHouseList.Count)
             round = 0;
         houseManager.move(currentPoint);
         drawnHouseList.Add(houseManager);
         restRowWidth -= houseManager.totalHouseWidth;
         currentPoint.X += houseManager.totalHouseWidth;
     }
 }