Skip to content

Commit 66c63e4

Browse files
committed
scale fix
1 parent 2dc7955 commit 66c63e4

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

cadastral.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def draw_parcels(self):
4242
if not parcel_points:
4343
continue
4444

45-
self._drawer.add_parcel(parcel.name, parcel_points)
45+
self._drawer.add_parcel(parcel.name, parcel_points, label_scale=self.label_scale)
4646
orientation = polygon_orientation(parcel_points)
4747

4848
for leg in parcel.legs:

dxf.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def setup_beacon_style(self, type_: str = "box", size: float = 1.0):
5555

5656
# Point styles (using blocks)
5757
block = self.doc.blocks.new(name='BEACON_POINT')
58-
radius = size * self.scale * 0.2 # inner hatch radius
58+
radius = size * 0.2 # inner hatch radius
5959
half = size / 2 # half-size for square
6060

6161
# Filled (solid hatch) circle
@@ -114,24 +114,25 @@ def draw_beacon(self, x: float, y: float, z: float = 0, text_height: float = 1.0
114114
(x + offset, y + offset)
115115
)
116116

117-
def add_parcel(self, parcel_id: str, points: list):
117+
def add_parcel(self, parcel_id: str, points: list, label_scale: float = 1.0):
118118
"""Add a parcel given its ID and list of (x, y) points"""
119119
# scale points
120120
points = [(x * self.scale, y * self.scale) for x, y, *rest in points]
121+
label_scale = label_scale * self.scale
121122

122123
self.msp.add_lwpolyline(points, close=True, dxfattribs={
123124
'layer': 'LINES'
124125
})
125126

126127
# Add parcel ID label at centroid
127128
if points and parcel_id:
128-
centroid_x = (sum(p[0] for p in points) / len(points)) * self.scale
129-
centroid_y = (sum(p[1] for p in points) / len(points)) * self.scale
129+
centroid_x = sum(p[0] for p in points) / len(points)
130+
centroid_y = sum(p[1] for p in points) / len(points)
130131
self.msp.add_text(
131132
parcel_id,
132133
dxfattribs={
133134
'layer': 'LABELS',
134-
'height': 2.0 * self.scale,
135+
'height': label_scale,
135136
'style': 'SURVEY_TEXT',
136137
'color': 2 # Yellow
137138
}

0 commit comments

Comments
 (0)