Skip to content

Commit

Permalink
GDM schema.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwatkot committed Dec 18, 2024
1 parent 3c40751 commit 8f9b680
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
42 changes: 42 additions & 0 deletions data/fs25-grle-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,47 @@
"width_multiplier": 2.0,
"channels": 1,
"data_type": "uint8"
},
{
"name": "densityMap_fruits.png",
"height_multiplier": 2.0,
"width_multiplier": 2.0,
"channels": 3,
"data_type": "uint8"
},
{
"name": "densityMap_ground.png",
"height_multiplier": 2.0,
"width_multiplier": 2.0,
"channels": 3,
"data_type": "uint8"
},
{
"name": "densityMap_groundFoliage.png",
"height_multiplier": 1.0,
"width_multiplier": 1.0,
"channels": 1,
"data_type": "uint8"
},
{
"name": "densityMap_height.png",
"height_multiplier": 2.0,
"width_multiplier": 2.0,
"channels": 3,
"data_type": "uint8"
},
{
"name": "densityMap_stones.png",
"height_multiplier": 2.0,
"width_multiplier": 2.0,
"channels": 1,
"data_type": "uint8"
},
{
"name": "densityMap_weed.png",
"height_multiplier": 2.0,
"width_multiplier": 2.0,
"channels": 1,
"data_type": "uint8"
}
]
Binary file modified data/fs25-map-template.zip
Binary file not shown.
7 changes: 6 additions & 1 deletion maps4fs/generator/grle.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,15 @@ def process(self) -> None:

height = int(self.map_height * info_layer["height_multiplier"])
width = int(self.map_width * info_layer["width_multiplier"])
channels = info_layer["channels"]
data_type = info_layer["data_type"]

# Create the InfoLayer PNG file with zeros.
info_layer_data = np.zeros((height, width), dtype=data_type)
if channels == 1:
info_layer_data = np.zeros((height, width), dtype=data_type)
else:
info_layer_data = np.zeros((height, width, channels), dtype=data_type)
self.logger.debug("Shape of %s: %s.", info_layer["name"], info_layer_data.shape)
cv2.imwrite(file_path, info_layer_data) # pylint: disable=no-member
self.logger.debug("InfoLayer PNG file %s created.", file_path)
else:
Expand Down

0 comments on commit 8f9b680

Please sign in to comment.