F1 circuit layouts with year-by-year SVGs — manually traced track variations
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

23 行
751B

  1. from dataclasses import dataclass
  2. from typing import Optional, List, Dict, Any, TYPE_CHECKING
  3. from models.geo_json.geometry import GeoJSONGeometry
  4. from models.geo_json.properties import GeoJSONProperties
  5. if TYPE_CHECKING:
  6. from models.circuit import Circuit
  7. @dataclass
  8. class GeoJSONFeature:
  9. type: str
  10. properties: GeoJSONProperties
  11. bbox: Optional[List[float]]
  12. geometry: GeoJSONGeometry
  13. @classmethod
  14. def from_dict(cls, circuit: 'Circuit', data: Dict[str, Any]) -> 'GeoJSONFeature':
  15. return cls(
  16. type=data['type'],
  17. properties=GeoJSONProperties.from_dict(circuit, data['properties']),
  18. geometry=GeoJSONGeometry.from_dict(data['geometry']),
  19. bbox=data.get('bbox')
  20. )