Skip to content

Commit

Permalink
QoL improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ppizarror committed Jul 18, 2024
1 parent f66f622 commit f4f3594
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MLStructFP/db/_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,6 @@ def plot_matplotlib(
linewidth: NumberType = 2.0,
alpha: NumberType = 1.0,
color: str = '',
fill: bool = False
fill: bool = True
) -> None:
super().plot_matplotlib(ax, linewidth, alpha, self.__color if color == '' else color, fill)
8 changes: 6 additions & 2 deletions MLStructFP/db/_db_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,14 @@ def set_filter(self, f_filter: Callable[['Floor'], bool]) -> None:
self.__filter = f_filter
self.__filtered_floors.clear()

def tabulate(self, limit: int = 0, show_project_id: bool = False) -> None:
def tabulate(self, limit: int = 0, show_project_id: bool = False,
f_filter: Optional[Callable[['Floor'], bool]] = None) -> None:
"""
Tabulates each floor, with their file and number of rects.
:param limit: Limits the number of items
:param show_project_id: Show project ID (if exists)
:param f_filter: Floor filter
"""
assert isinstance(limit, int) and limit >= 0, 'Limit must be an integer greater or equal than zero'
theads = ['#']
Expand All @@ -189,12 +191,14 @@ def tabulate(self, limit: int = 0, show_project_id: bool = False) -> None:
floors = self.floors
for j in range(len(floors)):
f: 'Floor' = floors[j]
if f_filter is not None and not f_filter(f):
continue
table_data = [j]
if show_project_id:
table_data.append(f.project_id)
for i in (f.id, f.category, 1 if f.elevation else 0,
len(f.rect), len(f.point), len(f.slab), len(f.room), len(f.item), # Item count
f.image_path):
os.path.basename(f.image_path)):
table_data.append(i)
table.append(table_data)
if 0 < limit - 1 <= j:
Expand Down

0 comments on commit f4f3594

Please sign in to comment.