1# Command covered: 'canvas create geomap_lnarr' 2# 3# This script file tests the commands in the tclgeomap package. See the 4# tclgeomap man page for a description of the package. See the tcltest 5# man page for a description of Tcl's testing proc's. 6# 7# Copyright (c) 2004 Gordon D. Carrie. All rights reserved. 8# 9# Licensed under the Open Software License version 2.1 10# 11# Please address questions and feedback to user0@tkgeomap.org 12# 13# @(#) $Id: tk_geomap_lnarr.test,v 1.4 2004/09/22 21:23:25 tkgeomap Exp $ 14 15if {[lsearch [namespace children] ::tcltest] == -1} { 16 package require tcltest 17 namespace import ::tcltest::* 18} 19 20package require tkgeomap 2 21 22# An arbitrary "land mass" 23# 24# It started out as: 25# {{47.531628 -14.259487} {46.069114 41.315951} 26# {-25.228323 79.341253} {-31.07837 14.259487} {16.087627 3.656279} 27# {17.915766 30.712743} {-1.828139 36.928417} {-5.11879 22.668928} 28# {7.678186 21.572046} {5.850047 15.722} {-16.087627 19.012651} 29# {-14.625116 55.209814} {32.906511 34.369022} {33.637765 -5.484418} 30# {-38.756556 -13.528232} {-37.659672 -79.341253} {45.337855 -80.803771} 31# {46.800373 -38.025301} {-6.581302 -39.853442} {-6.94693 -62.15674} 32# {25.95958 -65.813022} {26.325209 -54.844182} {10.968837 -54.844182} 33# {10.237581 -47.165996} {36.928417 -48.62851} {36.928417 -72.028699} 34# {-20.475162 -71.663062} {-21.937673 -28.518975} {47.531628 -14.259487}} 35# 36# Then the long segments were filled in with tclgeomap::fillsegment, which 37# is part of the tclgeomap_procs extension. 38 39set Freedonia { 40 {47.531628 -14.259487} {48.147778 -11.424485} {48.692584 -8.524644} 41 {49.163095 -5.565755} {49.556637 -2.554806} {49.870878 0.500077} 42 {50.10389 3.589756} {50.254206 6.704247} {50.32086 9.832947} 43 {50.30342 12.964887} {50.201999 16.089013} {50.017253 19.194475} 44 {49.750361 22.270896} {49.402986 25.30862} {48.977231 28.298909} 45 {48.475578 31.2341} {47.900824 34.107694} {47.256014 36.914405} 46 {46.544375 39.650152} {46.069114 41.315951} {46.069114 41.315951} 47 {44.41088 42.904171} {42.731858 44.404266} {41.034295 45.824843} 48 {39.32017 47.173645} {37.591227 48.457639} {35.849009 49.683099} 49 {34.094884 50.855681} {32.330074 51.980494} {30.555667 53.062165} 50 {28.772642 54.104891} {26.981881 55.112494} {25.18418 56.088464} 51 {23.380263 57.035997} {21.570793 57.958036} {19.756374 58.857298} 52 {17.937567 59.736303} {16.114889 60.597403} {14.288823 61.4428} 53 {12.459822 62.274567} {10.628313 63.094671} {8.794701 63.904987} 54 {6.959375 64.707312} {5.122707 65.503383} {3.285062 66.294888} 55 {1.446794 67.083484} {-0.391748 67.870802} {-2.230215 68.658466} 56 {-4.068261 69.448101} {-5.905533 70.241348} {-7.741674 71.039875} 57 {-9.576316 71.84539} {-11.40908 72.659653} {-13.239571 73.484493} 58 {-15.067376 74.321822} {-16.892055 75.17365} {-18.713144 76.042103} 59 {-20.530147 76.929444} {-22.342527 77.838093} {-24.149708 78.770651} 60 {-25.228323 79.341253} {-25.228323 79.341253} {-25.961833 77.278122} 61 {-26.665743 75.189638} {-27.33875 73.0758} {-27.979562 70.936758} 62 {-28.586901 68.772822} {-29.159513 66.58447} {-29.696173 64.372356} 63 {-30.195697 62.137313} {-30.656945 59.880359} {-31.078837 57.602695} 64 {-31.460354 55.305705} {-31.800556 52.990947} {-32.098581 50.660151} 65 {-32.353661 48.315202} {-32.565126 45.958129} {-32.732413 43.591087} 66 {-32.855071 41.216334} {-32.932766 38.836215} {-32.965285 36.453128} 67 {-32.952538 34.069509} {-32.89456 31.687795} {-32.791511 29.310406} 68 {-32.643673 26.939712} {-32.451445 24.578012} {-32.215343 22.227509} 69 {-31.93599 19.890289} {-31.614114 17.568302} {-31.250535 15.263348} 70 {-31.07837 14.259487} {-31.07837 14.259487} {-29.134197 13.717016} 71 {-27.18792 13.194702} {-25.239775 12.690317} {-23.289971 12.20186} 72 {-21.338699 11.727516} {-19.386131 11.265638} {-17.432424 10.814712} 73 {-15.477725 10.373347} {-13.522168 9.940248} {-11.565878 9.514204} 74 {-9.608975 9.094076} {-7.651571 8.678782} {-5.693773 8.267284} 75 {-3.735685 7.858581} {-1.777409 7.451699} {0.180957 7.04568} 76 {2.139313 6.639573} {4.097562 6.232427} {6.055604 5.823282} 77 {8.013337 5.411159} {9.970657 4.99505} {11.927455 4.573913} 78 {13.883619 4.146653} {15.839027 3.712119} {16.087627 3.656279} 79 {16.087627 3.656279} {16.35572 5.720417} {16.603668 7.790017} 80 {16.831095 9.864743} {17.037654 11.944226} {17.223027 14.028073} 81 {17.386926 16.11586} {17.529095 18.207142} {17.649312 20.30145} 82 {17.747384 22.398298} {17.823159 24.497183} {17.876514 26.597589} 83 {17.907364 28.69899} {17.915766 30.712743} {17.915766 30.712743} 84 {16.011048 31.350483} {14.104483 31.976162} {12.19633 32.591456} 85 {10.286832 33.197949} {8.37622 33.797145} {6.464713 34.390482} 86 {4.552525 34.979348} {2.63986 35.565091} {0.72692 36.149032} 87 {-1.186095 36.732479} {-1.828139 36.928417} {-1.828139 36.928417} 88 {-2.289995 34.981213} {-2.749207 33.032756} {-3.205243 31.082805} 89 {-3.657571 29.131122} {-4.105663 27.177478} {-4.548993 25.221651} 90 {-4.987039 23.26343} {-5.11879 22.668928} {-5.11879 22.668928} 91 {-3.126067 22.498019} {-1.133317 22.327758} {0.859444 22.157732} 92 {2.852196 21.987528} {4.844924 21.816733} {6.837609 21.644927} 93 {7.678186 21.572046} {7.678186 21.572046} {7.085639 19.645865} 94 {6.485186 17.724662} {5.877522 15.808057} {5.850047 15.722} 95 {5.850047 15.722} {3.871442 16.014823} {1.892736 16.306279} 96 {-0.086019 16.597071} {-2.064771 16.887893} {-4.04347 17.179441} 97 {-6.022064 17.472416} {-8.000501 17.767534} {-9.978726 18.065532} 98 {-11.956683 18.367173} {-13.934314 18.673259} {-15.911556 18.984634} 99 {-16.087627 19.012651} {-16.087627 19.012651} {-16.169263 21.092867} 100 {-16.230685 23.17459} {-16.2718 25.257397} {-16.292545 27.34086} 101 {-16.292888 29.424548} {-16.272829 31.508026} {-16.232399 33.590862} 102 {-16.171658 35.672628} {-16.090701 37.752902} {-15.989649 39.831271} 103 {-15.868656 41.907333} {-15.727906 43.980702} {-15.567609 46.051006} 104 {-15.388005 48.117892} {-15.189361 50.181027} {-14.97197 52.240099} 105 {-14.736151 54.294822} {-14.625116 55.209814} {-14.625116 55.209814} 106 {-12.775097 54.427633} {-10.922809 53.656831} {-9.068615 52.895596} 107 {-7.212864 52.14219} {-5.355889 51.39494} {-3.498013 50.652219} 108 {-1.639553 49.912438} {0.219179 49.174031} {2.077875 48.43544} 109 {3.936225 47.695107} {5.793917 46.951463} {7.650633 46.202909} 110 {9.506047 45.447809} {11.359823 44.684477} {13.21161 43.911159} 111 {15.061039 43.12602} {16.90772 42.327127} {18.751241 41.512435} 112 {20.591158 40.679761} {22.426994 39.826766} {24.258231 38.95093} 113 {26.084307 38.049526} {27.904606 37.119584} {29.718448 36.157863} 114 {31.525085 35.160805} {32.906511 34.369022} {32.906511 34.369022} 115 {33.31613 32.031834} {33.681595 29.673778} {34.00191 27.296842} 116 {34.276183 24.903213} {34.503635 22.49526} {34.683608 20.075512} 117 {34.815575 17.646633} {34.899145 15.211393} {34.93407 12.772638} 118 {34.920244 10.333257} {34.857709 7.896143} {34.746651 5.464165} 119 {34.587402 3.040131} {34.380429 0.626753} {34.126336 -1.773377} 120 {33.825848 -4.157819} {33.637765 -5.484418} {33.637765 -5.484418} 121 {31.650568 -5.752769} {29.662833 -6.00988} {27.674621 -6.257022} 122 {25.685986 -6.495326} {23.696976 -6.7258} {21.707636 -6.949353} 123 {19.718004 -7.166807} {17.728117 -7.378913} {15.738007 -7.586358} 124 {13.747704 -7.78978} {11.757238 -7.989772} {9.766634 -8.186892} 125 {7.775918 -8.381667} {5.785115 -8.574601} {3.794246 -8.766181} 126 {1.803336 -8.95688} {-0.187594 -9.147162} {-2.178523 -9.337488} 127 {-4.169427 -9.528317} {-6.160285 -9.720116} {-8.151073 -9.91336} 128 {-10.14177 -10.108537} {-12.13235 -10.306157} {-14.122787 -10.506752} 129 {-16.113056 -10.710885} {-18.103126 -10.919159} {-20.092968 -11.132218} 130 {-22.082548 -11.350762} {-24.071829 -11.575554} {-26.060771 -11.807431} 131 {-28.04933 -12.04732} {-30.037457 -12.296251} {-32.025096 -12.555378} 132 {-34.012184 -12.826003} {-35.998651 -13.109602} {-37.984417 -13.40786} 133 {-38.756556 -13.528232} {-38.756556 -13.528232} {-39.439791 -15.950405} 134 {-40.07182 -18.418738} {-40.650514 -20.931331} {-41.173829 -23.485751} 135 {-41.639835 -26.07903} {-42.046745 -28.707663} {-42.392943 -31.367633} 136 {-42.677012 -34.054441} {-42.897759 -36.763156} {-43.054236 -39.488486} 137 {-43.145762 -42.224856} {-43.171934 -44.966497} {-43.132637 -47.70755} 138 {-43.028043 -50.442163} {-42.858613 -53.164601} {-42.625083 -55.869336} 139 {-42.32845 -58.551143} {-41.969956 -61.205174} {-41.551058 -63.827023} 140 {-41.073411 -66.412773} {-40.538831 -68.959025} {-39.949273 -71.462919} 141 {-39.306802 -73.922131} {-38.613559 -76.334862} {-37.871745 -78.699818} 142 {-37.659672 -79.341253} {-37.659672 -79.341253} {-35.65999 -79.385737} 143 {-33.660293 -79.428047} {-31.660582 -79.468434} {-29.660859 -79.507119} 144 {-27.661125 -79.544295} {-25.661381 -79.580134} {-23.661629 -79.614792} 145 {-21.66187 -79.648404} {-19.662104 -79.681098} {-17.662332 -79.712985} 146 {-15.662555 -79.744171} {-13.662774 -79.774753} {-11.662989 -79.80482} 147 {-9.663201 -79.834456} {-7.66341 -79.863742} {-5.663618 -79.892754} 148 {-3.663824 -79.921566} {-1.664029 -79.95025} {0.335766 -79.978875} 149 {2.335561 -80.007512} {4.335355 -80.036231} {6.335149 -80.065102} 150 {8.334941 -80.094198} {10.33473 -80.123593} {12.334517 -80.153365} 151 {14.334301 -80.183594} {16.334081 -80.214369} {18.333856 -80.245779} 152 {20.333626 -80.277925} {22.33339 -80.310914} {24.333147 -80.344863} 153 {26.332896 -80.379901} {28.332637 -80.416172} {30.332367 -80.453834} 154 {32.332087 -80.493067} {34.331793 -80.534074} {36.331486 -80.577084} 155 {38.331162 -80.622361} {40.330819 -80.670209} {42.330456 -80.72098} 156 {44.330069 -80.775087} {45.337855 -80.803771} {45.337855 -80.803771} 157 {45.938319 -78.075091} {46.472472 -75.29002} {46.937744 -72.453349} 158 {47.33179 -69.570805} {47.652546 -66.648997} {47.898276 -63.695335} 159 {48.067615 -60.717909} {48.159602 -57.725333} {48.173711 -54.726565} 160 {48.109859 -51.730703} {47.968415 -48.74678} {47.750183 -45.783556} 161 {47.456386 -42.849331} {47.088632 -39.951775} {46.800373 -38.025301} 162 {46.800373 -38.025301} {44.801876 -38.136538} {42.803279 -38.240324} 163 {40.804594 -38.337611} {38.805832 -38.429207} {36.807002 -38.515802} 164 {34.808113 -38.59799} {32.809171 -38.676283} {30.810182 -38.751131} 165 {28.811152 -38.822926} {26.812086 -38.892016} {24.812987 -38.958711} 166 {22.81386 -39.023288} {20.814707 -39.085996} {18.815532 -39.147061} 167 {16.816338 -39.20669} {14.817127 -39.265075} {12.817902 -39.322392} 168 {10.818664 -39.378805} {8.819416 -39.43447} {6.82016 -39.489536} 169 {4.820898 -39.544143} {2.821632 -39.598431} {0.822363 -39.652531} 170 {-1.176907 -39.706578} {-3.176176 -39.760702} {-5.175441 -39.815036} 171 {-6.581302 -39.853442} {-6.581302 -39.853442} {-6.656268 -41.865448} 172 {-6.723099 -43.878035} {-6.781708 -45.891141} {-6.832023 -47.904703} 173 {-6.873978 -49.918653} {-6.907521 -51.932923} {-6.93261 -53.947442} 174 {-6.949211 -55.96214} {-6.957305 -57.976943} {-6.95688 -59.99178} 175 {-6.947937 -62.006576} {-6.94693 -62.15674} {-6.94693 -62.15674} 176 {-4.957943 -62.367485} {-2.96889 -62.576963} {-0.979797 -62.785689} 177 {1.009309 -62.994166} {2.998401 -63.202899} {4.987453 -63.412393} 178 {6.976439 -63.62316} {8.96533 -63.835727} {10.954099 -64.050635} 179 {12.942715 -64.268451} {14.931148 -64.489771} {16.919364 -64.715228} 180 {18.907327 -64.945497} {20.895 -65.181306} {22.882341 -65.423447} 181 {24.869305 -65.672785} {25.95958 -65.813022} {25.95958 -65.813022} 182 {26.101036 -63.59279} {26.208427 -61.36783} {26.28153 -59.139418} 183 {26.320189 -56.908859} {26.325209 -54.844182} {26.325209 -54.844182} 184 {24.325209 -54.844182} {22.325209 -54.844182} {20.325209 -54.844182} 185 {18.325209 -54.844182} {16.325209 -54.844182} {14.325209 -54.844182} 186 {12.325209 -54.844182} {10.968837 -54.844182} {10.968837 -54.844182} 187 {10.794157 -52.815341} {10.606278 -50.788946} {10.405451 -48.765123} 188 {10.237581 -47.165996} {10.237581 -47.165996} {12.235508 -47.258828} 189 {14.233402 -47.353076} {16.23126 -47.449006} {18.229073 -47.546905} 190 {20.226835 -47.647079} {22.224539 -47.749862} {24.222177 -47.855616} 191 {26.21974 -47.964743} {28.217217 -48.077684} {30.214597 -48.194932} 192 {32.21187 -48.317042} {34.209019 -48.444638} {36.20603 -48.57843} 193 {36.928417 -48.62851} {36.928417 -48.62851} {37.149399 -51.118798} 194 {37.318003 -53.621945} {37.433672 -56.134573} {37.49602 -58.653183} 195 {37.504839 -61.174193} {37.460098 -63.693991} {37.361948 -66.20898} 196 {37.210718 -68.715628} {37.006907 -71.210512} {36.928417 -72.028699} 197 {36.928417 -72.028699} {34.928466 -72.011392} {32.928513 -71.99491} 198 {30.928558 -71.979156} {28.9286 -71.964048} {26.928642 -71.949512} 199 {24.928681 -71.935483} {22.92872 -71.921902} {20.928757 -71.908717} 200 {18.928794 -71.895879} {16.928829 -71.883345} {14.928864 -71.871074} 201 {12.928898 -71.85903} {10.928932 -71.847177} {8.928965 -71.835483} 202 {6.928998 -71.823917} {4.92903 -71.812449} {2.929063 -71.801049} 203 {0.929095 -71.78969} {-1.070873 -71.778344} {-3.070841 -71.766983} 204 {-5.070808 -71.75558} {-7.070776 -71.744105} {-9.070743 -71.732531} 205 {-11.07071 -71.720827} {-13.070676 -71.708962} {-15.070642 -71.696903} 206 {-17.070607 -71.684615} {-19.070571 -71.67206} {-20.475162 -71.663062} 207 {-20.475162 -71.663062} {-20.813947 -69.556687} {-21.1269 -67.441186} 208 {-21.413487 -65.317117} {-21.673209 -63.185091} {-21.905612 -61.045777} 209 {-22.110281 -58.899893} {-22.286848 -56.748201} {-22.434995 -54.591506} 210 {-22.554451 -52.43065} {-22.644995 -50.266502} {-22.706461 -48.099958} 211 {-22.738735 -45.931931} {-22.741757 -43.763344} {-22.715521 -41.595126} 212 {-22.660076 -39.428201} {-22.575525 -37.263484} {-22.462024 -35.101876} 213 {-22.319782 -32.944252} {-22.149059 -30.791459} {-21.950165 -28.644311} 214 {-21.937673 -28.518975} {-21.937673 -28.518975} {-19.96857 -28.143961} 215 {-17.998699 -27.778203} {-16.028156 -27.42053} {-14.057033 -27.069859} 216 {-12.085413 -26.725181} {-10.113374 -26.385548} {-8.140992 -26.050061} 217 {-6.168337 -25.717864} {-4.195477 -25.388131} {-2.22248 -25.06006} 218 {-0.24941 -24.732865} {1.723667 -24.405768} {3.696689 -24.077992} 219 {5.669589 -23.748754} {7.642302 -23.417257} {9.61476 -23.082681} 220 {11.586893 -22.744179} {13.558626 -22.400864} {15.529883 -22.051801} 221 {17.50058 -21.695998} {19.47063 -21.33239} {21.439937 -20.959832} 222 {23.408397 -20.577078} {25.375897 -20.182764} {27.342311 -19.775391} 223 {29.307501 -19.353297} {31.271311 -18.91463} {33.233568 -18.457312} 224 {35.194075 -17.979} {37.152608 -17.477035} {39.108912 -16.948381} 225 {41.062691 -16.389549} {43.013606 -15.79651} {44.961259 -15.164575} 226 {46.905181 -14.488255} {47.531628 -14.259487} 227} 228 229# "Oceans" 230 231set dl 8 232foreach lon0 {-180 -60 60} { 233 set lon1 [expr {$lon0 + 120}] 234 for {set lat -88;set lon $lon0} {$lon < $lon1} {incr lon $dl} { 235 lappend ocean [list $lat $lon] 236 } 237 for {set lat -88;set lon $lon1} {$lat < 88} {incr lat $dl} { 238 lappend ocean [list $lat $lon] 239 } 240 for {set lat 88;set lon $lon1} {$lon > $lon0} {incr lon -$dl} { 241 lappend ocean [list $lat $lon] 242 } 243 for {set lat 88;set lon $lon0} {$lat > -88} {incr lat -$dl} { 244 lappend ocean [list $lat $lon] 245 } 246 lappend ocean [list -88 $lon0] 247 lappend Oceans $ocean 248 unset ocean 249} 250 251# These longitudes are potentially the most troublesome for Freedonia. 252 253set Lons {15.0 35.0 55.0 56.0 57.0 48.5 40.0 39.0 38.0 48.0 58.0 56.5 55.0 254 35.0 15.0 13.5 12.0 18.5 25.0 26.5 28.0 20.0 12.0 13.5 15.0 15.0 15.0 255 35.0 55.0 55.0 55.0 47.5 40.0 40.0 40.0 47.5 55.0 55.0 55.0 35.0 15.0 256 15.0 15.0 20.0 25.0 25.0 25.0 20.0 15.0 15.0 15.0 0.0 -15.0 -35.0 -55.0 257 -56.0 -57.0 -48.5 -40.0 -39.0 -38.0 -48.0 -58.0 -56.5 -55.0 -35.0 -15.0 258 -13.5 -12.0 -18.5 -25.0 -26.5 -28.0 -20.0 -12.0 -13.5 -15.0 -15.0 -15.0 259 -35.0 -55.0 -55.0 -55.0 -47.5 -40.0 -40.0 -40.0 -47.5 -55.0 -55.0 -55.0 260 -35.0 -15.0 -15.0 -15.0 -20.0 -25.0 -25.0 -25.0 -20.0 -15.0 -15.0 -15.0} 261 262test tk_geomap_lnarr-1.1 {Delete linearrays being displayed} { 263 # Create and draw some linearrays. Then delete them. 264 # They should disappear from the map. 265 266 geomap::lnarr fmlist Freedonia $Freedonia 267 geomap::lnarr fmlist Oceans $Oceans 268 if {[info commands .c] == ".c"} { 269 rename .c {} 270 } 271 set W 800 272 set H 600 273 set W2 [expr {$W / 2}] 274 set H2 [expr {$H / 2}] 275 canvas .c -width $W -height $H 276 set proj [geomap::projection Mercator 0.0] 277 set s [geomap::cartg 1:240000000] 278 .c create geomap_lnarr $W2 $H2 -lnarr Oceans -fill Blue4 \ 279 -projection $proj -scale $s 280 .c create geomap_lnarr $W2 $H2 -lnarr Freedonia -outline Green4 \ 281 -dotsize 2 -fill Yellow -projection $proj -scale $s 282 pack .c 283 update 284 after 3000 285 rename Freedonia {} 286 rename Oceans {} 287 rename $proj {} 288 update 289 after 3000 290 destroy .c 291} {} 292 293test tk_geomap_lnarr-1.2 {Delete map that is displaying linearrays} { 294 geomap::lnarr fmlist Freedonia $Freedonia 295 geomap::lnarr fmlist Oceans $Oceans 296 if {[info commands .c] == ".c"} { 297 rename .c {} 298 } 299 set W 800 300 set H 600 301 set W2 [expr {$W / 2}] 302 set H2 [expr {$H / 2}] 303 canvas .c -width $W -height $H 304 set proj [geomap::projection Mercator 0.0] 305 set s [geomap::cartg 1:240000000] 306 .c create geomap_lnarr $W2 $H2 -lnarr Oceans -fill Blue4 \ 307 -projection $proj -scale $s 308 .c create geomap_lnarr $W2 $H2 -lnarr Freedonia \ 309 -outline Green4 -dotsize 2 -fill Yellow -projection $proj -scale $s 310 pack .c 311 update 312 after 3000 313 destroy .c 314 rename $proj {} 315 rename Freedonia {} 316 rename Oceans {} 317} {} 318 319test tk_geomap_lnarr-1.3 {Mercator} { 320 geomap::lnarr fmlist Freedonia $Freedonia 321 geomap::lnarr fmlist Oceans $Oceans 322 set W 800 323 set H 600 324 set W2 [expr {$W / 2}] 325 set H2 [expr {$H / 2}] 326 canvas .c -width $W -height $H 327 pack .c 328 set proj [geomap::projection Mercator 0.0] 329 .c create text [expr {$W / 2}] [expr {$H - 40}] -tags maplabel 330 set s [geomap::cartg 1:240000000] 331 .c create geomap_lnarr $W2 $H2 -lnarr Oceans -projection $proj \ 332 -scale $s -fill Blue4 -tags geomap 333 .c create geomap_lnarr $W2 $H2 -lnarr Freedonia -projection $proj \ 334 -scale $s -outline Green4 -dotsize 2 -fill Yellow -tags geomap 335 set i 0 336 foreach lon $Lons { 337 set lon2 [expr {$lon - 180.0}] 338 $proj set Mercator $lon2 339 .c itemconfig geomap -refpoint [list 0.0 $lon2] 340 set text [format {%3d: %s} [incr i] [$proj info]] 341 .c itemconfig maplabel -text $text 342 update 343 after 250 344 } 345 destroy .c 346 rename $proj {} 347 rename Freedonia {} 348 rename Oceans {} 349} {} 350 351test tk_geomap_lnarr-1.4 {Lambert Conformal Conic} { 352 geomap::lnarr fmlist Freedonia $Freedonia 353 geomap::lnarr fmlist Oceans $Oceans 354 set W 800 355 set H 600 356 set W2 [expr {$W / 2}] 357 set H2 [expr {$H / 2}] 358 canvas .c -width $W -height $H 359 pack .c 360 set proj [geomap::projection Mercator 0.0] 361 set txt [.c create text [expr {$W / 2}] [expr {$H - 40}]] 362 set s [geomap::cartg 1:240000000] 363 .c create geomap_lnarr $W2 $H2 -lnarr Oceans -projection $proj \ 364 -scale $s -fill Blue4 -tags geomap 365 .c create geomap_lnarr $W2 $H2 -lnarr Freedonia -projection $proj \ 366 -scale $s -outline Green4 -dotsize 2 -fill Yellow -tags geomap 367 set Lat 45.0 368 set i 0 369 foreach lon $Lons { 370 set lon2 [expr {$lon - 180.0}] 371 set pt [list $Lat $lon2] 372 $proj set LambertConfConic $pt 373 .c itemconfig geomap -refpoint $pt 374 set text [format {%3d: %s} [incr i] [$proj info]] 375 .c itemconfig maplabel -text $text 376 update 377 after 250 378 } 379 set Lat -45.0 380 set i 0 381 foreach lon $Lons { 382 set lon2 [expr {$lon - 180.0}] 383 set pt [list $Lat $lon2] 384 $proj set LambertConfConic $pt 385 .c itemconfig geomap -refpoint $pt 386 set text [format {%3d: %s} [incr i] [$proj info]] 387 .c itemconfig maplabel -text $text 388 update 389 after 250 390 } 391 destroy .c 392 rename $proj {} 393 rename Freedonia {} 394 rename Oceans {} 395} {} 396 397test tk_geomap_lnarr-1.5 {Mercator again, different shapes} { 398 set Freedonia { 399 {{50 15} {50 55} {45 57} {45 40} {35 38} {35 58} {25 55} {25 15} \ 400 {35 12} {35 25} {45 28} {45 12} {50 15}} \ 401 {{10 15} {10 55} { 5 55} { 5 40} {-5 40} {-5 55} {-15 55} {-15 15} \ 402 {-5 15} {-5 25} { 5 25} { 5 15} {10 15}} \ 403 {{50 -15} {50 -55} {45 -57} {45 -40} {35 -38} {35 -58} {25 -55} \ 404 {25 -15} {35 -12} {35 -25} {45 -28} {45 -12} {50 -15}} \ 405 {{10 -15} {10 -55} { 5 -55} { 5 -40} {-5 -40} {-5 -55} {-15 -55} \ 406 {-15 -15} {-5 -15} {-5 -25} { 5 -25} { 5 -15} {10 -15}}} 407 geomap::lnarr fmlist Freedonia $Freedonia 408 geomap::lnarr fmlist Oceans $Oceans 409 set W 800 410 set H 600 411 set W2 [expr {$W / 2}] 412 set H2 [expr {$H / 2}] 413 canvas .c -width $W -height $H 414 pack .c 415 set proj [geomap::projection Mercator 0.0] 416 set txt [.c create text [expr {$W / 2}] [expr {$H - 40}]] 417 set s [geomap::cartg 1:240000000] 418 .c create geomap_lnarr $W2 $H2 -lnarr Oceans -projection $proj \ 419 -scale $s -fill Blue4 -tags geomap 420 .c create geomap_lnarr $W2 $H2 -lnarr Freedonia -projection $proj \ 421 -scale $s -outline Green4 -dotsize 2 -fill Yellow -tags geomap 422 set Lat 45.0 423 set Lons {} 424 foreach line $Freedonia { 425 foreach latLon $line { 426 lappend Lons [lindex $latLon 1] 427 } 428 } 429 set Lons2 {} 430 set last [lindex $Lons 0] 431 lappend Lons2 $last 432 foreach lon [lrange $Lons 1 end] { 433 lappend Lons2 [expr {0.5 * ($last + $lon)}] 434 lappend Lons2 $lon 435 set last $lon 436 } 437 set Lons [lsort -unique -real $Lons2] 438 foreach lon $Lons { 439 set lon2 [expr {$lon - 180.0}] 440 $proj set Mercator $lon2 441 .c itemconfig geomap -refpoint [list 0.0 $lon2] 442 .c itemconfig maplabel -text [$proj info] 443 update 444 after 250 445 } 446 foreach lon $Lons { 447 set lon2 [expr {$lon + 180.0}] 448 $proj set Mercator $lon2 449 .c itemconfig geomap -refpoint [list 0.0 $lon2] 450 .c itemconfig maplabel -text [$proj info] 451 update 452 after 250 453 } 454 destroy .c 455 rename $proj {} 456 rename Freedonia {} 457 rename Oceans {} 458} {} 459 460cleanupTests 461