Skip to content

Commit

Permalink
0.10.9: Fix for colour coding of map icons for Google's aabbggrr format
Browse files Browse the repository at this point in the history
  • Loading branch information
classaxe committed Oct 24, 2018
1 parent 9d7bbc2 commit ea341ee
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Controller/Web/Listener/Export/SignalsKml.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function signalsKmlController(
return $this->redirectToRoute('listeners', ['system' => $system]);
}
$parameters = [
'colors' => $typeRepository->getColorsForCodes(),
'colors' => $typeRepository->getMapIconColorForCodes(),
'description' => "Generated by ".strToUpper($system)." on ".date('Y-m-d'),
'signals' => $listenerRepository->getSignalsForListener($id),
'title' => strToUpper($system).' stations received by '.$listener->getName()
Expand Down
14 changes: 14 additions & 0 deletions src/Repository/TypeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ public function getColorsForCodes()
return $out;
}

public function getMapIconColorForCodes()
{
// Format is aabbggrr - alpha, blue, green, red NOT rrggbb as more usually seen
$out = static::getColorsForCodes();
foreach ($out as $key => &$value) {
$value =
"00"
.substr($value, 4, 2)
.substr($value, 2, 2)
.substr($value, 0, 2);
}
return $out;
}

public function getTypeForCode($code)
{
switch ($code) {
Expand Down
4 changes: 2 additions & 2 deletions templates/listener/export/signals.kml.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
<Style id="type_{{ type }}">
<IconStyle>
<scale>0.5</scale>
<color>{{ color }}00</color>
<color>{{ color }}</color>
<Icon><href>http://maps.google.com/mapfiles/kml/paddle/wht-circle.png</href></Icon>
</IconStyle>
</Style>
<Style id="type_{{ type }}_ex">
<IconStyle>
<scale>0.5</scale>
<color>{{ color }}00</color>
<color>{{ color }}</color>
<Icon><href>http://maps.google.com/mapfiles/kml/paddle/wht-blank.png</href></Icon>
</IconStyle>
</Style>
Expand Down

0 comments on commit ea341ee

Please sign in to comment.