~fabrixxm/pytrek

46571600d8f50f7672e890bd69e5c75f1433d29d — fabrixxm 9 months ago b0d988d
Add `starting_point` to `Entry`

`starting_point` is the first point of the first track of the gpx file
3 files changed, 12 insertions(+), 1 deletions(-)

M docs/theming.md
M pytrek/__init__.py
M pytrek/types.py
M docs/theming.md => docs/theming.md +6 -0
@@ 39,6 39,7 @@ smoothtrackfile: str   # url to smoothed and simplified gpx file
entry: Entry           # current entry
now: datetime          # current datetime (with local timezone)


# Objects

Site:


@@ 71,6 72,11 @@ Entry:
    max_latitude: float
    min_longitude: float
    max_longitude: float
	starting_point:			# first point in track
		latitude: float
		longitude: float
		elevation: float
		time: datetime

Image:
  url: str             # url to image

M pytrek/__init__.py => pytrek/__init__.py +3 -0
@@ 339,6 339,8 @@ def get_entries(cfg: Config) -> Entries:
                    continue

                end_time = gpx.get_time_bounds().end_time
                
                starting_point = gpx.tracks[0].segments[0].points[0]

                # get data on smoothed gpx track
                # see https://github.com/tkrajina/gpxpy/blob/0562b640604fc7b0ca30721b92021aafdae8d05f/gpxpy/gpx.py#L2207-L2208


@@ 388,6 390,7 @@ def get_entries(cfg: Config) -> Entries:
                    description=description,
                    stats=stats,
                    bounds=bounds,
                    starting_point=starting_point,
                    date=DateRange(start_time, end_time),
                    url=entry_folder_name,
                    images=[],

M pytrek/types.py => pytrek/types.py +3 -1
@@ 2,7 2,7 @@ from typing import Optional
from datetime import datetime
from pathlib import Path
from dataclasses import dataclass, field
from gpxpy.gpx import GPXBounds, MinimumMaximum, UphillDownhill
from gpxpy.gpx import GPXBounds, MinimumMaximum, UphillDownhill, GPXTrackPoint


def default_list(*v):


@@ 95,6 95,8 @@ class Entry:
    stats: TrackStats
    # Track bounds
    bounds: GPXBounds
    # Track start point
    starting_point: GPXTrackPoint
    # Entry relative url
    url: str
    # List of images in entry