From 4c695bc05888a2447d7b58491ba08be0ace189c8 Mon Sep 17 00:00:00 2001 From: Xeon0X Date: Thu, 20 Jun 2024 17:37:03 +0200 Subject: [PATCH] Combine Enums --- Enums.py | 31 ------------------------------- main.py | 8 +++++--- networks/geometry/Point2D.py | 2 +- networks/geometry/Segment2D.py | 2 +- networks/geometry/Segment3D.py | 2 +- networks/roads_2/Road.py | 6 +++--- utils/Enums.py | 34 ++++++++++++++++++++++++++++------ 7 files changed, 39 insertions(+), 46 deletions(-) delete mode 100644 Enums.py diff --git a/Enums.py b/Enums.py deleted file mode 100644 index 3dbf24e..0000000 --- a/Enums.py +++ /dev/null @@ -1,31 +0,0 @@ -from enum import Enum - - -class DIRECTION(Enum): - WEST = 0 - EAST = 1 - NORTH = 2 - SOUTH = 3 - - -class COLLUMN_STYLE(Enum): - INNER = 1 - OUTER = 2 - BOTH = 3 - - -class LINE_OVERLAP(Enum): - NONE = 0 - MAJOR = 1 - MINOR = 2 - - -class LINE_THICKNESS_MODE(Enum): - MIDDLE = 0 - DRAW_COUNTERCLOCKWISE = 1 - DRAW_CLOCKWISE = 2 - - -class ROTATION(Enum): - CLOCKWISE = 0 - COUNTERCLOCKWISE = 1 diff --git a/main.py b/main.py index 018154e..3900d7d 100644 --- a/main.py +++ b/main.py @@ -33,9 +33,11 @@ def main(): # editor.placeBlock( # (c[1][i][j].x, 110, c[1][i][j].y), Block("red_concrete")) - Road([Point3D(464, 85, -225), Point3D(408, 105, -224), - Point3D(368, 104, -249), Point3D(368, 85, -296), Point3D(457, 79, -292)], 15) - # rectangle_house_mountain, rectangle_building, skeleton_highway, skeleton_mountain, road_grid = world_maker() + # Road([Point3D(464, 85+10, -225), Point3D(408, 105+10, -224), + # Point3D(368, 104+10, -249), Point3D(368, 85+10, -296), Point3D(457, 79+10, -292)], 15) + Road([Point3D(526, 70, -415), Point3D(497, 76, -420), Point3D(483, 70, -381), Point3D(460, 71, -360), Point3D(430, 78, -383), Point3D(410, 71, -364), Point3D(381, + 71, -383), Point3D(350, 76, -375), Point3D(332, 79, -409), Point3D(432, 71, -460), Point3D(450, 70, -508), Point3D(502, 81, -493), Point3D(575, 85, -427)], 15) + # rectangle_house_mountain, rectangle_building, ske,leton_highway, skeleton_mountain, road_grid = world_maker() # editor = Editor(buffering=True) # buildArea = editor.getBuildArea() diff --git a/networks/geometry/Point2D.py b/networks/geometry/Point2D.py index d748303..1b6e201 100644 --- a/networks/geometry/Point2D.py +++ b/networks/geometry/Point2D.py @@ -3,7 +3,7 @@ from typing import List, Union import numpy as np -from Enums import ROTATION +from utils.Enums import ROTATION class Point2D: diff --git a/networks/geometry/Segment2D.py b/networks/geometry/Segment2D.py index 7bb4d4f..0d361c0 100644 --- a/networks/geometry/Segment2D.py +++ b/networks/geometry/Segment2D.py @@ -2,7 +2,7 @@ from typing import List, Union import numpy as np -from Enums import LINE_OVERLAP, LINE_THICKNESS_MODE +from utils.Enums import LINE_OVERLAP, LINE_THICKNESS_MODE from networks.geometry.Point2D import Point2D diff --git a/networks/geometry/Segment3D.py b/networks/geometry/Segment3D.py index 558e218..d13bdb9 100644 --- a/networks/geometry/Segment3D.py +++ b/networks/geometry/Segment3D.py @@ -1,5 +1,5 @@ from typing import List -from Enums import LINE_OVERLAP +from utils.Enums import LINE_OVERLAP from networks.geometry.Point3D import Point3D diff --git a/networks/roads_2/Road.py b/networks/roads_2/Road.py index b0ac4e7..7863ff7 100644 --- a/networks/roads_2/Road.py +++ b/networks/roads_2/Road.py @@ -7,7 +7,7 @@ from networks.geometry.Point2D import Point2D from networks.geometry.Segment2D import Segment2D from networks.geometry.Segment3D import Segment3D from networks.geometry.Circle import Circle -from Enums import LINE_THICKNESS_MODE +from utils.Enums import LINE_THICKNESS_MODE from gdpc import Block, Editor @@ -98,7 +98,7 @@ class Road: # Circle circle, gaps = Circle(self.polyline.centers[i]).circle_thick_by_line(int( - (self.polyline.radii[i]-self.width/2)), int((self.polyline.radii[i]+self.width/2)+1)) + (self.polyline.radii[i]-self.width/2)), int((self.polyline.radii[i]+self.width/2))) # Better to do here than drawing circle arc inside big triangle! double_point_a = Point2D.from_arrays(Point2D.to_arrays(self.polyline.acrs_intersections[i][0]) + 5 * (Point2D.to_arrays( @@ -176,7 +176,7 @@ class Road: self.segment_total_line_output[i].x, reference[self.segment_total_line_output[i].nearest(Point3D.to_2d(reference, 'y'), True)[0]].y, self.segment_total_line_output[i].y), Block("black_concrete"))) def place(self): - editor = Editor(buffering=True) + editor = Editor(buffering=False) for i in range(len(self.output_block)): editor.placeBlock(self.output_block[i][0], self.output_block[i][1]) diff --git a/utils/Enums.py b/utils/Enums.py index a40fcbe..62d7f0c 100644 --- a/utils/Enums.py +++ b/utils/Enums.py @@ -1,28 +1,50 @@ from enum import Enum + class DIRECTION(Enum): NORTH = 0 EAST = 1 SOUTH = 2 WEST = 3 - + + class COLLUMN_STYLE(Enum): NONE = 0 INNER = 1 OUTER = 2 BOTH = 3 - + + class WINDOW_BORDER_RADIUS(Enum): NONE = 0 TOP = 1 - TOP_AND_BOTTOM = 2 - + TOP_AND_BOTTOM = 2 + + class BALCONY_BORDER_RADIUS(Enum): NONE = 0 MEDIUM = 1 FULL = 2 - + + class INTER_FLOOR_BORDER(Enum): NONE = 0 SLAB = 1 - STAIRS = 2 \ No newline at end of file + STAIRS = 2 + + +class LINE_OVERLAP(Enum): + NONE = 0 + MAJOR = 1 + MINOR = 2 + + +class LINE_THICKNESS_MODE(Enum): + MIDDLE = 0 + DRAW_COUNTERCLOCKWISE = 1 + DRAW_CLOCKWISE = 2 + + +class ROTATION(Enum): + CLOCKWISE = 0 + COUNTERCLOCKWISE = 1