Skip to content

Commit 698407e

Browse files
committed
refactor: adjust frame percentages, introduce LayoutPlan, and comment redundant drawing logic
1 parent 5d24118 commit 698407e

4 files changed

Lines changed: 20 additions & 13 deletions

File tree

cadastral.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ def __init__(self, **kwargs):
1313
if self.type != PlanType.CADASTRAL:
1414
raise ValueError("CadastralPlan must have type PlanType.CADASTRAL")
1515

16-
self._frame_x_percent = 0.35
17-
self._frame_y_percent = 0.8
16+
self._frame_x_percent = 0.55
17+
self._frame_y_percent = 1.0
1818
self._bounding_box = self.get_bounding_box()
1919
self._frame_coords = self._setup_frame_coords()
2020
self._coord_dict = {coord.id: coord for coord in self.coordinates}
@@ -138,9 +138,9 @@ def draw_frames(self):
138138
frame_right, frame_top = max_x + margin_x, max_y + margin_y
139139
self._drawer.draw_frame(frame_left, frame_bottom, frame_right, frame_top)
140140

141-
offset_x, offset_y = max(width, height) * (self._frame_x_percent + 0.03), max(height, width) * (self._frame_y_percent + 0.03)
142-
self._drawer.draw_frame(min_x - offset_x, min_y - offset_y,
143-
max_x + offset_x, max_y + offset_y)
141+
# offset_x, offset_y = max(width, height) * (self._frame_x_percent + 0.03), max(height, width) * (self._frame_y_percent + 0.03)
142+
# self._drawer.draw_frame(min_x - offset_x, min_y - offset_y,
143+
# max_x + offset_x, max_y + offset_y)
144144

145145
def draw_title_block(self):
146146
"""Add title block to the frame."""

dxf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
import zipfile
1212
from upload import upload_file
1313
from ezdxf import bbox, colors
14-
import subprocess
1514
import math
16-
from typing import List, Tuple, Dict, Optional, Union
15+
from typing import List, Tuple
1716

1817

1918

layout.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from models.plan import PlanProps, PlanType
2+
3+
4+
class LayoutPlan(PlanProps):
5+
def __init__(self, **kwargs):
6+
super().__init__(**kwargs)
7+
if self.type != PlanType.LAYOUT:
8+
raise ValueError("LayoutPlan must have type PlanType.LAYOUT")

topographic.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def __init__(self, **kwargs):
2222
if self.type != PlanType.TOPOGRAPHIC:
2323
raise ValueError("TopographicPlan must have type PlanType.TOPOGRAPHIC")
2424

25-
self._frame_x_percent = 0.35
26-
self._frame_y_percent = 0.8
25+
self._frame_x_percent = 0.55
26+
self._frame_y_percent = 1.0
2727
self._bounding_box = self.get_bounding_box()
2828
self._frame_coords = self._setup_frame_coords()
2929
self._boundary_dict = {coord.id: coord for coord in self.topographic_boundary.coordinates}
@@ -177,10 +177,10 @@ def draw_frames(self):
177177
frame_right, frame_top = max_x + margin_x, max_y + margin_y
178178
self._drawer.draw_frame(frame_left, frame_bottom, frame_right, frame_top)
179179

180-
offset_x, offset_y = max(width, height) * (self._frame_x_percent + 0.03), max(height, width) * (
181-
self._frame_y_percent + 0.03)
182-
self._drawer.draw_frame(min_x - offset_x, min_y - offset_y,
183-
max_x + offset_x, max_y + offset_y)
180+
# offset_x, offset_y = max(width, height) * (self._frame_x_percent + 0.03), max(height, width) * (
181+
# self._frame_y_percent + 0.03)
182+
# self._drawer.draw_frame(min_x - offset_x, min_y - offset_y,
183+
# max_x + offset_x, max_y + offset_y)
184184

185185
def draw_title_block(self):
186186
"""Add title block to the frame."""

0 commit comments

Comments
 (0)