Skip to content

Commit

Permalink
Merge pull request #1315 from nehaniua/Dev-2.0
Browse files Browse the repository at this point in the history
obpas changes decimal points, toilet. risk type computation changes i…
  • Loading branch information
sriranjan-s authored Sep 2, 2024
2 parents 9f2ed4a + e652b6d commit c08a5e5
Show file tree
Hide file tree
Showing 9 changed files with 198 additions and 255 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,80 +39,53 @@ public PlanDetail validate(PlanDetail planDetail) {

@Override
public PlanDetail extract(PlanDetail planDetail) {
List<DXFLWPolyline> toiletMeasurements = null;
List<DXFLWPolyline> toiletVentilationMeasurements = null;
List<Measurement> roomMeasurements = null;
List<BigDecimal> roomHeights;
List<RoomHeight> roomHeightsList;




for (Block block : planDetail.getBlocks())
if (block.getBuilding() != null && block.getBuilding().getFloors() != null)
for (Block block : planDetail.getBlocks()) {
if (block.getBuilding() != null && block.getBuilding().getFloors() != null) {
for (Floor f : block.getBuilding().getFloors()) {
List<Toilet> toilets = new ArrayList<>();
List<Toilet> toilets = new ArrayList<>();
String layerName = String.format(layerNames.getLayerName("LAYER_NAME_BLK_FLR_TOILET"), block.getNumber(),
f.getNumber(), "+\\d");

List<String> names = Util.getLayerNamesLike(planDetail.getDoc(), layerName);


for (String toiletLayer : names) {
toiletMeasurements = Util.getPolyLinesByLayer(planDetail.getDoc(), toiletLayer);


if (!toiletMeasurements.isEmpty()) {
Toilet toiletObj = new Toilet();
List<Measurement> toiletMeasurementList = new ArrayList<>();
toiletMeasurements.forEach(toilet -> {

Measurement measurementToilet = new MeasurementDetail(toilet, true);
toiletMeasurementList.add(measurementToilet);


});

toiletObj.setToilets(toiletMeasurementList);
toilets.add(toiletObj);
}


List<String> names = Util.getLayerNamesLike(planDetail.getDoc(), layerName);

for (String toiletLayer : names) {
List<DXFLWPolyline> toiletMeasurements = Util.getPolyLinesByLayer(planDetail.getDoc(), toiletLayer);

if (!toiletMeasurements.isEmpty()) {
Toilet toiletObj = new Toilet();
List<Measurement> toiletMeasurementList = new ArrayList<>();
toiletMeasurements.forEach(toilet -> {
Measurement measurementToilet = new MeasurementDetail(toilet, true);
toiletMeasurementList.add(measurementToilet);
});

toiletObj.setToilets(toiletMeasurementList);
toilets.add(toiletObj);
}



String toiletVentilationLayer = String.format(layerNames.getLayerName("LAYER_NAME_BLK_FLR_TOILET_VENTILATION"), block.getNumber(),
f.getNumber(), "+\\d");
List<String> ventilationList = Util.getLayerNamesLike(planDetail.getDoc(), toiletVentilationLayer);
}

List<BigDecimal> ventilation = new ArrayList<>();

for (String ventilationHeightLayer : ventilationList) {
toiletVentilationMeasurements = Util.getPolyLinesByLayer(planDetail.getDoc(), ventilationHeightLayer);
String windowHeight = Util.getMtextByLayerName(planDetail.getDoc(), ventilationHeightLayer);

Toilet toiletObj = new Toilet();
BigDecimal windowHeight1 = windowHeight != null
? BigDecimal.valueOf(
Double.valueOf(windowHeight.replaceAll("WINDOW_HT_M=", "")))
: BigDecimal.ZERO;



toiletObj.setToiletVentilation(windowHeight1);
toilets.add(toiletObj);

String toiletVentilationLayer = String.format(layerNames.getLayerName("LAYER_NAME_BLK_FLR_TOILET_VENTILATION"), block.getNumber(),
f.getNumber(), "+\\d");
List<String> ventilationList = Util.getLayerNamesLike(planDetail.getDoc(), toiletVentilationLayer);

for (String ventilationHeightLayer : ventilationList) {
List<DXFLWPolyline> toiletVentilationMeasurements = Util.getPolyLinesByLayer(planDetail.getDoc(), ventilationHeightLayer);
String windowHeight = Util.getMtextByLayerName(planDetail.getDoc(), ventilationHeightLayer);



BigDecimal windowHeight1 = windowHeight != null
? BigDecimal.valueOf(Double.parseDouble(windowHeight.replaceAll("WINDOW_HT_M=", "")))
: BigDecimal.ZERO;

for (Toilet toiletObj : toilets) {
toiletObj.setToiletVentilation(windowHeight1);
}
f.setToilet(toilets);

}


f.setToilet(toilets);
}
}
}

return planDetail;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ else if (roomAreas.size() > 1) {
&& floor.getNonaHabitationalDoors().size() > 0) {
for (Door door : floor.getNonaHabitationalDoors()) {
if (door != null) {
BigDecimal doorHeight = door.getNonHabitationDoorHeight();
BigDecimal doorHeight = door.getNonHabitationDoorHeight().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal doorWidth = door.getNonHabitationDoorWidth();
// BigDecimal minDoorHeight = BigDecimal.valueOf(2.0);
BigDecimal minDoorWidth = BigDecimal.valueOf(0.75);
Expand All @@ -533,7 +533,7 @@ else if (roomAreas.size() > 1) {
// // Calculation For Windows Added by Neha
if (floor.getWindows() != null && floor.getWindows().size() > 0) {
for (Window window : floor.getWindows()) {
BigDecimal windowHeight = window.getWindowHeight();
BigDecimal windowHeight = window.getWindowHeight().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal windowWidth = window.getWindowWidth();
BigDecimal minWindowHeight = BigDecimal.valueOf(.50);
BigDecimal minWindowWidth = BigDecimal.valueOf(.50);
Expand Down Expand Up @@ -628,7 +628,7 @@ else if (roomAreas.size() > 1) {
// Now perform the check for each window against the minimum dimensions
if (room.getWindows() != null && !room.getWindows().isEmpty()) {
for (Window window : room.getWindows()) {
BigDecimal windowHeight = window.getWindowHeight();
BigDecimal windowHeight = window.getWindowHeight().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal windowWidth = window.getWindowWidth();

// Check each window's dimensions
Expand Down Expand Up @@ -696,7 +696,7 @@ else if (roomAreas.size() > 1) {
// Now perform the check for each Door against the minimum dimensions
if (room.getDoors() != null && !room.getDoors().isEmpty()) {
for (Door door : room.getDoors()) {
BigDecimal doorHeight = door.getDoorHeight();
BigDecimal doorHeight = door.getDoorHeight().setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal doorWidth = door.getDoorWidth();
System.out.println("rum number" + room.getNumber());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public Plan process(Plan pl) {
subRule = SUBRULE_41_III;

if (!kitchenAreas.isEmpty()) {
totalArea = kitchenAreas.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
totalArea = kitchenAreas.stream().reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, BigDecimal.ROUND_HALF_UP);
minimumHeight = MINIMUM_AREA_5;
subRuleDesc = String.format(SUBRULE_41_III_AREA_DESC, KITCHEN);

Expand All @@ -216,7 +216,7 @@ public Plan process(Plan pl) {
boolean isTypicalRepititiveFloor = false;
Map<String, Object> typicalFloorValues = ProcessHelper.getTypicalFloorValues(block, floor,
isTypicalRepititiveFloor);
BigDecimal minRoomWidth = kitchenWidths.stream().reduce(BigDecimal::min).get();
BigDecimal minRoomWidth = kitchenWidths.stream().reduce(BigDecimal::min).get().setScale(2, BigDecimal.ROUND_HALF_UP);
minWidth = MINIMUM_WIDTH_1_8;
subRuleDesc = String.format(SUBRULE_41_III_TOTAL_WIDTH, KITCHEN);
buildResult(pl, floor, minWidth, subRule, subRuleDesc, minRoomWidth, valid, typicalFloorValues);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,9 @@ else if (plotArea != null && plotArea.doubleValue() >= 100 && plotArea.doubleVal
BigDecimal requiredVisitorParkingArea = Util.roundOffTwoDecimal(BigDecimal.valueOf(requiredVisitorParkArea));
BigDecimal providedVisitorParkingArea = Util.roundOffTwoDecimal(providedVisitorParkArea);

double totalECS = roundedValueOpen + roundedValueCover + roundedValueBsmnt + roundedValueStilt;

BigDecimal totalECS = new BigDecimal(roundedValueOpen + roundedValueCover + roundedValueBsmnt + roundedValueStilt)
.setScale(2, BigDecimal.ROUND_HALF_UP);

if (totalProvidedCarParkArea.doubleValue() == 0) {
pl.addError(RULE__DESCRIPTION,
getLocaleMessage("msg.error.not.defined", RULE__DESCRIPTION));
Expand Down
Loading

0 comments on commit c08a5e5

Please sign in to comment.