diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..dba3ec5 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,8 @@ +libprop 0.12 (released 2008-02-23) + + * fixed bug with elevEnd calculation in pathLoss() + * added Longley-Rice propagation model + +libprop 0.11 (released 2007-12-13) + + * initial release under GNU license diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..3d90694 --- /dev/null +++ b/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. \ No newline at end of file diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 0000000..4231b4d --- /dev/null +++ b/Doxyfile @@ -0,0 +1,1252 @@ +# Doxyfile 1.5.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = libprop + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc/ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, +# Italian, Japanese, Japanese-en (Japanese with English messages), Korean, +# Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, +# Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# This tag can be used to specify the encoding used in the generated output. +# The encoding is not always determined by the language that is chosen, +# but also whether or not the output is meant for Windows or non-Windows users. +# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES +# forces the Windows encoding (this is the default for the Windows binary), +# whereas setting the tag to NO uses a Unix-style encoding (the default for +# all platforms other than Windows). + +USE_WINDOWS_ENCODING = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to +# include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = YES + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from the +# version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = NO + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py + +FILE_PATTERNS = *.h + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = YES + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = YES + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentstion. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = YES + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = NO + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a caller dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable caller graphs for selected +# functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that a graph may be further truncated if the graph's +# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH +# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), +# the graph is not depth-constrained. + +MAX_DOT_GRAPH_DEPTH = 0 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, which results in a white background. +# Warning: Depending on the platform used, enabling this option may lead to +# badly anti-aliased labels on the edges of a graph (i.e. they become hard to +# read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4de431f --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ + +CC=g++ +CFLAGS=-I. +DEBUG=-g +DEPS=geom.h radio.h source.h utils.h +OBJ=geom.o radio.o source.o utils.o main.o +LIBS=-lm -lstdc++ + +#%.o: %.C $(DEPS) +# $(CC) -c -o $@ $< $(CFLAGS) + +.C.o: + $(CC) -c $(DEBUG) $< + +main: $(OBJ) + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + +clean: + rm -f *.o *~ core + + + diff --git a/doc/html/annotated.html b/doc/html/annotated.html new file mode 100644 index 0000000..937c0f0 --- /dev/null +++ b/doc/html/annotated.html @@ -0,0 +1,40 @@ + + +libprop: Class List + + + + + + +

libprop Class List

Here are the classes, structs, unions and interfaces with brief descriptions: + + + + + + + + + + + +
ConvertInterface to convert a Point into another coordinate system that could be used to reference into a Source
ConvertAlbersInterface to convert Point objects into default Albers projection coordinate system
PointDescribe a specific point on the Earth surface. It can also store details about that point, such as its elevation and vegetation. Provides functions such as distance between two points, and projection along a bearing
RegionDefine a generic region on the Earth. Can turn its defined region into a series of discrete points, and check if a given point is inside the region
RegionAreaDefine a square region across the surface of the Earth, defined using two corner points. Can turn its defined region into a series of discrete points, and check if a given point is inside the region
RegionLineDefine a linear region across the surface of the Earth, defined as a series of points. Can turn its defined region into a series of discrete points, and check if a given point is inside the region
SourceInterface to a data source. Sources can be asked to fill Point objects with any available data
SourceGridFloatInterface to a data source. Sources can be asked to fill Point objects with any available data. Specifically handles data files in grid float format, usually ending with ".flt" extension
SourceGroupInterface to a collection of data sources. This can quickly fill Point objects with available data from a large set of source files
SourceIntegerInterface to a data source. Sources can be asked to fill Point objects with any available data. Specifically handles data files in integer format, usually ending with ".bil" extension
TimeRemainingHelpful class to express remaining time to a user. Displays a progress bar with a remaining time in minutes and seconds
+
Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classConvert-members.html b/doc/html/classConvert-members.html new file mode 100644 index 0000000..a5fcb04 --- /dev/null +++ b/doc/html/classConvert-members.html @@ -0,0 +1,29 @@ + + +libprop: Member List + + + + + + +

Convert Member List

This is the complete list of members for Convert, including all inherited members.

+ +
convert(Point *p, double *x, double *y)Convert [virtual]


Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classConvert.html b/doc/html/classConvert.html new file mode 100644 index 0000000..937b019 --- /dev/null +++ b/doc/html/classConvert.html @@ -0,0 +1,97 @@ + + +libprop: Convert Class Reference + + + + + + +

Convert Class Reference

Interface to convert a Point into another coordinate system that could be used to reference into a Source. +More... +

+#include <source.h> +

+

+Inheritance diagram for Convert:
+
+ +

+ +ConvertAlbers + +
+ +

+List of all members. + + + + +

Public Member Functions

virtual void convert (Point *p, double *x, double *y)
+


Detailed Description

+Interface to convert a Point into another coordinate system that could be used to reference into a Source.

Member Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
virtual void Convert::convert (Point p,
double *  x,
double *  y 
) [virtual]
+
+
+ +

+Convert the given Point into another coordinate system.

Parameters:
+ + + + +
p Point to be converted
x Output x coordinate after conversion
y Output y coordinate after conversion
+
+ +

Reimplemented in ConvertAlbers.

+ +
+

+


The documentation for this class was generated from the following file: +
Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classConvert.png b/doc/html/classConvert.png new file mode 100644 index 0000000..17bb816 Binary files /dev/null and b/doc/html/classConvert.png differ diff --git a/doc/html/classConvertAlbers-members.html b/doc/html/classConvertAlbers-members.html new file mode 100644 index 0000000..855306c --- /dev/null +++ b/doc/html/classConvertAlbers-members.html @@ -0,0 +1,36 @@ + + +libprop: Member List + + + + + + +

ConvertAlbers Member List

This is the complete list of members for ConvertAlbers, including all inherited members.

+ + + + + + + + +
bigCConvertAlbers [private]
calcMsq(double lat)ConvertAlbers [private]
calcQ(double lat)ConvertAlbers [private]
coneConstConvertAlbers [private]
convert(Point *p, double *x, double *y)ConvertAlbers [virtual]
ConvertAlbers()ConvertAlbers
middleLonConvertAlbers [private]
r0ConvertAlbers [private]


Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classConvertAlbers.html b/doc/html/classConvertAlbers.html new file mode 100644 index 0000000..a0dc3f1 --- /dev/null +++ b/doc/html/classConvertAlbers.html @@ -0,0 +1,234 @@ + + +libprop: ConvertAlbers Class Reference + + + + + + +

ConvertAlbers Class Reference

Interface to convert Point objects into default Albers projection coordinate system. +More... +

+#include <source.h> +

+

+Inheritance diagram for ConvertAlbers:
+
+ +

+ +Convert + +
+ +

+List of all members. + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 ConvertAlbers ()
void convert (Point *p, double *x, double *y)

Private Member Functions

double calcQ (double lat)
double calcMsq (double lat)

Private Attributes

double middleLon
double bigC
double coneConst
double r0
+


Detailed Description

+Interface to convert Point objects into default Albers projection coordinate system.

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
ConvertAlbers::ConvertAlbers (  ) 
+
+
+ +

+ +

+

+


Member Function Documentation

+ +
+
+ + + + + + + + + +
double ConvertAlbers::calcQ (double  lat  )  [private]
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + + +
double ConvertAlbers::calcMsq (double  lat  )  [private]
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void ConvertAlbers::convert (Point p,
double *  x,
double *  y 
) [virtual]
+
+
+ +

+Convert the given Point into default Albers projection coordinate system.

Parameters:
+ + + + +
p Point to be converted
x Output x coordinate after conversion
y Output y coordinate after conversion
+
+ +

Reimplemented from Convert.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
double ConvertAlbers::middleLon [private]
+
+
+ +

+ +

+

+ +

+
+ + + + +
double ConvertAlbers::bigC [private]
+
+
+ +

+ +

+

+ +

+
+ + + + +
double ConvertAlbers::coneConst [private]
+
+
+ +

+ +

+

+ +

+
+ + + + +
double ConvertAlbers::r0 [private]
+
+
+ +

+ +

+

+


The documentation for this class was generated from the following file: +
Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classConvertAlbers.png b/doc/html/classConvertAlbers.png new file mode 100644 index 0000000..3ab3416 Binary files /dev/null and b/doc/html/classConvertAlbers.png differ diff --git a/doc/html/classPoint-members.html b/doc/html/classPoint-members.html new file mode 100644 index 0000000..9c0f110 --- /dev/null +++ b/doc/html/classPoint-members.html @@ -0,0 +1,45 @@ + + +libprop: Member List + + + + + + +

Point Member List

This is the complete list of members for Point, including all inherited members.

+ + + + + + + + + + + + + + + + + +
bearing(Point *p)Point
distance(Point *p)Point
elevPoint
landTypePoint
latPoint
lonPoint
operator<<(ostream &output, const Point &p)Point [friend]
operator<<(ofstream &output, const Point &p)Point [friend]
operator>>(ifstream &input, Point &p)Point [friend]
Point()Point
Point(double _lat, double _lon)Point
Point(double _lat, double _lon, double _towerHeight)Point
project(double bearing, double distance)Point
towerHeightPoint
vegCoverPoint
vegHeightPoint
vegTypePoint


Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classPoint.html b/doc/html/classPoint.html new file mode 100644 index 0000000..75704d7 --- /dev/null +++ b/doc/html/classPoint.html @@ -0,0 +1,505 @@ + + +libprop: Point Class Reference + + + + + + +

Point Class Reference

Describe a specific point on the Earth surface. It can also store details about that point, such as its elevation and vegetation. Provides functions such as distance between two points, and projection along a bearing. +More... +

+#include <geom.h> +

+ +

+List of all members. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 Point ()
 Point (double _lat, double _lon)
 Point (double _lat, double _lon, double _towerHeight)
double distance (Point *p)
double bearing (Point *p)
Pointproject (double bearing, double distance)

Public Attributes

double lat
 Actual latitude of this point.
double lon
 Actual longitude of this point.
double elev
 Optional elevation of given point, usually filled by a Source object.
double towerHeight
 Optional height of a tower at this point.
double vegHeight
 Optional height of vegetation above ground elevation at this point, usually filled by a Source object.
int vegType
 Optional raw vegetation type, usually filled by vegetation Source object.
int vegCover
 Optional percentage (0-100) of vegetation cover as read from vegetation Source object.
int landType
 Optional raw land use type, usually filled by a land-use Source object.

Friends

ostream & operator<< (ostream &output, const Point &p)
 Output point in "(lat,long)" format.
ofstream & operator<< (ofstream &output, const Point &p)
 Output point in "lat\tlong" format.
ifstream & operator>> (ifstream &input, Point &p)
 Read in point in "lat\tlong" format.
+


Detailed Description

+Describe a specific point on the Earth surface. It can also store details about that point, such as its elevation and vegetation. Provides functions such as distance between two points, and projection along a bearing.

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
Point::Point (  ) 
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + + + + + + + + + + + +
Point::Point (double  _lat,
double  _lon 
)
+
+
+ +

+Create new Point object with given coordinates.

Parameters:
+ + + +
_lat Latitude to assign to new point (range -90 to 90)
_lon Longitude to assign to new point (range -180 to 180)
+
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
Point::Point (double  _lat,
double  _lon,
double  _towerHeight 
)
+
+
+ +

+Create new Point object with given coordinates. Also set the height of a tower at this point to the height given in meters.

Parameters:
+ + + + +
_lat Latitude to assign to new point (range -90 to 90)
_lon Longitude to assign to new point (range -180 to 180)
_towerHeight Height to assign to tower at this point (in meters)
+
+ +
+

+


Member Function Documentation

+ +
+
+ + + + + + + + + +
double Point::distance (Point p  ) 
+
+
+ +

+Calculate the distance between this point and the second given point.

Parameters:
+ + +
p Second point to compare this object against
+
+
Returns:
Distance between the two given points in kilometers
+ +
+

+ +

+
+ + + + + + + + + +
double Point::bearing (Point p  ) 
+
+
+ +

+Calculate the compass bearing from this point towards the second given point. If we walk from this point using the returned bearing, we will reach the second point.

Parameters:
+ + +
p Second point to compare this object against.
+
+
Returns:
Bearing from this point towards second given point (value returned in radians (range 0 to 2)
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + +
Point* Point::project (double  bearing,
double  distance 
)
+
+
+ +

+Project this point along the given bearing line for the given distance and return the new point.

Parameters:
+ + + +
bearing Bearing to follow from this point in radians (range 0 to 2)
distance Distance to walk along bearing line in kilometers
+
+
Returns:
New point object after walking given distance along the bearing line.
+ +
+

+


Friends And Related Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
ostream& operator<< (ostream &  output,
const Point p 
) [friend]
+
+
+ +

+Output point in "(lat,long)" format. +

+ +

+

+ +

+
+ + + + + + + + + + + + + + + + + + +
ofstream& operator<< (ofstream &  output,
const Point p 
) [friend]
+
+
+ +

+Output point in "lat\tlong" format. +

+ +

+

+ +

+
+ + + + + + + + + + + + + + + + + + +
ifstream& operator>> (ifstream &  input,
Point p 
) [friend]
+
+
+ +

+Read in point in "lat\tlong" format. +

+ +

+

+


Member Data Documentation

+ +
+
+ + + + +
double Point::lat
+
+
+ +

+Actual latitude of this point. +

+ +

+

+ +

+
+ + + + +
double Point::lon
+
+
+ +

+Actual longitude of this point. +

+ +

+

+ +

+
+ + + + +
double Point::elev
+
+
+ +

+Optional elevation of given point, usually filled by a Source object. +

+ +

+

+ +

+
+ + + + +
double Point::towerHeight
+
+
+ +

+Optional height of a tower at this point. +

+ +

+

+ +

+
+ + + + +
double Point::vegHeight
+
+
+ +

+Optional height of vegetation above ground elevation at this point, usually filled by a Source object. +

+ +

+

+ +

+
+ + + + +
int Point::vegType
+
+
+ +

+Optional raw vegetation type, usually filled by vegetation Source object. +

+ +

+

+ +

+
+ + + + +
int Point::vegCover
+
+
+ +

+Optional percentage (0-100) of vegetation cover as read from vegetation Source object. +

+ +

+

+ +

+
+ + + + +
int Point::landType
+
+
+ +

+Optional raw land use type, usually filled by a land-use Source object. +

+ +

+

+


The documentation for this class was generated from the following file: +
Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classRegion-members.html b/doc/html/classRegion-members.html new file mode 100644 index 0000000..34313e9 --- /dev/null +++ b/doc/html/classRegion-members.html @@ -0,0 +1,31 @@ + + +libprop: Member List + + + + + + +

Region Member List

This is the complete list of members for Region, including all inherited members.

+ + + +
add(Point *p)=0Region [pure virtual]
contains(Point *p)=0Region [pure virtual]
discrete(double resolution)=0Region [pure virtual]


Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classRegion.html b/doc/html/classRegion.html new file mode 100644 index 0000000..01d7096 --- /dev/null +++ b/doc/html/classRegion.html @@ -0,0 +1,141 @@ + + +libprop: Region Class Reference + + + + + + +

Region Class Reference

Define a generic region on the Earth. Can turn its defined region into a series of discrete points, and check if a given point is inside the region. +More... +

+#include <geom.h> +

+

+Inheritance diagram for Region:
+
+ +

+ +RegionArea +RegionLine + +
+ +

+List of all members. + + + + + + + + +

Public Member Functions

virtual vector< Point * > discrete (double resolution)=0
virtual bool contains (Point *p)=0
virtual void add (Point *p)=0
+


Detailed Description

+Define a generic region on the Earth. Can turn its defined region into a series of discrete points, and check if a given point is inside the region.

Member Function Documentation

+ +
+
+ + + + + + + + + +
virtual vector<Point*> Region::discrete (double  resolution  )  [pure virtual]
+
+
+ +

+Turn the defined region into a discrete set of points, using resolution to describe the level of detail.

Parameters:
+ + +
resolution Level of spacing (detail) between the discrete points to be created. Value in kilometers.
+
+
Returns:
List of points that describe this region using the level of resolution requested
+ +

Implemented in RegionArea, and RegionLine.

+ +
+

+ +

+
+ + + + + + + + + +
virtual bool Region::contains (Point p  )  [pure virtual]
+
+
+ +

+Check if this region contains the given point.

Parameters:
+ + +
p Point to check against
+
+
Returns:
True if point is inside this region, false otherwise
+ +

Implemented in RegionArea, and RegionLine.

+ +
+

+ +

+
+ + + + + + + + + +
virtual void Region::add (Point p  )  [pure virtual]
+
+
+ +

+Add the given Point to this Region, expanding the region as needed so that contains(p) returns true.

Parameters:
+ + +
p The point to include in this region
+
+ +

Implemented in RegionArea, and RegionLine.

+ +
+

+


The documentation for this class was generated from the following file: +
Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classRegion.png b/doc/html/classRegion.png new file mode 100644 index 0000000..f26ea25 Binary files /dev/null and b/doc/html/classRegion.png differ diff --git a/doc/html/classRegionArea-members.html b/doc/html/classRegionArea-members.html new file mode 100644 index 0000000..baa1353 --- /dev/null +++ b/doc/html/classRegionArea-members.html @@ -0,0 +1,38 @@ + + +libprop: Member List + + + + + + +

RegionArea Member List

This is the complete list of members for RegionArea, including all inherited members.

+ + + + + + + + + + +
add(Point *p)RegionArea [virtual]
bottomLeftRegionArea
contains(Point *p)RegionArea [virtual]
discrete(double resolution)RegionArea [virtual]
operator<<(ostream &output, const RegionArea &r)RegionArea [friend]
RegionArea()RegionArea
RegionArea(Point *bottomLeft, Point *topRight)RegionArea
RegionArea(Point *center, double radius)RegionArea
topRightRegionArea
~RegionArea()RegionArea


Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classRegionArea.html b/doc/html/classRegionArea.html new file mode 100644 index 0000000..c43ec86 --- /dev/null +++ b/doc/html/classRegionArea.html @@ -0,0 +1,335 @@ + + +libprop: RegionArea Class Reference + + + + + + +

RegionArea Class Reference

Define a square region across the surface of the Earth, defined using two corner points. Can turn its defined region into a series of discrete points, and check if a given point is inside the region. +More... +

+#include <geom.h> +

+

+Inheritance diagram for RegionArea:
+
+ +

+ +Region + +
+ +

+List of all members. + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 RegionArea ()
 RegionArea (Point *bottomLeft, Point *topRight)
 RegionArea (Point *center, double radius)
 ~RegionArea ()
vector< Point * > discrete (double resolution)
bool contains (Point *p)
void add (Point *p)

Public Attributes

PointbottomLeft
 Describe the bottom left corner of this square region.
PointtopRight
 Describe the top right corner of this square region.

Friends

ostream & operator<< (ostream &output, const RegionArea &r)
 Output region in "[(lat,long),(lat,long]" format.
+


Detailed Description

+Define a square region across the surface of the Earth, defined using two corner points. Can turn its defined region into a series of discrete points, and check if a given point is inside the region.

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
RegionArea::RegionArea (  ) 
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + + + + + + + + + + + +
RegionArea::RegionArea (Point bottomLeft,
Point topRight 
)
+
+
+ +

+Create new square region using the given points as the bottom-left and top-right corners.

Parameters:
+ + + +
bottomLeft Bottom-left corner point of the new region
topRight Top-right corner point of the new region
+
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + +
RegionArea::RegionArea (Point center,
double  radius 
)
+
+
+ +

+Create new square region using the given point as the region center and distance of radius to each corner.

Parameters:
+ + + +
center Point to center the square region around
radius Radius in kilometers from the center point to each corner of the square region
+
+ +
+

+ +

+
+ + + + + + + + +
RegionArea::~RegionArea (  ) 
+
+
+ +

+ +

+

+


Member Function Documentation

+ +
+
+ + + + + + + + + +
vector<Point*> RegionArea::discrete (double  resolution  )  [virtual]
+
+
+ +

+Turn the defined square region into a discrete set of points, using resolution to describe the level of detail. Effectively builds a grid across the square with resolution spacing.

Parameters:
+ + +
resolution Level of spacing (detail) between the discrete points to be created. Value in kilometers.
+
+
Returns:
List of points that describe this region using the level of resolution requested
+ +

Implements Region.

+ +
+

+ +

+
+ + + + + + + + + +
bool RegionArea::contains (Point p  )  [virtual]
+
+
+ +

+Check if this region contains the given point.

Parameters:
+ + +
p Point to check against
+
+
Returns:
True if point is inside this region, false otherwise
+ +

Implements Region.

+ +
+

+ +

+
+ + + + + + + + + +
void RegionArea::add (Point p  )  [virtual]
+
+
+ +

+Add the given Point to this Region, expanding the region as needed so that contains(p) returns true. Will expand the nearest square corner so that this region covers the given point.

Parameters:
+ + +
p The point to include in this region
+
+ +

Implements Region.

+ +
+

+


Friends And Related Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
ostream& operator<< (ostream &  output,
const RegionArea r 
) [friend]
+
+
+ +

+Output region in "[(lat,long),(lat,long]" format. +

+ +

+

+


Member Data Documentation

+ +
+ +
+ +

+Describe the bottom left corner of this square region. +

+ +

+

+ +

+ +
+ +

+Describe the top right corner of this square region. +

+ +

+

+


The documentation for this class was generated from the following file: +
Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classRegionArea.png b/doc/html/classRegionArea.png new file mode 100644 index 0000000..c8e7bf9 Binary files /dev/null and b/doc/html/classRegionArea.png differ diff --git a/doc/html/classRegionLine-members.html b/doc/html/classRegionLine-members.html new file mode 100644 index 0000000..c605e9f --- /dev/null +++ b/doc/html/classRegionLine-members.html @@ -0,0 +1,39 @@ + + +libprop: Member List + + + + + + +

RegionLine Member List

This is the complete list of members for RegionLine, including all inherited members.

+ + + + + + + + + + + +
add(Point *p)RegionLine [virtual]
contains(Point *p)RegionLine [virtual]
discrete(double resolution)RegionLine [virtual]
length()RegionLine
listRegionLine [private]
operator<<(ofstream &output, const RegionLine &r)RegionLine [friend]
RegionLine()RegionLine
RegionLine(vector< Point * > list)RegionLine
RegionLine(Point *p, Point *q)RegionLine
RegionLine(string filename)RegionLine
~RegionLine()RegionLine


Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classRegionLine.html b/doc/html/classRegionLine.html new file mode 100644 index 0000000..5d2624c --- /dev/null +++ b/doc/html/classRegionLine.html @@ -0,0 +1,354 @@ + + +libprop: RegionLine Class Reference + + + + + + +

RegionLine Class Reference

Define a linear region across the surface of the Earth, defined as a series of points. Can turn its defined region into a series of discrete points, and check if a given point is inside the region. +More... +

+#include <geom.h> +

+

+Inheritance diagram for RegionLine:
+
+ +

+ +Region + +
+ +

+List of all members. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 RegionLine ()
 RegionLine (vector< Point * > list)
 RegionLine (Point *p, Point *q)
 RegionLine (string filename)
 ~RegionLine ()
double length ()
vector< Point * > discrete (double resolution)
bool contains (Point *p)
void add (Point *p)

Private Attributes

vector< Point * > list
 List of all points contained in this linear region.

Friends

ofstream & operator<< (ofstream &output, const RegionLine &r)
 Output region in "lat\tlon\n..." format.
+


Detailed Description

+Define a linear region across the surface of the Earth, defined as a series of points. Can turn its defined region into a series of discrete points, and check if a given point is inside the region.

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
RegionLine::RegionLine (  ) 
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + + +
RegionLine::RegionLine (vector< Point * >  list  ) 
+
+
+ +

+Create new linear region that will contain the given list of points.

Parameters:
+ + +
list List of points to include in the new linear region
+
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + +
RegionLine::RegionLine (Point p,
Point q 
)
+
+
+ +

+Create new linear region that contains only the two given points. Additional points can still be added later if needed.

Parameters:
+ + + +
p Starting point for new line
q Ending point for new line
+
+ +
+

+ +

+
+ + + + + + + + + +
RegionLine::RegionLine (string  filename  ) 
+
+
+ +

+Create a new linear region by reading a list of points from a file. Usually used for reading in description of a roadway. Expecting file format to be "lat\tlon\n...-1\t-1\n".

Parameters:
+ + +
filename Filename to open and read list of points from
+
+ +
+

+ +

+
+ + + + + + + + +
RegionLine::~RegionLine (  ) 
+
+
+ +

+ +

+

+


Member Function Documentation

+ +
+
+ + + + + + + + +
double RegionLine::length (  ) 
+
+
+ +

+Calcuate the total length of this linear region

Returns:
Length of linear region in kilometers
+ +
+

+ +

+
+ + + + + + + + + +
vector<Point*> RegionLine::discrete (double  resolution  )  [virtual]
+
+
+ +

+Turn the defined linear region into a discrete set of points, using resolution to describe the level of detail. Effectively steps along the line defined in resolution-length steps.

Parameters:
+ + +
resolution Level of spacing (detail) between the discrete points to be created. Value in kilometers.
+
+
Returns:
List of points that describe this region using the level of resolution requested
+ +

Implements Region.

+ +
+

+ +

+
+ + + + + + + + + +
bool RegionLine::contains (Point p  )  [virtual]
+
+
+ +

+Check if this region contains the given point. Always returns false for line segments.

Parameters:
+ + +
p Point to check against
+
+
Returns:
Always returns false.
+ +

Implements Region.

+ +
+

+ +

+
+ + + + + + + + + +
void RegionLine::add (Point p  )  [virtual]
+
+
+ +

+Add the given Point to this Region. Will append given point to the end of this line segment.

Parameters:
+ + +
p The point to include in this region
+
+ +

Implements Region.

+ +
+

+


Friends And Related Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
ofstream& operator<< (ofstream &  output,
const RegionLine r 
) [friend]
+
+
+ +

+Output region in "lat\tlon\n..." format. +

+ +

+

+


Member Data Documentation

+ +
+
+ + + + +
vector<Point*> RegionLine::list [private]
+
+
+ +

+List of all points contained in this linear region. +

+ +

+

+


The documentation for this class was generated from the following file: +
Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classRegionLine.png b/doc/html/classRegionLine.png new file mode 100644 index 0000000..4ef5800 Binary files /dev/null and b/doc/html/classRegionLine.png differ diff --git a/doc/html/classSource-members.html b/doc/html/classSource-members.html new file mode 100644 index 0000000..f760c8d --- /dev/null +++ b/doc/html/classSource-members.html @@ -0,0 +1,44 @@ + + +libprop: Member List + + + + + + +

Source Member List

This is the complete list of members for Source, including all inherited members.

+ + + + + + + + + + + + + + + + +
bottomSource [protected]
cellsizeSource [protected]
contains(Point *p)Source [virtual]
convertSource [protected]
leftSource [protected]
ncolsSource [protected]
nrowsSource [protected]
rawSource [protected]
rawfilenameSource [protected]
resolve(Point *p)=0Source [pure virtual]
resolveList(vector< Point * > list)Source
rightSource [protected]
Source()Source [protected]
Source(Convert *_convert, int _type)Source [protected]
topSource [protected]
typeSource [protected]


Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classSource.html b/doc/html/classSource.html new file mode 100644 index 0000000..ea75622 --- /dev/null +++ b/doc/html/classSource.html @@ -0,0 +1,403 @@ + + +libprop: Source Class Reference + + + + + + +

Source Class Reference

Interface to a data source. Sources can be asked to fill Point objects with any available data. +More... +

+#include <source.h> +

+

+Inheritance diagram for Source:
+
+ +

+ +SourceGridFloat +SourceGroup +SourceInteger + +
+ +

+List of all members. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

virtual void resolve (Point *p)=0
void resolveList (vector< Point * > list)
virtual bool contains (Point *p)

Protected Member Functions

 Source ()
 Source (Convert *_convert, int _type)

Protected Attributes

Convertconvert
 Conversion to apply to each incoming Point.
int type
 Enumeration describing what type of data this object provides.
int ncols
int nrows
double top
double left
double bottom
double right
double cellsize
 Optional internal value describing the size of each data cell.
string rawfilename
 Filename pointing at actual source datafile.
ifstream raw
 Open stream to source datafile, if already opened.
+


Detailed Description

+Interface to a data source. Sources can be asked to fill Point objects with any available data.

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
Source::Source (  )  [protected]
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + + + + + + + + + + + +
Source::Source (Convert _convert,
int  _type 
) [protected]
+
+
+ +

+Create a new data source.

Parameters:
+ + + +
_convert The conversion to apply to all incoming points
_type Enumeration value describing the type of data we provide
+
+ +
+

+


Member Function Documentation

+ +
+
+ + + + + + + + + +
virtual void Source::resolve (Point p  )  [pure virtual]
+
+
+ +

+Resolve a given Point by filling it with any new data this source can provide. Will ignore given point if this source can't provide data.

Parameters:
+ + +
p The point to try filling with data
+
+ +

Implemented in SourceInteger, SourceGridFloat, and SourceGroup.

+ +
+

+ +

+
+ + + + + + + + + +
void Source::resolveList (vector< Point * >  list  ) 
+
+
+ +

+Resolve the entire list of Point objects by calling resolve() on each of them.

Parameters:
+ + +
list List of Point objects to try resolving
+
+ +
+

+ +

+
+ + + + + + + + + +
virtual bool Source::contains (Point p  )  [virtual]
+
+
+ +

+Check if this source provides data about the given point.

Parameters:
+ + +
p Point to check against
+
+
Returns:
True if this source provides data about given point, otherwise false.
+ +

Reimplemented in SourceGroup.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
Convert* Source::convert [protected]
+
+
+ +

+Conversion to apply to each incoming Point. +

+ +

+

+ +

+
+ + + + +
int Source::type [protected]
+
+
+ +

+Enumeration describing what type of data this object provides. +

+ +

+

+ +

+
+ + + + +
int Source::ncols [protected]
+
+
+ +

+ +

+

+ +

+
+ + + + +
int Source::nrows [protected]
+
+
+ +

+ +

+

+ +

+
+ + + + +
double Source::top [protected]
+
+
+ +

+ +

+

+ +

+
+ + + + +
double Source::left [protected]
+
+
+ +

+ +

+

+ +

+
+ + + + +
double Source::bottom [protected]
+
+
+ +

+ +

+

+ +

+
+ + + + +
double Source::right [protected]
+
+
+ +

+ +

+

+ +

+
+ + + + +
double Source::cellsize [protected]
+
+
+ +

+Optional internal value describing the size of each data cell. +

+ +

+

+ +

+
+ + + + +
string Source::rawfilename [protected]
+
+
+ +

+Filename pointing at actual source datafile. +

+ +

+

+ +

+
+ + + + +
ifstream Source::raw [protected]
+
+
+ +

+Open stream to source datafile, if already opened. +

+ +

+

+


The documentation for this class was generated from the following file: +
Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classSource.png b/doc/html/classSource.png new file mode 100644 index 0000000..eeff0e9 Binary files /dev/null and b/doc/html/classSource.png differ diff --git a/doc/html/classSourceGridFloat-members.html b/doc/html/classSourceGridFloat-members.html new file mode 100644 index 0000000..a3470a9 --- /dev/null +++ b/doc/html/classSourceGridFloat-members.html @@ -0,0 +1,49 @@ + + +libprop: Member List + + + + + + +

SourceGridFloat Member List

This is the complete list of members for SourceGridFloat, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + + +
bottomSource [protected]
cacheSourceGridFloat [protected]
cellsizeSource [protected]
contains(Point *p)Source [virtual]
convertSource [protected]
leftSource [protected]
ncolsSource [protected]
nrowsSource [protected]
rawSource [protected]
rawfilenameSource [protected]
resolve(Point *p)SourceGridFloat [virtual]
resolveList(vector< Point * > list)Source
rightSource [protected]
Source()Source [protected]
Source(Convert *_convert, int _type)Source [protected]
SourceGridFloat(Convert *convert, int type, string filename, bool cache)SourceGridFloat
SourceGridFloat(Convert *convert, int type, string filename, int _ncols, int _nrows, double _left, double _bottom, double _cellsize)SourceGridFloat
topSource [protected]
typeSource [protected]
value(int offset)SourceGridFloat [protected]
~SourceGridFloat()SourceGridFloat


Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classSourceGridFloat.html b/doc/html/classSourceGridFloat.html new file mode 100644 index 0000000..d24cc67 --- /dev/null +++ b/doc/html/classSourceGridFloat.html @@ -0,0 +1,283 @@ + + +libprop: SourceGridFloat Class Reference + + + + + + +

SourceGridFloat Class Reference

Interface to a data source. Sources can be asked to fill Point objects with any available data. Specifically handles data files in grid float format, usually ending with ".flt" extension. +More... +

+#include <source.h> +

+

+Inheritance diagram for SourceGridFloat:
+
+ +

+ +Source + +
+ +

+List of all members. + + + + + + + + + + + + + + + + + +

Public Member Functions

 SourceGridFloat (Convert *convert, int type, string filename, bool cache)
 SourceGridFloat (Convert *convert, int type, string filename, int _ncols, int _nrows, double _left, double _bottom, double _cellsize)
 ~SourceGridFloat ()
void resolve (Point *p)

Protected Member Functions

double value (int offset)

Protected Attributes

double * cache
 Internal cache of entire data file, if requested.
+


Detailed Description

+Interface to a data source. Sources can be asked to fill Point objects with any available data. Specifically handles data files in grid float format, usually ending with ".flt" extension.

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SourceGridFloat::SourceGridFloat (Convert convert,
int  type,
string  filename,
bool  cache 
)
+
+
+ +

+Create a new grid float data source.

Parameters:
+ + + + + +
convert The conversion to apply to all incoming points
type Enumeration value describing the type of data we provide
filename Filename pointing to ".hdr" file for this data source
cache Cache entire data file in memory if true, otherwise read directly from file when requested
+
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SourceGridFloat::SourceGridFloat (Convert convert,
int  type,
string  filename,
int  _ncols,
int  _nrows,
double  _left,
double  _bottom,
double  _cellsize 
)
+
+
+ +

+Create a new grid float data source. This constructor is specifically used to bypass reading the ".hdr" header file, which can save time when using large numbers of data source tiles.

Parameters:
+ + + + + + + + + +
convert The conversion to apply to all incoming points
type Enumeration value describing the type of data we provide
filename Filename pointing to ".hdr" file for this data source
_ncols Number of columns in the data file
_nrows Number of rows in the data file
_left Left longitude of the data file
_bottom Bottom latitude of the data file
_cellsize Size of each cell in the data file
+
+ +
+

+ +

+
+ + + + + + + + +
SourceGridFloat::~SourceGridFloat (  ) 
+
+
+ +

+ +

+

+


Member Function Documentation

+ +
+
+ + + + + + + + + +
double SourceGridFloat::value (int  offset  )  [protected]
+
+
+ +

+Retrieve a specific value, either from raw source file, or from cache if it exists.

Parameters:
+ + +
offset Offset into the data file to read
+
+
Returns:
Value at offset location
+ +
+

+ +

+
+ + + + + + + + + +
void SourceGridFloat::resolve (Point p  )  [virtual]
+
+
+ +

+Resolve a given Point by filling it with any new data this source can provide. Will ignore given point if this source can't provide data.

Parameters:
+ + +
p The point to try filling with data
+
+ +

Implements Source.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
double* SourceGridFloat::cache [protected]
+
+
+ +

+Internal cache of entire data file, if requested. +

+ +

+

+


The documentation for this class was generated from the following file: +
Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classSourceGridFloat.png b/doc/html/classSourceGridFloat.png new file mode 100644 index 0000000..45363cc Binary files /dev/null and b/doc/html/classSourceGridFloat.png differ diff --git a/doc/html/classSourceGroup-members.html b/doc/html/classSourceGroup-members.html new file mode 100644 index 0000000..d58356f --- /dev/null +++ b/doc/html/classSourceGroup-members.html @@ -0,0 +1,47 @@ + + +libprop: Member List + + + + + + +

SourceGroup Member List

This is the complete list of members for SourceGroup, including all inherited members.

+ + + + + + + + + + + + + + + + + + + +
add(Source *s)SourceGroup
bottomSource [protected]
cellsizeSource [protected]
contains(Point *p)SourceGroup [virtual]
convertSource [protected]
leftSource [protected]
listSourceGroup [private]
ncolsSource [protected]
nrowsSource [protected]
rawSource [protected]
rawfilenameSource [protected]
resolve(Point *p)SourceGroup [virtual]
resolveList(vector< Point * > list)Source
rightSource [protected]
Source()Source [protected]
Source(Convert *_convert, int _type)Source [protected]
topSource [protected]
typeSource [protected]
~SourceGroup()SourceGroup


Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classSourceGroup.html b/doc/html/classSourceGroup.html new file mode 100644 index 0000000..5a4c931 --- /dev/null +++ b/doc/html/classSourceGroup.html @@ -0,0 +1,181 @@ + + +libprop: SourceGroup Class Reference + + + + + + +

SourceGroup Class Reference

Interface to a collection of data sources. This can quickly fill Point objects with available data from a large set of source files. +More... +

+#include <source.h> +

+

+Inheritance diagram for SourceGroup:
+
+ +

+ +Source + +
+ +

+List of all members. + + + + + + + + + + + + + + +

Public Member Functions

 ~SourceGroup ()
void add (Source *s)
void resolve (Point *p)
bool contains (Point *p)

Private Attributes

vector< Source * > list
 Internal list of all Source objects we know about.
+


Detailed Description

+Interface to a collection of data sources. This can quickly fill Point objects with available data from a large set of source files.

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + +
SourceGroup::~SourceGroup (  ) 
+
+
+ +

+ +

+

+


Member Function Documentation

+ +
+
+ + + + + + + + + +
void SourceGroup::add (Source s  ) 
+
+
+ +

+Add the given Source to this list of sources. Will be used in any resolve() calls in the future.

Parameters:
+ + +
s Source object to add to our list
+
+ +
+

+ +

+
+ + + + + + + + + +
void SourceGroup::resolve (Point p  )  [virtual]
+
+
+ +

+Resolve a given Point by filling it with any new data this source can provide. Will ignore given point if this source can't provide data.

Parameters:
+ + +
p The point to try filling with data
+
+ +

Implements Source.

+ +
+

+ +

+
+ + + + + + + + + +
bool SourceGroup::contains (Point p  )  [virtual]
+
+
+ +

+Check if any sources we know about can provide data about the given point.

Parameters:
+ + +
p Point to check against
+
+
Returns:
True if any source provides data about given point, otherwise false.
+ +

Reimplemented from Source.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
vector<Source*> SourceGroup::list [private]
+
+
+ +

+Internal list of all Source objects we know about. +

+ +

+

+


The documentation for this class was generated from the following file: +
Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classSourceGroup.png b/doc/html/classSourceGroup.png new file mode 100644 index 0000000..7e60b6e Binary files /dev/null and b/doc/html/classSourceGroup.png differ diff --git a/doc/html/classSourceInteger-members.html b/doc/html/classSourceInteger-members.html new file mode 100644 index 0000000..f8d920e --- /dev/null +++ b/doc/html/classSourceInteger-members.html @@ -0,0 +1,48 @@ + + +libprop: Member List + + + + + + +

SourceInteger Member List

This is the complete list of members for SourceInteger, including all inherited members.

+ + + + + + + + + + + + + + + + + + + + +
bottomSource [protected]
cacheSourceInteger [protected]
cellsizeSource [protected]
contains(Point *p)Source [virtual]
convertSource [protected]
leftSource [protected]
ncolsSource [protected]
nrowsSource [protected]
rawSource [protected]
rawfilenameSource [protected]
resolve(Point *p)SourceInteger [virtual]
resolveList(vector< Point * > list)Source
rightSource [protected]
Source()Source [protected]
Source(Convert *_convert, int _type)Source [protected]
SourceInteger(Convert *convert, int type, string filename, bool cache)SourceInteger
topSource [protected]
typeSource [protected]
value(int offset)SourceInteger [protected]
~SourceInteger()SourceInteger


Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classSourceInteger.html b/doc/html/classSourceInteger.html new file mode 100644 index 0000000..415ec17 --- /dev/null +++ b/doc/html/classSourceInteger.html @@ -0,0 +1,204 @@ + + +libprop: SourceInteger Class Reference + + + + + + +

SourceInteger Class Reference

Interface to a data source. Sources can be asked to fill Point objects with any available data. Specifically handles data files in integer format, usually ending with ".bil" extension. +More... +

+#include <source.h> +

+

+Inheritance diagram for SourceInteger:
+
+ +

+ +Source + +
+ +

+List of all members. + + + + + + + + + + + + + + + +

Public Member Functions

 SourceInteger (Convert *convert, int type, string filename, bool cache)
 ~SourceInteger ()
void resolve (Point *p)

Protected Member Functions

int value (int offset)

Protected Attributes

int * cache
 Internal cache of entire data file, if requested.
+


Detailed Description

+Interface to a data source. Sources can be asked to fill Point objects with any available data. Specifically handles data files in integer format, usually ending with ".bil" extension.

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SourceInteger::SourceInteger (Convert convert,
int  type,
string  filename,
bool  cache 
)
+
+
+ +

+Create a new integer data source.

Parameters:
+ + + + + +
convert The conversion to apply to all incoming points
type Enumeration value describing the type of data we provide
filename Filename pointing to ".hdr" file for this data source
cache Cache entire data file in memory if true, otherwise read directly from file when requested
+
+ +
+

+ +

+
+ + + + + + + + +
SourceInteger::~SourceInteger (  ) 
+
+
+ +

+ +

+

+


Member Function Documentation

+ +
+
+ + + + + + + + + +
int SourceInteger::value (int  offset  )  [protected]
+
+
+ +

+Retrieve a specific value, either from raw source file, or from cache if it exists.

Parameters:
+ + +
offset Offset into the data file to read
+
+
Returns:
Value at offset location
+ +
+

+ +

+
+ + + + + + + + + +
void SourceInteger::resolve (Point p  )  [virtual]
+
+
+ +

+Resolve a given Point by filling it with any new data this source can provide. Will ignore given point if this source can't provide data.

Parameters:
+ + +
p The point to try filling with data
+
+ +

Implements Source.

+ +
+

+


Member Data Documentation

+ +
+
+ + + + +
int* SourceInteger::cache [protected]
+
+
+ +

+Internal cache of entire data file, if requested. +

+ +

+

+


The documentation for this class was generated from the following file: +
Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classSourceInteger.png b/doc/html/classSourceInteger.png new file mode 100644 index 0000000..45b668a Binary files /dev/null and b/doc/html/classSourceInteger.png differ diff --git a/doc/html/classTimeRemaining-members.html b/doc/html/classTimeRemaining-members.html new file mode 100644 index 0000000..a3d9def --- /dev/null +++ b/doc/html/classTimeRemaining-members.html @@ -0,0 +1,35 @@ + + +libprop: Member List + + + + + + +

TimeRemaining Member List

This is the complete list of members for TimeRemaining, including all inherited members.

+ + + + + + + +
displayTimeRemaining [private]
increment()TimeRemaining
maxTimeRemaining [private]
startTimeRemaining [private]
TimeRemaining(int _max, int _display)TimeRemaining
valueTimeRemaining [private]
wideTimeRemaining [private]


Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/classTimeRemaining.html b/doc/html/classTimeRemaining.html new file mode 100644 index 0000000..21783ec --- /dev/null +++ b/doc/html/classTimeRemaining.html @@ -0,0 +1,206 @@ + + +libprop: TimeRemaining Class Reference + + + + + + +

TimeRemaining Class Reference

Helpful class to express remaining time to a user. Displays a progress bar with a remaining time in minutes and seconds. +More... +

+#include <utils.h> +

+ +

+List of all members. + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

 TimeRemaining (int _max, int _display)
void increment ()
 Increment our internal counter by one task. Will update the user display if needed.

Private Attributes

int value
 Current increment value.
int display
 Number of every increment() calls we update display.
int max
 Total number of increment() calls we expect to process.
int wide
 Width of progress bar to output.
time_t start
 Marked starting time of first increment() call.
+


Detailed Description

+Helpful class to express remaining time to a user. Displays a progress bar with a remaining time in minutes and seconds.

Constructor & Destructor Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
TimeRemaining::TimeRemaining (int  _max,
int  _display 
)
+
+
+ +

+Create a new progress bar with user output.

Parameters:
+ + + +
_max The total number of increment() calls that we expect to process
_display Update the user display after every "display" number of increment() calls
+
+ +
+

+


Member Function Documentation

+ +
+
+ + + + + + + + +
void TimeRemaining::increment (  ) 
+
+
+ +

+Increment our internal counter by one task. Will update the user display if needed. +

+ +

+

+


Member Data Documentation

+ +
+
+ + + + +
int TimeRemaining::value [private]
+
+
+ +

+Current increment value. +

+ +

+

+ +

+
+ + + + +
int TimeRemaining::display [private]
+
+
+ +

+Number of every increment() calls we update display. +

+ +

+

+ +

+
+ + + + +
int TimeRemaining::max [private]
+
+
+ +

+Total number of increment() calls we expect to process. +

+ +

+

+ +

+
+ + + + +
int TimeRemaining::wide [private]
+
+
+ +

+Width of progress bar to output. +

+ +

+

+ +

+
+ + + + +
time_t TimeRemaining::start [private]
+
+
+ +

+Marked starting time of first increment() call. +

+ +

+

+


The documentation for this class was generated from the following file: +
Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/doxygen.css b/doc/html/doxygen.css new file mode 100644 index 0000000..e261cf6 --- /dev/null +++ b/doc/html/doxygen.css @@ -0,0 +1,359 @@ +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +BODY,TD { + font-size: 90%; +} +H1 { + text-align: center; + font-size: 160%; +} +H2 { + font-size: 120%; +} +H3 { + font-size: 100%; +} +CAPTION { font-weight: bold } +DIV.qindex { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.nav { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navtab { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +TD.navtab { + font-size: 70%; +} +A.qindex { + text-decoration: none; + font-weight: bold; + color: #1A419D; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1A419D +} +A.qindex:hover { + text-decoration: none; + background-color: #ddddff; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; +} +A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } +A.el { text-decoration: none; font-weight: bold } +A.elRef { font-weight: bold } +A.code:link { text-decoration: none; font-weight: normal; color: #0000FF} +A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF} +A.codeRef:link { font-weight: normal; color: #0000FF} +A.codeRef:visited { font-weight: normal; color: #0000FF} +A:hover { text-decoration: none; background-color: #f2f2ff } +DL.el { margin-left: -1cm } +.fragment { + font-family: monospace, fixed; + font-size: 95%; +} +PRE.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } + +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} +DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } +BODY { + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; +} +TD.indexkey { + background-color: #e8eef2; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TD.indexvalue { + background-color: #e8eef2; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TR.memlist { + background-color: #f0f0f0; +} +P.formulaDsp { text-align: center; } +IMG.formulaDsp { } +IMG.formulaInl { vertical-align: middle; } +SPAN.keyword { color: #008000 } +SPAN.keywordtype { color: #604020 } +SPAN.keywordflow { color: #e08000 } +SPAN.comment { color: #800000 } +SPAN.preprocessor { color: #806020 } +SPAN.stringliteral { color: #002080 } +SPAN.charliteral { color: #008080 } +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { color: #003399; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +TD.tiny { font-size: 75%; +} +a { + color: #1A41A8; +} +a:visited { + color: #2A3798; +} +.dirtab { padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; +} +TH.dirtab { background: #e8eef2; + font-weight: bold; +} +HR { height: 1px; + border: none; + border-top: 1px solid black; +} + +/* Style for detailed member documentation */ +.memtemplate { + font-size: 80%; + color: #606060; + font-weight: normal; + margin-left: 3px; +} +.memnav { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +.memitem { + padding: 4px; + background-color: #eef3f5; + border-width: 1px; + border-style: solid; + border-color: #dedeee; + -moz-border-radius: 8px 8px 8px 8px; +} +.memname { + white-space: nowrap; + font-weight: bold; +} +.memdoc{ + padding-left: 10px; +} +.memproto { + background-color: #d5e1e8; + width: 100%; + border-width: 1px; + border-style: solid; + border-color: #84b0c7; + font-weight: bold; + -moz-border-radius: 8px 8px 8px 8px; +} +.paramkey { + text-align: right; +} +.paramtype { + white-space: nowrap; +} +.paramname { + color: #602020; + font-style: italic; + white-space: nowrap; +} +/* End Styling for detailed member documentation */ + +/* for the tree view */ +.ftvtree { + font-family: sans-serif; + margin:0.5em; +} +.directory { font-size: 9pt; font-weight: bold; } +.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } +.directory > h3 { margin-top: 0; } +.directory p { margin: 0px; white-space: nowrap; } +.directory div { display: none; margin: 0px; } +.directory img { vertical-align: -30%; } diff --git a/doc/html/doxygen.png b/doc/html/doxygen.png new file mode 100644 index 0000000..f0a274b Binary files /dev/null and b/doc/html/doxygen.png differ diff --git a/doc/html/files.html b/doc/html/files.html new file mode 100644 index 0000000..53f0526 --- /dev/null +++ b/doc/html/files.html @@ -0,0 +1,32 @@ + + +libprop: File Index + + + + + + +

libprop File List

Here is a list of all files with brief descriptions: + + + + +
geom.h [code]
radio.h [code]
source.h [code]
utils.h [code]
+
Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/functions.html b/doc/html/functions.html new file mode 100644 index 0000000..0531759 --- /dev/null +++ b/doc/html/functions.html @@ -0,0 +1,232 @@ + + +libprop: Class Members + + + + + + + +
+ +
+ +

+Here is a list of all class members with links to the classes they belong to: +

+

- a -

+

- b -

+

- c -

+

- d -

+

- e -

+

- i -

+

- l -

+

- m -

+

- n -

+

- o -

+

- p -

+

- r -

+

- s -

+

- t -

+

- v -

+

- w -

+

- ~ -

+
Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/functions_func.html b/doc/html/functions_func.html new file mode 100644 index 0000000..da06ee5 --- /dev/null +++ b/doc/html/functions_func.html @@ -0,0 +1,147 @@ + + +libprop: Class Members - Functions + + + + + + + +
+ +
+ +

+  +

+

- a -

+

- b -

+

- c -

+

- d -

+

- i -

+

- l -

+

- p -

+

- r -

+

- s -

+

- t -

+

- v -

+

- ~ -

+
Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/functions_rela.html b/doc/html/functions_rela.html new file mode 100644 index 0000000..e285f38 --- /dev/null +++ b/doc/html/functions_rela.html @@ -0,0 +1,45 @@ + + +libprop: Class Members - Related Functions + + + + + + + +  +

+

+
Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/functions_vars.html b/doc/html/functions_vars.html new file mode 100644 index 0000000..fdefeb0 --- /dev/null +++ b/doc/html/functions_vars.html @@ -0,0 +1,145 @@ + + +libprop: Class Members - Variables + + + + + + + +
+ +
+ +

+  +

+

- b -

+

- c -

+

- d -

+

- e -

+

- l -

+

- m -

+

- n -

+

- r -

+

- s -

+

- t -

+

- v -

+

- w -

+
Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/geom_8h-source.html b/doc/html/geom_8h-source.html new file mode 100644 index 0000000..6d38cfc --- /dev/null +++ b/doc/html/geom_8h-source.html @@ -0,0 +1,142 @@ + + +libprop: geom.h Source File + + + + + +

geom.h

Go to the documentation of this file.
00001 /*
+00002         libprop -- library to simulate and measure radio signal propagation
+00003         
+00004         Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org
+00005         
+00006         This program is free software: you can redistribute it and/or modify
+00007         it under the terms of the GNU General Public License as published by
+00008         the Free Software Foundation, either version 3 of the License, or
+00009         (at your option) any later version.
+00010         
+00011         This program is distributed in the hope that it will be useful,
+00012         but WITHOUT ANY WARRANTY; without even the implied warranty of
+00013         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+00014         GNU General Public License for more details.
+00015         
+00016         You should have received a copy of the GNU General Public License
+00017         along with this program.  If not, see <http://www.gnu.org/licenses/>.
+00018 */
+00019 
+00020 #pragma once
+00021 
+00022 #include <iostream>
+00023 #include <fstream>
+00024 
+00025 #include <vector>
+00026 
+00027 using namespace std;
+00028 
+00029 #include "utils.h"
+00030 
+00031 
+00033 class Point {
+00035         friend ostream& operator<<(ostream& output, const Point& p);
+00037         friend ofstream& operator<<(ofstream& output, const Point& p);
+00039         friend ifstream& operator>>(ifstream& input, Point& p);
+00040         
+00041 public:
+00043         double lat;
+00045         double lon;
+00047         double elev;
+00049         double towerHeight;
+00051         double vegHeight;
+00053         int vegType;
+00055         int vegCover;
+00057         int landType;
+00058         
+00059         Point();
+00060         
+00064         Point(double _lat, double _lon);
+00065         
+00070         Point(double _lat, double _lon, double _towerHeight);
+00071         
+00075         double distance(Point* p);
+00076         
+00080         double bearing(Point* p);
+00081         
+00086         Point* project(double bearing, double distance);
+00087 
+00088 };
+00089 
+00090 
+00091 
+00093 class Region {
+00094 public:
+00098         virtual vector<Point*> discrete(double resolution) = 0;
+00099         
+00103         virtual bool contains(Point* p) = 0;
+00104         
+00107         virtual void add(Point* p) = 0;
+00108 };
+00109 
+00110 
+00112 class RegionArea : Region {
+00114         friend ostream& operator<<(ostream& output, const RegionArea& r);
+00115 private:
+00116 public:
+00118         Point* bottomLeft;
+00120         Point* topRight;
+00121         
+00122         RegionArea();
+00123         
+00127         RegionArea(Point* bottomLeft, Point* topRight);
+00128         
+00132         RegionArea(Point* center, double radius);
+00133         
+00134         ~RegionArea();
+00135         
+00139         vector<Point*> discrete(double resolution);
+00140         
+00144         bool contains(Point* p);
+00145         
+00148         void add(Point* p);
+00149 
+00150 };
+00151 
+00152 
+00154 class RegionLine : Region {
+00156         friend ofstream& operator<<(ofstream& output, const RegionLine& r);
+00157 private:
+00159         vector<Point*> list;
+00160 public:
+00161         RegionLine();
+00162         
+00165         RegionLine(vector<Point*> list);
+00166         
+00170         RegionLine(Point* p, Point* q);
+00171         
+00174         RegionLine(string filename);
+00175         
+00176         ~RegionLine();
+00177         
+00180         double length();
+00181         
+00185         vector<Point*> discrete(double resolution);
+00186         
+00190         bool contains(Point* p);
+00191         
+00194         void add(Point* p);
+00195         
+00196 };
+00197 
+00198 
+

Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/geom_8h.html b/doc/html/geom_8h.html new file mode 100644 index 0000000..cbdabb4 --- /dev/null +++ b/doc/html/geom_8h.html @@ -0,0 +1,45 @@ + + +libprop: geom.h File Reference + + + + + +

geom.h File Reference

#include <iostream>
+#include <fstream>
+#include <vector>
+#include "utils.h"
+ +

+Go to the source code of this file. + + + + + + + + + + + + + + + + + +

Namespaces

namespace  std

Classes

class  Point
 Describe a specific point on the Earth surface. It can also store details about that point, such as its elevation and vegetation. Provides functions such as distance between two points, and projection along a bearing. More...
class  Region
 Define a generic region on the Earth. Can turn its defined region into a series of discrete points, and check if a given point is inside the region. More...
class  RegionArea
 Define a square region across the surface of the Earth, defined using two corner points. Can turn its defined region into a series of discrete points, and check if a given point is inside the region. More...
class  RegionLine
 Define a linear region across the surface of the Earth, defined as a series of points. Can turn its defined region into a series of discrete points, and check if a given point is inside the region. More...
+


Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/globals.html b/doc/html/globals.html new file mode 100644 index 0000000..2c7ae99 --- /dev/null +++ b/doc/html/globals.html @@ -0,0 +1,87 @@ + + +libprop: Class Members + + + + + + +
+ +
+Here is a list of all file members with links to the files they belong to: +

+

+
Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/globals_defs.html b/doc/html/globals_defs.html new file mode 100644 index 0000000..eb695bb --- /dev/null +++ b/doc/html/globals_defs.html @@ -0,0 +1,71 @@ + + +libprop: Class Members + + + + + + +
+ +
+  +

+

+
Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/globals_func.html b/doc/html/globals_func.html new file mode 100644 index 0000000..b27b004 --- /dev/null +++ b/doc/html/globals_func.html @@ -0,0 +1,53 @@ + + +libprop: Class Members + + + + + + +
+ +
+  +

+

+
Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/hierarchy.html b/doc/html/hierarchy.html new file mode 100644 index 0000000..1a1661b --- /dev/null +++ b/doc/html/hierarchy.html @@ -0,0 +1,46 @@ + + +libprop: Hierarchical Index + + + + + + +

libprop Class Hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically: +
Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/index.html b/doc/html/index.html new file mode 100644 index 0000000..7de64ab --- /dev/null +++ b/doc/html/index.html @@ -0,0 +1,22 @@ + + +libprop: Main Page + + + + + +

libprop Documentation

+

+


Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/namespaces.html b/doc/html/namespaces.html new file mode 100644 index 0000000..05703e4 --- /dev/null +++ b/doc/html/namespaces.html @@ -0,0 +1,23 @@ + + +libprop: Namespace Index + + + + + +

libprop Namespace List

Here is a list of all namespaces with brief descriptions: + +
std
+
Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/namespacestd.html b/doc/html/namespacestd.html new file mode 100644 index 0000000..e756120 --- /dev/null +++ b/doc/html/namespacestd.html @@ -0,0 +1,25 @@ + + +libprop: std Namespace Reference + + + + + +

std Namespace Reference

+

+ + +
+


Generated on Sat Feb 23 21:49:23 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/radio_8h-source.html b/doc/html/radio_8h-source.html new file mode 100644 index 0000000..ce91dde --- /dev/null +++ b/doc/html/radio_8h-source.html @@ -0,0 +1,65 @@ + + +libprop: radio.h Source File + + + + + +

radio.h

Go to the documentation of this file.
00001 /*
+00002         libprop -- library to simulate and measure radio signal propagation
+00003         
+00004         Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org
+00005         
+00006         This program is free software: you can redistribute it and/or modify
+00007         it under the terms of the GNU General Public License as published by
+00008         the Free Software Foundation, either version 3 of the License, or
+00009         (at your option) any later version.
+00010         
+00011         This program is distributed in the hope that it will be useful,
+00012         but WITHOUT ANY WARRANTY; without even the implied warranty of
+00013         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+00014         GNU General Public License for more details.
+00015         
+00016         You should have received a copy of the GNU General Public License
+00017         along with this program.  If not, see <http://www.gnu.org/licenses/>.
+00018 */
+00019 
+00020 #pragma once
+00021 
+00022 #include "geom.h"
+00023 #include "source.h"
+00024 #include "utils.h"
+00025 
+00026 
+00027 #define SPEED_LIGHT 299792458 // meters/second
+00028 #define DENIED 1024
+00029 #define LARGE_LOSS -16777216
+00030 
+00031 #define CONSIDER_VEG true
+00032 #define CONSIDER_LAND true
+00033 
+00044 double knifeEdgeLoss(double startY, double endY, double pointY, double distX, double dist1X, double dist2X, double lambda, double sight);
+00045 
+00051 double calcFresnelLoss(double ground, double sight, double fresnel);
+00052 
+00058 double calcLandLoss(int type, double distance, double freq);
+00059 
+00060 //double pathLoss(Point* p, Point* q, SourceGroup* s, double resolution);
+00061 
+00071 double pathLoss(Point* p, Point* q, SourceGroup* s, double resolution, double txPower, double antenna, double freq);
+00072 
+00073 
+00083 double pathLossLongley(Point* p, Point* q, SourceGroup* s, double resolution, double txPower, double antenna, double freq);
+

Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/radio_8h.html b/doc/html/radio_8h.html new file mode 100644 index 0000000..b6f9e2d --- /dev/null +++ b/doc/html/radio_8h.html @@ -0,0 +1,433 @@ + + +libprop: radio.h File Reference + + + + + +

radio.h File Reference

#include "geom.h"
+#include "source.h"
+#include "utils.h"
+ +

+Go to the source code of this file. + + + + + + + + + + + + + + + + + + + + + + + +

Defines

#define SPEED_LIGHT   299792458
#define DENIED   1024
#define LARGE_LOSS   -16777216
#define CONSIDER_VEG   true
#define CONSIDER_LAND   true

Functions

double knifeEdgeLoss (double startY, double endY, double pointY, double distX, double dist1X, double dist2X, double lambda, double sight)
double calcFresnelLoss (double ground, double sight, double fresnel)
double calcLandLoss (int type, double distance, double freq)
double pathLoss (Point *p, Point *q, SourceGroup *s, double resolution, double txPower, double antenna, double freq)
double pathLossLongley (Point *p, Point *q, SourceGroup *s, double resolution, double txPower, double antenna, double freq)
+


Define Documentation

+ +
+
+ + + + +
#define CONSIDER_LAND   true
+
+
+ +

+ +

+

+ +

+
+ + + + +
#define CONSIDER_VEG   true
+
+
+ +

+ +

+

+ +

+
+ + + + +
#define DENIED   1024
+
+
+ +

+ +

+

+ +

+
+ + + + +
#define LARGE_LOSS   -16777216
+
+
+ +

+ +

+

+ +

+
+ + + + +
#define SPEED_LIGHT   299792458
+
+
+ +

+ +

+

+


Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
double calcFresnelLoss (double  ground,
double  sight,
double  fresnel 
)
+
+
+ +

+Calculate the fresnel loss given the situation variables. This model was found in literature, but seems less reliable.

Parameters:
+ + + + +
ground Elevation of ground at current point, in meters
sight Imaginary elevation of line-of-sight between origin and end point, in meters
fresnel Low-point elevation of first-fresnel zone at current point, in meters
+
+
Returns:
Calculated loss, in dBm
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
double calcLandLoss (int  type,
double  distance,
double  freq 
)
+
+
+ +

+Calculate the land-use attentuation loss assuming we pass through a specific distance of given type. This equation seems very unreliable, and has not been verified.

Parameters:
+ + + + +
type Enumeration value of type of land-use we are passing through
distance Distance of this land-use type that our signal passes through, in meters
freq Frequency of our transmitted signal, in MHz
+
+
Returns:
Calculated loss, in dBm
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
double knifeEdgeLoss (double  startY,
double  endY,
double  pointY,
double  distX,
double  dist1X,
double  dist2X,
double  lambda,
double  sight 
)
+
+
+ +

+Calculate the knife-edge loss given the situation variables.

Parameters:
+ + + + + + + + + +
startY Signal origin elevation point, in meters
endY Signal end elevation point, in meters
pointY Elevation where we are currently calculating knife-edge loss, in meters
distX Distance along the path between the origin and end points, in meters
dist1X Fraction along the path between origin and end point, from origin point
dist2X Fraction along the path between origin and end point, remaining towards end point
lambda Lambda value calculated using signal frequency
sight Imaginary elevation of line-of-sight between origin and end point, in meters
+
+
Returns:
Calculated loss as provided by knife-edge diffraction model, in dBm
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
double pathLoss (Point p,
Point q,
SourceGroup s,
double  resolution,
double  txPower,
double  antenna,
double  freq 
)
+
+
+ +

+Calculate the loss if we follow a given path between two radio towers.

Parameters:
+ + + + + + + + +
p Signal origin point, with towerHeight set
q Signal destination point, with towerHeight set
s SourceGroup to provide elevation and vegetaion data as required
resolution Detail used to step along the line-of-sight path, in kilometers
txPower Transmitter power, in mW
antenna Total antenna gain of both receiver and transmitter, in dB
freq Frequency that radios operate at, in MHz
+
+
Returns:
Calculated loss along given path, in dBm
+ +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
double pathLossLongley (Point p,
Point q,
SourceGroup s,
double  resolution,
double  txPower,
double  antenna,
double  freq 
)
+
+
+ +

+Calculate the loss if we follow a given path between two radio towers. Uses Longley-Rice propagation model to calculate attenuation.

Parameters:
+ + + + + + + + +
p Signal origin point, with towerHeight set
q Signal destination point, with towerHeight set
s SourceGroup to provide elevation and vegetaion data as required
resolution Detail used to step along the line-of-sight path, in kilometers
txPower Transmitter power, in mW
antenna Total antenna gain of both receiver and transmitter, in dB
freq Frequency that radios operate at, in MHz
+
+
Returns:
Calculated loss along given path, in dBm
+ +
+

+


Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/source_8h-source.html b/doc/html/source_8h-source.html new file mode 100644 index 0000000..40f33c0 --- /dev/null +++ b/doc/html/source_8h-source.html @@ -0,0 +1,168 @@ + + +libprop: source.h Source File + + + + + +

source.h

Go to the documentation of this file.
00001 /*
+00002         libprop -- library to simulate and measure radio signal propagation
+00003         
+00004         Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org
+00005         
+00006         This program is free software: you can redistribute it and/or modify
+00007         it under the terms of the GNU General Public License as published by
+00008         the Free Software Foundation, either version 3 of the License, or
+00009         (at your option) any later version.
+00010         
+00011         This program is distributed in the hope that it will be useful,
+00012         but WITHOUT ANY WARRANTY; without even the implied warranty of
+00013         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+00014         GNU General Public License for more details.
+00015         
+00016         You should have received a copy of the GNU General Public License
+00017         along with this program.  If not, see <http://www.gnu.org/licenses/>.
+00018 */
+00019 
+00020 #pragma once
+00021 
+00022 #include <iostream>
+00023 #include <fstream>
+00024 #include <string>
+00025 
+00026 #include <math.h>
+00027 
+00028 using namespace std;
+00029 
+00030 #include "geom.h"
+00031 #include "utils.h"
+00032 
+00033 #define TYPE_ELEV 2
+00034 #define TYPE_VEGTYPE 3
+00035 #define TYPE_VEGHEIGHT 4
+00036 #define TYPE_LAND 5
+00037 
+00038 #define LAND_NONE 0
+00039 #define LAND_FOREST 1
+00040 #define LAND_RESIDENTIAL 2
+00041 #define LAND_COMMERCIAL 3
+00042 
+00043 #define EC 0.082271854
+00044 #define EC2 0.006768658
+00045 
+00046 
+00048 class Convert {
+00049 public:
+00054         virtual void convert(Point* p, double* x, double* y);
+00055 };
+00056 
+00057 
+00059 class ConvertAlbers : public Convert {
+00060 private:
+00061         double middleLon, bigC, coneConst, r0;
+00062         
+00063         double calcQ(double lat);
+00064         double calcMsq(double lat);
+00065         
+00066 public:
+00067         ConvertAlbers();
+00068         
+00073         void convert(Point* p, double* x, double* y);
+00074         
+00075 };
+00076 
+00077 
+00079 class Source {
+00080 protected:
+00082         Convert* convert;
+00084         int type;
+00085         int ncols, nrows;
+00086         double top, left, bottom, right;
+00088         double cellsize;
+00090         string rawfilename;
+00092         ifstream raw;
+00093         
+00094         Source();
+00095         
+00099         Source(Convert* _convert, int _type);
+00100         
+00101 public:
+00104         virtual void resolve(Point* p) = 0;
+00105         
+00108         void resolveList(vector<Point*> list);
+00109         
+00113         virtual bool contains(Point* p);
+00114         
+00115 };
+00116 
+00117 
+00118 
+00120 class SourceInteger : public Source {
+00121 protected:
+00123         int* cache;
+00124         
+00128         int value(int offset);
+00129         
+00130 public:
+00131         
+00137         SourceInteger(Convert* convert, int type, string filename, bool cache);
+00138         
+00139         ~SourceInteger();
+00140         
+00143         void resolve(Point* p);
+00144 };
+00145 
+00146 
+00147 
+00149 class SourceGridFloat : public Source {
+00150 protected:
+00152         double* cache;
+00153         
+00157         double value(int offset);
+00158         
+00159 public:
+00160         
+00166         SourceGridFloat(Convert* convert, int type, string filename, bool cache);
+00167         
+00177         SourceGridFloat(Convert* convert, int type, string filename, int _ncols, int _nrows, double _left, double _bottom, double _cellsize);
+00178         
+00179         ~SourceGridFloat();
+00180         
+00183         void resolve(Point* p);
+00184         
+00185 };
+00186 
+00187 
+00188 
+00190 class SourceGroup : public Source {
+00191 private:
+00193         vector<Source*> list;
+00194 public:
+00195         ~SourceGroup();
+00196         
+00199         void add(Source* s);
+00200         
+00203         void resolve(Point* p);
+00204         
+00208         bool contains(Point* p);
+00209         
+00210 };
+00211 
+00212 
+00213 
+00214 
+00215 
+00216 
+

Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/source_8h.html b/doc/html/source_8h.html new file mode 100644 index 0000000..baf7831 --- /dev/null +++ b/doc/html/source_8h.html @@ -0,0 +1,222 @@ + + +libprop: source.h File Reference + + + + + +

source.h File Reference

#include <iostream>
+#include <fstream>
+#include <string>
+#include <math.h>
+#include "geom.h"
+#include "utils.h"
+ +

+Go to the source code of this file. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Classes

class  Convert
 Interface to convert a Point into another coordinate system that could be used to reference into a Source. More...
class  ConvertAlbers
 Interface to convert Point objects into default Albers projection coordinate system. More...
class  Source
 Interface to a data source. Sources can be asked to fill Point objects with any available data. More...
class  SourceInteger
 Interface to a data source. Sources can be asked to fill Point objects with any available data. Specifically handles data files in integer format, usually ending with ".bil" extension. More...
class  SourceGridFloat
 Interface to a data source. Sources can be asked to fill Point objects with any available data. Specifically handles data files in grid float format, usually ending with ".flt" extension. More...
class  SourceGroup
 Interface to a collection of data sources. This can quickly fill Point objects with available data from a large set of source files. More...

Defines

#define TYPE_ELEV   2
#define TYPE_VEGTYPE   3
#define TYPE_VEGHEIGHT   4
#define TYPE_LAND   5
#define LAND_NONE   0
#define LAND_FOREST   1
#define LAND_RESIDENTIAL   2
#define LAND_COMMERCIAL   3
#define EC   0.082271854
#define EC2   0.006768658
+


Define Documentation

+ +
+
+ + + + +
#define EC   0.082271854
+
+
+ +

+ +

+

+ +

+
+ + + + +
#define EC2   0.006768658
+
+
+ +

+ +

+

+ +

+
+ + + + +
#define LAND_COMMERCIAL   3
+
+
+ +

+ +

+

+ +

+
+ + + + +
#define LAND_FOREST   1
+
+
+ +

+ +

+

+ +

+
+ + + + +
#define LAND_NONE   0
+
+
+ +

+ +

+

+ +

+
+ + + + +
#define LAND_RESIDENTIAL   2
+
+
+ +

+ +

+

+ +

+
+ + + + +
#define TYPE_ELEV   2
+
+
+ +

+ +

+

+ +

+
+ + + + +
#define TYPE_LAND   5
+
+
+ +

+ +

+

+ +

+
+ + + + +
#define TYPE_VEGHEIGHT   4
+
+
+ +

+ +

+

+ +

+
+ + + + +
#define TYPE_VEGTYPE   3
+
+
+ +

+ +

+

+


Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/tab_b.gif b/doc/html/tab_b.gif new file mode 100644 index 0000000..0d62348 Binary files /dev/null and b/doc/html/tab_b.gif differ diff --git a/doc/html/tab_l.gif b/doc/html/tab_l.gif new file mode 100644 index 0000000..9b1e633 Binary files /dev/null and b/doc/html/tab_l.gif differ diff --git a/doc/html/tab_r.gif b/doc/html/tab_r.gif new file mode 100644 index 0000000..ce9dd9f Binary files /dev/null and b/doc/html/tab_r.gif differ diff --git a/doc/html/tabs.css b/doc/html/tabs.css new file mode 100644 index 0000000..c37faaf --- /dev/null +++ b/doc/html/tabs.css @@ -0,0 +1,102 @@ +/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ + +DIV.tabs +{ + float : left; + width : 100%; + background : url("tab_b.gif") repeat-x bottom; + margin-bottom : 4px; +} + +DIV.tabs UL +{ + margin : 0px; + padding-left : 10px; + list-style : none; +} + +DIV.tabs LI, DIV.tabs FORM +{ + display : inline; + margin : 0px; + padding : 0px; +} + +DIV.tabs FORM +{ + float : right; +} + +DIV.tabs A +{ + float : left; + background : url("tab_r.gif") no-repeat right top; + border-bottom : 1px solid #84B0C7; + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + +DIV.tabs A:hover +{ + background-position: 100% -150px; +} + +DIV.tabs A:link, DIV.tabs A:visited, +DIV.tabs A:active, DIV.tabs A:hover +{ + color: #1A419D; +} + +DIV.tabs SPAN +{ + float : left; + display : block; + background : url("tab_l.gif") no-repeat left top; + padding : 5px 9px; + white-space : nowrap; +} + +DIV.tabs INPUT +{ + float : right; + display : inline; + font-size : 1em; +} + +DIV.tabs TD +{ + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + + + +/* Commented Backslash Hack hides rule from IE5-Mac \*/ +DIV.tabs SPAN {float : none;} +/* End IE5-Mac hack */ + +DIV.tabs A:hover SPAN +{ + background-position: 0% -150px; +} + +DIV.tabs LI.current A +{ + background-position: 100% -150px; + border-width : 0px; +} + +DIV.tabs LI.current SPAN +{ + background-position: 0% -150px; + padding-bottom : 6px; +} + +DIV.nav +{ + background : none; + border : none; + border-bottom : 1px solid #84B0C7; +} diff --git a/doc/html/testcases_8h-source.html b/doc/html/testcases_8h-source.html new file mode 100644 index 0000000..77c1e5d --- /dev/null +++ b/doc/html/testcases_8h-source.html @@ -0,0 +1,48 @@ + + +libprop: testcases.h Source File + + + + + + +

testcases.h

Go to the documentation of this file.
00001 
+00002 #pragma once
+00003 
+00004 #include "geom.h"
+00005 #include "radio.h"
+00006 #include "source.h"
+00007 #include "utils.h"
+00008 
+00009 #include <time.h>
+00010 
+00011 void testPoint();
+00012 void testRegion();
+00013 void testReading();
+00014 void testFileLine();
+00015 void testReadGF();
+00016 void testFloat();
+00017 void testPath();
+00018 void testBulk();
+00019 void testAlbers();
+00020 void testVegetation();
+00021 void testInteger();
+00022 void testTypePath();
+00023 
+00024 
+

Generated on Tue Nov 6 11:42:55 2007 for libprop by  + +doxygen 1.5.1
+ + diff --git a/doc/html/testcases_8h.html b/doc/html/testcases_8h.html new file mode 100644 index 0000000..b643fba --- /dev/null +++ b/doc/html/testcases_8h.html @@ -0,0 +1,288 @@ + + +libprop: testcases.h File Reference + + + + + + +

testcases.h File Reference

#include "geom.h"
+#include "radio.h"
+#include "source.h"
+#include "utils.h"
+#include <time.h>
+ +

+Go to the source code of this file. + + + + + + + + + + + + + + + + + + + + + + + + + + +

Functions

void testPoint ()
void testRegion ()
void testReading ()
void testFileLine ()
void testReadGF ()
void testFloat ()
void testPath ()
void testBulk ()
void testAlbers ()
void testVegetation ()
void testInteger ()
void testTypePath ()
+


Function Documentation

+ +
+
+ + + + + + + + +
void testAlbers (  ) 
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + +
void testBulk (  ) 
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + +
void testFileLine (  ) 
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + +
void testFloat (  ) 
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + +
void testInteger (  ) 
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + +
void testPath (  ) 
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + +
void testPoint (  ) 
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + +
void testReadGF (  ) 
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + +
void testReading (  ) 
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + +
void testRegion (  ) 
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + +
void testTypePath (  ) 
+
+
+ +

+ +

+

+ +

+
+ + + + + + + + +
void testVegetation (  ) 
+
+
+ +

+ +

+

+


Generated on Tue Nov 6 11:42:55 2007 for libprop by  + +doxygen 1.5.1
+ + diff --git a/doc/html/utils_8h-source.html b/doc/html/utils_8h-source.html new file mode 100644 index 0000000..4a363e6 --- /dev/null +++ b/doc/html/utils_8h-source.html @@ -0,0 +1,76 @@ + + +libprop: utils.h Source File + + + + + +

utils.h

Go to the documentation of this file.
00001 /*
+00002         libprop -- library to simulate and measure radio signal propagation
+00003         
+00004         Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org
+00005         
+00006         This program is free software: you can redistribute it and/or modify
+00007         it under the terms of the GNU General Public License as published by
+00008         the Free Software Foundation, either version 3 of the License, or
+00009         (at your option) any later version.
+00010         
+00011         This program is distributed in the hope that it will be useful,
+00012         but WITHOUT ANY WARRANTY; without even the implied warranty of
+00013         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+00014         GNU General Public License for more details.
+00015         
+00016         You should have received a copy of the GNU General Public License
+00017         along with this program.  If not, see <http://www.gnu.org/licenses/>.
+00018 */
+00019 
+00020 #pragma once
+00021 
+00022 #include <math.h>
+00023 #include <float.h>
+00024 #include <assert.h>
+00025 
+00026 #include <iostream>
+00027 #include <time.h>
+00028 
+00029 using namespace std;
+00030 
+00031 
+00032 #define PI 3.14159
+00033 #define RADIUS 6378.2064
+00034  
+00036 double toRadians(double d);
+00037 
+00039 double toDegrees(double r);
+00040 
+00044 double ieee_single(char *data2);
+00045 
+00046 
+00047 
+00049 class TimeRemaining {
+00050 private:
+00052         int value;
+00054         int display;
+00056         int max;
+00058         int wide;
+00060         time_t start;
+00061 
+00062 public:
+00066         TimeRemaining(int _max, int _display);
+00067         
+00069         void increment();
+00070 };
+00071 
+

Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/doc/html/utils_8h.html b/doc/html/utils_8h.html new file mode 100644 index 0000000..3ff1a2e --- /dev/null +++ b/doc/html/utils_8h.html @@ -0,0 +1,150 @@ + + +libprop: utils.h File Reference + + + + + +

utils.h File Reference

#include <math.h>
+#include <float.h>
+#include <assert.h>
+#include <iostream>
+#include <time.h>
+ +

+Go to the source code of this file. + + + + + + + + + + + + + + + + + + + +

Classes

class  TimeRemaining
 Helpful class to express remaining time to a user. Displays a progress bar with a remaining time in minutes and seconds. More...

Defines

#define PI   3.14159
#define RADIUS   6378.2064

Functions

double toRadians (double d)
 Convert given degree value into radians.
double toDegrees (double r)
 Convert given radians value into degrees.
double ieee_single (char *data2)
+


Define Documentation

+ +
+
+ + + + +
#define PI   3.14159
+
+
+ +

+ +

+

+ +

+
+ + + + +
#define RADIUS   6378.2064
+
+
+ +

+ +

+

+


Function Documentation

+ +
+
+ + + + + + + + + +
double ieee_single (char *  data2  ) 
+
+
+ +

+Convert the given character string into a single value, interpreting it using the IEEE single standard.

Parameters:
+ + +
data2 Value to be converted, requires four bytes
+
+
Returns:
Interpreted value expressed as a double
+ +
+

+ +

+
+ + + + + + + + + +
double toDegrees (double  r  ) 
+
+
+ +

+Convert given radians value into degrees. +

+ +

+

+ +

+
+ + + + + + + + + +
double toRadians (double  d  ) 
+
+
+ +

+Convert given degree value into radians. +

+ +

+

+


Generated on Sat Feb 23 21:49:22 2008 for libprop by  + +doxygen 1.5.4
+ + diff --git a/geom.C b/geom.C new file mode 100644 index 0000000..de57a35 --- /dev/null +++ b/geom.C @@ -0,0 +1,251 @@ +/* + libprop -- library to simulate and measure radio signal propagation + + Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "geom.h" +#include "utils.h" + +#include +#include +#include +#include + +using namespace std; + + + +ostream& operator<<(ostream& output, const Point& p) { + output.precision(8); + output << "(" << p.lat << "," << p.lon << ")"; + return output; +} + +ofstream& operator<<(ofstream& output, const Point& p) { + output.precision(8); + output << p.lat << "\t" << p.lon << endl; + return output; +} + +ifstream& operator>>(ifstream& input, Point& p) { + input >> p.lat >> p.lon; + return input; +} + +Point::Point() : lat(-1), lon(-1), elev(-1), towerHeight(0), vegHeight(0), vegType(-1), vegCover(-1), landType(-1) { +} + +Point::Point(double _lat, double _lon) : lat(_lat), lon(_lon), elev(-1), towerHeight(0), vegHeight(0), vegType(-1), vegCover(-1), landType(-1) { +} + +Point::Point(double _lat, double _lon, double _towerHeight) : lat(_lat), lon(_lon), elev(-1), towerHeight(_towerHeight), vegHeight(0), vegType(-1), vegCover(-1), landType(-1) { +} + +double Point::distance(Point* p) { + // calculate distance from here to point in km + double lat1 = toRadians(lat), lon1 = toRadians(lon), + lat2 = toRadians(p->lat), lon2 = toRadians(p->lon); + + return acos(sin(lat1) * sin(lat2) + + cos(lat1) * cos(lat2) * cos(lon2 - lon1)) * RADIUS; +} + +double Point::bearing(Point* p) { + // calculate bearing from here to point in radians + double lat1 = toRadians(lat), lon1 = toRadians(lon), + lat2 = toRadians(p->lat), lon2 = toRadians(p->lon); + + return atan2(sin(lon2 - lon1) * cos(lat2), + cos(lat1) * sin(lat2) - + sin(lat1) * cos(lat2) * cos(lon2 - lon1)); +} + +Point* Point::project(double bearing, double distance) { + // project from here at bearing (radians) for distance (km) + double lat1 = toRadians(lat), lon1 = toRadians(lon); + double ratio = distance / RADIUS; + + double lat2 = asin(sin(lat1) * cos(ratio) + + cos(lat1) * sin(ratio) * cos(bearing)); + double lon2 = lon1 + atan2(sin(bearing) * sin(ratio) * cos(lat1), + cos(ratio) - sin(lat1) * sin(lat2)); + + return new Point(toDegrees(lat2), toDegrees(lon2)); +} + + + + + + + +ostream& operator<<(ostream& output, const RegionArea& r) { + output << "[" << *(r.bottomLeft) << "," << *(r.topRight) << "]"; + return output; +} + +RegionArea::RegionArea() { + bottomLeft = new Point(1024, 1024); + topRight = new Point(0, -1024); +} + +RegionArea::~RegionArea() { + delete bottomLeft; + delete topRight; +} + +RegionArea::RegionArea(Point* bottomLeft, Point* topRight) { + this->bottomLeft = bottomLeft; + this->topRight = topRight; +} + +RegionArea::RegionArea(Point* center, double radius) { + topRight = center->project(toRadians(45), radius); + bottomLeft = center->project(toRadians(225), radius); +} + +vector RegionArea::discrete(double resolution) { + // step through entire region making a grid of discrete points + // convert km to degree resolution + Point* q = bottomLeft->project(0, resolution); + double degRes = q->lat - bottomLeft->lat; + + vector list; + for(double lat = bottomLeft->lat; lat < topRight->lat; lat += degRes) { + for(double lon = bottomLeft->lon; lon < topRight->lon; lon += degRes) { + list.push_back(new Point(lat, lon)); + } + } + return list; +} + +bool RegionArea::contains(Point* p) { + // check if given point is inside this area + return (p->lat <= topRight->lat && p->lat >= bottomLeft->lat && + p->lon <= topRight->lon && p->lon >= bottomLeft->lon); +} + +void RegionArea::add(Point* p) { + // force the area to enlarge to include given point + bottomLeft->lat = min(bottomLeft->lat, p->lat); + bottomLeft->lon = min(bottomLeft->lon, p->lon); + topRight->lat = max(topRight->lat, p->lat); + topRight->lon = max(topRight->lon, p->lon); +} + + + + + + + + +ofstream& operator<<(ofstream& output, const RegionLine& r) { + vector list = r.list; + vector::iterator it; + for(it = list.begin(); it != list.end(); it++) { + cout << *(*it); + } + return output; +} + +RegionLine::RegionLine() { +} + +RegionLine::RegionLine(vector list) { + this->list = list; +} + +RegionLine::RegionLine(Point* p, Point* q) { + list.push_back(p); + list.push_back(q); +} + +RegionLine::RegionLine(string filename) { + // read in file of points to create line + ifstream in(filename.c_str(), ifstream::in); + while(in.good()) { + Point* p = new Point(); + in >> *p; + if(p->lat == -1 || p->lon == -1) continue; + list.push_back(p); + } + in.close(); + +} + +RegionLine::~RegionLine() { + // not deallocated, what if we still need these points later? + //vector::iterator it; + //for(it = list.begin(); it != list.end(); it++) { + // delete *it; + //} +} + +double RegionLine::length() { + vector::iterator it; + double length = 0; + Point* last = list[0]; + for(it = list.begin(), it++; it != list.end(); it++) { + length += last->distance(*it); + last = *it; + } + return length; +} + +vector RegionLine::discrete(double resolution) { + // turn path into list of discrete points + vector list; + double length = this->length(); + int i = 0; + + Point* last = NULL; + Point* next = this->list[i++]; + double lastExact = 0, + bearing = 0, + distance = 0; + +//cout << "entering next=" << next << endl; fflush(stdout); +//cout << "expected length=" << length << endl; + + for(double here = 0; here < length; here += resolution) { + // check if we need to start into the next line segment + while(here - lastExact >= distance) { + last = next; + next = this->list[i++]; +//cout << "\tnewline, last=" << last << "\tnext=" << next << "\tdistance=" << distance << endl; fflush(stdout); + lastExact += distance; + bearing = last->bearing(next); + distance = last->distance(next); + } + + // extend from last point + Point* p = last->project(bearing, here - lastExact); + list.push_back(p); + } + + return list; +} + +bool RegionLine::contains(Point* p) { + return false; +} + +void RegionLine::add(Point* p) { + list.push_back(p); +} + diff --git a/geom.h b/geom.h new file mode 100644 index 0000000..afdf341 --- /dev/null +++ b/geom.h @@ -0,0 +1,198 @@ +/* + libprop -- library to simulate and measure radio signal propagation + + Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#pragma once + +#include +#include + +#include + +using namespace std; + +#include "utils.h" + + +/// Describe a specific point on the Earth surface. It can also store details about that point, such as its elevation and vegetation. Provides functions such as distance between two points, and projection along a bearing. +class Point { + /// Output point in "(lat,long)" format + friend ostream& operator<<(ostream& output, const Point& p); + /// Output point in "lat\tlong" format + friend ofstream& operator<<(ofstream& output, const Point& p); + /// Read in point in "lat\tlong" format + friend ifstream& operator>>(ifstream& input, Point& p); + +public: + /// Actual latitude of this point + double lat; + /// Actual longitude of this point + double lon; + /// Optional elevation of given point, usually filled by a Source object + double elev; + /// Optional height of a tower at this point + double towerHeight; + /// Optional height of vegetation above ground elevation at this point, usually filled by a Source object + double vegHeight; + /// Optional raw vegetation type, usually filled by vegetation Source object + int vegType; + /// Optional percentage (0-100) of vegetation cover as read from vegetation Source object + int vegCover; + /// Optional raw land use type, usually filled by a land-use Source object + int landType; + + Point(); + + /// Create new Point object with given coordinates. + /// @param _lat Latitude to assign to new point (range -90 to 90) + /// @param _lon Longitude to assign to new point (range -180 to 180) + Point(double _lat, double _lon); + + /// Create new Point object with given coordinates. Also set the height of a tower at this point to the height given in meters. + /// @param _lat Latitude to assign to new point (range -90 to 90) + /// @param _lon Longitude to assign to new point (range -180 to 180) + /// @param _towerHeight Height to assign to tower at this point (in meters) + Point(double _lat, double _lon, double _towerHeight); + + /// Calculate the distance between this point and the second given point. + /// @param p Second point to compare this object against + /// @return Distance between the two given points in kilometers + double distance(Point* p); + + /// Calculate the compass bearing from this point towards the second given point. If we walk from this point using the returned bearing, we will reach the second point. + /// @param p Second point to compare this object against. + /// @return Bearing from this point towards second given point (value returned in radians (range 0 to 2\pi) + double bearing(Point* p); + + /// Project this point along the given bearing line for the given distance and return the new point. + /// @param bearing Bearing to follow from this point in radians (range 0 to 2\pi) + /// @param distance Distance to walk along bearing line in kilometers + /// @return New point object after walking given distance along the bearing line. + Point* project(double bearing, double distance); + +}; + + + +/// Define a generic region on the Earth. Can turn its defined region into a series of discrete points, and check if a given point is inside the region. +class Region { +public: + /// Turn the defined region into a discrete set of points, using resolution to describe the level of detail. + /// @param resolution Level of spacing (detail) between the discrete points to be created. Value in kilometers. + /// @return List of points that describe this region using the level of resolution requested + virtual vector discrete(double resolution) = 0; + + /// Check if this region contains the given point. + /// @param p Point to check against + /// @return True if point is inside this region, false otherwise + virtual bool contains(Point* p) = 0; + + /// Add the given Point to this Region, expanding the region as needed so that contains(p) returns true. + /// @param p The point to include in this region + virtual void add(Point* p) = 0; +}; + + +/// Define a square region across the surface of the Earth, defined using two corner points. Can turn its defined region into a series of discrete points, and check if a given point is inside the region. +class RegionArea : Region { + /// Output region in "[(lat,long),(lat,long]" format + friend ostream& operator<<(ostream& output, const RegionArea& r); +private: +public: + /// Describe the bottom left corner of this square region + Point* bottomLeft; + /// Describe the top right corner of this square region + Point* topRight; + + RegionArea(); + + /// Create new square region using the given points as the bottom-left and top-right corners. + /// @param bottomLeft Bottom-left corner point of the new region + /// @param topRight Top-right corner point of the new region + RegionArea(Point* bottomLeft, Point* topRight); + + /// Create new square region using the given point as the region center and distance of radius to each corner. + /// @param center Point to center the square region around + /// @param radius Radius in kilometers from the center point to each corner of the square region + RegionArea(Point* center, double radius); + + ~RegionArea(); + + /// Turn the defined square region into a discrete set of points, using resolution to describe the level of detail. Effectively builds a grid across the square with resolution spacing. + /// @param resolution Level of spacing (detail) between the discrete points to be created. Value in kilometers. + /// @return List of points that describe this region using the level of resolution requested + vector discrete(double resolution); + + /// Check if this region contains the given point. + /// @param p Point to check against + /// @return True if point is inside this region, false otherwise + bool contains(Point* p); + + /// Add the given Point to this Region, expanding the region as needed so that contains(p) returns true. Will expand the nearest square corner so that this region covers the given point. + /// @param p The point to include in this region + void add(Point* p); + +}; + + +/// Define a linear region across the surface of the Earth, defined as a series of points. Can turn its defined region into a series of discrete points, and check if a given point is inside the region. +class RegionLine : Region { + /// Output region in "lat\tlon\n..." format + friend ofstream& operator<<(ofstream& output, const RegionLine& r); +private: + /// List of all points contained in this linear region + vector list; +public: + RegionLine(); + + /// Create new linear region that will contain the given list of points. + /// @param list List of points to include in the new linear region + RegionLine(vector list); + + /// Create new linear region that contains only the two given points. Additional points can still be added later if needed. + /// @param p Starting point for new line + /// @param q Ending point for new line + RegionLine(Point* p, Point* q); + + /// Create a new linear region by reading a list of points from a file. Usually used for reading in description of a roadway. Expecting file format to be "lat\tlon\n...-1\t-1\n". + /// @param filename Filename to open and read list of points from + RegionLine(string filename); + + ~RegionLine(); + + /// Calcuate the total length of this linear region + /// @return Length of linear region in kilometers + double length(); + + /// Turn the defined linear region into a discrete set of points, using resolution to describe the level of detail. Effectively steps along the line defined in resolution-length steps. + /// @param resolution Level of spacing (detail) between the discrete points to be created. Value in kilometers. + /// @return List of points that describe this region using the level of resolution requested + vector discrete(double resolution); + + /// Check if this region contains the given point. Always returns false for line segments. + /// @param p Point to check against + /// @return Always returns false. + bool contains(Point* p); + + /// Add the given Point to this Region. Will append given point to the end of this line segment. + /// @param p The point to include in this region + void add(Point* p); + +}; + + diff --git a/longley.C b/longley.C new file mode 100644 index 0000000..e7ce36b --- /dev/null +++ b/longley.C @@ -0,0 +1,1257 @@ +/* + +longley.C -- longley-rice routines taken almost verbatim from public-domain source + +The software contained within was developed by an agency of the U.S. Government. NTIA/ITS has no objection to the use of this software for any purpose since it is not subject to copyright protection in the U.S. + +No warranty, expressed or implied, is made by NTIA/ITS or the U.S. Government as to the accuracy, suitability and functioning of the program and related material, nor shall the fact of distribution constitute any endorsement by the U.S. Government. + +sources: +http://flattop.its.bldrdoc.gov/itm.html +http://flattop.its.bldrdoc.gov/itm/ITMDLL.cpp + +*/ + + + +// ************************************* +// C++ routines for this program are taken from +// a translation of the FORTRAN code written by +// U.S. Department of Commerce NTIA/ITS +// Institute for Telecommunication Sciences +// ***************** +// Irregular Terrain Model (ITM) (Longley-Rice) +// ************************************* + + + +#include +#include +#include +#include +#include +#include +#include + +#define THIRD (1.0/3.0) + +using namespace std; + +struct tcomplex + { double tcreal; + double tcimag; + }; + +struct prop_type +{ double aref; + double dist; + double hg[2]; + double wn; + double dh; + double ens; + double gme; + double zgndreal; + double zgndimag; + double he[2]; + double dl[2]; + double the[2]; + int kwx; + int mdp; +}; + +struct propv_type +{ double sgc; + int lvar; + int mdvar; + int klim; +}; + +struct propa_type +{ double dlsa; + double dx; + double ael; + double ak1; + double ak2; + double aed; + double emd; + double aes; + double ems; + double dls[2]; + double dla; + double tha; +}; + +int mymin(const int &i, const int &j) +{ if(ij) + return i; + else + return j; +} + +double mymin(const double &a, const double &b) +{ if(ab) + return a; + else + return b; +} + +double FORTRAN_DIM(const double &x, const double &y) +{ // This performs the FORTRAN DIM function. + // result is x-y if x is greater than y; otherwise result is 0.0 + if(x>y) + return x-y; + else + return 0.0; +} + +double aknfe(const double &v2) +{ double a; + if(v2<5.76) + a=6.02+9.11*sqrt(v2)-1.27*v2; + else + a=12.953+4.343*log(v2); + return a; +} + +double fht(const double& x, const double& pk) +{ double w, fhtv; + if(x<200.0) + { w=-log(pk); + if( pk < 1e-5 || x*pow(w,3.0) > 5495.0 ) + { fhtv=-117.0; + if(x>1.0) + fhtv=17.372*log(x)+fhtv; + } + else + fhtv=2.5e-5*x*x/pk-8.686*w-15.0; + } + else + { fhtv=0.05751*x-4.343*log(x); + if(x<2000.0) + { w=0.0134*x*exp(-0.005*x); + fhtv=(1.0-w)*fhtv+w*(17.372*log(x)-117.0); + } + } + return fhtv; +} + +double h0f(double r, double et) +{ double a[5]={25.0, 80.0, 177.0, 395.0, 705.0}; + double b[5]={24.0, 45.0, 68.0, 80.0, 105.0}; + double q, x; + int it; + double h0fv; + it=(int)et; + if(it<=0) + { it=1; + q=0.0; + } + else if(it>=5) + { it=5; + q=0.0; + } + else + q=et-it; + x=pow(1.0/r,2.0); + h0fv=4.343*log((a[it-1]*x+b[it-1])*x+1.0); + if(q!=0.0) + h0fv=(1.0-q)*h0fv+q*4.343*log((a[it]*x+b[it])*x+1.0); + return h0fv; +} + +double ahd(double td) +{ int i; + double a[3] = { 133.4, 104.6, 71.8}; + double b[3] = {0.332e-3, 0.212e-3, 0.157e-3}; + double c[3] = { -4.343, -1.086, 2.171}; + if(td<=10e3) + i=0; + else if(td<=70e3) + i=1; + else + i=2; + return a[i]+b[i]*td+c[i]*log(td); +} + +double adiff( double d, prop_type &prop, propa_type &propa) +{ complex prop_zgnd(prop.zgndreal,prop.zgndimag); + static double wd1, xd1, afo, qk, aht, xht; + double a, q, pk, ds, th, wa, ar, wd, adiffv; + if(d==0) + { q=prop.hg[0]*prop.hg[1]; + qk=prop.he[0]*prop.he[1]-q; + if(prop.mdp<0.0) + q+=10.0; + wd1=sqrt(1.0+qk/q); + xd1=propa.dla+propa.tha/prop.gme; + q=(1.0-0.8*exp(-propa.dlsa/50e3))*prop.dh; + q*=0.78*exp(-pow(q/16.0,0.25)); + afo=mymin(15.0,2.171*log(1.0+4.77e-4*prop.hg[0]*prop.hg[1] * + prop.wn*q)); + qk=1.0/abs(prop_zgnd); + aht=20.0; + xht=0.0; + for(int j=0;j<2;++j) + { a=0.5*pow(prop.dl[j],2.0)/prop.he[j]; + wa=pow(a*prop.wn,THIRD); + pk=qk/wa; + q=(1.607-pk)*151.0*wa*prop.dl[j]/a; + xht+=q; + aht+=fht(q,pk); + } + adiffv=0.0; + } + else + { th=propa.tha+d*prop.gme; + ds=d-propa.dla; + q=0.0795775*prop.wn*ds*pow(th,2.0); + adiffv=aknfe(q*prop.dl[0]/(ds+prop.dl[0]))+aknfe(q*prop.dl[1]/(ds+prop.dl[1])); + a=ds/th; + wa=pow(a*prop.wn,THIRD); + pk=qk/wa; + q=(1.607-pk)*151.0*wa*th+xht; + ar=0.05751*q-4.343*log(q)-aht; + q=(wd1+xd1/d)*mymin(((1.0-0.8*exp(-d/50e3))*prop.dh*prop.wn),6283.2); + wd=25.1/(25.1+sqrt(q)); + adiffv=ar*wd+(1.0-wd)*adiffv+afo; + } + return adiffv; +} + +double ascat( double d, prop_type &prop, propa_type &propa) +{ complex prop_zgnd(prop.zgndreal,prop.zgndimag); + static double ad, rr, etq, h0s; + double h0, r1, r2, z0, ss, et, ett, th, q; + double ascatv; + if(d==0.0) + { ad=prop.dl[0]-prop.dl[1]; + rr=prop.he[1]/prop.he[0]; + if(ad<0.0) + { ad=-ad; + rr=1.0/rr; + } + etq=(5.67e-6*prop.ens-2.32e-3)*prop.ens+0.031; + h0s=-15.0; + ascatv=0.0; + } + else + { if(h0s>15.0) + h0=h0s; + else + { th=prop.the[0]+prop.the[1]+d*prop.gme; + r2=2.0*prop.wn*th; + r1=r2*prop.he[0]; + r2*=prop.he[1]; + if(r1<0.2 && r2<0.2) + return 1001.0; // <==== early return + ss=(d-ad)/(d+ad); + q=rr/ss; + ss=mymax(0.1,ss); + q=mymin(mymax(0.1,q),10.0); + z0=(d-ad)*(d+ad)*th*0.25/d; + et=(etq*exp(-pow(mymin(1.7,z0/8.0e3),6.0))+1.0)*z0/1.7556e3; + ett=mymax(et,1.0); + h0=(h0f(r1,ett)+h0f(r2,ett))*0.5; + h0+=mymin(h0,(1.38-log(ett))*log(ss)*log(q)*0.49); + h0=FORTRAN_DIM(h0,0.0); + if(et<1.0) + h0=et*h0+(1.0-et)*4.343*log(pow((1.0+1.4142/r1) * + (1.0+1.4142/r2),2.0)*(r1+r2)/(r1+r2+2.8284)); + if(h0>15.0 && h0s>=0.0) + h0=h0s; + } + h0s=h0; + th=propa.tha+d*prop.gme; + ascatv=ahd(th*d)+4.343*log(47.7*prop.wn*pow(th,4.0))-0.1 * + (prop.ens-301.0)*exp(-th*d/40e3)+h0; + } + return ascatv; +} + +double qerfi( double q ) +{ double x, t, v; + double c0 = 2.515516698; + double c1 = 0.802853; + double c2 = 0.010328; + double d1 = 1.432788; + double d2 = 0.189269; + double d3 = 0.001308; + + x = 0.5 - q; + t = mymax(0.5 - fabs(x), 0.000001); + t = sqrt(-2.0 * log(t)); + v = t - ((c2 * t + c1) * t + c0) / (((d3 * t + d2) * t + d1) * t + 1.0); + if (x < 0.0) v = -v; + return v; +} + +void qlrps( double fmhz, double zsys, double en0, + int ipol, double eps, double sgm, prop_type &prop) +{ double gma=157e-9; + prop.wn=fmhz/47.7; + prop.ens=en0; + if(zsys!=0.0) + prop.ens*=exp(-zsys/9460.0); + prop.gme=gma*(1.0-0.04665*exp(prop.ens/179.3)); + complex zq, prop_zgnd(prop.zgndreal,prop.zgndimag); + zq=complex (eps,376.62*sgm/prop.wn); + prop_zgnd=sqrt(zq-1.0); + if(ipol!=0.0) + prop_zgnd = prop_zgnd/zq; + + prop.zgndreal=prop_zgnd.real(); prop.zgndimag=prop_zgnd.imag(); +} + +double abq_alos (complex r) +{ return r.real()*r.real()+r.imag()*r.imag(); } + +double alos( double d, prop_type &prop, propa_type &propa) +{ complex prop_zgnd(prop.zgndreal,prop.zgndimag); + static double wls; + complex r; + double s, sps, q; + double alosv; + if(d==0.0) + { wls=0.021/(0.021+prop.wn*prop.dh/mymax(10e3,propa.dlsa)); + alosv=0.0; + } + else + { q=(1.0-0.8*exp(-d/50e3))*prop.dh; + s=0.78*q*exp(-pow(q/16.0,0.25)); + q=prop.he[0]+prop.he[1]; + sps=q/sqrt(d*d+q*q); + r=(sps-prop_zgnd)/(sps+prop_zgnd)*exp(-mymin(10.0,prop.wn*s*sps)); + q=abq_alos(r); + if(q<0.25 || q1.57) + q=3.14-2.4649/q; + alosv=(-4.343*log(abq_alos(complex(cos(q),-sin(q))+r))-alosv) * + wls+alosv; + } + return alosv; +} + + +void qlra( int kst[], int klimx, int mdvarx, + prop_type &prop, propv_type &propv) +{ complex prop_zgnd(prop.zgndreal,prop.zgndimag); + double q; + for(int j=0;j<2;++j) + { if(kst[j]<=0) + prop.he[j]=prop.hg[j]; + else + { q=4.0; + if(kst[j]!=1) + q=9.0; + if(prop.hg[j]<5.0) + q*=sin(0.3141593*prop.hg[j]); + prop.he[j]=prop.hg[j]+(1.0+q)*exp(-mymin(20.0,2.0*prop.hg[j]/mymax(1e-3,prop.dh))); + } + q=sqrt(2.0*prop.he[j]/prop.gme); + prop.dl[j]=q*exp(-0.07*sqrt(prop.dh/mymax(prop.he[j],5.0))); + prop.the[j]=(0.65*prop.dh*(q/prop.dl[j]-1.0)-2.0*prop.he[j])/q; + } + prop.mdp=1; + propv.lvar=mymax(propv.lvar,3); + if(mdvarx>=0) + { propv.mdvar=mdvarx; + propv.lvar=mymax(propv.lvar,4); + } + if(klimx>0) + { propv.klim=klimx; + propv.lvar=5; + } +} + +void lrprop (double d, + prop_type &prop, propa_type &propa) // PaulM_lrprop +{ static bool wlos, wscat; + static double dmin, xae; + complex prop_zgnd(prop.zgndreal,prop.zgndimag); + double a0, a1, a2, a3, a4, a5, a6; + double d0, d1, d2, d3, d4, d5, d6; + bool wq; + double q; + int j; + + if(prop.mdp!=0) + { + for(j=0;j<2;j++) + propa.dls[j]=sqrt(2.0*prop.he[j]/prop.gme); + propa.dlsa=propa.dls[0]+propa.dls[1]; + propa.dla=prop.dl[0]+prop.dl[1]; + propa.tha=mymax(prop.the[0]+prop.the[1],-propa.dla*prop.gme); + wlos=false; + wscat=false; + if(prop.wn<0.838 || prop.wn>210.0) + { prop.kwx=mymax(prop.kwx,1); + } + for(j=0;j<2;j++) + if(prop.hg[j]<1.0 || prop.hg[j]>1000.0) + { prop.kwx=mymax(prop.kwx,1); + } + for(j=0;j<2;j++) + if( abs(prop.the[j]) >200e-3 || prop.dl[j]<0.1*propa.dls[j] || + prop.dl[j]>3.0*propa.dls[j] ) + { prop.kwx=mymax(prop.kwx,3); + } + +// changed to indicate which condition triggered error +if(prop.ens < 250.0 || prop.ens > 400.0) prop.kwx = 5; +if(prop.gme < 75e-9 || prop.gme > 250e-9) prop.kwx = 6; +if(prop_zgnd.real() <= abs(prop_zgnd.imag())) prop.kwx = 7; +if(prop.wn < 0.419 || prop.wn > 420.0) prop.kwx = 8; + +for(j=0;j<2;j++) + if(prop.hg[j]<0.5 || prop.hg[j]>3000.0) + prop.kwx = 9; + + dmin=abs(prop.he[0]-prop.he[1])/200e-3; + q=adiff(0.0,prop,propa); + xae=pow(prop.wn*pow(prop.gme,2),-THIRD); + d3=mymax(propa.dlsa,1.3787*xae+propa.dla); + d4=d3+2.7574*xae; + a3=adiff(d3,prop,propa); + a4=adiff(d4,prop,propa); + propa.emd=(a4-a3)/(d4-d3); + propa.aed=a3-propa.emd*d3; + } + if(prop.mdp>=0) + { prop.mdp=0; + prop.dist=d; + } + if(prop.dist>0.0) + { + if(prop.dist>1000e3) + { prop.kwx=mymax(prop.kwx,1); + } + if(prop.dist2000e3) prop.kwx = 11; + } + if(prop.dist=0.0) + { d0=mymin(d0,0.5*propa.dla); + d1=d0+0.25*(propa.dla-d0); + } + else + d1=mymax(-propa.aed/propa.emd,0.25*propa.dla); + a1=alos(d1,prop,propa); + wq=false; + if(d0=0.0 || propa.ak2>0.0; + if(wq) + { + propa.ak1=(a2-a0-propa.ak2*q)/(d2-d0); + if(propa.ak1<0.0) + { propa.ak1=0.0; + propa.ak2=FORTRAN_DIM(a2,a0)/q; + if(propa.ak2==0.0) propa.ak1=propa.emd; + } + } + } + if(!wq) + { propa.ak1=FORTRAN_DIM(a2,a1)/(d2-d1); + propa.ak2=0.0; + if(propa.ak1==0.0) propa.ak1=propa.emd; + } + propa.ael=a2-propa.ak1*d2-propa.ak2*log(d2); + wlos=true; + } + if(prop.dist>0.0) + prop.aref=propa.ael+propa.ak1*prop.dist + + propa.ak2*log(prop.dist); + } + if(prop.dist<=0.0 || prop.dist>=propa.dlsa) + { if(!wscat) + { + q=ascat(0.0,prop,propa); + d5=propa.dla+200e3; + d6=d5+200e3; + a6=ascat(d6,prop,propa); + a5=ascat(d5,prop,propa); + if(a5<1000.0) + { propa.ems=(a6-a5)/200e3; + propa.dx=mymax(propa.dlsa,mymax(propa.dla+0.3*xae * + log(47.7*prop.wn),(a5-propa.aed-propa.ems*d5) / + (propa.emd-propa.ems))); + propa.aes=(propa.emd-propa.ems)*propa.dx+propa.aed; + } + else + { propa.ems=propa.emd; + propa.aes=propa.aed; + propa.dx=10.e6; + } + wscat=true; + } + if(prop.dist>propa.dx) + prop.aref=propa.aes+propa.ems*prop.dist; + else + prop.aref=propa.aed+propa.emd*prop.dist; + } + prop.aref=mymax(prop.aref,0.0); +} + +double curve (double const &c1, double const &c2, double const &x1, + double const &x2, double const &x3, double const &de) +{ return (c1+c2/(1.0+pow((de-x2)/x3,2.0)))*pow(de/x1,2.0) / + (1.0+pow(de/x1,2.0)); +} + +double avar(double zzt, double zzl, double zzc, + prop_type &prop, propv_type &propv) +{ static int kdv; + static double dexa, de, vmd, vs0, sgl, sgtm, sgtp, sgtd, tgtd, + gm, gp, cv1, cv2, yv1, yv2, yv3, csm1, csm2, ysm1, ysm2, + ysm3, csp1, csp2, ysp1, ysp2, ysp3, csd1, zd, cfm1, cfm2, + cfm3, cfp1, cfp2, cfp3; + double bv1[7]={-9.67,-0.62,1.26,-9.21,-0.62,-0.39,3.15}; + double bv2[7]={12.7,9.19,15.5,9.05,9.19,2.86,857.9}; + double xv1[7]={144.9e3,228.9e3,262.6e3,84.1e3,228.9e3,141.7e3,2222.e3}; + double xv2[7]={190.3e3,205.2e3,185.2e3,101.1e3,205.2e3,315.9e3,164.8e3}; + double xv3[7]={133.8e3,143.6e3,99.8e3,98.6e3,143.6e3,167.4e3,116.3e3}; + double bsm1[7]={2.13,2.66,6.11,1.98,2.68,6.86,8.51}; + double bsm2[7]={159.5,7.67,6.65,13.11,7.16,10.38,169.8}; + double xsm1[7]={762.2e3,100.4e3,138.2e3,139.1e3,93.7e3,187.8e3,609.8e3}; + double xsm2[7]={123.6e3,172.5e3,242.2e3,132.7e3,186.8e3,169.6e3,119.9e3}; + double xsm3[7]={94.5e3,136.4e3,178.6e3,193.5e3,133.5e3,108.9e3,106.6e3}; + double bsp1[7]={2.11,6.87,10.08,3.68,4.75,8.58,8.43}; + double bsp2[7]={102.3,15.53,9.60,159.3,8.12,13.97,8.19}; + double xsp1[7]={636.9e3,138.7e3,165.3e3,464.4e3,93.2e3,216.0e3,136.2e3}; + double xsp2[7]={134.8e3,143.7e3,225.7e3,93.1e3,135.9e3,152.0e3,188.5e3}; + double xsp3[7]={95.6e3,98.6e3,129.7e3,94.2e3,113.4e3,122.7e3,122.9e3}; + double bsd1[7]={1.224,0.801,1.380,1.000,1.224,1.518,1.518}; + double bzd1[7]={1.282,2.161,1.282,20.,1.282,1.282,1.282}; + double bfm1[7]={1.0,1.0,1.0,1.0,0.92,1.0,1.0}; + double bfm2[7]={0.0,0.0,0.0,0.0,0.25,0.0,0.0}; + double bfm3[7]={0.0,0.0,0.0,0.0,1.77,0.0,0.0}; + double bfp1[7]={1.0,0.93,1.0,0.93,0.93,1.0,1.0}; + double bfp2[7]={0.0,0.31,0.0,0.19,0.31,0.0,0.0}; + double bfp3[7]={0.0,2.00,0.0,1.79,2.00,0.0,0.0}; + static bool ws, w1; + double rt=7.8, rl=24.0, avarv, q, vs, zt, zl, zc; + double sgt, yr; + int temp_klim = propv.klim-1; + + if(propv.lvar>0) + { switch(propv.lvar) + { default: + if(propv.klim<=0 || propv.klim>7) + { propv.klim = 5; + temp_klim = 4; + { prop.kwx=mymax(prop.kwx,2); + } + } + cv1 = bv1[temp_klim]; + cv2 = bv2[temp_klim]; + yv1 = xv1[temp_klim]; + yv2 = xv2[temp_klim]; + yv3 = xv3[temp_klim]; + csm1=bsm1[temp_klim]; + csm2=bsm2[temp_klim]; + ysm1=xsm1[temp_klim]; + ysm2=xsm2[temp_klim]; + ysm3=xsm3[temp_klim]; + csp1=bsp1[temp_klim]; + csp2=bsp2[temp_klim]; + ysp1=xsp1[temp_klim]; + ysp2=xsp2[temp_klim]; + ysp3=xsp3[temp_klim]; + csd1=bsd1[temp_klim]; + zd =bzd1[temp_klim]; + cfm1=bfm1[temp_klim]; + cfm2=bfm2[temp_klim]; + cfm3=bfm3[temp_klim]; + cfp1=bfp1[temp_klim]; + cfp2=bfp2[temp_klim]; + cfp3=bfp3[temp_klim]; + case 4: + kdv=propv.mdvar; + ws = kdv>=20; + if(ws) + kdv-=20; + w1 = kdv>=10; + if(w1) + kdv-=10; + if(kdv<0 || kdv>3) + { kdv=0; + prop.kwx=mymax(prop.kwx,2); + } + case 3: + q=log(0.133*prop.wn); + gm=cfm1+cfm2/(pow(cfm3*q,2.0)+1.0); + gp=cfp1+cfp2/(pow(cfp3*q,2.0)+1.0); + case 2: + dexa=sqrt(18e6*prop.he[0])+sqrt(18e6*prop.he[1]) + + pow((575.7e12/prop.wn),THIRD); + case 1: + if(prop.dist3.1 || fabs(zl)>3.1 || fabs(zc)>3.1) + { prop.kwx=mymax(prop.kwx,1); + } + if(zt<0.0) + sgt=sgtm; + else if(zt<=zd) + sgt=sgtp; + else + sgt=sgtd+tgtd/zt; + vs=vs0+pow(sgt*zt,2.0)/(rt+zc*zc)+pow(sgl*zl,2.0)/(rl+zc*zc); + if(kdv==0) + { yr=0.0; + propv.sgc=sqrt(sgt*sgt+sgl*sgl+vs); + } + else if(kdv==1) + { yr=sgt*zt; + propv.sgc=sqrt(sgl*sgl+vs); + } + else if(kdv==2) + { yr=sqrt(sgt*sgt+sgl*sgl)*zt; + propv.sgc=sqrt(vs); + } + else + { yr=sgt*zt+sgl*zl; + propv.sgc=sqrt(vs); + } + avarv=prop.aref-vmd-yr-propv.sgc*zc; + if(avarv<0.0) + avarv=avarv*(29.0-avarv)/(29.0-10.0*avarv); + return avarv; + +} + +void hzns (double pfl[], prop_type &prop) +{ bool wq; + int np; + double xi, za, zb, qc, q, sb, sa; + + np=(int)pfl[0]; + xi=pfl[1]; + za=pfl[2]+prop.hg[0]; + zb=pfl[np+2]+prop.hg[1]; + qc=0.5*prop.gme; + q=qc*prop.dist; + prop.the[1]=(zb-za)/prop.dist; + prop.the[0]=prop.the[1]-q; + prop.the[1]=-prop.the[1]-q; + prop.dl[0]=prop.dist; + prop.dl[1]=prop.dist; + if(np>=2) + { sa=0.0; + sb=prop.dist; + wq=true; + for(int i=1;i0.0) + { prop.the[0]+=q/sa; + prop.dl[0]=sa; + wq=false; + } + if(!wq) + { q=pfl[i+2]-(qc*sb+prop.the[1])*sb-zb; + if(q>0.0) + { prop.the[1]+=q/sb; + prop.dl[1]=sb; + } + } + } + } +} + +void z1sq1 (double z[], const double &x1, const double &x2, + double& z0, double& zn) +{ double xn, xa, xb, x, a, b; + int n, ja, jb; + xn=z[0]; + xa=int(FORTRAN_DIM(x1/z[1],0.0)); + xb=xn-int(FORTRAN_DIM(xn,x2/z[1])); + if(xb<=xa) + { xa=FORTRAN_DIM(xa,1.0); + xb=xn-FORTRAN_DIM(xn,xb+1.0); + } + ja=(int)xa; + jb=(int)xb; + n=jb-ja; + xa=xb-xa; + x=-0.5*xa; + xb+=x; + a=0.5*(z[ja+2]+z[jb+2]); + b=0.5*(z[ja+2]-z[jb+2])*x; + for(int i=2;i<=n;++i) + { ++ja; + x+=1.0; + a+=z[ja+2]; + b+=z[ja+2]*x; + } + a/=xa; + b=b*12.0/((xa*xa+2.0)*xa); + z0=a-b*xb; + zn=a+b*(xn-xb); +} + +double qtile (const int &nn, double a[], const int &ir) +{ double q, r; + int m, n, i, j, j1, i0, k; + bool done=false; + bool goto10=true; + + m=0; + n=nn; + k=mymin(mymax(0,ir),n); + while(!done) + { + if(goto10) + { q=a[k]; + i0=m; + j1=n; + } + i=i0; + while(i<=n && a[i]>=q) + i++; + if(i>n) + i=n; + j=j1; + while(j>=m && a[j]<=q) + j--; + if(jk) + { a[k]=a[j]; + a[j]=q; + n=j-1; + goto10=true; + } + else + done=true; + } + return q; +} + +double qerf(const double &z) +{ double b1=0.319381530, b2=-0.356563782, b3=1.781477937; + double b4=-1.821255987, b5=1.330274429; + double rp=4.317008, rrt2pi=0.398942280; + double t, x, qerfv; + x=z; + t=fabs(x); + if(t>=10.0) + qerfv=0.0; + else + { t=rp/(t+rp); + qerfv=exp(-0.5*x*x)*rrt2pi*((((b5*t+b4)*t+b3)*t+b2)*t+b1)*t; + } + if(x<0.0) qerfv=1.0-qerfv; + return qerfv; +} + +double d1thx(double pfl[], const double &x1, const double &x2) +{ int np, ka, kb, n, k, j; + double d1thxv, sn, xa, xb; + double *s; + + np=(int)pfl[0]; + xa=x1/pfl[1]; + xb=x2/pfl[1]; + d1thxv=0.0; + if(xb-xa<2.0) // exit out + return d1thxv; + ka=(int)(0.1*(xb-xa+8.0)); + ka=mymin(mymax(4,ka),25); + n=10*ka-5; + kb=n-ka+1; + sn=n-1; + assert( (s = new double[n+2]) != 0 ); + s[0]=sn; + s[1]=1.0; + xb=(xb-xa)/sn; + k=(int)(xa+1.0); + xa-=(double)k; + for(j=0;j0.0 && k1.5*prop.dist) + { z1sq1(pfl,xl[0],xl[1],za,zb); + prop.he[0]=prop.hg[0]+FORTRAN_DIM(pfl[2],za); + prop.he[1]=prop.hg[1]+FORTRAN_DIM(pfl[np+2],zb); + for(j=0;j<2;j++) + prop.dl[j]=sqrt(2.0*prop.he[j]/prop.gme) * + exp(-0.07*sqrt(prop.dh/mymax(prop.he[j],5.0))); + q=prop.dl[0]+prop.dl[1]; + + if(q<=prop.dist) + { q=pow(prop.dist/q,2.0); + for(j=0;j<2;j++) + { prop.he[j]*=q; + prop.dl[j]=sqrt(2.0*prop.he[j]/prop.gme) * + exp(-0.07*sqrt(prop.dh/mymax(prop.he[j],5.0))); + } + } + for(j=0;j<2;j++) + { q=sqrt(2.0*prop.he[j]/prop.gme); + prop.the[j]=(0.65*prop.dh*(q/prop.dl[j]-1.0)-2.0 * + prop.he[j])/q; + } + } + else + { z1sq1(pfl,xl[0],0.9*prop.dl[0],za,q); + z1sq1(pfl,prop.dist-0.9*prop.dl[1],xl[1],q,zb); + prop.he[0]=prop.hg[0]+FORTRAN_DIM(pfl[2],za); + prop.he[1]=prop.hg[1]+FORTRAN_DIM(pfl[np+2],zb); + } + prop.mdp=-1; + propv.lvar=mymax(propv.lvar,3); + if(mdvarx>=0) + { propv.mdvar=mdvarx; + propv.lvar=mymax(propv.lvar,4); + } + if(klimx>0) + { propv.klim=klimx; + propv.lvar=5; + } + lrprop(0.0,prop,propa); +} + +double deg2rad(double d) +{ + return d * 3.1415926535897 / 180.0; +} + +//******************************************************** +//* Point-To-Point Mode Calculations * +//******************************************************** + +void point_to_point(double elev[], double tht_m, double rht_m, + double eps_dielect, double sgm_conductivity, double eno_ns_surfref, + double frq_mhz, int radio_climate, int pol, double conf, double rel, + double &dbloss, char *strmode, int &errnum) + // pol: 0-Horizontal, 1-Vertical + // radio_climate: 1-Equatorial, 2-Continental Subtropical, 3-Maritime Tropical, + // 4-Desert, 5-Continental Temperate, 6-Maritime Temperate, Over Land, + // 7-Maritime Temperate, Over Sea + // conf, rel: .01 to .99 + // elev[]: [num points - 1], [delta dist(meters)], [height(meters) point 1], ..., [height(meters) point n] + // errnum: 0- No Error. + // 1- Warning: Some parameters are nearly out of range. + // Results should be used with caution. + // 2- Note: Default parameters have been substituted for impossible ones. + // 3- Warning: A combination of parameters is out of range. + // Results are probably invalid. + // Other- Warning: Some parameters are out of range. + // Results are probably invalid. +{ + + prop_type prop; + propv_type propv; + propa_type propa; + double zsys=0; + double zc, zr; + double eno, enso, q; + long ja, jb, i, np; + double dkm, xkm; + double fs; + + prop.hg[0] = tht_m; prop.hg[1] = rht_m; + propv.klim = radio_climate; + prop.kwx = 0; + propv.lvar = 5; + prop.mdp = -1; + zc = qerfi(conf); + zr = qerfi(rel); + np = (long)elev[0]; + dkm = (elev[1] * elev[0]) / 1000.0; + xkm = elev[1] / 1000.0; + eno = eno_ns_surfref; + enso = 0.0; + q = enso; + if(q<=0.0) + { + ja = (long) (3.0 + 0.1 * elev[0]); + jb = np - ja + 6; + for(i=ja-1;i0.0) + strcpy(strmode,"Double Horizon"); + if(prop.dist<=propa.dlsa || prop.dist <= propa.dx) + strcat(strmode,", Diffraction Dominant"); + else if(prop.dist>propa.dx) + strcat(strmode, ", Troposcatter Dominant"); + } + dbloss = avar(zr,0.0,zc,prop,propv) + fs; + errnum = prop.kwx; +} + + +void point_to_pointMDH (double elev[], double tht_m, double rht_m, + double eps_dielect, double sgm_conductivity, double eno_ns_surfref, + double frq_mhz, int radio_climate, int pol, double timepct, double locpct, double confpct, + double &dbloss, int &propmode, double &deltaH, int &errnum) + // pol: 0-Horizontal, 1-Vertical + // radio_climate: 1-Equatorial, 2-Continental Subtropical, 3-Maritime Tropical, + // 4-Desert, 5-Continental Temperate, 6-Maritime Temperate, Over Land, + // 7-Maritime Temperate, Over Sea + // timepct, locpct, confpct: .01 to .99 + // elev[]: [num points - 1], [delta dist(meters)], [height(meters) point 1], ..., [height(meters) point n] + // propmode: Value Mode + // -1 mode is undefined + // 0 Line of Sight + // 5 Single Horizon, Diffraction + // 6 Single Horizon, Troposcatter + // 9 Double Horizon, Diffraction + // 10 Double Horizon, Troposcatter + // errnum: 0- No Error. + // 1- Warning: Some parameters are nearly out of range. + // Results should be used with caution. + // 2- Note: Default parameters have been substituted for impossible ones. + // 3- Warning: A combination of parameters is out of range. + // Results are probably invalid. + // Other- Warning: Some parameters are out of range. + // Results are probably invalid. +{ + + prop_type prop; + propv_type propv; + propa_type propa; + double zsys=0; + double ztime, zloc, zconf; + double eno, enso, q; + long ja, jb, i, np; + double dkm, xkm; + double fs; + + propmode = -1; // mode is undefined + prop.hg[0] = tht_m; prop.hg[1] = rht_m; + propv.klim = radio_climate; + prop.kwx = 0; + propv.lvar = 5; + prop.mdp = -1; + ztime = qerfi(timepct); + zloc = qerfi(locpct); + zconf = qerfi(confpct); + + np = (long)elev[0]; + dkm = (elev[1] * elev[0]) / 1000.0; + xkm = elev[1] / 1000.0; + eno = eno_ns_surfref; + enso = 0.0; + q = enso; + if(q<=0.0) + { + ja = (long) (3.0 + 0.1 * elev[0]); + jb = np - ja + 6; + for(i=ja-1;i0.0) + propmode = 8; // Double Horizon + if(prop.dist<=propa.dlsa || prop.dist <= propa.dx) + propmode += 1; // Diffraction Dominant + else if(prop.dist>propa.dx) + propmode += 2; // Troposcatter Dominant + } + dbloss = avar(ztime, zloc, zconf, prop, propv) + fs; //avar(time,location,confidence) + errnum = prop.kwx; +} + +void point_to_pointDH (double elev[], double tht_m, double rht_m, + double eps_dielect, double sgm_conductivity, double eno_ns_surfref, + double frq_mhz, int radio_climate, int pol, double conf, double rel, + double &dbloss, double &deltaH, int &errnum) + // pol: 0-Horizontal, 1-Vertical + // radio_climate: 1-Equatorial, 2-Continental Subtropical, 3-Maritime Tropical, + // 4-Desert, 5-Continental Temperate, 6-Maritime Temperate, Over Land, + // 7-Maritime Temperate, Over Sea + // conf, rel: .01 to .99 + // elev[]: [num points - 1], [delta dist(meters)], [height(meters) point 1], ..., [height(meters) point n] + // errnum: 0- No Error. + // 1- Warning: Some parameters are nearly out of range. + // Results should be used with caution. + // 2- Note: Default parameters have been substituted for impossible ones. + // 3- Warning: A combination of parameters is out of range. + // Results are probably invalid. + // Other- Warning: Some parameters are out of range. + // Results are probably invalid. +{ + + char strmode[100]; + prop_type prop; + propv_type propv; + propa_type propa; + double zsys=0; + double zc, zr; + double eno, enso, q; + long ja, jb, i, np; + double dkm, xkm; + double fs; + + prop.hg[0] = tht_m; prop.hg[1] = rht_m; + propv.klim = radio_climate; + prop.kwx = 0; + propv.lvar = 5; + prop.mdp = -1; + zc = qerfi(conf); + zr = qerfi(rel); + np = (long)elev[0]; + dkm = (elev[1] * elev[0]) / 1000.0; + xkm = elev[1] / 1000.0; + eno = eno_ns_surfref; + enso = 0.0; + q = enso; + if(q<=0.0) + { + ja = (long)(3.0 + 0.1 * elev[0]); + jb = np - ja + 6; + for(i=ja-1;i0.0) + strcpy(strmode,"Double Horizon"); + if(prop.dist<=propa.dlsa || prop.dist <= propa.dx) + strcat(strmode,", Diffraction Dominant"); + else if(prop.dist>propa.dx) + strcat(strmode, ", Troposcatter Dominant"); + } + dbloss = avar(zr,0.0,zc,prop,propv) + fs; //avar(time,location,confidence) + errnum = prop.kwx; +} + + +//******************************************************** +//* Area Mode Calculations * +//******************************************************** + +void area(long ModVar, double deltaH, double tht_m, double rht_m, + double dist_km, int TSiteCriteria, int RSiteCriteria, + double eps_dielect, double sgm_conductivity, double eno_ns_surfref, + double frq_mhz, int radio_climate, int pol, double pctTime, double pctLoc, + double pctConf, double &dbloss, char *strmode, int &errnum) +{ + // pol: 0-Horizontal, 1-Vertical + // TSiteCriteria, RSiteCriteria: + // 0 - random, 1 - careful, 2 - very careful + // radio_climate: 1-Equatorial, 2-Continental Subtropical, 3-Maritime Tropical, + // 4-Desert, 5-Continental Temperate, 6-Maritime Temperate, Over Land, + // 7-Maritime Temperate, Over Sea + // ModVar: 0 - Single: pctConf is "Time/Situation/Location", pctTime, pctLoc not used + // 1 - Individual: pctTime is "Situation/Location", pctConf is "Confidence", pctLoc not used + // 2 - Mobile: pctTime is "Time/Locations (Reliability)", pctConf is "Confidence", pctLoc not used + // 3 - Broadcast: pctTime is "Time", pctLoc is "Location", pctConf is "Confidence" + // pctTime, pctLoc, pctConf: .01 to .99 + // errnum: 0- No Error. + // 1- Warning: Some parameters are nearly out of range. + // Results should be used with caution. + // 2- Note: Default parameters have been substituted for impossible ones. + // 3- Warning: A combination of parameters is out of range. + // Results are probably invalid. + // Other- Warning: Some parameters are out of range. + // Results are probably invalid. + // NOTE: strmode is not used at this time. + prop_type prop; + propv_type propv; + propa_type propa; + double zt, zl, zc, xlb; + double fs; + long ivar; + double eps, eno, sgm; + long ipol; + int kst[2]; + + kst[0] = (int) TSiteCriteria; + kst[1] = (int) RSiteCriteria; + zt = qerfi(pctTime); + zl = qerfi(pctLoc); + zc = qerfi(pctConf); + eps = eps_dielect; + sgm = sgm_conductivity; + eno = eno_ns_surfref; + prop.dh = deltaH; + prop.hg[0] = tht_m; prop.hg[1] = rht_m; + propv.klim = radio_climate; + prop.ens = eno; + prop.kwx = 0; + ivar = (long) ModVar; + ipol = (long) pol; + qlrps(frq_mhz, 0.0, eno, ipol, eps, sgm, prop); + qlra(kst, propv.klim, ivar, prop, propv); + if(propv.lvar<1) propv.lvar = 1; + lrprop(dist_km * 1000.0, prop, propa); + fs = 32.45 + 20.0 * log10(frq_mhz) + 20.0 * log10(prop.dist / 1000.0); + xlb = fs + avar(zt, zl, zc, prop, propv); + dbloss = xlb; + if(prop.kwx==0) + errnum = 0; + else + errnum = prop.kwx; +} + + +double ITMAreadBLoss(long ModVar, double deltaH, double tht_m, double rht_m, + double dist_km, int TSiteCriteria, int RSiteCriteria, + double eps_dielect, double sgm_conductivity, double eno_ns_surfref, + double frq_mhz, int radio_climate, int pol, double pctTime, double pctLoc, + double pctConf) +{ + char strmode[200]; + int errnum; + double dbloss; + area(ModVar,deltaH,tht_m,rht_m,dist_km,TSiteCriteria,RSiteCriteria, + eps_dielect,sgm_conductivity,eno_ns_surfref, + frq_mhz,radio_climate,pol,pctTime,pctLoc, + pctConf,dbloss,strmode,errnum); + return dbloss; +} + +double ITMDLLVersion() +{ + return 7.0; +} + diff --git a/main.C b/main.C new file mode 100644 index 0000000..30d1773 --- /dev/null +++ b/main.C @@ -0,0 +1,89 @@ +/* + libprop -- library to simulate and measure radio signal propagation + + Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "source.h" +#include "geom.h" +#include "radio.h" +#include "utils.h" +//#include "test/testcases.h" + +#include +#include + +using namespace std; + + +// this example will test an area around a tower for radio coverage +int main(int argc, char** argv) { + + Convert* norm = new Convert(); + Convert* albers = new ConvertAlbers(); + bool cache = false; + + // load all data sources needed + SourceGroup* sg = new SourceGroup(); + sg->add(new SourceGridFloat(norm, TYPE_ELEV, "data/80214271.elev/80214271.hdr", cache)); + //sg->add(new SourceGridFloat(albers, TYPE_VEGHEIGHT, "data/22276103.height/22276103.hdr", cache)); + //sg->add(new SourceGridFloat(albers, TYPE_VEGTYPE, "data/22273282.type/22273282.hdr", cache)); + //sg->add(new SourceInteger(albers, TYPE_LAND, "data/99981370.land/99981370.hdr", cache)); + + // create central tower point and set height + Point* tower = new Point(45.52391667, -111.2476944); + tower->towerHeight = 10; + vector list; + + // define our area of interest as 5 kilometers around tower and turn it into list of discrete points using a 75 meter grid + RegionArea* area = new RegionArea(tower, 5); + list = area->discrete(0.075); + + // define our area of interest as an entire roadway, split into discrete points every 25 meters + //RegionLine* road = new RegionLine("data/mt199-highway.txt"); + //list = road->discrete(0.025); + + // show progress display to user + TimeRemaining *t = new TimeRemaining(list.size(), 256); + + // save results to file + ofstream out("data/predicted.txt"); + out.precision(8); + + // run a path loss to each point + vector::iterator it; + for(it = list.begin(); it != list.end(); it++) { + Point* r = *it; + r->towerHeight = 10; + + // test path loss if stepping along path in 10 meter increments, using 4 watt transmitter, no antennas, and 900MHz radio system + double loss = pathLoss(tower, r, sg, 0.010, 4000, 0, 900); + double longleyLoss = pathLossLongley(tower, r, sg, 0.010, 4000, 0, 900); + t->increment(); + + // only output if we can actually cover the point being tested + if(loss == DENIED) continue; + out << r->lat << "\t" << r->lon << "\t" << loss << "\t" << longleyLoss << endl; + + } + + out.close(); + +} + + + + diff --git a/plot.C b/plot.C new file mode 100644 index 0000000..8b6c104 --- /dev/null +++ b/plot.C @@ -0,0 +1,456 @@ +/* + libprop -- library to simulate and measure radio signal propagation + + Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "source.h" +#include "geom.h" +#include "radio.h" +#include "utils.h" +#include "testcases.h" + + +#include +#include + +#include "gd.h" + +#include +#include + +using namespace std; + + + +void error() { + cout << "Content-Type:image/png" << endl; + cout << "Error: true" << endl << endl; + gdImagePtr im = gdImageCreateTrueColor(10, 10); + gdImageFilledRectangle(im, 0, 0, 10, 10, gdTrueColor(255, 255, 255)); + gdImagePng(im, stdout); + exit(0); + +} + + +int main(void) { + +//cout << "Content-Type:text/plain" << endl << endl; + +double towerLat = -1, towerLon = -1, topRightLat = -1, topRightLon = -1, bottomLeftLat = -1, bottomLeftLon = -1; +int detail = -1, r = -1, g = -1, b = -1; +double txHeight = -1, rxHeight = -1, eirp = -1, mhz = -1, txantenna = -1, rxantenna = -1, sens = -1; + +// read in all variables from query +char* vars = getenv("QUERY_STRING"); +char* var = strtok(vars, ","); +while(var != NULL) { + if(towerLat == -1) towerLat = atof(var); + else if(towerLon == -1) towerLon = atof(var); + else if(bottomLeftLat == -1) bottomLeftLat = atof(var); + else if(bottomLeftLon == -1) bottomLeftLon = atof(var); + else if(topRightLat == -1) topRightLat = atof(var); + else if(topRightLon == -1) topRightLon = atof(var); + else if(detail == -1) detail = atoi(var); + else if(r == -1) r = atoi(var); + else if(g == -1) g = atoi(var); + else if(b == -1) b = atoi(var); + else if(txHeight == -1) txHeight = atof(var); + else if(rxHeight == -1) rxHeight = atof(var); + else if(eirp == -1) eirp = atof(var); + else if(mhz == -1) mhz = atof(var); + else if(txantenna == -1) txantenna = atof(var); + else if(rxantenna == -1) rxantenna = atof(var); + else if(sens == -1) sens = atof(var); + var = strtok(NULL, ","); +} + +// check for problems with incoming data bounds + +if(topRightLat < 33 || topRightLat > 49 || + bottomLeftLat < 33 || bottomLeftLat > 49 || + towerLat < 33 || towerLat > 49) error(); + +if(topRightLon > -102 || topRightLon < -126 || + bottomLeftLon > -102 || bottomLeftLat < -126 || + towerLon > -102 || towerLon < -126) error(); + +if(detail < 10) error(); + +if(r < 0 || r > 255 || + g < 0 || g > 255 || + b < 0 || b > 255) error(); + +if(txHeight < 0 || txHeight > 100 || + rxHeight < 0 || rxHeight > 100) error(); + +if(eirp < 0 || eirp > 32768) error(); +if(mhz < 150 || mhz > 10000) error(); + +if(txantenna < 0 || txantenna > 30 || + rxantenna < 0 || rxantenna > 30) error(); + +// load regional elevation data +SourceGroup* sg = new SourceGroup(); +//sg->add(new SourceGridFloat(new Convert(), TYPE_ELEV, "80214271.elev/80214271.hdr", false)); +//sg->add(new SourceGridFloat(new Convert(), TYPE_ELEV, "63034346/63034346.hdr", false)); + + +Convert* normal = new Convert(); + +//sg->add(new SourceGridFloat(normal, TYPE_ELEV, "63034346/63034346.hdr", 2809, 5336, -108.34009259127, 43.249999999636, 0.000092592592600001)); + + +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/00680497/00680497.hdr", 5400, 10801, -122.49999999981, 40.999999999456, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/00724160/00724160.hdr", 5401, 5401, -120.50009259225, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/01128382/01128382.hdr", 5400, 5401, -121.99999999977, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/01602763/01602763.hdr", 5401, 5401, -118.50009259209, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/01619089/01619089.hdr", 5400, 5401, -120.99999999969, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/01620307/01620307.hdr", 5400, 5401, -122.49999999981, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/02036657/02036657.hdr", 5401, 5401, -119.50009259217, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/02990967/02990967.hdr", 5400, 10801, -124.49999999997, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/03260116/03260116.hdr", 5401, 5401, -117.00009259197, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/05565028/05565028.hdr", 5400, 5401, -121.99999999977, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/05914643/05914643.hdr", 5401, 5401, -119.50009259217, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/06391951/06391951.hdr", 5400, 5401, -120.99999999969, 39.499999999336, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/06455652/06455652.hdr", 5400, 5401, -122.99999999985, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/06602633/06602633.hdr", 5400, 10801, -124.49999999997, 39.999999999376, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/06978577/06978577.hdr", 5400, 10801, -123.49999999989, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/07301082/07301082.hdr", 5401, 5401, -115.00009259181, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/07545749/07545749.hdr", 5401, 5401, -119.50009259217, 38.499999999256, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/07834411/07834411.hdr", 5400, 5401, -123.49999999989, 37.499999999176, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/07873207/07873207.hdr", 5401, 5401, -115.00009259181, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/07881913/07881913.hdr", 5401, 5401, -115.50009259185, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/08219950/08219950.hdr", 5401, 5401, -115.00009259181, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/09567258/09567258.hdr", 5400, 5401, -120.99999999969, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/11867483/11867483.hdr", 5400, 5401, -121.49999999973, 41.499999999496, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/12094197/12094197.hdr", 5400, 5401, -121.49999999973, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/12187229/12187229.hdr", 5400, 10801, -123.99999999993, 40.999999999456, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/12614752/12614752.hdr", 5400, 5401, -121.99999999977, 39.999999999376, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/13630027/13630027.hdr", 5400, 5401, -121.49999999973, 39.999999999376, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/13832349/13832349.hdr", 5401, 5401, -120.00009259221, 40.499999999416, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/14556548/14556548.hdr", 5400, 5401, -120.99999999969, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/14815189/14815189.hdr", 5400, 10801, -122.99999999985, 38.999999999296, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/16013569/16013569.hdr", 5401, 5401, -119.50009259217, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/16042093/16042093.hdr", 5400, 5401, -121.99999999977, 37.499999999176, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/16626380/16626380.hdr", 5400, 5401, -121.49999999973, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/16654859/16654859.hdr", 5400, 5401, -122.99999999985, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/17320698/17320698.hdr", 5401, 5401, -115.00009259181, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/18934751/18934751.hdr", 5401, 5401, -116.00009259189, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/19584154/19584154.hdr", 5400, 5401, -120.99999999969, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/19593552/19593552.hdr", 5400, 5401, -120.99999999969, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/19665972/19665972.hdr", 5401, 5401, -120.00009259221, 38.999999999296, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/19671577/19671577.hdr", 5400, 5401, -121.99999999977, 40.999999999456, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/20000792/20000792.hdr", 5401, 5401, -116.00009259189, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/20979926/20979926.hdr", 5400, 10801, -123.99999999993, 39.999999999376, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/21100639/21100639.hdr", 5400, 5401, -120.99999999969, 39.999999999376, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/21937011/21937011.hdr", 5401, 5401, -120.50009259225, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/22815951/22815951.hdr", 5401, 5401, -118.00009259205, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/23062309/23062309.hdr", 5401, 5401, -118.00009259205, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/23553225/23553225.hdr", 5400, 10801, -122.99999999985, 39.999999999376, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/23643144/23643144.hdr", 5401, 5401, -119.50009259217, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/23934115/23934115.hdr", 5401, 5401, -118.00009259205, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/24197274/24197274.hdr", 5400, 10801, -122.49999999981, 39.999999999376, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/24484180/24484180.hdr", 5401, 5401, -117.00009259197, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/24615222/24615222.hdr", 5400, 5401, -121.99999999977, 39.499999999336, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/25238768/25238768.hdr", 5401, 5401, -118.00009259205, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/25366891/25366891.hdr", 5400, 5401, -121.49999999973, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/25945975/25945975.hdr", 5400, 5401, -123.49999999989, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/25977226/25977226.hdr", 5400, 5401, -122.99999999985, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/26269509/26269509.hdr", 5401, 5401, -119.50009259217, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/27366948/27366948.hdr", 5400, 5401, -122.99999999985, 38.499999999256, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/27452901/27452901.hdr", 5401, 5401, -117.50009259201, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/27879616/27879616.hdr", 5400, 5401, -120.99999999969, 40.499999999416, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/27974007/27974007.hdr", 1080, 1189, -122.70999999983, 38.869999999285, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/28565190/28565190.hdr", 5401, 5401, -116.50009259193, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/28865336/28865336.hdr", 5400, 5401, -121.99999999977, 40.499999999416, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/29357240/29357240.hdr", 5401, 5401, -117.50009259201, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/29602808/29602808.hdr", 5400, 10801, -122.49999999981, 38.999999999296, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/30200417/30200417.hdr", 5401, 5401, -115.50009259185, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/30322751/30322751.hdr", 5400, 5401, -121.49999999973, 40.999999999456, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/31132542/31132542.hdr", 5401, 5401, -116.00009259189, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/31512477/31512477.hdr", 5400, 5401, -121.99999999977, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/31550067/31550067.hdr", 5400, 5401, -122.49999999981, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/31646682/31646682.hdr", 5401, 5401, -119.00009259213, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/31973925/31973925.hdr", 5401, 5401, -115.50009259185, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/32639090/32639090.hdr", 5401, 5401, -117.50009259201, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/33765868/33765868.hdr", 5400, 5401, -120.99999999969, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/33927487/33927487.hdr", 5401, 5401, -116.50009259193, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/34328169/34328169.hdr", 5401, 5401, -120.50009259225, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/34945327/34945327.hdr", 5400, 10801, -125.00000000001, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/35891990/35891990.hdr", 5401, 5401, -116.50009259193, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/35996027/35996027.hdr", 5400, 5401, -121.49999999973, 38.999999999296, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/36042209/36042209.hdr", 5401, 5401, -117.50009259201, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/36117356/36117356.hdr", 5400, 5401, -123.99999999993, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/36982201/36982201.hdr", 5400, 5401, -120.99999999969, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/37876050/37876050.hdr", 5401, 5401, -119.00009259213, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/38180378/38180378.hdr", 5401, 5401, -120.50009259225, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/38663867/38663867.hdr", 5401, 5401, -115.50009259185, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/38956499/38956499.hdr", 5400, 5401, -121.99999999977, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/39474037/39474037.hdr", 5400, 5401, -121.99999999977, 38.499999999256, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/39604546/39604546.hdr", 5401, 5401, -115.50009259185, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/40298792/40298792.hdr", 5400, 5401, -121.49999999973, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/41205948/41205948.hdr", 5401, 5401, -116.50009259193, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/41286377/41286377.hdr", 5401, 5401, -118.00009259205, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/41372072/41372072.hdr", 5400, 10801, -125.00000000001, 38.999999999296, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/41794435/41794435.hdr", 5400, 5401, -122.49999999981, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/41924354/41924354.hdr", 5400, 5401, -123.99999999993, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/42297756/42297756.hdr", 5401, 5401, -117.00009259197, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/42467423/42467423.hdr", 5401, 5401, -117.00009259197, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/42586574/42586574.hdr", 5400, 10801, -123.99999999993, 38.999999999296, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/42593554/42593554.hdr", 5400, 5401, -121.99999999977, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/42776738/42776738.hdr", 5401, 5401, -119.00009259213, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/42999231/42999231.hdr", 5400, 5401, -121.49999999973, 40.499999999416, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/43439245/43439245.hdr", 5401, 5401, -117.50009259201, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/43759764/43759764.hdr", 5401, 5401, -115.50009259185, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/44013467/44013467.hdr", 5401, 5401, -119.50009259217, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/45046833/45046833.hdr", 5400, 5401, -122.49999999981, 37.499999999176, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/45172273/45172273.hdr", 5401, 5401, -116.50009259193, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/45447314/45447314.hdr", 5401, 5401, -116.00009259189, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/45746018/45746018.hdr", 5401, 5401, -115.50009259185, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/45946007/45946007.hdr", 5401, 5401, -118.00009259205, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/46473728/46473728.hdr", 5401, 5401, -120.50009259225, 37.499999999176, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/46585525/46585525.hdr", 5400, 5401, -121.99999999977, 38.999999999296, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/47132229/47132229.hdr", 5401, 5401, -120.50009259225, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/47266135/47266135.hdr", 5401, 5401, -116.50009259193, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/47436049/47436049.hdr", 5401, 5401, -120.50009259225, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/48060923/48060923.hdr", 5401, 5401, -118.50009259209, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/48063632/48063632.hdr", 5400, 5401, -121.99999999977, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/48289180/48289180.hdr", 5400, 5401, -121.99999999977, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/48317549/48317549.hdr", 5400, 5401, -121.99999999977, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/48573665/48573665.hdr", 5400, 5401, -123.49999999989, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/48925941/48925941.hdr", 5400, 10801, -123.99999999993, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/49129061/49129061.hdr", 5400, 5401, -121.49999999973, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/49264197/49264197.hdr", 5401, 5401, -118.50009259209, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/49655574/49655574.hdr", 5400, 5401, -122.99999999985, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/50069594/50069594.hdr", 5401, 5401, -116.00009259189, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/50627803/50627803.hdr", 5401, 5401, -120.00009259221, 41.499999999496, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/51139569/51139569.hdr", 5400, 5401, -120.99999999969, 38.499999999256, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/52229741/52229741.hdr", 5401, 5401, -118.50009259209, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/52488441/52488441.hdr", 5401, 5401, -115.00009259181, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/53370093/53370093.hdr", 5400, 10801, -125.00000000001, 40.999999999456, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/53601187/53601187.hdr", 5401, 5401, -119.00009259213, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/54020083/54020083.hdr", 5401, 5401, -119.50009259217, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/54139787/54139787.hdr", 5401, 5401, -120.00009259221, 39.499999999336, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/54359836/54359836.hdr", 5400, 5401, -122.49999999981, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/54443731/54443731.hdr", 5401, 5401, -114.50009259177, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/54792101/54792101.hdr", 5401, 5401, -120.00009259221, 37.499999999176, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/55018501/55018501.hdr", 5401, 5401, -115.00009259181, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/55424986/55424986.hdr", 5401, 5401, -119.50009259217, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/55762742/55762742.hdr", 5400, 5401, -121.49999999973, 39.499999999336, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/55883597/55883597.hdr", 5400, 5401, -121.99999999977, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/55967412/55967412.hdr", 5401, 5401, -119.00009259213, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/56281294/56281294.hdr", 5400, 5401, -120.99999999969, 40.999999999456, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/56440438/56440438.hdr", 5401, 5401, -120.00009259221, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/56656318/56656318.hdr", 5400, 5401, -123.49999999989, 38.499999999256, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/56916446/56916446.hdr", 5401, 5401, -119.50009259217, 37.499999999176, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/57463853/57463853.hdr", 5401, 5401, -119.00009259213, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/58437007/58437007.hdr", 5401, 5401, -119.50009259217, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/58841108/58841108.hdr", 5400, 5401, -120.99999999969, 38.999999999296, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/58956348/58956348.hdr", 5401, 5401, -117.00009259197, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/58959171/58959171.hdr", 5401, 5401, -120.50009259225, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/59117619/59117619.hdr", 5401, 5401, -116.50009259193, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/59205856/59205856.hdr", 5400, 10801, -124.49999999997, 38.999999999296, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/59687179/59687179.hdr", 5400, 5401, -121.99999999977, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/61508029/61508029.hdr", 5401, 5401, -119.00009259213, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/61805253/61805253.hdr", 5401, 5401, -120.50009259225, 41.499999999496, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/62025741/62025741.hdr", 5401, 5401, -116.50009259193, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/62184682/62184682.hdr", 5401, 5401, -120.50009259225, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/62215875/62215875.hdr", 5401, 5401, -116.00009259189, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/62761047/62761047.hdr", 5401, 5401, -120.00009259221, 38.499999999256, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/64347175/64347175.hdr", 5401, 5401, -115.00009259181, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/64618397/64618397.hdr", 5401, 5401, -118.00009259205, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/64981909/64981909.hdr", 5400, 5401, -123.99999999993, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/65033213/65033213.hdr", 5401, 5401, -120.50009259225, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/65712975/65712975.hdr", 5401, 5401, -120.00009259221, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/65743692/65743692.hdr", 5400, 5401, -121.49999999973, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/65824895/65824895.hdr", 5401, 5401, -120.50009259225, 39.499999999336, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/65954931/65954931.hdr", 5401, 5401, -114.50009259177, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/66104703/66104703.hdr", 5401, 5401, -118.50009259209, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/66537013/66537013.hdr", 5401, 5401, -118.50009259209, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/66615321/66615321.hdr", 5401, 5401, -114.50009259177, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/66780126/66780126.hdr", 5401, 5401, -120.00009259221, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/66987167/66987167.hdr", 5401, 5401, -120.00009259221, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/67134514/67134514.hdr", 5400, 5401, -121.99999999977, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/67379214/67379214.hdr", 5401, 5401, -117.00009259197, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/67752922/67752922.hdr", 5400, 5401, -121.49999999973, 37.499999999176, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/68552869/68552869.hdr", 5400, 5401, -122.99999999985, 37.499999999176, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/68579151/68579151.hdr", 5401, 5401, -118.50009259209, 37.499999999176, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/68689070/68689070.hdr", 5400, 5401, -123.99999999993, 38.499999999256, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/68947195/68947195.hdr", 5401, 5401, -120.00009259221, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/69235623/69235623.hdr", 5401, 5401, -117.50009259201, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/69856724/69856724.hdr", 5401, 5401, -117.50009259201, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/70170699/70170699.hdr", 5400, 5401, -123.99999999993, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/71028846/71028846.hdr", 5400, 10801, -125.00000000001, 39.999999999376, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/71109069/71109069.hdr", 5401, 5401, -118.00009259205, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/71817014/71817014.hdr", 5401, 5401, -114.50009259177, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/72103972/72103972.hdr", 5401, 5401, -119.00009259213, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/72322807/72322807.hdr", 5401, 5401, -120.50009259225, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/73768291/73768291.hdr", 5400, 10801, -123.49999999989, 38.999999999296, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/73898613/73898613.hdr", 5400, 5401, -120.99999999969, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/74083980/74083980.hdr", 5400, 10801, -124.49999999997, 40.999999999456, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/74616100/74616100.hdr", 5401, 5401, -119.00009259213, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/75763141/75763141.hdr", 5400, 10801, -122.49999999981, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/76154670/76154670.hdr", 5400, 5401, -121.49999999973, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/76458127/76458127.hdr", 5400, 5401, -121.49999999973, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/76510235/76510235.hdr", 5401, 5401, -117.00009259197, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/76790337/76790337.hdr", 5401, 5401, -120.50009259225, 40.999999999456, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/76800583/76800583.hdr", 5400, 10801, -123.49999999989, 40.999999999456, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/77054392/77054392.hdr", 5401, 5401, -117.00009259197, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/77518000/77518000.hdr", 5401, 5401, -118.00009259205, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/79358337/79358337.hdr", 5401, 5401, -120.00009259221, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/79623424/79623424.hdr", 5401, 5401, -120.00009259221, 40.999999999456, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/79792482/79792482.hdr", 5400, 5401, -121.49999999973, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/79839873/79839873.hdr", 5401, 5401, -117.00009259197, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/80010111/80010111.hdr", 5400, 5401, -122.49999999981, 38.499999999256, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/80254160/80254160.hdr", 5400, 5401, -123.49999999989, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/80339385/80339385.hdr", 5401, 5401, -118.50009259209, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/80358150/80358150.hdr", 5401, 5401, -118.00009259205, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/80483004/80483004.hdr", 5401, 5401, -120.00009259221, 39.999999999376, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/81231810/81231810.hdr", 5400, 10801, -122.99999999985, 40.999999999456, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/81491395/81491395.hdr", 5401, 5401, -120.50009259225, 38.499999999256, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/82002645/82002645.hdr", 5401, 5401, -114.50009259177, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/82136143/82136143.hdr", 5401, 5401, -119.00009259213, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/83250817/83250817.hdr", 5401, 5401, -117.50009259201, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/84020088/84020088.hdr", 5400, 5401, -120.99999999969, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/84397490/84397490.hdr", 5401, 5401, -120.50009259225, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/84528245/84528245.hdr", 5400, 5401, -121.49999999973, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/84547464/84547464.hdr", 5400, 5401, -120.99999999969, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/85731079/85731079.hdr", 5400, 10801, -122.99999999985, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/86225526/86225526.hdr", 5401, 5401, -118.50009259209, 37.999999999216, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/86979470/86979470.hdr", 5401, 5401, -118.00009259205, 37.499999999176, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/86981844/86981844.hdr", 5401, 5401, -120.50009259225, 39.999999999376, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/87512210/87512210.hdr", 5401, 5401, -114.50009259177, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/87710033/87710033.hdr", 5401, 5401, -118.00009259205, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/88304583/88304583.hdr", 5401, 5401, -120.00009259221, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/90097667/90097667.hdr", 5401, 5401, -120.00009259221, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/90109889/90109889.hdr", 5401, 5401, -117.50009259201, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/90238122/90238122.hdr", 5401, 5401, -116.00009259189, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/90495344/90495344.hdr", 5401, 5401, -119.00009259213, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/90577027/90577027.hdr", 5401, 5401, -116.50009259193, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/91037559/91037559.hdr", 5400, 5401, -120.99999999969, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/91041984/91041984.hdr", 5400, 5401, -120.99999999969, 37.499999999176, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/91452459/91452459.hdr", 5401, 5401, -119.50009259217, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/91511423/91511423.hdr", 5400, 5401, -123.99999999993, 37.499999999176, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/91621890/91621890.hdr", 5401, 5401, -120.00009259221, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/91960086/91960086.hdr", 5401, 5401, -120.00009259221, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/92171314/92171314.hdr", 5401, 5401, -116.50009259193, 33.999999998896, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/92848319/92848319.hdr", 5400, 5401, -120.99999999969, 41.499999999496, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/92907064/92907064.hdr", 5400, 5401, -123.49999999989, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/92913400/92913400.hdr", 5401, 5401, -118.50009259209, 32.999999998816, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/93346202/93346202.hdr", 5401, 5401, -117.00009259197, 33.499999998856, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/93554793/93554793.hdr", 5401, 5401, -120.50009259225, 40.499999999416, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/93811554/93811554.hdr", 5401, 5401, -118.50009259209, 34.499999998936, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/94103547/94103547.hdr", 5400, 5401, -121.99999999977, 41.499999999496, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/94951854/94951854.hdr", 5401, 5401, -118.50009259209, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/95002067/95002067.hdr", 5401, 5401, -116.00009259189, 36.999999999136, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/95090289/95090289.hdr", 5401, 5401, -120.00009259221, 36.499999999096, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/96482961/96482961.hdr", 5400, 10801, -123.49999999989, 39.999999999376, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/96509576/96509576.hdr", 5401, 5401, -114.50009259177, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/96728155/96728155.hdr", 5401, 5401, -116.00009259189, 34.999999998976, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/97388485/97388485.hdr", 5401, 5401, -119.00009259213, 37.499999999176, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/97488235/97488235.hdr", 5401, 5401, -116.00009259189, 32.499999998776, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/97598859/97598859.hdr", 5400, 5401, -121.49999999973, 38.499999999256, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/97806449/97806449.hdr", 5401, 5401, -120.50009259225, 38.999999999296, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/98306247/98306247.hdr", 5400, 5401, -121.49999999973, 35.999999999056, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/99177799/99177799.hdr", 5401, 5401, -119.50009259217, 35.499999999016, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "calif/99220202/99220202.hdr", 5401, 5401, -117.50009259201, 34.999999998976, 0.000092592592600001)); + + + + +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/07802769/07802769.hdr", 5401, 5401, -110.00009259141, 42.999999999616, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/07939674/07939674.hdr", 5401, 5400, -108.00009259125, 43.499999999656, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/15522436/15522436.hdr", 5401, 5401, -108.00009259125, 42.999999999616, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/27769222/27769222.hdr", 5401, 5401, -109.00009259133, 42.999999999616, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/31564793/31564793.hdr", 5401, 5401, -109.50009259137, 42.999999999616, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/32480620/32480620.hdr", 5401, 5401, -107.50009259121, 42.999999999616, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/44420245/44420245.hdr", 5401, 5400, -110.00009259141, 43.499999999656, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/54787365/54787365.hdr", 5401, 5400, -108.50009259129, 43.999999999696, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/58366835/58366835.hdr", 5401, 5401, -108.50009259129, 42.999999999616, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/59359503/59359503.hdr", 5401, 5400, -109.00009259133, 43.999999999696, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/60583210/60583210.hdr", 5401, 5400, -107.50009259121, 43.499999999656, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/62091713/62091713.hdr", 5401, 5400, -109.50009259137, 43.499999999656, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/73232551/73232551.hdr", 5401, 5400, -108.00009259125, 43.999999999696, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/79231368/79231368.hdr", 5401, 5400, -107.50009259121, 43.999999999696, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/89313062/89313062.hdr", 5401, 5400, -108.50009259129, 43.499999999656, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/95039968/95039968.hdr", 5401, 5400, -109.00009259133, 43.499999999656, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/95566948/95566948.hdr", 5401, 5400, -109.50009259137, 43.999999999696, 0.000092592592600001)); +sg->add(new SourceGridFloat(normal, TYPE_ELEV, "wyoming/99858940/99858940.hdr", 5401, 5400, -110.00009259141, 43.999999999696, 0.000092592592600001)); + + + + +// create image for writing + +// one meter in degrees notation +double mlat = 0.0000090175; +double mlon = 0.0000120425; + +// pixels is +int width = (int)((topRightLon - bottomLeftLon) / (mlon * detail)); +int height = (int)((topRightLat - bottomLeftLat) / (mlat * detail)); + +gdImagePtr im = gdImageCreateTrueColor(width, height); +gdImageAlphaBlending(im, 0); +gdImageSaveAlpha(im, 1); + +// find central tower location +//Point* tower = new Point((bottomLeftLat + topRightLat) / 2, (bottomLeftLon + topRightLon) / 2, txHeight); +Point* tower = new Point(towerLat, towerLon, txHeight); + +// draw across entire image +double degResLat = (topRightLat - bottomLeftLat) / height; +double degResLon = (topRightLon - bottomLeftLon) / width; +int y = height - 1; +for(double lat = bottomLeftLat; lat < topRightLat; lat += degResLat) { + int x = 0; + for(double lon = bottomLeftLon; lon < topRightLon; lon += degResLon) { + // create and test point + Point* test = new Point(lat, lon, rxHeight); + +double loss; +if(sg->contains(test)) { + loss = pathLoss(tower, test, sg, 0.030, eirp, txantenna+rxantenna, mhz); +} else { + loss = -1024; +} + + // color if coverage exists + int color; + if(loss < sens || loss == DENIED) { + color = gdTrueColorAlpha(0, 0, 0, 127); + } else { + // scale red between 0 and -100 + if(loss > 0) loss = 0; + double val = (64 * (loss/sens)); + color = gdTrueColorAlpha(r, g, b, (int)val); + } + + gdImageSetPixel(im, x, y, color); + x++; + } + y--; +} + +cout << "Content-Type:image/png" << endl << endl; +gdImagePng(im, stdout); + +return 0; + +} + diff --git a/radio.C b/radio.C new file mode 100644 index 0000000..e4c1376 --- /dev/null +++ b/radio.C @@ -0,0 +1,326 @@ +/* + libprop -- library to simulate and measure radio signal propagation + + Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "radio.h" + +#include "geom.h" +#include "source.h" +#include "utils.h" + +//class LongleyWrapper; +#include "longley.C" + + +double knifeEdgeLoss(double startY, double endY, double pointY, double distX, double dist1X, double dist2X, double lambda, double sight) { + // calculate loss along a given path, assuming a knife-edge model + // http://wireless.ictp.trieste.it/school_2002/labo/linkloss/index.html + double d = sqrt(pow(endY - startY, 2) + pow(distX, 2)), + d1 = sqrt(pow(dist1X, 2) + pow(startY - pointY, 2)), + d2 = sqrt(pow(dist2X, 2) + pow(endY - pointY, 2)); + + double deltaD = d1 + d2 - d, + v = 2 * sqrt(deltaD / lambda); + double loss = 6.9 + 20 * log10(sqrt(pow(v, 2) + 1) + v); + return loss; +} + + +double calcFresnelLoss(double ground, double sight, double fresnel) { + double partial = fresnel*0.6; + double margin = sight - ground; + if(margin > 0.6 * fresnel) return 0; + return 6 * (margin / partial); +} + + + +double calcLandLoss(int type, double distance, double freq) { + double loss = 0; + // equations below are coming from TIA TR8 using an curve fit through their loss values + // we assume their values are over 200-meter grids, so we treat accordingly + switch(type) { + case LAND_FOREST: + loss = -9.484 + 2.776 * log(freq); break; + case LAND_RESIDENTIAL: + loss = -9.735 + 3.196 * log(freq); break; + case LAND_COMMERCIAL: + loss = -10.31 + 3.616 * log(freq); break; + } +//cout << "about to use loss=" << loss << "/200m with total dist=" << distance << endl; + distance /= 200; + return loss * distance; +} + + + +double pathLoss(Point* p, Point* q, SourceGroup* s, double resolution, double txPower, double antenna, double freq) { +// lilys studies are 4000, 0, 900 +// double txPower = 1000, // mW +// antenna = 0, // dB/dBi +// freq = 900; // MHz + + // perform radio conversions + double lambda = SPEED_LIGHT / (freq * 1000000); + double txPowerDbm = 10 * log10(txPower); + + double dist = p->distance(q) * 1000; + s->resolve(p); + s->resolve(q); + + // check if outside of radio horizon + // http://en.wikipedia.org/wiki/Radio_horizon + double elevStart = p->elev + p->towerHeight, + elevEnd = q->elev + q->towerHeight; + double horizon = (3.569 * sqrt(elevStart)) * 1000; + if(dist > horizon) + return DENIED; + + // correct ending elevation for earth curvature + double curve = (pow(dist / 1000, 2) / (2 * RADIUS)) * 1000; // http://mathforum.org/library/drmath/view/54904.html + elevEnd -= curve; + + // gather data along signal path + RegionLine* line = new RegionLine(p, q); + vector path = line->discrete(resolution); + s->resolveList(path); + + double vegDepth = 0; + double forestDepth = 0, residentialDepth = 0, commercialDepth = 0; + double worstFresnel = 0, freeSpace = 0, vegLoss = 0, landLoss = 0; + bool lineDead = false; + + // walk along entire path + for(unsigned int i = 0; i < path.size(); i++) { + Point* r = path[i]; + + double fraction = (double)i / (double)path.size(); + double d1 = fraction * dist, + d2 = (1 - fraction) * dist; + + double ground = r->elev; + double sight = ((elevEnd - elevStart) * fraction) + elevStart; + double fresnel = sqrt((lambda * d1 * d2) / (d1 + d2)); // http://en.wikipedia.org/wiki/Fresnel_zone + double curve = (pow(d1 / 1000, 2) / (2 * RADIUS)) * 1000; // http://mathforum.org/library/drmath/view/54904.html + double veg = r->vegHeight; + + //cout << "walking sight=" << sight << "\tground=" << ground << endl; + + // assert good elevation data and correct for earth curve +// assert(ground != -1); + ground -= curve; + + // check for line-of-sight + if(sight < ground) { + lineDead = true; + break; + } + + // check for fresnel violation + if(sight - fresnel < ground) { +/**/ + double startY = elevStart, pointY = ground, + endY = elevEnd - ((pow(dist / 1000, 2) / (2 * RADIUS)) * 1000); + double distX = dist, dist1X = d1, dist2X = d2; + + double fresLoss = knifeEdgeLoss(startY, endY, pointY, distX, dist1X, dist2X, lambda, sight); +/**/ +// double fresLoss = calcFresnelLoss(ground, sight, fresnel); + if(fresLoss > worstFresnel) + worstFresnel = fresLoss; + + } + + // check for vegetation + if(sight < ground + veg) { + vegDepth += resolution; + } + + // measure all land use depths +//if(sight - fresnel < ground) { + switch(r->landType) { + case LAND_FOREST: forestDepth += resolution; break; + case LAND_RESIDENTIAL: residentialDepth += resolution; break; + case LAND_COMMERCIAL: commercialDepth += resolution; break; + } +//} + } + + freeSpace = 32.4 + 20 * log10(freq) + 20 * log10(dist / 1000); + + if(CONSIDER_VEG) { + //cout << "considering vegetation" << endl; + vegDepth *= 1000; + if(vegDepth < 14) { + vegLoss = 0.45 * pow(freq / 1000, 0.284) * vegDepth; + } else if(vegDepth < 400) { + vegLoss = 1.33 * pow(freq / 1000, 0.284) * pow(vegDepth, 0.588); + } else { + vegLoss = LARGE_LOSS; + } + } + + if(CONSIDER_LAND) { +/**/ + forestDepth *= 1000; + residentialDepth *= 1000; + commercialDepth *= 1000; + + landLoss += calcLandLoss(LAND_FOREST, forestDepth, freq); + landLoss += calcLandLoss(LAND_RESIDENTIAL, residentialDepth, freq); + landLoss += calcLandLoss(LAND_COMMERCIAL, commercialDepth, freq); +/**/ +/** / +// consder land use at destination point +switch(q->landType) { + case LAND_FOREST: + landLoss += -9.484 + 2.776 * log(freq); break; + case LAND_RESIDENTIAL: + landLoss += -9.735 + 3.196 * log(freq); break; + case LAND_COMMERCIAL: + landLoss += -10.31 + 3.616 * log(freq); break; +} + +switch(p->landType) { + case LAND_FOREST: + landLoss += -9.484 + 2.776 * log(freq); break; + case LAND_RESIDENTIAL: + landLoss += -9.735 + 3.196 * log(freq); break; + case LAND_COMMERCIAL: + landLoss += -10.31 + 3.616 * log(freq); break; +} + +/**/ + + + } + +//cout << "\n========\nfreeSpace=" << freeSpace; cout << "\nworstFresnel=" << worstFresnel; cout << "\nvegLoss=" << vegLoss; cout << "\nlandLoss=" << landLoss; + + double system = txPowerDbm + antenna; + double totalLoss = freeSpace + worstFresnel + vegLoss + landLoss; + + // clean up discrete path that we built + delete line; + while(!path.empty()) { + delete path.back(); + path.pop_back(); + } + + if(lineDead) + return DENIED; + else + return system - totalLoss; + +} + + + +double pathLossLongley(Point* p, Point* q, SourceGroup* s, double resolution, double txPower, double antenna, double freq) { + + // perform radio conversions + double lambda = SPEED_LIGHT / (freq * 1000000); + double txPowerDbm = 10 * log10(txPower); + + double dist = p->distance(q) * 1000; + s->resolve(p); + s->resolve(q); + + // gather data along signal path + RegionLine* line = new RegionLine(p, q); + vector path = line->discrete(resolution); + s->resolveList(path); + +if(path.size() == 0) return txPowerDbm + antenna; +//cout << "pathLossLongley: path.size()=" << path.size() << endl; cout.flush(); + + // form elev[] array to pass to longley rice algorithm + double* elev = new double[path.size() + 2]; + elev[0] = path.size()-1; + elev[1] = resolution*1000; + for(unsigned int i = 0; i < path.size(); i++) { + Point* r = path[i]; + assert(r->elev != -1); + elev[i+2] = r->elev; + } + + // clean up discrete path that we built + delete line; + while(!path.empty()) { + delete path.back(); + path.pop_back(); + } + + // set variables for longley rice algorithm + // some default values used from http://www.softwright.com/faq/engineering/prop_longley_rice.html + // horizontal versus vertical polarization http://www.tpub.com/neets/book10/42c.htm + double tht_m = p->towerHeight; // transmitter height (meters) + double rht_m = q->towerHeight; // receiver height (meters) + + double eps_dielect = 15; // dielectric constant, set for average ground + double sgm_conductivity = 0.005; // conductivity constant, set for average ground + double eno_ns_surfref = 301; // Surface refractivity of the atmosphere, set for average + + double frq_mhz = freq; // radio frequency (mhz) + int radio_climate = 5; // climate, set for continental temperate + + int pol = 0; // polarization, set for horizontal + double conf = 0.9; // time variability, set to 50% + double rel = 0.9; // situation (confidence) variability, set to 50% + + double dbloss = -1; // calculated loss in dbm + char strmode[128]; // string describing mode used + int errnum = -1; // resulting error code + + // run actual longley rice calculation + point_to_point(elev, tht_m, rht_m, eps_dielect, sgm_conductivity, eno_ns_surfref, frq_mhz, radio_climate, pol, conf, rel, dbloss, strmode, errnum); + + // delete elevation data + delete[] elev; + + // check for any error codes + if(errnum != 0) return DENIED; + +/** / + //assert(errnum == 0); + cout << "pathLossLongley: debug strmode=" << strmode << endl; + switch(errnum) { + case 0: break; + case 1: + cout << "pathLossLongley: Warning: Some parameters are nearly out of range. Results should be used with caution." << endl; + return DENIED; break; + case 2: + cout << "pathLossLongley: Note: Default parameters have been substituted for impossible ones." << endl; + return DENIED; break; + case 3: + cout << "pathLossLongley: Warning: A combination of parameters is out of range. Results are probably invalid." << endl; + return DENIED; break; + default: + cout << "pathLossLongley: errnum=" << errnum << " Warning: Some parameters are out of range. Results are probably invalid." << endl; + return DENIED; break; + } +/**/ + + double system = txPowerDbm + antenna; + double totalLoss = dbloss; + + return system - totalLoss; + +} + + diff --git a/radio.h b/radio.h new file mode 100644 index 0000000..c383efe --- /dev/null +++ b/radio.h @@ -0,0 +1,83 @@ +/* + libprop -- library to simulate and measure radio signal propagation + + Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#pragma once + +#include "geom.h" +#include "source.h" +#include "utils.h" + + +#define SPEED_LIGHT 299792458 // meters/second +#define DENIED 1024 +#define LARGE_LOSS -16777216 + +#define CONSIDER_VEG true +#define CONSIDER_LAND true + +/// Calculate the knife-edge loss given the situation variables. +/// @param startY Signal origin elevation point, in meters +/// @param endY Signal end elevation point, in meters +/// @param pointY Elevation where we are currently calculating knife-edge loss, in meters +/// @param distX Distance along the path between the origin and end points, in meters +/// @param dist1X Fraction along the path between origin and end point, from origin point +/// @param dist2X Fraction along the path between origin and end point, remaining towards end point +/// @param lambda Lambda value calculated using signal frequency +/// @param sight Imaginary elevation of line-of-sight between origin and end point, in meters +/// @return Calculated loss as provided by knife-edge diffraction model, in dBm +double knifeEdgeLoss(double startY, double endY, double pointY, double distX, double dist1X, double dist2X, double lambda, double sight); + +/// Calculate the fresnel loss given the situation variables. This model was found in literature, but seems less reliable. +/// @param ground Elevation of ground at current point, in meters +/// @param sight Imaginary elevation of line-of-sight between origin and end point, in meters +/// @param fresnel Low-point elevation of first-fresnel zone at current point, in meters +/// @return Calculated loss, in dBm +double calcFresnelLoss(double ground, double sight, double fresnel); + +/// Calculate the land-use attentuation loss assuming we pass through a specific distance of given type. This equation seems very unreliable, and has not been verified. +/// @param type Enumeration value of type of land-use we are passing through +/// @param distance Distance of this land-use type that our signal passes through, in meters +/// @param freq Frequency of our transmitted signal, in MHz +/// @return Calculated loss, in dBm +double calcLandLoss(int type, double distance, double freq); + +//double pathLoss(Point* p, Point* q, SourceGroup* s, double resolution); + +/// Calculate the loss if we follow a given path between two radio towers. +/// @param p Signal origin point, with towerHeight set +/// @param q Signal destination point, with towerHeight set +/// @param s SourceGroup to provide elevation and vegetaion data as required +/// @param resolution Detail used to step along the line-of-sight path, in kilometers +/// @param txPower Transmitter power, in mW +/// @param antenna Total antenna gain of both receiver and transmitter, in dB +/// @param freq Frequency that radios operate at, in MHz +/// @return Calculated loss along given path, in dBm +double pathLoss(Point* p, Point* q, SourceGroup* s, double resolution, double txPower, double antenna, double freq); + + +/// Calculate the loss if we follow a given path between two radio towers. Uses Longley-Rice propagation model to calculate attenuation. +/// @param p Signal origin point, with towerHeight set +/// @param q Signal destination point, with towerHeight set +/// @param s SourceGroup to provide elevation and vegetaion data as required +/// @param resolution Detail used to step along the line-of-sight path, in kilometers +/// @param txPower Transmitter power, in mW +/// @param antenna Total antenna gain of both receiver and transmitter, in dB +/// @param freq Frequency that radios operate at, in MHz +/// @return Calculated loss along given path, in dBm +double pathLossLongley(Point* p, Point* q, SourceGroup* s, double resolution, double txPower, double antenna, double freq); diff --git a/source.C b/source.C new file mode 100644 index 0000000..a90cd8e --- /dev/null +++ b/source.C @@ -0,0 +1,391 @@ +/* + libprop -- library to simulate and measure radio signal propagation + + Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "source.h" + +#include +#include +#include + +#include + +using namespace std; + +#include "geom.h" +#include "utils.h" + + + +void Convert::convert(Point* p, double* x, double* y) { + *x = p->lon; + *y = p->lat; +} + + + + +ConvertAlbers::ConvertAlbers() { + double northLat = toRadians(29.500000), + southLat = toRadians(45.500000), + originLat = toRadians(23.000000), + originLon = toRadians(-96.000000); + + middleLon = originLon; + + double q1 = calcQ(southLat), + q2 = calcQ(northLat), + q0 = calcQ(originLat); + + double m1sq = calcMsq(southLat), + m2sq = calcMsq(northLat); + + coneConst = (m1sq - m2sq) / (q2 - q1); + bigC = m1sq + coneConst * q1; + r0 = (RADIUS * 1000) * sqrt(bigC - coneConst * q0) / coneConst; + +} + +double ConvertAlbers::calcQ(double lat) { + double s = sin(lat), + es = s * EC; + return (1.0 - EC2) * ((s / (1 - es * es)) - + (1 / (2 * EC)) * log((1 - es) / (1 + es))); +} + +double ConvertAlbers::calcMsq(double lat) { + double c = cos(lat), + es = sin(lat) * EC; + return c * c / (1 - es * es); +} + +void ConvertAlbers::convert(Point* p, double* x, double* y) { + double lat = toRadians(p->lat), + lon = toRadians(p->lon); + + double q = calcQ(lat), + theta = coneConst * (lon - middleLon), + r = (RADIUS * 1000) * sqrt(bigC - coneConst * q) / coneConst; + + *x = (r * sin(theta) * 1) + 80; + *y = ((r0 - r * cos(theta)) * 1) + 80; +} + + + + + + +Source::Source() { +} + +Source::Source(Convert* _convert, int _type) : convert(_convert), type(_type) { +} + +void Source::resolveList(vector list) { + vector::iterator it; + for(it = list.begin(); it != list.end(); it++) { + resolve(*it); + } +} + +bool Source::contains(Point* p) { + double x, y; + convert->convert(p, &x, &y); + return (x > left && x < right && + y > bottom && y < top); +} + + + + + + + + +int SourceInteger::value(int offset) { + if(cache == NULL) { + char data[1]; + raw.seekg(offset); + raw.read(data, 1); + int value = (int)*data; + return value; + } else { + return cache[offset]; + } +} + +SourceInteger::SourceInteger(Convert* convert, int type, string filename, bool cache) : Source(convert, type) { + // read in header information + ifstream in(filename.c_str(), ifstream::in); + string name; double value; + while(in.good()) { + in >> name; + if(name == "NCOLS") in >> ncols; + if(name == "NROWS") in >> nrows; + } + in.close(); + + filename.replace(filename.end() - 3, filename.end(), "blw"); + ifstream in2(filename.c_str(), ifstream::in); + in2 >> cellsize >> value >> value >> value >> left >> top; + in2.close(); + + bottom = top - (nrows * cellsize); + right = left + (ncols * cellsize); + +//cout << fixed << " cell=" << cellsize; cout << " rows=" << nrows; cout << " cols=" << ncols; cout << endl; +//cout << " top=" << top; cout << " bot=" << bottom; cout << " lef=" << left; cout << " rig=" << right; cout << endl; + + // open data source + filename.replace(filename.end() - 3, filename.end(), "bil"); + raw.open(filename.c_str(), ifstream::in | ifstream::binary); + + if(cache) { + // create a cache for entire data file + long size = nrows * ncols; + this->cache = new int[size]; + + cout << "SourceInteger: loading data file..."; fflush(stdout); + char data[1]; + for(int i = 0; i < size; i++) { + raw.read(data, 1); + this->cache[i] = (int)*data; + } + cout << "done" << endl; + } else { + this->cache = NULL; + } + +} + +SourceInteger::~SourceInteger() { + raw.close(); + if(cache != NULL) + delete[] cache; +} + +void SourceInteger::resolve(Point* p) { + double x, y; + convert->convert(p, &x, &y); + + // find the approximate cell location + int row = (int)((y - bottom) / cellsize), + col = (int)((x - left) / cellsize); + + row = nrows - max(0, min(row, nrows)) - 1; + col = max(0, min(col, ncols)); + + long offset = ((row * ncols) + col); +//cout << fixed << "about to use x=" << x << "\ty=" << y << endl; +//cout << "about to use row=" << row << "\tcol=" << col << endl; +//cout << "about to use offset=" << offset << endl; + int iv = value(offset); + if(type == TYPE_LAND) { + switch(iv) { + case 41: case 42: case 43: case 90: case 91: case 93: + p->landType = LAND_FOREST; break; + case 22: + p->landType = LAND_RESIDENTIAL; break; + case 23: case 24: + p->landType = LAND_COMMERCIAL; break; + default: + p->landType = LAND_NONE; break; + } + } +//cout << "FOUND value=" << iv << endl; + +} + + + + + + + + +double SourceGridFloat::value(int offset) { +//cout << "trying to run offset=" << offset << endl; fflush(stdout); + if(cache == NULL) { + char data[4]; + raw.seekg(offset * 4); + raw.read(data, 4); + return ieee_single(data); + } else { + return cache[offset]; + } +} + +SourceGridFloat::SourceGridFloat(Convert* convert, int type, string filename, bool cache) : Source(convert, type) { + // read in header information + ifstream in(filename.c_str(), ifstream::in); + while(in.good()) { + string name; + double value; + in >> name >> value; + if(name == "ncols") ncols = (int)value; + if(name == "nrows") nrows = (int)value; + if(name == "xllcorner") left = value; + if(name == "yllcorner") bottom = value; + if(name == "cellsize") cellsize = value; + } + in.close(); + + top = bottom + (nrows * cellsize); + right = left + (ncols * cellsize); + + // open data source + filename.replace(filename.end() - 3, filename.end(), "flt"); + raw.open(filename.c_str(), ifstream::in | ifstream::binary); + + if(cache) { + // create a cache for entire data file + long size = nrows * ncols; + this->cache = new double[size]; + + cout << "SourceGridFloat: loading data file..."; fflush(stdout); + char data[4]; + for(int i = 0; i < size; i++) { + raw.read(data, 4); + this->cache[i] = ieee_single(data); + } + cout << "done" << endl; + } else { + this->cache = NULL; + } +} + +SourceGridFloat::SourceGridFloat(Convert* convert, int type, string filename, int _ncols, int _nrows, double _left, double _bottom, double _cellsize) : Source(convert, type) { + // set explicit header file values + nrows = _nrows; + ncols = _ncols; + left = _left; + bottom = _bottom; + cellsize = _cellsize; + + top = bottom + (nrows * cellsize); + right = left + (ncols * cellsize); + + // save data source filename for later opening if needed + filename.replace(filename.end() - 3, filename.end(), "flt"); + rawfilename = filename; + + this->cache = NULL; +} + + +SourceGridFloat::~SourceGridFloat() { + if(raw != NULL) + raw.close(); + if(cache != NULL) + delete[] cache; +} + +void SourceGridFloat::resolve(Point* p) { + double x, y; + convert->convert(p, &x, &y); + + // open data source if needed + if(!raw.is_open()) + raw.open(rawfilename.c_str(), ifstream::in | ifstream::binary); + + + // find the approximate cell location + int row = (int)((y - bottom) / cellsize), + col = (int)((x - left) / cellsize); + + row = nrows - max(0, min(row, nrows)) - 1; + col = max(0, min(col, ncols)); + + long offset = ((row * ncols) + col); +//cout << "about to use x=" << x << "\ty=" << y << endl; +//cout << "about to use row=" << row << "\tcol=" << col << endl; +//cout << "about to use offset=" << offset << endl; + double dv = value(offset); + int iv = (int)dv; + if(type == TYPE_ELEV) { + p->elev = dv; + } else if(type == TYPE_VEGTYPE) { + p->vegType = iv; + // save the vegetation density/cover as the average (half) percent + switch(iv) { + case 101: case 111: case 121: p->vegCover = 15; break; + case 102: case 112: case 122: p->vegCover = 25; break; + case 103: case 113: case 123: p->vegCover = 35; break; + case 104: case 114: case 124: p->vegCover = 45; break; + case 105: case 115: case 125: p->vegCover = 55; break; + case 106: case 116: case 126: p->vegCover = 65; break; + case 107: case 117: case 127: p->vegCover = 75; break; + case 108: case 118: case 128: p->vegCover = 85; break; + case 109: case 119: case 129: p->vegCover = 95; break; + } + } else if(type == TYPE_VEGHEIGHT) { + // save the vegetation height as the average (half) in meters + switch(iv) { + case 101: p->vegHeight = 0.25; break; + case 102: p->vegHeight = 0.5; break; + case 103: p->vegHeight = 1; break; + + case 104: p->vegHeight = 0.25; break; + case 105: p->vegHeight = 0.5; break; + case 106: p->vegHeight = 1.5; break; + case 107: p->vegHeight = 3; break; + + case 108: p->vegHeight = 2.5; break; + case 109: p->vegHeight = 5; break; + case 110: p->vegHeight = 12.5; break; + case 111: p->vegHeight = 25; break; + case 112: p->vegHeight = 50; break; + } + } + +} + + + + + + + +SourceGroup::~SourceGroup() { + while(!list.empty()) { + delete list.back(); + list.pop_back(); + } +} + +void SourceGroup::resolve(Point* p) { + vector::iterator it; + for(it = list.begin(); it != list.end(); it++) { + if((*it)->contains(p)) + (*it)->resolve(p); + } +} + +bool SourceGroup::contains(Point* p) { + vector::iterator it; + for(it = list.begin(); it != list.end(); it++) { + if((*it)->contains(p)) return true; + } + return false; +} + +void SourceGroup::add(Source* s) { + list.push_back(s); +} + diff --git a/source.h b/source.h new file mode 100644 index 0000000..16e3d4d --- /dev/null +++ b/source.h @@ -0,0 +1,216 @@ +/* + libprop -- library to simulate and measure radio signal propagation + + Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#pragma once + +#include +#include +#include + +#include + +using namespace std; + +#include "geom.h" +#include "utils.h" + +#define TYPE_ELEV 2 +#define TYPE_VEGTYPE 3 +#define TYPE_VEGHEIGHT 4 +#define TYPE_LAND 5 + +#define LAND_NONE 0 +#define LAND_FOREST 1 +#define LAND_RESIDENTIAL 2 +#define LAND_COMMERCIAL 3 + +#define EC 0.082271854 +#define EC2 0.006768658 + + +/// Interface to convert a Point into another coordinate system that could be used to reference into a Source. +class Convert { +public: + /// Convert the given Point into another coordinate system. + /// @param p Point to be converted + /// @param x Output x coordinate after conversion + /// @param y Output y coordinate after conversion + virtual void convert(Point* p, double* x, double* y); +}; + + +/// Interface to convert Point objects into default Albers projection coordinate system. +class ConvertAlbers : public Convert { +private: + double middleLon, bigC, coneConst, r0; + + double calcQ(double lat); + double calcMsq(double lat); + +public: + ConvertAlbers(); + + /// Convert the given Point into default Albers projection coordinate system. + /// @param p Point to be converted + /// @param x Output x coordinate after conversion + /// @param y Output y coordinate after conversion + void convert(Point* p, double* x, double* y); + +}; + + +/// Interface to a data source. Sources can be asked to fill Point objects with any available data. +class Source { +protected: + /// Conversion to apply to each incoming Point + Convert* convert; + /// Enumeration describing what type of data this object provides + int type; + int ncols, nrows; + double top, left, bottom, right; + /// Optional internal value describing the size of each data cell + double cellsize; + /// Filename pointing at actual source datafile + string rawfilename; + /// Open stream to source datafile, if already opened + ifstream raw; + + Source(); + + /// Create a new data source. + /// @param _convert The conversion to apply to all incoming points + /// @param _type Enumeration value describing the type of data we provide + Source(Convert* _convert, int _type); + +public: + /// Resolve a given Point by filling it with any new data this source can provide. Will ignore given point if this source can't provide data. + /// @param p The point to try filling with data + virtual void resolve(Point* p) = 0; + + /// Resolve the entire list of Point objects by calling resolve() on each of them. + /// @param list List of Point objects to try resolving + void resolveList(vector list); + + /// Check if this source provides data about the given point. + /// @param p Point to check against + /// @return True if this source provides data about given point, otherwise false. + virtual bool contains(Point* p); + +}; + + + +/// Interface to a data source. Sources can be asked to fill Point objects with any available data. Specifically handles data files in integer format, usually ending with ".bil" extension. +class SourceInteger : public Source { +protected: + /// Internal cache of entire data file, if requested + int* cache; + + /// Retrieve a specific value, either from raw source file, or from cache if it exists. + /// @param offset Offset into the data file to read + /// @return Value at offset location + int value(int offset); + +public: + + /// Create a new integer data source. + /// @param convert The conversion to apply to all incoming points + /// @param type Enumeration value describing the type of data we provide + /// @param filename Filename pointing to ".hdr" file for this data source + /// @param cache Cache entire data file in memory if true, otherwise read directly from file when requested + SourceInteger(Convert* convert, int type, string filename, bool cache); + + ~SourceInteger(); + + /// Resolve a given Point by filling it with any new data this source can provide. Will ignore given point if this source can't provide data. + /// @param p The point to try filling with data + void resolve(Point* p); +}; + + + +/// Interface to a data source. Sources can be asked to fill Point objects with any available data. Specifically handles data files in grid float format, usually ending with ".flt" extension. +class SourceGridFloat : public Source { +protected: + /// Internal cache of entire data file, if requested + double* cache; + + /// Retrieve a specific value, either from raw source file, or from cache if it exists. + /// @param offset Offset into the data file to read + /// @return Value at offset location + double value(int offset); + +public: + + /// Create a new grid float data source. + /// @param convert The conversion to apply to all incoming points + /// @param type Enumeration value describing the type of data we provide + /// @param filename Filename pointing to ".hdr" file for this data source + /// @param cache Cache entire data file in memory if true, otherwise read directly from file when requested + SourceGridFloat(Convert* convert, int type, string filename, bool cache); + + /// Create a new grid float data source. This constructor is specifically used to bypass reading the ".hdr" header file, which can save time when using large numbers of data source tiles. + /// @param convert The conversion to apply to all incoming points + /// @param type Enumeration value describing the type of data we provide + /// @param filename Filename pointing to ".hdr" file for this data source + /// @param _ncols Number of columns in the data file + /// @param _nrows Number of rows in the data file + /// @param _left Left longitude of the data file + /// @param _bottom Bottom latitude of the data file + /// @param _cellsize Size of each cell in the data file + SourceGridFloat(Convert* convert, int type, string filename, int _ncols, int _nrows, double _left, double _bottom, double _cellsize); + + ~SourceGridFloat(); + + /// Resolve a given Point by filling it with any new data this source can provide. Will ignore given point if this source can't provide data. + /// @param p The point to try filling with data + void resolve(Point* p); + +}; + + + +/// Interface to a collection of data sources. This can quickly fill Point objects with available data from a large set of source files. +class SourceGroup : public Source { +private: + /// Internal list of all Source objects we know about + vector list; +public: + ~SourceGroup(); + + /// Add the given Source to this list of sources. Will be used in any resolve() calls in the future. + /// @param s Source object to add to our list + void add(Source* s); + + /// Resolve a given Point by filling it with any new data this source can provide. Will ignore given point if this source can't provide data. + /// @param p The point to try filling with data + void resolve(Point* p); + + /// Check if any sources we know about can provide data about the given point. + /// @param p Point to check against + /// @return True if any source provides data about given point, otherwise false. + bool contains(Point* p); + +}; + + + + + + diff --git a/test/testcases.C b/test/testcases.C new file mode 100644 index 0000000..5cde471 --- /dev/null +++ b/test/testcases.C @@ -0,0 +1,346 @@ +/* + libprop -- library to simulate and measure radio signal propagation + + Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "geom.h" +#include "radio.h" +#include "source.h" +#include "utils.h" + +#include + +// test cases +void testPoint() { + cout << "== testPoint ==" << endl; + + Point* p = new Point(45.52391667, -111.2476944); + Point* q = new Point(45.49677778, -111.2711389); + + cout << "distance:\tp->q=" << p->distance(q) << "\n\t\tq->p=" << q->distance(p) << endl; + cout << "bearing:\tp->q=" << toDegrees(p->bearing(q)) << "\n\t\tq->p=" << toDegrees(q->bearing(p)) << endl; + + Point* r = p->project(q->bearing(p), p->distance(q) / 2); + Point* s = p->project(p->bearing(q) + toRadians(45), p->distance(q) / 2); + cout << "project:\tp, direction=q->p, distance=1/2 p->q\n\t\t" << *r << "\n\t\t" << *s << endl; + +} + +void testRegion() { + cout << "== testRegion ==" << endl; + + Point* p = new Point(45.52391667, -111.2476944); + Point* q = new Point(45.49677778, -111.2711389); + + RegionArea* normal = new RegionArea(q, p); + cout << "normal:\t" << *normal << endl; + + RegionArea* add = new RegionArea(); + add->add(p); + add->add(q); + cout << "includ:\t" << *add << endl; + + RegionArea* radius = new RegionArea(q, 10); + cout << "radius:\t" << *radius << endl; + + Point* out1 = p->project(toRadians(90), 0.050); + Point* out2 = p->project(toRadians(45), 0.050); + Point* out3 = p->project(toRadians(225), 10); + Point* in1 = p->project(toRadians(270), 0.050); + Point* in2 = p->project(toRadians(225), 0.050); + + cout << "out1:\t" << normal->contains(out1) << endl; + cout << "out2:\t" << normal->contains(out2) << endl; + cout << "out3:\t" << normal->contains(out3) << endl; + cout << "in1:\t" << normal->contains(in1) << endl; + cout << "in2:\t" << normal->contains(in2) << endl; + +} + +void testReading() { + cout << "== testReading ==" << endl; + + //Point* p = new Point(); + //cin >> *p; + //cout << *p; +} + + +void testFileLine() { + cout << "== testFileLine ==" << endl; + + string file = "C:\\_JSharkey\\__Input\\ca199-raw.txt"; + RegionLine* line = new RegionLine(file); + + double resolution = 0.500; + + vector list = line->discrete(resolution); + double origlength = line->length(), + thislength = list.size() * resolution; + + cout << "original=" << origlength << endl; + cout << "n=" << list.size() << ", this=" << thislength << endl; + + // save each point out to file + ofstream out("C:\\_JSharkey\\__Output\\test199.kml"); + out << ""; + out.precision(8); + + vector::iterator it; + for(it = list.begin(); it != list.end(); it++) { + out << "" << (*it)->lon << "," << (*it)->lat << ",-1"; + } + + out << ""; + out.close(); + + +} + + + + + + +void testReadGF() { + cout << "== testReadGF ==" << endl; + + Source* s;// = new SourceGridFloatDecimal("C:\\_JSharkey\\__Input\\hw191.80214271\\80214271.hdr", false, TYPE_ELEV); + + Point* p = new Point(45.52391667, -111.2476944); + Point* q = new Point(45.49677778, -111.2711389); + + s->resolve(p); + s->resolve(q); + + cout << "p.elev=" << p->elev << endl; + cout << "q.elev=" << q->elev << endl; + + +} + +void testFloat() { + //char raw[] = {0x42, 0x7c, 0x00, 0x00}; + //double value = ieee_single(raw); + + //cout << "value=" << value << endl; +} + + + +void testPath() { + Point* p = new Point(45.52391667, -111.2476944); + Point* q = new Point(45.530035, -111.235863); + + p->towerHeight = 10; + q->towerHeight = 10; + + Source* s;// = new SourceGridFloatDecimal("C:\\_JSharkey\\__Input\\hw191.80214271\\80214271.hdr", false, TYPE_ELEV); + SourceGroup* sg = new SourceGroup(); + sg->add(s); + + // should be field strength=-56.6443697139135 +// double loss = pathLoss(p, q, sg, 0.010); +// cout << "found loss=" << loss << endl; + +} + +void testBulk() { + // time running a set of bulk points + + time_t start,end; + + //Source* s = new SourceGridFloatMemory("C:\\_JSharkey\\__Input\\hw191.80214271\\80214271.hdr"); + Source* s;// = new SourceGridFloatDecimal("C:\\_JSharkey\\__Input\\hw191.80214271\\80214271.hdr", false, TYPE_ELEV); + SourceGroup* sg = new SourceGroup(); + sg->add(s); + + time(&start); + + Point* p = new Point(45.52391667, -111.2476944); + RegionArea* a = new RegionArea(p, 1); + vector list = a->discrete(0.100); + + cout << "total points=" << list.size() << endl; + + p->towerHeight = 10; + + // run a path loss to each point + vector::iterator it; + for(it = list.begin(); it != list.end(); it++) { + Point* q = *it; + q->towerHeight = 10; + +// double loss = pathLoss(p, q, sg, 0.010); + + } + + time(&end); + double dif = difftime(end, start); + + cout << "seconds=" << dif << endl; + + cout << "finished!" << endl; + +} + +void testAlbers() { + cout << "== testAlbers ==" << endl; + +// prepareAlbers(); + + Point* p = new Point(45.52391667, -111.2476944); +/* PointAlbers* q = new PointAlbers(p); + + cout.precision(12); + cout << " middleLon=" << middleLon; + cout << " bigC=" << bigC << endl; + cout << " coneConst=" << coneConst; + cout << " r0=" << r0 << endl; + + cout << "lat=" << p->lat << " lon=" << p->lon << endl; + cout << "albers x=" << q->x << " y=" << q->y << endl; + +*/ +} + +void testVegetation() { + cout << "== testVegetation ==" << endl; + + Point* p = new Point(45.52391667, -111.2476944); + Point* q = new Point(45.535590, -111.237847); // fs=-117.811987241978 + Point* r = new Point(45.515451, -111.249752); // fs=-59.430352054876 + + p->towerHeight = 10; + q->towerHeight = 10; + r->towerHeight = 10; + + Convert* norm = new Convert(); + Convert* albers = new ConvertAlbers(); + + Source* s = new SourceGridFloat(norm, TYPE_ELEV, "mt191/80214271.elev/80214271.hdr", false); + Source* t = new SourceGridFloat(albers, TYPE_VEGHEIGHT, "mt191/22276103.height/22276103.hdr", false); + Source* u = new SourceGridFloat(albers, TYPE_VEGTYPE, "mt191/22273282.type/22273282.hdr", false); + + SourceGroup* sg = new SourceGroup(); + sg->add(s); + sg->add(t); + sg->add(u); + + sg->resolve(p); + sg->resolve(q); + sg->resolve(r); + + cout << "p\telev=" << p->elev << "\tvegtype=" << p->vegType << "\tvegheight=" << p->vegHeight << "\tvegcover=" << p->vegCover << endl; + cout << "q\telev=" << q->elev << "\tvegtype=" << q->vegType << "\tvegheight=" << q->vegHeight << "\tvegcover=" << q->vegCover << endl; + cout << "r\telev=" << r->elev << "\tvegtype=" << r->vegType << "\tvegheight=" << r->vegHeight << "\tvegcover=" << r->vegCover << endl; + +// double losspq = pathLoss(p, q, sg, 0.010); +// double losspr = pathLoss(p, r, sg, 0.010); + cout.precision(8); +// cout << "loss pq=" << losspq << endl; +// cout << "loss pr=" << losspr << endl; + +} + + +void testInteger() { + +// load an integer data source and try reading various points + + Convert* albers = new ConvertAlbers(); + Source* s = new SourceInteger(albers, TYPE_LAND, "mt191/99981370.land/99981370.hdr", false); + + Point* p = new Point(45.52391667, -111.2476944); + +ofstream out("results/landcover.txt"); +out.precision(8); + +RegionArea* area = new RegionArea(p, 1); +vector list = area->discrete(0.050); + +vector::iterator it; +for(it = list.begin(); it != list.end(); it++) { + Point* q = *it; + s->resolve(q); + out << q->lon << "\t" << q->lat << "\t" << q->landType << endl; +} + +out.close(); + + + + + +return; + + Point* q = new Point(45.535590, -111.237847); + Point* r = new Point(45.515451, -111.249752); + + s->resolve(p); + s->resolve(q); + s->resolve(r); + + cout << "p\ttype=" << p->landType << endl; + cout << "q\ttype=" << q->landType << endl; + cout << "r\ttype=" << r->landType << endl; + + + +} + + + +void testTypePath() { + +// test the new viewshed with and without path information + +SourceGroup* sg = new SourceGroup(); +Convert* norm = new Convert(); +Convert* albers = new ConvertAlbers(); +bool cache = false; + +// mt191 +sg->add(new SourceGridFloat(norm, TYPE_ELEV, "mt191/80214271.elev/80214271.hdr", cache)); +sg->add(new SourceGridFloat(albers, TYPE_VEGHEIGHT, "mt191/22276103.height/22276103.hdr", cache)); +sg->add(new SourceGridFloat(albers, TYPE_VEGTYPE, "mt191/22273282.type/22273282.hdr", cache)); + +Point* p = new Point(45.52391667, -111.2476944); +Point* q = new Point(45.535590, -111.237847); +Point* r = new Point(45.515451, -111.249752); + +p->towerHeight = 10; +q->towerHeight = 10; +r->towerHeight = 10; + +double pq, pq2, pr, pr2; + +pq = pathLoss(p, q, sg, 0.010, 4000, 0, 900); +pr = pathLoss(p, r, sg, 0.010, 4000, 0, 900); + +sg->add(new SourceInteger(albers, TYPE_LAND, "mt191/99981370.land/99981370.hdr", cache)); + +pq2 = pathLoss(p, q, sg, 0.010, 4000, 0, 900); +pr2 = pathLoss(p, r, sg, 0.010, 4000, 0, 900); + +cout << "\np->q\tbefore=\t" << pq << "\n\tafter=\t" << pq2 << endl; +cout << "\np->r\tbefore=\t" << pr << "\n\tafter=\t" << pr2 << endl; + +} + + + diff --git a/test/testcases.h b/test/testcases.h new file mode 100644 index 0000000..3454a3e --- /dev/null +++ b/test/testcases.h @@ -0,0 +1,42 @@ +/* + libprop -- library to simulate and measure radio signal propagation + + Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#pragma once + +#include "geom.h" +#include "radio.h" +#include "source.h" +#include "utils.h" + +#include + +void testPoint(); +void testRegion(); +void testReading(); +void testFileLine(); +void testReadGF(); +void testFloat(); +void testPath(); +void testBulk(); +void testAlbers(); +void testVegetation(); +void testInteger(); +void testTypePath(); + + diff --git a/utils.C b/utils.C new file mode 100644 index 0000000..1400951 --- /dev/null +++ b/utils.C @@ -0,0 +1,117 @@ +/* + libprop -- library to simulate and measure radio signal propagation + + Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "utils.h" + +#include +#include + +using namespace std; + +double toRadians(double d) { + return d * PI / 180; +} + +double toDegrees(double r) { + return r * 180 / PI; +} + +// taken from http://www.thescripts.com/forum/thread59795.html +// requires input in reversed byte order +double ieee_single(char *data2) { + //const unsigned char *data = v; + unsigned char data[4]; + data[0] = data2[3]; + data[1] = data2[2]; + data[2] = data2[1]; + data[3] = data2[0]; + int s, e; + unsigned long src; + //long f; + double f; + double value; + + src = ((unsigned long)data[0] << 24) + + ((unsigned long)data[1] << 16) + + ((unsigned long)data[2] << 8) + + ((unsigned long)data[3]); + + s = (src & 0x80000000UL) >> 31; + e = (src & 0x7F800000UL) >> 23; + f = (src & 0x007FFFFFUL); + + if (e == 255 && f != 0) { + /* NaN - Not a number */ + value = DBL_MAX; + } else if (e == 255 && f == 0 && s == 1) { + /* Negative infinity */ + value = -DBL_MAX; + } else if (e == 255 && f == 0 && s == 0) { + /* Positive infinity */ + value = DBL_MAX; + } else if (e > 0 && e < 255) { + /* Normal number */ + f += 0x00800000UL; + if (s) f = -f; + value = ldexp(f, (int)(e - 127 - 23)); + } else if (e == 0 && f != 0) { + /* Denormal number */ + if (s) f = -f; + value = ldexp(f, -126 - 23); + } else if (e == 0 && f == 0 && s == 1) { + /* Negative zero */ + value = 0; + } else if (e == 0 && f == 0 && s == 0) { + /* Positive zero */ + value = 0; + } else { + /* Never happens */ + //printf("s = %d, e = %d, f = %lu\n", s, e, f); + //assert(!"Oops, unhandled case in ieee_single()"); + } + return value; +} + +TimeRemaining::TimeRemaining(int _max, int _display) : max(_max), display(_display) { + value = 0; + wide = 50; + time(&start); +} + +void TimeRemaining::increment() { + value++; + if(value % display != 0 && value != max) return; + + time_t end; time(&end); + double diff = difftime(end, start); + int sec = (int)((double)diff / (double)value * (double)(max - value)); + int prog = (int)((double)value * (double)wide / (double)max); + int pct = (int)((double)value * 100 / (double)max); + + if(prog > wide) return; + + string a(prog, '*'); + string b(wide - prog, ' '); + + int min = sec / 60; + sec -= min * 60; + + cout << "\r[" << a << b << "] " << pct << "%, " << min << " min " << sec << " sec "; + fflush(stdout); +} diff --git a/utils.h b/utils.h new file mode 100644 index 0000000..7eeaaa6 --- /dev/null +++ b/utils.h @@ -0,0 +1,71 @@ +/* + libprop -- library to simulate and measure radio signal propagation + + Copyright (C) 2007 Jeffrey Sharkey, jsharkey.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#pragma once + +#include +#include +#include + +#include +#include + +using namespace std; + + +#define PI 3.14159 +#define RADIUS 6378.2064 + +/// Convert given degree value into radians +double toRadians(double d); + +/// Convert given radians value into degrees +double toDegrees(double r); + +/// Convert the given character string into a single value, interpreting it using the IEEE single standard. +/// @param data2 Value to be converted, requires four bytes +/// @return Interpreted value expressed as a double +double ieee_single(char *data2); + + + +/// Helpful class to express remaining time to a user. Displays a progress bar with a remaining time in minutes and seconds. +class TimeRemaining { +private: + /// Current increment value + int value; + /// Number of every increment() calls we update display + int display; + /// Total number of increment() calls we expect to process + int max; + /// Width of progress bar to output + int wide; + /// Marked starting time of first increment() call + time_t start; + +public: + /// Create a new progress bar with user output. + /// @param _max The total number of increment() calls that we expect to process + /// @param _display Update the user display after every "display" number of increment() calls + TimeRemaining(int _max, int _display); + + /// Increment our internal counter by one task. Will update the user display if needed. + void increment(); +}; +