maps4fs 1.8.211__py3-none-any.whl → 1.8.213__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -149,13 +149,13 @@ class I3d(XMLComponent):
149
149
  return
150
150
 
151
151
  node_id = SPLINES_NODE_ID_STARTING_VALUE
152
- for road_id, road in enumerate(roads_polylines, start=1):
153
- # Add to scene node
154
- # <Shape name="spline01_CSV" translation="0 0 0" nodeId="11" shapeId="11"/>
152
+ for road_id, road_info in enumerate(roads_polylines, start=1):
153
+ points = road_info.get("points")
154
+ tags = road_info.get("tags")
155
155
 
156
156
  try:
157
157
  fitted_road = self.fit_object_into_bounds(
158
- linestring_points=road, angle=self.rotation
158
+ linestring_points=points, angle=self.rotation
159
159
  )
160
160
  except ValueError as e:
161
161
  self.logger.debug(
@@ -168,52 +168,58 @@ class I3d(XMLComponent):
168
168
  fitted_road = self.interpolate_points(
169
169
  fitted_road, num_points=self.map.spline_settings.spline_density
170
170
  )
171
+ fitted_roads = [(fitted_road, "original")]
171
172
 
172
- spline_name = f"spline{road_id}"
173
+ if self.map.spline_settings.add_reversed_splines:
174
+ reversed_fitted_road = fitted_road[::-1]
175
+ fitted_roads.append((reversed_fitted_road, "reversed"))
173
176
 
174
- data = {
175
- "name": spline_name,
176
- "translation": "0 0 0",
177
- "nodeId": str(node_id),
178
- "shapeId": str(node_id),
179
- }
177
+ for fitted_road, direction in fitted_roads:
178
+ spline_name = f"spline_{road_id}_{direction}_{tags}"
180
179
 
181
- scene_node.append(self.create_element("Shape", data))
180
+ data = {
181
+ "name": spline_name,
182
+ "translation": "0 0 0",
183
+ "nodeId": str(node_id),
184
+ "shapeId": str(node_id),
185
+ }
182
186
 
183
- road_ccs = [self.top_left_coordinates_to_center(point) for point in fitted_road]
187
+ scene_node.append(self.create_element("Shape", data))
184
188
 
185
- data = {
186
- "name": spline_name,
187
- "shapeId": str(node_id),
188
- "degree": "3",
189
- "form": "open",
190
- }
191
- nurbs_curve_node = self.create_element("NurbsCurve", data)
189
+ road_ccs = [self.top_left_coordinates_to_center(point) for point in fitted_road]
192
190
 
193
- for point_ccs, point in zip(road_ccs, fitted_road):
194
- cx, cy = point_ccs
195
- x, y = point
191
+ data = {
192
+ "name": spline_name,
193
+ "shapeId": str(node_id),
194
+ "degree": "3",
195
+ "form": "open",
196
+ }
197
+ nurbs_curve_node = self.create_element("NurbsCurve", data)
196
198
 
197
- x = max(0, min(int(x), dem_x_size - 1))
198
- y = max(0, min(int(y), dem_y_size - 1))
199
+ for point_ccs, point in zip(road_ccs, fitted_road):
200
+ cx, cy = point_ccs
201
+ x, y = point
199
202
 
200
- z = not_resized_dem[y, x]
201
- z *= self.get_z_scaling_factor()
203
+ x = max(0, min(int(x), dem_x_size - 1))
204
+ y = max(0, min(int(y), dem_y_size - 1))
202
205
 
203
- nurbs_curve_node.append(self.create_element("cv", {"c": f"{cx}, {z}, {cy}"}))
206
+ z = not_resized_dem[y, x]
207
+ z *= self.get_z_scaling_factor()
204
208
 
205
- shapes_node.append(nurbs_curve_node)
209
+ nurbs_curve_node.append(self.create_element("cv", {"c": f"{cx}, {z}, {cy}"}))
206
210
 
207
- user_attribute_node = self.get_user_attribute_node(
208
- node_id,
209
- attributes=[
210
- ("maxSpeedScale", "integer", "1"),
211
- ("speedLimit", "integer", "100"),
212
- ],
213
- )
211
+ shapes_node.append(nurbs_curve_node)
214
212
 
215
- user_attributes_node.append(user_attribute_node)
216
- node_id += 1
213
+ user_attribute_node = self.get_user_attribute_node(
214
+ node_id,
215
+ attributes=[
216
+ ("maxSpeedScale", "integer", "1"),
217
+ ("speedLimit", "integer", "100"),
218
+ ],
219
+ )
220
+
221
+ user_attributes_node.append(user_attribute_node)
222
+ node_id += 1
217
223
 
218
224
  tree.write(splines_i3d_path) # type: ignore
219
225
  self.logger.debug("Splines I3D file saved to: %s.", splines_i3d_path)
@@ -402,7 +402,11 @@ class Texture(ImageComponent):
402
402
  for linestring in self.objects_generator(
403
403
  layer.tags, layer.width, layer.info_layer, yield_linestrings=True
404
404
  ):
405
- info_layer_data[f"{layer.info_layer}_polylines"].append(linestring) # type: ignore
405
+ linestring_entry = {
406
+ "points": linestring,
407
+ "tags": str(layer.tags),
408
+ }
409
+ info_layer_data[f"{layer.info_layer}_polylines"].append(linestring_entry) # type: ignore
406
410
 
407
411
  def dissolve(self) -> None:
408
412
  """Dissolves textures of the layers with tags into sublayers for them to look more
@@ -212,6 +212,7 @@ class SplineSettings(SettingsModel):
212
212
  """
213
213
 
214
214
  spline_density: int = 2
215
+ add_reversed_splines: bool = False
215
216
 
216
217
 
217
218
  class SatelliteSettings(SettingsModel):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: maps4fs
3
- Version: 1.8.211
3
+ Version: 1.8.213
4
4
  Summary: Generate map templates for Farming Simulator from real places.
5
5
  Author-email: iwatkot <iwatkot@gmail.com>
6
6
  License: MIT License
@@ -645,6 +645,7 @@ You can also apply some advanced settings to the map generation process.<br>
645
645
  ### Splines Advanced settings
646
646
 
647
647
  - Splines density - number of points, which will be added (interpolate) between each pair of existing points. The higher the value, the denser the spline will be. It can smooth the splines, but high values can in opposite make the splines look unnatural.
648
+ - Add reversed splines - if enabled, the tool will add the reversed copies of the splines. It can be useful if you want to have the splines on both directions. By default, it's set to False.
648
649
 
649
650
  ### Satellite Advanced settings
650
651
 
@@ -5,15 +5,15 @@ maps4fs/generator/dem.py,sha256=Nyz64BWM---Vpy1mi8bbhHEfd2Wc2rWw9UqHraqXDJ8,1177
5
5
  maps4fs/generator/game.py,sha256=NZaxj5z7WzMiHzAvQyr-TvVjGoHgqGldM6ZsItuYyzA,11292
6
6
  maps4fs/generator/map.py,sha256=1mbnOWXVEDeFHWDBBDX9ugzRtrGBQYrJ5ruKmPUsMe8,11136
7
7
  maps4fs/generator/qgis.py,sha256=Es8hLuqN_KH8lDfnJE6He2rWYbAKJ3RGPn-o87S6CPI,6116
8
- maps4fs/generator/settings.py,sha256=ZHwLn1ObdOuhyUTzQTYvyDs7YZ0SbVLgTSpoeUtqi0c,6708
8
+ maps4fs/generator/settings.py,sha256=wscbtbJ8shuLshUE1RSiNXkPGY_SkGQ9qa0v0NHj_aQ,6747
9
9
  maps4fs/generator/component/__init__.py,sha256=s01yVVVi8R2xxNvflu2D6wTd9I_g73AMM2x7vAC7GX4,490
10
10
  maps4fs/generator/component/background.py,sha256=ppxK2RheCYrLRnBkLeZUst6Ciopo9Z_zUyjS-n8YwGE,18794
11
11
  maps4fs/generator/component/config.py,sha256=RitKgFDZPzjA1fi8GcEi1na75qqaueUvpcITHjBvCXc,3674
12
12
  maps4fs/generator/component/grle.py,sha256=kCx00SJdYEDr0tcHFvHC99928e9Eke2t_LwNxkqfvBg,18984
13
- maps4fs/generator/component/i3d.py,sha256=z2ZkflA5E8FrHcGleXSVKZRWvkqclz_Yh_qxJI86enE,19685
13
+ maps4fs/generator/component/i3d.py,sha256=YaIzTJcsCtfKA14oxlhljS-dqgMf392KOd4altvFPZM,20117
14
14
  maps4fs/generator/component/layer.py,sha256=QPcEzTv_8N9wYvHAZy8OezfATaVLG-YetSfCXf2lnFI,5892
15
15
  maps4fs/generator/component/satellite.py,sha256=oZBHjP_QY0ik1-Vk7JqMS__zIG8ffw2voeozB7-HUQc,4946
16
- maps4fs/generator/component/texture.py,sha256=UXVzNht5ETO9-wI9cZ-ojXTgkr227B2CDZ5VwXMm_Bc,30818
16
+ maps4fs/generator/component/texture.py,sha256=GWOE7w2maydB2LDku-YEC1w1oc8kcnnZ1SPTL6b82H8,30966
17
17
  maps4fs/generator/component/base/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,43
18
18
  maps4fs/generator/component/base/component.py,sha256=apGuQ7TcwqL0neJZiciNLGO22wZwYyqoDZM7aI1RHw8,21273
19
19
  maps4fs/generator/component/base/component_image.py,sha256=2QnJ9xm0D54v4whg7bc1s-kwRVjZHhOo1OR5jHr1Qp0,4786
@@ -52,8 +52,8 @@ maps4fs/toolbox/__init__.py,sha256=zZMLEkGzb4z0xql650gOtGSvcgX58DnJ2yN3vC2daRk,4
52
52
  maps4fs/toolbox/background.py,sha256=RclEqxEWLbMxuEkkegQP8jybzugwQ1_R3rdfDe0s21U,2104
53
53
  maps4fs/toolbox/custom_osm.py,sha256=X6ZlPqiOhNjkmdD_qVroIfdOl9Rb90cDwVSLDVYgx80,1892
54
54
  maps4fs/toolbox/dem.py,sha256=z9IPFNmYbjiigb3t02ZenI3Mo8odd19c5MZbjDEovTo,3525
55
- maps4fs-1.8.211.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
56
- maps4fs-1.8.211.dist-info/METADATA,sha256=sgf8q9pnxL8u908MqfLBE3AyVRGyxI8h4WwXNH_g0rs,45409
57
- maps4fs-1.8.211.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
58
- maps4fs-1.8.211.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
59
- maps4fs-1.8.211.dist-info/RECORD,,
55
+ maps4fs-1.8.213.dist-info/LICENSE.md,sha256=pTKD_oUexcn-yccFCTrMeLkZy0ifLRa-VNcDLqLZaIw,10749
56
+ maps4fs-1.8.213.dist-info/METADATA,sha256=U9UdGBlile35wbqnAIHpHeYIHnQYDfLoSqd-p7nNil8,45600
57
+ maps4fs-1.8.213.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
58
+ maps4fs-1.8.213.dist-info/top_level.txt,sha256=Ue9DSRlejRQRCaJueB0uLcKrWwsEq9zezfv5dI5mV1M,8
59
+ maps4fs-1.8.213.dist-info/RECORD,,