Skip to content

Commit

Permalink
Removed easting and northing properties of Texture
Browse files Browse the repository at this point in the history
* Removed easting.

* Removed northing.

* Removed commented code.
  • Loading branch information
iwatkot authored May 28, 2024
1 parent 384d58d commit f64fa37
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ The script will also generate the `generation_info.json` file in the `output` fo
`"width"` - the width of the map in meters,<br>
`"height_coef"` - since we need a texture of exact size, the height of the map is multiplied by this coefficient,<br>
`"width_coef"` - same as above but for the width,<br>
`"easting"` - boolean, if true, the map is in the eastern hemisphere, if false, in the western,<br>
`"northing"` - boolean, if true, the map is in the northern hemisphere, if false, in the southern,<br>
`"tile_name"` - the name of the SRTM tile which was used to generate the height map, e.g. "N52E013"<br>

You can use this information to adjust some other sources of data to the map, e.g. textures, height maps, etc.
Expand Down
19 changes: 2 additions & 17 deletions maps4fs/generator/texture.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ def _read_parameters(self) -> None:
self.width_coef = self.width / (self.distance * 2)
self.logger.debug(f"Map coefficients (HxW): {self.height_coef} x {self.width_coef}.")

self.easting = self.minimum_x < 500000
self.northing = self.minimum_y < 10000000
self.logger.debug(f"Map is in {'east' if self.easting else 'west'} of central meridian.")
self.logger.debug(f"Map is in {'north' if self.northing else 'south'} hemisphere.")

def info_sequence(self) -> None:
"""Saves generation info to JSON file "generation_info.json".
Expand All @@ -139,8 +134,6 @@ def info_sequence(self) -> None:
- width
- height_coef
- width_coef
- easting
- northing
"""
useful_attributes = [
"coordinates",
Expand All @@ -154,8 +147,6 @@ def info_sequence(self) -> None:
"width",
"height_coef",
"width_coef",
"easting",
"northing",
]
info_sequence = {attr: getattr(self, attr, None) for attr in useful_attributes}

Expand Down Expand Up @@ -261,10 +252,7 @@ def get_relative_x(self, x: float) -> int:
Returns:
int: Relative X coordinate in map image.
"""
if self.easting:
raw_x = x - self.minimum_x
else:
raw_x = self.minimum_x - x
raw_x = x - self.minimum_x
return int(raw_x * self.height_coef)

def get_relative_y(self, y: float) -> int:
Expand All @@ -276,10 +264,7 @@ def get_relative_y(self, y: float) -> int:
Returns:
int: Relative Y coordinate in map image.
"""
if self.northing:
raw_y = y - self.minimum_y
else:
raw_y = self.minimum_y - y
raw_y = y - self.minimum_y
return self.height - int(raw_y * self.width_coef)

def _to_np(self, geometry: shapely.geometry.polygon.Polygon, *args) -> np.ndarray:
Expand Down

0 comments on commit f64fa37

Please sign in to comment.