Skip to content

Commit

Permalink
Added partition property to rect
Browse files Browse the repository at this point in the history
  • Loading branch information
ppizarror committed Nov 14, 2024
1 parent 9b9df40 commit cfc6599
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion MLStructFP/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
__description__ = 'Machine learning structural floor plan dataset'
__keywords__ = ['ml', 'ai', 'floor plan', 'architectural', 'dataset', 'cnn']
__email__ = '[email protected]'
__version__ = '0.6.9'
__version__ = '0.7.0'

# URL
__url__ = 'https://github.com/MLSTRUCT/MLSTRUCT-FP'
Expand Down
7 changes: 6 additions & 1 deletion MLStructFP/db/_c_rect.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Rect(BaseComponent):
angle: float
length: float
line: GeomLine2D
partition: bool
thickness: float
wall: int

Expand All @@ -39,7 +40,8 @@ def __init__(
y: List[float],
line_m: NumberType,
line_n: NumberType,
line_theta: NumberType
line_theta: NumberType,
partition: bool
) -> None:
"""
Constructor.
Expand All @@ -55,6 +57,7 @@ def __init__(
:param line_m: Line slope
:param line_n: Line intercept
:param line_theta: Line angle
:param partition: Rect is partition wall
"""
BaseComponent.__init__(self, rect_id, x, y, floor)
assert isinstance(wall_id, int) and wall_id > 0
Expand All @@ -63,12 +66,14 @@ def __init__(
assert isinstance(line_m, NumberInstance)
assert isinstance(line_n, NumberInstance)
assert isinstance(line_theta, NumberInstance)
assert isinstance(partition, bool)
self.angle = float(angle)
self.length = float(length)
self.line = GeomLine2D()
self.line.m = float(line_m)
self.line.n = float(line_n)
self.line.theta = float(line_theta)
self.partition = partition
self.thickness = float(thickness)
self.wall = wall_id
# noinspection PyProtectedMember
Expand Down
6 changes: 4 additions & 2 deletions MLStructFP/db/_db_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ def __init__(self, db: str, floor_only: bool = False) -> None:
y=rect_data['y'],
line_m=rect_data['line'][0], # Slope
line_n=rect_data['line'][1], # Intercept
line_theta=rect_data['line'][2] # Theta
line_theta=rect_data['line'][2], # Theta
partition=rect_data['partition'] if 'partition' in rect_data else False # Is partition
)
for point_id in data.get('point', {}):
point_data: dict = data['point'][point_id]
Expand Down Expand Up @@ -246,7 +247,8 @@ def hist(self,
if f_filter is not None and not f_filter(f):
continue
fh = f_hist(f)
assert isinstance(fh, list), f'f_hist must return a list of categories to assemble histogram, "{fh}" is not allowed'
assert isinstance(fh,
list), f'f_hist must return a list of categories to assemble histogram, "{fh}" is not allowed'
for c in fh:
assert isinstance(c, str), f'f_hist must return only strings, "{c}" is not allowed'
cat.append(c)
Expand Down

0 comments on commit cfc6599

Please sign in to comment.