diff options
author | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-09-26 01:57:08 (GMT) |
---|---|---|
committer | Cecil Hugh Watson <knoppmyth@gmail.com> | 2009-09-26 01:57:08 (GMT) |
commit | 7b29169fff9e7c624890c5edffe85def8a293136 (patch) | |
tree | 47753889faa3a2063b66d1c7e7681e703eb1b39a /abs/core/LinHES-timezone | |
parent | c491dea779dac29afff3578bf8245943817c2339 (diff) | |
download | linhes_pkgbuild-7b29169fff9e7c624890c5edffe85def8a293136.zip linhes_pkgbuild-7b29169fff9e7c624890c5edffe85def8a293136.tar.gz linhes_pkgbuild-7b29169fff9e7c624890c5edffe85def8a293136.tar.bz2 |
LinHES 6.01.00
Diffstat (limited to 'abs/core/LinHES-timezone')
-rw-r--r-- | abs/core/LinHES-timezone/Makefile | 62 | ||||
-rw-r--r-- | abs/core/LinHES-timezone/PKGBUILD | 29 | ||||
-rw-r--r-- | abs/core/LinHES-timezone/Tux.csv | 1268 | ||||
-rw-r--r-- | abs/core/LinHES-timezone/WorldTZ_102.zip | bin | 0 -> 1628730 bytes | |||
-rw-r--r-- | abs/core/LinHES-timezone/create_map_include.c | 186 | ||||
-rw-r--r-- | abs/core/LinHES-timezone/extract_map_data.c | 188 | ||||
-rw-r--r-- | abs/core/LinHES-timezone/linhes_timezone.c | 1120 |
7 files changed, 2853 insertions, 0 deletions
diff --git a/abs/core/LinHES-timezone/Makefile b/abs/core/LinHES-timezone/Makefile new file mode 100644 index 0000000..d543638 --- /dev/null +++ b/abs/core/LinHES-timezone/Makefile @@ -0,0 +1,62 @@ +all: linhes_timezone + +clean: + rm -Rf tables maps \ + WorldTZ.mdb WorldTZ.mfd WorldTZ.mas WorldTZ.mws WorldTZ_readme.txt map_data.txt \ + extract_map_data create_map_include linhes_timezone timezone_map.h + +#WorldTZ.mdb WorldTZ.mfd : WorldTZ_102.zip +# unzip WorldTZ_102.zip ; touch WorldTZ.mdb WorldTZ.mfd + +tables/AttrDesc : WorldTZ.mdb + mkdir -p tables + for table in $$(mdb-tables WorldTZ.mdb) ; do mdb-export WorldTZ.mdb $$table > tables/$$table ; done + sed -i 's/ //g' tables/AttrDesc # Fix TZ corruption. + echo 1254 >> tables/11001 # Add Central African Republic to the UTC+1 borders. + grep -v ^7867$$ tables/11017 > tables/11017.tmp ; mv tables/11017.tmp tables/11017 # Remove WA from UTC+9 + grep -v ^7866$$ tables/11017 > tables/11017.tmp ; mv tables/11017.tmp tables/11017 # Remove WA/SA border from UTC+9 + echo 7867 >> tables/11016 # Put WA in UTC+8 + +map_data.txt : extract_map_data WorldTZ.mfd + ./extract_map_data > map_data.txt + +extract_map_data : extract_map_data.c + cc --std=c99 -o extract_map_data -lm extract_map_data.c + +maps : map_data.txt tables/AttrDesc + mkdir maps + for zone in $$(cat tables/AttrDesc | grep 110 | grep -v 11000 | grep -v 11020 | cut -d ',' -f 1) ; \ + do \ + offset=$$(grep $$zone tables/AttrDesc | cut -d '"' -f 2 | sed 's/+//g' ) ; \ + echo $$offset >> maps/zones ; \ + boundary=boundary$$offset; \ + echo $$boundary ; \ + for section in $$(cat tables/$$zone) ; do grep "^$$section," map_data.txt >> maps/$$boundary ; done ; \ + done ; \ + for i in `cat tables/U8000 | grep -v ObjID | cut -d '"' -f 2 ` ; do \ + echo i=$$i ; \ + zone=$$(grep "^\\\"$$i\\\"," tables/U8000 | cut -d '"' -f 4) ; \ + echo zone=$$zone ; \ + tz_name=$$(grep "^\\\"$$i\\\"," tables/U7000 | cut -d '"' -f 4) ; \ + echo tz_name=$$tz_name ; \ + tz_lat=$$(grep "^$$i," tables/U5000 | cut -d ',' -f 2) ; \ + echo tz_lat=$$tz_lat ; \ + tz_lon=$$(grep "^$$i," tables/U6000 | cut -d ',' -f 2) ; \ + echo tz_lon=$$tz_lon ; \ + echo $$tz_lat $$tz_lon $$tz_name >> maps/places$$zone ; \ + done ;\ + for places in maps/places* ; do \ + sort -g -r $$places > $$places.sorted ; mv $$places.sorted $$places ; \ + done ; \ + sort -g maps/zones > maps/zones.sorted + cat Tux.csv >> maps/boundary14 + +./create_map_include : create_map_include.c maps + cc -lm --std=gnu99 -o ./create_map_include create_map_include.c + +timezone_map.h : ./create_map_include + ./create_map_include > timezone_map.h + +linhes_timezone : linhes_timezone.c timezone_map.h + cc --std=gnu99 -O3 -pthread -lXt -llirc_client -lm -o linhes_timezone linhes_timezone.c + diff --git a/abs/core/LinHES-timezone/PKGBUILD b/abs/core/LinHES-timezone/PKGBUILD new file mode 100644 index 0000000..e819965 --- /dev/null +++ b/abs/core/LinHES-timezone/PKGBUILD @@ -0,0 +1,29 @@ +# $Id: PKGBUILD 23123 2009-01-03 02:43:02Z kevin $ +# Maintainer: Greg Frost <gregfrost1@bigpond.com> +pkgname=LinHES-timezone +pkgver=1 +pkgrel=9 +pkgdesc="GUI timezone selector used by LinHES-config." +arch=i686 +depends=() +makedepends=(mdbtools) +source=(Makefile + Tux.csv + WorldTZ_102.zip + create_map_include.c + extract_map_data.c + linhes_timezone.c) + +build() { + cd ${srcdir} + make + MVDIR=$startdir/pkg/usr/MythVantage + mkdir -p $MVDIR/bin + install -m 0755 linhes_timezone $MVDIR/bin/timezone.bin +} + +md5sums=('53976e51e938c555f84b43c933339051' + '0710658b3b46cc659f56260c03b904ed' + '0d9e51af5f650dd329edce4531c42a58' + 'c01e2335603d8395004e32bae9060fde' + 'b20bd68272644f607fbfe7d50e7be42a') diff --git a/abs/core/LinHES-timezone/Tux.csv b/abs/core/LinHES-timezone/Tux.csv new file mode 100644 index 0000000..c781230 --- /dev/null +++ b/abs/core/LinHES-timezone/Tux.csv @@ -0,0 +1,1268 @@ +1,1,1,76.855404,-29.9543607
+1,1,1,76.92874033,-29.8978647
+1,1,1,77.039595,-29.7662397
+1,1,1,77.101748,-29.6618607
+1,1,1,77.20296833,-29.4918717
+1,1,1,77.21614533,-29.4420057
+1,1,1,77.22810267,-29.1836937
+1,1,1,77.24999233,-28.7108082
+1,1,1,77.136483,-28.4430318
+1,1,1,76.76400433,-28.0888536
+1,1,1,76.50763367,-27.8450787
+1,1,1,76.470453,-27.7418799
+1,1,1,76.61730033,-27.6816627
+1,1,1,76.75328567,-27.6258996
+1,1,1,76.92623267,-27.6951834
+1,1,1,77.235358,-27.9292605
+1,1,1,77.82467367,-28.3755045
+1,1,1,78.17055333,-28.453236
+1,1,1,79.450732,-28.4271351
+1,1,1,80.82728767,-28.3990692
+1,1,1,81.57573867,-28.269135
+1,1,1,82.33406533,-27.9265767
+1,1,1,82.82386233,-27.7053213
+1,1,1,83.14567633,-27.4522509
+1,1,1,83.55725167,-26.9646801
+1,1,1,83.84563667,-26.6230461
+1,1,1,83.978035,-26.5048983
+1,1,1,84.14106833,-26.4436992
+1,1,1,84.410816,-26.342442
+1,1,1,84.553379,-26.5419792
+1,1,1,84.54716033,-27.012081
+1,1,1,84.54428433,-27.2295078
+1,1,1,84.516651,-27.370002
+1,1,1,84.40524567,-27.7336173
+1,1,1,84.10637767,-28.7090871
+1,1,1,84.01263633,-29.2582017
+1,1,1,84.09731667,-29.5373907
+1,1,1,84.146749,-29.7003687
+1,1,1,84.30427033,-29.8236867
+1,1,1,84.447027,-29.8111707
+1,1,1,84.54704167,-29.8023987
+1,1,1,84.551579,-29.7957657
+1,1,1,84.576327,-29.6220807
+1,1,1,84.590433,-29.5230807
+1,1,1,84.646968,-29.1855807
+1,1,1,84.70196033,-28.872081
+1,1,1,84.75695233,-28.558581
+1,1,1,84.82448533,-28.153581
+1,1,1,84.852034,-27.972081
+1,1,1,84.92401,-27.4978746
+1,1,1,84.97764,-26.0267505
+1,1,1,84.98108467,-24.432081
+1,1,1,84.984057,-23.0559882
+1,1,1,84.98429267,-23.0514891
+1,1,1,85.064223,-22.8429828
+1,1,1,85.12628933,-22.681077
+1,1,1,85.182713,-22.5995196
+1,1,1,85.314223,-22.4816214
+1,1,1,85.515724,-22.3009764
+1,1,1,85.70807133,-22.2370386
+1,1,1,86.136654,-22.208238
+1,1,1,86.422576,-22.1890242
+1,1,1,86.46410867,-22.0055526
+1,1,1,86.55894167,-21.5866278
+1,1,1,86.83585067,-21.3499071
+1,1,1,87.38406533,-21.2191119
+1,1,1,87.560966,-21.1769061
+1,1,1,87.73832567,-21.1632777
+1,1,1,88.11739867,-21.1627617
+1,1,1,88.667827,-21.1620123
+1,1,1,88.81997067,-21.1929951
+1,1,1,89.31645833,-21.4069392
+1,1,1,89.538465,-21.5026053
+1,1,1,89.73406533,-21.5371119
+1,1,1,89.73406533,-21.4806105
+1,1,1,89.73406533,-21.4362687
+1,1,1,89.463923,-21.2078802
+1,1,1,89.245717,-21.0677427
+1,1,1,89.132385,-20.9949579
+1,1,1,88.93715033,-20.8976658
+1,1,1,88.811862,-20.8515381
+1,1,1,88.64378133,-20.7896553
+1,1,1,88.58136233,-20.7511659
+1,1,1,88.573754,-20.7047133
+1,1,1,88.568083,-20.6700873
+1,1,1,88.61667767,-20.46858
+1,1,1,88.68174267,-20.2569192
+1,1,1,88.87554667,-19.6264602
+1,1,1,88.94017267,-19.2255144
+1,1,1,88.94444667,-18.627081
+1,1,1,88.95149667,-17.6398806
+1,1,1,88.755679,-16.9871793
+1,1,1,88.12010267,-15.8793735
+1,1,1,87.53107533,-14.8527021
+1,1,1,86.906687,-14.0993799
+1,1,1,86.411835,-13.8183546
+1,1,1,86.27147167,-13.7386428
+1,1,1,86.100732,-13.6845003
+1,1,1,86.100732,-13.7197026
+1,1,1,86.100732,-13.7302218
+1,1,1,86.21937033,-13.8903102
+1,1,1,86.36437233,-14.0754549
+1,1,1,87.04365433,-14.9427879
+1,1,1,87.74921167,-16.0510407
+1,1,1,88.05093167,-16.7246151
+1,1,1,88.29283867,-17.2646601
+1,1,1,88.475271,-17.9958819
+1,1,1,88.534416,-18.6625104
+1,1,1,88.63134367,-19.7549865
+1,1,1,88.30012167,-20.6880249
+1,1,1,87.73406533,-20.9170656
+1,1,1,87.62101267,-20.9628093
+1,1,1,87.49374967,-20.9805066
+1,1,1,87.21739867,-20.9889129
+1,1,1,86.77804267,-21.0022779
+1,1,1,86.71652967,-20.9806425
+1,1,1,86.600911,-20.772081
+1,1,1,86.51775633,-20.622081
+1,1,1,86.49607367,-19.422081
+1,1,1,86.459138,-17.3779224
+1,1,1,86.35176733,-17.0298399
+1,1,1,85.16175567,-15.0963924
+1,1,1,84.79572233,-14.5016874
+1,1,1,84.72367033,-14.3450778
+1,1,1,84.567994,-13.8058203
+1,1,1,84.247566,-12.6958665
+1,1,1,83.93769367,-12.0451716
+1,1,1,83.44948267,-11.457081
+1,1,1,82.707034,-10.5627393
+1,1,1,82.610579,-10.192056
+1,1,1,82.90503633,-9.364743
+1,1,1,83.095287,-8.830212
+1,1,1,83.09175067,-8.5522572
+1,1,1,82.89236233,-8.3687127
+1,1,1,82.745919,-8.233905
+1,1,1,82.63204133,-8.1882813
+1,1,1,81.96194267,-7.9959492
+1,1,1,80.94620867,-7.7044128
+1,1,1,80.47644333,-7.4435208
+1,1,1,80.346353,-7.098705
+1,1,1,80.217653,-6.7575747
+1,1,1,80.31044067,-6.2076204
+1,1,1,80.54299267,-5.9332134
+1,1,1,80.709859,-5.7363147
+1,1,1,80.92306,-5.6518473
+1,1,1,81.249935,-5.6531328
+1,1,1,81.46517933,-5.6539794
+1,1,1,81.55348967,-5.6692146
+1,1,1,81.702253,-5.7311661
+1,1,1,81.93476967,-5.8279965
+1,1,1,82.11721033,-5.9709996
+1,1,1,82.210109,-6.1292406
+1,1,1,82.30952767,-6.2985879
+1,1,1,82.305878,-6.7035003
+1,1,1,82.20224167,-7.002081
+1,1,1,82.034794,-7.4845062
+1,1,1,82.03911733,-7.4326629
+1,1,1,82.158339,-7.5285348
+1,1,1,82.37780267,-7.7050164
+1,1,1,82.71869167,-7.7190024
+1,1,1,82.87032167,-7.5577458
+1,1,1,82.99996367,-7.419873
+1,1,1,83.039238,-7.2783555
+1,1,1,83.05783367,-6.882081
+1,1,1,83.078155,-6.4490289
+1,1,1,83.02605433,-6.1615194
+1,1,1,82.82885033,-5.6184666
+1,1,1,82.558491,-4.8739614
+1,1,1,82.28860033,-4.6589769
+1,1,1,81.47380867,-4.5390918
+1,1,1,80.86367067,-4.4493186
+1,1,1,80.531004,-4.5204525
+1,1,1,80.22387067,-4.8063654
+1,1,1,79.741864,-5.2550691
+1,1,1,79.50483867,-5.9726496
+1,1,1,79.60021367,-6.6944496
+1,1,1,79.652888,-7.0930872
+1,1,1,79.643091,-7.1093583
+1,1,1,79.392839,-7.0388766
+1,1,1,79.16874567,-6.9757623
+1,1,1,78.68066533,-6.9245205
+1,1,1,78.397751,-6.9344061
+1,1,1,78.09219233,-6.9450828
+1,1,1,78.06754467,-6.9213609
+1,1,1,78.066821,-6.6159078
+1,1,1,78.06386633,-5.3686707
+1,1,1,77.64740567,-4.6928508
+1,1,1,76.88406533,-4.6965666
+1,1,1,76.352924,-4.699152
+1,1,1,75.923553,-5.05956
+1,1,1,75.76358567,-5.637081
+1,1,1,75.70119133,-5.8623393
+1,1,1,75.71174367,-6.50646
+1,1,1,75.783982,-6.882081
+1,1,1,75.926123,-7.6211817
+1,1,1,76.238141,-7.9884852
+1,1,1,76.47843367,-7.699581
+1,1,1,76.57874333,-7.5789789
+1,1,1,76.66785,-7.4229411
+1,1,1,76.66603233,-7.3710708
+1,1,1,76.665281,-7.3496265
+1,1,1,76.591027,-7.3010112
+1,1,1,76.501024,-7.2630369
+1,1,1,76.40085433,-7.2207732
+1,1,1,76.310634,-7.1550414
+1,1,1,76.268421,-7.0935699
+1,1,1,76.08144633,-6.8212914
+1,1,1,75.98584067,-6.3342483
+1,1,1,76.06770867,-6.0710841
+1,1,1,76.17040333,-5.740974
+1,1,1,76.67391267,-5.5373964
+1,1,1,77.02102633,-5.6856411
+1,1,1,77.31483533,-5.8111203
+1,1,1,77.62551633,-6.3944817
+1,1,1,77.59250267,-6.758694
+1,1,1,77.566032,-7.0507236
+1,1,1,77.506503,-7.1408397
+1,1,1,77.211671,-7.3352052
+1,1,1,77.06815467,-7.4298174
+1,1,1,76.830732,-7.6036137
+1,1,1,76.68406533,-7.7214198
+1,1,1,76.53739867,-7.8392259
+1,1,1,76.35739867,-7.9744995
+1,1,1,76.28406533,-8.0220279
+1,1,1,75.90931267,-8.2649109
+1,1,1,75.70080967,-8.5503375
+1,1,1,75.70075833,-8.8205352
+1,1,1,75.70072467,-8.9979627
+1,1,1,75.78157233,-9.0923688
+1,1,1,76.03033933,-9.2053884
+1,1,1,76.22540433,-9.2940099
+1,1,1,76.40432967,-9.4502322
+1,1,1,76.590694,-9.6946422
+1,1,1,76.839235,-10.0205949
+1,1,1,77.13504633,-10.1231244
+1,1,1,77.81739867,-10.1198235
+1,1,1,78.64636833,-10.1158131
+1,1,1,79.38927067,-9.9577836
+1,1,1,80.78353167,-9.4888698
+1,1,1,81.53932767,-9.2346828
+1,1,1,81.75062,-9.1519146
+1,1,1,81.794837,-9.0927183
+1,1,1,81.915689,-8.930925
+1,1,1,82.06130433,-8.817081
+1,1,1,82.14739867,-8.817081
+1,1,1,82.26254533,-8.817081
+1,1,1,82.36739867,-8.9161275
+1,1,1,82.36739867,-9.024897
+1,1,1,82.36739867,-9.206961
+1,1,1,82.053905,-9.3560016
+1,1,1,80.96739867,-9.6904827
+1,1,1,80.64656533,-9.7892514
+1,1,1,80.15156567,-9.9691704
+1,1,1,79.86739867,-10.0903026
+1,1,1,79.29183033,-10.3356516
+1,1,1,79.13397767,-10.3870272
+1,1,1,78.75541833,-10.4522145
+1,1,1,78.44709567,-10.5053073
+1,1,1,77.72847233,-10.5112692
+1,1,1,77.33799367,-10.4639739
+1,1,1,77.01553533,-10.4249175
+1,1,1,76.82474667,-10.4463762
+1,1,1,76.840486,-10.5199308
+1,1,1,76.857139,-10.5977556
+1,1,1,77.59504167,-11.1194427
+1,1,1,77.76571833,-11.1740574
+1,1,1,78.00549033,-11.2507821
+1,1,1,78.47855267,-11.2641102
+1,1,1,78.78804667,-11.2028607
+1,1,1,79.25106733,-11.1112278
+1,1,1,80.71495133,-10.5459018
+1,1,1,81.438632,-10.1792517
+1,1,1,81.684003,-10.0549356
+1,1,1,81.819503,-10.0041243
+1,1,1,81.906403,-10.003842
+1,1,1,82.05345267,-10.0033644
+1,1,1,82.16739867,-10.0854555
+1,1,1,82.16739867,-10.191873
+1,1,1,82.16739867,-10.3062546
+1,1,1,81.92110233,-10.5003639
+1,1,1,81.64838133,-10.6009173
+1,1,1,81.174322,-10.7757051
+1,1,1,81.072904,-10.8235059
+1,1,1,80.600732,-11.0946978
+1,1,1,79.95183567,-11.4673914
+1,1,1,79.66962367,-11.6529351
+1,1,1,79.243827,-11.9868108
+1,1,1,78.786,-12.3458022
+1,1,1,78.65726133,-12.3943269
+1,1,1,78.150732,-12.3988248
+1,1,1,77.745759,-12.4024212
+1,1,1,77.62394067,-12.3660336
+1,1,1,77.35892667,-12.1623093
+1,1,1,77.152538,-12.0036525
+1,1,1,76.65945067,-11.4503094
+1,1,1,76.51906367,-11.2198146
+1,1,1,76.37376833,-10.9812612
+1,1,1,76.04734067,-10.647081
+1,1,1,75.95961667,-10.647081
+1,1,1,75.90277433,-10.647081
+1,1,1,75.897383,-10.6603773
+1,1,1,75.80147867,-11.037081
+1,1,1,75.73310833,-11.3056344
+1,1,1,75.487643,-11.8160808
+1,1,1,75.08803067,-12.5206992
+1,1,1,74.60510933,-13.3722126
+1,1,1,74.58443433,-13.4465865
+1,1,1,74.583096,-14.337081
+1,1,1,74.581978,-15.081264
+1,1,1,74.602826,-15.0165909
+1,1,1,74.2011,-15.522081
+1,1,1,73.70643267,-16.1445192
+1,1,1,72.94018733,-17.774859
+1,1,1,72.755877,-18.597081
+1,1,1,72.61772367,-19.2133944
+1,1,1,72.52044367,-20.2588974
+1,1,1,72.54652333,-20.847081
+1,1,1,72.56724433,-21.3144093
+1,1,1,72.54048367,-21.4544064
+1,1,1,72.41739867,-21.5225967
+1,1,1,72.29094533,-21.5926533
+1,1,1,72.13967633,-21.5202696
+1,1,1,71.83101133,-21.2420052
+1,1,1,71.34181367,-20.8009887
+1,1,1,71.18672967,-20.4366534
+1,1,1,71.19042133,-19.737081
+1,1,1,71.192773,-19.2915099
+1,1,1,71.23668333,-18.9518016
+1,1,1,71.33486267,-18.6196296
+1,1,1,71.41748833,-18.34008
+1,1,1,71.419239,-18.2595
+1,1,1,71.34239867,-18.2727102
+1,1,1,71.26374233,-18.2862324
+1,1,1,71.08480933,-18.6186462
+1,1,1,70.99736733,-18.9136938
+1,1,1,70.94423633,-19.0929687
+1,1,1,70.92262267,-19.2748251
+1,1,1,70.91020433,-19.647081
+1,1,1,70.89503933,-20.1016662
+1,1,1,70.90072433,-20.1702489
+1,1,1,70.97983433,-20.487081
+1,1,1,71.07909133,-20.8846017
+1,1,1,71.27018533,-21.2592948
+1,1,1,71.53267267,-21.571074
+1,1,1,71.93530067,-22.0493106
+1,1,1,73.97860667,-23.6830821
+1,1,1,75.340802,-24.6159495
+1,1,1,75.66534067,-24.8382021
+1,1,1,76.02974533,-25.1161581
+1,1,1,76.15059033,-25.2336294
+1,1,1,76.87062033,-25.9335582
+1,1,1,76.72979533,-26.5766649
+1,1,1,75.747889,-27.0726498
+1,1,1,75.59361933,-27.1505751
+1,1,1,75.46739867,-27.2193429
+1,1,1,75.46739867,-27.2254671
+1,1,1,75.46739867,-27.2315913
+1,1,1,75.59283967,-27.3885846
+1,1,1,75.74615667,-27.5743416
+1,1,1,76.310185,-28.2577107
+1,1,1,76.637808,-28.7580405
+1,1,1,76.751267,-29.1092967
+1,1,1,76.82604367,-29.3407977
+1,1,1,76.82189333,-29.6727987
+1,1,1,76.741545,-29.8869987
+1,1,1,76.70645533,-29.9805447
+1,1,1,76.68771767,-30.057081
+1,1,1,76.69990567,-30.057081
+1,1,1,76.71209333,-30.057081
+1,1,1,76.78206767,-30.010857
+1,1,1,76.855404,-29.9543607
+1,,,,
+1,1,1,83.39948633,-9.0116883
+1,1,1,83.39948633,-9.7644165
+1,1,1,82.40413033,-9.9231924
+1,1,1,81.92041533,-10.1937858
+1,1,1,81.47003367,-10.5693795
+1,1,1,78.88129267,-11.626791
+1,1,1,78.19452267,-11.626791
+1,1,1,77.08985933,-11.4189588
+1,1,1,75.745382,-9.9346131
+1,1,1,75.57289233,-8.9516883
+1,1,1,75.57289233,-8.3789601
+1,1,1,76.384915,-7.9201842
+1,1,1,76.83529667,-7.5445908
+1,1,1,77.28567833,-7.1689971
+1,1,1,77.80775267,-6.8165856
+1,1,1,78.69452267,-6.9665856
+1,1,1,79.38129267,-6.9665856
+1,1,1,80.453367,-7.2589971
+1,1,1,80.90374867,-7.6345908
+1,1,1,81.80413033,-7.9051842
+1,1,1,83.39948633,-8.0789601
+1,1,1,83.39948633,-9.0116883
+1,,,,
+1,1,1,65.25322551,-29.1342738
+1,1,1,66.27848633,-29.5533651
+1,1,1,68.66675,-30.084747
+1,1,1,69.50831067,-30.188865
+1,1,1,70.07025467,-30.400833
+1,1,1,73.78959533,-31.181817
+1,1,1,74.64648233,-31.181817
+1,1,1,75.916137,-30.354951
+1,1,1,76.12565833,-29.1327939
+1,1,1,75.768862,-27.8902383
+1,1,1,74.18628467,-25.5899535
+1,1,1,72.96332333,-22.5742398
+1,1,1,70.004886,-21.5368506
+1,1,1,69.70502533,-21.66834
+1,1,1,69.46355367,-22.0252677
+1,1,1,69.35664667,-22.0862301
+1,1,1,69.14370867,-22.2076554
+1,1,1,68.90653467,-22.476036
+1,1,1,68.755944,-22.8103248
+1,1,1,68.59962233,-23.1573357
+1,1,1,68.456656,-23.5826853
+1,1,1,68.28187143,-24.2029191
+1,1,1,67.93997497,-24.8220828
+1,1,1,66.54368527,-24.2653119
+1,1,1,65.58733593,-24.7126806
+1,1,1,65.23879317,-25.6663359
+1,1,1,65.83377103,-28.0102998
+1,1,1,65.25322551,-29.1342738
+1,,,,
+1,1,1,92.80707967,-25.6089555
+1,1,1,93.447312,-26.0799999
+1,1,1,94.44908733,-26.4293025
+1,1,1,94.902563,-27.2116317
+1,1,1,94.04073333,-28.1395176
+1,1,1,93.29644233,-28.4666676
+1,1,1,92.202278,-28.9346199
+1,1,1,90.70235733,-29.576106
+1,1,1,89.76382233,-30.192921
+1,1,1,89.075979,-30.598998
+1,1,1,88.389209,-31.141311
+1,1,1,86.79820267,-31.457385
+1,1,1,86.07394933,-31.380675
+1,1,1,85.61789,-31.09584
+1,1,1,85.10331433,-27.8321808
+1,1,1,85.26955667,-26.7613737
+1,1,1,85.26955667,-26.1886455
+1,1,1,84.493746,-23.9073477
+1,1,1,85.73500267,-22.5149148
+1,1,1,86.93859867,-22.3087944
+1,1,1,87.974941,-23.2965903
+1,1,1,88.73703267,-23.9744832
+1,1,1,89.36738,-23.5917795
+1,1,1,90.36322833,-23.0082537
+1,1,1,91.116409,-22.8587616
+1,1,1,91.36382433,-22.8096543
+1,1,1,91.37498,-22.5768555
+1,1,1,91.88970533,-22.8199668
+1,1,1,92.13714233,-22.9368345
+1,1,1,92.27856133,-23.303886
+1,1,1,92.30609367,-23.6162919
+1,1,1,92.35042733,-24.1193412
+1,1,1,92.40536433,-25.1873916
+1,1,1,92.80707967,-25.6089555
+1,,,,
+1,1,1,76.796339,-30.465903
+1,1,1,76.348262,-30.659355
+1,1,1,75.53406533,-31.274514
+1,1,1,75.071888,-31.623708
+1,1,1,74.86334667,-31.752909
+1,1,1,74.64112133,-31.827741
+1,1,1,74.45791933,-31.88943
+1,1,1,74.04635933,-31.925751
+1,1,1,73.850732,-31.897494
+1,1,1,73.43139467,-31.836921
+1,1,1,72.90028733,-31.675335
+1,1,1,71.660628,-31.231164
+1,1,1,70.25954733,-30.729156
+1,1,1,69.72204033,-30.585687
+1,1,1,68.21739867,-30.312117
+1,1,1,67.247373,-30.13575
+1,1,1,65.887164,-29.8360017
+1,1,1,65.621183,-29.7399897
+1,1,1,65.38106,-29.6533137
+1,1,1,65.131335,-29.4707157
+1,1,1,65.05505133,-29.3260347
+1,1,1,65.019468,-29.2585467
+1,1,1,65.000732,-29.1433707
+1,1,1,65.000732,-28.9921137
+1,1,1,65.000732,-28.7892867
+1,1,1,65.024892,-28.6968354
+1,1,1,65.19946033,-28.2316485
+1,1,1,65.51655333,-27.3866643
+1,1,1,65.531868,-27.0409599
+1,1,1,65.285382,-26.292081
+1,1,1,65.01223733,-25.4622072
+1,1,1,65.076128,-24.860463
+1,1,1,65.46956567,-24.5573715
+1,1,1,65.69200033,-24.3860154
+1,1,1,65.854067,-24.3571404
+1,1,1,66.59622667,-24.3566376
+1,1,1,67.317763,-24.3561486
+1,1,1,67.561471,-24.3227136
+1,1,1,67.840791,-24.1858911
+1,1,1,68.16241633,-24.0283458
+1,1,1,68.343495,-23.7879642
+1,1,1,68.556043,-23.2363968
+1,1,1,68.69392533,-22.8785889
+1,1,1,68.782491,-22.737081
+1,1,1,68.86855067,-22.737081
+1,1,1,68.94116133,-22.737081
+1,1,1,69.00043267,-22.8923652
+1,1,1,69.00023567,-23.082081
+1,1,1,69.000062,-23.2492884
+1,1,1,68.79049567,-23.9580537
+1,1,1,68.68674667,-24.1423191
+1,1,1,68.57587233,-24.3392385
+1,1,1,68.42646333,-24.4909803
+1,1,1,68.25375,-24.5820753
+1,1,1,67.93090367,-24.7523559
+1,1,1,67.30938033,-24.7989714
+1,1,1,66.627499,-24.7040478
+1,1,1,66.19182133,-24.6433974
+1,1,1,65.941701,-24.6560673
+1,1,1,65.77515233,-24.7472232
+1,1,1,65.52823067,-24.882369
+1,1,1,65.487836,-25.1859936
+1,1,1,65.66699233,-25.5602001
+1,1,1,66.01370067,-26.2843758
+1,1,1,66.08016167,-26.4377292
+1,1,1,66.15319633,-26.682081
+1,1,1,66.24046867,-26.9740665
+1,1,1,66.25429233,-27.2271084
+1,1,1,66.199556,-27.5306793
+1,1,1,66.14534667,-27.8313255
+1,1,1,66.04962,-28.0186785
+1,1,1,65.766527,-28.378188
+1,1,1,65.62077233,-28.5632871
+1,1,1,65.48698967,-28.7620893
+1,1,1,65.469232,-28.8199713
+1,1,1,65.41939033,-28.9824327
+1,1,1,65.49289333,-29.1072927
+1,1,1,65.69176233,-29.1979917
+1,1,1,65.86036133,-29.2748817
+1,1,1,68.26560033,-29.8337757
+1,1,1,69.96739867,-30.191496
+1,1,1,70.48989867,-30.301326
+1,1,1,71.442819,-30.511125
+1,1,1,72.084999,-30.657711
+1,1,1,72.72717933,-30.8043
+1,1,1,73.39467933,-30.939909
+1,1,1,73.56833233,-30.959067
+1,1,1,74.10169033,-31.017906
+1,1,1,74.60002667,-30.948642
+1,1,1,74.942352,-30.768087
+1,1,1,75.421196,-30.515529
+1,1,1,75.7536,-29.8888437
+1,1,1,75.79281367,-29.1647037
+1,1,1,75.81862433,-28.6880682
+1,1,1,75.70168733,-28.2612894
+1,1,1,75.392592,-27.7040352
+1,1,1,75.15765367,-27.2804757
+1,1,1,75.041572,-27.1140684
+1,1,1,73.91585533,-25.587081
+1,1,1,71.933664,-22.8983217
+1,1,1,71.07248333,-22.0019325
+1,1,1,70.34005433,-21.865086
+1,1,1,70.104947,-21.8211588
+1,1,1,69.94548167,-21.8455335
+1,1,1,69.63044533,-21.9735519
+1,1,1,69.325104,-22.097631
+1,1,1,69.221955,-22.1041212
+1,1,1,69.14895333,-22.0038483
+1,1,1,69.07888667,-21.9076065
+1,1,1,69.02299933,-21.3710013
+1,1,1,69.04253633,-20.982081
+1,1,1,69.06530533,-20.5288287
+1,1,1,69.16171833,-20.258697
+1,1,1,69.52972033,-19.617081
+1,1,1,70.256524,-18.3498906
+1,1,1,70.55372667,-17.7458586
+1,1,1,71.050097,-16.527081
+1,1,1,71.558985,-15.2775687
+1,1,1,71.76555233,-14.9332044
+1,1,1,72.57072267,-13.992081
+1,1,1,73.01040833,-13.4781546
+1,1,1,73.543055,-12.8023269
+1,1,1,73.91984733,-12.2802978
+1,1,1,74.06205267,-12.0832785
+1,1,1,74.339017,-11.719581
+1,1,1,74.53532367,-11.472081
+1,1,1,75.095885,-10.765335
+1,1,1,75.122056,-10.6978155
+1,1,1,75.06933133,-10.0943745
+1,1,1,74.98993067,-9.1856298
+1,1,1,74.858305,-6.138222
+1,1,1,74.855428,-5.142081
+1,1,1,74.85268733,-4.1930634
+1,1,1,74.85957767,-4.0511133
+1,1,1,74.92707167,-3.6661065
+1,1,1,75.064661,-2.88125388
+1,1,1,75.277857,-2.29223148
+1,1,1,75.60891567,-1.78229424
+1,1,1,75.738286,-1.58302263
+1,1,1,75.87990233,-1.42565259
+1,1,1,76.150732,-1.18020579
+1,1,1,76.69153767,-0.69008577
+1,1,1,77.15508567,-0.45480666
+1,1,1,77.94670067,-0.26864106
+1,1,1,78.591125,-0.11709054
+1,1,1,78.751945,-0.10202856
+1,1,1,79.71739867,-0.10280205
+1,1,1,80.70900433,-0.10359648
+1,1,1,81.027966,-0.13896987
+1,1,1,81.76739867,-0.33015063
+1,1,1,83.50098367,-0.77836998
+1,1,1,84.74342133,-1.85924034
+1,1,1,85.160579,-3.282081
+1,1,1,85.314403,-3.8067423
+1,1,1,85.398232,-4.4309859
+1,1,1,85.517117,-5.937081
+1,1,1,85.64418833,-7.5468843
+1,1,1,85.71925467,-8.1150543
+1,1,1,85.88871267,-8.7496575
+1,1,1,86.00464133,-9.1837986
+1,1,1,86.13991767,-9.466722
+1,1,1,86.62023733,-10.2796056
+1,1,1,87.58506,-11.9124522
+1,1,1,87.98585167,-12.4821192
+1,1,1,88.97777333,-13.6304991
+1,1,1,90.536213,-15.4347558
+1,1,1,91.29076767,-16.8701352
+1,1,1,91.736821,-18.8789994
+1,1,1,92.12084333,-20.6084994
+1,1,1,92.16712067,-21.2690301
+1,1,1,91.94616833,-21.867081
+1,1,1,91.81313733,-22.2271551
+1,1,1,91.683562,-22.4059821
+1,1,1,91.22644167,-22.8603741
+1,1,1,90.26557933,-23.8155024
+1,1,1,89.198029,-24.417081
+1,1,1,88.463939,-24.417081
+1,1,1,87.795843,-24.417081
+1,1,1,87.185413,-24.008061
+1,1,1,86.75108333,-23.2693782
+1,1,1,86.54532967,-22.8599499
+1,1,1,86.57205633,-22.5339264
+1,1,1,85.99003933,-22.6492446
+1,1,1,85.70750867,-22.7198535
+1,1,1,85.47464567,-23.028381
+1,1,1,85.402962,-23.427081
+1,1,1,85.35155233,-23.7130176
+1,1,1,85.36006567,-24.8049417
+1,1,1,85.41582633,-25.077081
+1,1,1,85.44118233,-25.200831
+1,1,1,85.51853233,-25.565331
+1,1,1,85.58771533,-25.887081
+1,1,1,85.707312,-26.4432891
+1,1,1,85.71350733,-26.5016112
+1,1,1,85.71359667,-27.072081
+1,1,1,85.713679,-27.5966244
+1,1,1,85.69992133,-27.7550832
+1,1,1,85.604202,-28.332081
+1,1,1,85.51454767,-28.8725187
+1,1,1,85.49699967,-29.0575047
+1,1,1,85.50733533,-29.3532267
+1,1,1,85.51924,-29.6938647
+1,1,1,85.52672533,-29.7271977
+1,1,1,85.639164,-29.9402847
+1,1,1,85.77529633,-30.198276
+1,1,1,86.07673267,-30.508464
+1,1,1,86.337871,-30.65928
+1,1,1,86.90982467,-30.989598
+1,1,1,87.710393,-31.01199
+1,1,1,88.38406533,-30.716508
+1,1,1,88.571673,-30.634221
+1,1,1,88.84837967,-30.456369
+1,1,1,89.31739867,-30.116616
+1,1,1,90.072681,-29.5694907
+1,1,1,90.63551867,-29.2172937
+1,1,1,91.06430733,-29.0234787
+1,1,1,91.22580833,-28.9504788
+1,1,1,91.61882233,-28.8150999
+1,1,1,91.937672,-28.7226366
+1,1,1,93.25075233,-28.3418562
+1,1,1,93.850785,-28.1128353
+1,1,1,94.18406533,-27.8652318
+1,1,1,94.57856733,-27.572145
+1,1,1,94.76987033,-27.2581653
+1,1,1,94.698758,-27.0204831
+1,1,1,94.61085767,-26.7266901
+1,1,1,94.23498767,-26.518434
+1,1,1,93.46378133,-26.3362263
+1,1,1,92.88192333,-26.1987549
+1,1,1,92.74431133,-26.1362328
+1,1,1,92.505086,-25.9006572
+1,1,1,92.29500633,-25.6937826
+1,1,1,92.133117,-25.39734
+1,1,1,92.01436767,-25.002081
+1,1,1,91.897648,-24.6135783
+1,1,1,91.88057467,-23.9867937
+1,1,1,91.98004567,-23.742081
+1,1,1,92.05058067,-23.5685544
+1,1,1,92.121032,-23.487081
+1,1,1,92.20054767,-23.487081
+1,1,1,92.29436433,-23.487081
+1,1,1,92.33985967,-23.6340603
+1,1,1,92.36769767,-24.027081
+1,1,1,92.398803,-24.46623
+1,1,1,92.47803633,-24.6961221
+1,1,1,92.69997733,-24.9911763
+1,1,1,93.01770233,-25.4135685
+1,1,1,93.354924,-25.6871316
+1,1,1,94.11739867,-26.1410259
+1,1,1,94.91470433,-26.6156547
+1,1,1,95.13260133,-26.8444662
+1,1,1,95.13260133,-27.207081
+1,1,1,95.13260133,-27.5510142
+1,1,1,94.96461067,-27.7196763
+1,1,1,94.09761067,-28.2462096
+1,1,1,93.38710167,-28.6777053
+1,1,1,93.11937333,-28.8140247
+1,1,1,92.519382,-29.0497977
+1,1,1,91.33510533,-29.5151727
+1,1,1,90.49736533,-30.028977
+1,1,1,89.59320367,-30.844485
+1,1,1,88.821454,-31.540563
+1,1,1,88.48255933,-31.725402
+1,1,1,87.793589,-31.826028
+1,1,1,87.48410267,-31.871226
+1,1,1,86.808151,-31.863612
+1,1,1,86.41027467,-31.81044
+1,1,1,85.570476,-31.698213
+1,1,1,85.11191633,-31.426899
+1,1,1,84.72885567,-30.815604
+1,1,1,84.48621667,-30.4284
+1,1,1,84.37251967,-30.339555
+1,1,1,84.078955,-30.307761
+1,1,1,83.95343267,-30.294168
+1,1,1,82.553232,-30.282828
+1,1,1,80.96739867,-30.282564
+1,1,1,78.35949067,-30.282126
+1,1,1,78.048197,-30.287202
+1,1,1,77.70857367,-30.335682
+1,1,1,76.796339,-30.465903
+1,1,1,76.855404,-29.9543607
+1,1,1,76.92874033,-29.8978647
+1,1,1,77.039595,-29.7662397
+1,1,1,77.101748,-29.6618607
+1,1,1,77.20296833,-29.4918717
+1,1,1,77.21614533,-29.4420057
+1,1,1,77.22810267,-29.1836937
+1,1,1,77.24999233,-28.7108082
+1,1,1,77.136483,-28.4430318
+1,1,1,76.76400433,-28.0888536
+1,1,1,76.50763367,-27.8450787
+1,1,1,76.470453,-27.7418799
+1,1,1,76.61730033,-27.6816627
+1,1,1,76.75328567,-27.6258996
+1,1,1,76.92623267,-27.6951834
+1,1,1,77.235358,-27.9292605
+1,1,1,77.82467367,-28.3755045
+1,1,1,78.17055333,-28.453236
+1,1,1,79.450732,-28.4271351
+1,1,1,80.82728767,-28.3990692
+1,1,1,81.57573867,-28.269135
+1,1,1,82.33406533,-27.9265767
+1,1,1,82.82386233,-27.7053213
+1,1,1,83.14567633,-27.4522509
+1,1,1,83.55725167,-26.9646801
+1,1,1,83.84563667,-26.6230461
+1,1,1,83.978035,-26.5048983
+1,1,1,84.14106833,-26.4436992
+1,1,1,84.410816,-26.342442
+1,1,1,84.553379,-26.5419792
+1,1,1,84.54716033,-27.012081
+1,1,1,84.54428433,-27.2295078
+1,1,1,84.516651,-27.370002
+1,1,1,84.40524567,-27.7336173
+1,1,1,84.10637767,-28.7090871
+1,1,1,84.01263633,-29.2582017
+1,1,1,84.09731667,-29.5373907
+1,1,1,84.146749,-29.7003687
+1,1,1,84.30427033,-29.8236867
+1,1,1,84.447027,-29.8111707
+1,1,1,84.54704167,-29.8023987
+1,1,1,84.551579,-29.7957657
+1,1,1,84.576327,-29.6220807
+1,1,1,84.590433,-29.5230807
+1,1,1,84.646968,-29.1855807
+1,1,1,84.70196033,-28.872081
+1,1,1,84.75695233,-28.558581
+1,1,1,84.82448533,-28.153581
+1,1,1,84.852034,-27.972081
+1,1,1,84.92401,-27.4978746
+1,1,1,84.97764,-26.0267505
+1,1,1,84.98108467,-24.432081
+1,1,1,84.984057,-23.0559882
+1,1,1,84.98429267,-23.0514891
+1,1,1,85.064223,-22.8429828
+1,1,1,85.12628933,-22.681077
+1,1,1,85.182713,-22.5995196
+1,1,1,85.314223,-22.4816214
+1,1,1,85.515724,-22.3009764
+1,1,1,85.70807133,-22.2370386
+1,1,1,86.136654,-22.208238
+1,1,1,86.422576,-22.1890242
+1,1,1,86.46410867,-22.0055526
+1,1,1,86.55894167,-21.5866278
+1,1,1,86.83585067,-21.3499071
+1,1,1,87.38406533,-21.2191119
+1,1,1,87.560966,-21.1769061
+1,1,1,87.73832567,-21.1632777
+1,1,1,88.11739867,-21.1627617
+1,1,1,88.667827,-21.1620123
+1,1,1,88.81997067,-21.1929951
+1,1,1,89.31645833,-21.4069392
+1,1,1,89.538465,-21.5026053
+1,1,1,89.73406533,-21.5371119
+1,1,1,89.73406533,-21.4806105
+1,1,1,89.73406533,-21.4362687
+1,1,1,89.463923,-21.2078802
+1,1,1,89.245717,-21.0677427
+1,1,1,89.132385,-20.9949579
+1,1,1,88.93715033,-20.8976658
+1,1,1,88.811862,-20.8515381
+1,1,1,88.64378133,-20.7896553
+1,1,1,88.58136233,-20.7511659
+1,1,1,88.573754,-20.7047133
+1,1,1,88.568083,-20.6700873
+1,1,1,88.61667767,-20.46858
+1,1,1,88.68174267,-20.2569192
+1,1,1,88.87554667,-19.6264602
+1,1,1,88.94017267,-19.2255144
+1,1,1,88.94444667,-18.627081
+1,1,1,88.95149667,-17.6398806
+1,1,1,88.755679,-16.9871793
+1,1,1,88.12010267,-15.8793735
+1,1,1,87.53107533,-14.8527021
+1,1,1,86.906687,-14.0993799
+1,1,1,86.411835,-13.8183546
+1,1,1,86.27147167,-13.7386428
+1,1,1,86.100732,-13.6845003
+1,1,1,86.100732,-13.7197026
+1,1,1,86.100732,-13.7302218
+1,1,1,86.21937033,-13.8903102
+1,1,1,86.36437233,-14.0754549
+1,1,1,87.04365433,-14.9427879
+1,1,1,87.74921167,-16.0510407
+1,1,1,88.05093167,-16.7246151
+1,1,1,88.29283867,-17.2646601
+1,1,1,88.475271,-17.9958819
+1,1,1,88.534416,-18.6625104
+1,1,1,88.63134367,-19.7549865
+1,1,1,88.30012167,-20.6880249
+1,1,1,87.73406533,-20.9170656
+1,1,1,87.62101267,-20.9628093
+1,1,1,87.49374967,-20.9805066
+1,1,1,87.21739867,-20.9889129
+1,1,1,86.77804267,-21.0022779
+1,1,1,86.71652967,-20.9806425
+1,1,1,86.600911,-20.772081
+1,1,1,86.51775633,-20.622081
+1,1,1,86.49607367,-19.422081
+1,1,1,86.459138,-17.3779224
+1,1,1,86.35176733,-17.0298399
+1,1,1,85.16175567,-15.0963924
+1,1,1,84.79572233,-14.5016874
+1,1,1,84.72367033,-14.3450778
+1,1,1,84.567994,-13.8058203
+1,1,1,84.247566,-12.6958665
+1,1,1,83.93769367,-12.0451716
+1,1,1,83.44948267,-11.457081
+1,1,1,82.707034,-10.5627393
+1,1,1,82.610579,-10.192056
+1,1,1,82.90503633,-9.364743
+1,1,1,83.095287,-8.830212
+1,1,1,83.09175067,-8.5522572
+1,1,1,82.89236233,-8.3687127
+1,1,1,82.745919,-8.233905
+1,1,1,82.63204133,-8.1882813
+1,1,1,81.96194267,-7.9959492
+1,1,1,80.94620867,-7.7044128
+1,1,1,80.47644333,-7.4435208
+1,1,1,80.346353,-7.098705
+1,1,1,80.217653,-6.7575747
+1,1,1,80.31044067,-6.2076204
+1,1,1,80.54299267,-5.9332134
+1,1,1,80.709859,-5.7363147
+1,1,1,80.92306,-5.6518473
+1,1,1,81.249935,-5.6531328
+1,1,1,81.46517933,-5.6539794
+1,1,1,81.55348967,-5.6692146
+1,1,1,81.702253,-5.7311661
+1,1,1,81.93476967,-5.8279965
+1,1,1,82.11721033,-5.9709996
+1,1,1,82.210109,-6.1292406
+1,1,1,82.30952767,-6.2985879
+1,1,1,82.305878,-6.7035003
+1,1,1,82.20224167,-7.002081
+1,1,1,82.034794,-7.4845062
+1,1,1,82.03911733,-7.4326629
+1,1,1,82.158339,-7.5285348
+1,1,1,82.37780267,-7.7050164
+1,1,1,82.71869167,-7.7190024
+1,1,1,82.87032167,-7.5577458
+1,1,1,82.99996367,-7.419873
+1,1,1,83.039238,-7.2783555
+1,1,1,83.05783367,-6.882081
+1,1,1,83.078155,-6.4490289
+1,1,1,83.02605433,-6.1615194
+1,1,1,82.82885033,-5.6184666
+1,1,1,82.558491,-4.8739614
+1,1,1,82.28860033,-4.6589769
+1,1,1,81.47380867,-4.5390918
+1,1,1,80.86367067,-4.4493186
+1,1,1,80.531004,-4.5204525
+1,1,1,80.22387067,-4.8063654
+1,1,1,79.741864,-5.2550691
+1,1,1,79.50483867,-5.9726496
+1,1,1,79.60021367,-6.6944496
+1,1,1,79.652888,-7.0930872
+1,1,1,79.643091,-7.1093583
+1,1,1,79.392839,-7.0388766
+1,1,1,79.16874567,-6.9757623
+1,1,1,78.68066533,-6.9245205
+1,1,1,78.397751,-6.9344061
+1,1,1,78.09219233,-6.9450828
+1,1,1,78.06754467,-6.9213609
+1,1,1,78.066821,-6.6159078
+1,1,1,78.06386633,-5.3686707
+1,1,1,77.64740567,-4.6928508
+1,1,1,76.88406533,-4.6965666
+1,1,1,76.352924,-4.699152
+1,1,1,75.923553,-5.05956
+1,1,1,75.76358567,-5.637081
+1,1,1,75.70119133,-5.8623393
+1,1,1,75.71174367,-6.50646
+1,1,1,75.783982,-6.882081
+1,1,1,75.926123,-7.6211817
+1,1,1,76.238141,-7.9884852
+1,1,1,76.47843367,-7.699581
+1,1,1,76.57874333,-7.5789789
+1,1,1,76.66785,-7.4229411
+1,1,1,76.66603233,-7.3710708
+1,1,1,76.665281,-7.3496265
+1,1,1,76.591027,-7.3010112
+1,1,1,76.501024,-7.2630369
+1,1,1,76.40085433,-7.2207732
+1,1,1,76.310634,-7.1550414
+1,1,1,76.268421,-7.0935699
+1,1,1,76.08144633,-6.8212914
+1,1,1,75.98584067,-6.3342483
+1,1,1,76.06770867,-6.0710841
+1,1,1,76.17040333,-5.740974
+1,1,1,76.67391267,-5.5373964
+1,1,1,77.02102633,-5.6856411
+1,1,1,77.31483533,-5.8111203
+1,1,1,77.62551633,-6.3944817
+1,1,1,77.59250267,-6.758694
+1,1,1,77.566032,-7.0507236
+1,1,1,77.506503,-7.1408397
+1,1,1,77.211671,-7.3352052
+1,1,1,77.06815467,-7.4298174
+1,1,1,76.830732,-7.6036137
+1,1,1,76.68406533,-7.7214198
+1,1,1,76.53739867,-7.8392259
+1,1,1,76.35739867,-7.9744995
+1,1,1,76.28406533,-8.0220279
+1,1,1,75.90931267,-8.2649109
+1,1,1,75.70080967,-8.5503375
+1,1,1,75.70075833,-8.8205352
+1,1,1,75.70072467,-8.9979627
+1,1,1,75.78157233,-9.0923688
+1,1,1,76.03033933,-9.2053884
+1,1,1,76.22540433,-9.2940099
+1,1,1,76.40432967,-9.4502322
+1,1,1,76.590694,-9.6946422
+1,1,1,76.839235,-10.0205949
+1,1,1,77.13504633,-10.1231244
+1,1,1,77.81739867,-10.1198235
+1,1,1,78.64636833,-10.1158131
+1,1,1,79.38927067,-9.9577836
+1,1,1,80.78353167,-9.4888698
+1,1,1,81.53932767,-9.2346828
+1,1,1,81.75062,-9.1519146
+1,1,1,81.794837,-9.0927183
+1,1,1,81.915689,-8.930925
+1,1,1,82.06130433,-8.817081
+1,1,1,82.14739867,-8.817081
+1,1,1,82.26254533,-8.817081
+1,1,1,82.36739867,-8.9161275
+1,1,1,82.36739867,-9.024897
+1,1,1,82.36739867,-9.206961
+1,1,1,82.053905,-9.3560016
+1,1,1,80.96739867,-9.6904827
+1,1,1,80.64656533,-9.7892514
+1,1,1,80.15156567,-9.9691704
+1,1,1,79.86739867,-10.0903026
+1,1,1,79.29183033,-10.3356516
+1,1,1,79.13397767,-10.3870272
+1,1,1,78.75541833,-10.4522145
+1,1,1,78.44709567,-10.5053073
+1,1,1,77.72847233,-10.5112692
+1,1,1,77.33799367,-10.4639739
+1,1,1,77.01553533,-10.4249175
+1,1,1,76.82474667,-10.4463762
+1,1,1,76.840486,-10.5199308
+1,1,1,76.857139,-10.5977556
+1,1,1,77.59504167,-11.1194427
+1,1,1,77.76571833,-11.1740574
+1,1,1,78.00549033,-11.2507821
+1,1,1,78.47855267,-11.2641102
+1,1,1,78.78804667,-11.2028607
+1,1,1,79.25106733,-11.1112278
+1,1,1,80.71495133,-10.5459018
+1,1,1,81.438632,-10.1792517
+1,1,1,81.684003,-10.0549356
+1,1,1,81.819503,-10.0041243
+1,1,1,81.906403,-10.003842
+1,1,1,82.05345267,-10.0033644
+1,1,1,82.16739867,-10.0854555
+1,1,1,82.16739867,-10.191873
+1,1,1,82.16739867,-10.3062546
+1,1,1,81.92110233,-10.5003639
+1,1,1,81.64838133,-10.6009173
+1,1,1,81.174322,-10.7757051
+1,1,1,81.072904,-10.8235059
+1,1,1,80.600732,-11.0946978
+1,1,1,79.95183567,-11.4673914
+1,1,1,79.66962367,-11.6529351
+1,1,1,79.243827,-11.9868108
+1,1,1,78.786,-12.3458022
+1,1,1,78.65726133,-12.3943269
+1,1,1,78.150732,-12.3988248
+1,1,1,77.745759,-12.4024212
+1,1,1,77.62394067,-12.3660336
+1,1,1,77.35892667,-12.1623093
+1,1,1,77.152538,-12.0036525
+1,1,1,76.65945067,-11.4503094
+1,1,1,76.51906367,-11.2198146
+1,1,1,76.37376833,-10.9812612
+1,1,1,76.04734067,-10.647081
+1,1,1,75.95961667,-10.647081
+1,1,1,75.90277433,-10.647081
+1,1,1,75.897383,-10.6603773
+1,1,1,75.80147867,-11.037081
+1,1,1,75.73310833,-11.3056344
+1,1,1,75.487643,-11.8160808
+1,1,1,75.08803067,-12.5206992
+1,1,1,74.60510933,-13.3722126
+1,1,1,74.58443433,-13.4465865
+1,1,1,74.583096,-14.337081
+1,1,1,74.581978,-15.081264
+1,1,1,74.602826,-15.0165909
+1,1,1,74.2011,-15.522081
+1,1,1,73.70643267,-16.1445192
+1,1,1,72.94018733,-17.774859
+1,1,1,72.755877,-18.597081
+1,1,1,72.61772367,-19.2133944
+1,1,1,72.52044367,-20.2588974
+1,1,1,72.54652333,-20.847081
+1,1,1,72.56724433,-21.3144093
+1,1,1,72.54048367,-21.4544064
+1,1,1,72.41739867,-21.5225967
+1,1,1,72.29094533,-21.5926533
+1,1,1,72.13967633,-21.5202696
+1,1,1,71.83101133,-21.2420052
+1,1,1,71.34181367,-20.8009887
+1,1,1,71.18672967,-20.4366534
+1,1,1,71.19042133,-19.737081
+1,1,1,71.192773,-19.2915099
+1,1,1,71.23668333,-18.9518016
+1,1,1,71.33486267,-18.6196296
+1,1,1,71.41748833,-18.34008
+1,1,1,71.419239,-18.2595
+1,1,1,71.34239867,-18.2727102
+1,1,1,71.26374233,-18.2862324
+1,1,1,71.08480933,-18.6186462
+1,1,1,70.99736733,-18.9136938
+1,1,1,70.94423633,-19.0929687
+1,1,1,70.92262267,-19.2748251
+1,1,1,70.91020433,-19.647081
+1,1,1,70.89503933,-20.1016662
+1,1,1,70.90072433,-20.1702489
+1,1,1,70.97983433,-20.487081
+1,1,1,71.07909133,-20.8846017
+1,1,1,71.27018533,-21.2592948
+1,1,1,71.53267267,-21.571074
+1,1,1,71.93530067,-22.0493106
+1,1,1,73.97860667,-23.6830821
+1,1,1,75.340802,-24.6159495
+1,1,1,75.66534067,-24.8382021
+1,1,1,76.02974533,-25.1161581
+1,1,1,76.15059033,-25.2336294
+1,1,1,76.87062033,-25.9335582
+1,1,1,76.72979533,-26.5766649
+1,1,1,75.747889,-27.0726498
+1,1,1,75.59361933,-27.1505751
+1,1,1,75.46739867,-27.2193429
+1,1,1,75.46739867,-27.2254671
+1,1,1,75.46739867,-27.2315913
+1,1,1,75.59283967,-27.3885846
+1,1,1,75.74615667,-27.5743416
+1,1,1,76.310185,-28.2577107
+1,1,1,76.637808,-28.7580405
+1,1,1,76.751267,-29.1092967
+1,1,1,76.82604367,-29.3407977
+1,1,1,76.82189333,-29.6727987
+1,1,1,76.741545,-29.8869987
+1,1,1,76.70645533,-29.9805447
+1,1,1,76.68771767,-30.057081
+1,1,1,76.69990567,-30.057081
+1,1,1,76.71209333,-30.057081
+1,1,1,76.78206767,-30.010857
+1,1,1,76.855404,-29.9543607
+1,,,,
+1,1,1,85.290415,-10.8334548
+1,1,1,85.36160833,-10.7927157
+1,1,1,85.50007267,-10.4848917
+1,1,1,85.50040667,-10.3666173
+1,1,1,85.500662,-10.2759204
+1,1,1,85.478526,-10.2324843
+1,1,1,85.39720667,-10.1641173
+1,1,1,85.340268,-10.1162472
+1,1,1,85.27984133,-10.077081
+1,1,1,85.262925,-10.077081
+1,1,1,85.246009,-10.077081
+1,1,1,85.11634567,-10.0277019
+1,1,1,84.974784,-9.9673497
+1,1,1,84.799041,-9.892425
+1,1,1,84.647826,-9.7972656
+1,1,1,84.49806367,-9.6673497
+1,1,1,84.37742867,-9.5627019
+1,1,1,84.26146467,-9.477081
+1,1,1,84.24036533,-9.477081
+1,1,1,84.21926533,-9.477081
+1,1,1,84.19232333,-9.5117883
+1,1,1,84.18049367,-9.5542083
+1,1,1,84.14217333,-9.6916203
+1,1,1,84.197132,-9.9066513
+1,1,1,84.335091,-10.1590857
+1,1,1,84.45714,-10.3824081
+1,1,1,84.49935867,-10.4277102
+1,1,1,84.77542867,-10.6315857
+1,1,1,85.07218567,-10.8507381
+1,1,1,85.183772,-10.8944787
+1,1,1,85.290415,-10.8334548
+1,,,,
+1,1,1,77.270649,-6.814581
+1,1,1,77.30945567,-6.7229346
+1,1,1,77.298465,-6.6524331
+1,1,1,77.198076,-6.3490548
+1,1,1,77.154151,-6.2163114
+1,1,1,77.09129033,-6.1048395
+1,1,1,77.023425,-6.0393435
+1,1,1,76.92537433,-5.9447151
+1,1,1,76.91113,-5.939976
+1,1,1,76.83406533,-5.976342
+1,1,1,76.722331,-6.0290682
+1,1,1,76.733311,-6.1492185
+1,1,1,76.86190933,-6.2810376
+1,1,1,76.95974833,-6.381327
+1,1,1,77.04309033,-6.5713101
+1,1,1,77.082804,-6.784581
+1,1,1,77.10899,-6.9252048
+1,1,1,77.216534,-6.9423804
+1,1,1,77.270649,-6.814581
+1,,,,
+1,1,1,81.96808267,-6.7313394
+1,1,1,82.039352,-6.6540525
+1,1,1,81.98759733,-6.2825028
+1,1,1,81.88639,-6.1448616
+1,1,1,81.78243433,-6.0034824
+1,1,1,81.54429333,-5.8741299
+1,1,1,81.35206767,-5.8546299
+1,1,1,81.22751733,-5.8419951
+1,1,1,81.20177867,-5.8492653
+1,1,1,81.16760467,-5.9067345
+1,1,1,81.12082467,-5.9854026
+1,1,1,81.14187033,-6.007701
+1,1,1,81.30797467,-6.0554595
+1,1,1,81.51309667,-6.1144368
+1,1,1,81.70336233,-6.3687105
+1,1,1,81.75349233,-6.6508554
+1,1,1,81.77213333,-6.7557705
+1,1,1,81.78858,-6.777081
+1,1,1,81.85091067,-6.777081
+1,1,1,81.892156,-6.777081
+1,1,1,81.94488333,-6.7564971
+1,1,1,81.96808267,-6.7313394
+1,,,,
+1,1,1,82.18867067,-2.69226408
+1,1,1,82.42852033,-2.54303718
+1,1,1,82.44815467,-2.53656918
+1,1,1,82.67797333,-2.53108368
+1,1,1,82.969619,-2.52412248
+1,1,1,83.03406567,-2.50201998
+1,1,1,83.03406567,-2.40895788
+1,1,1,83.03406567,-2.26396848
+1,1,1,82.47926467,-1.82264604
+1,1,1,82.24788167,-1.78357908
+1,1,1,82.01355667,-1.74401538
+1,1,1,81.93061167,-1.85779869
+1,1,1,81.88243467,-2.28489618
+1,1,1,81.86445467,-2.44429548
+1,1,1,81.83899,-2.51100348
+1,1,1,81.763478,-2.59652118
+1,1,1,81.65928367,-2.71452168
+1,1,1,81.64400533,-2.78374998
+1,1,1,81.70906533,-2.84307438
+1,1,1,81.776394,-2.90446758
+1,1,1,81.92036367,-2.85919668
+1,1,1,82.18867067,-2.69226408
+1,,,,
+1,1,1,79.410085,-7.4872386
+1,1,1,79.21516133,-7.4259753
+1,1,1,79.067386,-7.3370922
+1,1,1,79.104668,-7.3035384
+1,1,1,79.113817,-7.2953043
+1,1,1,79.22542433,-7.2801747
+1,1,1,79.352684,-7.2699168
+1,1,1,79.65352067,-7.2456678
+1,1,1,79.76739867,-7.2828384
+1,1,1,79.76739867,-7.4052831
+1,1,1,79.76739867,-7.4632503
+1,1,1,79.744596,-7.5059535
+1,1,1,79.70292333,-7.5260256
+1,1,1,79.66746233,-7.5431061
+1,1,1,79.633712,-7.5560271
+1,1,1,79.62792333,-7.5547386
+1,1,1,79.62213467,-7.5534504
+1,1,1,79.52410733,-7.5230754
+1,1,1,79.410085,-7.4872386
+1,,,,
+1,1,1,77.434187,-7.6172856
+1,1,1,77.32839967,-7.4393868
+1,1,1,77.521896,-7.287081
+1,1,1,77.85369433,-7.287081
+1,1,1,77.96906767,-7.287081
+1,1,1,78.07226967,-7.2999036
+1,1,1,78.08303167,-7.3155759
+1,1,1,78.10818933,-7.3522113
+1,1,1,77.994676,-7.407081
+1,1,1,77.89372733,-7.407081
+1,1,1,77.83444333,-7.407081
+1,1,1,77.799849,-7.4377419
+1,1,1,77.74986933,-7.534581
+1,1,1,77.695118,-7.6406658
+1,1,1,77.66624133,-7.663635
+1,1,1,77.57794667,-7.671333
+1,1,1,77.49767733,-7.6783314
+1,1,1,77.462659,-7.6651662
+1,1,1,77.434187,-7.6172856
+1,,,,
+1,1,1,72.47012933,-15.8961972
+1,1,1,72.790484,-15.599523
+1,1,1,72.878587,-15.4512909
+1,1,1,72.86127833,-15.2380935
+1,1,1,72.84920067,-15.0893295
+1,1,1,72.78740767,-15.0385272
+1,1,1,72.65493467,-15.068451
+1,1,1,72.555839,-15.0908352
+1,1,1,72.50178867,-15.1788813
+1,1,1,72.41807067,-15.4542921
+1,1,1,72.37857533,-15.5842218
+1,1,1,72.32091667,-15.671697
+1,1,1,72.18322733,-15.8105769
+1,1,1,71.99868567,-15.9967149
+1,1,1,71.96803533,-16.065654
+1,1,1,72.040732,-16.131081
+1,1,1,72.11698533,-16.199709
+1,1,1,72.17905267,-16.165758
+1,1,1,72.47012933,-15.8961972
diff --git a/abs/core/LinHES-timezone/WorldTZ_102.zip b/abs/core/LinHES-timezone/WorldTZ_102.zip Binary files differnew file mode 100644 index 0000000..3112bd4 --- /dev/null +++ b/abs/core/LinHES-timezone/WorldTZ_102.zip diff --git a/abs/core/LinHES-timezone/create_map_include.c b/abs/core/LinHES-timezone/create_map_include.c new file mode 100644 index 0000000..dbdbb52 --- /dev/null +++ b/abs/core/LinHES-timezone/create_map_include.c @@ -0,0 +1,186 @@ +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <math.h> + +int main () +{ + char line_in[100]; + FILE *zones; + FILE *boundary; + char boundary_name[100]; + zones = fopen ("maps/zones.sorted", "r"); + int zone_num = 0; + + printf ("typedef struct {double x;double y;double z;} vect_type;\n"); + while (!feof (zones)) + { + char coords[100]; + int points_in_vector = 0; + if (fgets (line_in, sizeof (line_in), zones)) + { + //Strip the newline off the end. + line_in[strlen(line_in) - 1] = 0; + + sprintf (boundary_name, "maps/boundary%s", line_in); + +//printf ("%s<\n", boundary_name); + + boundary = fopen (boundary_name, "r"); + + if (!boundary) + { + fprintf (stderr, "%s ", boundary_name); + perror ("fopen"); + exit (1); + } + + printf ("vect_type boundary_%d[] = {\n", zone_num); + + while (!feof (boundary)) + { + int num_scanned; + int id,code,point; + double lon,lat,x,y,z; + + memset (coords, 0, sizeof (coords)); + fgets (coords, sizeof (coords), boundary); +//printf ("scanning %s\n", coords); + + num_scanned = sscanf (coords, "%d,%d,%d,%lf,%lf", &id,&code,&point,&lon,&lat); + +//printf ("num scanned%d\n", num_scanned); + + if (num_scanned <= 0) + { + // EOF coming. + } + else if (num_scanned == 5) + { + lon *= M_PI / 180.0; + lat *= M_PI / 180.0; + + x = cos (lon) * cos (lat); + y = sin (lon) * cos (lat); + z = sin (lat); + + points_in_vector++; + printf ("{%.5lf, %.5lf, %.5lf},\n", x, y, z); + } + else + { +//printf ("points in = %d\n", points_in_vector); + + // If there was only a single point in the vector duplicate it. + // This will allow ust to use xdrawlines to draw it. + if (points_in_vector == 1) + printf ("{%.5lf, %.5lf, %.5lf},\n", x, y, z); + + //Print an end vector delimiter. + printf ("{-10.0,-10.0,-10.0},\n"); + points_in_vector = 0; + } + } + printf ("};\n"); + + printf ("#define num_boundary_points_%d XtNumber (boundary_%d)\n", zone_num, zone_num); + fclose (boundary); + zone_num++; + } + } + + fclose (zones); + + + printf ("typedef struct {\n" + " char *zonename;\n" + " vect_type v;\n" + "} place_info_type;\n"); + + zones = fopen ("maps/zones.sorted", "r"); + zone_num = 0; + + while (!feof (zones)) + { + FILE *places; + char place_name[100]; + + if (fgets (line_in, sizeof (line_in), zones)) + { + char place_info[100]; + double lat,lon; + char zonename[100]; + + //Strip the newline off the end. + line_in[strlen(line_in) - 1] = 0; + + printf ("#define zone_offset_%d \"%s%s\"\n", zone_num, (line_in[0] == '-') ? "" : "+", line_in); + + sprintf (place_name, "maps/places%s", line_in); + +//printf ("%s<\n", place_name); + + places = fopen (place_name, "r"); + + if (!places) + { + fprintf (stderr, "%s ", place_name); + perror ("fopen"); + exit (1); + } + + printf ("place_info_type places_%d[] =\n{\n", zone_num); + + memset (place_info, 0, sizeof (place_info)); + + while (fgets (place_info, sizeof (place_info), places)) + { +//printf (place_info); + + if (sscanf (place_info, "%lf %lf %s", &lat, &lon, zonename) == 3) + { + lat *= M_PI / 180.0; + lon *= M_PI / 180.0; + + printf (" {\"%s\", {%.5lf, %.5lf, %.5lf}},\n", zonename, + + cos (lon) * cos (lat), + sin (lon) * cos (lat), + sin (lat) + ); + } + } + printf ("};\n"); + + printf ("#define num_places_%d XtNumber (places_%d)\n", zone_num, zone_num); + zone_num++; + } + } + + printf ("#define NUM_ZONES %d\n", zone_num); + + printf ("struct {\n" + " char *offset;\n" + " int num_boundary_points;\n" + " vect_type *boundary_points;\n" + " int num_places;\n" + " place_info_type *place_info;\n" + "} zone_data[] =\n" + "{\n"); + + for (int zone = 0; zone < zone_num; zone++) + { + printf (" {\n" + " zone_offset_%d,\n" + " num_boundary_points_%d,\n" + " boundary_%d,\n" + " num_places_%d,\n" + " places_%d\n" + " },\n", zone, zone, zone, zone, zone); + } + + printf ("};\n"); + + exit (0); +} diff --git a/abs/core/LinHES-timezone/extract_map_data.c b/abs/core/LinHES-timezone/extract_map_data.c new file mode 100644 index 0000000..8fd8e52 --- /dev/null +++ b/abs/core/LinHES-timezone/extract_map_data.c @@ -0,0 +1,188 @@ +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <stdlib.h> +#include <stdio.h> +#include <math.h> +#include <unistd.h> + +int main () +{ + int fd; + int num_vectors; + int limits[4]; + double MAP_PIXEL_WIDTH = 1000; + + typedef struct + { + int id; + int code; + int limits[4]; + int num_points; + int offset; + } vector_info; + + vector_info *vector; + int i; + + fd = open ("WorldTZ.mfd", O_RDONLY); + + if (fd == -1) + { + perror ("open"); + abort (); + } + + read (fd, &num_vectors, 4); + read (fd, limits, sizeof (limits)); + + vector = calloc (num_vectors, sizeof (vector_info)); + + read (fd, vector, sizeof (vector_info) * num_vectors); + +#if 0 + for (i = 0; i < num_vectors; i++) + { + printf ("list%d %d %d %d %d %d %d %d %d\n", + i, + vector[i].id, + vector[i].code, + vector[i].limits[0], + vector[i].limits[2], + vector[i].limits[3], + vector[i].limits[4], + vector[i].num_points, + vector[i].offset); + } +#endif + + for (i = 0; i < num_vectors; i++) + { + typedef struct + { + int lon; + int lat; + } point_type; + + int j; + + point_type *point = NULL; + + point = realloc (point, vector[i].num_points * sizeof (point_type)); + read (fd, point, vector[i].num_points * sizeof (point_type)); + + /* Map the points onto an 800x400 pixel area */ + + for (j = 0; j < vector[i].num_points; j++) + { + if (point[j].lon > -2000000) + { + point[j].lon = lrint (point[j].lon * MAP_PIXEL_WIDTH / 3600000); + point[j].lat = lrint (point[j].lat * MAP_PIXEL_WIDTH / 3600000); + } + } + + /* Remove consecutive points that are now the same. */ + + for (j = 0; j < vector[i].num_points - 1; j++) + { + if ((point[j].lon == point[j+1].lon) && + (point[j].lat == point[j+1].lat)) + { + for (int k = j + 1; k < vector[i].num_points - 1; k++) + { + point[k].lat = point[k+1].lat; + point[k].lon = point[k+1].lon; + } + + vector[i].num_points--; + j--; + } + } + + // Lop off any small corners one style at a time + //(so that aligning borders match) to make them diagonals. + + for (int lop = 0; lop < 8; lop++) + { + int dx1c[8] = {-1, 1,-1, 1, 0, 0, 0, 0,}; + int dx2c[8] = { 0, 0, 0, 0,-1, 1,-1, 1,}; + int dy1c[8] = { 0, 0, 0, 0,-1,-1, 1, 1,}; + int dy2c[8] = {-1,-1, 1, 1, 0, 0, 0, 0,}; + + for (j = 0; j < vector[i].num_points - 2; j++) + { + int dx1,dx2,dy1,dy2; + dx1 = point[j+0].lon - point[j+1].lon; + dx2 = point[j+1].lon - point[j+2].lon; + dy1 = point[j+0].lat - point[j+1].lat; + dy2 = point[j+1].lat - point[j+2].lat; + + if ((dx1 == dx1c[lop]) && (dy1 == dy1c[lop]) && + (dx2 == dx2c[lop]) && (dy2 == dy2c[lop])) + { + for (int k = j + 1; k < vector[i].num_points - 1; k++) + { + point[k].lat = point[k+1].lat; + point[k].lon = point[k+1].lon; + } + + vector[i].num_points--; + j--; + } + } + } + + /* Now weed out points where there are a number of points on the same line. */ + + for (j = 0; j < vector[i].num_points - 2; j++) + { + int dx1,dx2,dy1,dy2; + int same_dir = 0; + dx1 = point[j+0].lon - point[j+1].lon; + dx2 = point[j+1].lon - point[j+2].lon; + dy1 = point[j+0].lat - point[j+1].lat; + dy2 = point[j+1].lat - point[j+2].lat; + + if ((dx1 == 0) && (dx2 == 0) && (dy1 * dy2 >= 0)) + same_dir = 1; + if ((dy1 == 0) && (dy2 == 0) && (dx1 * dx2 >= 0)) + same_dir = 1; + + if ((dx1 != 0) && (dx2 != 0)) + { + if ((dy1 * dx2) == (dy2 * dx1) && ((dx1 * dx2) > 0)) + same_dir = 1; + } + + if (same_dir) + { + for (int k = j + 1; k < vector[i].num_points - 1; k++) + { + point[k].lat = point[k+1].lat; + point[k].lon = point[k+1].lon; + } + + vector[i].num_points--; + j--; + } + } + + for (j = 0; j < vector[i].num_points; j++) + { + if (point[j].lon == -2147483648) + { + printf ("%d,\n", vector[i].id); + } + else + { + printf ("%d,%d,%d,%.2lf,%.2lf\n", + vector[i].id, vector[i].code, j, + point[j].lon * 360.0 / MAP_PIXEL_WIDTH, + point[j].lat * 360.0 / MAP_PIXEL_WIDTH); + } + } + + printf ("%d,\n", vector[i].id); + } +} diff --git a/abs/core/LinHES-timezone/linhes_timezone.c b/abs/core/LinHES-timezone/linhes_timezone.c new file mode 100644 index 0000000..d7a56d2 --- /dev/null +++ b/abs/core/LinHES-timezone/linhes_timezone.c @@ -0,0 +1,1120 @@ +#include <stdio.h> +#include <math.h> +#include <stdlib.h> +#include <stdio.h> +#define _GNU_SOURCE +#include <string.h> +#include <strings.h> +#include <X11/Xlib.h> +#include <X11/Intrinsic.h> +#include <X11/IntrinsicI.h> +#include <lirc/lirc_client.h> +#include <pthread.h> + +#include "timezone_map.h" + +Display *display; +Window window; +GC gc; +int screen; +int selected_zone; +int selected_place; +Pixmap pixmap; +XColor ocean; +XColor land[8]; +XColor border; +XColor selected_border; +XColor selected_land; +XColor name_colour; +XColor location_dot; +XColor lat_lon; +XColor tux_yellow; +Dimension screen_width = 1920; +Dimension screen_height = 1080; +Dimension width = 1920; +Dimension height = 1080; +Position x = 0; +Position y = 0; +XFontStruct *font; +XPoint xpoints[1000]; +int radius; +double aspect_correction = 1; + +double target_lat; +double target_lon; + +double displayed_lat; +double displayed_lon; + +double lon_rotate[2] = {1, 0}; +double lat_rotate[2] = {1, 0}; + +double acceleration = 0.01; +char input_keys[200]; + +int guessing_timezone = FALSE; +time_t guess_timeout = 0; +int guess_failed = FALSE; +time_t guess_failed_timeout = 0; +int show_information = FALSE; +int info_displayed = FALSE; + +void select_place (int place) +{ + target_lon = atan2 (zone_data[selected_zone].place_info[place].v.y, + zone_data[selected_zone].place_info[place].v.x); + target_lat = acos (zone_data[selected_zone].place_info[place].v.z /2); + + selected_place = place; +} + +void default_zone (char *arg_zone) +{ + int found_zone = FALSE; + + for (int zone = 0; zone < NUM_ZONES; zone++) + { + for (int place = 0; place < zone_data[zone].num_places; place++) + { + if (strstr (zone_data[zone].place_info[place].zonename, + arg_zone[0] ? arg_zone : "Los_Angeles")) + { + selected_zone = zone; + select_place (place); + found_zone = TRUE; + } + } + } + + if (!found_zone) + { + default_zone (""); + } +} + +int translate_point (vect_type *v, XPoint *p) +{ + vect_type v2; + vect_type v3; + + v2.x = v->x * lon_rotate[0] + v->y * lon_rotate[1]; + v2.y = v->x * -1.0 * lon_rotate[1] + v->y * lon_rotate[0]; + v2.z = v->z; + + v3.x = v2.x * lat_rotate[0] + v2.z * lat_rotate[1]; + v3.y = v2.y * radius; + v3.z = v2.x * -1.0 * lat_rotate[1] + v2.z * lat_rotate[0]; + + + // If the point is behind the face of the globe, project it to the edge. + if (v3.x < 0) + { + p->x = width /2 + radius * sin (atan2 (v3.y,v3.z)) * aspect_correction; + p->y = height/2 - radius * cos (atan2 (v3.y,v3.z)); + } + else + { + p->x = width /2 + lrint (v3.y) * aspect_correction; + p->y = height/2 - lrint (v3.z); + } + + // Return a value indicating if it is on the front of the world. + return (v3.x >= 0); +} + +void draw_zone ( + Drawable d, + int zone, + int fill, + int selected) +{ + int boundary = 0; + int num_points = 0; + int all_on_back = 1; + + if (selected && fill) + XSetForeground (display, gc, selected_land.pixel); + + while (boundary < zone_data[zone].num_boundary_points) + { + if (zone_data[zone].boundary_points[boundary].x < -9) + { + + if ((num_points > 1) && !all_on_back) + { + if (fill) + { + if (!selected) + { + if (zone == NUM_ZONES - 1) + { + if (boundary < 380) + XSetForeground (display, gc, WhitePixel (display, screen)); + else if (boundary < 470) + XSetForeground (display, gc, tux_yellow.pixel); + else if (boundary < 1120) + XSetForeground (display, gc, BlackPixel (display, screen)); + else + XSetForeground (display, gc, WhitePixel (display, screen)); + } + else + { + XSetForeground (display, gc, + land[boundary % XtNumber (land)].pixel); + } + } + + XFillPolygon ( + display, d, gc, + xpoints, + num_points, Complex, CoordModeOrigin); + } + else + XDrawLines ( + display, d, gc, + xpoints, + num_points, CoordModeOrigin); + } + + boundary++; + num_points = 0; + all_on_back = 1; + } + else + { + if (translate_point (&zone_data[zone].boundary_points[boundary], + &xpoints[num_points])) + all_on_back = 0; + + num_points++; + boundary++; + } + } +} + +void draw_string (int x, int y, const char*s, unsigned long colour) +{ + XSetForeground (display, gc, BlackPixel (display, screen)); + for (int x_pos = x - 3; x_pos <= x + 3; x_pos++) + for (int y_pos = y - 3; y_pos <= y + 3; y_pos++) + XDrawString (display, pixmap, gc, x_pos, y_pos, s, strlen (s)); + + XSetForeground (display, gc, colour); + XDrawString (display, pixmap, gc, x, y, s, strlen (s)); +} + +void draw_point (XPoint p, char *s) +{ + int text_width; + + int dot_size = ceil (sqrt (height) / 6.0); + + if (s) + dot_size += 2; + + XSetForeground (display, gc, + s ? WhitePixel (display, screen) : location_dot.pixel); + XFillRectangle (display, pixmap, gc, + p.x - dot_size / 2, p.y - dot_size / 2, dot_size, dot_size); + + XSetForeground (display, gc, BlackPixel (display, screen)); + XSetLineAttributes (display, gc, 2, LineSolid, CapRound, JoinRound); + XDrawRectangle (display, pixmap, gc, + p.x - dot_size / 2, p.y - dot_size / 2, dot_size, dot_size); + + if (s) + { + int text_x; + int text_y; + + text_width = XTextWidth (font, s, strlen (s)); + + if (p.x + text_width + 30 > width) + { + text_x = p.x - text_width - 6; + text_y = p.y + 10; + } + else + { + text_x = p.x + 6; + text_y = p.y + 10; + } + + draw_string (text_x, text_y, s, name_colour.pixel); + } +} + +void redraw_map () +{ + XPoint selected_point; + char selected_name[100]; + + lon_rotate[0] = cos (displayed_lon); + lon_rotate[1] = sin (displayed_lon); + + lat_rotate[1] = cos (displayed_lat) * radius; + lat_rotate[0] = sin (displayed_lat) * radius; + + /* Draw the map into the pixmap. */ + + XSetForeground (display, gc, BlackPixel (display, screen)); + XFillRectangle (display, pixmap, gc, 0, 0, width, height); + + XSetForeground (display, gc, ocean.pixel); + XFillArc (display, pixmap, gc, + width / 2 - radius * aspect_correction, height / 2 - radius, + radius * 2 * aspect_correction, radius * 2, 0, 360 * 64); + + XSetForeground (display, gc, lat_lon.pixel); + XSetLineAttributes (display, gc, 2, LineSolid, CapRound, JoinRound); + + for (int lon = 0; lon < 24; lon++) + for (int lat = 0; lat < 12 * 3; lat++) + { + XPoint line[2]; + vect_type v; + v.x = cos (lon * 15 * M_PI / 180) * cos ((90 - lat * 5) * M_PI / 180); + v.y = sin (lon * 15 * M_PI / 180) * cos ((90 - lat * 5) * M_PI / 180); + v.z = sin ((90 - lat * 5) / 180.0 * M_PI); + line[0] = line[1]; + if (translate_point (&v, &line[1]) && (lat > 0)) + XDrawLines (display, pixmap, gc, line, 2, CoordModeOrigin); + } + + for (int lat = 0; lat < 12; lat++) + for (int lon = 0; lon <= 24 * 3; lon++) + { + XPoint line[2]; + vect_type v; + v.x = cos (lon * 5 * M_PI / 180) * cos ((90 - lat * 15) * M_PI / 180); + v.y = sin (lon * 5 * M_PI / 180) * cos ((90 - lat * 15) * M_PI / 180); + v.z = sin ((90 - lat * 15) / 180.0 * M_PI); + line[0] = line[1]; + if (translate_point (&v, &line[1]) && (lon > 0)) + XDrawLines (display, pixmap, gc, line, 2, CoordModeOrigin); + } + + for (int zone = 0; zone < NUM_ZONES; zone++) + draw_zone (pixmap, zone, 1, 0); + + XSetLineAttributes (display, gc, 2, LineSolid, CapRound, JoinRound); + XSetForeground (display, gc, border.pixel); + for (int zone = 0; zone < NUM_ZONES - 1; zone++) + draw_zone (pixmap, zone, 0, 0); + + if (show_information) + { + info_displayed = TRUE; + char *s[4] = {"Left/Right: Change Offset", + "Up/Down: Change Location", + "Enter: Select Location", + "Esc: Abort"}; + int num = XtNumber(s); + for (int i = 0; i < num; i++) + { + int text_width = XTextWidth (font, s[i], strlen (s[i])); + draw_string (width/2 - text_width/2, + height/2 + (-2 + i) * (font->ascent + font->descent), + s[i], name_colour.pixel); + } + } + else if (guessing_timezone || (info_displayed = FALSE)) + { + char *s = "Guessing Timezone"; + int text_width = XTextWidth (font, s, strlen (s)); + draw_string (width/2 - text_width/2, height/2, s, name_colour.pixel); + } + else if (guess_failed) + { + char *s = "Unable to Guess Timezone"; + char *s2 = "Please Select Timezone Manually"; + int text_width = XTextWidth (font, s, strlen (s)); + draw_string (width/2 - text_width/2, height/2, s, name_colour.pixel); + text_width = XTextWidth (font, s2, strlen (s2)); + draw_string (width/2 - text_width/2, + height/2 + font->ascent + font->descent, + s2, name_colour.pixel); + } + else + { + draw_zone (pixmap, selected_zone, 1, 1); + XSetForeground (display, gc, selected_border.pixel); + draw_zone (pixmap, selected_zone, 0, 1); + + for (int place = 0; place < zone_data[selected_zone].num_places; place++) + { + XPoint point; + + translate_point (&zone_data[selected_zone].place_info[place].v, &point); + + draw_point (point, NULL); + + if ((place == selected_place) && (!guessing_timezone)) + { + char *underscore; + selected_point = point; + strcpy (selected_name, strchr (zone_data[selected_zone].place_info[place].zonename, '/') + 1); + while (underscore = strchr (selected_name, '_')) + underscore[0] = ' '; + } + } + + draw_point (selected_point, selected_name); + + { + char zone_offset[100]; + sprintf (zone_offset, "UTC%s", zone_data[selected_zone].offset); + draw_string ( + ((width * 0.95 - XTextWidth (font, "UTC+88", strlen ("UTC+88"))) + + ((width / 2) + radius / sqrt (2))) / 2, + ((lrint (height * 0.05) + font->ascent) + + (height / 2 - radius / sqrt (2))) / 2, + zone_offset, name_colour.pixel); + } + } + + if (!guessing_timezone && !guess_failed) + { + const char *title = "Select Your Time Zone"; + const char *help = "Help = i"; + + draw_string (width / 2 - XTextWidth (font, title, strlen (title)) / 2, + ((lrint (height * 0.05) + font->ascent) + + (height / 2 - radius / sqrt (2))) / 2, + title, WhitePixel (display,screen)); + + draw_string (width * 0.05, height * 0.95 - font->descent - font->ascent, + help, name_colour.pixel); + } + + XCopyArea (display, pixmap, window, gc, 0, 0, width, height, 0, 0); +} + +int nearest_z (double near_z) +{ + double min_delta = + fabs (near_z - zone_data[selected_zone].place_info[0].v.z); + int min_delta_place = 0; + + for (int place = 1; place < zone_data[selected_zone].num_places; place++) + { + double delta = + fabs (near_z - zone_data[selected_zone].place_info[place].v.z); + + if (delta < min_delta) + { + min_delta_place = place; + min_delta = delta; + } + } + + return min_delta_place; +} + +void handle_key (char key) +{ + double selected_z; + + selected_z = zone_data[selected_zone].place_info[selected_place].v.z; + + if (show_information) + { + show_information = FALSE; + return; + } + + switch (key) + { + case 'U': + select_place ((selected_place + + zone_data[selected_zone].num_places - 1) % + zone_data[selected_zone].num_places); + break; + + case 'D': + select_place ((selected_place + 1) % + zone_data[selected_zone].num_places); + break; + + case 'L': + selected_zone = (selected_zone + NUM_ZONES - 1) % NUM_ZONES; + select_place (nearest_z (selected_z)); + break; + + case 'R': + selected_zone = (selected_zone + 1) % NUM_ZONES; + select_place (nearest_z (selected_z)); + break; + + case 'I': + show_information = !show_information; + break; + + case 'X': + printf ("%s\n", zone_data[selected_zone].place_info[selected_place].zonename); + exit (0); + + case 'E': + exit(1); + } +} + +void handle_event (XEvent *xevent) +{ + switch (xevent->type) + { + case Expose: + redraw_map (); + break; + + case KeyPress: + switch (XLookupKeysym (&xevent->xkey, 0)) + { + case XK_Up: + handle_key ('U'); + break; + + case XK_Down: + handle_key ('D'); + break; + + case XK_Left: + handle_key ('L'); + break; + + case XK_Right: + handle_key ('R'); + break; + + case XK_Return: + handle_key ('X'); + break; + + case XK_Escape: + handle_key ('E'); + break; + + case XK_I: + case XK_i: + handle_key ('I'); + break; + } + + break; + } +} + +Bool event_predicate (Display *display, XEvent *xevent, XPointer unused) +{ + return (xevent->type == KeyPress) || (xevent->type == Expose); +} + +void next_view () +{ + static double step_size = 0.01; + double error_total; + double lat_error = target_lat - displayed_lat; + double lon_error = target_lon - displayed_lon; + + if (guessing_timezone) + { + displayed_lon += 1 / 180.0 * M_PI; + } + else + { + lat_error = atan2 (sin (lat_error), cos( lat_error)); + lon_error = atan2 (sin (lon_error), cos (lon_error)); + + error_total = sqrt (lat_error * lat_error + lon_error * lon_error); + + if (error_total < acceleration) + { + displayed_lat = target_lat; + displayed_lon = target_lon; + } + else + { + if (error_total > (step_size + acceleration) * + (step_size + acceleration) / acceleration / 2) + step_size += acceleration; + else + step_size -= acceleration; + + if (step_size < acceleration) + step_size = acceleration; + + displayed_lat += step_size * (lat_error / error_total); + displayed_lon += step_size * (lon_error / error_total); + } + } +} + +void *lirc_thread (void *unused) +{ + int lirc_fd; + struct lirc_config *lirc_config; + char *lirc_code; + + if ((lirc_fd = lirc_init ("mythtv",0)) == -1) + fprintf (stderr,"Error initialising lirc\n"); + else + { + int readc_status; + + if (readc_status = lirc_readconfig (NULL, &lirc_config, NULL)) + { + fprintf (stderr,"Error loading lirc config file %d %p\n", readc_status, lirc_config); + } + } + + while ((lirc_nextcode (&lirc_code) == 0) && (lirc_code != NULL)) + { + char *action; + + while ((lirc_code2char (lirc_config, lirc_code, &action) == 0) && + (action != NULL)) + { + if (strcasecmp (action, "down") == 0) + strcat (input_keys, "D"); + + if (strcasecmp (action, "up") == 0) + strcat (input_keys, "U"); + + if (strcasecmp (action, "left") == 0) + strcat (input_keys, "L"); + + if (strcasecmp (action, "right") == 0) + strcat (input_keys, "R"); + + if (strcasecmp (action, "return") == 0) + strcat (input_keys, "X"); + + if (strcasecmp (action, "Esc") == 0) + strcat (input_keys, "E"); + } + + free (lirc_code); + lirc_code = NULL; + } +} + +void get_value (FILE *input, char*output, int out_len) +{ + const char *value_pattern = "value=\""; + char *value; + + output[0] = 0; + fgets (output, out_len, input); + + if (value = strcasestr (output, value_pattern)) + { + memmove (output, value + strlen (value_pattern), + strlen (value + strlen (value_pattern)) + 1); + } + + if (value = strchr (output, '"')) + value[0] = 0; +} + +void *timezone_guess (void *unused) +{ + const double invalid = 99999; + FILE *guess_data; + char line_in[1000]; + double guess_latitude = invalid; + double guess_longitude = invalid; + char guess_zone[1000] = {0}; + char *timezone_info_command; + + if (getenv ("FAKE_GEOBYTES")) + { + timezone_info_command = + "sleep 2 ; " + "echo Latitude ; " + "echo \" <td value=\\\"-34.993\\\"\" ;" + "echo Longitude ; " + "echo \" <td value=\\\"138.6\\\"\" ;" + "echo TimeZone ; " + "echo \" <td value=\\\"+09:30\\\"\""; + } + else + { + timezone_info_command = + "wget http://www.geobytes.com/IpLocator.htm -O - 2> /dev/null |" + "grep \"^ <td \" |" + "grep -i -E -A1 \"Latitude|Longitude|TimeZone\" | grep -v \"^--$\""; + } + + guess_data = popen (timezone_info_command, "r"); + + if (!guess_data) + { + fprintf (stderr, "error parsing web page for timezone guess\n"); + if (guessing_timezone) + { + guessing_timezone = FALSE; + guess_failed = TRUE; + guess_failed_timeout = time (NULL) + 3; + } + return NULL; + } + + while (fgets (line_in, sizeof (line_in), guess_data)) + { + // Look for the entries in the guess data and then the next line + // will hold the value. + + if (strcasestr (line_in, "latitude")) + { + get_value (guess_data, line_in, sizeof (line_in)); + sscanf (line_in, "%lf", &guess_latitude); + } + else if (strcasestr (line_in, "longitude")) + { + get_value (guess_data, line_in, sizeof (line_in)); + sscanf (line_in, "%lf", &guess_longitude); + } + else if (strcasestr (line_in, "timezone")) + { + get_value (guess_data, line_in, sizeof (line_in)); + + // The geobytes timezone data is of the form "+09:30" whereas the + // map timezone data is of the form "+6" or "+9.5". Convert + // to the map timezone data format so we can find the timezone. + + if (strcmp (&line_in[3], ":30") == 0) + sprintf (&line_in[3], ".5"); + else + line_in[3] = 0; + + if (line_in[1] == '0') + memmove (&line_in[1], &line_in[2], strlen (&line_in[2]) + 1); + + strncpy (guess_zone, line_in, sizeof (guess_zone)); + } + } + + pclose (guess_data); + + if ((guess_latitude != invalid) && + (guess_longitude != invalid) && + guess_zone[0] != 0) + { + int zone; + + fprintf (stderr, "guessed lat lon %f %f %s\n", + guess_latitude, guess_longitude, guess_zone); + + // Look for the guessed zone in the zone_data structure. + for (zone = 0; zone < NUM_ZONES; zone++) + { + if (strcmp (guess_zone, zone_data[zone].offset) == 0) + break; + } + + if (zone == NUM_ZONES) + { + fprintf (stderr, "couldnt find zone %s\n", guess_zone); + if (guessing_timezone) + { + guessing_timezone = FALSE; + guess_failed = TRUE; + guess_failed_timeout = time (NULL) + 3; + } + } + else + { + double x,y,z; + double min_dist_squared; + int closest_place; + + // Look for the location in the zone nearest to the guess lat/lon. + + // Convert the guessed lat/lon to x,y,z. + + guess_latitude *= M_PI / 180.0; + guess_longitude *= M_PI / 180.0; + + x = cos (guess_longitude) * cos (guess_latitude); + y = sin (guess_longitude) * cos (guess_latitude); + z = sin (guess_latitude); + + min_dist_squared = + pow (x - zone_data[zone].place_info[0].v.x, 2) + + pow (y - zone_data[zone].place_info[0].v.y, 2) + + pow (z - zone_data[zone].place_info[0].v.z, 2); + closest_place = 0; + + for (int place = 1; place < zone_data[zone].num_places; place++) + { + double dist_squared; + + dist_squared = + pow (x - zone_data[zone].place_info[place].v.x, 2) + + pow (y - zone_data[zone].place_info[place].v.y, 2) + + pow (z - zone_data[zone].place_info[place].v.z, 2); + + if (dist_squared < min_dist_squared) + { + closest_place = place; + min_dist_squared = dist_squared; + } + } + + fprintf (stderr, "Guess=%s %s\n", + zone_data[zone].place_info[closest_place].zonename, + zone_data[zone].offset); + + selected_zone = zone; + select_place (closest_place); + } + } + else + { + if (guessing_timezone) + { + guessing_timezone = FALSE; + guess_failed = TRUE; + guess_failed_timeout = time (NULL) + 3; + } + } + + guessing_timezone = FALSE; + return NULL; +} + +void remove_titlebar_and_borders () +{ + XClassHint* classHint; + char* appname; + appname="look fo rme"; + XStoreName (display, window, appname); + + /* Set the name and class hints for the window manager to use. */ + + classHint = XAllocClassHint (); + if (classHint) + { + classHint->res_name = appname; + classHint->res_class = "MoonRoot"; + } + + XSetClassHint (display, window, classHint); + XFree (classHint); + + typedef struct + { + CARD32 flags; + CARD32 functions; + CARD32 decorations; + INT32 input_mode; + CARD32 status; + } MotifWmHints, MwmHints; + + #define MWM_HINTS_DECORATIONS (1L << 1) + + + Atom XA_MOTIF_WM_HINTS = XInternAtom (display, "_MOTIF_WM_HINTS", False); + MotifWmHints mwm_hints; + + mwm_hints.flags = MWM_HINTS_DECORATIONS; + mwm_hints.decorations = 0; + + XChangeProperty ( + display, window, + XA_MOTIF_WM_HINTS, XA_MOTIF_WM_HINTS, + 32, PropModeReplace, + (char *) &mwm_hints, 5); +} + +void set_window_position (int x, int y) +{ + XSizeHints hints; + + hints.flags = USPosition | PPosition; + hints.x = x; + hints.y = y; + + XSetWMNormalHints(display, window, &hints); +} + +int main (int argc, char *argv[]) +{ + XEvent xevent; + Colormap cmap; + XColor color, colorrgb; + pthread_t tid; + int opt; + int arg_width = -1; + int arg_height = -1; + char arg_zone[100] = {0}; + + if (getenv ("ACCEL")) + acceleration = atof (getenv ("ACCEL")); + + while ((opt = getopt (argc, argv, "z:w:h:a:")) != -1) + { + switch (opt) + { + case 'z': + strncpy (arg_zone, optarg, sizeof (arg_zone) - 1); + + if (strcasecmp (arg_zone, "guess") == 0) + { + guessing_timezone = TRUE; + arg_zone[0]=0; + } + + break; + + case 'w': + arg_width = atoi (optarg); + break; + + case 'h': + arg_height = atoi (optarg); + break; + + case 'a': + acceleration = atof (optarg); + break; + + case '?': + printf ("usage: %s [-a accelleration] [-z timezone] " + "[-w width] [-h height]\n" + "e.g. linhes_timezone -w 1920 -h 1090 -z Australia/Adelaide\n" + "specify a timezone of 'guess' to determine the initial " + "timezone from\n" + "your ip address using geocache.\n", + argv[0]); + exit (0); + break; + } + } + + pthread_create (&tid, NULL, lirc_thread, NULL); + + /* Connect to the X server. */ + + display = XOpenDisplay (""); + + if (display == NULL) + { + fprintf (stderr, "cannot connect to server\n"); + exit (EXIT_FAILURE); + } + + /* Get default screen. */ + + screen = DefaultScreen (display); + screen_width = XWidthOfScreen (DefaultScreenOfDisplay (display)); + screen_height = XHeightOfScreen (DefaultScreenOfDisplay (display)); + + if ((arg_width <= 0) && (arg_height > 0)) + arg_width == arg_height; + + if (arg_width > 0) + { + width = arg_width; + + if (arg_height <= 0) + height = width; + else + height = arg_height; + + x = (screen_width - width) / 2; + y = (screen_height - height) / 2; + } + else + { + width = screen_width; + height = screen_height; + x = 0; + y = 0; + } + + if (width < height) + radius = width; + else + radius = height; + + radius = 0.96 * radius / 2; + + if ((screen_height == 0) || + (XWidthMMOfScreen (DefaultScreenOfDisplay (display)) == 0)) + aspect_correction = 1; + else + aspect_correction = + sqrt (screen_width * + XHeightMMOfScreen (DefaultScreenOfDisplay (display)) * 1.0 / + screen_height / + XWidthMMOfScreen (DefaultScreenOfDisplay (display))); + + // Protect against very wierd aspect corrections from bogus + // screen dimensions. + if ((aspect_correction < 0.5) || (aspect_correction > 2)) + aspect_correction = 1; + + window = XCreateSimpleWindow (display, + DefaultRootWindow(display), x, y, width, height, 0, + land[0].pixel, ocean.pixel); + + remove_titlebar_and_borders (); + set_window_position (x, y); + + if (!window) + { + fprintf (stderr, "cannot open window\n"); + exit (EXIT_FAILURE); + } + + /* set graphics context of rectangle to red */ + gc= XCreateGC (display, window, 0, 0); + cmap = DefaultColormap (display, screen); + + // Load the font. + + font = XLoadQueryFont (display, (width > 800) ? + "-*-lucida-bold-r-*-*-34-*-*-*-*-*-*-*" : + "-*-lucida-bold-r-*-*-20-*-*-*-*-*-*-*"); + if (!font) + fprintf (stderr,"error loading font\n"); + + XSetFont (display, gc, font->fid); + + pixmap = + XCreatePixmap (display, window, width, height, + DefaultDepth (display, DefaultScreen (display))); + + ocean.flags = DoRed | DoGreen | DoBlue; + ocean.red = 40 * 256; + ocean.green = 41 * 256; + ocean.blue = 72 * 256; + if (XAllocColor (display, cmap, &ocean) == 0) + printf ("Cant allocate color\n"); + + lat_lon.flags = DoRed | DoGreen | DoBlue; + lat_lon.red = 0 * 256; + lat_lon.green = 0 * 256; + lat_lon.blue = 86 * 256; + if (XAllocColor (display, cmap, &lat_lon) == 0) + printf ("Cant allocate color\n"); + + tux_yellow.flags = DoRed | DoGreen | DoBlue; + tux_yellow.red = 248 * 256; + tux_yellow.green = 191 * 256; + tux_yellow.blue = 17 * 256; + if (XAllocColor (display, cmap, &tux_yellow) == 0) + printf ("Cant allocate color\n"); + + for (int land_col = 0; land_col < XtNumber (land); land_col++) + { + land[land_col].flags = DoRed | DoGreen | DoBlue; + land[land_col].red = (120 + 9 * land_col) * 256; + land[land_col].green = (40 + 3 * land_col) * 256; + land[land_col].blue = 0 * 256; + if (XAllocColor (display, cmap, &land[land_col]) == 0) + printf ("Cant allocate color\n"); + } + + selected_land.flags = DoRed | DoGreen | DoBlue; + selected_land.red = 3 * 256; + selected_land.green = 40 * 256; + selected_land.blue = 13 * 256; + if (XAllocColor (display, cmap, &selected_land) == 0) + printf ("Cant allocate color\n"); + + border.flags = DoRed | DoGreen | DoBlue; + border.red = 0 * 256; + border.green = 0 * 256; + border.blue = 0 * 256; + if (XAllocColor (display, cmap, &border) == 0) + printf ("Cant allocate color\n"); + + selected_border.flags = DoRed | DoGreen | DoBlue; + selected_border.red = 80 * 256; + selected_border.green = 255 * 256; + selected_border.blue = 80 * 256; + if (XAllocColor (display, cmap, &selected_border) == 0) + printf ("Cant allocate color\n"); + + name_colour.flags = DoRed | DoGreen | DoBlue; + name_colour.red = 255 * 256; + name_colour.green = 255 * 256; + name_colour.blue = 0 * 256; + if (XAllocColor (display, cmap, &name_colour) == 0) + printf ("Cant allocate color\n"); + + location_dot.flags = DoRed | DoGreen | DoBlue; + location_dot.red = 255 * 256; + location_dot.green = 55 * 256; + location_dot.blue = 200 * 256; + if (XAllocColor (display, cmap, &location_dot) == 0) + printf ("Cant allocate color\n"); + + // Find the selected timezone (or LA if a timezone was not selected) and + // make that the selected zone and place. + + default_zone (arg_zone); + + if (guessing_timezone) + { + pthread_create (&tid, NULL, timezone_guess, NULL); + guess_timeout = time (NULL) + 10; + displayed_lat = M_PI/2; + displayed_lon = 0; + } + else + { + displayed_lat = target_lat; + displayed_lon = target_lon; + } + + /* ask for exposure event and keyboard events */ + XSelectInput(display, window, KeymapNotify | ExposureMask); + + /* pop this window up on the screen */ + XMapRaised (display, window); + + redraw_map (); + + while (1) + { + if (guessing_timezone && (time (NULL) > guess_timeout)) + { + guessing_timezone = FALSE; + guess_failed_timeout = time (NULL) + 3; + guess_failed = TRUE; + } + + if ((displayed_lat != target_lat) || (displayed_lon != target_lon) || + guessing_timezone || guess_failed || + (info_displayed ^ show_information)) + { + if (guess_failed && (time (NULL) > guess_failed_timeout)) + { + guess_failed = FALSE; + } + + next_view (); + redraw_map (); + } + else + { + usleep (1000); + } + + while (strlen (input_keys)) + { + handle_key (input_keys[0]); + memmove (&input_keys[0], &input_keys[1], strlen (input_keys)); + } + + // If there is an event pending, go on to process it. + + if (XCheckIfEvent (display, &xevent, event_predicate, NULL)) + handle_event (&xevent); + } + + return 0; +} |