//ramp와 겹치는 지상 주차 제거 //지상주차수 체크 //목표주차 미달? //지하주차 추가 // 지하주차 규모 체크 // 지하주차 규모 초과? //새 램프 // 지하주차 규모 충분 //끝 //목표주차 충분 //끝 //something changed = true public bool OverlapCheck(ref Apartment apt) { ParkingLotOnEarth gp = apt.ParkingLotOnEarth; ParkingLotUnderGround ugp = apt.ParkingLotUnderGround; if (gp.ParkingLines.Count <= 0) { return(false); } Curve ramp = ugp.Ramp; if (ramp == null) { return(false); } Stack <int> removeIndex = new Stack <int>(); for (int i = 0; i < gp.ParkingLines[0].Count; i++) { var pccr = Curve.PlanarClosedCurveRelationship(ramp, gp.ParkingLines[0][i].Boundary.ToNurbsCurve(), Plane.WorldXY, 0); if (pccr != RegionContainment.Disjoint) { removeIndex.Push(i); } } int overlapCount = removeIndex.Count; while (removeIndex.Count > 0) { int index = removeIndex.Pop(); apt.ParkingLotOnEarth.ParkingLines[0].RemoveAt(index); } if (ugp.Count + overlapCount > 50 && ugp.Count <= 50) { //지하 50대 미만이었다가 초과하게되면? 다시생성 this.require = ugp.Count + overlapCount; Calculate(); apt.ParkingLotUnderGround = new ParkingLotUnderGround((int)eachFloorParkingCount * floors, eachFloorArea * floors, floors); return(true); } else { //그밖의경우 this.require = ugp.Count + overlapCount; Calculate(); apt.ParkingLotUnderGround = new ParkingLotUnderGround((int)eachFloorParkingCount * floors, eachFloorArea * floors, floors); apt.ParkingLotUnderGround.Ramp = ramp; return(false); } }
//common public ParkingLotOnEarth GetParking() { if (!FieldCheck()) { return(new ParkingLotOnEarth()); } if (addFront) { AddFrontLine(); } if (addBack) { AddBackLine(); } while (distance >= 64000) { MultiplyLines(); } ParkingLotOnEarth parkingLot; //parking ParkingResultContainer pm = new ParkingResultContainer(boundary, parkingLines, distance, coreDepth, useInnerLoop, LineType); pm.CalculateParkingScore(); //check obstacle collision List <Curve> parkable = new List <Curve>(); foreach (Curve park in pm.parkingCells) { bool collision = false; foreach (Curve obs in obstacles) { //collision 생기거나 if (Curve.PlanarCurveCollision(park, obs, Plane.WorldXY, 0)) { collision = true; break; } //내포,외포 하거나 else if (Curve.PlanarClosedCurveRelationship(park, obs, Plane.WorldXY, 0) == RegionContainment.AInsideB || Curve.PlanarClosedCurveRelationship(park, obs, Plane.WorldXY, 0) == RegionContainment.BInsideA) { collision = true; break; } } if (!collision) { parkable.Add(park); } } List <ParkingLine> pls = new List <ParkingLine>(); if (pm.parkingCells != null) { pls = parkable.Select(n => new ParkingLine(n)).ToList(); } parkingLot = new ParkingLotOnEarth(new List <List <ParkingLine> >() { pls }); return(parkingLot); }