Skip to content

Commit

Permalink
#150 - make x & y scale the same else things look strange
Browse files Browse the repository at this point in the history
regenerate examples.
  • Loading branch information
time4tea committed Sep 30, 2023
1 parent 22a1de6 commit 99ac923
Show file tree
Hide file tree
Showing 52 changed files with 19 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/xml/examples/04-metrics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Conversions that don't make sense for a given metric will fail with a suitable m

## Controllable units

Some units can be controlled by the command line, so instead of using a particular unit, you can also use one of the following
Some units can be controlled by the command line, so instead of using a particular unit, you can also use on eof the following

| Unit | Meaning |
|---------------|------------------------------------|
Expand Down
Binary file modified docs/xml/examples/05-moving-map/05-moving-map-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/05-moving-map/05-moving-map-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/05-moving-map/05-moving-map-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/05-moving-map/05-moving-map-11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/05-moving-map/05-moving-map-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/05-moving-map/05-moving-map-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/05-moving-map/05-moving-map-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/05-moving-map/05-moving-map-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/05-moving-map/05-moving-map-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/05-moving-map/05-moving-map-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/05-moving-map/05-moving-map-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/05-moving-map/05-moving-map-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/06-cairo-circuit-map/06-cairo-circuit-map-0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/06-cairo-circuit-map/06-cairo-circuit-map-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/06-cairo-circuit-map/06-cairo-circuit-map-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/xml/examples/06-cairo-circuit-map/06-cairo-circuit-map-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 12 additions & 18 deletions docs/xml/examples/06-cairo-gauge-round-annotated/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,29 +103,23 @@ The following are available to change: `background-rgb`, `major-ann-rgb`, `minor


```xml
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" needle-rgb="255,0,255"/>
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" major-tick-rgb="255,0,0"/>
```
<kbd>![06-cairo-gauge-round-annotated-10.png](06-cairo-gauge-round-annotated-10.png)</kbd>


```xml
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" needle-rgb="255,0,255"/>
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" minor-tick-rgb="255,0,0"/>
```
<kbd>![06-cairo-gauge-round-annotated-11.png](06-cairo-gauge-round-annotated-11.png)</kbd>


```xml
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" major-tick-rgb="255,0,0"/>
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" needle-rgb="255,0,255"/>
```
<kbd>![06-cairo-gauge-round-annotated-12.png](06-cairo-gauge-round-annotated-12.png)</kbd>


```xml
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" minor-tick-rgb="255,0,0"/>
```
<kbd>![06-cairo-gauge-round-annotated-13.png](06-cairo-gauge-round-annotated-13.png)</kbd>


# Transparency

Any colour that is completely transparent will disappear... this can be used to change the appearance of the widget quite a bit.
Expand All @@ -134,36 +128,36 @@ Any colour that is completely transparent will disappear... this can be used to
```xml
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" background-rgb="255,0,0,0"/>
```
<kbd>![06-cairo-gauge-round-annotated-14.png](06-cairo-gauge-round-annotated-14.png)</kbd>
<kbd>![06-cairo-gauge-round-annotated-13.png](06-cairo-gauge-round-annotated-13.png)</kbd>


```xml
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" major-ann-rgb="255,0,0,0"/>
```
<kbd>![06-cairo-gauge-round-annotated-15.png](06-cairo-gauge-round-annotated-15.png)</kbd>
<kbd>![06-cairo-gauge-round-annotated-14.png](06-cairo-gauge-round-annotated-14.png)</kbd>


```xml
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" minor-ann-rgb="255,0,0,0"/>
```
<kbd>![06-cairo-gauge-round-annotated-16.png](06-cairo-gauge-round-annotated-16.png)</kbd>
<kbd>![06-cairo-gauge-round-annotated-15.png](06-cairo-gauge-round-annotated-15.png)</kbd>


```xml
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" needle-rgb="255,0,255,40"/>
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" major-tick-rgb="255,0,0,0"/>
```
<kbd>![06-cairo-gauge-round-annotated-17.png](06-cairo-gauge-round-annotated-17.png)</kbd>
<kbd>![06-cairo-gauge-round-annotated-16.png](06-cairo-gauge-round-annotated-16.png)</kbd>


```xml
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" major-tick-rgb="255,0,0,0"/>
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" minor-tick-rgb="255,0,0,0"/>
```
<kbd>![06-cairo-gauge-round-annotated-18.png](06-cairo-gauge-round-annotated-18.png)</kbd>
<kbd>![06-cairo-gauge-round-annotated-17.png](06-cairo-gauge-round-annotated-17.png)</kbd>


```xml
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" minor-tick-rgb="255,0,0,0"/>
<component type="cairo-gauge-round-annotated" metric="speed" units="mph" needle-rgb="255,0,255,40"/>
```
<kbd>![06-cairo-gauge-round-annotated-19.png](06-cairo-gauge-round-annotated-19.png)</kbd>
<kbd>![06-cairo-gauge-round-annotated-18.png](06-cairo-gauge-round-annotated-18.png)</kbd>


Binary file modified docs/xml/examples/06-journey-map/06-journey-map-0.png
Binary file modified docs/xml/examples/06-journey-map/06-journey-map-1.png
Binary file modified docs/xml/examples/06-journey-map/06-journey-map-2.png
Binary file modified docs/xml/examples/06-journey-map/06-journey-map-3.png
Binary file modified docs/xml/examples/06-journey-map/06-journey-map-4.png
Binary file modified docs/xml/examples/06-journey-map/06-journey-map-5.png
Binary file modified docs/xml/examples/06-journey-map/06-journey-map-6.png
Binary file modified docs/xml/examples/06-moving-journey-map/06-moving-journey-map-5.png
Binary file modified docs/xml/examples/06-moving-journey-map/06-moving-journey-map-6.png
Binary file modified docs/xml/examples/09-frame/09-frame-4.png
Binary file modified docs/xml/examples/09-frame/09-frame-5.png
Binary file modified docs/xml/examples/09-frame/09-frame-6.png
8 changes: 5 additions & 3 deletions gopro_overlay/widgets/cairo/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ def journey(self):
self._journey = Journey()
self.framemeta.process(self._journey.accept)
bbox = self._journey.bounding_box
self._size = bbox.size() * 1.1
size = bbox.size() * 1.1

self._size = max(size.x, size.y)

self._mid = Coordinate(
x=((bbox.max.lat - bbox.min.lat) / 2) + bbox.min.lat,
Expand All @@ -133,8 +135,8 @@ def journey(self):
return self._journey

def scale(self, point):
x = ((point.lat - self._mid.x) / self._size.x)
y = ((point.lon - self._mid.y) / self._size.y)
x = ((point.lat - self._mid.x) / self._size)
y = ((point.lon - self._mid.y) / self._size)
return x, y

def draw(self, context: cairo.Context):
Expand Down
2 changes: 1 addition & 1 deletion tests/widgets/test_widgets_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from gopro_overlay.widgets.cairo.cairo import CairoAdapter, CairoWidget
from gopro_overlay.widgets.cairo.circuit import CairoCircuit, Line
from gopro_overlay.widgets.map import Circuit
from tests.widgets import test_widgets_setup
from tests.approval import approve_image
from tests.widgets import test_widgets_setup
from tests.widgets.test_widgets import time_rendering

ts = test_widgets_setup.ts
Expand Down

0 comments on commit 99ac923

Please sign in to comment.