├── LICENSE ├── Makefile ├── OnlineRoutingMapper.qml ├── README.md ├── __init__.py ├── help ├── Makefile ├── make.bat └── source │ ├── conf.py │ └── index.rst ├── i18n └── af.ts ├── icon.png ├── metadata.txt ├── onlineroutingmapper.py ├── onlineroutingmapper_dialog.py ├── onlineroutingmapper_dialog_base.ui ├── pb_tool.cfg ├── plugin_upload.py ├── providers ├── __init__.py ├── abstract_provider.py ├── apikeys.json ├── flexpolyline.py ├── graphhopper.py ├── here.py ├── openrouteservice.py ├── tomtom.py └── yandex.py ├── pylintrc ├── resources.py ├── resources.qrc ├── scripts ├── compile-strings.sh ├── run-env-linux.sh └── update-strings.sh └── test ├── __init__.py ├── qgis_interface.py ├── tenbytenraster.asc ├── tenbytenraster.asc.aux.xml ├── tenbytenraster.keywords ├── tenbytenraster.lic ├── tenbytenraster.prj ├── tenbytenraster.qml ├── test_init.py ├── test_onlineroutingmapper_dialog.py ├── test_qgis_environment.py ├── test_resources.py ├── test_translations.py └── utilities.py /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | #/*************************************************************************** 2 | # OnlineRoutingMapper 3 | # 4 | # Generate routes by using online services (Openrouteservice, GraphHopper , TomTom, Here) 5 | # ------------------- 6 | # begin : 2024-10-23 7 | # git sha : $Format:%H$ 8 | # copyright : (C) 2024 by Mehmet Selim BILGIN, Yunus Emre ONDER 9 | # email : mselimbilgin@yahoo.com, emre.ondr@hotmail.com 10 | # ***************************************************************************/ 11 | # 12 | #/*************************************************************************** 13 | # * * 14 | # * This program is free software; you can redistribute it and/or modify * 15 | # * it under the terms of the GNU General Public License as published by * 16 | # * the Free Software Foundation; either version 2 of the License, or * 17 | # * (at your option) any later version. * 18 | # * * 19 | # ***************************************************************************/ 20 | 21 | ################################################# 22 | # Edit the following to match your sources lists 23 | ################################################# 24 | 25 | 26 | #Add iso code for any locales you want to support here (space separated) 27 | # default is no locales 28 | # LOCALES = af 29 | LOCALES = 30 | 31 | # If locales are enabled, set the name of the lrelease binary on your system. If 32 | # you have trouble compiling the translations, you may have to specify the full path to 33 | # lrelease 34 | #LRELEASE = lrelease 35 | #LRELEASE = lrelease-qt4 36 | 37 | 38 | # translation 39 | SOURCES = \ 40 | __init__.py \ 41 | onlineroutingmapper.py onlineroutingmapper_dialog.py 42 | 43 | PLUGINNAME = onlineroutingmapper 44 | 45 | PY_FILES = \ 46 | __init__.py \ 47 | onlineroutingmapper.py onlineroutingmapper_dialog.py 48 | 49 | UI_FILES = onlineroutingmapper_dialog_base.ui 50 | 51 | EXTRAS = metadata.txt icon.png 52 | 53 | EXTRA_DIRS = 54 | 55 | COMPILED_RESOURCE_FILES = resources.py 56 | 57 | PEP8EXCLUDE=pydev,resources.py,conf.py,third_party,ui 58 | 59 | # QGISDIR points to the location where your plugin should be installed. 60 | # This varies by platform, relative to your HOME directory: 61 | # * Linux: 62 | # .local/share/QGIS/QGIS3/profiles/default/python/plugins/ 63 | # * Mac OS X: 64 | # Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins 65 | # * Windows: 66 | # AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins' 67 | 68 | QGISDIR=C:\Users\18675\AppData/Roaming/QGIS/QGIS3/profiles/default/python/plugins 69 | 70 | ################################################# 71 | # Normally you would not need to edit below here 72 | ################################################# 73 | 74 | HELP = help/build/html 75 | 76 | PLUGIN_UPLOAD = $(c)/plugin_upload.py 77 | 78 | RESOURCE_SRC=$(shell grep '^ *@@g;s/.*>//g' | tr '\n' ' ') 79 | 80 | .PHONY: default 81 | default: 82 | @echo While you can use make to build and deploy your plugin, pb_tool 83 | @echo is a much better solution. 84 | @echo A Python script, pb_tool provides platform independent management of 85 | @echo your plugins and runs anywhere. 86 | @echo You can install pb_tool using: pip install pb_tool 87 | @echo See https://g-sherman.github.io/plugin_build_tool/ for info. 88 | 89 | compile: $(COMPILED_RESOURCE_FILES) 90 | 91 | %.py : %.qrc $(RESOURCES_SRC) 92 | pyrcc5 -o $*.py $< 93 | 94 | %.qm : %.ts 95 | $(LRELEASE) $< 96 | 97 | test: compile transcompile 98 | @echo 99 | @echo "----------------------" 100 | @echo "Regression Test Suite" 101 | @echo "----------------------" 102 | 103 | @# Preceding dash means that make will continue in case of errors 104 | @-export PYTHONPATH=`pwd`:$(PYTHONPATH); \ 105 | export QGIS_DEBUG=0; \ 106 | export QGIS_LOG_FILE=/dev/null; \ 107 | nosetests -v --with-id --with-coverage --cover-package=. \ 108 | 3>&1 1>&2 2>&3 3>&- || true 109 | @echo "----------------------" 110 | @echo "If you get a 'no module named qgis.core error, try sourcing" 111 | @echo "the helper script we have provided first then run make test." 112 | @echo "e.g. source run-env-linux.sh ; make test" 113 | @echo "----------------------" 114 | 115 | deploy: compile doc transcompile 116 | @echo 117 | @echo "------------------------------------------" 118 | @echo "Deploying plugin to your .qgis2 directory." 119 | @echo "------------------------------------------" 120 | # The deploy target only works on unix like operating system where 121 | # the Python plugin directory is located at: 122 | # $HOME/$(QGISDIR)/python/plugins 123 | mkdir -p $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 124 | cp -vf $(PY_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 125 | cp -vf $(UI_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 126 | cp -vf $(COMPILED_RESOURCE_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 127 | cp -vf $(EXTRAS) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 128 | cp -vfr i18n $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 129 | cp -vfr $(HELP) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/help 130 | # Copy extra directories if any 131 | (foreach EXTRA_DIR,(EXTRA_DIRS), cp -R (EXTRA_DIR) (HOME)/(QGISDIR)/python/plugins/(PLUGINNAME)/;) 132 | 133 | 134 | # The dclean target removes compiled python files from plugin directory 135 | # also deletes any .git entry 136 | dclean: 137 | @echo 138 | @echo "-----------------------------------" 139 | @echo "Removing any compiled python files." 140 | @echo "-----------------------------------" 141 | find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname "*.pyc" -delete 142 | find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname ".git" -prune -exec rm -Rf {} \; 143 | 144 | 145 | derase: 146 | @echo 147 | @echo "-------------------------" 148 | @echo "Removing deployed plugin." 149 | @echo "-------------------------" 150 | rm -Rf $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) 151 | 152 | zip: deploy dclean 153 | @echo 154 | @echo "---------------------------" 155 | @echo "Creating plugin zip bundle." 156 | @echo "---------------------------" 157 | # The zip target deploys the plugin and creates a zip file with the deployed 158 | # content. You can then upload the zip file on http://plugins.qgis.org 159 | rm -f $(PLUGINNAME).zip 160 | cd $(HOME)/$(QGISDIR)/python/plugins; zip -9r $(CURDIR)/$(PLUGINNAME).zip $(PLUGINNAME) 161 | 162 | package: compile 163 | # Create a zip package of the plugin named $(PLUGINNAME).zip. 164 | # This requires use of git (your plugin development directory must be a 165 | # git repository). 166 | # To use, pass a valid commit or tag as follows: 167 | # make package VERSION=Version_0.3.2 168 | @echo 169 | @echo "------------------------------------" 170 | @echo "Exporting plugin to zip package. " 171 | @echo "------------------------------------" 172 | rm -f $(PLUGINNAME).zip 173 | git archive --prefix=$(PLUGINNAME)/ -o $(PLUGINNAME).zip $(VERSION) 174 | echo "Created package: $(PLUGINNAME).zip" 175 | 176 | upload: zip 177 | @echo 178 | @echo "-------------------------------------" 179 | @echo "Uploading plugin to QGIS Plugin repo." 180 | @echo "-------------------------------------" 181 | $(PLUGIN_UPLOAD) $(PLUGINNAME).zip 182 | 183 | transup: 184 | @echo 185 | @echo "------------------------------------------------" 186 | @echo "Updating translation files with any new strings." 187 | @echo "------------------------------------------------" 188 | @chmod +x scripts/update-strings.sh 189 | @scripts/update-strings.sh $(LOCALES) 190 | 191 | transcompile: 192 | @echo 193 | @echo "----------------------------------------" 194 | @echo "Compiled translation files to .qm files." 195 | @echo "----------------------------------------" 196 | @chmod +x scripts/compile-strings.sh 197 | @scripts/compile-strings.sh $(LRELEASE) $(LOCALES) 198 | 199 | transclean: 200 | @echo 201 | @echo "------------------------------------" 202 | @echo "Removing compiled translation files." 203 | @echo "------------------------------------" 204 | rm -f i18n/*.qm 205 | 206 | clean: 207 | @echo 208 | @echo "------------------------------------" 209 | @echo "Removing uic and rcc generated files" 210 | @echo "------------------------------------" 211 | rm $(COMPILED_UI_FILES) $(COMPILED_RESOURCE_FILES) 212 | 213 | doc: 214 | @echo 215 | @echo "------------------------------------" 216 | @echo "Building documentation using sphinx." 217 | @echo "------------------------------------" 218 | cd help; make html 219 | 220 | pylint: 221 | @echo 222 | @echo "-----------------" 223 | @echo "Pylint violations" 224 | @echo "-----------------" 225 | @pylint --reports=n --rcfile=pylintrc . || true 226 | @echo 227 | @echo "----------------------" 228 | @echo "If you get a 'no module named qgis.core' error, try sourcing" 229 | @echo "the helper script we have provided first then run make pylint." 230 | @echo "e.g. source run-env-linux.sh ; make pylint" 231 | @echo "----------------------" 232 | 233 | 234 | # Run pep8 style checking 235 | #http://pypi.python.org/pypi/pep8 236 | pep8: 237 | @echo 238 | @echo "-----------" 239 | @echo "PEP8 issues" 240 | @echo "-----------" 241 | @pep8 --repeat --ignore=E203,E121,E122,E123,E124,E125,E126,E127,E128 --exclude $(PEP8EXCLUDE) . || true 242 | @echo "-----------" 243 | @echo "Ignored in PEP8 check:" 244 | @echo $(PEP8EXCLUDE) 245 | -------------------------------------------------------------------------------- /OnlineRoutingMapper.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 0 291 | 0 292 | 0 293 | id 294 | 295 | 296 | 315 | 316 | 317 | 318 | 0 319 | 320 | generatedlayout 321 | 322 | 323 | 324 | 325 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Online Routing Mapper v1.1 2 | ========== 3 | 4 | 5 | (C) 2015 by Mehmet Selim BILGIN & 2024 Yunus Emre ONDER 6 | 7 | mselimbilgin [at] yahoo.com 8 | emre.ondr [at] hotmail.com 9 | 10 | http://cbsuygulama.wordpress.com 11 | 12 | 13 | 14 | ###Description 15 | You dont need data anymore to calculate routes for your maps. Just point the start and stop locations. It will generate routes by using online services. 16 | 17 | 18 | ###Features 19 | 20 | - QGIS 3 Plugin. 21 | 22 | - Shortest-Path without any data. 23 | 24 | - Popular web services supported. 25 | 26 | - No need extra python packages. 27 | 28 | 29 | ###Changelog 30 | - Yandex.Routing added. 31 | 32 | 33 |



34 |

35 | 36 |

37 | 38 | 39 | 40 | 41 |

42 | 43 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | OnlineRoutingMapper 5 | A QGIS plugin 6 | Generate routes by using online services (Openrouteservice, GraphHopper , TomTom, Here) 7 | Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/ 8 | ------------------- 9 | begin : 2024-10-23 10 | copyright : (C) 2024 by Mehmet Selim BILGIN, Yunus Emre ONDER 11 | email : mselimbilgin@yahoo.com, emre.ondr@hotmail.com 12 | git sha : $Format:%H$ 13 | ***************************************************************************/ 14 | 15 | /*************************************************************************** 16 | * * 17 | * This program is free software; you can redistribute it and/or modify * 18 | * it under the terms of the GNU General Public License as published by * 19 | * the Free Software Foundation; either version 2 of the License, or * 20 | * (at your option) any later version. * 21 | * * 22 | ***************************************************************************/ 23 | This script initializes the plugin, making it known to QGIS. 24 | """ 25 | 26 | 27 | # noinspection PyPep8Naming 28 | def classFactory(iface): # pylint: disable=invalid-name 29 | """Load OnlineRoutingMapper class from file OnlineRoutingMapper. 30 | 31 | :param iface: A QGIS interface instance. 32 | :type iface: QgsInterface 33 | """ 34 | # 35 | from .onlineroutingmapper import OnlineRoutingMapper 36 | return OnlineRoutingMapper(iface) 37 | -------------------------------------------------------------------------------- /help/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = build 9 | 10 | # Internal variables. 11 | PAPEROPT_a4 = -D latex_paper_size=a4 12 | PAPEROPT_letter = -D latex_paper_size=letter 13 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source 14 | 15 | .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest 16 | 17 | help: 18 | @echo "Please use \`make ' where is one of" 19 | @echo " html to make standalone HTML files" 20 | @echo " dirhtml to make HTML files named index.html in directories" 21 | @echo " singlehtml to make a single large HTML file" 22 | @echo " pickle to make pickle files" 23 | @echo " json to make JSON files" 24 | @echo " htmlhelp to make HTML files and a HTML help project" 25 | @echo " qthelp to make HTML files and a qthelp project" 26 | @echo " devhelp to make HTML files and a Devhelp project" 27 | @echo " epub to make an epub" 28 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 29 | @echo " latexpdf to make LaTeX files and run them through pdflatex" 30 | @echo " text to make text files" 31 | @echo " man to make manual pages" 32 | @echo " changes to make an overview of all changed/added/deprecated items" 33 | @echo " linkcheck to check all external links for integrity" 34 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 35 | 36 | clean: 37 | -rm -rf $(BUILDDIR)/* 38 | 39 | html: 40 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 41 | @echo 42 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 43 | 44 | dirhtml: 45 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 46 | @echo 47 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 48 | 49 | singlehtml: 50 | $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml 51 | @echo 52 | @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." 53 | 54 | pickle: 55 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 56 | @echo 57 | @echo "Build finished; now you can process the pickle files." 58 | 59 | json: 60 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 61 | @echo 62 | @echo "Build finished; now you can process the JSON files." 63 | 64 | htmlhelp: 65 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 66 | @echo 67 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 68 | ".hhp project file in $(BUILDDIR)/htmlhelp." 69 | 70 | qthelp: 71 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 72 | @echo 73 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 74 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 75 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/template_class.qhcp" 76 | @echo "To view the help file:" 77 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/template_class.qhc" 78 | 79 | devhelp: 80 | $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp 81 | @echo 82 | @echo "Build finished." 83 | @echo "To view the help file:" 84 | @echo "# mkdir -p $$HOME/.local/share/devhelp/template_class" 85 | @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/template_class" 86 | @echo "# devhelp" 87 | 88 | epub: 89 | $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub 90 | @echo 91 | @echo "Build finished. The epub file is in $(BUILDDIR)/epub." 92 | 93 | latex: 94 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 95 | @echo 96 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 97 | @echo "Run \`make' in that directory to run these through (pdf)latex" \ 98 | "(use \`make latexpdf' here to do that automatically)." 99 | 100 | latexpdf: 101 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 102 | @echo "Running LaTeX files through pdflatex..." 103 | make -C $(BUILDDIR)/latex all-pdf 104 | @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." 105 | 106 | text: 107 | $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text 108 | @echo 109 | @echo "Build finished. The text files are in $(BUILDDIR)/text." 110 | 111 | man: 112 | $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man 113 | @echo 114 | @echo "Build finished. The manual pages are in $(BUILDDIR)/man." 115 | 116 | changes: 117 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 118 | @echo 119 | @echo "The overview file is in $(BUILDDIR)/changes." 120 | 121 | linkcheck: 122 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 123 | @echo 124 | @echo "Link check complete; look for any errors in the above output " \ 125 | "or in $(BUILDDIR)/linkcheck/output.txt." 126 | 127 | doctest: 128 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 129 | @echo "Testing of doctests in the sources finished, look at the " \ 130 | "results in $(BUILDDIR)/doctest/output.txt." 131 | -------------------------------------------------------------------------------- /help/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Command file for Sphinx documentation 4 | 5 | if "%SPHINXBUILD%" == "" ( 6 | set SPHINXBUILD=sphinx-build 7 | ) 8 | set BUILDDIR=build 9 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source 10 | if NOT "%PAPER%" == "" ( 11 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% 12 | ) 13 | 14 | if "%1" == "" goto help 15 | 16 | if "%1" == "help" ( 17 | :help 18 | echo.Please use `make ^` where ^ is one of 19 | echo. html to make standalone HTML files 20 | echo. dirhtml to make HTML files named index.html in directories 21 | echo. singlehtml to make a single large HTML file 22 | echo. pickle to make pickle files 23 | echo. json to make JSON files 24 | echo. htmlhelp to make HTML files and a HTML help project 25 | echo. qthelp to make HTML files and a qthelp project 26 | echo. devhelp to make HTML files and a Devhelp project 27 | echo. epub to make an epub 28 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 29 | echo. text to make text files 30 | echo. man to make manual pages 31 | echo. changes to make an overview over all changed/added/deprecated items 32 | echo. linkcheck to check all external links for integrity 33 | echo. doctest to run all doctests embedded in the documentation if enabled 34 | goto end 35 | ) 36 | 37 | if "%1" == "clean" ( 38 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i 39 | del /q /s %BUILDDIR%\* 40 | goto end 41 | ) 42 | 43 | if "%1" == "html" ( 44 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html 45 | echo. 46 | echo.Build finished. The HTML pages are in %BUILDDIR%/html. 47 | goto end 48 | ) 49 | 50 | if "%1" == "dirhtml" ( 51 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml 52 | echo. 53 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. 54 | goto end 55 | ) 56 | 57 | if "%1" == "singlehtml" ( 58 | %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml 59 | echo. 60 | echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. 61 | goto end 62 | ) 63 | 64 | if "%1" == "pickle" ( 65 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle 66 | echo. 67 | echo.Build finished; now you can process the pickle files. 68 | goto end 69 | ) 70 | 71 | if "%1" == "json" ( 72 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json 73 | echo. 74 | echo.Build finished; now you can process the JSON files. 75 | goto end 76 | ) 77 | 78 | if "%1" == "htmlhelp" ( 79 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp 80 | echo. 81 | echo.Build finished; now you can run HTML Help Workshop with the ^ 82 | .hhp project file in %BUILDDIR%/htmlhelp. 83 | goto end 84 | ) 85 | 86 | if "%1" == "qthelp" ( 87 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp 88 | echo. 89 | echo.Build finished; now you can run "qcollectiongenerator" with the ^ 90 | .qhcp project file in %BUILDDIR%/qthelp, like this: 91 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\template_class.qhcp 92 | echo.To view the help file: 93 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\template_class.ghc 94 | goto end 95 | ) 96 | 97 | if "%1" == "devhelp" ( 98 | %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp 99 | echo. 100 | echo.Build finished. 101 | goto end 102 | ) 103 | 104 | if "%1" == "epub" ( 105 | %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub 106 | echo. 107 | echo.Build finished. The epub file is in %BUILDDIR%/epub. 108 | goto end 109 | ) 110 | 111 | if "%1" == "latex" ( 112 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 113 | echo. 114 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. 115 | goto end 116 | ) 117 | 118 | if "%1" == "text" ( 119 | %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text 120 | echo. 121 | echo.Build finished. The text files are in %BUILDDIR%/text. 122 | goto end 123 | ) 124 | 125 | if "%1" == "man" ( 126 | %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man 127 | echo. 128 | echo.Build finished. The manual pages are in %BUILDDIR%/man. 129 | goto end 130 | ) 131 | 132 | if "%1" == "changes" ( 133 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes 134 | echo. 135 | echo.The overview file is in %BUILDDIR%/changes. 136 | goto end 137 | ) 138 | 139 | if "%1" == "linkcheck" ( 140 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck 141 | echo. 142 | echo.Link check complete; look for any errors in the above output ^ 143 | or in %BUILDDIR%/linkcheck/output.txt. 144 | goto end 145 | ) 146 | 147 | if "%1" == "doctest" ( 148 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest 149 | echo. 150 | echo.Testing of doctests in the sources finished, look at the ^ 151 | results in %BUILDDIR%/doctest/output.txt. 152 | goto end 153 | ) 154 | 155 | :end 156 | -------------------------------------------------------------------------------- /help/source/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # OnlineRoutingMapper documentation build configuration file, created by 4 | # sphinx-quickstart on Sun Feb 12 17:11:03 2012. 5 | # 6 | # This file is execfile()d with the current directory set to its containing dir. 7 | # 8 | # Note that not all possible configuration values are present in this 9 | # autogenerated file. 10 | # 11 | # All configuration values have a default; values that are commented out 12 | # serve to show the default. 13 | 14 | import sys, os 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | #sys.path.insert(0, os.path.abspath('.')) 20 | 21 | # -- General configuration ----------------------------------------------------- 22 | 23 | # If your documentation needs a minimal Sphinx version, state it here. 24 | #needs_sphinx = '1.0' 25 | 26 | # Add any Sphinx extension module names here, as strings. They can be extensions 27 | # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 28 | extensions = ['sphinx.ext.todo', 'sphinx.ext.imgmath', 'sphinx.ext.viewcode'] 29 | 30 | # Add any paths that contain templates here, relative to this directory. 31 | templates_path = ['_templates'] 32 | 33 | # The suffix of source filenames. 34 | source_suffix = '.rst' 35 | 36 | # The encoding of source files. 37 | #source_encoding = 'utf-8-sig' 38 | 39 | # The master toctree document. 40 | master_doc = 'index' 41 | 42 | # General information about the project. 43 | project = u'OnlineRoutingMapper' 44 | copyright = u'2013, Mehmet Selim BILGIN, Yunus Emre ONDER' 45 | 46 | # The version info for the project you're documenting, acts as replacement for 47 | # |version| and |release|, also used in various other places throughout the 48 | # built documents. 49 | # 50 | # The short X.Y version. 51 | version = '1.0' 52 | # The full version, including alpha/beta/rc tags. 53 | release = '1.0' 54 | 55 | # The language for content autogenerated by Sphinx. Refer to documentation 56 | # for a list of supported languages. 57 | #language = None 58 | 59 | # There are two options for replacing |today|: either, you set today to some 60 | # non-false value, then it is used: 61 | #today = '' 62 | # Else, today_fmt is used as the format for a strftime call. 63 | #today_fmt = '%B %d, %Y' 64 | 65 | # List of patterns, relative to source directory, that match files and 66 | # directories to ignore when looking for source files. 67 | exclude_patterns = [] 68 | 69 | # The reST default role (used for this markup: `text`) to use for all documents. 70 | #default_role = None 71 | 72 | # If true, '()' will be appended to :func: etc. cross-reference text. 73 | #add_function_parentheses = True 74 | 75 | # If true, the current module name will be prepended to all description 76 | # unit titles (such as .. function::). 77 | #add_TemplateModuleNames = True 78 | 79 | # If true, sectionauthor and moduleauthor directives will be shown in the 80 | # output. They are ignored by default. 81 | #show_authors = False 82 | 83 | # The name of the Pygments (syntax highlighting) style to use. 84 | pygments_style = 'sphinx' 85 | 86 | # A list of ignored prefixes for module index sorting. 87 | #modindex_common_prefix = [] 88 | 89 | 90 | # -- Options for HTML output --------------------------------------------------- 91 | 92 | # The theme to use for HTML and HTML Help pages. See the documentation for 93 | # a list of builtin themes. 94 | html_theme = 'default' 95 | 96 | # Theme options are theme-specific and customize the look and feel of a theme 97 | # further. For a list of options available for each theme, see the 98 | # documentation. 99 | #html_theme_options = {} 100 | 101 | # Add any paths that contain custom themes here, relative to this directory. 102 | #html_theme_path = [] 103 | 104 | # The name for this set of Sphinx documents. If None, it defaults to 105 | # " v documentation". 106 | #html_title = None 107 | 108 | # A shorter title for the navigation bar. Default is the same as html_title. 109 | #html_short_title = None 110 | 111 | # The name of an image file (relative to this directory) to place at the top 112 | # of the sidebar. 113 | #html_logo = None 114 | 115 | # The name of an image file (within the static path) to use as favicon of the 116 | # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 117 | # pixels large. 118 | #html_favicon = None 119 | 120 | # Add any paths that contain custom static files (such as style sheets) here, 121 | # relative to this directory. They are copied after the builtin static files, 122 | # so a file named "default.css" will overwrite the builtin "default.css". 123 | html_static_path = ['_static'] 124 | 125 | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 126 | # using the given strftime format. 127 | #html_last_updated_fmt = '%b %d, %Y' 128 | 129 | # If true, SmartyPants will be used to convert quotes and dashes to 130 | # typographically correct entities. 131 | #html_use_smartypants = True 132 | 133 | # Custom sidebar templates, maps document names to template names. 134 | #html_sidebars = {} 135 | 136 | # Additional templates that should be rendered to pages, maps page names to 137 | # template names. 138 | #html_additional_pages = {} 139 | 140 | # If false, no module index is generated. 141 | #html_domain_indices = True 142 | 143 | # If false, no index is generated. 144 | #html_use_index = True 145 | 146 | # If true, the index is split into individual pages for each letter. 147 | #html_split_index = False 148 | 149 | # If true, links to the reST sources are added to the pages. 150 | #html_show_sourcelink = True 151 | 152 | # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 153 | #html_show_sphinx = True 154 | 155 | # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 156 | #html_show_copyright = True 157 | 158 | # If true, an OpenSearch description file will be output, and all pages will 159 | # contain a tag referring to it. The value of this option must be the 160 | # base URL from which the finished HTML is served. 161 | #html_use_opensearch = '' 162 | 163 | # This is the file name suffix for HTML files (e.g. ".xhtml"). 164 | #html_file_suffix = None 165 | 166 | # Output file base name for HTML help builder. 167 | htmlhelp_basename = 'TemplateClassdoc' 168 | 169 | 170 | # -- Options for LaTeX output -------------------------------------------------- 171 | 172 | # The paper size ('letter' or 'a4'). 173 | #latex_paper_size = 'letter' 174 | 175 | # The font size ('10pt', '11pt' or '12pt'). 176 | #latex_font_size = '10pt' 177 | 178 | # Grouping the document tree into LaTeX files. List of tuples 179 | # (source start file, target name, title, author, documentclass [howto/manual]). 180 | latex_documents = [ 181 | ('index', 'OnlineRoutingMapper.tex', u'OnlineRoutingMapper Documentation', 182 | u'Mehmet Selim BILGIN, Yunus Emre ONDER', 'manual'), 183 | ] 184 | 185 | # The name of an image file (relative to this directory) to place at the top of 186 | # the title page. 187 | #latex_logo = None 188 | 189 | # For "manual" documents, if this is true, then toplevel headings are parts, 190 | # not chapters. 191 | #latex_use_parts = False 192 | 193 | # If true, show page references after internal links. 194 | #latex_show_pagerefs = False 195 | 196 | # If true, show URL addresses after external links. 197 | #latex_show_urls = False 198 | 199 | # Additional stuff for the LaTeX preamble. 200 | #latex_preamble = '' 201 | 202 | # Documents to append as an appendix to all manuals. 203 | #latex_appendices = [] 204 | 205 | # If false, no module index is generated. 206 | #latex_domain_indices = True 207 | 208 | 209 | # -- Options for manual page output -------------------------------------------- 210 | 211 | # One entry per manual page. List of tuples 212 | # (source start file, name, description, authors, manual section). 213 | man_pages = [ 214 | ('index', 'TemplateClass', u'OnlineRoutingMapper Documentation', 215 | [u'Mehmet Selim BILGIN, Yunus Emre ONDER'], 1) 216 | ] 217 | -------------------------------------------------------------------------------- /help/source/index.rst: -------------------------------------------------------------------------------- 1 | .. OnlineRoutingMapper documentation master file, created by 2 | sphinx-quickstart on Sun Feb 12 17:11:03 2012. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to OnlineRoutingMapper's documentation! 7 | ============================================ 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | Indices and tables 15 | ================== 16 | 17 | * :ref:`genindex` 18 | * :ref:`modindex` 19 | * :ref:`search` 20 | 21 | -------------------------------------------------------------------------------- /i18n/af.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @default 5 | 6 | 7 | Good morning 8 | Goeie more 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MSBilgin/OnlineRoutingMapper/521bccf53ada44719953d249e7a095cdb8704a48/icon.png -------------------------------------------------------------------------------- /metadata.txt: -------------------------------------------------------------------------------- 1 | # This file contains metadata for your plugin. 2 | 3 | # This file should be included when you package your plugin.# Mandatory items: 4 | 5 | [general] 6 | name=Online Routing Mapper 7 | qgisMinimumVersion=3.0 8 | description=Generate routes by using online services (Openrouteservice, GraphHopper ,TomTom, Here, Yandex) 9 | version=1.1 10 | author=Mehmet Selim BILGIN, Yunus Emre ONDER 11 | email=mselimbilgin@yahoo.com, emre.ondr@hotmail.com 12 | 13 | about=Online Routing Mapper uses several web services to determine the shortest or fastest routes. It calculates routes between starting and destination points and visualizes them on QGIS maps, facilitating spatial analysis. 14 | 15 | tracker=https://github.com/MSBilgin/OnlineRoutingMapper/issues 16 | repository=https://github.com/MSBilgin/OnlineRoutingMapper 17 | # End of mandatory metadata 18 | 19 | # Recommended items: 20 | 21 | hasProcessingProvider=no 22 | # Uncomment the following line and add your changelog: 23 | changelog=Yandex.Routing was added as provider. 24 | 25 | # Tags are comma separated with spaces allowed 26 | tags=analysis, network analysis, network, vector, webservice, web, shortest path 27 | 28 | homepage=http://cbsuygulama.wordpress.com/ 29 | category=Plugins 30 | icon=icon.png 31 | # experimental flag 32 | experimental=False 33 | 34 | # deprecated flag (applies to the whole plugin, not just a single version) 35 | deprecated=False 36 | 37 | # Since QGIS 3.8, a comma separated list of plugins to be installed 38 | # (or upgraded) can be specified. 39 | # Check the documentation for more information. 40 | # plugin_dependencies= 41 | 42 | Category of the plugin: Raster, Vector, Database or Web 43 | # category= 44 | 45 | # If the plugin can run on QGIS Server. 46 | server=False 47 | 48 | -------------------------------------------------------------------------------- /onlineroutingmapper.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | OnlineRoutingMapper 5 | A QGIS plugin 6 | Generate routes by using online services (Openrouteservice, GraphHopper , TomTom, Here, Yandex) 7 | Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/ 8 | ------------------- 9 | begin : 2024-10-25 10 | git sha : $Format:%H$ 11 | copyright : (C) 2024 by Mehmet Selim BILGIN, Yunus Emre ONDER 12 | email : mselimbilgin@yahoo.com, eonder0@gmail.com 13 | ***************************************************************************/ 14 | 15 | /*************************************************************************** 16 | * * 17 | * This program is free software; you can redistribute it and/or modify * 18 | * it under the terms of the GNU General Public License as published by * 19 | * the Free Software Foundation; either version 2 of the License, or * 20 | * (at your option) any later version. * 21 | * * 22 | ***************************************************************************/ 23 | """ 24 | import os.path 25 | 26 | from qgis.PyQt.QtCore import QSettings, QTranslator, QCoreApplication 27 | from qgis.PyQt.QtGui import QIcon, QColor 28 | from qgis.PyQt.QtWidgets import QAction, QMessageBox, QInputDialog, QLineEdit 29 | from qgis.core import * 30 | from qgis.gui import * 31 | 32 | # Import the code for the dialog 33 | from .onlineroutingmapper_dialog import OnlineRoutingMapperDialog 34 | from .providers import get_provider_by_title, get_provider_titles 35 | 36 | 37 | # Initialize Qt resources from file resources.py 38 | 39 | class OnlineRoutingMapper: 40 | """QGIS Plugin Implementation.""" 41 | 42 | def __init__(self, iface): 43 | """Constructor. 44 | 45 | :param iface: An interface instance that will be passed to this class 46 | which provides the hook by which you can manipulate the QGIS 47 | application at run time. 48 | :type iface: QgsInterface 49 | """ 50 | self.no = 0 51 | self.dialog = None 52 | self.click_tool = None 53 | self.start_rubber_band = None 54 | self.stop_rubber_band = None 55 | self.iface = iface 56 | # initialize plugin directory 57 | self.plugin_dir = os.path.dirname(__file__) 58 | # initialize locale 59 | locale = QSettings().value('locale/userLocale')[0:2] 60 | locale_path = os.path.join( 61 | self.plugin_dir, 62 | 'i18n', 63 | 'OnlineRoutingMapper_{}.qm'.format(locale)) 64 | 65 | if os.path.exists(locale_path): 66 | self.translator = QTranslator() 67 | self.translator.load(locale_path) 68 | QCoreApplication.installTranslator(self.translator) 69 | 70 | # Declare instance attributes 71 | self.actions = [] 72 | self.menu = self.tr(u'&Online Routing Mapper') 73 | self.toolbar = self.iface.addToolBar(u'OnlineRoutingMapper') 74 | self.toolbar.setObjectName(u'OnlineRoutingMapper') 75 | # Check if plugin was started the first time in current QGIS session 76 | # Must be set in initGui() to survive plugin reloads 77 | self.first_start = None 78 | 79 | # noinspection PyMethodMayBeStatic 80 | def tr(self, message): 81 | """Get the translation for a string using Qt translation API. 82 | 83 | We implement this ourselves since we do not inherit QObject. 84 | 85 | :param message: String for translation. 86 | :type message: str, QString 87 | 88 | :returns: Translated version of message. 89 | :rtype: QString 90 | """ 91 | # noinspection PyTypeChecker,PyArgumentList,PyCallByClass 92 | return QCoreApplication.translate('OnlineRoutingMapper', message) 93 | 94 | def add_action( 95 | self, 96 | icon_path, 97 | text, 98 | callback, 99 | enabled_flag=True, 100 | add_to_menu=True, 101 | add_to_toolbar=True, 102 | status_tip=None, 103 | whats_this=None, 104 | parent=None): 105 | """Add a toolbar icon to the toolbar. 106 | 107 | :param icon_path: Path to the icon for this action. Can be a resource 108 | path (e.g. ':/plugins/foo/bar.png') or a normal file system path. 109 | :type icon_path: str 110 | 111 | :param text: Text that should be shown in menu items for this action. 112 | :type text: str 113 | 114 | :param callback: Function to be called when the action is triggered. 115 | :type callback: function 116 | 117 | :param enabled_flag: A flag indicating if the action should be enabled 118 | by default. Defaults to True. 119 | :type enabled_flag: bool 120 | 121 | :param add_to_menu: Flag indicating whether the action should also 122 | be added to the menu. Defaults to True. 123 | :type add_to_menu: bool 124 | 125 | :param add_to_toolbar: Flag indicating whether the action should also 126 | be added to the toolbar. Defaults to True. 127 | :type add_to_toolbar: bool 128 | 129 | :param status_tip: Optional text to show in a popup when mouse pointer 130 | hovers over the action. 131 | :type status_tip: str 132 | 133 | :param parent: Parent widget for the new action. Defaults None. 134 | :type parent: QWidget 135 | 136 | :param whats_this: Optional text to show in the status bar when the 137 | mouse pointer hovers over the action. 138 | 139 | :returns: The action that was created. Note that the action is also 140 | added to self.actions list. 141 | :rtype: QAction 142 | """ 143 | 144 | icon = QIcon(icon_path) 145 | action = QAction(icon, text, parent) 146 | action.triggered.connect(callback) 147 | action.setEnabled(enabled_flag) 148 | 149 | if status_tip is not None: 150 | action.setStatusTip(status_tip) 151 | 152 | if whats_this is not None: 153 | action.setWhatsThis(whats_this) 154 | 155 | if add_to_toolbar: 156 | # Adds plugin icon to Plugins toolbar 157 | self.toolbar.addAction(action) 158 | 159 | if add_to_menu: 160 | self.iface.addPluginToMenu( 161 | self.menu, 162 | action) 163 | 164 | self.actions.append(action) 165 | 166 | return action 167 | 168 | def initGui(self): 169 | """Create the menu entries and toolbar icons inside the QGIS GUI.""" 170 | 171 | # icon_path = ':/plugins/onlineroutingmapper/icon.png' 172 | icon_path = os.path.join(os.path.dirname(__file__), 'icon.png') 173 | self.add_action( 174 | icon_path, 175 | text=self.tr(u'Online Routing Mapper'), 176 | callback=self.run, 177 | parent=self.iface.mainWindow()) 178 | 179 | # will be set False in run() 180 | self.first_start = True 181 | 182 | def unload(self): 183 | """Removes the plugin menu item and icon from QGIS GUI.""" 184 | for action in self.actions: 185 | self.iface.removePluginMenu( 186 | self.tr(u'&Online Routing Mapper'), 187 | action) 188 | self.iface.removeToolBarIcon(action) 189 | 190 | def click_handler(self, point): 191 | if self.no == 0: 192 | self.start_rubber_band.removeLastPoint() 193 | self.start_rubber_band.removeLastPoint() 194 | self.start_rubber_band.addPoint(point) 195 | self.dialog.startTxt.setText(str(point.x()) + ',' + str(point.y())) 196 | else: 197 | self.stop_rubber_band.removeLastPoint() 198 | self.stop_rubber_band.removeLastPoint() 199 | self.stop_rubber_band.addPoint(point) 200 | self.dialog.stopTxt.setText(str(point.x()) + ',' + str(point.y())) 201 | self.dialog.showNormal() 202 | 203 | # free them 204 | self.iface.mapCanvas().unsetMapTool(self.click_tool) 205 | self.click_tool.canvasClicked.disconnect(self.click_handler) 206 | 207 | def tool_activator(self, no): 208 | self.no = no 209 | self.dialog.showMinimized() 210 | self.click_tool.canvasClicked.connect(self.click_handler) 211 | self.iface.mapCanvas().setMapTool(self.click_tool) # clickTool is activated 212 | 213 | def crs_transform(self, point): 214 | source_crs = self.iface.mapCanvas().mapSettings().destinationCrs() # getting the project CRS 215 | destination_crs = QgsCoordinateReferenceSystem(4326) # google uses this CRS 216 | transformer = QgsCoordinateTransform(source_crs, destination_crs, 217 | QgsProject.instance()) # defining a CRS transformer 218 | 219 | output_point = transformer.transform(point, QgsCoordinateTransform.ForwardTransform) 220 | return '{0},{1}'.format(output_point.y(), output_point.x()) 221 | 222 | def show_apikey_dialog(self): 223 | provider = get_provider_by_title(self.dialog.serviceCombo.currentText()) 224 | apikey = '' 225 | try: 226 | apikey = provider.get_apikey() 227 | except: 228 | pass 229 | 230 | value, ok = QInputDialog.getText(None, "Set API Key", provider.title + ":", QLineEdit.Normal, apikey) 231 | if ok: 232 | provider.set_apikey(value) 233 | 234 | def draw_route(self, wkt_linestring): 235 | feature = QgsFeature() 236 | feature.setGeometry(QgsGeometry.fromWkt(wkt_linestring)) 237 | vector_layer = QgsVectorLayer('LineString?crs=epsg:4326', 'Routing Result', 'memory') 238 | layer_provider = vector_layer.dataProvider() 239 | vector_layer.startEditing() 240 | layer_provider.addFeatures([feature]) 241 | vector_layer.commitChanges() 242 | vector_layer.updateExtents() 243 | vector_layer.loadNamedStyle(self.plugin_dir + os.sep + 'OnlineRoutingMapper.qml') 244 | QgsProject.instance().addMapLayer(vector_layer) 245 | destination_crs = self.iface.mapCanvas().mapSettings().destinationCrs() # getting the project CRS 246 | source_crs = QgsCoordinateReferenceSystem(4326) 247 | transformer = QgsCoordinateTransform(source_crs, destination_crs, QgsProject.instance()) 248 | zoom_extent = transformer.transform(vector_layer.extent(), QgsCoordinateTransform.ForwardTransform) 249 | self.iface.mapCanvas().setExtent(zoom_extent) 250 | self.iface.mapCanvas().zoomScale(self.iface.mapCanvas().scale() * 1.03) # zoom out a little bit. 251 | 252 | def run_analysis(self): 253 | if len(self.dialog.startTxt.text()) > 0 and len(self.dialog.stopTxt.text()) > 0: 254 | arr_start_point = self.dialog.startTxt.text().replace(" ", "").split(",") 255 | arr_stop_point = self.dialog.stopTxt.text().replace(" ", "").split(",") 256 | 257 | start_point = QgsPointXY(float(arr_start_point[0]), float(arr_start_point[1])) 258 | stop_point = QgsPointXY(float(arr_stop_point[0]), float(arr_stop_point[1])) 259 | 260 | start_point_wgs84 = self.crs_transform(start_point) 261 | stop_point_wgs84 = self.crs_transform(stop_point) 262 | 263 | try: 264 | provider = get_provider_by_title(self.dialog.serviceCombo.currentText()) 265 | wkt = provider.solve(start_point_wgs84, stop_point_wgs84) 266 | self.draw_route(wkt) 267 | 268 | # clear rubberbands 269 | self.start_rubber_band.removeLastPoint() 270 | self.stop_rubber_band.removeLastPoint() 271 | self.start_rubber_band.removeLastPoint() 272 | self.stop_rubber_band.removeLastPoint() 273 | except Exception as err: 274 | QMessageBox.warning(self.dialog, "Error", str(err)) 275 | else: 276 | QMessageBox.information(self.dialog, 'Warning', 'Please choose Start Location and Stop Location.') 277 | 278 | def generate_rubber_band(self): 279 | rubber_band = QgsRubberBand(self.iface.mapCanvas(), QgsWkbTypes.PointGeometry) 280 | rubber_band.setColor(QColor("#000000")) 281 | rubber_band.setIconSize(7) 282 | rubber_band.setIcon(QgsRubberBand.ICON_FULL_BOX) 283 | return rubber_band 284 | 285 | def remove_rubber_bands(self, event): 286 | self.iface.mapCanvas().scene().removeItem(self.start_rubber_band) 287 | self.iface.mapCanvas().scene().removeItem(self.stop_rubber_band) 288 | 289 | def run(self): 290 | self.no = 0 291 | 292 | if self.first_start: 293 | self.first_start = False 294 | self.dialog = OnlineRoutingMapperDialog() 295 | 296 | self.start_rubber_band = self.generate_rubber_band() 297 | self.stop_rubber_band = self.generate_rubber_band() 298 | 299 | self.dialog = OnlineRoutingMapperDialog() 300 | self.dialog.setFixedSize(self.dialog.size()) 301 | self.dialog.serviceCombo.addItems(get_provider_titles()) 302 | self.click_tool = QgsMapToolEmitPoint(self.iface.mapCanvas()) 303 | 304 | self.dialog.setApiKeyBtn.clicked.connect(self.show_apikey_dialog) 305 | self.dialog.startBtn.clicked.connect(lambda: self.tool_activator(0)) 306 | self.dialog.stopBtn.clicked.connect(lambda: self.tool_activator(1)) 307 | self.dialog.runBtn.clicked.connect(self.run_analysis) 308 | 309 | self.dialog.show() 310 | self.dialog.closeEvent = self.remove_rubber_bands 311 | -------------------------------------------------------------------------------- /onlineroutingmapper_dialog.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | /*************************************************************************** 4 | OnlineRoutingMapperDialog 5 | A QGIS plugin 6 | Generate routes by using online services (Google Directions, Here, MapBox, YourNavigation, OSRM etc.) 7 | Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/ 8 | ------------------- 9 | begin : 2018-10-01 10 | git sha : $Format:%H$ 11 | copyright : (C) 2018 by Mehmet Selim BILGIN 12 | email : mselimbilgin@yahoo.com 13 | ***************************************************************************/ 14 | 15 | /*************************************************************************** 16 | * * 17 | * This program is free software; you can redistribute it and/or modify * 18 | * it under the terms of the GNU General Public License as published by * 19 | * the Free Software Foundation; either version 2 of the License, or * 20 | * (at your option) any later version. * 21 | * * 22 | ***************************************************************************/ 23 | """ 24 | 25 | import os 26 | 27 | from qgis.PyQt.QtCore import Qt 28 | from qgis.PyQt import uic, QtGui 29 | from qgis.PyQt import QtWidgets 30 | 31 | FORM_CLASS, _ = uic.loadUiType(os.path.join( 32 | os.path.dirname(__file__), 'OnlineRoutingMapper_dialog_base.ui')) 33 | 34 | 35 | class OnlineRoutingMapperDialog(QtWidgets.QDialog, FORM_CLASS): 36 | def __init__(self, parent=None): 37 | """Constructor.""" 38 | super(OnlineRoutingMapperDialog, self).__init__(parent) 39 | # Set up the user interface from Designer. 40 | # After setupUI you can access any designer object by doing 41 | # self., and you can use autoconnect slots - see 42 | # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html 43 | # #widgets-and-dialogs-with-auto-connect 44 | self.setupUi(self) 45 | 46 | def keyPressEvent(self, event: QtGui.QKeyEvent) -> None: 47 | if not event.key() == Qt.Key_Escape: 48 | super().keyPressEvent(event) 49 | 50 | 51 | -------------------------------------------------------------------------------- /onlineroutingmapper_dialog_base.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | OnlineRoutingMapperDialogBase 4 | 5 | 6 | true 7 | 8 | 9 | 10 | 0 11 | 0 12 | 375 13 | 308 14 | 15 | 16 | 17 | 18 | 0 19 | 0 20 | 21 | 22 | 23 | Online Routing Mapper 24 | 25 | 26 | 27 | 28 | 20 29 | 280 30 | 53 31 | 16 32 | 33 | 34 | 35 | <html><head/><body><p><a href="https://cbsuygulama.wordpress.com/2015/11/05/shortest-path-analysis-with-online-routing-mapper-plugin/"><span style=" text-decoration: underline; color:#0000ff;">Help...</span></a></p></body></html> 36 | 37 | 38 | true 39 | 40 | 41 | 42 | 43 | 44 | 20 45 | 40 46 | 231 47 | 22 48 | 49 | 50 | 51 | 52 | border:1px solid black 53 | 54 | 55 | false 56 | 57 | 58 | 59 | 60 | 61 | 270 62 | 180 63 | 81 64 | 22 65 | 66 | 67 | 68 | 69 | 70 | 71 | Choose 72 | 73 | 74 | 75 | 76 | 77 | 20 78 | 160 79 | 221 80 | 16 81 | 82 | 83 | 84 | Stop Location 85 | 86 | 87 | 88 | 89 | 90 | 20 91 | 90 92 | 221 93 | 16 94 | 95 | 96 | 97 | Start Location 98 | 99 | 100 | 101 | 102 | true 103 | 104 | 105 | 106 | 20 107 | 110 108 | 231 109 | 22 110 | 111 | 112 | 113 | border:1px solid black 114 | 115 | 116 | false 117 | 118 | 119 | 120 | 121 | 122 | 270 123 | 110 124 | 81 125 | 22 126 | 127 | 128 | 129 | 130 | 8 131 | 132 | 133 | 134 | 135 | 136 | 137 | Choose 138 | 139 | 140 | 141 | 142 | 143 | 20 144 | 180 145 | 231 146 | 22 147 | 148 | 149 | 150 | border:1px solid black 151 | 152 | 153 | false 154 | 155 | 156 | 157 | 158 | 159 | 20 160 | 20 161 | 221 162 | 16 163 | 164 | 165 | 166 | Online Service 167 | 168 | 169 | 170 | 171 | true 172 | 173 | 174 | 175 | 20 176 | 240 177 | 331 178 | 31 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 0 188 | 0 189 | 0 190 | 191 | 192 | 193 | 194 | 195 | 196 | 46 197 | 204 198 | 113 199 | 200 | 201 | 202 | 203 | 204 | 205 | 108 206 | 255 207 | 171 208 | 209 | 210 | 211 | 212 | 213 | 214 | 77 215 | 229 216 | 142 217 | 218 | 219 | 220 | 221 | 222 | 223 | 23 224 | 102 225 | 56 226 | 227 | 228 | 229 | 230 | 231 | 232 | 31 233 | 136 234 | 75 235 | 236 | 237 | 238 | 239 | 240 | 241 | 0 242 | 0 243 | 0 244 | 245 | 246 | 247 | 248 | 249 | 250 | 255 251 | 255 252 | 255 253 | 254 | 255 | 256 | 257 | 258 | 259 | 0 260 | 0 261 | 0 262 | 263 | 264 | 265 | 266 | 267 | 268 | 255 269 | 255 270 | 255 271 | 272 | 273 | 274 | 275 | 276 | 277 | 46 278 | 204 279 | 113 280 | 281 | 282 | 283 | 284 | 285 | 286 | 0 287 | 0 288 | 0 289 | 290 | 291 | 292 | 293 | 294 | 295 | 150 296 | 229 297 | 184 298 | 299 | 300 | 301 | 302 | 303 | 304 | 255 305 | 255 306 | 220 307 | 308 | 309 | 310 | 311 | 312 | 313 | 0 314 | 0 315 | 0 316 | 317 | 318 | 319 | 320 | 321 | 322 | 0 323 | 0 324 | 0 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 0 334 | 0 335 | 0 336 | 337 | 338 | 339 | 340 | 341 | 342 | 46 343 | 204 344 | 113 345 | 346 | 347 | 348 | 349 | 350 | 351 | 108 352 | 255 353 | 171 354 | 355 | 356 | 357 | 358 | 359 | 360 | 77 361 | 229 362 | 142 363 | 364 | 365 | 366 | 367 | 368 | 369 | 23 370 | 102 371 | 56 372 | 373 | 374 | 375 | 376 | 377 | 378 | 31 379 | 136 380 | 75 381 | 382 | 383 | 384 | 385 | 386 | 387 | 0 388 | 0 389 | 0 390 | 391 | 392 | 393 | 394 | 395 | 396 | 255 397 | 255 398 | 255 399 | 400 | 401 | 402 | 403 | 404 | 405 | 0 406 | 0 407 | 0 408 | 409 | 410 | 411 | 412 | 413 | 414 | 255 415 | 255 416 | 255 417 | 418 | 419 | 420 | 421 | 422 | 423 | 46 424 | 204 425 | 113 426 | 427 | 428 | 429 | 430 | 431 | 432 | 0 433 | 0 434 | 0 435 | 436 | 437 | 438 | 439 | 440 | 441 | 150 442 | 229 443 | 184 444 | 445 | 446 | 447 | 448 | 449 | 450 | 255 451 | 255 452 | 220 453 | 454 | 455 | 456 | 457 | 458 | 459 | 0 460 | 0 461 | 0 462 | 463 | 464 | 465 | 466 | 467 | 468 | 0 469 | 0 470 | 0 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 23 480 | 102 481 | 56 482 | 483 | 484 | 485 | 486 | 487 | 488 | 46 489 | 204 490 | 113 491 | 492 | 493 | 494 | 495 | 496 | 497 | 108 498 | 255 499 | 171 500 | 501 | 502 | 503 | 504 | 505 | 506 | 77 507 | 229 508 | 142 509 | 510 | 511 | 512 | 513 | 514 | 515 | 23 516 | 102 517 | 56 518 | 519 | 520 | 521 | 522 | 523 | 524 | 31 525 | 136 526 | 75 527 | 528 | 529 | 530 | 531 | 532 | 533 | 23 534 | 102 535 | 56 536 | 537 | 538 | 539 | 540 | 541 | 542 | 255 543 | 255 544 | 255 545 | 546 | 547 | 548 | 549 | 550 | 551 | 23 552 | 102 553 | 56 554 | 555 | 556 | 557 | 558 | 559 | 560 | 46 561 | 204 562 | 113 563 | 564 | 565 | 566 | 567 | 568 | 569 | 46 570 | 204 571 | 113 572 | 573 | 574 | 575 | 576 | 577 | 578 | 0 579 | 0 580 | 0 581 | 582 | 583 | 584 | 585 | 586 | 587 | 46 588 | 204 589 | 113 590 | 591 | 592 | 593 | 594 | 595 | 596 | 255 597 | 255 598 | 220 599 | 600 | 601 | 602 | 603 | 604 | 605 | 0 606 | 0 607 | 0 608 | 609 | 610 | 611 | 612 | 613 | 614 | 0 615 | 0 616 | 0 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 10 626 | 50 627 | false 628 | 629 | 630 | 631 | 632 | 633 | 634 | Run 635 | 636 | 637 | 638 | 30 639 | 30 640 | 641 | 642 | 643 | 644 | 645 | 646 | 270 647 | 40 648 | 81 649 | 22 650 | 651 | 652 | 653 | 654 | 8 655 | 656 | 657 | 658 | 659 | 660 | 661 | Set API Key 662 | 663 | 664 | 665 | 666 | 667 | 668 | -------------------------------------------------------------------------------- /pb_tool.cfg: -------------------------------------------------------------------------------- 1 | #/*************************************************************************** 2 | # OnlineRoutingMapper 3 | # 4 | # Configuration file for plugin builder tool (pb_tool) 5 | # Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/ 6 | # ------------------- 7 | # begin : 2024-10-23 8 | # copyright : (C) 2024 by Mehmet Selim BILGIN, Yunus Emre ONDER 9 | # email : mselimbilgin@yahoo.com, emre.ondr@hotmail.com 10 | # ***************************************************************************/ 11 | # 12 | #/*************************************************************************** 13 | # * * 14 | # * This program is free software; you can redistribute it and/or modify * 15 | # * it under the terms of the GNU General Public License as published by * 16 | # * the Free Software Foundation; either version 2 of the License, or * 17 | # * (at your option) any later version. * 18 | # * * 19 | # ***************************************************************************/ 20 | # 21 | # 22 | # You can install pb_tool using: 23 | # pip install http://geoapt.net/files/pb_tool.zip 24 | # 25 | # Consider doing your development (and install of pb_tool) in a virtualenv. 26 | # 27 | # For details on setting up and using pb_tool, see: 28 | # http://g-sherman.github.io/plugin_build_tool/ 29 | # 30 | # Issues and pull requests here: 31 | # https://github.com/g-sherman/plugin_build_tool: 32 | # 33 | # Sane defaults for your plugin generated by the Plugin Builder are 34 | # already set below. 35 | # 36 | # As you add Python source files and UI files to your plugin, add 37 | # them to the appropriate [files] section below. 38 | 39 | [plugin] 40 | # Name of the plugin. This is the name of the directory that will 41 | # be created in .qgis2/python/plugins 42 | name: onlineroutingmapper 43 | 44 | # Full path to where you want your plugin directory copied. If empty, 45 | # the QGIS default path will be used. Don't include the plugin name in 46 | # the path. 47 | plugin_path: 48 | 49 | [files] 50 | # Python files that should be deployed with the plugin 51 | python_files: __init__.py onlineroutingmapper.py onlineroutingmapper_dialog.py 52 | 53 | # The main dialog file that is loaded (not compiled) 54 | main_dialog: onlineroutingmapper_dialog_base.ui 55 | 56 | # Other ui files for dialogs you create (these will be compiled) 57 | compiled_ui_files: 58 | 59 | # Resource file(s) that will be compiled 60 | resource_files: resources.qrc 61 | 62 | # Other files required for the plugin 63 | extras: metadata.txt icon.png 64 | 65 | # Other directories to be deployed with the plugin. 66 | # These must be subdirectories under the plugin directory 67 | extra_dirs: 68 | 69 | # ISO code(s) for any locales (translations), separated by spaces. 70 | # Corresponding .ts files must exist in the i18n directory 71 | locales: 72 | 73 | [help] 74 | # the built help directory that should be deployed with the plugin 75 | dir: help/build/html 76 | # the name of the directory to target in the deployed plugin 77 | target: help 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /plugin_upload.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding=utf-8 3 | """This script uploads a plugin package to the plugin repository. 4 | Authors: A. Pasotti, V. Picavet 5 | git sha : $TemplateVCSFormat 6 | """ 7 | 8 | import sys 9 | import getpass 10 | import xmlrpc.client 11 | from optparse import OptionParser 12 | 13 | standard_library.install_aliases() 14 | 15 | # Configuration 16 | PROTOCOL = 'https' 17 | SERVER = 'plugins.qgis.org' 18 | PORT = '443' 19 | ENDPOINT = '/plugins/RPC2/' 20 | VERBOSE = False 21 | 22 | 23 | def main(parameters, arguments): 24 | """Main entry point. 25 | 26 | :param parameters: Command line parameters. 27 | :param arguments: Command line arguments. 28 | """ 29 | address = "{protocol}://{username}:{password}@{server}:{port}{endpoint}".format( 30 | protocol=PROTOCOL, 31 | username=parameters.username, 32 | password=parameters.password, 33 | server=parameters.server, 34 | port=parameters.port, 35 | endpoint=ENDPOINT) 36 | print("Connecting to: %s" % hide_password(address)) 37 | 38 | server = xmlrpc.client.ServerProxy(address, verbose=VERBOSE) 39 | 40 | try: 41 | with open(arguments[0], 'rb') as handle: 42 | plugin_id, version_id = server.plugin.upload( 43 | xmlrpc.client.Binary(handle.read())) 44 | print("Plugin ID: %s" % plugin_id) 45 | print("Version ID: %s" % version_id) 46 | except xmlrpc.client.ProtocolError as err: 47 | print("A protocol error occurred") 48 | print("URL: %s" % hide_password(err.url, 0)) 49 | print("HTTP/HTTPS headers: %s" % err.headers) 50 | print("Error code: %d" % err.errcode) 51 | print("Error message: %s" % err.errmsg) 52 | except xmlrpc.client.Fault as err: 53 | print("A fault occurred") 54 | print("Fault code: %d" % err.faultCode) 55 | print("Fault string: %s" % err.faultString) 56 | 57 | 58 | def hide_password(url, start=6): 59 | """Returns the http url with password part replaced with '*'. 60 | 61 | :param url: URL to upload the plugin to. 62 | :type url: str 63 | 64 | :param start: Position of start of password. 65 | :type start: int 66 | """ 67 | start_position = url.find(':', start) + 1 68 | end_position = url.find('@') 69 | return "%s%s%s" % ( 70 | url[:start_position], 71 | '*' * (end_position - start_position), 72 | url[end_position:]) 73 | 74 | 75 | if __name__ == "__main__": 76 | parser = OptionParser(usage="%prog [options] plugin.zip") 77 | parser.add_option( 78 | "-w", "--password", dest="password", 79 | help="Password for plugin site", metavar="******") 80 | parser.add_option( 81 | "-u", "--username", dest="username", 82 | help="Username of plugin site", metavar="user") 83 | parser.add_option( 84 | "-p", "--port", dest="port", 85 | help="Server port to connect to", metavar="80") 86 | parser.add_option( 87 | "-s", "--server", dest="server", 88 | help="Specify server name", metavar="plugins.qgis.org") 89 | options, args = parser.parse_args() 90 | if len(args) != 1: 91 | print("Please specify zip file.\n") 92 | parser.print_help() 93 | sys.exit(1) 94 | if not options.server: 95 | options.server = SERVER 96 | if not options.port: 97 | options.port = PORT 98 | if not options.username: 99 | # interactive mode 100 | username = getpass.getuser() 101 | print("Please enter user name [%s] :" % username, end=' ') 102 | 103 | res = input() 104 | if res != "": 105 | options.username = res 106 | else: 107 | options.username = username 108 | if not options.password: 109 | # interactive mode 110 | options.password = getpass.getpass() 111 | main(options, args) 112 | -------------------------------------------------------------------------------- /providers/__init__.py: -------------------------------------------------------------------------------- 1 | from .here import Here 2 | from .openrouteservice import Openrouteservice 3 | from .tomtom import TomTom 4 | from .graphhopper import GraphHopper 5 | from .yandex import Yandex 6 | 7 | __PROVIDERS__ = [ 8 | TomTom(), 9 | GraphHopper(), 10 | Openrouteservice(), 11 | Here(), 12 | Yandex() 13 | ] 14 | 15 | 16 | def get_provider_titles(): 17 | return [provider.title for provider in __PROVIDERS__] 18 | 19 | 20 | def get_provider_by_title(title): 21 | for provider in __PROVIDERS__: 22 | if provider.title == title: 23 | return provider 24 | 25 | raise Exception('Undefined provider:' + title) 26 | -------------------------------------------------------------------------------- /providers/abstract_provider.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | from abc import ABC, abstractmethod 4 | 5 | __APIKEYS_FILEPATH__ = os.path.join(os.path.dirname(__file__), 'apikeys.json') 6 | 7 | 8 | class AbstractProvider(ABC): 9 | 10 | def __init__(self, title, name): 11 | self.title = title 12 | self.__name = name 13 | 14 | @abstractmethod 15 | def solve(self, start_point, end_point): 16 | pass 17 | 18 | def get_apikey(self): 19 | with open(__APIKEYS_FILEPATH__) as file: 20 | data = json.load(file) 21 | if not data[self.__name]: 22 | raise Exception('You must set API key for the selected service') 23 | 24 | return data[self.__name] 25 | 26 | def set_apikey(self, value): 27 | with open(__APIKEYS_FILEPATH__, 'r+') as file: 28 | data = json.load(file) 29 | print(data) 30 | data[self.__name] = value 31 | print(data) 32 | file.seek(0) 33 | json.dump(data, file, indent=4) 34 | file.truncate() 35 | -------------------------------------------------------------------------------- /providers/apikeys.json: -------------------------------------------------------------------------------- 1 | { 2 | "here": "", 3 | "openrouteservice": "", 4 | "tomtom": "hpygzp67548xfpk69qsfwqng", 5 | "graphhopper": "f2b4cb43-64dd-46f5-94a5-3212fdbbd65e", 6 | "yandex": "" 7 | } -------------------------------------------------------------------------------- /providers/flexpolyline.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2019 HERE Europe B.V. 2 | # Licensed under MIT, see full license in LICENSE 3 | # SPDX-License-Identifier: MIT 4 | # License-Filename: LICENSE 5 | 6 | # Simplified from https://github.com/heremaps/flexible-polyline/tree/master/python/flexpolyline 7 | 8 | from collections import namedtuple 9 | 10 | ABSENT = 0 11 | LEVEL = 1 12 | ALTITUDE = 2 13 | ELEVATION = 3 14 | RESERVED1 = 4 # Reserved for future types 15 | RESERVED2 = 5 # Reserved for future types 16 | CUSTOM1 = 6 17 | CUSTOM2 = 7 18 | 19 | __THIRD_DIM_MAP = { 20 | ALTITUDE: 'alt', 21 | ELEVATION: 'elv', 22 | LEVEL: 'lvl', 23 | RESERVED1: 'rsv1', 24 | RESERVED2: 'rsv2', 25 | CUSTOM1: 'cst1', 26 | CUSTOM2: 'cst2', 27 | } 28 | 29 | __FORMAT_VERSION = 1 30 | 31 | __DECODING_TABLE = [ 32 | 62, -1, -1, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 33 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 34 | 22, 23, 24, 25, -1, -1, -1, -1, 63, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 35 | 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 36 | ] 37 | 38 | 39 | __PolylineHeader = namedtuple('PolylineHeader', 'precision,third_dim,third_dim_precision') 40 | 41 | 42 | def __decode_header(decoder): 43 | """Decode the polyline header from an `encoded_char`. Returns a PolylineHeader object.""" 44 | version = next(decoder) 45 | if version != __FORMAT_VERSION: 46 | raise ValueError('Invalid format version') 47 | value = next(decoder) 48 | precision = value & 15 49 | value >>= 4 50 | third_dim = value & 7 51 | third_dim_precision = (value >> 3) & 15 52 | return __PolylineHeader(precision, third_dim, third_dim_precision) 53 | 54 | 55 | def __get_third_dimension(encoded): 56 | """Return the third dimension of an encoded polyline. 57 | Possible returned values are: ABSENT, LEVEL, ALTITUDE, ELEVATION, CUSTOM1, CUSTOM2.""" 58 | header = __decode_header(__decode_unsigned_values(encoded)) 59 | return header.third_dim 60 | 61 | 62 | def __decode_char(char): 63 | """Decode a single char to the corresponding value""" 64 | char_value = ord(char) 65 | 66 | try: 67 | value = __DECODING_TABLE[char_value - 45] 68 | except IndexError: 69 | raise ValueError('Invalid encoding') 70 | if value < 0: 71 | raise ValueError('Invalid encoding') 72 | return value 73 | 74 | 75 | def __to_signed(value): 76 | """Decode the sign from an unsigned value""" 77 | if value & 1: 78 | value = ~value 79 | value >>= 1 80 | return value 81 | 82 | 83 | def __decode_unsigned_values(encoded): 84 | """Return an iterator over encoded unsigned values part of an `encoded` polyline""" 85 | result = shift = 0 86 | 87 | for char in encoded: 88 | value = __decode_char(char) 89 | 90 | result |= (value & 0x1F) << shift 91 | if (value & 0x20) == 0: 92 | yield result 93 | result = shift = 0 94 | else: 95 | shift += 5 96 | 97 | if shift > 0: 98 | raise ValueError('Invalid encoding') 99 | 100 | 101 | def __iter_decode(encoded): 102 | """Return an iterator over coordinates. The number of coordinates are 2 or 3 103 | depending on the polyline content.""" 104 | 105 | last_lat = last_lng = last_z = 0 106 | decoder = __decode_unsigned_values(encoded) 107 | 108 | header = __decode_header(decoder) 109 | factor_degree = 10.0 ** header.precision 110 | factor_z = 10.0 ** header.third_dim_precision 111 | third_dim = header.third_dim 112 | 113 | while True: 114 | try: 115 | last_lat += __to_signed(next(decoder)) 116 | except StopIteration: 117 | return # sequence completed 118 | 119 | try: 120 | last_lng += __to_signed(next(decoder)) 121 | 122 | if third_dim: 123 | last_z += __to_signed(next(decoder)) 124 | yield (last_lat / factor_degree, last_lng / factor_degree, last_z / factor_z) 125 | else: 126 | yield (last_lat / factor_degree, last_lng / factor_degree) 127 | except StopIteration: 128 | raise ValueError("Invalid encoding. Premature ending reached") 129 | 130 | 131 | def decode(encoded): 132 | """Return a list of coordinates. The number of coordinates are 2 or 3 133 | depending on the polyline content.""" 134 | return list(__iter_decode(encoded)) 135 | -------------------------------------------------------------------------------- /providers/graphhopper.py: -------------------------------------------------------------------------------- 1 | import json 2 | from urllib.request import urlopen 3 | 4 | from .abstract_provider import AbstractProvider 5 | 6 | 7 | class GraphHopper(AbstractProvider): 8 | 9 | def __init__(self): 10 | super().__init__('GraphHopper Directions API', 'graphhopper') 11 | 12 | def solve(self, start_point, end_point): 13 | url = 'https://graphhopper.com/api/1/route?point={0}&point={1}' \ 14 | '&profile=car&locale=en&calc_points=true&points_encoded=false&instructions=false&key={2}' \ 15 | .format(start_point, end_point, super().get_apikey()) 16 | response = urlopen(url).read().decode("utf-8") 17 | 18 | response_data = json.loads(response) 19 | coordinates = response_data['paths'][0]['points']['coordinates'] 20 | 21 | useful_coordinates = [] 22 | for i in coordinates: 23 | useful_coordinates.append(" ".join(map(str, i))) 24 | 25 | wkt = 'LineString(%s)' % (','.join(useful_coordinates)) 26 | return wkt 27 | -------------------------------------------------------------------------------- /providers/here.py: -------------------------------------------------------------------------------- 1 | import json 2 | from urllib.request import urlopen 3 | 4 | from .abstract_provider import AbstractProvider 5 | from .flexpolyline import decode 6 | 7 | 8 | class Here(AbstractProvider): 9 | 10 | def __init__(self): 11 | super().__init__('HERE Routing API', 'here') 12 | 13 | def solve(self, start_point, end_point): 14 | url = 'https://router.hereapi.com/v8/routes?transportMode=car&traffic=enabled&origin={0}&destination={1}&return=polyline&apiKey={2}' \ 15 | .format(start_point, end_point, super().get_apikey()) 16 | response = urlopen(url).read().decode("utf-8") 17 | 18 | response_data = json.loads(response) 19 | encoded_polyline = response_data['routes'][0]['sections'][0]['polyline'] 20 | decoded_polyline = decode(encoded_polyline) 21 | print(decoded_polyline) 22 | 23 | useful_coordinates = [] 24 | for i in decoded_polyline: 25 | useful_coordinates.append('{0} {1} '.format(i[1], i[0])) 26 | 27 | wkt = 'LineString(%s)' % (','.join(useful_coordinates)) 28 | return wkt 29 | -------------------------------------------------------------------------------- /providers/openrouteservice.py: -------------------------------------------------------------------------------- 1 | import json 2 | from urllib.request import urlopen 3 | 4 | from .abstract_provider import AbstractProvider 5 | 6 | 7 | class Openrouteservice(AbstractProvider): 8 | 9 | def __init__(self): 10 | super().__init__('Openrouteservice Directions API', 'openrouteservice') 11 | 12 | def solve(self, start_point, end_point): 13 | start_point = ','.join(start_point.split(',')[::-1]) 14 | end_point = ','.join(end_point.split(',')[::-1]) 15 | url = 'https://api.openrouteservice.org/v2/directions/driving-car?start={0}&end={1}&api_key={2}' \ 16 | .format(start_point, end_point, super().get_apikey()) 17 | 18 | response = urlopen(url).read().decode("utf-8") 19 | 20 | response_data = json.loads(response) 21 | coordinates = response_data['features'][0]['geometry']['coordinates'] 22 | 23 | useful_coordinates = [] 24 | for i in coordinates: 25 | useful_coordinates.append(" ".join(map(str, i))) 26 | 27 | wkt = 'LineString(%s)' % (','.join(useful_coordinates)) 28 | return wkt 29 | -------------------------------------------------------------------------------- /providers/tomtom.py: -------------------------------------------------------------------------------- 1 | import json 2 | from urllib.request import urlopen 3 | 4 | from .abstract_provider import AbstractProvider 5 | 6 | 7 | class TomTom(AbstractProvider): 8 | 9 | def __init__(self): 10 | super().__init__('TomTom Routing API', 'tomtom') 11 | 12 | def solve(self, start_point, end_point): 13 | url = 'https://api.tomtom.com/routing/1/calculateRoute/{0}:{1}/jsonp?key={2}&traffic=true'\ 14 | .format(start_point, end_point, super().get_apikey()) 15 | response = urlopen(url).read().decode("utf-8") 16 | 17 | response_data = json.loads(response[9:-1]) 18 | coors = response_data['routes'][0]['legs'][0]['points'] 19 | 20 | useful_coor_list = [] 21 | for i in coors: 22 | useful_coor_list.extend([i['longitude'], i['latitude']]) 23 | 24 | coor_pair = [useful_coor_list[i:i + 2] for i in range(0, len(useful_coor_list), 2)] 25 | useful_poly = [] 26 | for i in coor_pair: 27 | useful_poly.append(" ".join(map(str, i))) 28 | wkt = 'LineString(%s)' % (','.join(useful_poly)) 29 | return wkt 30 | -------------------------------------------------------------------------------- /providers/yandex.py: -------------------------------------------------------------------------------- 1 | import json 2 | from urllib.request import urlopen 3 | 4 | from .abstract_provider import AbstractProvider 5 | 6 | 7 | class Yandex(AbstractProvider): 8 | 9 | def __init__(self): 10 | super().__init__('Yandex.Routing', 'yandex') 11 | 12 | def solve(self, start_point, end_point): 13 | url = 'https://api.routing.yandex.net/v2/route?waypoints={0}|{1}&mode=driving&apikey={2}'\ 14 | .format(start_point, end_point, super().get_apikey()) 15 | 16 | response = urlopen(url).read().decode("utf-8") 17 | 18 | response_data = json.loads(response) 19 | steps = response_data['route']['legs'][0]['steps'] 20 | 21 | useful_coor_list = [] 22 | for i in steps: 23 | points = i['polyline']['points'] 24 | for j in points: 25 | j.reverse() 26 | useful_coor_list.extend(j) 27 | 28 | coor_pair = [useful_coor_list[i:i + 2] for i in range(0, len(useful_coor_list), 2)] 29 | useful_poly = [] 30 | for i in coor_pair: 31 | useful_poly.append(" ".join(map(str, i))) 32 | wkt = 'LineString(%s)' % (','.join(useful_poly)) 33 | return wkt -------------------------------------------------------------------------------- /pylintrc: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | 3 | # Specify a configuration file. 4 | #rcfile= 5 | 6 | # Python code to execute, usually for sys.path manipulation such as 7 | # pygtk.require(). 8 | #init-hook= 9 | 10 | # Profiled execution. 11 | profile=no 12 | 13 | # Add files or directories to the blacklist. They should be base names, not 14 | # paths. 15 | ignore=CVS 16 | 17 | # Pickle collected data for later comparisons. 18 | persistent=yes 19 | 20 | # List of plugins (as comma separated values of python modules names) to load, 21 | # usually to register additional checkers. 22 | load-plugins= 23 | 24 | 25 | [MESSAGES CONTROL] 26 | 27 | # Enable the message, report, category or checker with the given id(s). You can 28 | # either give multiple identifier separated by comma (,) or put this option 29 | # multiple time. See also the "--disable" option for examples. 30 | #enable= 31 | 32 | # Disable the message, report, category or checker with the given id(s). You 33 | # can either give multiple identifiers separated by comma (,) or put this 34 | # option multiple times (only on the command line, not in the configuration 35 | # file where it should appear only once).You can also use "--disable=all" to 36 | # disable everything first and then reenable specific checks. For example, if 37 | # you want to run only the similarities checker, you can use "--disable=all 38 | # --enable=similarities". If you want to run only the classes checker, but have 39 | # no Warning level messages displayed, use"--disable=all --enable=classes 40 | # --disable=W" 41 | # see http://stackoverflow.com/questions/21487025/pylint-locally-defined-disables-still-give-warnings-how-to-suppress-them 42 | disable=locally-disabled,C0103 43 | 44 | 45 | [REPORTS] 46 | 47 | # Set the output format. Available formats are text, parseable, colorized, msvs 48 | # (visual studio) and html. You can also give a reporter class, eg 49 | # mypackage.mymodule.MyReporterClass. 50 | output-format=text 51 | 52 | # Put messages in a separate file for each module / package specified on the 53 | # command line instead of printing them on stdout. Reports (if any) will be 54 | # written in a file name "pylint_global.[txt|html]". 55 | files-output=no 56 | 57 | # Tells whether to display a full report or only the messages 58 | reports=yes 59 | 60 | # Python expression which should return a note less than 10 (10 is the highest 61 | # note). You have access to the variables errors warning, statement which 62 | # respectively contain the number of errors / warnings messages and the total 63 | # number of statements analyzed. This is used by the global evaluation report 64 | # (RP0004). 65 | evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) 66 | 67 | # Add a comment according to your evaluation note. This is used by the global 68 | # evaluation report (RP0004). 69 | comment=no 70 | 71 | # Template used to display messages. This is a python new-style format string 72 | # used to format the message information. See doc for all details 73 | #msg-template= 74 | 75 | 76 | [BASIC] 77 | 78 | # Required attributes for module, separated by a comma 79 | required-attributes= 80 | 81 | # List of builtins function names that should not be used, separated by a comma 82 | bad-functions=map,filter,apply,input 83 | 84 | # Regular expression which should only match correct module names 85 | module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ 86 | 87 | # Regular expression which should only match correct module level names 88 | const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ 89 | 90 | # Regular expression which should only match correct class names 91 | class-rgx=[A-Z_][a-zA-Z0-9]+$ 92 | 93 | # Regular expression which should only match correct function names 94 | function-rgx=[a-z_][a-z0-9_]{2,30}$ 95 | 96 | # Regular expression which should only match correct method names 97 | method-rgx=[a-z_][a-z0-9_]{2,30}$ 98 | 99 | # Regular expression which should only match correct instance attribute names 100 | attr-rgx=[a-z_][a-z0-9_]{2,30}$ 101 | 102 | # Regular expression which should only match correct argument names 103 | argument-rgx=[a-z_][a-z0-9_]{2,30}$ 104 | 105 | # Regular expression which should only match correct variable names 106 | variable-rgx=[a-z_][a-z0-9_]{2,30}$ 107 | 108 | # Regular expression which should only match correct attribute names in class 109 | # bodies 110 | class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ 111 | 112 | # Regular expression which should only match correct list comprehension / 113 | # generator expression variable names 114 | inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ 115 | 116 | # Good variable names which should always be accepted, separated by a comma 117 | good-names=i,j,k,ex,Run,_ 118 | 119 | # Bad variable names which should always be refused, separated by a comma 120 | bad-names=foo,bar,baz,toto,tutu,tata 121 | 122 | # Regular expression which should only match function or class names that do 123 | # not require a docstring. 124 | no-docstring-rgx=__.*__ 125 | 126 | # Minimum line length for functions/classes that require docstrings, shorter 127 | # ones are exempt. 128 | docstring-min-length=-1 129 | 130 | 131 | [MISCELLANEOUS] 132 | 133 | # List of note tags to take in consideration, separated by a comma. 134 | notes=FIXME,XXX,TODO 135 | 136 | 137 | [TYPECHECK] 138 | 139 | # Tells whether missing members accessed in mixin class should be ignored. A 140 | # mixin class is detected if its name ends with "mixin" (case insensitive). 141 | ignore-mixin-members=yes 142 | 143 | # List of classes names for which member attributes should not be checked 144 | # (useful for classes with attributes dynamically set). 145 | ignored-classes=SQLObject 146 | 147 | # When zope mode is activated, add a predefined set of Zope acquired attributes 148 | # to generated-members. 149 | zope=no 150 | 151 | # List of members which are set dynamically and missed by pylint inference 152 | # system, and so shouldn't trigger E0201 when accessed. Python regular 153 | # expressions are accepted. 154 | generated-members=REQUEST,acl_users,aq_parent 155 | 156 | 157 | [VARIABLES] 158 | 159 | # Tells whether we should check for unused import in __init__ files. 160 | init-import=no 161 | 162 | # A regular expression matching the beginning of the name of dummy variables 163 | # (i.e. not used). 164 | dummy-variables-rgx=_$|dummy 165 | 166 | # List of additional names supposed to be defined in builtins. Remember that 167 | # you should avoid to define new builtins when possible. 168 | additional-builtins= 169 | 170 | 171 | [FORMAT] 172 | 173 | # Maximum number of characters on a single line. 174 | max-line-length=80 175 | 176 | # Regexp for a line that is allowed to be longer than the limit. 177 | ignore-long-lines=^\s*(# )??$ 178 | 179 | # Allow the body of an if to be on the same line as the test if there is no 180 | # else. 181 | single-line-if-stmt=no 182 | 183 | # List of optional constructs for which whitespace checking is disabled 184 | no-space-check=trailing-comma,dict-separator 185 | 186 | # Maximum number of lines in a module 187 | max-module-lines=1000 188 | 189 | # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 190 | # tab). 191 | indent-string=' ' 192 | 193 | 194 | [SIMILARITIES] 195 | 196 | # Minimum lines number of a similarity. 197 | min-similarity-lines=4 198 | 199 | # Ignore comments when computing similarities. 200 | ignore-comments=yes 201 | 202 | # Ignore docstrings when computing similarities. 203 | ignore-docstrings=yes 204 | 205 | # Ignore imports when computing similarities. 206 | ignore-imports=no 207 | 208 | 209 | [IMPORTS] 210 | 211 | # Deprecated modules which should not be used, separated by a comma 212 | deprecated-modules=regsub,TERMIOS,Bastion,rexec 213 | 214 | # Create a graph of every (i.e. internal and external) dependencies in the 215 | # given file (report RP0402 must not be disabled) 216 | import-graph= 217 | 218 | # Create a graph of external dependencies in the given file (report RP0402 must 219 | # not be disabled) 220 | ext-import-graph= 221 | 222 | # Create a graph of internal dependencies in the given file (report RP0402 must 223 | # not be disabled) 224 | int-import-graph= 225 | 226 | 227 | [DESIGN] 228 | 229 | # Maximum number of arguments for function / method 230 | max-args=5 231 | 232 | # Argument names that match this expression will be ignored. Default to name 233 | # with leading underscore 234 | ignored-argument-names=_.* 235 | 236 | # Maximum number of locals for function / method body 237 | max-locals=15 238 | 239 | # Maximum number of return / yield for function / method body 240 | max-returns=6 241 | 242 | # Maximum number of branch for function / method body 243 | max-branches=12 244 | 245 | # Maximum number of statements in function / method body 246 | max-statements=50 247 | 248 | # Maximum number of parents for a class (see R0901). 249 | max-parents=7 250 | 251 | # Maximum number of attributes for a class (see R0902). 252 | max-attributes=7 253 | 254 | # Minimum number of public methods for a class (see R0903). 255 | min-public-methods=2 256 | 257 | # Maximum number of public methods for a class (see R0904). 258 | max-public-methods=20 259 | 260 | 261 | [CLASSES] 262 | 263 | # List of interface methods to ignore, separated by a comma. This is used for 264 | # instance to not check methods defines in Zope's Interface base class. 265 | ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by 266 | 267 | # List of method names used to declare (i.e. assign) instance attributes. 268 | defining-attr-methods=__init__,__new__,setUp 269 | 270 | # List of valid names for the first argument in a class method. 271 | valid-classmethod-first-arg=cls 272 | 273 | # List of valid names for the first argument in a metaclass class method. 274 | valid-metaclass-classmethod-first-arg=mcs 275 | 276 | 277 | [EXCEPTIONS] 278 | 279 | # Exceptions that will emit a warning when being caught. Defaults to 280 | # "Exception" 281 | overgeneral-exceptions=Exception 282 | -------------------------------------------------------------------------------- /resources.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Resource object code 4 | # 5 | # Created by: The Resource Compiler for PyQt5 (Qt v5.9.5) 6 | # 7 | # WARNING! All changes made in this file will be lost! 8 | 9 | from PyQt5 import QtCore 10 | 11 | qt_resource_data = b"\ 12 | \x00\x00\x0a\xe0\ 13 | \x89\ 14 | \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ 15 | \x00\x00\x39\x00\x00\x00\x39\x08\x06\x00\x00\x00\x8c\x18\x83\x85\ 16 | \x00\x00\x00\x04\x73\x42\x49\x54\x08\x08\x08\x08\x7c\x08\x64\x88\ 17 | \x00\x00\x00\x09\x70\x48\x59\x73\x00\x00\x01\x3b\x00\x00\x01\x3b\ 18 | \x01\x1f\xdf\x6f\x71\x00\x00\x00\x19\x74\x45\x58\x74\x53\x6f\x66\ 19 | \x74\x77\x61\x72\x65\x00\x77\x77\x77\x2e\x69\x6e\x6b\x73\x63\x61\ 20 | \x70\x65\x2e\x6f\x72\x67\x9b\xee\x3c\x1a\x00\x00\x0a\x5d\x49\x44\ 21 | \x41\x54\x68\x81\xed\x9a\x7b\x70\x54\xd5\x1d\xc7\x3f\xf7\xde\xdd\ 22 | \xec\x66\xf3\x7e\xbf\x20\x21\x0f\x44\x45\x88\xbc\x44\x05\x11\x1f\ 23 | \x08\x48\x05\x1f\x41\x11\x47\x65\xe8\x58\xa9\xf5\xd5\x76\x94\xea\ 24 | \x30\x8e\x4c\x6d\xa5\xad\xa2\x68\x7d\x0c\x45\x2d\xb4\xc8\x0c\x4a\ 25 | \x45\xd1\x60\x45\x69\x50\x8a\xa0\x54\x10\x04\xc1\x84\x3c\x20\x09\ 26 | \xc9\x26\xd9\xbc\x76\x37\xfb\xbc\xb7\x7f\xdc\xec\x72\xf7\x91\xcd\ 27 | \x6e\xb4\x42\x67\xf2\x9d\x39\x7f\x9c\xdf\x79\xfc\x7e\xdf\x7b\xce\ 28 | \xf9\x9d\xdf\x39\xe7\xc2\x30\x86\x31\x8c\x73\x09\xc2\xd9\x36\xa0\ 29 | \x1f\x26\x20\xb1\x3f\xb9\x80\x56\xc0\x7d\x56\x2d\xfa\x81\x30\x1e\ 30 | \x58\x0d\x1c\x02\xbc\x80\xa2\x49\x32\xd0\x08\x6c\x00\x6e\x06\x74\ 31 | \x67\xc9\xc6\x21\xe3\x6a\x60\x17\x81\xa4\x06\x4b\x8d\xc0\x03\xfc\ 32 | \x1f\x90\x35\x00\xaf\xa2\x8e\x52\x2c\x04\xb5\xe9\x10\x70\x41\xac\ 33 | \x8a\x7f\xac\x35\x99\x02\xbc\x03\x5c\x15\x5c\xa0\xcb\x4e\x20\x61\ 34 | \x76\x19\xc6\xf2\x1c\xc4\x24\x03\xde\xce\x3e\xdc\x75\x5d\x38\xbe\ 35 | \x6e\xa1\x6f\x5f\x13\x28\x4a\x70\x93\x5e\xe0\x56\xe0\xc3\x68\x95\ 36 | \xff\x18\x24\x93\x80\x1d\xc0\x54\xad\x30\x7e\x4a\x01\x19\xcb\xa7\ 37 | \x91\x34\x7f\x0c\x82\x5e\x0a\xdb\xd0\x55\x63\xa1\xe3\xb9\xcf\xe9\ 38 | \x7a\xed\x00\x8a\xd3\xa3\x2d\xea\x03\xe6\x01\xff\x8a\xc6\x80\x1f\ 39 | \x8a\xe4\x28\x60\x0e\x30\x1d\x18\x81\xea\x25\xfb\x80\x76\x20\x07\ 40 | \xb8\xcc\xaf\x50\x27\x92\xf3\xec\x6c\xd2\xef\xbf\x04\xc4\xe8\xd4\ 41 | \x3b\x0e\xb5\xd2\xb4\x78\x0b\xce\x23\x66\xad\xb8\x03\x98\x08\x9c\ 42 | \x1c\xac\xfd\xf7\x25\x79\x0d\xf0\x14\x70\x69\x34\x95\x05\x83\x8e\ 43 | \x91\x5b\x17\x91\x38\xa7\x2c\x66\x45\xde\x2e\x07\xa7\x6e\x78\x13\ 44 | \xfb\xee\x00\x4e\x55\x84\x59\x02\xc1\x10\x63\xd6\xa6\x22\x13\xd8\ 45 | \x0e\x7c\x4c\x94\x04\x01\xf2\xd7\xde\x30\x24\x82\x00\x52\xaa\x91\ 46 | \x91\x5b\x17\xa1\x2f\x4a\xd5\x8a\x67\x02\x15\x83\xb5\x1d\x0a\xc9\ 47 | \x32\x60\x2f\xea\xf4\x0c\x80\x10\xaf\x27\xae\x34\x1d\xe3\xa4\x7c\ 48 | \x74\x79\x49\x01\x65\xc9\xb7\x5d\x44\xca\x5d\xe5\x43\x50\x77\x06\ 49 | \x52\x86\x89\xfc\xd7\x17\x80\x10\x30\x01\x7f\x33\x58\xbb\x58\xa7\ 50 | \x6b\x36\xb0\x07\x28\xd5\x0a\x13\x66\x8e\x22\xed\xbe\x29\xaa\x13\ 51 | \x31\x9c\xd9\xca\xbc\x9d\x7d\xf4\xbe\x73\x8c\x9e\xcd\x47\xc8\x7f\ 52 | \x7d\x01\xba\xfc\x24\x7e\x08\x9c\x9a\xbf\x89\xde\x6d\xc7\xb5\xa2\ 53 | \x29\xc0\xfe\x81\xea\xc7\x42\x52\x44\x5d\x03\x57\xf8\x04\x52\x86\ 54 | \x89\xdc\x17\xe7\x92\x72\xfb\xb8\x18\xcd\x8c\x0e\x8a\xd3\x83\xc7\ 55 | \x6c\xc3\xd3\xd4\x8b\xc7\x6c\x43\x3f\x2a\x15\xe3\xf8\x1c\xac\xdb\ 56 | \xab\x39\x79\xfd\x46\x6d\xd5\xdf\x01\x2b\x06\xea\x27\x96\x08\x62\ 57 | \x09\x5a\x82\xa9\x46\x8a\x76\xdc\x89\x71\x42\x1e\x00\x3d\x6f\x1f\ 58 | \xc5\x70\x41\x26\x86\xb1\xd9\x51\x75\xe6\x6d\xb7\xd3\xb7\xbf\x19\ 59 | \xaf\xd9\x86\xa7\xd5\x8a\xbb\xb9\x17\x4f\x8b\x15\x4f\x43\x37\x9e\ 60 | \x56\x2b\x1e\xb3\x0d\xd9\xea\x3a\xd3\x40\x14\x28\x3b\x76\x3f\x00\ 61 | \x09\xd7\x94\x20\x26\xc6\x69\xcb\xa7\x47\xd2\x15\x2d\x49\x09\x78\ 62 | \x5c\x2b\x28\x78\xf3\x16\x3f\x41\x50\x49\xf6\xbe\x7b\x8c\x82\xd7\ 63 | \x17\x90\x1c\xc5\xc8\x8a\x89\x71\xb4\x3e\xba\x03\xe7\xe1\x56\x04\ 64 | \x83\x04\x5e\x05\xc5\x23\x87\xad\x2b\x48\x22\x89\x3f\x39\x8f\xb8\ 65 | \xd1\x19\x6a\x3e\x4e\xc2\x38\x21\x0f\xfb\x67\x0d\xbe\x2a\x39\x11\ 66 | \x75\x0d\x6a\x8d\x8a\x59\x68\xd6\x61\x72\xc5\x85\x24\xce\x1d\x1d\ 67 | \x50\xc1\x75\xbc\x1d\xc5\xe1\xe1\xf4\x7d\x1f\xd0\xb8\x70\x33\x4a\ 68 | \x5f\xe4\x43\x84\x60\xd4\x31\xf2\x1f\xb7\x21\xc4\xeb\x50\x5c\xf2\ 69 | \x80\x04\x01\x14\xaf\x4c\xe6\x8a\x19\x01\x32\x29\xcd\xa8\xcd\x26\ 70 | \x44\xd2\x15\x2d\xc9\x00\x37\x9d\xf1\xe8\xb4\x90\x0a\xee\xc6\x1e\ 71 | \x40\xdd\xcf\x7a\x2b\xab\x39\x71\xf1\xab\xb8\xeb\xbb\x22\x76\x1a\ 72 | \x57\x96\x4e\xee\xea\x39\x11\x3d\x83\x20\x89\x98\x66\x14\x11\x3f\ 73 | \x39\x3f\x62\x57\x91\x0a\xa3\x25\xe9\xdf\x0b\xe3\x4a\xd2\x42\x14\ 74 | \x2a\x1e\x19\xc5\xe5\x3d\x93\xb7\xbb\x71\xd5\x58\xa8\x9d\xbc\x16\ 75 | \xfb\xae\x06\x22\x21\x6d\xd9\x64\x12\xaf\x2b\x1d\x30\xfa\x51\xbc\ 76 | \x32\x99\x8f\x5d\x11\x22\xf7\x76\x3b\xb5\xd9\x88\x3c\xa2\x25\xe9\ 77 | \x9f\xaa\xc6\x09\x79\xc1\xfb\x14\xee\x86\xae\xd0\xf8\x53\x56\x50\ 78 | \x9c\x1e\x9a\x97\x6e\xf5\x8f\x72\x38\xd8\xaa\xea\x71\x1e\x36\x83\ 79 | \x1c\x12\x88\x83\x28\x60\x18\x9b\x15\x12\x40\x28\x2e\x2f\x8e\xfd\ 80 | \xcd\x5a\x51\x16\xb0\x09\xf5\x20\x10\x82\x68\x1c\x8f\x80\x7a\x4c\ 81 | \x52\x33\x26\x7d\x48\x05\xd7\x89\x4e\x90\x65\xbf\x61\xc8\x0a\x89\ 82 | \x73\xcb\xc8\xfe\xed\xd5\x18\x27\x85\x9f\x66\x8a\xcb\x4b\xeb\x23\ 83 | \x1f\x61\x79\xf1\x8b\x70\x27\x8d\xfe\x4a\x90\xb9\x3c\xd4\x71\xf6\ 84 | \x7d\xd9\x84\x6c\x73\x05\x8b\x17\xa1\xee\x97\x15\xc0\x41\x6d\x41\ 85 | \xa4\x91\x14\x80\x05\xc0\x16\x34\xab\x46\xee\x71\x86\x54\x74\xd7\ 86 | \x76\x22\xdb\xdc\x48\xe9\xf1\x24\xcd\x56\xbf\xba\xe1\xfc\xac\x01\ 87 | \x09\xba\x8e\xb7\x53\x77\xf9\x6b\x58\x5e\xd8\xa7\x12\x14\x05\x32\ 88 | \x97\x4f\x27\xfd\xe7\x53\x10\x74\x67\x4c\xd2\xe5\x25\x92\xbc\xe8\ 89 | \xa2\x90\xf6\xf1\x53\x0a\x28\xf8\xfb\xcd\xc4\x4f\x1d\x11\x5c\x54\ 90 | \x8a\x7a\xe2\x19\x13\x4c\x24\x1c\xca\x81\xbf\xa0\x7e\x99\x00\x18\ 91 | \xcb\x73\x29\x39\xb8\x2c\x40\xd6\xb3\xf9\x08\x8a\x57\x26\xf9\x96\ 92 | \x0b\x41\x51\xa8\x2e\x7c\x0e\xc5\xe5\x65\x74\xe3\xaf\x10\x13\x02\ 93 | \x7d\x82\x65\xcd\x5e\x5a\x1f\xfb\xc4\xef\x7d\x75\xf9\x49\x14\xfc\ 94 | \xf5\x46\x12\x66\x95\x22\xdb\x5c\xd4\x96\xbf\x82\xbb\xa1\x1b\x80\ 95 | \xec\xdf\x5f\x43\xc6\x23\xa1\x4e\x4e\x8b\xae\x37\x0e\xd0\xf2\xf0\ 96 | \x87\xc1\x1f\xbf\x1e\xb8\x04\x68\x03\x75\xff\x0b\xc6\x12\x60\x2b\ 97 | \x50\x14\xae\x53\x8f\xd9\x46\xda\xb2\xc9\x88\x89\x67\x8c\x37\x8c\ 98 | \xcd\xc6\x38\x2e\x07\x41\x12\x11\x74\x22\x9e\x76\x3b\xb6\x4f\xea\ 99 | \x88\x2b\x49\xc3\x38\x51\xdd\x4b\xbd\xed\x76\x9a\xee\xd8\x82\xe5\ 100 | \xf9\xbd\xd0\xbf\x5d\x24\xcd\x1f\x43\x51\xe5\x1d\x18\xc6\xa9\xdb\ 101 | \x9c\x10\x27\x61\x9a\x56\x48\xd7\xba\xaf\x10\x0c\x12\x23\x36\x55\ 102 | \x04\x84\x89\xe1\x60\x9c\x90\x47\xd2\x82\xf3\xb1\x6e\xaf\x41\xee\ 103 | \x72\xf8\xc4\xa9\xc0\x48\xd4\x59\x18\x32\x92\xf7\x01\x7f\x0e\x96\ 104 | \xc7\x5f\x52\x40\x72\xc5\x85\x18\xc6\xe5\x20\x26\x1b\x30\x5e\x94\ 105 | \x8d\x98\x6c\x60\x20\xb8\x6a\x3b\xa9\x19\xfd\x02\xc6\xf1\x39\x94\ 106 | \x1c\x58\x86\xb5\xb2\x9a\xe6\xa5\xef\xe2\x69\xb5\x02\x20\x26\xc4\ 107 | \x91\xf7\xf2\xbc\x01\x03\xf6\xf6\x55\xbb\xf1\x5a\xfa\xc8\xf9\xe3\ 108 | \xac\x88\x04\xb5\x70\x9f\xec\xa6\x6e\xca\x5a\x3c\x66\x9b\x56\x3c\ 109 | \x0f\xa8\xd4\x92\x99\x0b\x6c\x43\x33\xba\xc6\x49\xf9\xe4\x3e\x3f\ 110 | \x07\xd3\xf4\xc2\xa8\x95\xf9\x70\x72\xde\x46\xac\x95\xd5\x24\xdf\ 111 | \x3a\x96\x9e\xb7\x8e\xfa\x9d\x8b\x71\x62\x1e\x05\x1b\x6f\xc1\x70\ 112 | \x7e\xe6\xc0\x8d\x65\x05\x6f\x97\x03\x29\x3d\x3e\x26\x9d\xb6\x9d\ 113 | \x75\x34\x5c\xbb\x5e\xbd\x0d\x52\xf1\x39\x70\xb9\x8f\x50\x06\xea\ 114 | \x82\xf5\x1f\x13\x52\xee\x18\x4f\xe1\x7b\xb7\x13\x57\x9c\x16\x93\ 115 | \x22\x1f\xbc\x96\x3e\xac\xdb\x6b\x70\x1e\x69\x53\x05\xa2\x40\xd6\ 116 | \x13\x33\x29\xd8\x70\x13\xba\x9c\xc4\xf0\x6d\xda\xed\x88\x26\x3d\ 117 | \x08\x02\x62\x7c\xa8\x17\x1f\x0c\x71\xc5\x69\x38\xbf\x31\xe3\x3c\ 118 | \xda\xe6\x13\x8d\x04\x3e\xf0\xb9\xb2\x95\xa8\xc7\x28\x40\x5d\x2b\ 119 | \x05\xeb\x6f\x44\x88\x0b\x7f\xf7\x12\x11\xb2\x42\xfb\x1f\x76\xd3\ 120 | \xfa\xe8\x0e\xbf\x48\x4a\x35\x52\xf8\xfe\x62\xb2\x9e\x9c\x39\xe0\ 121 | \x7d\x8e\xb7\xb3\x8f\xba\xcb\xd6\x05\x4f\xb7\x98\x91\xfe\xe0\xd4\ 122 | \x60\xd1\x42\x09\x48\x07\xd6\xd3\x1f\x1a\x49\x99\x26\x8a\x76\x2e\ 123 | \x51\xbf\x68\x8c\xf0\x34\xf7\x72\xaa\x62\x33\x5d\x6b\xff\xe3\x77\ 124 | \x2e\x00\x8a\xc3\x83\xf5\xa3\x5a\x14\x9b\x1b\xe3\xc5\xb9\x88\xc6\ 125 | \x50\x67\xd2\xf1\xcc\x1e\x7a\xb7\x7c\x8b\xeb\x78\xc7\xf7\x3a\xba\ 126 | \xe9\x0b\x53\xb0\xbc\xbc\x1f\xc5\xee\x8f\x9d\xf5\x12\x70\x3b\x9a\ 127 | \xd8\x34\xeb\xb1\x2b\xd4\x30\x2b\x46\xf4\x6e\x3b\xce\xc9\xeb\x37\ 128 | \xe2\x3c\xdc\x0a\x80\x68\xd2\x63\x9c\x90\x87\xe7\xb4\x15\x14\x35\ 129 | \xd4\xb3\xef\xaa\xa7\xfb\x8d\x03\x28\x1e\x19\x63\x79\xae\xdf\x73\ 130 | \xca\x56\x17\x8d\x15\x9b\x51\x9c\x5e\x5c\xdf\x75\xa0\x2f\x4e\xc5\ 131 | \x78\x71\xee\xd0\x58\x0a\x02\xf6\xaa\x7a\x5c\xd5\x16\x9f\xc4\x20\ 132 | \x02\xb3\xfd\x15\x44\x81\x94\xbb\x63\xbb\xa2\x90\x6d\x2e\x9a\xee\ 133 | \x7a\x87\x53\xf3\x37\xe1\x6d\x53\xa7\x9a\x69\x5a\x21\xa5\x47\x7e\ 134 | \x41\xf1\xbe\x7b\x18\x5d\xfb\x10\xe9\x0f\x4e\xf5\xcf\x0c\x8f\xd9\ 135 | \x86\xf9\xf1\x4f\xf8\x2e\xff\x59\x5a\x1e\xda\x8e\xa7\xa9\x07\xcb\ 136 | \x4b\x5f\x68\xbf\x3c\xa7\x97\xbd\x8f\xab\xc6\x12\x56\x5f\x34\xd0\ 137 | \x8f\x48\xd6\x66\xd3\x04\xe0\x0b\xfa\x37\x7d\x7d\x71\x1a\xa3\x6b\ 138 | \x1f\x8a\xba\x33\xc7\x81\xd3\xea\x55\xe1\xb1\x76\x55\x20\x89\x64\ 139 | \xad\x98\x41\xe6\x8a\x19\x01\x91\x0b\x80\xb7\xcd\x86\xe5\xa5\x2f\ 140 | \xb1\xbc\xb0\x0f\x6f\x67\x9f\x5f\xee\x5b\xf7\xda\x00\x5f\xd0\x8b\ 141 | \x18\x27\xe6\x53\xfc\xef\xa5\x20\xc5\x7e\x0d\xd5\xf2\xf0\x87\x58\ 142 | \xd6\xec\xf5\x65\x15\x11\x8d\x47\xd5\x8f\x4c\x0e\xdb\x28\x04\xb2\ 143 | \x42\xdb\x93\x55\xd4\x4d\x5d\xe7\x27\x18\x57\x9a\x4e\xf1\xee\xa5\ 144 | \xaa\x73\xd1\x85\x1a\x26\x65\x25\x90\xf5\xe4\x4c\xca\xbe\x7b\x80\ 145 | \xac\x27\xae\xf4\x6f\x0f\x8a\xcb\x1b\x40\x10\x40\x71\xcb\xf4\x7d\ 146 | \xd9\x44\xc7\x73\x7b\x43\xfa\x89\xca\xbc\xde\x80\xe8\xc7\x21\xa2\ 147 | \xbe\x4d\x00\x84\x35\x2e\x18\xee\xc6\x1e\x1a\x66\x6d\xa0\x6d\x65\ 148 | \x15\x8a\x5b\x35\x2e\xe5\xce\x72\x4a\xbe\xba\x97\xf8\x4b\x43\x62\ 149 | \xc9\x10\x48\x99\x26\xb2\x56\x5e\xc5\x79\xcd\xbf\x26\xff\xb5\x05\ 150 | \x03\xeb\x94\x15\xcc\x8f\x7f\xec\x5f\xe3\xb1\xc0\x5d\xdb\xa9\xcd\ 151 | \xb6\x8a\x80\xff\x1c\xe4\xed\x74\x84\x34\xd0\xa2\x7b\xd3\x61\x6a\ 152 | \xc7\xbd\x8c\x6d\x67\x9d\x6a\x70\x5a\x3c\x23\x36\x2f\xa4\x60\xc3\ 153 | \x4d\x11\x23\xa0\x70\xf0\x39\x1d\x25\xdc\x11\xcb\x07\x05\x1a\x17\ 154 | \x6f\x09\x19\xe9\x48\x90\x6d\x2e\xec\x7b\x1b\xb5\xa2\x83\x22\xea\ 155 | \xb3\x18\x00\xce\xc3\xad\xc1\x43\xad\x36\xb4\xaa\xce\xa5\x69\xf1\ 156 | \x16\xbc\xfd\xf1\xa1\x69\x46\x11\x25\x07\xee\x25\x79\xe1\xd8\xa8\ 157 | \x0d\x08\xb0\xdf\x23\xd3\xb6\xb2\x6a\xd0\x3a\xce\x6f\xdb\x68\x7f\ 158 | \xea\xd3\xa8\xfb\xed\x5a\xf7\x15\x8a\x23\xe0\xdd\xe4\x53\x11\xd8\ 159 | \xad\xed\xb4\x6b\xc3\xd7\x01\x8d\xec\x7b\x4e\x71\x62\xfc\x2b\x74\ 160 | \xff\x4d\x95\x0b\x7a\x89\xec\x55\xd7\x32\x6a\xe7\xdd\xc1\xb7\xd9\ 161 | \x31\xa1\x77\xeb\x31\xdc\x27\xbb\xc3\x1f\x96\xfb\x21\xe8\x44\x50\ 162 | \xa0\xfd\xe9\xcf\x70\x1c\x6c\x19\xb4\x4f\xc5\xed\xa5\x63\xf5\xe7\ 163 | \x5a\x91\x07\xd8\xa4\x43\x8d\xd4\x9f\xa1\xff\x00\xdd\xf1\xa7\x3d\ 164 | \x4a\xda\xcf\x26\x09\xbe\xc8\xa4\xf7\xed\xa3\xb8\xeb\xd4\x39\xae\ 165 | \x2f\x4c\xa1\x60\xc3\x4d\x98\xae\x1c\x35\x24\x62\x5a\xb4\x3f\xfd\ 166 | \x59\x88\x4c\x4c\x36\x20\x65\xc4\xa3\xcb\x4a\x40\x97\x97\x84\x2e\ 167 | \x3b\x01\x29\x3b\x01\x5d\xa6\xc9\x3f\x83\x22\xc1\xbc\xfc\x63\xf5\ 168 | \xc3\x9d\xc1\x5b\x40\x8b\xa0\xc9\xf8\x03\x82\xf4\x07\xa7\x92\xbb\ 169 | \x66\x2e\xa0\x7e\x9d\xfa\x19\x6f\x60\x1c\x9f\x43\xce\x33\xd7\x21\ 170 | \x26\xc5\xb6\xf6\xc2\x41\xb6\xbb\xb1\x56\x56\x23\x65\x9a\xd0\x65\ 171 | \x9a\x90\xfa\x53\x34\x8e\x6f\x20\x74\xad\x3f\x48\xf3\x92\xad\x5a\ 172 | \x91\x13\xf5\xc1\xb6\xce\x47\x72\x0c\x70\x18\xf0\xc7\x72\x39\xab\ 173 | \x67\x93\xf1\x4b\xf5\xc5\x4d\xee\x76\x20\xa6\x04\x5c\x01\x9e\x3b\ 174 | \x50\x14\xda\x57\xed\xc6\xbc\x62\x67\xf0\xd4\x7f\x04\x75\x86\xfa\ 175 | \x8f\x55\x1d\x80\x15\x4d\xf4\x63\xfb\xe7\x09\x9c\xdf\x98\x49\xb8\ 176 | \x6a\x14\x52\xba\xe9\x47\xb2\x38\x36\x38\x0e\xb5\x72\xfa\x9e\xf7\ 177 | \xe8\x7c\x65\xbf\xf6\x78\x05\xf0\x2e\xe0\x8f\x6a\x82\x0f\xcd\x6b\ 178 | \x81\x7b\xb4\x02\xc1\xa8\x23\xf9\xd6\xb1\xa4\xfd\x74\x22\x86\x71\ 179 | \xd1\x3d\x01\xfc\x2f\x21\x77\x3b\xb1\x55\xd5\xd3\xf3\xf6\x51\xac\ 180 | \x95\xd5\xe1\x2e\xc1\xb6\xa1\x5e\x6a\xd9\x07\xea\x43\x04\x5e\x64\ 181 | \xe8\x3f\x2e\x9c\xcd\x24\x03\x6b\x08\x7f\xa5\x13\x16\xb7\x01\x2d\ 182 | \xe7\x80\xe1\xd1\xa6\x1a\xa2\x78\x71\x0e\x87\x34\xd4\xe7\xb0\xa6\ 183 | \x73\x80\x44\xb8\xe4\x01\x3e\x45\xfd\x13\x24\xe2\x6d\x57\x34\xef\ 184 | \x93\x22\x30\x19\x38\x0f\xf5\xa6\x3a\x8b\xa1\x3f\xc3\x0f\x15\x32\ 185 | \xd0\x8d\xba\x2d\xd8\x51\x7f\x4b\xdb\x05\x44\x7e\x6c\x19\xc6\x30\ 186 | \x86\x31\x8c\x61\x0c\x63\x18\xc3\x00\xf8\x2f\x1a\x06\x28\x25\xa2\ 187 | \x6a\xe7\xc1\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\ 188 | " 189 | 190 | qt_resource_name = b"\ 191 | \x00\x07\ 192 | \x07\x3b\xe0\xb3\ 193 | \x00\x70\ 194 | \x00\x6c\x00\x75\x00\x67\x00\x69\x00\x6e\x00\x73\ 195 | \x00\x13\ 196 | \x03\xad\x26\x42\ 197 | \x00\x4f\ 198 | \x00\x6e\x00\x6c\x00\x69\x00\x6e\x00\x65\x00\x52\x00\x6f\x00\x75\x00\x74\x00\x69\x00\x6e\x00\x67\x00\x4d\x00\x61\x00\x70\x00\x70\ 199 | \x00\x65\x00\x72\ 200 | \x00\x08\ 201 | \x0a\x61\x5a\xa7\ 202 | \x00\x69\ 203 | \x00\x63\x00\x6f\x00\x6e\x00\x2e\x00\x70\x00\x6e\x00\x67\ 204 | " 205 | 206 | qt_resource_struct_v1 = b"\ 207 | \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ 208 | \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ 209 | \x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\ 210 | \x00\x00\x00\x40\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ 211 | " 212 | 213 | qt_resource_struct_v2 = b"\ 214 | \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ 215 | \x00\x00\x00\x00\x00\x00\x00\x00\ 216 | \x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\ 217 | \x00\x00\x00\x00\x00\x00\x00\x00\ 218 | \x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\ 219 | \x00\x00\x00\x00\x00\x00\x00\x00\ 220 | \x00\x00\x00\x40\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ 221 | \x00\x00\x01\x5c\x34\x17\x6b\x28\ 222 | " 223 | 224 | qt_version = QtCore.qVersion().split('.') 225 | if qt_version < ['5', '8', '0']: 226 | rcc_version = 1 227 | qt_resource_struct = qt_resource_struct_v1 228 | else: 229 | rcc_version = 2 230 | qt_resource_struct = qt_resource_struct_v2 231 | 232 | def qInitResources(): 233 | QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) 234 | 235 | def qCleanupResources(): 236 | QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data) 237 | 238 | qInitResources() 239 | -------------------------------------------------------------------------------- /resources.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | icon.png 4 | 5 | 6 | -------------------------------------------------------------------------------- /scripts/compile-strings.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | LRELEASE=$1 3 | LOCALES=$2 4 | 5 | 6 | for LOCALE in ${LOCALES} 7 | do 8 | echo "Processing: ${LOCALE}.ts" 9 | # Note we don't use pylupdate with qt .pro file approach as it is flakey 10 | # about what is made available. 11 | $LRELEASE i18n/${LOCALE}.ts 12 | done 13 | -------------------------------------------------------------------------------- /scripts/run-env-linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | QGIS_PREFIX_PATH=/usr/local/qgis-2.0 4 | if [ -n "$1" ]; then 5 | QGIS_PREFIX_PATH=$1 6 | fi 7 | 8 | echo ${QGIS_PREFIX_PATH} 9 | 10 | 11 | export QGIS_PREFIX_PATH=${QGIS_PREFIX_PATH} 12 | export QGIS_PATH=${QGIS_PREFIX_PATH} 13 | export LD_LIBRARY_PATH=${QGIS_PREFIX_PATH}/lib 14 | export PYTHONPATH=${QGIS_PREFIX_PATH}/share/qgis/python:${QGIS_PREFIX_PATH}/share/qgis/python/plugins:${PYTHONPATH} 15 | 16 | echo "QGIS PATH: $QGIS_PREFIX_PATH" 17 | export QGIS_DEBUG=0 18 | export QGIS_LOG_FILE=/tmp/inasafe/realtime/logs/qgis.log 19 | 20 | export PATH=${QGIS_PREFIX_PATH}/bin:$PATH 21 | 22 | echo "This script is intended to be sourced to set up your shell to" 23 | echo "use a QGIS 2.0 built in $QGIS_PREFIX_PATH" 24 | echo 25 | echo "To use it do:" 26 | echo "source $BASH_SOURCE /your/optional/install/path" 27 | echo 28 | echo "Then use the make file supplied here e.g. make guitest" 29 | -------------------------------------------------------------------------------- /scripts/update-strings.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | LOCALES=$* 3 | 4 | # Get newest .py files so we don't update strings unnecessarily 5 | 6 | CHANGED_FILES=0 7 | PYTHON_FILES=`find . -regex ".*\(ui\|py\)$" -type f` 8 | for PYTHON_FILE in $PYTHON_FILES 9 | do 10 | CHANGED=$(stat -c %Y $PYTHON_FILE) 11 | if [ ${CHANGED} -gt ${CHANGED_FILES} ] 12 | then 13 | CHANGED_FILES=${CHANGED} 14 | fi 15 | done 16 | 17 | # Qt translation stuff 18 | # for .ts file 19 | UPDATE=false 20 | for LOCALE in ${LOCALES} 21 | do 22 | TRANSLATION_FILE="i18n/$LOCALE.ts" 23 | if [ ! -f ${TRANSLATION_FILE} ] 24 | then 25 | # Force translation string collection as we have a new language file 26 | touch ${TRANSLATION_FILE} 27 | UPDATE=true 28 | break 29 | fi 30 | 31 | MODIFICATION_TIME=$(stat -c %Y ${TRANSLATION_FILE}) 32 | if [ ${CHANGED_FILES} -gt ${MODIFICATION_TIME} ] 33 | then 34 | # Force translation string collection as a .py file has been updated 35 | UPDATE=true 36 | break 37 | fi 38 | done 39 | 40 | if [ ${UPDATE} == true ] 41 | # retrieve all python files 42 | then 43 | echo ${PYTHON_FILES} 44 | # update .ts 45 | echo "Please provide translations by editing the translation files below:" 46 | for LOCALE in ${LOCALES} 47 | do 48 | echo "i18n/"${LOCALE}".ts" 49 | # Note we don't use pylupdate with qt .pro file approach as it is flakey 50 | # about what is made available. 51 | pylupdate4 -noobsolete ${PYTHON_FILES} -ts i18n/${LOCALE}.ts 52 | done 53 | else 54 | echo "No need to edit any translation files (.ts) because no python files" 55 | echo "has been updated since the last update translation. " 56 | fi 57 | -------------------------------------------------------------------------------- /test/__init__.py: -------------------------------------------------------------------------------- 1 | # import qgis libs so that ve set the correct sip api version 2 | import qgis # pylint: disable=W0611 # NOQA -------------------------------------------------------------------------------- /test/qgis_interface.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """QGIS plugin implementation. 3 | 4 | .. note:: This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | .. note:: This source code was copied from the 'postgis viewer' application 10 | with original authors: 11 | Copyright (c) 2010 by Ivan Mincik, ivan.mincik@gista.sk 12 | Copyright (c) 2011 German Carrillo, geotux_tuxman@linuxmail.org 13 | Copyright (c) 2014 Tim Sutton, tim@linfiniti.com 14 | 15 | """ 16 | 17 | __author__ = 'tim@linfiniti.com' 18 | __revision__ = '$Format:%H$' 19 | __date__ = '10/01/2011' 20 | __copyright__ = ( 21 | 'Copyright (c) 2010 by Ivan Mincik, ivan.mincik@gista.sk and ' 22 | 'Copyright (c) 2011 German Carrillo, geotux_tuxman@linuxmail.org' 23 | 'Copyright (c) 2014 Tim Sutton, tim@linfiniti.com' 24 | ) 25 | 26 | import logging 27 | from qgis.PyQt.QtCore import QObject, pyqtSlot, pyqtSignal 28 | from qgis.core import QgsMapLayerRegistry 29 | from qgis.gui import QgsMapCanvasLayer 30 | LOGGER = logging.getLogger('QGIS') 31 | 32 | 33 | #noinspection PyMethodMayBeStatic,PyPep8Naming 34 | class QgisInterface(QObject): 35 | """Class to expose QGIS objects and functions to plugins. 36 | 37 | This class is here for enabling us to run unit tests only, 38 | so most methods are simply stubs. 39 | """ 40 | currentLayerChanged = pyqtSignal(QgsMapCanvasLayer) 41 | 42 | def __init__(self, canvas): 43 | """Constructor 44 | :param canvas: 45 | """ 46 | QObject.__init__(self) 47 | self.canvas = canvas 48 | # Set up slots so we can mimic the behaviour of QGIS when layers 49 | # are added. 50 | LOGGER.debug('Initialising canvas...') 51 | # noinspection PyArgumentList 52 | QgsMapLayerRegistry.instance().layersAdded.connect(self.addLayers) 53 | # noinspection PyArgumentList 54 | QgsMapLayerRegistry.instance().layerWasAdded.connect(self.addLayer) 55 | # noinspection PyArgumentList 56 | QgsMapLayerRegistry.instance().removeAll.connect(self.removeAllLayers) 57 | 58 | # For processing module 59 | self.destCrs = None 60 | 61 | @pyqtSlot('QStringList') 62 | def addLayers(self, layers): 63 | """Handle layers being added to the registry so they show up in canvas. 64 | 65 | :param layers: list list of map layers that were added 66 | 67 | .. note:: The QgsInterface api does not include this method, 68 | it is added here as a helper to facilitate testing. 69 | """ 70 | #LOGGER.debug('addLayers called on qgis_interface') 71 | #LOGGER.debug('Number of layers being added: %s' % len(layers)) 72 | #LOGGER.debug('Layer Count Before: %s' % len(self.canvas.layers())) 73 | current_layers = self.canvas.layers() 74 | final_layers = [] 75 | for layer in current_layers: 76 | final_layers.append(QgsMapCanvasLayer(layer)) 77 | for layer in layers: 78 | final_layers.append(QgsMapCanvasLayer(layer)) 79 | 80 | self.canvas.setLayerSet(final_layers) 81 | #LOGGER.debug('Layer Count After: %s' % len(self.canvas.layers())) 82 | 83 | @pyqtSlot('QgsMapLayer') 84 | def addLayer(self, layer): 85 | """Handle a layer being added to the registry so it shows up in canvas. 86 | 87 | :param layer: list list of map layers that were added 88 | 89 | .. note: The QgsInterface api does not include this method, it is added 90 | here as a helper to facilitate testing. 91 | 92 | .. note: The addLayer method was deprecated in QGIS 1.8 so you should 93 | not need this method much. 94 | """ 95 | pass 96 | 97 | @pyqtSlot() 98 | def removeAllLayers(self): 99 | """Remove layers from the canvas before they get deleted.""" 100 | self.canvas.setLayerSet([]) 101 | 102 | def newProject(self): 103 | """Create new project.""" 104 | # noinspection PyArgumentList 105 | QgsMapLayerRegistry.instance().removeAllMapLayers() 106 | 107 | # ---------------- API Mock for QgsInterface follows ------------------- 108 | 109 | def zoomFull(self): 110 | """Zoom to the map full extent.""" 111 | pass 112 | 113 | def zoomToPrevious(self): 114 | """Zoom to previous view extent.""" 115 | pass 116 | 117 | def zoomToNext(self): 118 | """Zoom to next view extent.""" 119 | pass 120 | 121 | def zoomToActiveLayer(self): 122 | """Zoom to extent of active layer.""" 123 | pass 124 | 125 | def addVectorLayer(self, path, base_name, provider_key): 126 | """Add a vector layer. 127 | 128 | :param path: Path to layer. 129 | :type path: str 130 | 131 | :param base_name: Base name for layer. 132 | :type base_name: str 133 | 134 | :param provider_key: Provider key e.g. 'ogr' 135 | :type provider_key: str 136 | """ 137 | pass 138 | 139 | def addRasterLayer(self, path, base_name): 140 | """Add a raster layer given a raster layer file name 141 | 142 | :param path: Path to layer. 143 | :type path: str 144 | 145 | :param base_name: Base name for layer. 146 | :type base_name: str 147 | """ 148 | pass 149 | 150 | def activeLayer(self): 151 | """Get pointer to the active layer (layer selected in the legend).""" 152 | # noinspection PyArgumentList 153 | layers = QgsMapLayerRegistry.instance().mapLayers() 154 | for item in layers: 155 | return layers[item] 156 | 157 | def addToolBarIcon(self, action): 158 | """Add an icon to the plugins toolbar. 159 | 160 | :param action: Action to add to the toolbar. 161 | :type action: QAction 162 | """ 163 | pass 164 | 165 | def removeToolBarIcon(self, action): 166 | """Remove an action (icon) from the plugin toolbar. 167 | 168 | :param action: Action to add to the toolbar. 169 | :type action: QAction 170 | """ 171 | pass 172 | 173 | def addToolBar(self, name): 174 | """Add toolbar with specified name. 175 | 176 | :param name: Name for the toolbar. 177 | :type name: str 178 | """ 179 | pass 180 | 181 | def mapCanvas(self): 182 | """Return a pointer to the map canvas.""" 183 | return self.canvas 184 | 185 | def mainWindow(self): 186 | """Return a pointer to the main window. 187 | 188 | In case of QGIS it returns an instance of QgisApp. 189 | """ 190 | pass 191 | 192 | def addDockWidget(self, area, dock_widget): 193 | """Add a dock widget to the main window. 194 | 195 | :param area: Where in the ui the dock should be placed. 196 | :type area: 197 | 198 | :param dock_widget: A dock widget to add to the UI. 199 | :type dock_widget: QDockWidget 200 | """ 201 | pass 202 | 203 | def legendInterface(self): 204 | """Get the legend.""" 205 | return self.canvas 206 | -------------------------------------------------------------------------------- /test/tenbytenraster.asc: -------------------------------------------------------------------------------- 1 | NCOLS 10 2 | NROWS 10 3 | XLLCENTER 1535380.000000 4 | YLLCENTER 5083260.000000 5 | DX 10 6 | DY 10 7 | NODATA_VALUE -9999 8 | 0 1 2 3 4 5 6 7 8 9 9 | 0 1 2 3 4 5 6 7 8 9 10 | 0 1 2 3 4 5 6 7 8 9 11 | 0 1 2 3 4 5 6 7 8 9 12 | 0 1 2 3 4 5 6 7 8 9 13 | 0 1 2 3 4 5 6 7 8 9 14 | 0 1 2 3 4 5 6 7 8 9 15 | 0 1 2 3 4 5 6 7 8 9 16 | 0 1 2 3 4 5 6 7 8 9 17 | 0 1 2 3 4 5 6 7 8 9 18 | CRS 19 | NOTES 20 | -------------------------------------------------------------------------------- /test/tenbytenraster.asc.aux.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Point 4 | 5 | 6 | 7 | 9 8 | 4.5 9 | 0 10 | 2.872281323269 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/tenbytenraster.keywords: -------------------------------------------------------------------------------- 1 | title: Tenbytenraster 2 | -------------------------------------------------------------------------------- /test/tenbytenraster.lic: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Tim Sutton, Linfiniti Consulting CC 5 | 6 | 7 | 8 | tenbytenraster.asc 9 | 2700044251 10 | Yes 11 | Tim Sutton 12 | Tim Sutton (QGIS Source Tree) 13 | Tim Sutton 14 | This data is publicly available from QGIS Source Tree. The original 15 | file was created and contributed to QGIS by Tim Sutton. 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/tenbytenraster.prj: -------------------------------------------------------------------------------- 1 | GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]] -------------------------------------------------------------------------------- /test/tenbytenraster.qml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 0 26 | 27 | -------------------------------------------------------------------------------- /test/test_init.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """Tests QGIS plugin init.""" 3 | 4 | __author__ = 'Tim Sutton ' 5 | __revision__ = '$Format:%H$' 6 | __date__ = '17/10/2010' 7 | __license__ = "GPL" 8 | __copyright__ = 'Copyright 2012, Australia Indonesia Facility for ' 9 | __copyright__ += 'Disaster Reduction' 10 | 11 | import os 12 | import unittest 13 | import logging 14 | import configparser 15 | 16 | LOGGER = logging.getLogger('QGIS') 17 | 18 | 19 | class TestInit(unittest.TestCase): 20 | """Test that the plugin init is usable for QGIS. 21 | 22 | Based heavily on the validator class by Alessandro 23 | Passoti available here: 24 | 25 | http://github.com/qgis/qgis-django/blob/master/qgis-app/ 26 | plugins/validator.py 27 | 28 | """ 29 | 30 | def test_read_init(self): 31 | """Test that the plugin __init__ will validate on plugins.qgis.org.""" 32 | 33 | # You should update this list according to the latest in 34 | # https://github.com/qgis/qgis-django/blob/master/qgis-app/ 35 | # plugins/validator.py 36 | 37 | required_metadata = [ 38 | 'name', 39 | 'description', 40 | 'version', 41 | 'qgisMinimumVersion', 42 | 'email', 43 | 'author'] 44 | 45 | file_path = os.path.abspath(os.path.join( 46 | os.path.dirname(__file__), os.pardir, 47 | 'metadata.txt')) 48 | LOGGER.info(file_path) 49 | metadata = [] 50 | parser = configparser.ConfigParser() 51 | parser.optionxform = str 52 | parser.read(file_path) 53 | message = 'Cannot find a section named "general" in %s' % file_path 54 | assert parser.has_section('general'), message 55 | metadata.extend(parser.items('general')) 56 | 57 | for expectation in required_metadata: 58 | message = ('Cannot find metadata "%s" in metadata source (%s).' % ( 59 | expectation, file_path)) 60 | 61 | self.assertIn(expectation, dict(metadata), message) 62 | 63 | if __name__ == '__main__': 64 | unittest.main() 65 | -------------------------------------------------------------------------------- /test/test_onlineroutingmapper_dialog.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """Dialog test. 3 | 4 | .. note:: This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | """ 10 | 11 | __author__ = 'mselimbilgin@yahoo.com, emre.ondr@hotmail.com' 12 | __date__ = '2024-10-23' 13 | __copyright__ = 'Copyright 2024, Mehmet Selim BILGIN, Yunus Emre ONDER' 14 | 15 | import unittest 16 | 17 | from qgis.PyQt.QtGui import QDialogButtonBox, QDialog 18 | 19 | from onlineroutingmapper_dialog import OnlineRoutingMapperDialog 20 | 21 | from utilities import get_qgis_app 22 | QGIS_APP = get_qgis_app() 23 | 24 | 25 | class OnlineRoutingMapperDialogTest(unittest.TestCase): 26 | """Test dialog works.""" 27 | 28 | def setUp(self): 29 | """Runs before each test.""" 30 | self.dialog = OnlineRoutingMapperDialog(None) 31 | 32 | def tearDown(self): 33 | """Runs after each test.""" 34 | self.dialog = None 35 | 36 | def test_dialog_ok(self): 37 | """Test we can click OK.""" 38 | 39 | button = self.dialog.button_box.button(QDialogButtonBox.Ok) 40 | button.click() 41 | result = self.dialog.result() 42 | self.assertEqual(result, QDialog.Accepted) 43 | 44 | def test_dialog_cancel(self): 45 | """Test we can click cancel.""" 46 | button = self.dialog.button_box.button(QDialogButtonBox.Cancel) 47 | button.click() 48 | result = self.dialog.result() 49 | self.assertEqual(result, QDialog.Rejected) 50 | 51 | if __name__ == "__main__": 52 | suite = unittest.makeSuite(OnlineRoutingMapperDialogTest) 53 | runner = unittest.TextTestRunner(verbosity=2) 54 | runner.run(suite) 55 | 56 | -------------------------------------------------------------------------------- /test/test_qgis_environment.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """Tests for QGIS functionality. 3 | 4 | 5 | .. note:: This program is free software; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2 of the License, or 8 | (at your option) any later version. 9 | 10 | """ 11 | __author__ = 'tim@linfiniti.com' 12 | __date__ = '20/01/2011' 13 | __copyright__ = ('Copyright 2012, Australia Indonesia Facility for ' 14 | 'Disaster Reduction') 15 | 16 | import os 17 | import unittest 18 | from qgis.core import ( 19 | QgsProviderRegistry, 20 | QgsCoordinateReferenceSystem, 21 | QgsRasterLayer) 22 | 23 | from .utilities import get_qgis_app 24 | QGIS_APP = get_qgis_app() 25 | 26 | 27 | class QGISTest(unittest.TestCase): 28 | """Test the QGIS Environment""" 29 | 30 | def test_qgis_environment(self): 31 | """QGIS environment has the expected providers""" 32 | 33 | r = QgsProviderRegistry.instance() 34 | self.assertIn('gdal', r.providerList()) 35 | self.assertIn('ogr', r.providerList()) 36 | self.assertIn('postgres', r.providerList()) 37 | 38 | def test_projection(self): 39 | """Test that QGIS properly parses a wkt string. 40 | """ 41 | crs = QgsCoordinateReferenceSystem() 42 | wkt = ( 43 | 'GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",' 44 | 'SPHEROID["WGS_1984",6378137.0,298.257223563]],' 45 | 'PRIMEM["Greenwich",0.0],UNIT["Degree",' 46 | '0.0174532925199433]]') 47 | crs.createFromWkt(wkt) 48 | auth_id = crs.authid() 49 | expected_auth_id = 'EPSG:4326' 50 | self.assertEqual(auth_id, expected_auth_id) 51 | 52 | # now test for a loaded layer 53 | path = os.path.join(os.path.dirname(__file__), 'tenbytenraster.asc') 54 | title = 'TestRaster' 55 | layer = QgsRasterLayer(path, title) 56 | auth_id = layer.crs().authid() 57 | self.assertEqual(auth_id, expected_auth_id) 58 | 59 | if __name__ == '__main__': 60 | unittest.main() 61 | -------------------------------------------------------------------------------- /test/test_resources.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """Resources test. 3 | 4 | .. note:: This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | """ 10 | 11 | __author__ = 'mselimbilgin@yahoo.com, emre.ondr@hotmail.com' 12 | __date__ = '2024-10-23' 13 | __copyright__ = 'Copyright 2024, Mehmet Selim BILGIN, Yunus Emre ONDER' 14 | 15 | import unittest 16 | 17 | from qgis.PyQt.QtGui import QIcon 18 | 19 | 20 | 21 | class OnlineRoutingMapperDialogTest(unittest.TestCase): 22 | """Test rerources work.""" 23 | 24 | def setUp(self): 25 | """Runs before each test.""" 26 | pass 27 | 28 | def tearDown(self): 29 | """Runs after each test.""" 30 | pass 31 | 32 | def test_icon_png(self): 33 | """Test we can click OK.""" 34 | path = ':/plugins/OnlineRoutingMapper/icon.png' 35 | icon = QIcon(path) 36 | self.assertFalse(icon.isNull()) 37 | 38 | if __name__ == "__main__": 39 | suite = unittest.makeSuite(OnlineRoutingMapperResourcesTest) 40 | runner = unittest.TextTestRunner(verbosity=2) 41 | runner.run(suite) 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /test/test_translations.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """Safe Translations Test. 3 | 4 | .. note:: This program is free software; you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation; either version 2 of the License, or 7 | (at your option) any later version. 8 | 9 | """ 10 | from .utilities import get_qgis_app 11 | 12 | __author__ = 'ismailsunni@yahoo.co.id' 13 | __date__ = '12/10/2011' 14 | __copyright__ = ('Copyright 2012, Australia Indonesia Facility for ' 15 | 'Disaster Reduction') 16 | import unittest 17 | import os 18 | 19 | from qgis.PyQt.QtCore import QCoreApplication, QTranslator 20 | 21 | QGIS_APP = get_qgis_app() 22 | 23 | 24 | class SafeTranslationsTest(unittest.TestCase): 25 | """Test translations work.""" 26 | 27 | def setUp(self): 28 | """Runs before each test.""" 29 | if 'LANG' in iter(os.environ.keys()): 30 | os.environ.__delitem__('LANG') 31 | 32 | def tearDown(self): 33 | """Runs after each test.""" 34 | if 'LANG' in iter(os.environ.keys()): 35 | os.environ.__delitem__('LANG') 36 | 37 | def test_qgis_translations(self): 38 | """Test that translations work.""" 39 | parent_path = os.path.join(__file__, os.path.pardir, os.path.pardir) 40 | dir_path = os.path.abspath(parent_path) 41 | file_path = os.path.join( 42 | dir_path, 'i18n', 'af.qm') 43 | translator = QTranslator() 44 | translator.load(file_path) 45 | QCoreApplication.installTranslator(translator) 46 | 47 | expected_message = 'Goeie more' 48 | real_message = QCoreApplication.translate("@default", 'Good morning') 49 | self.assertEqual(real_message, expected_message) 50 | 51 | 52 | if __name__ == "__main__": 53 | suite = unittest.makeSuite(SafeTranslationsTest) 54 | runner = unittest.TextTestRunner(verbosity=2) 55 | runner.run(suite) 56 | -------------------------------------------------------------------------------- /test/utilities.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | """Common functionality used by regression tests.""" 3 | 4 | import sys 5 | import logging 6 | 7 | 8 | LOGGER = logging.getLogger('QGIS') 9 | QGIS_APP = None # Static variable used to hold hand to running QGIS app 10 | CANVAS = None 11 | PARENT = None 12 | IFACE = None 13 | 14 | 15 | def get_qgis_app(): 16 | """ Start one QGIS application to test against. 17 | 18 | :returns: Handle to QGIS app, canvas, iface and parent. If there are any 19 | errors the tuple members will be returned as None. 20 | :rtype: (QgsApplication, CANVAS, IFACE, PARENT) 21 | 22 | If QGIS is already running the handle to that app will be returned. 23 | """ 24 | 25 | try: 26 | from qgis.PyQt import QtGui, QtCore 27 | from qgis.core import QgsApplication 28 | from qgis.gui import QgsMapCanvas 29 | from .qgis_interface import QgisInterface 30 | except ImportError: 31 | return None, None, None, None 32 | 33 | global QGIS_APP # pylint: disable=W0603 34 | 35 | if QGIS_APP is None: 36 | gui_flag = True # All test will run qgis in gui mode 37 | #noinspection PyPep8Naming 38 | QGIS_APP = QgsApplication(sys.argv, gui_flag) 39 | # Make sure QGIS_PREFIX_PATH is set in your env if needed! 40 | QGIS_APP.initQgis() 41 | s = QGIS_APP.showSettings() 42 | LOGGER.debug(s) 43 | 44 | global PARENT # pylint: disable=W0603 45 | if PARENT is None: 46 | #noinspection PyPep8Naming 47 | PARENT = QtGui.QWidget() 48 | 49 | global CANVAS # pylint: disable=W0603 50 | if CANVAS is None: 51 | #noinspection PyPep8Naming 52 | CANVAS = QgsMapCanvas(PARENT) 53 | CANVAS.resize(QtCore.QSize(400, 400)) 54 | 55 | global IFACE # pylint: disable=W0603 56 | if IFACE is None: 57 | # QgisInterface is a stub implementation of the QGIS plugin interface 58 | #noinspection PyPep8Naming 59 | IFACE = QgisInterface(CANVAS) 60 | 61 | return QGIS_APP, CANVAS, IFACE, PARENT 62 | --------------------------------------------------------------------------------