[
  {
    "path": ".gitignore",
    "content": "# Ignore the build directory\n**/build/"
  },
  {
    "path": "CMakeLists.txt",
    "content": "# Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n#\n# This file is part of FLAT.\n#\n# FLAT is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# FLAT is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n# Minimum CMake version required \ncmake_minimum_required(VERSION 2.8.11)\n\n# Project information\nproject (FLAT)\n\n# Version data and header file\nset (CT_VERSION_MAJOR 1)\nset (CT_VERSION_MINOR 0)\nset (CT_VERSION_PATCH 0)\nset (CT_VERSION \"${CT_VERSION_MAJOR}.${CT_VERSION_MINOR}.${CT_VERSION_PATCH}\")\nconfigure_file (\n  \"${PROJECT_SOURCE_DIR}/version.h.in\"\n  \"${PROJECT_BINARY_DIR}/version.h\"\n)\ninclude_directories(\"${PROJECT_BINARY_DIR}\")\n\n# Default build type if none was specified\nif(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)\n  set(CMAKE_BUILD_TYPE Release CACHE STRING \"Choose the type of build.\" FORCE)\n  # Set the possible values of build type for cmake-gui\n  set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS \"Debug\" \"Release\"\n    \"MinSizeRel\" \"RelWithDebInfo\")\nendif()\n\n# Qt configuration\nset(CMAKE_INCLUDE_CURRENT_DIR ON) # Find includes in corresponding build directories\nset(CMAKE_AUTOMOC ON) # Instruct CMake to run moc automatically when needed\nset(CMAKE_AUTORCC ON) # Instruct CMake to run rcc automatically when needed\nset(CMAKE_AUTOUIC ON) # Instruct CMake to run uic automatically when needed\nfind_package(Qt5Core REQUIRED)\nfind_package(Qt5Widgets REQUIRED)\nfind_package(Qt5Xml REQUIRED)\n\n# Add all source and resource files\nfile(GLOB SRC src/*.cpp src/*.h)\nfile(GLOB RSC src/*.qrc)\n\n# Add the executable\nif(WIN32)\n    add_executable(FLAT WIN32 ${SRC} ${RSC})\nelse()\n    add_executable(FLAT ${SRC} ${RSC})\nendif()\nset_target_properties(FLAT PROPERTIES OUTPUT_NAME flat)\nset_target_properties(FLAT PROPERTIES OUTPUT_NAME_DEBUG flatd)\n\n# Set up the required libraries\ntarget_link_libraries(FLAT Qt5::Core Qt5::Widgets Qt5::Xml)"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "# FLAT - Facial Landmarks Annotation Tool\n\nA visual editor for manually annotating facial landmarks in images of human faces.\n\n![Screenshot](screenshot.png)\n\n## Usage\n\nCreate a new face annotation dataset (files with extension `.fad`) and add the face images. Then, add the facial features and connect then as desired using either the program menus or the context menu. The zoom level can be controlled either from the widget control on the image properties tool window or by holding CTRL and scrolling the mouse wheel. While zoomed, an image can also be side scrolled by holding SHIFT and scrolling the mouse wheel. All images in the same face annotation dataset share the same model, that is they have the same amount of face landmarks (even though they can be differently positioned for each image). Automatically fitting of 66 face landmarks can be performed via the \"Fit Landmarks\" option if the utility is available (see details bellow). If the automatic fitting succeeds, the 66 landmarks will be positioned as best as possible in the face image. Otherwise, a status bar message will indicate the error.\n\n## Dependences\n\nThe application has been developed and tested with:\n\n- [CMake](https://cmake.org/) 3.5.0-rc3\n- [Qt](http://www.qt.io/) 5.5.1 32-bit\n\nThe \"Fit Landmarks\" menu option (in \"Tools/CSIRO Face Analysis SDK\" menu) requires an external executable called `fit-fit(.exe)` - even though its absence does not prevent the FLAT tool from being compiled and used. Please check the [SDK web site](http://face.ci2cv.net/) and [the source code of my port to Windows/Linux](https://github.com/luigivieira/face-analysis-sdk). The option for an external dependence (instead of source code integration) is only to make the compilation of this project simpler and its usage broader.\n\n## Building\n\n1. Use CMake to configure and generate the environment. I suggest using the folder `build`, since it is the one ignored by gitignore.\n2. In Windows, open the Visual Studio solution and build with the desired build type (*debug*, *release*, etc).\n3. In Linux, use type `make` to let the Makefile produce the binary in the build type configured by CMake.\n4. The code produces only a single executable named `flat(.exe)`, that depends only on Qt. If you want to use the \"Fit Landmarks\" option mentioned before, go to the CSIRO Face Analysis SDK page, download and build its libraries and executables. Then, configure in FLAT the path for the `face-fit(.exe)` executable.\n\n## Credits\n\nCopyright (C) 2016 [Luiz Carlos Vieira](http://www.luiz.vieira.nom.br). Available under GPL (see details in the license file).\n\nThe application icons and images are either from or based on the Oxygen Icons Set, downloaded as [PNGs from Felipe Azevedo (pasnox)](https://github.com/pasnox/oxygen-icons-png) and [licensed under LGPL from KDE](https://techbase.kde.org/Projects/Oxygen/Licensing), and the [Farm-Fresh Web Icons Set](http://www.fatcow.com/free-icons), licensed under [Creative Commons (CC BY 4.0)](http://creativecommons.org/licenses/by/4.0/)."
  },
  {
    "path": "example/example.fad",
    "content": "<?xml version='1.0' encoding='UTF-8'?>\n<FaceDataset xmlns=\"https://github.com/luigivieira/Facial-Landmarks-Annotation-Tool\" numberOfFeatures=\"66\">\n    <Samples>\n        <Sample fileName=\"images/Angelina.jpg\">\n            <Features>\n                <Feature id=\"0\" y=\"277\" x=\"266\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"1\" y=\"327\" x=\"270\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"2\" y=\"376\" x=\"276\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                        <Target id=\"3\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"3\" y=\"425\" x=\"284\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"4\" y=\"472\" x=\"299\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"5\" y=\"512\" x=\"328\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                        <Target id=\"6\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"6\" y=\"541\" x=\"367\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"7\" y=\"561\" x=\"411\">\n                    <Connections>\n                        <Target id=\"6\"/>\n                        <Target id=\"8\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"8\" y=\"568\" x=\"460\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"9\" y=\"561\" x=\"506\">\n                    <Connections>\n                        <Target id=\"8\"/>\n                        <Target id=\"10\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"10\" y=\"538\" x=\"548\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"11\" y=\"507\" x=\"583\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"12\" y=\"467\" x=\"608\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"13\" y=\"421\" x=\"622\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"14\" y=\"374\" x=\"629\">\n                    <Connections>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"15\" y=\"327\" x=\"635\">\n                    <Connections>\n                        <Target id=\"14\"/>\n                        <Target id=\"16\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"16\" y=\"280\" x=\"637\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"17\" y=\"217\" x=\"304\">\n                    <Connections>\n                        <Target id=\"18\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"18\" y=\"199\" x=\"330\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"19\" y=\"193\" x=\"361\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"20\" y=\"196\" x=\"392\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"21\" y=\"206\" x=\"422\">\n                    <Connections>\n                        <Target id=\"20\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"22\" y=\"208\" x=\"503\">\n                    <Connections>\n                        <Target id=\"23\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"23\" y=\"199\" x=\"531\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"24\" y=\"196\" x=\"560\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"25\" y=\"202\" x=\"588\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"26\" y=\"219\" x=\"611\">\n                    <Connections>\n                        <Target id=\"25\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"27\" y=\"258\" x=\"464\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"28\" y=\"290\" x=\"465\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"29\" y=\"321\" x=\"466\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                        <Target id=\"30\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"30\" y=\"352\" x=\"466\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"31\" y=\"375\" x=\"434\">\n                    <Connections>\n                        <Target id=\"32\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"32\" y=\"379\" x=\"449\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"33\" y=\"381\" x=\"465\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"34\" y=\"379\" x=\"480\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"35\" y=\"375\" x=\"494\">\n                    <Connections>\n                        <Target id=\"34\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"36\" y=\"268.072\" x=\"330.688\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"37\" y=\"253.512\" x=\"352.736\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"38\" y=\"250.44\" x=\"384.952\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"39\" y=\"268.56\" x=\"411.12\">\n                    <Connections>\n                        <Target id=\"38\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"40\" y=\"275.096\" x=\"387.56\">\n                    <Connections>\n                        <Target id=\"39\"/>\n                        <Target id=\"41\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"41\" y=\"277.632\" x=\"355.296\">\n                    <Connections>\n                        <Target id=\"36\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"42\" y=\"268\" x=\"514\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"43\" y=\"255\" x=\"533.024\">\n                    <Connections>\n                        <Target id=\"42\"/>\n                        <Target id=\"44\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"44\" y=\"253.976\" x=\"561.144\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"45\" y=\"272.12\" x=\"585.776\">\n                    <Connections>\n                        <Target id=\"44\"/>\n                        <Target id=\"46\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"46\" y=\"281.168\" x=\"566.264\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"47\" y=\"280.168\" x=\"535.024\">\n                    <Connections>\n                        <Target id=\"46\"/>\n                        <Target id=\"42\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"48\" y=\"438\" x=\"389\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"49\" y=\"425\" x=\"413\">\n                    <Connections>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"50\" y=\"408.96\" x=\"438\">\n                    <Connections>\n                        <Target id=\"49\"/>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"51\" y=\"411.96\" x=\"464\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"52\" y=\"408.96\" x=\"489\">\n                    <Connections>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"53\" y=\"425\" x=\"513\">\n                    <Connections>\n                        <Target id=\"52\"/>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"54\" y=\"439\" x=\"533\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"55\" y=\"463.6\" x=\"513\">\n                    <Connections>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"56\" y=\"470.6\" x=\"489\">\n                    <Connections>\n                        <Target id=\"55\"/>\n                        <Target id=\"57\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"57\" y=\"472.6\" x=\"464\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"58\" y=\"470.6\" x=\"437\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"59\" y=\"462.6\" x=\"411\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"60\" y=\"434\" x=\"434\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                        <Target id=\"65\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"61\" y=\"436\" x=\"464\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"62\" y=\"435\" x=\"492\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"63\" y=\"438\" x=\"492\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                        <Target id=\"62\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"64\" y=\"438\" x=\"463.488\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"65\" y=\"437\" x=\"434\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                    </Connections>\n                </Feature>\n            </Features>\n        </Sample>\n        <Sample fileName=\"images/Chris.jpg\">\n            <Features>\n                <Feature id=\"0\" y=\"188\" x=\"81\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"1\" y=\"225.024\" x=\"78.416\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"2\" y=\"260.024\" x=\"81.416\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                        <Target id=\"3\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"3\" y=\"303.656\" x=\"84.928\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"4\" y=\"344.656\" x=\"91.928\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"5\" y=\"382.656\" x=\"106.928\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                        <Target id=\"6\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"6\" y=\"420.288\" x=\"128.928\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"7\" y=\"437.632\" x=\"159\">\n                    <Connections>\n                        <Target id=\"6\"/>\n                        <Target id=\"8\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"8\" y=\"451.632\" x=\"191\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"9\" y=\"443.216\" x=\"233.704\">\n                    <Connections>\n                        <Target id=\"8\"/>\n                        <Target id=\"10\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"10\" y=\"418.216\" x=\"263.704\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"11\" y=\"393.384\" x=\"288.192\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"12\" y=\"357.384\" x=\"308.192\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"13\" y=\"318.36\" x=\"321.68\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"14\" y=\"276.656\" x=\"328.584\">\n                    <Connections>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"15\" y=\"240\" x=\"333\">\n                    <Connections>\n                        <Target id=\"14\"/>\n                        <Target id=\"16\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"16\" y=\"209\" x=\"337\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"17\" y=\"190\" x=\"106\">\n                    <Connections>\n                        <Target id=\"18\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"18\" y=\"182\" x=\"125\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"19\" y=\"180\" x=\"146\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"20\" y=\"184\" x=\"169\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"21\" y=\"193\" x=\"191\">\n                    <Connections>\n                        <Target id=\"20\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"22\" y=\"200\" x=\"236\">\n                    <Connections>\n                        <Target id=\"23\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"23\" y=\"196\" x=\"256\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"24\" y=\"195\" x=\"277\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"25\" y=\"200\" x=\"296\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"26\" y=\"209\" x=\"311\">\n                    <Connections>\n                        <Target id=\"25\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"27\" y=\"224\" x=\"213\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"28\" y=\"252\" x=\"210\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"29\" y=\"279\" x=\"207\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                        <Target id=\"30\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"30\" y=\"305\" x=\"204\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"31\" y=\"305.362\" x=\"177.017\">\n                    <Connections>\n                        <Target id=\"32\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"32\" y=\"309.74\" x=\"190.655\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"33\" y=\"315.051\" x=\"204\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"34\" y=\"309.791\" x=\"222.243\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"35\" y=\"306.429\" x=\"234.571\">\n                    <Connections>\n                        <Target id=\"34\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"36\" y=\"218.949\" x=\"128.068\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"37\" y=\"210.051\" x=\"147.328\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"38\" y=\"211.068\" x=\"166.277\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"39\" y=\"228.537\" x=\"181.915\">\n                    <Connections>\n                        <Target id=\"38\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"40\" y=\"227.192\" x=\"161\">\n                    <Connections>\n                        <Target id=\"39\"/>\n                        <Target id=\"41\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"41\" y=\"225.537\" x=\"144.034\">\n                    <Connections>\n                        <Target id=\"36\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"42\" y=\"234.898\" x=\"240.723\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"43\" y=\"222.723\" x=\"254.723\">\n                    <Connections>\n                        <Target id=\"42\"/>\n                        <Target id=\"44\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"44\" y=\"224.379\" x=\"276.932\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"45\" y=\"236.277\" x=\"291.915\">\n                    <Connections>\n                        <Target id=\"44\"/>\n                        <Target id=\"46\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"46\" y=\"238.554\" x=\"272.655\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"47\" y=\"237.537\" x=\"257.345\">\n                    <Connections>\n                        <Target id=\"46\"/>\n                        <Target id=\"42\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"48\" y=\"338\" x=\"147\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"49\" y=\"321\" x=\"157\">\n                    <Connections>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"50\" y=\"320.192\" x=\"176.689\">\n                    <Connections>\n                        <Target id=\"49\"/>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"51\" y=\"325.175\" x=\"202\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"52\" y=\"324.192\" x=\"224.689\">\n                    <Connections>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"53\" y=\"328\" x=\"244\">\n                    <Connections>\n                        <Target id=\"52\"/>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"54\" y=\"348\" x=\"249\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"55\" y=\"366\" x=\"237\">\n                    <Connections>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"56\" y=\"380\" x=\"219\">\n                    <Connections>\n                        <Target id=\"55\"/>\n                        <Target id=\"57\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"57\" y=\"385\" x=\"196\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"58\" y=\"376\" x=\"174\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"59\" y=\"359\" x=\"158\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"60\" y=\"340.763\" x=\"170.379\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                        <Target id=\"65\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"61\" y=\"340.813\" x=\"199.034\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"62\" y=\"340.83\" x=\"227.345\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"63\" y=\"358\" x=\"226\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                        <Target id=\"62\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"64\" y=\"365\" x=\"199\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"65\" y=\"354\" x=\"172\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                    </Connections>\n                </Feature>\n            </Features>\n        </Sample>\n        <Sample fileName=\"images/Hayley.jpg\">\n            <Features>\n                <Feature id=\"0\" y=\"259.76\" x=\"226.36\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"1\" y=\"298.76\" x=\"227.36\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"2\" y=\"338.76\" x=\"232.36\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                        <Target id=\"3\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"3\" y=\"376.76\" x=\"240.36\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"4\" y=\"414.76\" x=\"254.36\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"5\" y=\"450.76\" x=\"277.36\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                        <Target id=\"6\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"6\" y=\"480.76\" x=\"308.36\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"7\" y=\"503.76\" x=\"346.36\">\n                    <Connections>\n                        <Target id=\"6\"/>\n                        <Target id=\"8\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"8\" y=\"516.52\" x=\"376.28\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"9\" y=\"514.52\" x=\"416.28\">\n                    <Connections>\n                        <Target id=\"8\"/>\n                        <Target id=\"10\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"10\" y=\"498.52\" x=\"454.28\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"11\" y=\"480\" x=\"485\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"12\" y=\"447\" x=\"508\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"13\" y=\"411.48\" x=\"526.32\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"14\" y=\"366.48\" x=\"533.32\">\n                    <Connections>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"15\" y=\"319.48\" x=\"534.48\">\n                    <Connections>\n                        <Target id=\"14\"/>\n                        <Target id=\"16\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"16\" y=\"269.64\" x=\"535.28\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"17\" y=\"225.16\" x=\"243.28\">\n                    <Connections>\n                        <Target id=\"18\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"18\" y=\"215.16\" x=\"259.28\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"19\" y=\"212.16\" x=\"277.28\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"20\" y=\"214.16\" x=\"296.28\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"21\" y=\"218.16\" x=\"314.28\">\n                    <Connections>\n                        <Target id=\"20\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"22\" y=\"210.32\" x=\"422\">\n                    <Connections>\n                        <Target id=\"23\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"23\" y=\"202.32\" x=\"444\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"24\" y=\"198.32\" x=\"468\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"25\" y=\"201.32\" x=\"491\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"26\" y=\"213.32\" x=\"511\">\n                    <Connections>\n                        <Target id=\"25\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"27\" y=\"257\" x=\"367\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"28\" y=\"284\" x=\"369\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"29\" y=\"311\" x=\"371\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                        <Target id=\"30\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"30\" y=\"338\" x=\"373\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"31\" y=\"361\" x=\"341\">\n                    <Connections>\n                        <Target id=\"32\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"32\" y=\"366\" x=\"356\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"33\" y=\"368\" x=\"371\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"34\" y=\"365\" x=\"388\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"35\" y=\"359\" x=\"404\">\n                    <Connections>\n                        <Target id=\"34\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"36\" y=\"254\" x=\"269\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"37\" y=\"240\" x=\"284\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"38\" y=\"241\" x=\"304\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"39\" y=\"254\" x=\"319\">\n                    <Connections>\n                        <Target id=\"38\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"40\" y=\"261\" x=\"303\">\n                    <Connections>\n                        <Target id=\"39\"/>\n                        <Target id=\"41\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"41\" y=\"262\" x=\"285\">\n                    <Connections>\n                        <Target id=\"36\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"42\" y=\"249\" x=\"427\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"43\" y=\"234\" x=\"442\">\n                    <Connections>\n                        <Target id=\"42\"/>\n                        <Target id=\"44\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"44\" y=\"233\" x=\"463\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"45\" y=\"244\" x=\"480\">\n                    <Connections>\n                        <Target id=\"44\"/>\n                        <Target id=\"46\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"46\" y=\"254\" x=\"464\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"47\" y=\"255\" x=\"445\">\n                    <Connections>\n                        <Target id=\"46\"/>\n                        <Target id=\"42\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"48\" y=\"420\" x=\"328\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"49\" y=\"409\" x=\"343\">\n                    <Connections>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"50\" y=\"401\" x=\"359\">\n                    <Connections>\n                        <Target id=\"49\"/>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"51\" y=\"402.72\" x=\"383.68\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"52\" y=\"396.8\" x=\"412.56\">\n                    <Connections>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"53\" y=\"402.8\" x=\"429.56\">\n                    <Connections>\n                        <Target id=\"52\"/>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"54\" y=\"411.8\" x=\"447.56\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"55\" y=\"425.8\" x=\"432.56\">\n                    <Connections>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"56\" y=\"439.56\" x=\"415.2\">\n                    <Connections>\n                        <Target id=\"55\"/>\n                        <Target id=\"57\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"57\" y=\"445.4\" x=\"386.6\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"58\" y=\"439\" x=\"358\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"59\" y=\"433\" x=\"341\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"60\" y=\"418\" x=\"360\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                        <Target id=\"65\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"61\" y=\"420.92\" x=\"386.24\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"62\" y=\"414.72\" x=\"418.88\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"63\" y=\"412.72\" x=\"417.88\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                        <Target id=\"62\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"64\" y=\"416.92\" x=\"385.24\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"65\" y=\"415\" x=\"360\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                    </Connections>\n                </Feature>\n            </Features>\n        </Sample>\n        <Sample fileName=\"images/Johnny.jpg\">\n            <Features>\n                <Feature id=\"0\" y=\"361\" x=\"136\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"1\" y=\"406\" x=\"142\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"2\" y=\"451\" x=\"151\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                        <Target id=\"3\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"3\" y=\"495\" x=\"162\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"4\" y=\"536\" x=\"179\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"5\" y=\"569\" x=\"206\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                        <Target id=\"6\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"6\" y=\"594\" x=\"241\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"7\" y=\"611\" x=\"279\">\n                    <Connections>\n                        <Target id=\"6\"/>\n                        <Target id=\"8\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"8\" y=\"614\" x=\"322\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"9\" y=\"604\" x=\"366\">\n                    <Connections>\n                        <Target id=\"8\"/>\n                        <Target id=\"10\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"10\" y=\"580\" x=\"404\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"11\" y=\"548\" x=\"435\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"12\" y=\"510\" x=\"458\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"13\" y=\"469\" x=\"471\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"14\" y=\"426\" x=\"477\">\n                    <Connections>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"15\" y=\"382\" x=\"478\">\n                    <Connections>\n                        <Target id=\"14\"/>\n                        <Target id=\"16\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"16\" y=\"339\" x=\"476\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"17\" y=\"311\" x=\"164\">\n                    <Connections>\n                        <Target id=\"18\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"18\" y=\"297\" x=\"185\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"19\" y=\"291\" x=\"211\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"20\" y=\"292\" x=\"237\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"21\" y=\"298\" x=\"262\">\n                    <Connections>\n                        <Target id=\"20\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"22\" y=\"295\" x=\"332\">\n                    <Connections>\n                        <Target id=\"23\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"23\" y=\"287\" x=\"355\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"24\" y=\"283\" x=\"380\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"25\" y=\"284\" x=\"405\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"26\" y=\"294\" x=\"428\">\n                    <Connections>\n                        <Target id=\"25\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"27\" y=\"329\" x=\"302\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"28\" y=\"359\" x=\"304\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"29\" y=\"388\" x=\"305\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                        <Target id=\"30\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"30\" y=\"418\" x=\"307\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"31\" y=\"434\" x=\"283\">\n                    <Connections>\n                        <Target id=\"32\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"32\" y=\"438\" x=\"296\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"33\" y=\"439\" x=\"310\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"34\" y=\"436\" x=\"323\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"35\" y=\"430\" x=\"336\">\n                    <Connections>\n                        <Target id=\"34\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"36\" y=\"337\" x=\"201\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"37\" y=\"327\" x=\"218\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"38\" y=\"326\" x=\"238\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"39\" y=\"336\" x=\"255\">\n                    <Connections>\n                        <Target id=\"38\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"40\" y=\"339\" x=\"237\">\n                    <Connections>\n                        <Target id=\"39\"/>\n                        <Target id=\"41\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"41\" y=\"341\" x=\"219\">\n                    <Connections>\n                        <Target id=\"36\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"42\" y=\"331\" x=\"345\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"43\" y=\"320\" x=\"360\">\n                    <Connections>\n                        <Target id=\"42\"/>\n                        <Target id=\"44\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"44\" y=\"318\" x=\"380\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"45\" y=\"326\" x=\"398\">\n                    <Connections>\n                        <Target id=\"44\"/>\n                        <Target id=\"46\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"46\" y=\"332\" x=\"381\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"47\" y=\"332\" x=\"363\">\n                    <Connections>\n                        <Target id=\"46\"/>\n                        <Target id=\"42\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"48\" y=\"508.92\" x=\"244.416\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"49\" y=\"494.6\" x=\"268.68\">\n                    <Connections>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"50\" y=\"483.184\" x=\"290.68\">\n                    <Connections>\n                        <Target id=\"49\"/>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"51\" y=\"485.256\" x=\"311.048\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"52\" y=\"478.648\" x=\"330.856\">\n                    <Connections>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"53\" y=\"482.48\" x=\"349.224\">\n                    <Connections>\n                        <Target id=\"52\"/>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"54\" y=\"491.192\" x=\"364.2\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"55\" y=\"501.44\" x=\"373.752\">\n                    <Connections>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"56\" y=\"519\" x=\"342\">\n                    <Connections>\n                        <Target id=\"55\"/>\n                        <Target id=\"57\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"57\" y=\"524\" x=\"315\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"58\" y=\"522\" x=\"288\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"59\" y=\"516.144\" x=\"265.512\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"60\" y=\"498.088\" x=\"280.952\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                        <Target id=\"65\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"61\" y=\"494.6\" x=\"313.56\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"62\" y=\"493.064\" x=\"338.976\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"63\" y=\"499.632\" x=\"345.072\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                        <Target id=\"62\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"64\" y=\"500\" x=\"314\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"65\" y=\"503.656\" x=\"281.928\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                    </Connections>\n                </Feature>\n            </Features>\n        </Sample>\n        <Sample fileName=\"images/Natalie.jpg\">\n            <Features>\n                <Feature id=\"0\" y=\"210\" x=\"186\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"1\" y=\"250\" x=\"185\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"2\" y=\"290\" x=\"187\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                        <Target id=\"3\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"3\" y=\"332\" x=\"191\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"4\" y=\"377\" x=\"205\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"5\" y=\"419\" x=\"229\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                        <Target id=\"6\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"6\" y=\"453\" x=\"261\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"7\" y=\"481\" x=\"300\">\n                    <Connections>\n                        <Target id=\"6\"/>\n                        <Target id=\"8\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"8\" y=\"494\" x=\"344\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"9\" y=\"488\" x=\"379\">\n                    <Connections>\n                        <Target id=\"8\"/>\n                        <Target id=\"10\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"10\" y=\"469\" x=\"412\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"11\" y=\"441\" x=\"440\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"12\" y=\"405\" x=\"461\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"13\" y=\"362\" x=\"471\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"14\" y=\"321\" x=\"481\">\n                    <Connections>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"15\" y=\"282\" x=\"492\">\n                    <Connections>\n                        <Target id=\"14\"/>\n                        <Target id=\"16\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"16\" y=\"242\" x=\"501\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"17\" y=\"208\" x=\"232\">\n                    <Connections>\n                        <Target id=\"18\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"18\" y=\"196\" x=\"256\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"19\" y=\"195\" x=\"283\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"20\" y=\"202\" x=\"310\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"21\" y=\"212\" x=\"335\">\n                    <Connections>\n                        <Target id=\"20\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"22\" y=\"218\" x=\"427\">\n                    <Connections>\n                        <Target id=\"23\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"23\" y=\"211\" x=\"450\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"24\" y=\"208\" x=\"474\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"25\" y=\"212\" x=\"497\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"26\" y=\"225\" x=\"513\">\n                    <Connections>\n                        <Target id=\"25\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"27\" y=\"252\" x=\"375\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"28\" y=\"284\" x=\"375\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"29\" y=\"316\" x=\"376\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                        <Target id=\"30\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"30\" y=\"347\" x=\"376\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"31\" y=\"354\" x=\"337\">\n                    <Connections>\n                        <Target id=\"32\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"32\" y=\"361\" x=\"350\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"33\" y=\"366\" x=\"365\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"34\" y=\"364\" x=\"379\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"35\" y=\"359\" x=\"392\">\n                    <Connections>\n                        <Target id=\"34\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"36\" y=\"241\" x=\"269\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"37\" y=\"232\" x=\"288\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"38\" y=\"235\" x=\"309\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"39\" y=\"248\" x=\"323\">\n                    <Connections>\n                        <Target id=\"38\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"40\" y=\"250\" x=\"305\">\n                    <Connections>\n                        <Target id=\"39\"/>\n                        <Target id=\"41\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"41\" y=\"249\" x=\"286\">\n                    <Connections>\n                        <Target id=\"36\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"42\" y=\"254\" x=\"418\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"43\" y=\"243\" x=\"436\">\n                    <Connections>\n                        <Target id=\"42\"/>\n                        <Target id=\"44\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"44\" y=\"244\" x=\"456\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"45\" y=\"255\" x=\"472\">\n                    <Connections>\n                        <Target id=\"44\"/>\n                        <Target id=\"46\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"46\" y=\"260\" x=\"454\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"47\" y=\"259\" x=\"435\">\n                    <Connections>\n                        <Target id=\"46\"/>\n                        <Target id=\"42\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"48\" y=\"386\" x=\"291\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"49\" y=\"383\" x=\"316\">\n                    <Connections>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"50\" y=\"383\" x=\"340\">\n                    <Connections>\n                        <Target id=\"49\"/>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"51\" y=\"391\" x=\"363\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"52\" y=\"387\" x=\"382\">\n                    <Connections>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"53\" y=\"390\" x=\"401\">\n                    <Connections>\n                        <Target id=\"52\"/>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"54\" y=\"396\" x=\"419\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"55\" y=\"410\" x=\"400\">\n                    <Connections>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"56\" y=\"418\" x=\"378\">\n                    <Connections>\n                        <Target id=\"55\"/>\n                        <Target id=\"57\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"57\" y=\"419\" x=\"356\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"58\" y=\"414\" x=\"332\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"59\" y=\"403\" x=\"309\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"60\" y=\"396\" x=\"333\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                        <Target id=\"65\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"61\" y=\"403\" x=\"360\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"62\" y=\"400\" x=\"382\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"63\" y=\"397\" x=\"382\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                        <Target id=\"62\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"64\" y=\"397\" x=\"359\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"65\" y=\"392\" x=\"331\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                    </Connections>\n                </Feature>\n            </Features>\n        </Sample>\n        <Sample fileName=\"images/Robert.jpg\">\n            <Features>\n                <Feature id=\"0\" y=\"280\" x=\"156\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"1\" y=\"315\" x=\"154\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"2\" y=\"349\" x=\"155\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                        <Target id=\"3\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"3\" y=\"384\" x=\"160\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"4\" y=\"420\" x=\"172\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"5\" y=\"452\" x=\"193\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                        <Target id=\"6\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"6\" y=\"480\" x=\"219\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"7\" y=\"501\" x=\"250\">\n                    <Connections>\n                        <Target id=\"6\"/>\n                        <Target id=\"8\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"8\" y=\"513\" x=\"286\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"9\" y=\"508\" x=\"317\">\n                    <Connections>\n                        <Target id=\"8\"/>\n                        <Target id=\"10\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"10\" y=\"492\" x=\"346\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"11\" y=\"469\" x=\"370\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"12\" y=\"439\" x=\"388\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"13\" y=\"405\" x=\"400\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"14\" y=\"371\" x=\"409\">\n                    <Connections>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"15\" y=\"336\" x=\"416\">\n                    <Connections>\n                        <Target id=\"14\"/>\n                        <Target id=\"16\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"16\" y=\"302\" x=\"420\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"17\" y=\"244\" x=\"210\">\n                    <Connections>\n                        <Target id=\"18\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"18\" y=\"236\" x=\"227\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"19\" y=\"234\" x=\"247\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"20\" y=\"237\" x=\"266\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"21\" y=\"244\" x=\"285\">\n                    <Connections>\n                        <Target id=\"20\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"22\" y=\"250\" x=\"343\">\n                    <Connections>\n                        <Target id=\"23\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"23\" y=\"246\" x=\"361\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"24\" y=\"245\" x=\"380\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"25\" y=\"250\" x=\"397\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"26\" y=\"261\" x=\"410\">\n                    <Connections>\n                        <Target id=\"25\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"27\" y=\"283\" x=\"312\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"28\" y=\"306\" x=\"313\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"29\" y=\"328\" x=\"313\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                        <Target id=\"30\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"30\" y=\"351\" x=\"314\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"31\" y=\"365\" x=\"286\">\n                    <Connections>\n                        <Target id=\"32\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"32\" y=\"369\" x=\"297\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"33\" y=\"371\" x=\"307\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"34\" y=\"370\" x=\"317\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"35\" y=\"368\" x=\"326\">\n                    <Connections>\n                        <Target id=\"34\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"36\" y=\"279\" x=\"230\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"37\" y=\"271\" x=\"244\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"38\" y=\"273\" x=\"259\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"39\" y=\"282\" x=\"271\">\n                    <Connections>\n                        <Target id=\"38\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"40\" y=\"286\" x=\"257\">\n                    <Connections>\n                        <Target id=\"39\"/>\n                        <Target id=\"41\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"41\" y=\"285\" x=\"243\">\n                    <Connections>\n                        <Target id=\"36\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"42\" y=\"288\" x=\"345\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"43\" y=\"281\" x=\"358\">\n                    <Connections>\n                        <Target id=\"42\"/>\n                        <Target id=\"44\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"44\" y=\"282\" x=\"373\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"45\" y=\"292\" x=\"385\">\n                    <Connections>\n                        <Target id=\"44\"/>\n                        <Target id=\"46\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"46\" y=\"296\" x=\"371\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"47\" y=\"294\" x=\"357\">\n                    <Connections>\n                        <Target id=\"46\"/>\n                        <Target id=\"42\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"48\" y=\"410\" x=\"252\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"49\" y=\"403\" x=\"269\">\n                    <Connections>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"50\" y=\"399\" x=\"287\">\n                    <Connections>\n                        <Target id=\"49\"/>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"51\" y=\"404\" x=\"305\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"52\" y=\"402\" x=\"320\">\n                    <Connections>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"53\" y=\"408\" x=\"334\">\n                    <Connections>\n                        <Target id=\"52\"/>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"54\" y=\"417\" x=\"345\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"55\" y=\"428\" x=\"333\">\n                    <Connections>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"56\" y=\"434\" x=\"317\">\n                    <Connections>\n                        <Target id=\"55\"/>\n                        <Target id=\"57\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"57\" y=\"436\" x=\"300\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"58\" y=\"431\" x=\"281\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"59\" y=\"423\" x=\"265\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"60\" y=\"411\" x=\"284\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                        <Target id=\"65\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"61\" y=\"415\" x=\"303\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"62\" y=\"414\" x=\"318\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"63\" y=\"417\" x=\"318\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                        <Target id=\"62\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"64\" y=\"418\" x=\"301\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"65\" y=\"414\" x=\"282\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                    </Connections>\n                </Feature>\n            </Features>\n        </Sample>\n        <Sample fileName=\"images/Scarlett.jpg\">\n            <Features>\n                <Feature id=\"0\" y=\"348\" x=\"206\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"1\" y=\"392\" x=\"217\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"2\" y=\"435\" x=\"232\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                        <Target id=\"3\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"3\" y=\"478\" x=\"249\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"4\" y=\"519\" x=\"270\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"5\" y=\"555\" x=\"299\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                        <Target id=\"6\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"6\" y=\"586\" x=\"333\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"7\" y=\"608\" x=\"373\">\n                    <Connections>\n                        <Target id=\"6\"/>\n                        <Target id=\"8\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"8\" y=\"610\" x=\"417\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"9\" y=\"594\" x=\"461\">\n                    <Connections>\n                        <Target id=\"8\"/>\n                        <Target id=\"10\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"10\" y=\"562\" x=\"497\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"11\" y=\"524\" x=\"527\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"12\" y=\"481\" x=\"549\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"13\" y=\"434\" x=\"561\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"14\" y=\"386\" x=\"565\">\n                    <Connections>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"15\" y=\"339\" x=\"566\">\n                    <Connections>\n                        <Target id=\"14\"/>\n                        <Target id=\"16\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"16\" y=\"291\" x=\"564\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"17\" y=\"282\" x=\"214\">\n                    <Connections>\n                        <Target id=\"18\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"18\" y=\"265\" x=\"232\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"19\" y=\"257\" x=\"256\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"20\" y=\"256\" x=\"282\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"21\" y=\"261\" x=\"308\">\n                    <Connections>\n                        <Target id=\"20\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"22\" y=\"245\" x=\"401\">\n                    <Connections>\n                        <Target id=\"23\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"23\" y=\"232\" x=\"427\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"24\" y=\"224\" x=\"456\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"25\" y=\"225\" x=\"486\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"26\" y=\"237\" x=\"512\">\n                    <Connections>\n                        <Target id=\"25\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"27\" y=\"302\" x=\"360\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"28\" y=\"335\" x=\"364\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"29\" y=\"367\" x=\"367\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                        <Target id=\"30\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"30\" y=\"399\" x=\"371\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"31\" y=\"420\" x=\"346\">\n                    <Connections>\n                        <Target id=\"32\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"32\" y=\"424\" x=\"362\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"33\" y=\"425\" x=\"378\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"34\" y=\"419\" x=\"395\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"35\" y=\"410\" x=\"410\">\n                    <Connections>\n                        <Target id=\"34\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"36\" y=\"322\" x=\"253\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"37\" y=\"309\" x=\"270\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"38\" y=\"306\" x=\"293\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"39\" y=\"313\" x=\"313\">\n                    <Connections>\n                        <Target id=\"38\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"40\" y=\"320\" x=\"293\">\n                    <Connections>\n                        <Target id=\"39\"/>\n                        <Target id=\"41\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"41\" y=\"324\" x=\"273\">\n                    <Connections>\n                        <Target id=\"36\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"42\" y=\"295\" x=\"421\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"43\" y=\"281\" x=\"438\">\n                    <Connections>\n                        <Target id=\"42\"/>\n                        <Target id=\"44\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"44\" y=\"278\" x=\"461\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"45\" y=\"285\" x=\"482\">\n                    <Connections>\n                        <Target id=\"44\"/>\n                        <Target id=\"46\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"46\" y=\"293\" x=\"463\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"47\" y=\"296\" x=\"442\">\n                    <Connections>\n                        <Target id=\"46\"/>\n                        <Target id=\"42\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"48\" y=\"477\" x=\"319\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"49\" y=\"463\" x=\"336\">\n                    <Connections>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"50\" y=\"454\" x=\"360\">\n                    <Connections>\n                        <Target id=\"49\"/>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"51\" y=\"454\" x=\"384\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"52\" y=\"446\" x=\"411\">\n                    <Connections>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"53\" y=\"446\" x=\"439\">\n                    <Connections>\n                        <Target id=\"52\"/>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"54\" y=\"453\" x=\"465\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"55\" y=\"483\" x=\"451\">\n                    <Connections>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"56\" y=\"506\" x=\"428\">\n                    <Connections>\n                        <Target id=\"55\"/>\n                        <Target id=\"57\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"57\" y=\"517\" x=\"397\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"58\" y=\"516\" x=\"366\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"59\" y=\"501\" x=\"338\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"60\" y=\"470\" x=\"356\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                        <Target id=\"65\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"61\" y=\"467\" x=\"387\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"62\" y=\"459\" x=\"421\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"63\" y=\"480\" x=\"427\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                        <Target id=\"62\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"64\" y=\"493\" x=\"392\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"65\" y=\"491\" x=\"358\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                    </Connections>\n                </Feature>\n            </Features>\n        </Sample>\n        <Sample fileName=\"images/Tom.jpg\">\n            <Features>\n                <Feature id=\"0\" y=\"271\" x=\"174\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"1\" y=\"308\" x=\"174\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"2\" y=\"345\" x=\"176\">\n                    <Connections>\n                        <Target id=\"1\"/>\n                        <Target id=\"3\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"3\" y=\"383\" x=\"179\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"4\" y=\"423\" x=\"186\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"5\" y=\"461\" x=\"201\">\n                    <Connections>\n                        <Target id=\"4\"/>\n                        <Target id=\"6\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"6\" y=\"494\" x=\"224\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"7\" y=\"519\" x=\"252\">\n                    <Connections>\n                        <Target id=\"6\"/>\n                        <Target id=\"8\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"8\" y=\"532\" x=\"287\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"9\" y=\"526\" x=\"325\">\n                    <Connections>\n                        <Target id=\"8\"/>\n                        <Target id=\"10\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"10\" y=\"506\" x=\"360\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"11\" y=\"478\" x=\"390\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"12\" y=\"444\" x=\"414\">\n                    <Connections>\n                        <Target id=\"11\"/>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"13\" y=\"405\" x=\"429\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"14\" y=\"368\" x=\"438\">\n                    <Connections>\n                        <Target id=\"13\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"15\" y=\"331\" x=\"444\">\n                    <Connections>\n                        <Target id=\"14\"/>\n                        <Target id=\"16\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"16\" y=\"293\" x=\"449\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"17\" y=\"261\" x=\"191\">\n                    <Connections>\n                        <Target id=\"18\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"18\" y=\"252\" x=\"209\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"19\" y=\"251\" x=\"229\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"20\" y=\"256\" x=\"250\">\n                    <Connections>\n                        <Target id=\"19\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"21\" y=\"264\" x=\"269\">\n                    <Connections>\n                        <Target id=\"20\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"22\" y=\"269\" x=\"328\">\n                    <Connections>\n                        <Target id=\"23\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"23\" y=\"263\" x=\"351\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"24\" y=\"262\" x=\"374\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"25\" y=\"266\" x=\"396\">\n                    <Connections>\n                        <Target id=\"24\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"26\" y=\"278\" x=\"415\">\n                    <Connections>\n                        <Target id=\"25\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"27\" y=\"293\" x=\"298\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"28\" y=\"320\" x=\"296\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"29\" y=\"346\" x=\"293\">\n                    <Connections>\n                        <Target id=\"28\"/>\n                        <Target id=\"30\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"30\" y=\"372\" x=\"291\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"31\" y=\"380\" x=\"269\">\n                    <Connections>\n                        <Target id=\"32\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"32\" y=\"387\" x=\"280\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"33\" y=\"390\" x=\"292\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"34\" y=\"388\" x=\"305\">\n                    <Connections>\n                        <Target id=\"33\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"35\" y=\"383\" x=\"318\">\n                    <Connections>\n                        <Target id=\"34\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"36\" y=\"286\" x=\"220\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"37\" y=\"280\" x=\"234\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"38\" y=\"282\" x=\"249\">\n                    <Connections>\n                        <Target id=\"37\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"39\" y=\"290\" x=\"262\">\n                    <Connections>\n                        <Target id=\"38\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"40\" y=\"291\" x=\"248\">\n                    <Connections>\n                        <Target id=\"39\"/>\n                        <Target id=\"41\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"41\" y=\"290\" x=\"233\">\n                    <Connections>\n                        <Target id=\"36\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"42\" y=\"295\" x=\"340\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"43\" y=\"289\" x=\"354\">\n                    <Connections>\n                        <Target id=\"42\"/>\n                        <Target id=\"44\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"44\" y=\"290\" x=\"369\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"45\" y=\"298\" x=\"383\">\n                    <Connections>\n                        <Target id=\"44\"/>\n                        <Target id=\"46\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"46\" y=\"299\" x=\"369\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"47\" y=\"298\" x=\"354\">\n                    <Connections>\n                        <Target id=\"46\"/>\n                        <Target id=\"42\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"48\" y=\"418\" x=\"238\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"49\" y=\"409\" x=\"253\">\n                    <Connections>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"50\" y=\"407\" x=\"272\">\n                    <Connections>\n                        <Target id=\"49\"/>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"51\" y=\"411\" x=\"292\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"52\" y=\"409\" x=\"314\">\n                    <Connections>\n                        <Target id=\"51\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"53\" y=\"415\" x=\"335\">\n                    <Connections>\n                        <Target id=\"52\"/>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"54\" y=\"425\" x=\"351\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"55\" y=\"442\" x=\"336\">\n                    <Connections>\n                        <Target id=\"54\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"56\" y=\"454\" x=\"315\">\n                    <Connections>\n                        <Target id=\"55\"/>\n                        <Target id=\"57\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"57\" y=\"457\" x=\"291\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"58\" y=\"451\" x=\"268\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"59\" y=\"437\" x=\"250\">\n                    <Connections>\n                        <Target id=\"58\"/>\n                        <Target id=\"48\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"60\" y=\"417\" x=\"268\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                        <Target id=\"65\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"61\" y=\"421\" x=\"292\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"62\" y=\"421\" x=\"318\">\n                    <Connections>\n                        <Target id=\"61\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"63\" y=\"435\" x=\"319\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                        <Target id=\"62\"/>\n                    </Connections>\n                </Feature>\n                <Feature id=\"64\" y=\"439\" x=\"291\">\n                    <Connections/>\n                </Feature>\n                <Feature id=\"65\" y=\"432\" x=\"267\">\n                    <Connections>\n                        <Target id=\"64\"/>\n                    </Connections>\n                </Feature>\n            </Features>\n        </Sample>\n    </Samples>\n</FaceDataset>\n"
  },
  {
    "path": "src/aboutwindow.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"aboutwindow.h\"\n#include \"ui_aboutwindow.h\"\n#include \"version.h\"\n\n#include <QScrollArea>\n#include <QLabel>\n\n// +-----------------------------------------------------------\nft::AboutWindow::AboutWindow(QWidget *pParent) :\n\tQDialog(pParent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint),\n\tui(new Ui::AboutWindow)\n{\n    ui->setupUi(this);\n\tui->label->setText(ui->label->text().arg(FLAT_VERSION));\n\tui->label->setOpenExternalLinks(true);\n\tsetFixedSize(425, 268);\n}\n\n// +-----------------------------------------------------------\nft::AboutWindow::~AboutWindow()\n{\n    delete ui;\n}\n"
  },
  {
    "path": "src/aboutwindow.h",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef ABOUTWINDOW_H\n#define ABOUTWINDOW_H\n\n#include <QDialog>\n\nnamespace Ui\n{\n    class AboutWindow;\n}\n\nnamespace ft\n{\n    /**\n     * Form class used to display the about dialog box.\n     */\n    class AboutWindow : public QDialog\n    {\n        Q_OBJECT\n\n    public:\n        /**\n         * Class constructor.\n         * @param pParent QWidget with the window parent.\n         */\n        explicit AboutWindow(QWidget *pParent = 0);\n\n        /**\n         * Class destructor\n         */\n        virtual ~AboutWindow();\n\n    private:\n        /** Instance of the ui for GUI element access. */\n        Ui::AboutWindow *ui;\n    };\n}\n\n#endif // ABOUTWINDOW_H"
  },
  {
    "path": "src/aboutwindow.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>AboutWindow</class>\n <widget class=\"QDialog\" name=\"AboutWindow\">\n  <property name=\"windowModality\">\n   <enum>Qt::ApplicationModal</enum>\n  </property>\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>425</width>\n    <height>268</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>About...</string>\n  </property>\n  <property name=\"locale\">\n   <locale language=\"English\" country=\"UnitedKingdom\"/>\n  </property>\n  <property name=\"modal\">\n   <bool>true</bool>\n  </property>\n  <layout class=\"QGridLayout\" name=\"gridLayout_2\">\n   <property name=\"leftMargin\">\n    <number>5</number>\n   </property>\n   <property name=\"topMargin\">\n    <number>5</number>\n   </property>\n   <property name=\"rightMargin\">\n    <number>5</number>\n   </property>\n   <property name=\"bottomMargin\">\n    <number>5</number>\n   </property>\n   <property name=\"spacing\">\n    <number>5</number>\n   </property>\n   <item row=\"0\" column=\"0\">\n    <layout class=\"QVBoxLayout\" name=\"vLayout\">\n     <property name=\"spacing\">\n      <number>10</number>\n     </property>\n     <item>\n      <widget class=\"QScrollArea\" name=\"scrollArea\">\n       <property name=\"widgetResizable\">\n        <bool>true</bool>\n       </property>\n       <widget class=\"QWidget\" name=\"scrollAreaWidgetContents\">\n        <property name=\"geometry\">\n         <rect>\n          <x>0</x>\n          <y>0</y>\n          <width>394</width>\n          <height>331</height>\n         </rect>\n        </property>\n        <layout class=\"QGridLayout\" name=\"gridLayout\">\n         <property name=\"leftMargin\">\n          <number>0</number>\n         </property>\n         <property name=\"topMargin\">\n          <number>0</number>\n         </property>\n         <property name=\"rightMargin\">\n          <number>0</number>\n         </property>\n         <property name=\"bottomMargin\">\n          <number>0</number>\n         </property>\n         <property name=\"spacing\">\n          <number>0</number>\n         </property>\n         <item row=\"0\" column=\"0\">\n          <widget class=\"QLabel\" name=\"label\">\n           <property name=\"text\">\n            <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;FLAT - Facial Landmarks Annotation Tool (version %1)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Copyright (C) 2016 &lt;a href=&quot;http://www.luiz.vieira.nom.br/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Luiz Carlos Vieira&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;This is a visual editor to help annotating face images with facial landmarks required for the implementation of deformable fit algorithms or avatar transposition. The source code is available &lt;a href=&quot;https://github.com/luigivieira/Facial-Landmarks-Annotation-Tool&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;at Github&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;The application icons and images are either from or based on the Oxygen Icons Set, downloaded as &lt;a href=&quot;https://github.com/pasnox/oxygen-icons-png&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;PNGs from Felipe Azevedo (pasnox)&lt;/span&gt;&lt;/a&gt; and &lt;a href=&quot;https://techbase.kde.org/Projects/Oxygen/Licensing&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;licensed under LGPL from KDE&lt;/span&gt;&lt;/a&gt;, and the &lt;a href=&quot;http://www.fatcow.com/free-icons&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Farm-Fresh Web Icons Set&lt;/span&gt;&lt;/a&gt;, licensed under &lt;a href=&quot;http://creativecommons.org/licenses/by/4.0/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Creative Commons (CC BY 4.0)&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;LICENSE&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;You should have received a copy of the GNU General Public License along with this program. If not, see &lt;a href=&quot;http://www.gnu.org/licenses/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://www.gnu.org/licenses/&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>\n           </property>\n           <property name=\"alignment\">\n            <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>\n           </property>\n           <property name=\"wordWrap\">\n            <bool>true</bool>\n           </property>\n           <property name=\"openExternalLinks\">\n            <bool>true</bool>\n           </property>\n          </widget>\n         </item>\n        </layout>\n       </widget>\n      </widget>\n     </item>\n     <item>\n      <layout class=\"QHBoxLayout\" name=\"hLayout\">\n       <property name=\"spacing\">\n        <number>0</number>\n       </property>\n       <item>\n        <spacer name=\"horizontalSpacer\">\n         <property name=\"orientation\">\n          <enum>Qt::Horizontal</enum>\n         </property>\n         <property name=\"sizeHint\" stdset=\"0\">\n          <size>\n           <width>40</width>\n           <height>20</height>\n          </size>\n         </property>\n        </spacer>\n       </item>\n       <item>\n        <widget class=\"QPushButton\" name=\"closeButton\">\n         <property name=\"maximumSize\">\n          <size>\n           <width>80</width>\n           <height>16777215</height>\n          </size>\n         </property>\n         <property name=\"text\">\n          <string>&amp;Close</string>\n         </property>\n         <property name=\"default\">\n          <bool>true</bool>\n         </property>\n        </widget>\n       </item>\n      </layout>\n     </item>\n    </layout>\n   </item>\n  </layout>\n </widget>\n <resources/>\n <connections>\n  <connection>\n   <sender>closeButton</sender>\n   <signal>clicked()</signal>\n   <receiver>AboutWindow</receiver>\n   <slot>accept()</slot>\n   <hints>\n    <hint type=\"sourcelabel\">\n     <x>380</x>\n     <y>249</y>\n    </hint>\n    <hint type=\"destinationlabel\">\n     <x>212</x>\n     <y>133</y>\n    </hint>\n   </hints>\n  </connection>\n </connections>\n</ui>\n"
  },
  {
    "path": "src/application.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"application.h\"\n#include <typeinfo>\n#include <QtGlobal>\n#include <QDateTime>\n#include <QFileInfo>\n#include <QDebug>\n#include <QMessageBox>\n#include <QSettings>\n#include <QDir>\n#include <QStandardPaths>\n#include <QFileInfo>\n\n#include <iostream>\n#include <stdexcept>\n\nusing namespace std;\n\n// +-----------------------------------------------------------\nft::FtApplication::FtApplication(int argc, char* argv[]): QApplication(argc, argv)\n{\n    m_pMainWindow = NULL;\n\n\t// Information used to store the program settings\n    QCoreApplication::setOrganizationName(\"Flat\");\n    QCoreApplication::setOrganizationDomain(\"https://github.com/luigivieira/Facial-Landmarks-Annotation-Tool.git\");\n    QCoreApplication::setApplicationName(\"Data\");\n\n\tQString sAppFile = QCoreApplication::applicationFilePath();\n\tQString sDocPath = QDir::toNativeSeparators(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)) + QDir::separator();\n\tQFileInfo oFile = QFileInfo(sAppFile);\n\tQString sLogFile = QString(\"%1%2.log\").arg(sDocPath).arg(oFile.baseName());\n\n\tm_oLogFile.open(qPrintable(sLogFile), ios::app);\n\tif (!m_oLogFile.is_open())\n\t{\n\t\tcerr << QString(\"Could not open the file [%1] for writing. No log will be created.\").arg(sLogFile).toStdString();\n\t\texit(-1);\n\t}\n\t\n\tqInstallMessageHandler(&ft::FtApplication::handleLogOutput);\n\t\n\tqDebug() << QCoreApplication::applicationFilePath().toStdString().c_str() << \"started.\";\n}\n\n// +-----------------------------------------------------------\nft::FtApplication::~FtApplication()\n{\n\tqDebug() << QCoreApplication::applicationFilePath().toStdString().c_str() << \"ended.\";\n\n\tif (m_oLogFile.is_open())\n\t{\n\t\tm_oLogFile.flush();\n\t\tm_oLogFile.close();\n\t}\n}\n\n// +-----------------------------------------------------------\nbool ft::FtApplication::notify(QObject* pReceiver, QEvent* pEvent)\n{\n    try\n\t{\n\t\t// Retransmit the event notification\n        return QApplication::notify(pReceiver, pEvent);\n    }\n    catch (std::exception &e)\n\t{\n        qFatal(\"Exception %s sending event [%s] to object [%s] (%s)\",\n            e.what(), typeid(*pEvent).name(), qPrintable(pReceiver->objectName()), typeid(*pReceiver).name());\n    }\n    catch (...)\n\t{\n        qFatal(\"Exception sending event [%s] to object [%s] (%s)\",\n            typeid(*pEvent).name(), qPrintable(pReceiver->objectName()), typeid(*pReceiver).name());\n    }\n\n    return false;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FtApplication::handleLogOutput(QtMsgType eType, const QMessageLogContext &oContext, const QString &sMsg) {\n\tQString sNow = QDateTime::currentDateTime().toString(\"yyyy-MM-dd hh:mm:ss.zzz\");\n\n\t// Only include context information if it exists (when compiled in debug)\n\tQString sDebugInfo;\n\tif(oContext.line != 0)\n\t{\n\t\tQString sSource = QFileInfo(QFile(oContext.file).fileName()).fileName();\n\t\tsDebugInfo = QString(\" [%1:%2, %3] \").arg(sSource).arg(oContext.line).arg(oContext.function);\n\t}\n\telse\n\t\tsDebugInfo = \" \";\n\n\tswitch (eType)\n\t{\n\t\tcase QtDebugMsg:\n\t\t\tFtApplication::instance()->m_oLogFile << qPrintable(sNow) << qPrintable(sDebugInfo) << \"DEBUG: \" << qPrintable(sMsg) << endl;\n\t\t\tFtApplication::instance()->m_oLogFile.flush();\n\t\t\tbreak;\n\n\t\tcase QtWarningMsg:\n\t\t\tFtApplication::instance()->m_oLogFile << qPrintable(sNow) << qPrintable(sDebugInfo) << \"WARNING: \" << qPrintable(sMsg) << endl;\n\t\t\tFtApplication::instance()->m_oLogFile.flush();\n\t\t\tbreak;\n\n\t\tcase QtCriticalMsg:\n\t\t\tFtApplication::instance()->m_oLogFile << qPrintable(sNow) << qPrintable(sDebugInfo) << \"CRITICAL: \" << qPrintable(sMsg) << endl;\n\t\t\tFtApplication::instance()->m_oLogFile.flush();\n\t\t\tbreak;\n\n\t\tcase QtFatalMsg:\n\t\t\tQApplication::beep();\n\t\t\tQMessageBox::critical(NULL, qApp->translate(\"Main\", \"Runtime Error\"), qApp->translate(\"Main\", \"A severe exception happened and the application must terminate.\"), QMessageBox::Ok);\n\n\t\t\tcerr << qPrintable(sNow) << qPrintable(sDebugInfo) << \"FATAL: \" << qPrintable(sMsg) << endl;\n\t\t\tFtApplication::instance()->m_oLogFile << qPrintable(sNow) << qPrintable(sDebugInfo) << \"FATAL:\" << qPrintable(sMsg) << endl;\n\t\t\texit(-2);\n\t}\n}\n\n// +-----------------------------------------------------------\nft::FtApplication* ft::FtApplication::instance()\n{\n\treturn (FtApplication *) qApp;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FtApplication::showStatusMessage(const QString &sMsg, const int iTimeout)\n{\n\tFtApplication::instance()->emit statusMessageShown(sMsg, iTimeout);\n}"
  },
  {
    "path": "src/application.h",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef APPLICATION_H\n#define APPLICATION_H\n\n#include <QApplication>\n#include <QMainWindow>\n#include <QObject>\n\n#include <fstream>\n\nnamespace ft\n{\n\t/**\n\t * Custom application class, used to intercept message notifications in the project applications.\n\t */\n\tclass FtApplication: public QApplication\n\t{\n\t\tQ_OBJECT\n\tpublic:\n\t\t/**\n\t\t* Class constructor.\n\t\t* @param argc Number of arguments received from the command line.\n\t\t* @param argv Array of char pointers with the arguments received from the command line.\n\t\t*/\n\t\tFtApplication(int argc, char* argv[]);\n\n\t\t/**\n\t\t* Class destructor.\n\t\t*/\n\t\tvirtual ~FtApplication();\n\n\t\t/**\n\t\t * Displays a text message in the main window status bar.\n\t\t * @param sMsg QString with the message to be displayed.\n\t\t * @param iTimeout Integer with the number of miliseconds\n\t\t * by which the message will be displayed. The default is 5000\n\t\t * (i.e. 5 seconds).\n\t\t */\n\t\tstatic void showStatusMessage(const QString &sMsg, const int iTimeout = 5000);\n\n\t\t/**\n\t\t * Handles the notification of messages in the application event loop.\n\t\t * @param pReceiver Pointer to the QObject that shall receive the message.\n\t\t * @param pEvent Pointer to the QEvent with the message information.\n\t\t */\n        bool notify(QObject* pReceiver, QEvent* pEvent);\n\n\t\t/**\n\t\t * Gets the default instance for this application (from the qApp variable simply type-casted).\n\t\t * @return Pointer to the default instance of the FtApplication.\n\t\t */\n\t\tstatic FtApplication* instance();\n\n\tsignals:\n\t\t/**\n\t\t * Signal indicating that a status message was requested to be displayed on the\n\t\t * application main window.\n\t\t * @param sMsg QString with the message to be displayed.\n\t\t * @param iTimeout Integer with the number of miliseconds\n\t\t * by which the message will be displayed.\n\t\t */\n\t\tvoid statusMessageShown(const QString &sMsg, const int iTimeout);\n\n\tprotected:\n\t\t/**\n\t\t * Log and exception message handler for application events.\n \t\t * @param eType QtMsgType enum value with the type of the log event.\n\t\t * @param oContext QMessageLogContext instance with information on where the event happened (function, line, etc)\n\t\t * @param sMsg QString instance with the event message.\n\t\t */\n\t\tstatic void handleLogOutput(QtMsgType eType, const QMessageLogContext& oContext, const QString& sMsg);\n\n\tprivate:\n\t\t/** File stream used to log application messages. */\n\t\tstd::ofstream m_oLogFile;\n\t\t\n\t\t/** Instance of the main window used with this application. */\n\t\tQMainWindow *m_pMainWindow;\n\t};\n}\n\n#endif // APPLICATION_H\n"
  },
  {
    "path": "src/childwindow.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"childwindow.h\"\n#include \"mainwindow.h\"\n#include \"application.h\"\n\n#include <QMessageBox>\n#include <QGridLayout>\n#include <QApplication>\n#include <QtMath>\n#include <QDebug>\n\n#include <vector>\n\nusing namespace std;\n\n// +-----------------------------------------------------------\nft::ChildWindow::ChildWindow(QWidget *pParent) :\n    QWidget(pParent)\n{\n\tsetAutoFillBackground(true);\n\tsetBackgroundRole(QPalette::Dark);\n\tsetAttribute(Qt::WA_DeleteOnClose);\n\n\tQGridLayout *pLayout = new QGridLayout(this);\n\tpLayout->setMargin(0);\n\tsetLayout(pLayout);\n\n\tm_pFaceWidget = new FaceWidget(this);\n\tpLayout->addWidget(m_pFaceWidget);\n\n\tm_pFaceWidget->setPixmap(QPixmap(\":/images/noface\"));\n\n\tm_pFaceDatasetModel = new FaceDatasetModel();\n\tm_pFaceSelectionModel = new QItemSelectionModel(m_pFaceDatasetModel);\n\n\t// Capture of relevant signals\n\tconnect(m_pFaceWidget, SIGNAL(onScaleFactorChanged(const double)), this, SLOT(onScaleFactorChanged(const double)));\n\tconnect(m_pFaceWidget, SIGNAL(onFaceFeaturesSelectionChanged()), this, SLOT(onFaceFeaturesSelectionChanged()));\n\tconnect(m_pFaceWidget, SIGNAL(onFaceFeaturesChanged()), this, SLOT(onDataChanged()));\n\tconnect(m_pFaceDatasetModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&, const QVector<int>&)), this, SLOT(onDataChanged()));\n\tconnect(m_pFaceSelectionModel, SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(onCurrentChanged(const QModelIndex &, const QModelIndex &)));\n\n\t// Indicate that it is a brand new dataset (i.e. not yet saved to a file)\n\tsetProperty(\"new\", true);\n\tm_iCurrentImage = -1;\n}\n\n// +-----------------------------------------------------------\nft::ChildWindow::~ChildWindow()\n{\n\tdelete m_pFaceSelectionModel;\n\tdelete m_pFaceDatasetModel;\n}\n\n// +-----------------------------------------------------------\nft::FaceDatasetModel* ft::ChildWindow::dataModel() const\n{\n\treturn m_pFaceDatasetModel;\n}\n\n// +-----------------------------------------------------------\nQItemSelectionModel* ft::ChildWindow::selectionModel() const\n{\n\treturn m_pFaceSelectionModel;\n}\n\n// +-----------------------------------------------------------\nbool ft::ChildWindow::save(QString &sMsgError)\n{\n\tif(!m_pFaceDatasetModel->saveToFile(windowFilePath(), sMsgError))\n\t\treturn false;\n\n\tonDataChanged(false);\n\tsetProperty(\"new\", QVariant()); // No longer a new dataset\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nbool ft::ChildWindow::saveToFile(const QString &sFileName, QString &sMsgError)\n{\n\tif(!m_pFaceDatasetModel->saveToFile(sFileName, sMsgError))\n\t\treturn false;\n\n\tsetWindowFilePath(sFileName);\n\tonDataChanged(false);\n\tsetProperty(\"new\", QVariant()); // No longer a new dataset\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nbool ft::ChildWindow::loadFromFile(const QString &sFileName, QString &sMsgError)\n{\n\tif(!m_pFaceDatasetModel->loadFromFile(qPrintable(sFileName), sMsgError))\n\t\treturn false;\n\n\tsetWindowFilePath(sFileName);\n\tonDataChanged(false);\n\tsetProperty(\"new\", QVariant()); // No longer a new dataset\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::setZoomLevel(const int iLevel)\n{\n\tint iSteps = iLevel - 11; // Because 11 is the middle slider value, equivalent to the scale of 1.0 (100%)\n\tdouble dBase = iSteps < 0 ? FaceWidget::ZOOM_OUT_STEP : FaceWidget::ZOOM_IN_STEP;\n\t\n\tdouble dFactor = 1.0 * qPow(dBase, abs(iSteps));\n\tm_pFaceWidget->setScaleFactor(dFactor);\n}\n\n// +-----------------------------------------------------------\nint ft::ChildWindow::getZoomLevel() const\n{\n\tdouble dFactor = m_pFaceWidget->getScaleFactor();\n\tdouble dBase = dFactor < 1.0 ? FaceWidget::ZOOM_OUT_STEP : FaceWidget::ZOOM_IN_STEP;\n\n\tint iSteps = qCeil(qLn(abs(dFactor)) / qLn(dBase));\n\tif(dFactor > 1.0)\n\t\treturn iSteps + 11;\n\telse\n\t\treturn 11 - iSteps;\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::zoomIn()\n{\n\tm_pFaceWidget->zoomIn();\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::zoomOut()\n{\n\tm_pFaceWidget->zoomOut();\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::onScaleFactorChanged(const double dScaleFactor)\n{\n\tQ_UNUSED(dScaleFactor);\n\n\tQModelIndex oCurrent = m_pFaceSelectionModel->currentIndex();\n\tQString sImageName = m_pFaceDatasetModel->data(m_pFaceDatasetModel->index(oCurrent.row(), 0), Qt::UserRole).toString();\n\temit onUIUpdated(sImageName, getZoomLevel());\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::onDataChanged(const bool bModified)\n{\n\tif(bModified)\n\t\tupdateFeaturesInDataset();\n\tsetWindowModified(bModified);\n\temit onDataModified();\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::onCurrentChanged(const QModelIndex &oCurrent, const QModelIndex &oPrevious)\n{\n\tQ_UNUSED(oPrevious);\n\n\tif(!oCurrent.isValid())\n\t{\n\t\tm_iCurrentImage = -1;\n\t\tm_pFaceWidget->setPixmap(QPixmap(\":/images/noface\"));\n\t\temit onUIUpdated(\"\", 0);\n\t}\n\telse\n\t{\n\t\tm_iCurrentImage = oCurrent.row();\n\t\tQVariant oData = m_pFaceDatasetModel->data(m_pFaceDatasetModel->index(m_iCurrentImage, 2), Qt::UserRole);\n\t\tif(oData.isValid())\n\t\t\tm_pFaceWidget->setPixmap(oData.value<QPixmap>());\n\t\telse\n\t\t\tm_pFaceWidget->setPixmap(QPixmap(\":/images/brokenimage\"));\n\n\t\tQString sImageName = oCurrent.data(Qt::UserRole).toString();\n\t\temit onUIUpdated(sImageName, getZoomLevel());\n\n\t\trefreshFeaturesInWidget();\n\t}\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::refreshFeaturesInWidget()\n{\n\tvector<FaceFeature*> vFeats = m_pFaceDatasetModel->getFeatures(m_iCurrentImage);\n\tQList<FaceFeatureNode*> lsNodes = m_pFaceWidget->getFaceFeatures(m_pFaceDatasetModel->numFeatures()); // This call automatically guarantees that there are \"m_pFaceDatasetModel->numFeatures()\" features in the editor\n\tfor(int i = 0; i < (int) vFeats.size(); i++)\n\t{\n\t\tlsNodes[i]->setData(0, true); // Indication to avoid emitting position change event\n\n\t\t// Refresh the feature visual in the widget:\n\t\t//    - (re)position the feature\n\t\t//    - (re)do any connections\n\t\tlsNodes[i]->setPos(vFeats[i]->x(), vFeats[i]->y());\n\t\tforeach(int iID, vFeats[i]->getConnections())\n\t\t\tm_pFaceWidget->connectFaceFeatures(vFeats[i]->getID(), iID);\n\n\t\tlsNodes[i]->setData(0, false);\n\t}\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::updateFeaturesInDataset()\n{\n\tQList<FaceFeatureNode*> lsNodes = m_pFaceWidget->getFaceFeatures();\n\tvector<FaceFeature*> vFeats = m_pFaceDatasetModel->getFeatures(m_iCurrentImage);\n\n\tFaceFeatureNode* pNode;\n\tfor(int i = 0; i < (int) vFeats.size(); i++)\n\t{\n\t\tif(i >= lsNodes.size()) // Sanity check (vFeats and lsNodes are supposed to have the same size, but who knows?)\n\t\t{\n\t\t\tqCritical() << tr(\"An update of face features in dataset was not performed due to inconsistences.\");\n\t\t\tcontinue;\n\t\t}\n\t\tpNode = lsNodes.at(i);\n\t\tvFeats[i]->setID(pNode->getID());\n\t\tvFeats[i]->setX(pNode->x());\n\t\tvFeats[i]->setY(pNode->y());\n\t}\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::onFaceFeaturesSelectionChanged()\n{\n\temit onFeaturesSelectionChanged();\n}\n\n// +-----------------------------------------------------------\nbool ft::ChildWindow::displayFaceFeatures() const\n{\n\treturn m_pFaceWidget->displayFaceFeatures();\n}\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::setDisplayFaceFeatures(const bool bValue)\n{\n\tm_pFaceWidget->setDisplayFaceFeatures(bValue);\n}\n\n// +-----------------------------------------------------------\nbool ft::ChildWindow::displayConnections() const\n{\n\treturn m_pFaceWidget->displayConnections();\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::setDisplayConnections(const bool bValue)\n{\n\tm_pFaceWidget->setDisplayConnections(bValue);\n}\n\n// +-----------------------------------------------------------\nbool ft::ChildWindow::displayFeatureIDs() const\n{\n\treturn m_pFaceWidget->displayFeatureIDs();\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::setDisplayFeatureIDs(const bool bValue)\n{\n\tm_pFaceWidget->setDisplayFeatureIDs(bValue);\n}\n\n// +-----------------------------------------------------------\nconst QList<ft::FaceFeatureNode*>& ft::ChildWindow::getFaceFeatures() const\n{\n\treturn m_pFaceWidget->getFaceFeatures();\n}\n\n// +-----------------------------------------------------------\nQList<ft::FaceFeatureNode*> ft::ChildWindow::getSelectedFeatures() const\n{\n\treturn m_pFaceWidget->getSelectedFeatures();\n}\n\n// +-----------------------------------------------------------\nQList<ft::FaceFeatureEdge*> ft::ChildWindow::getSelectedConnections() const\n{\n\treturn m_pFaceWidget->getSelectedConnections();\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::setContextMenu(QMenu *pMenu)\n{\n\tm_pFaceWidget->setContextMenu(pMenu);\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::addFeature(const QPoint &oPos)\n{\n\tFaceFeatureNode *pNode = m_pFaceWidget->addFaceFeature(oPos, true);\n\tm_pFaceDatasetModel->addFeature(pNode->getID(), pNode->x(), pNode->y());\n\tonDataChanged();\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::removeSelectedFeatures()\n{\n\tbool bUpdated = false;\n\tQList<FaceFeatureNode*> lsFeats = m_pFaceWidget->getSelectedFeatures();\n\tforeach(FaceFeatureNode *pNode, lsFeats)\n\t{\n\t\tm_pFaceDatasetModel->removeFeature(pNode->getID());\n\t\tm_pFaceWidget->removeFaceFeature(pNode);\n\t\tbUpdated = true;\n\t}\n\tif(bUpdated)\n\t{\n\t\tupdateFeaturesInDataset();\n\t\tonDataChanged();\n\t}\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::connectFeatures()\n{\n\tbool bUpdated = false;\n\tQList<FaceFeatureNode*> lsFeats = m_pFaceWidget->getSelectedFeatures();\n\tQList<FaceFeatureNode*>::iterator oFirst, oSecond;\n\n\tfor(oFirst = lsFeats.begin(); oFirst != lsFeats.end(); oFirst++)\n\t{\n\t\tfor(oSecond = oFirst + 1; oSecond != lsFeats.end(); oSecond++)\n\t\t{\n\t\t\tm_pFaceWidget->connectFaceFeatures(*oFirst, *oSecond);\n\t\t\tm_pFaceDatasetModel->connectFeatures((*oFirst)->getID(), (*oSecond)->getID());\n\t\t\tbUpdated = true;\n\t\t}\n\t}\n\tif(bUpdated)\n\t\tonDataChanged();\n}\n\n// +-----------------------------------------------------------\nvoid ft::ChildWindow::disconnectFeatures()\n{\n\tbool bUpdated = false;\n\tQList<FaceFeatureNode*> lsFeats = m_pFaceWidget->getSelectedFeatures();\n\tQList<FaceFeatureNode*>::iterator oFirst, oSecond;\n\n\tfor(oFirst = lsFeats.begin(); oFirst != lsFeats.end(); oFirst++)\n\t{\n\t\tfor(oSecond = oFirst + 1; oSecond != lsFeats.end(); oSecond++)\n\t\t{\n\t\t\tm_pFaceWidget->disconnectFaceFeatures(*oFirst, *oSecond);\n\t\t\tm_pFaceDatasetModel->disconnectFeatures((*oFirst)->getID(), (*oSecond)->getID());\n\t\t\tbUpdated = true;\n\t\t}\n\t}\n\tif(bUpdated)\n\t\tonDataChanged();\n}\n\n// +-----------------------------------------------------------\nbool ft::ChildWindow::positionFeatures(std::vector<QPoint> vPoints)\n{\n\tQList<FaceFeatureNode *> lFeats = m_pFaceWidget->getFaceFeatures(vPoints.size()); // this call automatically adds or removes features to match vPoints.size()\n\t\n\t// Adjust the dataset so it has the same amount of features as the widget\n\tvector<FaceFeature*> vFeats = m_pFaceDatasetModel->getFeatures(m_iCurrentImage);\n\tint iDiff = lFeats.size() - vFeats.size();\n\n\t// If the widget has more features than the dataset, add the difference\n\tif (iDiff > 0)\n\t{\n\t\tfor (int i = 0; i < iDiff; i++)\n\t\t\tm_pFaceDatasetModel->addFeature(lFeats.size() + i - 1, 0, 0);\n\t}\n\n\t// Else, if the widget has less features than the dataset, remove the difference\n\telse if (iDiff < 0)\n\t{\n\t\tfor (int i = 0; i < abs(iDiff); i++)\n\t\t\tm_pFaceDatasetModel->removeFeature(lFeats.size() - i - 1);\n\t}\n\n\t// Move the features\n\tFaceFeatureNode *pFeat;\n\tfor (unsigned int i = 0; i < vPoints.size(); i++)\n\t{\n\t\tpFeat = lFeats.at(i);\n\t\tpFeat->setPos(vPoints[i]);\n\t}\n\tupdateFeaturesInDataset();\n\tsetWindowModified(true);\n\temit onDataModified();\n\n\treturn true;\n}"
  },
  {
    "path": "src/childwindow.h",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef CHILDWINDOW_H\n#define CHILDWINDOW_H\n\n#include \"facedatasetmodel.h\"\n#include \"facewidget.h\"\n\n#include <QtGui>\n#include <QWidget>\n\nnamespace ft\n{\n\t/**\n\t * MDI-child window class used to display and edit the face annotation datasets.\n\t */\n\tclass ChildWindow : public QWidget\n\t{\n\t\tQ_OBJECT\n\tpublic:\n\t\t/**\n\t\t * Class constructor.\n\t\t * @param pParent Instance of the widget that will be the parent of this window.\n\t\t */\n\t\texplicit ChildWindow(QWidget* pParent = 0);\n\n\t\t/**\n\t\t * Class destructor.\n\t\t */\n\t\tvirtual ~ChildWindow();\n\n\t\t/**\n\t\t * Gets the list model used to display information about the contents of the\n\t\t * face annotation dataset handled by this window.\n\t\t * @return An instance of a QAbstractListModel that can be used with any subclass of QAbstractItemView\n\t\t * to display lists, icons or trees with the face annotation dataset contents.\n\t\t */\n\t\tFaceDatasetModel* dataModel() const;\n\n\t\t/**\n\t\t * Gets the list selection model used to display selection information about the contents of the\n\t\t * face annotation dataset handled by this window.\n\t\t * @return An instance of a QItemSelectionModel that can be used with any subclass of QAbstractItemView\n\t\t * to display lists, icons or tress with the face annotation dataset contents.\n\t\t */\n\t\tQItemSelectionModel* selectionModel() const;\n\n\t\t/**\n\t\t * Saves the contents of the face annotation dataset in this window to the current file\n\t\t * (stored in the windowFilePath property). The file is saved in the YAML format, as defined\n\t\t * in the FaceDataset class.\n\t\t */\n\t\tbool save(QString &sMsgError);\n\n\t\t/**\n\t\t * Saves the contents of the face annotation dataset in this window to the given file.\n\t\t * The file is saved in the YAML format, as defined in the FaceDataset class.\n\t\t * @param sFileName QString with the path and name of the file to save the dataset to.\n\t\t */\n\t\tbool saveToFile(const QString &sFileName, QString &sMsgError);\n\n\t\t/**\n\t\t * Loads the contents of the face annotation dataset from the given file into this window.\n\t\t * The file must be in the YAML format, as defined in the FaceDataset class.\n\t\t * @param sFileName QString with the path and name of the file to load the dataset from.\n\t\t */\n\t\tbool loadFromFile(const QString &sFileName, QString &sMsgError);\n\n\t\t/**\n\t\t * Sets the zoom level of the image in display in terms of the steps defined in the zoom\n\t\t * slider from 1 to 21, with 11 (the middle value) as \"no zoom\" (i.e. 100% view).\n\t\t * @param iLevel Integer with the zoom level to set.\n\t\t */\n\t\tvoid setZoomLevel(const int iLevel);\n\n\t\t/**\n\t\t * Gets the current zoom level of the image in display in terms of the steps defined in the zoom\n\t\t * slider from 1 to 21, with 11 (the middle value) as \"no zoom\" (i.e. 100% view).\n\t\t * @return Integer with the current zoom level.\n\t\t */\n\t\tint getZoomLevel() const;\n\n\t\t/**\n\t\t * Performs one step of zoom in.\n\t\t */\n\t\tvoid zoomIn();\n\n\t\t/**\n\t\t * Performs one step of zoom out.\n\t\t */\n\t\tvoid zoomOut();\n\n\t\t/**\n\t\t * Indicates if the face feature nodes are on display.\n\t\t * @return Boolean indicating if the face feature nodes are being displayed or not.\n\t\t */\n\t\tbool displayFaceFeatures() const;\n\n\t\t/**\n\t\t * Updates the indication on if the face feature nodes shall be displayed or not.\n\t\t * @param bValue Boolean with the new value (true means show, false means hide).\n\t\t */\n\t\tvoid setDisplayFaceFeatures(const bool bValue);\n\n\t\t/**\n\t\t * Indicates if the face feature edges are on display.\n\t\t * @return Boolean indicating if the face feature edges are being displayed or not.\n\t\t */\n\t\tbool displayConnections() const;\n\n\t\t/**\n\t\t * Updates the indication on if the face feature edges shall be displayed or not.\n\t\t * @param bValue Boolean with the new value (true means show, false means hide).\n\t\t */\n\t\tvoid setDisplayConnections(const bool bValue);\n\n\t\t/**\n\t\t * Indicates if the identifiers of the face feature nodes are on display.\n\t\t * @return Boolean indicating if the identifiers of the face feature nodes are being displayed or not.\n\t\t */\n\t\tbool displayFeatureIDs() const;\n\n\t\t/**\n\t\t * Updates the indication on if the identifiers of the face feature nodes shall be displayed or not.\n\t\t * @param bValue Boolean with the new value (true means show, false means hide).\n\t\t */\n\t\tvoid setDisplayFeatureIDs(const bool bValue);\n\n\t\t/**\n\t\t * Queries the list of existing face feature nodes.\n\t\t * @param Const reference to the QList of existing nodes.\n\t\t */\n\t\tconst QList<FaceFeatureNode*>& getFaceFeatures() const;\n\n\t\t/**\n\t\t * Queries the selected face feature nodes.\n\t\t * @return QList with the pointers to the selected face feature nodes.\n\t\t */\n\t\tQList<FaceFeatureNode*> getSelectedFeatures() const;\n\n\t\t/**\n\t\t * Queries the selected face feature edges.\n\t\t * @return QList with the pointers to the selected face feature edges.\n\t\t */\n\t\tQList<FaceFeatureEdge*> getSelectedConnections() const;\n\n\t\t/**\n\t\t * Sets the menu to be displayed upon events of context menu on the face features editor.\n\t\t * The actions used in the menu must be controlled by the caller.\n\t\t * @param pMenu Instance of the QMenu to be used for the context of the editor.\n\t\t */\n\t\tvoid setContextMenu(QMenu *pMenu);\n\n\t\t/**\n\t\t * Adds a new feature to the face feature editor, in the given position.\n\t\t * @param oPos QPoint with the position (x, y) of the new feature.\n\t\t */\n\t\tvoid addFeature(const QPoint &oPos);\n\n\t\t/**\n\t\t * Removes the selected features and all their connections.\n\t\t */\n\t\tvoid removeSelectedFeatures();\n\n\t\t/**\n\t\t * Connects the selected features among themselves.\n\t\t */\n\t\tvoid connectFeatures();\n\n\t\t/**\n\t\t * Disconnects the selected features.\n\t\t */\n\t\tvoid disconnectFeatures();\n\n\t\t/**\n\t\t * Moves the face features in the image currently on display according to the given\n\t\t * list of positions. If the number of face features is different than the number of\n\t\t * points, the model is updated accordingly (with features added or removed to match\n\t\t * the number of points).\n\t\t * @param vPoints A std::vector with the list of QPoint instances with the new\n\t\t * features' positions.\n\t\t * @return Boolean indicating if the reposition was successfully done or not.\n\t\t */\n\t\tbool positionFeatures(std::vector<QPoint> vPoints);\n\n\tprotected:\n\n\t\t/**\n\t\t * Refreshes the positions of face features in the editor based on the values in the dataset.\n\t\t */\n\t\tvoid refreshFeaturesInWidget();\n\n\t\t/**\n\t\t * Updates the positions of face features in the dataset based on the values in the editor.\n\t\t */\n\t\tvoid updateFeaturesInDataset();\n\n\tprotected slots:\n\n\t\t/**\n\t\t * Captures the indication of changes in the image scale factor (zoom).\n\t\t * @param dScaleFactor Double with the new scale factor for the image.\n\t\t */\n\t\tvoid onScaleFactorChanged(const double dScaleFactor);\n\n\t\t/**\n\t\t * Captures the indication that face features were selected or unselected in the editor.\n\t\t */\n\t\tvoid onFaceFeaturesSelectionChanged();\n\n\t\t/**\n\t\t * Captures indications of changes in the data model or the face widget\n\t\t * (so the UI can be updated accordingly).\n\t\t * @param bModified Boolean indicating if the child window shall be marked as modified or not.\n\t\t * The default is true.\n\t\t */\n\t\tvoid onDataChanged(const bool bModified = true);\n\n\t\t/**\n\t\t * Captures indication of changes in the current selected image on the selection model.\n\t\t */\n\t\tvoid onCurrentChanged(const QModelIndex &oCurrent, const QModelIndex &oPrevious);\n\n\tsignals:\n\n\t\t/**\n\t\t * Signal to indicate changes in the data model (so the UI can be updated accordingly).\n\t\t */\n\t\tvoid onDataModified();\n\n\t\t/**\n\t\t * Signal to indicate that the selection of face features changed in the editor.\n\t\t * The selection can be queried through getSelectedFeatures() and getSelectedConnections().\n\t\t */\n\t\tvoid onFeaturesSelectionChanged();\n\n\t\t/**\n\t\t * Signal to indicate an update in the UI due to changes in the selection model.\n\t\t * @param sImageName QString with the name of the current selected face image.\n\t\t * @param iZoomLevel Current level of zoom in the face image widget.\n\t\t */\n\t\tvoid onUIUpdated(const QString sImageName, const int iZoomLevel);\n\n\tprivate:\n\n\t\t/** Index of the current displayed face image. */\n\t\tint m_iCurrentImage;\n\n\t\t/** Widget used to display face images and edit facial features. */\n\t\tFaceWidget *m_pFaceWidget;\n\n\t\t/** Instance of the model used to encapsulate the access of the face dataset to Qt view components such as QListView. */\n\t\tFaceDatasetModel *m_pFaceDatasetModel;\n\n\t\t/** Selection model used to represent the selection of items in Qt view components such as QListView. */\n\t\tQItemSelectionModel *m_pFaceSelectionModel;\n\t};\n}\n\n#endif // CHILDWINDOW_H\n"
  },
  {
    "path": "src/facedataset.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"facedataset.h\"\n\n#include <QDebug>\n#include <QFileInfo>\n#include <QDir>\n#include <QApplication>\n\nusing namespace std;\n\n// +-----------------------------------------------------------\nft::FaceDataset::FaceDataset()\n{\n\tm_iNumFeatures = 0;\n}\n\n// +-----------------------------------------------------------\nft::FaceDataset::~FaceDataset()\n{\n\tclear();\n}\n\n// +-----------------------------------------------------------\nint ft::FaceDataset::size() const\n{\n\treturn m_vSamples.size();\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceDataset::loadFromFile(const QString &sFileName, QString &sMsgError)\n{\n\t/******************************************************\n\t * Open and read the file\n\t ******************************************************/\n\tQFile oFile(sFileName);\n\tif (!oFile.open(QFile::ReadOnly))\n    {\n\t\tsMsgError = QString(QApplication::translate(\"FaceDataset\", \"it was not possible to read from file [%1]\")).arg(sFileName);\n        return false;\n    }\n\n\t// Used to resolve the image file names relative to the saved file path\n\tQDir oBase(QFileInfo(sFileName).absolutePath());\n\n\tQTextStream oData(&oFile);\n\tQString sData = oData.readAll();\n\toFile.close();\n\n\t/******************************************************\n\t * Parse the xml document\n\t ******************************************************/\n\tQDomDocument oDoc;\n\tQString sError;\n\tint iLine, iColumn;\n\tif(!oDoc.setContent(sData, true, &sError, &iLine, &iColumn))\n\t{\n\t\tsMsgError = QString(QApplication::translate(\"FaceDataset\", \"there is an error in the contents of the file [%1]: error [%2], line [%3], column [%4]\")).arg(sFileName, sError, QString::number(iLine), QString::number(iColumn));\n\t\treturn false;\n\t}\n\n\t// Root node\n\tQDomElement oRoot = oDoc.firstChildElement(\"FaceDataset\");\n\n\tif(oRoot.isNull())\n\t{\n\t\tsMsgError = QString(QApplication::translate(\"FaceDataset\", \"there is an error in the contents of the file [%1]: the node '%2' does not exist\")).arg(sFileName, \"FaceDataset\");\n\t\treturn false;\n\t}\n\n\tint iNumFeats = oRoot.attribute(\"numberOfFeatures\", \"-1\").toInt();\n\tif(iNumFeats < 0)\n\t{\n\t\tsMsgError = QString(QApplication::translate(\"FaceDataset\", \"there is an error in the contents of the file [%1]: the attribute '%2' does not exist or it contains an invalid value\")).arg(sFileName, \"numberOfFeatures\");\n\t\treturn false;\n\t}\n\n\t// Sample images\n\tQDomElement oSamples = oRoot.firstChildElement(\"Samples\");\n\tif(oSamples.isNull())\n\t{\n\t\tsMsgError = QString(QApplication::translate(\"FaceDataset\", \"there is an error in the contents of the file [%1]: the node '%2' does not exist\")).arg(sFileName, \"Samples\");\n\t\treturn false;\n\t}\n\n\tvector<FaceImage*> vSamples;\n\tfor(QDomElement oElement = oSamples.firstChildElement(); !oElement.isNull(); oElement = oElement.nextSiblingElement())\n\t{\n\t\tFaceImage *pSample = new FaceImage();\n\t\tif(!pSample->loadFromXML(oElement, sError, iNumFeats))\n\t\t{\n\t\t\tforeach(FaceImage *pSamp, vSamples)\n\t\t\t\tdelete(pSamp);\n\t\t\tdelete pSample;\n\n\t\t\tsMsgError = QString(QApplication::translate(\"FaceDataset\", \"there is an error in the contents of the file [%1]: %2\")).arg(sFileName, sError);\n\t\t\treturn false;\n\t\t}\n\t\tpSample->setFileName(oBase.absoluteFilePath(pSample->fileName()));\n\t\tvSamples.push_back(pSample);\n\t}\n\n\tclear();\n\tm_iNumFeatures = iNumFeats;\n\tm_vSamples = vSamples;\n\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceDataset::saveToFile(const QString &sFileName, QString &sMsgError) const\n{\n\t/******************************************************\n\t * Create the xml document\n\t ******************************************************/\n\tQDomDocument oDoc;\n\n\t// Processing instruction\n\tQDomProcessingInstruction oInstr = oDoc.createProcessingInstruction(\"xml\", \"version='1.0' encoding='UTF-8'\");\n\toDoc.appendChild(oInstr);\n\n\t// Root node\n\tQDomElement oRoot = oDoc.createElementNS(\"https://github.com/luigivieira/Facial-Landmarks-Annotation-Tool\", \"FaceDataset\");\n\toDoc.appendChild(oRoot);\n\n\toRoot.setAttribute(\"numberOfFeatures\", m_iNumFeatures);\n\n\t// Sample images\n\tQDomElement oSamples = oDoc.createElement(\"Samples\");\n\toRoot.appendChild(oSamples);\n\n\t// Used to make the image file names relative to the saved file path\n\tQDir oBase(QFileInfo(sFileName).absolutePath());\n\tQString sSave;\n\n\tforeach(FaceImage *pImage, m_vSamples)\n\t{\n\t\tsSave = pImage->fileName(); // Save the absolute path (it is still used in the editor)\n\t\tpImage->setFileName(oBase.relativeFilePath(pImage->fileName()));\n\t\tpImage->saveToXML(oSamples);\n\t\tpImage->setFileName(sSave);\n\t}\n\n\t/******************************************************\n\t * Save the file\n\t ******************************************************/\n\tQFile oFile(sFileName);\n\tif (!oFile.open(QFile::WriteOnly | QFile::Truncate))\n    {\n\t\tsMsgError = QString(QApplication::translate(\"FaceDataset\", \"it was not possible to write to file [%1]\")).arg(sFileName);\n        return false;\n    }\n\n\tQTextStream oData(&oFile);\n\toDoc.save(oData, 4);\n\toFile.close();\n\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceDataset::clear()\n{\n\tforeach(FaceImage *pImage, m_vSamples)\n\t\tdelete pImage;\n\tm_vSamples.clear();\n\n\tm_iNumFeatures = 0;\n}\n\n// +-----------------------------------------------------------\nft::FaceImage* ft::FaceDataset::getImage(const int iIndex) const\n{\n    if(iIndex < 0 || iIndex >= size())\n\t\treturn NULL;\n\n\treturn m_vSamples[iIndex];\n}\n\n// +-----------------------------------------------------------\nft::FaceImage* ft::FaceDataset::addImage(const QString &sFileName)\n{\n\tforeach(FaceImage *pImage, m_vSamples)\n\t\tif(pImage->fileName() == sFileName)\n\t\t\treturn pImage;\n\n\tFaceImage *pRet = new FaceImage(sFileName);\n\tm_vSamples.push_back(pRet);\n\treturn pRet;\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceDataset::removeImage(const int iIndex)\n{\n\tif(iIndex < 0 || iIndex >= size())\n\t\treturn false;\n\n\tFaceImage *pImage = m_vSamples[iIndex];\n\tm_vSamples.erase(m_vSamples.begin() + iIndex);\n\tdelete pImage;\n\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nint ft::FaceDataset::numFeatures() const\n{\n\treturn m_iNumFeatures;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceDataset::setNumFeatures(int iNumFeats)\n{\n\tm_iNumFeatures = iNumFeats;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceDataset::addFeature(int iID, float x, float y)\n{\n\tFaceFeature *pFeat;\n\tforeach(FaceImage *pSample, m_vSamples)\n\t\tpFeat = pSample->addFeature(iID, x, y);\n\tm_iNumFeatures++;\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceDataset::removeFeature(const int iIndex)\n{\n\tif(iIndex < 0 || iIndex >= m_iNumFeatures)\n\t\treturn false;\n\n\tforeach(FaceImage *pSample, m_vSamples)\n\t\tpSample->removeFeature(iIndex);\n\tm_iNumFeatures--;\n\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceDataset::connectFeatures(int iIDSource, int iIDTarget)\n{\n\tforeach(FaceImage *pSample, m_vSamples)\n\t\tpSample->connectFeatures(iIDSource, iIDTarget);\n\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceDataset::disconnectFeatures(int iIDSource, int iIDTarget)\n{\n\tforeach(FaceImage *pSample, m_vSamples)\n\t\tpSample->disconnectFeatures(iIDSource, iIDTarget);\n\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nvector<ft::FaceFeature*> ft::FaceDataset::getImageFeatures(const int iIndex)\n{\n\tif(iIndex < 0 || iIndex >= (int) m_vSamples.size())\n\t\treturn vector<FaceFeature*>();\n\n\treturn m_vSamples[iIndex]->getFeatures();\n}"
  },
  {
    "path": "src/facedataset.h",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef FACEDATASET_H\n#define FACEDATASET_H\n\n#include \"faceimage.h\"\n#include \"facefeature.h\"\n\n#include <QDomDocument>\n\n#include <vector>\n\nnamespace ft\n{\n\t/**\n\t * Represents a dataset of facial images that can be annotated with facial landmarks and\n\t * prototypical emotional labels.\n\t */\n\tclass FaceDataset\n\t{\n\tpublic:\n\t\t/**\n\t\t * Class constructor.\n\t\t */\n\t\tFaceDataset();\n\n\t\t/**\n\t\t * Class destructor.\n\t\t */\n\t\tvirtual ~FaceDataset();\n\n\t\t/**\n\t\t * Returns the number of face samples in the dataset.\n\t\t * @return Integer with the number of face samples in this dataset.\n\t\t */\n\t\tint size() const;\n\n\t\t/**\n\t\t * Loads (unserializes) the instance from the given text file in the YAML format\n\t\t * (YAML Ain't Markup Language - http://en.wikipedia.org/wiki/YAML).\n\t\t * @param sFileName QString with the name of the file to read the data from.\n\t\t * @param sMsgError QString to receive the error message in case the method fails.\n\t\t * @return Boolean indicating if the loading was successful (true) of failed (false).\n\t\t */\n\t\tbool loadFromFile(const QString &sFileName, QString &sMsgError);\n\n        /**\n         * Saves (serializes) the instance to the given file in the YAML format\n\t\t * (YAML Ain't Markup Language - http://en.wikipedia.org/wiki/YAML).\n         * @param sFileName QString with the name of the file to write the data to.\n\t\t * @param sMsgError QString to receive the error message in case the method fails.\n\t\t * @return Boolean indicating if the saving was successful (true) of failed (false).\n         */\n        bool saveToFile(const QString &sFileName, QString &sMsgError) const;\n\n        /**\n         * Clear the face annotation dataset.\n         */\n        void clear();\n\n\t\t/**\n\t\t * Gets the face image for the given index. The index must be in the range [0, count - 1],\n\t\t * where count is the number of face images in the dataset.\n\t\t * @param iIndex Integer with the index of the image file to load.\n\t\t * @return Pointer to a FaceImage with the face image data. If the method fails, NULL is returned. \n\t\t */\n\t\tFaceImage* getImage(const int iIndex) const;\n\n\t\t/**\n\t\t * Adds a new image to the face annotation dataset. All other data (landmarks, connections, etc)\n\t\t * are created with default values.\n\t\t * @param sFileName QString with the path and filename of the image file to be added to the dataset.\n\t\t * @return Pointer to a FaceImage with the new image added to the dataset or NULL if failed. \n\t\t */\n\t\tFaceImage* addImage(const QString &sFileName);\n\n\t\t/**\n\t\t * Removes an image from the face annotation dataset. All other data (landmarks, connections, etc)\n\t\t * are also removed.\n\t\t * @param iIndex Integer with the index of the image to remove.\n\t\t * @return Boolean indicating if the image was removed (true) or not (false, in case\n\t\t * the given index is out of range).\n\t\t */\n\t\tbool removeImage(const int iIndex);\n\n\t\t/**\n\t\t * Queries the number of facial features in the dataset (applicable to all images).\n\t\t * @return Integer with the number of face features in the dataset.\n\t\t */\n\t\tint numFeatures() const;\n\n\t\t/**\n\t\t * Updates the number of facial features in the dataset (applicable to all images).\n\t\t * @param iNumFeats Integer with the new number of facial features for the dataset.\n\t\t */\n\t\tvoid setNumFeatures(int iNumFeats);\n\n\t\t/**\n\t\t * Adds a new feature to the face dataset. A new feature is added to all\n\t\t * face images in the dataset in the same coordinates.\n\t\t * @param iID Integer with the identifier of the face feature.\n\t\t * @param x Float with the x coordinate for the face features.\n\t\t * @param y Float with the y coordinate for the face features.\n\t\t */\n\t\tvoid addFeature(int iID, float x = 0.0f, float y = 0.0f);\n\n\t\t/**\n\t\t * Removes an existing feature from the face dataset. The feature is removed from all\n\t\t * face images in the dataset.\n\t\t * @param iIndex Integer with the index of the feature to remove.\n\t\t * @return Boolean indicating if the feature was successfully removed (true) or not (false).\n\t\t */\n\t\tbool removeFeature(const int iIndex);\n\n\t\t/**\n\t\t* Connects the two given features.\n\t\t* @param iIDSource Integer with the ID of the source feature.\n\t\t* @param iIDTarget Integer with the ID of the target feature.\n\t\t* @return Boolean indicating if the connection was successfully created.\n\t\t*/\n\t\tbool connectFeatures(int iIDSource, int iIDTarget);\n\n\t\t/**\n\t\t* Disconnects the two given features.\n\t\t* @param iIDSource Integer with the ID of the source feature.\n\t\t* @param iIDTarget Integer with the ID of the target feature.\n\t\t* @return Boolean indicating if the connection was successfully removed.\n\t\t*/\n\t\tbool disconnectFeatures(int iIDSource, int iIDTarget);\n\n\t\t/**\n\t\t * Gets the list of face features in the given image index.\n\t\t * @param iIndex Integer with the index of the image to query the face features.\n\t\t * @param A vector of FaceFeature instances with the face features in the image. It returns\n\t\t * an empty vector if the given index is invalid.\n\t\t */\n\t\tstd::vector<FaceFeature*> getImageFeatures(const int iIndex);\n\n\tprivate:\n\n\t\t/** Vector of sample face images. */\n\t\tstd::vector<FaceImage*> m_vSamples;\n\n\t\t/** Number of face features in the dataset (i.e. applicable to all images). */\n\t\tint m_iNumFeatures;\n\t};\n}\n\n#endif // FACEDATASET_H\n"
  },
  {
    "path": "src/facedatasetmodel.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n \n#include \"facedatasetmodel.h\"\n#include <assert.h>\n\n#include <QFileInfo>\n#include <QApplication>\n#include <QDebug>\n\n// +-----------------------------------------------------------\nft::FaceDatasetModel::FaceDatasetModel(QObject *pParent):\n\tQAbstractListModel(pParent)\n{\n\tm_pFaceDataset = new FaceDataset();\n}\n\n// +-----------------------------------------------------------\nft::FaceDatasetModel::~FaceDatasetModel()\n{\n\tdelete m_pFaceDataset;\n}\n\n\n// +-----------------------------------------------------------\nint ft::FaceDatasetModel::rowCount(const QModelIndex &oParent) const\n{\n\tQ_UNUSED(oParent);\n\treturn m_pFaceDataset->size();\n}\n\n// +-----------------------------------------------------------\nint ft::FaceDatasetModel::columnCount(const QModelIndex &oParent) const\n{\n\tQ_UNUSED(oParent);\n\treturn 4; // There are four columns of data: [Image Name]\n}\n\n// +-----------------------------------------------------------\nQVariant ft::FaceDatasetModel::headerData(int iSection, Qt::Orientation eOrientation, int iRole) const\n{\n\tQ_UNUSED(eOrientation);\n\tswitch(iRole)\n\t{\n\t\t// Display data (the dataset contents)\n\t\tcase Qt::DisplayRole:\n\t\t\tswitch(iSection)\n\t\t\t{\n\t\t\t\tcase 0: // [Image Name]\n\t\t\t\t\treturn QApplication::translate(\"FaceDatasetModel\", \"Image Name\");\n\n\t\t\t\tcase 1: // [File Path]\n\t\t\t\t\treturn QApplication::translate(\"FaceDatasetModel\", \"File Path\");\n\n\t\t\t\tdefault:\n\t\t\t\t\treturn QVariant();\n\t\t\t}\n\t\t\t\n\n\t\tcase Qt::DecorationRole:\n\t\t\tif(iSection == 0)\n\t\t\t\treturn QApplication::translate(\"FaceDatasetModel\", \"Thumbnail\");\n\t\t\telse\n\t\t\t\treturn QVariant();\n\n\t\tdefault:\n\t\t\treturn QVariant();\n\t}\n}\n\n// +-----------------------------------------------------------\nQVariant ft::FaceDatasetModel::data(const QModelIndex &oIndex, int iRole) const\n{\n\tFaceImage *pImage = m_pFaceDataset->getImage(oIndex.row());\n\tif(!pImage)\n\t\treturn QVariant();\n\n\tQPixmap oPixmap;\n\n\tswitch(iRole)\n\t{\n\t\t// Data to be displayed on ModelViews\n\t\tcase Qt::DisplayRole:\n\t\t\tswitch(oIndex.column())\n\t\t\t{\n\t\t\t\tcase 0: // [Image Name]\n\t\t\t\t\treturn QFileInfo(pImage->fileName()).baseName();\n\n\t\t\t\tcase 1: // [File Path]\n\t\t\t\t\treturn pImage->fileName();\n\n\t\t\t\tdefault:\n\t\t\t\t\treturn QVariant();\n\t\t\t}\n\n\t\t// Decoration data (image thumbnails for the first column)\n\t\tcase Qt::DecorationRole:\n\t\t\tif(oIndex.column() == 0)\n\t\t\t\treturn m_lCachedThumbnails[oIndex.row()];\n\t\t\telse\n\t\t\t\treturn QVariant();\n\n\t\t// Raw data from the face dataset\n\t\tcase Qt::UserRole:\n\t\t\tswitch(oIndex.column())\n\t\t\t{\n\t\t\t\tcase 0: // The complete image file name+path\n\t\t\t\t\treturn pImage->fileName();\n\n\t\t\t\tcase 2: // The image data\n\t\t\t\t\toPixmap = pImage->pixMap();\n\t\t\t\t\tif(oPixmap.isNull())\n\t\t\t\t\t\toPixmap = QPixmap(\":/images/brokenimage\");\n\t\t\t\t\treturn oPixmap;\n\n\t\t\t\tdefault:\n\t\t\t\t\treturn QVariant();\n\t\t\t}\n\n\t\t// Any other role, return invalid\n\t\tdefault:\n\t\t\treturn QVariant();\n\t}\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceDatasetModel::setData(const QModelIndex &oIndex, const QVariant &oValue, int iRole)\n{\n\tFaceImage *pImage = m_pFaceDataset->getImage(oIndex.row());\n\tif(!pImage)\n\t\treturn false;\n\n\tif(iRole == Qt::UserRole)\n\t{\n\t\tswitch(oIndex.column())\n\t\t{\n\t\t\tcase 0: // [Image Name]\n\t\t\t\treturn false;\n\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t}\n\telse\n\t\treturn false;\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceDatasetModel::loadFromFile(const QString &sFileName, QString &sMsgError)\n{\n\tbeginResetModel();\n\tbool bRet = m_pFaceDataset->loadFromFile(sFileName, sMsgError);\n\n\t// Rebuild the thumbnails cache\n\tif(bRet)\n\t{\n\t\tm_lCachedThumbnails.clear();\n\t\tfor(int i = 0; i < m_pFaceDataset->size(); i++)\n\t\t\tm_lCachedThumbnails.append(buildThumbnail(i));\n\t}\n\n\tendResetModel();\n\treturn bRet;\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceDatasetModel::saveToFile(const QString &sFileName, QString &sMsgError) const\n{\n\treturn m_pFaceDataset->saveToFile(sFileName, sMsgError);\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceDatasetModel::addImages(const QStringList &lImageFiles)\n{\n\tint iFirst = m_pFaceDataset->size();\n\tint iLast = iFirst + lImageFiles.size() - 1;\n\tbeginInsertRows(QModelIndex(), iFirst, iLast);\n\tfor(int i = 0; i < lImageFiles.size(); i++)\n\t{\n\t\tm_pFaceDataset->addImage(lImageFiles[i]);\n\t\tm_lCachedThumbnails.append(buildThumbnail(m_pFaceDataset->size() - 1));\n\t}\n\tendInsertRows();\n\temit dataChanged(index(iFirst), index(iLast));\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceDatasetModel::removeImages(const QList<int> &lImageIndexes)\n{\n\tint iFirst = lImageIndexes.first();\n\tint iLast = lImageIndexes.last();\n\tbeginRemoveRows(QModelIndex(), iFirst, iLast);\n\tfor(int i = lImageIndexes.size() - 1; i >= 0; i--)\n\t{\n\t\tm_pFaceDataset->removeImage(lImageIndexes[i]);\n\t\tm_lCachedThumbnails.removeAt(lImageIndexes[i]);\n\t}\n\tendRemoveRows();\n\temit dataChanged(index(0), index(lImageIndexes.size() - 1));\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceDatasetModel::addFeature(int iID, float x, float y)\n{\n\tm_pFaceDataset->addFeature(iID, x, y);\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceDatasetModel::removeFeature(const int iIndex)\n{\n\tm_pFaceDataset->removeFeature(iIndex);\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceDatasetModel::connectFeatures(int iIDSource, int iIDTarget)\n{\n\tm_pFaceDataset->connectFeatures(iIDSource, iIDTarget);\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceDatasetModel::disconnectFeatures(int iIDSource, int iIDTarget)\n{\n\tm_pFaceDataset->disconnectFeatures(iIDSource, iIDTarget);\n}\n\n// +-----------------------------------------------------------\nstd::vector<ft::FaceFeature*> ft::FaceDatasetModel::getFeatures(const int iIndex)\n{\n\treturn m_pFaceDataset->getImageFeatures(iIndex);\n}\n\n// +-----------------------------------------------------------\nint ft::FaceDatasetModel::numFeatures() const\n{\n\treturn m_pFaceDataset->numFeatures();\n}\n\n// +-----------------------------------------------------------\nQPixmap ft::FaceDatasetModel::buildThumbnail(const int iIndex)\n{\n\tQPixmap oImage;\n\tFaceImage *pImage = m_pFaceDataset->getImage(iIndex);\n\tif(!pImage)\n\t\toImage = QPixmap(\":/images/imagemissing\");\n\telse\n\t{\n\t\toImage = pImage->pixMap();\n\t\tif(oImage.isNull())\n\t\t\toImage = QPixmap(\":/images/imagemissing\");\n\t}\n\n\toImage = oImage.scaled(50, 50, Qt::IgnoreAspectRatio);\n\treturn oImage;\n}\n\n// +-----------------------------------------------------------\nQt::ItemFlags ft::FaceDatasetModel::flags(const QModelIndex &oIndex) const\n{\n\tswitch(oIndex.column())\n\t{\n\t\tcase 0: // [Image Name]\n\t\t\treturn Qt::ItemIsEnabled | Qt::ItemIsSelectable;\n\n\t\tdefault:\n\t\t\treturn Qt::NoItemFlags;\n\t}\n}\n"
  },
  {
    "path": "src/facedatasetmodel.h",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef FACEDATASETMODEL_H\n#define FACEDATASETMODEL_H\n\n#include \"facedataset.h\"\n\n#include <QAbstractListModel>\n#include <QList>\n#include <QPixmap>\n\nnamespace ft\n{\n\t/**\n\t * Model class that encapsulates the access to the FaceDataset in order to provide data for\n\t * the view classes in Qt (such as QListView).\n\t */\n\tclass FaceDatasetModel : public QAbstractListModel\n\t{\n\tpublic:\n\t\t/**\n\t\t * Class constructor.\n\t\t * @param pParent Instance of a QObject with the parent of the model. Default is NULL.\n\t\t */\n\t\tFaceDatasetModel(QObject *pParent = NULL);\n\n\t\t/**\n\t\t * Virtual class destructor.\n\t\t */\n\t\tvirtual ~FaceDatasetModel();\n\n\t\t/**\n\t\t * Returns the number of rows under the given parent. When the parent is valid\n\t\t * it means that rowCount is returning the number of children of parent.\n\t\t * @param oParent A QModelIndex with the parent to be used in the query.\n\t\t * @return Integer with the number of rows under the given parent.\n\t\t */\n\t\tint rowCount(const QModelIndex &oParent = QModelIndex()) const;\n\n\t\t/**\n\t\t * Returns the number of columns for the children of the given parent.\n\t\t * @param oParent A QModelIndex with the parent to be used in the query.\n\t\t * @return Integer with the number of columns for the children of the given parent.\n\t\t */\n\t\tint columnCount(const QModelIndex &oParent = QModelIndex()) const;\n\n\t\t/**\n\t\t * Returns the data stored under the given role for the item referred to by the index.\n\t\t * @param oIndex A QModelIndex with the index of the data requested.\n\t\t * @param iRole A DispleyRole identifying the role of the data requested (the default is DisplayRole).\n\t\t * @return A QVariant with the data requested.\n\t\t */\n\t\tQVariant data(const QModelIndex &oIndex, int iRole = Qt::DisplayRole) const;\n\n\t\t/**\n\t\t * Returns the header data stored under the given section (column), for the given role.\n\t\t * @param iSection Integer with the section (column) to retrieve the header data.\n\t\t * @param eOrientation The orientation of the header (not used).\n\t\t * @param iRole A DispleyRole identifying the role of the header data requested (the default is DisplayRole).\n\t\t * @return A QVariant with the header data requested.\n\t\t */\n\t\tQVariant headerData(int iSection, Qt::Orientation eOrientation, int iRole = Qt::DisplayRole) const;\n\n\t\t/**\n\t\t * Updates the face data stored under the given role for the item referred by the index.\n\t\t * @param oIndex A QModelIndex with the index of the data to be updated.\n\t\t * param oValue A QVariant with the new value for the data under the index.\n\t\t * @param iRole A DisplayRole identifying the role of the data to be updated.\n\t\t * @return A boolean indicating if the update was successful (true) or not (false).\n\t\t */\n\t\tbool setData(const QModelIndex &oIndex, const QVariant &oValue, int iRole = Qt::EditRole);\n\n\t\t/**\n\t\t * Loads the data from the given text file in the YAML format\n\t\t * (YAML Ain't Markup Language - http://en.wikipedia.org/wiki/YAML).\n\t\t * @param sFileName QString with the name of the file to read the data from.\n\t\t * @param sMsgError QString to receive the error message in case the method fails.\n\t\t * @return Boolean indicating if the loading was successful (true) of failed (false).\n\t\t */\n\t\tbool loadFromFile(const QString &sFileName, QString &sMsgError);\n\n        /**\n         * Saves the data to the given file in the YAML format\n\t\t * (YAML Ain't Markup Language - http://en.wikipedia.org/wiki/YAML).\n         * @param sFileName QString with the name of the file to write the data to.\n\t\t * @param sMsgError QString to receive the error message in case the method fails.\n\t\t * @return Boolean indicating if the saving was successful (true) of failed (false).\n         */\n        bool saveToFile(const QString &sFileName, QString &sMsgError) const;\n\n\t\t/**\n\t\t * Adds the given images to the dataset.\n\t\t * @param lImageFiles QStringList with the list of image file names to add.\n\t\t * @return Boolean indicating if the operation was successful or not.\n\t\t */\n\t\tbool addImages(const QStringList &lImageFiles);\n\n\t\t/**\n\t\t * Removes the given images to the dataset.\n\t\t * @param lImageFiles QList with the list of image indexes to remove.\n\t\t * @return Boolean indicating if the operation was successful or not.\n\t\t */\n\t\tbool removeImages(const QList<int> &lImageIndexes);\n\n\t\t/**\n\t\t * Adds a new feature to the face dataset. A new feature is added to all\n\t\t * face images in the dataset in the same coordinates.\n\t\t * @param iID Integer with the identifier of the face feature.\n\t\t * @param x Float with the x coordinate for the face features.\n\t\t * @param y Float with the y coordinate for the face features.\n\t\t */\n\t\tvoid addFeature(int iID, float x = 0.0f, float y = 0.0f);\n\n\t\t/**\n\t\t * Removes the feature of given index in all face images.\n\t\t * @param iIndex Index of the feature to remove.\n\t\t */\n\t\tvoid removeFeature(const int iIndex);\n\n\t\t/**\n\t\t * Connects the two given features in the face dataset.\n\t\t * @param iIDSource Integer with the ID of the source feature.\n\t\t * @param iIDTarget Integer with the ID of the target feature.\n\t\t */\n\t\tvoid connectFeatures(int iIDSource, int iIDTarget);\n\n\t\t/**\n\t\t* Disconnects the two given features in the face dataset.\n\t\t* @param iIDSource Integer with the ID of the source feature.\n\t\t* @param iIDTarget Integer with the ID of the target feature.\n\t\t*/\n\t\tvoid disconnectFeatures(int iIDSource, int iIDTarget);\n\n\t\t/**\n\t\t * Gets all features in the given face image index.\n\t\t * @param iIndex Integer with the index of the face image to query.\n\t\t * @return Vector of FaceFeature instances with the face features in the image.\n\t\t */\n\t\tstd::vector<FaceFeature*> getFeatures(const int iIndex);\n\n\t\t/**\n\t\t * Queries the number of facial features in the dataset (applicable to all images).\n\t\t * @return Integer with the number of face features in the dataset.\n\t\t */\n\t\tint numFeatures() const;\n\n\tprotected:\n\n\t\t/**\n\t\t * Build a thumbnail for the given image index.\n\t\t * @param iIndex Integer with the index of the image to build the thumbnail for.\n\t\t * @return A QPixmap with the thumbmail. If the image could not be read,\n\t\t * a thumbnail of the 'image missing' is returned instead.\n\t\t */\n\t\tQPixmap buildThumbnail(const int iIndex);\n\n\t\t/**\n\t\t * Queries the display/edit flags for the given index.\n\t\t * @param oIndex A QModelIndex with the index to be queried.\n\t\t * @return A Qt::ItemFlags with the flags to be applied to the given index.\n\t\t */\n\t\tQt::ItemFlags flags(const QModelIndex &oIndex) const;\n\n\tprivate:\n\t\t/** Instance of the face annotation dataset for data access. */\n\t\tFaceDataset *m_pFaceDataset;\n\n\t\t/**\n\t\t * List of thumbnails for the existing images to improve access performance.\n\t\t * The thumbnails are related to the images in the facedataset according to their\n\t\t * indexed position.\n\t\t */\n\t\tQList<QPixmap> m_lCachedThumbnails;\n\t};\n\n}\n\n#endif //FACEDATASETMODEL_H"
  },
  {
    "path": "src/facefeature.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"facefeature.h\"\n#include <QApplication>\n#include <algorithm>\n\nusing namespace std;\n\n// +-----------------------------------------------------------\nft::FaceFeature::FaceFeature():\tQPoint()\n{\n\tsetID(-1);\n}\n\n// +-----------------------------------------------------------\nft::FaceFeature::FaceFeature(int iID, float x, float y): QPoint(x, y)\n{\n\tsetID(iID);\n}\n\n// +-----------------------------------------------------------\nint ft::FaceFeature::getID() const\n{\n\treturn m_iID;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFeature::setID(int iID)\n{\n\tm_iID = iID;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFeature::connectTo(FaceFeature *pOther)\n{\n\tvector<int>::iterator it = find(m_vConnections.begin(), m_vConnections.end(), pOther->getID());\n\tif (it == m_vConnections.end())\n\t\tm_vConnections.push_back(pOther->getID());\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFeature::disconnectFrom(FaceFeature *pOther)\n{\n\tvector<int>::iterator it = find(m_vConnections.begin(), m_vConnections.end(), pOther->getID());\n\tif (it != m_vConnections.end())\n\t\tm_vConnections.erase(it);\n}\n\n// +-----------------------------------------------------------\nstd::vector<int> ft::FaceFeature::getConnections()\n{\n\treturn m_vConnections;\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceFeature::loadFromXML(const QDomElement &oElement, QString &sMsgError)\n{\n// Check the element name\n\tif(oElement.tagName() != \"Feature\")\n\t{\n\t\tsMsgError = QString(QApplication::translate(\"FaceFeature\", \"invalid node name [%1] - expected node '%2'\").arg(oElement.tagName(), \"Feature\"));\n\t\treturn false;\n\t}\n\n\tQString sID = oElement.attribute(\"id\");\n\tif(sID == \"\")\n\t{\n\t\tsMsgError = QString(QApplication::translate(\"FaceFeature\", \"the attribute '%1' does not exist or it contains an invalid value\").arg(\"id\"));\n\t\treturn false;\n\t}\n\n\tQString sValueX = oElement.attribute(\"x\");\n\tif(sValueX == \"\")\n\t{\n\t\tsMsgError = QString(QApplication::translate(\"FaceFeature\", \"the attribute '%1' does not exist or it contains an invalid value\").arg(\"x\"));\n\t\treturn false;\n\t}\n\n\tQString sValueY = oElement.attribute(\"y\");\n\tif(sValueY == \"\")\n\t{\n\t\tsMsgError = QString(QApplication::translate(\"FaceFeature\", \"the attribute '%1' does not exist or it contains an invalid value\").arg(\"y\"));\n\t\treturn false;\n\t}\n\n\t// Connetions\n\tQDomElement oConnections = oElement.firstChildElement(\"Connections\");\n\tif (oConnections.isNull())\n\t{\n\t\tsMsgError = QString(QApplication::translate(\"FaceFeature\", \"the node '%1' does not exist\")).arg(\"Connections\");\n\t\treturn false;\n\t}\n\n\tvector<int> vConnections;\n\tfor (QDomElement oConn = oConnections.firstChildElement(); !oConn.isNull(); oConn = oConn.nextSiblingElement())\n\t{\n\t\tQString sValue = oConn.attribute(\"id\");\n\t\tif (sValue == \"\")\n\t\t{\n\t\t\tsMsgError = QString(QApplication::translate(\"FaceFeature\", \"the attribute '%1' does not exist or it contains an invalid value\").arg(\"id\"));\n\t\t\treturn false;\n\t\t}\n\n\t\tvConnections.push_back(sValue.toInt());\n\t}\n\n\tm_iID = sID.toInt();\n\tsetX(sValueX.toFloat());\n\tsetY(sValueY.toFloat());\n\tm_vConnections = vConnections;\n\t\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFeature::saveToXML(QDomElement &oParent) const\n{\n\tQDomElement oFeature = oParent.ownerDocument().createElement(\"Feature\");\n\toParent.appendChild(oFeature);\n\n\t// Save the feature attributes\n\toFeature.setAttribute(\"id\", m_iID);\n\toFeature.setAttribute(\"x\", x());\n\toFeature.setAttribute(\"y\", y());\n\n\t// Add the \"Connections\" subnode\n\tQDomElement oConnections = oParent.ownerDocument().createElement(\"Connections\");\n\toFeature.appendChild(oConnections);\n\n\t// Save all the connections\n\tQDomElement oTarget;\n\tforeach(int iID, m_vConnections)\n\t{\n\t\toTarget = oParent.ownerDocument().createElement(\"Target\");\n\t\toConnections.appendChild(oTarget);\n\t\toTarget.setAttribute(\"id\", iID);\n\t}\n}\n"
  },
  {
    "path": "src/facefeature.h",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef FACE_FEATURE_H\n#define FACE_FEATURE_H\n\n#include <QDomDocument>\n#include <vector>\n#include <QPoint>\n\nnamespace ft\n{\n\t/**\n\t * Represents the data of a facial feature in the image dataset.\n\t */\n\tclass FaceFeature : public QPoint\n    {\n\tpublic:\n\n\t\t/**\n\t\t * Class constructor.\n\t\t */\n\t\tFaceFeature();\n\n\t\t/**\n\t\t * Class constructor.\n\t\t * @param iID Integer with the feature identifier.\n\t\t * @param x Float with the x coordinate of the face feature.\n\t\t * @param y Float with the y coordinate of the face feature.\n\t\t */\n\t\tFaceFeature(int iID, float x, float y);\n\n\t\t/**\n\t\t * Getter of the feature ID.\n\t\t * @return Integer with the ID of the feature.\n\t\t */\n\t\tint getID() const;\n\n\t\t/**\n\t\t * Setter of the feature ID.\n\t\t * @param iID Integer with the new ID for the feature.\n\t\t */\n\t\tvoid setID(int iID);\n\n\t\t/**\n\t\t * Connects this feature to the feature of given ID.\n\t\t * @param *pOther Pointer to the other feature to connect to.\n\t\t */\n\t\tvoid connectTo(FaceFeature *pOther);\n\n\t\t/**\n\t\t* Disconnects this feature from the feature of given ID.\n\t\t* @param pOther Pointer to the other feature to disconnect from.\n\t\t*/\n\t\tvoid disconnectFrom(FaceFeature *pOther);\n\n\t\t/**\n\t\t * Gets the list of features (by their IDs) to which this feature is connected to.\n\t\t * @return Std vector with a list of integers (the connected features' IDs).\n\t\t */\n\t\tstd::vector<int> getConnections();\n\n\t\t/**\n\t\t * Loads (unserializes) the face feature data from the given xml element.\n\t\t * @param oElement QDomElement from where to read the feature data (the feature node in the xml).\n\t\t * @param sMsgError QString to receive the error message in case the method fails.\n\t\t * @return Boolean indicating if the loading was successful (true) or if it failed (false).\n\t\t */\n\t\tbool loadFromXML(const QDomElement &oElement, QString &sMsgError);\n\n        /**\n         * Saves the face feature data into the given xml element.\n\t\t * @param oParent QDomElement to receive the node of the face feature data.\n         */\n        void saveToXML(QDomElement &oParent) const;\n\n\tprivate:\n\n\t\t/** Identifier of the face feature. */\n\t\tint m_iID;\n\n\t\t/** List of other features to which this feature is connected to. */\n\t\tstd::vector<int> m_vConnections;\n    };\n}\n\n#endif // FACE_FEATURE_H"
  },
  {
    "path": "src/facefeatureedge.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"facefeatureedge.h\"\n#include \"facewidget.h\"\n#include \"facefeaturenode.h\"\n\n#include <math.h>\n\n#include <QPainter>\n#include <QGraphicsScene>\n#include <QGraphicsSceneMouseEvent>\n\n// +-----------------------------------------------------------\nft::FaceFeatureEdge::FaceFeatureEdge(FaceWidget *pFaceWidget, FaceFeatureNode *pSourceNode, FaceFeatureNode *pTargetNode)\n{\n\tm_pFaceWidget = pFaceWidget;\n\n    setAcceptedMouseButtons(0);\n\n    m_pSourceNode = pSourceNode;\n    m_pTargetNode = pTargetNode;\n\n    m_pTargetNode->addEdge(this);\n    m_pSourceNode->addEdge(this);\n\n    adjust();\n}\n\n// +-----------------------------------------------------------\nft::FaceFeatureNode* ft::FaceFeatureEdge::sourceNode() const\n{\n    return m_pSourceNode;\n}\n\n// +-----------------------------------------------------------\nft::FaceFeatureNode* ft::FaceFeatureEdge::targetNode() const\n{\n    return m_pTargetNode;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFeatureEdge::adjust()\n{\n    if (!m_pSourceNode || !m_pTargetNode)\n        return;\n\n    QLineF line(mapFromItem(m_pSourceNode, 0, 0), mapFromItem(m_pTargetNode, 0, 0));\n    qreal length = line.length();\n\n    prepareGeometryChange();\n\n    QPointF edgeOffset((line.dx() * FaceFeatureNode::RADIUS) / length, (line.dy() * FaceFeatureNode::RADIUS) / length);\n\tm_oSourcePoint = line.p1() + edgeOffset;\n    m_oTargetPoint = line.p2() - edgeOffset;\n}\n\n// +-----------------------------------------------------------\nQRectF ft::FaceFeatureEdge::boundingRect() const\n{\n    if (!m_pSourceNode || !m_pTargetNode)\n        return QRectF();\n\n    QRectF oRet = QRectF(m_oSourcePoint, QSizeF(m_oTargetPoint.x() - m_oSourcePoint.x(), m_oTargetPoint.y() - m_oSourcePoint.y()));\n\treturn oRet.normalized();\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFeatureEdge::paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget *pWidget)\n{\n\tQ_UNUSED(pOption);\n\tQ_UNUSED(pWidget);\n    if (!m_pSourceNode || !m_pTargetNode)\n        return;\n\n    QLineF oLine(m_oSourcePoint, m_oTargetPoint);\n    pPainter->setPen(QPen(Qt::yellow, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));\n    pPainter->drawLine(oLine);\n}"
  },
  {
    "path": "src/facefeatureedge.h",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef FACEFEATUREEDGE_H\n#define FACEFEATUREEDGE_H\n\n#include <QGraphicsItem>\n\nnamespace ft\n{\n\tclass FaceWidget;\n\tclass FaceFeatureNode;\n\n\t/**\n\t * Implements the edges connecting two FaceFeatures.\n\t */ \n\tclass FaceFeatureEdge : public QGraphicsItem\n\t{\n\tpublic:\n\t\t/**\n\t\t * Class constructor.\n\t\t * @param pFaceWidget Instance of the FaceWidget to be the parent of the face feature edge.\n\t\t * @param pSourceFeat Instance of the FaceFeatureNode that acts as the first point of the edge.\n\t\t * @param pTargetNode Instance of the FaceFeatureNode that acts as the second point of the edge.\n\t\t */\n\t\tFaceFeatureEdge(FaceWidget *pFaceWidget, FaceFeatureNode *pSourceNode, FaceFeatureNode *pTargetNode);\n\n\t\t/**\n\t\t * Gets the first point of the edge.\n\t\t * @return An instance of FaceFeatureNode with the first point of the edge.\n\t\t */\n\t\tFaceFeatureNode *sourceNode() const;\n\n\t\t/**\n\t\t * Gets the second point of the edge.\n\t\t * @return An instance of FaceFeatureNode with the second point of the edge.\n\t\t */\n\t\tFaceFeatureNode *targetNode() const;\n\n\t\t/**\n\t\t * Forces the edge to adjust its coordinates based on the first (source) and second (target) face feature nodes.\n\t\t */\n\t\tvoid adjust();\n\n\tprotected:\n\n\t\t/**\n\t\t * Queries the bounding rectangle of the face feature edge.\n\t\t * @return A QRectF with the coordinates and size of the bounding rect of the edge.\n\t\t */\n\t\tQRectF boundingRect() const Q_DECL_OVERRIDE;\n\n\t\t/**\n\t\t * Paint method for the face feature edge.\n\t\t * @param pPainter Instance of a QPainter to allow drawing the edge.\n\t\t * @param pOption Instance of a QStyleOptionGraphicsItem with information on the style and state of the edge.\n\t\t * @param pWidget Instance of a QWidget with the widget that the edge is being painted on. Optional, and might be 0.\n\t\t */\n\t\tvoid paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget *pWidget) Q_DECL_OVERRIDE;\n\n\tprivate:\n\n\t\t/** Reference to the parent face widget. */\n\t\tFaceWidget *m_pFaceWidget;\n\n\t\t/** The first (source) face feature node of the edge. */\n\t\tFaceFeatureNode *m_pSourceNode;\n\n\t\t/** The second (target) face feature node of the edge. */\n\t\tFaceFeatureNode *m_pTargetNode;\n\n\t\t/** Starting point for the face feature edge. */\n\t\tQPointF m_oSourcePoint;\n\n\t\t/** Ending point for the face feature edge. */\n\t\tQPointF m_oTargetPoint;\n\t};\n};\n\n#endif // FACEFEATUREEDGE_H\n"
  },
  {
    "path": "src/facefeaturenode.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"facefeaturenode.h\"\n#include \"facewidget.h\"\n#include \"facefeatureedge.h\"\n#include \"application.h\"\n\n#include <QGraphicsScene>\n#include <QGraphicsSceneMouseEvent>\n#include <QPainter>\n\n// Radius of the drawn node, in pixels\nconst int ft::FaceFeatureNode::RADIUS = 4;\n\n// +-----------------------------------------------------------\nft::FaceFeatureNode::FaceFeatureNode(int iID, FaceWidget *pFaceWidget)\n{\n\tm_pFaceWidget = pFaceWidget;\n\n    setFlag(ItemIsMovable);\n    setFlag(ItemSendsGeometryChanges);\n\tsetFlag(ItemIsSelectable);\n    setCacheMode(DeviceCoordinateCache);\n\n\tsetSelected(false);\n\tsetAcceptHoverEvents(true);\n\n\tm_iID = iID;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFeatureNode::addEdge(FaceFeatureEdge *pEdge)\n{\n\tm_lEdges.append(pEdge);\n    pEdge->adjust();\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFeatureNode::removeEdge(FaceFeatureEdge *pEdge)\n{\n\tm_lEdges.removeOne(pEdge);\n}\n\n// +-----------------------------------------------------------\nQList<ft::FaceFeatureEdge *> ft::FaceFeatureNode::edges() const\n{\n    return m_lEdges;\n}\n\n// +-----------------------------------------------------------\nft::FaceFeatureEdge *ft::FaceFeatureNode::getEdgeTo(const FaceFeatureNode *pNode) const\n{\n\tforeach(FaceFeatureEdge *pEdge, m_lEdges)\n\t{\n\t\tif((pEdge->sourceNode() == this && pEdge->targetNode() == pNode) ||\n\t\t   (pEdge->sourceNode() == pNode && pEdge->targetNode() == this))\n\t\t{\n\t\t\treturn pEdge;\n\t\t}\n\t}\n\treturn NULL;\n}\n\n// +-----------------------------------------------------------\nQRectF ft::FaceFeatureNode::boundingRect() const\n{\n\tif(m_pFaceWidget->displayFeatureIDs())\n\t{\n\t\tQString sID = QString::number(m_iID);\n\t\tint iHeight = m_pFaceWidget->fontMetrics().height();\n\t\tint iWidth = m_pFaceWidget->fontMetrics().width(sID);\n\t\treturn QRectF(-(iWidth + RADIUS), -(iHeight + RADIUS), 2 * RADIUS + iWidth, 2 * RADIUS + iHeight);\n\t}\n\telse\n\t\treturn QRectF(-RADIUS, -RADIUS, 2 * RADIUS, 2 * RADIUS);\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFeatureNode::paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget *pWidget)\n{\n\tQ_UNUSED(pOption);\n\tQ_UNUSED(pWidget);\n\n\tQBrush oBrush;\n\toBrush.setStyle(Qt::SolidPattern);\n\tif(isSelected())\n\t{\n\t    pPainter->setPen(QPen(Qt::red, 0));\n\t\toBrush.setColor(QColor(Qt::red));\n\t}\n\telse\n\t{\n\t    pPainter->setPen(QPen(Qt::yellow, 0));\n\t\toBrush.setColor(QColor(Qt::yellow));\n\t}\n\n\tQRectF oBounds;\n\tif(m_pFaceWidget->displayFeatureIDs())\n\t{\n\t\tQString sID = QString::number(m_iID);\n\t\tint iHeight = m_pFaceWidget->fontMetrics().height();\n\t\tint iWidth = m_pFaceWidget->fontMetrics().width(sID);\n\t\toBounds = QRectF(-(iWidth + RADIUS), -(iHeight + RADIUS), iWidth, iHeight);\n\t\tpPainter->drawText(oBounds, sID);\n\n\t\toBounds = QRectF(-RADIUS, -RADIUS, 2 * RADIUS, 2 * RADIUS);\n\t}\n\telse\n\t\toBounds = boundingRect();\n\n    pPainter->setBrush(oBrush);\n\tpPainter->drawEllipse(oBounds);\n}\n\n// +-----------------------------------------------------------\nQVariant ft::FaceFeatureNode::itemChange(GraphicsItemChange eChange, const QVariant &oValue)\n{\n\tQString sText;\n    switch(eChange)\n\t{\n\t\tcase ItemPositionHasChanged:\n\t\t\tforeach(FaceFeatureEdge *pEdge, m_lEdges)\n\t\t\t\tpEdge->adjust();\n\n\t\t\tsText = QApplication::translate(\"FaceFeatureNode\", \"Node: %1 Position: (%2, %3)\").arg(m_iID).arg(QString::number(pos().x(), 'f', 2)).arg(QString::number(pos().y(), 'f', 2));\n\t\t\tFtApplication::instance()->showStatusMessage(sText, 0);\n\n\t\t\tif(!data(0).toBool()) // This flag is used in ChildWindow::refreshFeaturesInWidget\n\t\t\t\tm_pFaceWidget->faceFeatureMoved(this);\n\t\t\tbreak;\n\t\n\t\tdefault:\n\t\t\tbreak;\n    };\n\n    return QGraphicsItem::itemChange(eChange, oValue);\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFeatureNode::hoverEnterEvent(QGraphicsSceneHoverEvent *pEvent)\n{\n\tQString sText = QApplication::translate(\"FaceFeatureNode\", \"Node: %1 Position: (%2, %3)\").arg(m_iID).arg(QString::number(pos().x(), 'f', 2)).arg(QString::number(pos().y(), 'f', 2));\n\tFtApplication::instance()->showStatusMessage(sText, 0);\n\tQGraphicsItem::hoverEnterEvent(pEvent);\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFeatureNode::hoverLeaveEvent(QGraphicsSceneHoverEvent *pEvent)\n{\n\tFtApplication::instance()->showStatusMessage(\"\");\n\tQGraphicsItem::hoverLeaveEvent(pEvent);\n}\n\n// +-----------------------------------------------------------\nint ft::FaceFeatureNode::getID() const\n{\n\treturn m_iID;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFeatureNode::setID(int iID)\n{\n\tm_iID = iID;\n}"
  },
  {
    "path": "src/facefeaturenode.h",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef FACEFEATURENODE_H\n#define FACEFEATURENODE_H\n\n#include <QGraphicsItem>\n#include <QList>\n\nnamespace ft\n{\n\tclass FaceWidget;\n\tclass FaceFeatureEdge;\n\n\t/**\n\t * Implements the visual manipulator of facial feature nodes to be used together with the FaceWidget.\n\t */\n\tclass FaceFeatureNode: public QGraphicsItem\n\t{\n\tpublic:\n\t\t/**\n\t\t * Class constructor.\n\t\t * @param iID Integer with the ID of the feature node.\n\t\t * @param pFaceWidget Instance of the FaceWidget to be the parent of the face feature node.\n\t\t */\n\t\tFaceFeatureNode(int iID, FaceWidget *pFaceWidget);\n\n\t\t/**\n\t\t * Adds a new edge to the face feature node.\n\t\t * @param pEdge Instance of the FaceFeatureEdge to be added to the face feature.\n\t\t */\n\t\tvoid addEdge(FaceFeatureEdge *pEdge);\n\n\t\t/**\n\t\t * Removes an existing edge from the face feature node.\n\t\t * @param pEdge Instance of the FaceFeatureEdge to be removed from the face feature.\n\t\t */\n\t\tvoid removeEdge(FaceFeatureEdge *pEdge);\n\n\t\t/**\n\t\t * Queries the list of face feature edges connected to this node.\n\t\t * @return Q QList<FaceFeatureEdge*> with the list of edges connected to this node.\n\t\t */\n\t\tQList<FaceFeatureEdge *> edges() const;\n\n\t\t/**\n\t\t * Queries the edge that connects this node to the given node.\n\t\t * @param pNode Instance of the other FaceFeatureNode that might be connected to this node.\n\t\t * @return An instance of the FaceFeatureEdge with the edge connecting the two nodes, or NULL\n\t\t * if there is no edge connecting the nodes.\n\t\t */\n\t\tFaceFeatureEdge *getEdgeTo(const FaceFeatureNode *pNode) const;\n\n\t\t/**\n\t\t * Queries the bounding rectangle of the face feature node.\n\t\t * @return A QRectF with the coordinates and size of the bounding rect of the node.\n\t\t */\n\t\tQRectF boundingRect() const Q_DECL_OVERRIDE;\n\n\t\t/**\n\t\t * Gets the identifier of the feature node.\n\t\t */\n\t\tint getID() const;\n\n\t\t/**\n\t\t * Updates the identifier of the feature node.\n\t\t * @param iID Integer with the new identifier for the feature node.\n\t\t */\n\t\tvoid setID(int iID);\n\n\tpublic:\n\n\t\t/** Constant with the radius of the node drawn, in pixels. */\n\t\tconst static int RADIUS;\n\n\tprotected:\n\n\t\t/**\n\t\t * Paint method for the face feature node.\n\t\t * @param pPainter Instance of a QPainter to allow drawing the node.\n\t\t * @param pOption Instance of a QStyleOptionGraphicsItem with information on the style and state of the node.\n\t\t * @param pWidget Instance of a QWidget with the widget that the node is being painted on. Optional, and might be 0.\n\t\t */\n\t\tvoid paint(QPainter *pPainter, const QStyleOptionGraphicsItem *pOption, QWidget *pWidget) Q_DECL_OVERRIDE;\n\n\t\t/**\n\t\t * Captures the event of changes in the node.\n\t\t * @param eChange GraphicsItemChange enumeration value indicating what is the change.\n\t\t * @param oValue QVariant const reference with the value that changed.\n\t\t */\n\t\tQVariant itemChange(GraphicsItemChange eChange, const QVariant &oValue) Q_DECL_OVERRIDE;\n\n\t\t/**\n\t\t * Captures the mouse enter event on the feature node.\n\t\t * @param pEvent Instance of a QGraphicsSceneHoverEvent with the event data.\n\t\t */\n\t\tvoid hoverEnterEvent(QGraphicsSceneHoverEvent *pEvent) Q_DECL_OVERRIDE;\n\n\t\t/**\n\t\t * Captures the mouse exit event on the feature node.\n\t\t * @param pEvent Instance of a QGraphicsSceneHoverEvent with the event data.\n\t\t */\n\t\tvoid hoverLeaveEvent(QGraphicsSceneHoverEvent *pEvent) Q_DECL_OVERRIDE;\n\n\tprivate:\n\n\t\t/** Reference to the parent face widget. */\n\t\tFaceWidget *m_pFaceWidget;\n\n\t\t/** List of edges added to the node. */\n\t\tQList<FaceFeatureEdge *> m_lEdges;\n\n\t\t/** Identifier of the face feature node. */\n\t\tint m_iID;\n\t};\n};\n\n#endif // FACEFEATURENODE_H\n"
  },
  {
    "path": "src/facefitconfig.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"facefitconfig.h\"\n#include \"ui_facefitconfig.h\"\n#include <QFileDialog>\n#include <QPushButton>\n#include <QFileInfo>\n#include <QMessageBox>\n\n// +-----------------------------------------------------------\nft::FaceFitConfig::FaceFitConfig(QWidget *pParent) :\n\tQDialog(pParent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint),\n\tui(new Ui::FaceFitConfig)\n{\n    ui->setupUi(this);\n\tsetFixedSize(size());\n\tconnect(ui->pathButton, SIGNAL(clicked()), this, SLOT(on_actionSelectPath_triggered()));\n\tconnect(ui->pathEdit, SIGNAL(textChanged(QString)), this, SLOT(onPathChanged(QString)));\n\tconnect(ui->buttonBox, SIGNAL(helpRequested()), this, SLOT(onShowHelp()));\n\tonPathChanged(ui->pathEdit->text());\n}\n\n// +-----------------------------------------------------------\nft::FaceFitConfig::~FaceFitConfig()\n{\n    delete ui;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFitConfig::onPathChanged(QString sFilePath)\n{\n\tbool bEnabled = sFilePath.length() > 0 && QFileInfo(sFilePath).exists();\n\tui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(bEnabled);\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFitConfig::onShowHelp()\n{\n\tQMessageBox::information(this, tr(\"Help on the face-fit utility\"), tr(\"The <code>face-fit</code> utility is an external executable that can be used to automatically adjust facial landmarks to an image of a human face. It is part of the <a href='http://face.ci2cv.net/'>CSIRO Face Analysis SDK</a>.\"), QMessageBox::Ok);\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceFitConfig::on_actionSelectPath_triggered()\n{\n\tQString sFile = QFileDialog::getOpenFileName(this, tr(\"Select face-fit executable...\"), NULL, tr(\"All files (*.*)\"));\n\tif (sFile.length())\n\t\tui->pathEdit->setText(sFile);\n}\n\n// +-----------------------------------------------------------\nQString ft::FaceFitConfig::getFaceFitPath()\n{\n\treturn ui->pathEdit->text();\n}"
  },
  {
    "path": "src/facefitconfig.h",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef FACEFITCONFIG_H\n#define FACEFITCONFIG_H\n\n#include <QDialog>\n\nnamespace Ui\n{\n    class FaceFitConfig;\n}\n\nnamespace ft\n{\n    /**\n     * Form class used to display the configuration window for the face fit utility.\n     */\n    class FaceFitConfig : public QDialog\n    {\n        Q_OBJECT\n\n    public:\n        /**\n         * Class constructor.\n         * @param pParent QWidget with the window parent.\n         */\n        explicit FaceFitConfig(QWidget *pParent = 0);\n\n        /**\n         * Class destructor\n         */\n        virtual ~FaceFitConfig();\n\n\t\t/**\n\t\t * Gets the configured path for the face-fit utility.\n\t\t * @param QString with the path of the face-fit utility.\n\t\t */\n\t\tQString getFaceFitPath();\n\n\tprivate slots:\n\t\t/**\n\t\t* Slot for the Select Path event.\n\t\t*/\n\t\tvoid on_actionSelectPath_triggered();\n\n\t\t/**\n\t\t * Slot to handle changes in the path line editor.\n\t\t * @param sFilePath QString with the newly editted utility path.\n\t\t */\n\t\tvoid onPathChanged(QString sFilePath);\n\n\t\t/**\n\t\t* Slot to handle the request for help.\n\t\t*/\n\t\tvoid onShowHelp();\n\n    private:\n        /** Instance of the ui for GUI element access. */\n        Ui::FaceFitConfig *ui;\n    };\n}\n\n#endif // FACEFITCONFIG_H"
  },
  {
    "path": "src/facefitconfig.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>FaceFitConfig</class>\n <widget class=\"QDialog\" name=\"FaceFitConfig\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>391</width>\n    <height>76</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>Configuration of the face-fit utility</string>\n  </property>\n  <property name=\"locale\">\n   <locale language=\"English\" country=\"UnitedKingdom\"/>\n  </property>\n  <layout class=\"QVBoxLayout\" name=\"verticalLayout\">\n   <item>\n    <layout class=\"QHBoxLayout\" name=\"horizontalLayout\">\n     <property name=\"sizeConstraint\">\n      <enum>QLayout::SetMinimumSize</enum>\n     </property>\n     <item>\n      <widget class=\"QLabel\" name=\"label\">\n       <property name=\"text\">\n        <string>Path to the face-fit utility:</string>\n       </property>\n      </widget>\n     </item>\n     <item>\n      <layout class=\"QHBoxLayout\" name=\"horizontalLayout_2\">\n       <property name=\"spacing\">\n        <number>0</number>\n       </property>\n       <property name=\"sizeConstraint\">\n        <enum>QLayout::SetMinimumSize</enum>\n       </property>\n       <item>\n        <widget class=\"QLineEdit\" name=\"pathEdit\"/>\n       </item>\n       <item>\n        <widget class=\"QToolButton\" name=\"pathButton\">\n         <property name=\"text\">\n          <string>...</string>\n         </property>\n        </widget>\n       </item>\n      </layout>\n     </item>\n    </layout>\n   </item>\n   <item>\n    <widget class=\"QDialogButtonBox\" name=\"buttonBox\">\n     <property name=\"orientation\">\n      <enum>Qt::Horizontal</enum>\n     </property>\n     <property name=\"standardButtons\">\n      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>\n     </property>\n    </widget>\n   </item>\n  </layout>\n </widget>\n <resources/>\n <connections>\n  <connection>\n   <sender>buttonBox</sender>\n   <signal>accepted()</signal>\n   <receiver>FaceFitConfig</receiver>\n   <slot>accept()</slot>\n   <hints>\n    <hint type=\"sourcelabel\">\n     <x>248</x>\n     <y>254</y>\n    </hint>\n    <hint type=\"destinationlabel\">\n     <x>157</x>\n     <y>274</y>\n    </hint>\n   </hints>\n  </connection>\n  <connection>\n   <sender>buttonBox</sender>\n   <signal>rejected()</signal>\n   <receiver>FaceFitConfig</receiver>\n   <slot>reject()</slot>\n   <hints>\n    <hint type=\"sourcelabel\">\n     <x>195</x>\n     <y>55</y>\n    </hint>\n    <hint type=\"destinationlabel\">\n     <x>195</x>\n     <y>37</y>\n    </hint>\n   </hints>\n  </connection>\n </connections>\n</ui>\n"
  },
  {
    "path": "src/faceimage.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"faceimage.h\"\n\n#include <QApplication>\n\nusing namespace std;\n\n// +-----------------------------------------------------------\nft::FaceImage::FaceImage(const QString &sFileName)\n{\n\tm_sFileName = sFileName;\n}\n\n// +-----------------------------------------------------------\nft::FaceImage::~FaceImage()\n{\n\tclear();\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceImage::clear()\n{\n\tforeach(FaceFeature *pFeature, m_vFeatures)\n\t\tdelete pFeature;\n\tforeach(FaceFeatureEdge *pEdge, m_vConnections)\n\t\tdelete pEdge;\n\tm_vFeatures.clear();\n\tm_vConnections.clear();\n}\n\n// +-----------------------------------------------------------\nQString ft::FaceImage::fileName() const\n{\n\treturn m_sFileName;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceImage::setFileName(QString sFileName)\n{\n\tm_sFileName = sFileName;\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceImage::loadFromXML(const QDomElement &oElement, QString &sMsgError, int iNumExpectedFeatures)\n{\n\t// Check the element name\n\tif(oElement.tagName() != \"Sample\")\n\t{\n\t\tsMsgError = QString(QApplication::translate(\"FaceImage\", \"invalid node name [%1] - expected node '%2'\").arg(oElement.tagName(), \"Sample\"));\n\t\treturn false;\n\t}\n\n\t// Read the file name\n\tQString sFile = oElement.attribute(\"fileName\");\n\tif(sFile == \"\")\n\t{\n\t\tsMsgError = QString(QApplication::translate(\"FaceImage\", \"the attribute '%1' does not exist or it contains an invalid value\").arg(\"fileName\"));\n\t\treturn false;\n\t}\n\n\t// Read the face features\n\t// Sample images\n\tQDomElement oFeatures = oElement.firstChildElement(\"Features\");\n\tif(oFeatures.isNull() || oFeatures.childNodes().count() != iNumExpectedFeatures)\n\t{\n\t\tsMsgError = QString(QApplication::translate(\"FaceImage\", \"the node '%1' does not exist or it contains less children nodes than expected\").arg(\"Features\"));\n\t\treturn false;\n\t}\n\n\tvector<FaceFeature*> vFeatures;\n\tfor(QDomElement oElement = oFeatures.firstChildElement(); !oElement.isNull(); oElement = oElement.nextSiblingElement())\n\t{\n\t\tFaceFeature *pFeature = new FaceFeature();\n\t\tif(!pFeature->loadFromXML(oElement, sMsgError))\n\t\t{\n\t\t\tforeach(FaceFeature *pFeat, vFeatures)\n\t\t\t\tdelete(pFeat);\n\t\t\tdelete pFeature;\n\n\t\t\treturn false;\n\t\t}\n\t\tvFeatures.push_back(pFeature);\n\t}\n\n\tclear();\n\tm_sFileName = sFile;\n\tm_vFeatures = vFeatures;\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceImage::saveToXML(QDomElement &oParent) const\n{\n\t// Add the \"Sample\" node\n\tQDomElement oSample = oParent.ownerDocument().createElement(\"Sample\");\n\toParent.appendChild(oSample);\n\n\t// Define it's attributes\n\toSample.setAttribute(\"fileName\", m_sFileName);\n\n\t// Add the \"Features\" subnode\n\tQDomElement oFeatures = oParent.ownerDocument().createElement(\"Features\");\n\toSample.appendChild(oFeatures);\n\n\t// Add the nodes for the features\n\tforeach(FaceFeature *pFeat, m_vFeatures)\n\t\tpFeat->saveToXML(oFeatures);\n}\n\n// +-----------------------------------------------------------\nQPixmap ft::FaceImage::pixMap() const\n{\n\tQPixmap oRet;\n\toRet.load(m_sFileName);\n\treturn oRet;\n}\n\n// +-----------------------------------------------------------\nft::FaceFeature* ft::FaceImage::addFeature(int iID, float x, float y)\n{\n\tFaceFeature *pFeat = new FaceFeature(iID, x, y);\n\tm_vFeatures.push_back(pFeat);\n\treturn pFeat;\n}\n\n// +-----------------------------------------------------------\nft::FaceFeature* ft::FaceImage::getFeature(const int iIndex) const\n{\n\tif(iIndex < 0 || iIndex >= (int) m_vFeatures.size())\n\t\treturn NULL;\n\treturn m_vFeatures[iIndex];\n}\n\n// +-----------------------------------------------------------\nstd::vector<ft::FaceFeature*> ft::FaceImage::getFeatures() const\n{\n\treturn m_vFeatures;\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceImage::removeFeature(const int iIndex)\n{\n\tif(iIndex < 0 || iIndex >= (int) m_vFeatures.size())\n\t\treturn false;\n\n\tFaceFeature *pFeat = m_vFeatures[iIndex];\n\tm_vFeatures.erase(m_vFeatures.begin() + iIndex);\n\tdelete pFeat;\n\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceImage::connectFeatures(int iIDSource, int iIDTarget)\n{\n\tif (iIDSource < 0 || iIDSource >= (int)m_vFeatures.size())\n\t\treturn false;\n\tif (iIDTarget < 0 || iIDTarget >= (int)m_vFeatures.size())\n\t\treturn false;\n\n\tFaceFeature *pSource = m_vFeatures[iIDSource];\n\tFaceFeature *pTarget = m_vFeatures[iIDTarget];\n\tpSource->connectTo(pTarget);\n\treturn true;\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceImage::disconnectFeatures(int iIDSource, int iIDTarget)\n{\n\tif (iIDSource < 0 || iIDSource >= (int)m_vFeatures.size())\n\t\treturn false;\n\tif (iIDTarget < 0 || iIDTarget >= (int)m_vFeatures.size())\n\t\treturn false;\n\n\tFaceFeature *pSource = m_vFeatures[iIDSource];\n\tFaceFeature *pTarget = m_vFeatures[iIDTarget];\n\tpSource->disconnectFrom(pTarget);\n\treturn true;\n}"
  },
  {
    "path": "src/faceimage.h",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef FACE_IMAGE_H\n#define FACE_IMAGE_H\n\n#include \"facefeature.h\"\n#include \"facefeatureedge.h\"\n\n#include <QString>\n#include <QPixmap>\n#include <QDomDocument>\n\n#include <vector>\n#include <string>\n\nnamespace ft\n{\n\t/**\n\t * Represents the data from one facial image sample in the image dataset, including its\n     * annotations (facial features, their connections, and the face emotional label).\n\t */\n\tclass FaceImage\n    {\n\tpublic:\n\t\t/**\n\t\t * Class constructor.\n\t\t * @param sFileName String with the file name of the face image. If defined as empty in the\n\t\t * constructor, it can only be later updated by reading from a file.\n\t\t */\n\t\tFaceImage(const QString &sFileName = QString());\n\n\t\t/**\n\t\t * Class destructor.\n\t\t */\n\t\tvirtual ~FaceImage();\n\n\t\t/**\n\t\t * Gets the file name of the face image.\n\t\t * @return QString with the complete file name of the face image.\n\t\t */\n\t\tQString fileName() const;\n\n\t\t/**\n\t\t * Sets the file name of the face image.\n\t\t * @param sFileName QString with the new file name for the face image.\n\t\t */\n\t\tvoid setFileName(QString sFileName);\n\n\t\t/**\n\t\t * Adds a new face feature to the face image.\n\t\t * @param iID Integer with the ID of the face feature.\n\t\t * @param x Float with the x coordinate of the face feature.\n\t\t * @param y Float with the y coordinate of the face feature.\n\t\t * @return Instance of a FaceFeature with the new feature created.\n\t\t */\n\t\tFaceFeature *addFeature(int iID, float x = 0.0f, float y = 0.0f);\n\n\t\t/**\n\t\t * Gets the face feature at the given index.\n\t\t * @param iIndex Integer with the index of the feature to be obtained.\n\t\t * @return Instance of the face feature at the index or NULL if the index \n\t\t * is out of bounds.\n\t\t */\n\t\tFaceFeature *getFeature(const int iIndex) const;\n\n\t\t/**\n\t\t * Gets all face features in the image.\n\t\t * @return Vector with all instances of face features in the image.\n\t\t */\n\t\tstd::vector<FaceFeature*> getFeatures() const;\n\n\t\t/**\n\t\t * Removes the face feature at the given index.\n\t\t * @param iIndex Integer with the index of the feature to be removed.\n\t\t * @return Boolean indicating if the face feature was successfully\n\t\t * removed (true) or not (false).\n\t\t */\n\t\tbool removeFeature(const int iIndex);\n\n\t\t/**\n\t\t* Connects the two given features.\n\t\t* @param iIDSource Integer with the ID (index) of the source feature.\n\t\t* @param iIDTarget Integer with the ID (index) of the target feature.\n\t\t* @return Boolean indicating if the connection was successfully created.\n\t\t*/\n\t\tbool connectFeatures(int iIDSource, int iIDTarget);\n\n\t\t/**\n\t\t* Disconnects the two given features.\n\t\t* @param iIDSource Integer with the ID (index) of the source feature.\n\t\t* @param iIDTarget Integer with the ID (index) of the target feature.\n\t\t* @return Boolean indicating if the connection was successfully removed.\n\t\t*/\n\t\tbool disconnectFeatures(int iIDSource, int iIDTarget);\n\n\t\t/**\n\t\t * Loads (unserializes) the face image data from the given xml element.\n\t\t * @param oElement QDomElement from where to read the image data (the image node in the xml).\n\t\t * @param sMsgError QString to receive the error message in case the method fails.\n\t\t * @param iNumExpectedFeatures Integer with the number of expected features.\n\t\t * @return Boolean indicating if the loading was successful (true) or if it failed (false).\n\t\t */\n\t\tbool loadFromXML(const QDomElement &oElement, QString &sMsgError, int iNumExpectedFeatures);\n\n        /**\n         * Saves the face image data into the given xml element.\n\t\t * @param oParent Parent QDomElement to receive the new node of the face image data.\n         */\n        void saveToXML(QDomElement &oParent) const;\n\n\t\t/**\n\t\t * Loads and returns the image data as a Qt's QPixmap. If an error occur during the loading of\n\t\t * the file, an empty QPixmap is returned instead (that can be checked with QPixmap::isNull()).\n\t\t * @return A QPixmap with the image data, or an empty QPixmap if an error ocurred.\n\t\t */\n\t\tQPixmap pixMap() const;\n\n\tprotected:\n\n\t\t/**\n\t\t * Clears the internal data (like face features).\n\t\t */\n\t\tvoid clear();\n\n\tprivate:\n\n\t\t/** Name of the file with the face image. */\n\t\tQString m_sFileName;\n\n\t\t/** Vector of the face features in this face image. */\n\t\tstd::vector<FaceFeature*> m_vFeatures;\n\n\t\t/** Vector of the connections between face features in this face image. */\n\t\tstd::vector<FaceFeatureEdge*> m_vConnections;\n    };\n}\n\n#endif // FACE_IMAGE_H"
  },
  {
    "path": "src/facewidget.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"facewidget.h\"\n#include \"facewidgetscene.h\"\n\n#include <QApplication>\n#include <QPixmap>\n#include <QGraphicsEffect>\n#include <QScrollBar>\n#include <QtMath>\n#include <QGraphicsSceneMouseEvent>\n\n// Scale values for zoom in and out steps\nconst double ft::FaceWidget::ZOOM_IN_STEP = 1.25;\nconst double ft::FaceWidget::ZOOM_OUT_STEP = 0.80;\n\n// Number of face features edited by the widget\nconst int ft::FaceWidget::NUM_FACE_FEATURES = 68;\n\n// +-----------------------------------------------------------\nft::FaceWidget::FaceWidget(QWidget *pParent) : QGraphicsView(pParent)\n{\n\tsetDragMode(RubberBandDrag);\n\n\tm_pScene = (QGraphicsScene*) new FaceWidgetScene(this);\n\tm_pScene->setItemIndexMethod(QGraphicsScene::NoIndex);\n\tsetScene(m_pScene);\n\tconnect(m_pScene, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));\n\n\tsetCacheMode(CacheBackground);\n    setViewportUpdateMode(BoundingRectViewportUpdate);\n    setRenderHint(QPainter::Antialiasing);\n    setTransformationAnchor(AnchorUnderMouse);\n\n    scale(1.0, 1.0);\n\tm_dScaleFactor = 1.0;\n\n\tsetBackgroundBrush(QApplication::palette().dark());\n\n\t// Add the image item\n\tQPixmap oPixmap(\":/images/noface\");\n\tm_pPixmapItem = m_pScene->addPixmap(oPixmap);\n\tm_pPixmapItem->setShapeMode(QGraphicsPixmapItem::BoundingRectShape);\n\tm_pScene->setSceneRect(0, 0, oPixmap.width(), oPixmap.height());\n\n\t// Setup the face features editor\n\tm_bDisplayFaceFeatures = true;\n\tm_bDisplayConnections = true;\n\tm_bDisplayFeatureIDs = false;\n\n\tm_pContextMenu = NULL;\n\n\t//createFaceFeatures();\n\tm_bFeaturesMoved = false;\n\tm_bSelectionChanged = false;\n}\n\n// +-----------------------------------------------------------\nft::FaceWidget::~FaceWidget()\n{\n\tdelete m_pScene;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::setPixmap(const QPixmap &oPixmap)\n{\n\tm_pPixmapItem->setPixmap(oPixmap);\n\tm_pScene->setSceneRect(0, 0, oPixmap.width(), oPixmap.height());\n}\n\n// +-----------------------------------------------------------\ndouble ft::FaceWidget::getScaleFactor() const\n{\n\treturn qFloor(m_dScaleFactor * 100000.0) / 100000.0; // Returns it with precision of 5 decimals\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::setScaleFactor(const double dScaleFactor)\n{\n\tif(dScaleFactor == m_dScaleFactor)\n\t\treturn;\n\n\tif(dScaleFactor >= 0.10 && dScaleFactor <= 10.0)\n\t{\n\t\t// First, go back to the base scale (1.0 or 100%)\n\t\tdouble dAdjust = 1.0 / m_dScaleFactor;\n\t\tscale(dAdjust, dAdjust);\n\n\t\t// Then, apply the requested factor.\n\t\tm_dScaleFactor = dScaleFactor;\n\t\tif(m_dScaleFactor != 1.0)\n\t\t\tscale(dScaleFactor, dScaleFactor);\n\t}\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::scaleViewBy(double dFactorBy)\n{\n\tdouble dFactor = m_dScaleFactor * dFactorBy;\n\tif(dFactor >= 0.10 && dFactor <= 10.0)\n\t{\n\t\tm_dScaleFactor = dFactor;\n\t    scale(dFactorBy, dFactorBy);\n\n\t\t// Emit the signal that the scale factor has changed\n\t\temit onScaleFactorChanged(getScaleFactor());\n\t}\n}\n\n#ifndef QT_NO_WHEELEVENT\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::wheelEvent(QWheelEvent *pEvent)\n{\n\tbool bCtrl = QApplication::keyboardModifiers() & Qt::ControlModifier;\n\tbool bAlt = QApplication::keyboardModifiers() & Qt::AltModifier;\n\tbool bShift = QApplication::keyboardModifiers() & Qt::ShiftModifier;\n\tint iDelta = pEvent->angleDelta().x() + pEvent->angleDelta().y();\n\tdouble dBase = iDelta < 0 ? ZOOM_OUT_STEP : ZOOM_IN_STEP;\n\tint iSteps = abs(iDelta / 120);\n\n\tif(!(bCtrl || bAlt || bShift)) // No special key pressed => scroll vertically\n\t\tverticalScrollBar()->setValue(verticalScrollBar()->value() - iDelta);\n\telse if(bShift && !(bCtrl || bAlt)) // Only shift key pressed => scroll horizontally\n\t\thorizontalScrollBar()->setValue(horizontalScrollBar()->value() - iDelta);\n\telse if(bCtrl && !(bAlt || bShift)) // Only ctrl key pressed => zoom in and out\n\t\tscaleViewBy(qPow(dBase, iSteps));\n}\n#endif\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::mousePressEvent(QMouseEvent* pEvent)\n{\n\tQPointF oPos = pEvent->pos();\n\toPos = mapToScene(pEvent->pos());\n\tQTransform oTrf;\n\tQGraphicsItem* pItem = scene()->itemAt(oPos, oTrf);\n\tif (pItem && pItem->isEnabled() && (pItem->flags() & QGraphicsItem::ItemIsSelectable) &&\n\t\t(pEvent->modifiers() & Qt::ShiftModifier))\n\t{\n\t\tint iFirst, iLast;\n\t\tQList<FaceFeatureNode*> lsSelected = getSelectedFeatures();\n\t\tif(!lsSelected.size())\n\t\t\tiFirst = 0;\n\t\telse\n\t\t{\n\t\t\tiFirst = lsSelected.first()->getID();\n\t\t\tforeach(FaceFeatureNode *pNode, lsSelected)\n\t\t\t\tif(pNode->getID() < iFirst)\n\t\t\t\t\tiFirst = pNode->getID();\n\t\t}\n\n\t\tiLast = ((FaceFeatureNode*) pItem)->getID();\n\n\t\tif(iFirst != iLast)\n\t\t{\n\t\t\tQList<FaceFeatureNode*> lsFeats = getFaceFeatures();\n\t\t\tforeach(FaceFeatureNode* pFeat, lsFeats)\n\t\t\t\tpFeat->setSelected(false);\n\n\t\t\tfor(int i = qMin(iFirst, iLast); i <= qMax(iFirst, iLast); i++)\n\t\t\t\tlsFeats[i]->setSelected(true);\n\t\t}\n\t\tpEvent->accept();\n\t}\n\telse\n\t\tQGraphicsView::mousePressEvent((QMouseEvent*) pEvent);\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::mouseReleaseEvent(QMouseEvent *pEvent)\n{\n\tif(m_bFeaturesMoved)\n\t{\n\t\temit onFaceFeaturesChanged();\n\t\tm_bFeaturesMoved = false;\n\t}\n\n\tif(m_bSelectionChanged)\n\t{\n\t\temit onFaceFeaturesSelectionChanged();\n\t\tm_bSelectionChanged = false;\n\t}\n\n\tQGraphicsView::mouseReleaseEvent(pEvent);\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::zoomIn()\n{\n\tscaleViewBy(ZOOM_IN_STEP);\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::zoomOut()\n{\n\tscaleViewBy(ZOOM_OUT_STEP);\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::createFaceFeatures()\n{\n\t// These are the coordinates for the face features of a sample face model\n\tdouble aFaceModel[NUM_FACE_FEATURES][2] =\n\t{\n\t\t{217.79878, 217.08728},\n\t\t{216.89078, 254.86311},\n\t\t{223.67206, 292.07462},\n\t\t{238.23885, 326.79248},\n\t\t{254.94789, 360.61587},\n\t\t{279.53139, 388.90414},\n\t\t{310.45043, 410.42450},\n\t\t{345.37818, 425.29204},\n\t\t{382.36266, 428.51270},\n\t\t{418.06689, 424.13911},\n\t\t{449.99561, 408.56366},\n\t\t{477.42884, 385.63278},\n\t\t{499.83194, 357.72590},\n\t\t{509.49470, 323.37268},\n\t\t{516.13174, 287.86876},\n\t\t{518.15853, 252.06194},\n\t\t{518.69634, 216.55158},\n\t\t{247.62010, 180.34162},\n\t\t{268.70792, 165.39026},\n\t\t{293.56778, 158.93545},\n\t\t{319.16937, 160.78699},\n\t\t{343.48894, 169.15112},\n\t\t{397.25624, 164.28431},\n\t\t{420.26527, 156.48688},\n\t\t{443.57508, 150.79923},\n\t\t{467.19522, 154.84270},\n\t\t{488.87233, 165.42594},\n\t\t{372.77664, 199.50671},\n\t\t{373.99586, 223.36618},\n\t\t{375.57578, 246.90136},\n\t\t{378.10595, 270.34028},\n\t\t{345.61168, 293.24677},\n\t\t{361.62731, 300.03883},\n\t\t{378.63337, 301.76439},\n\t\t{393.55789, 298.57543},\n\t\t{406.85187, 291.64665},\n\t\t{280.10863, 206.43671},\n\t\t{300.22526, 197.40182},\n\t\t{321.95062, 195.23294},\n\t\t{339.75602, 206.97070},\n\t\t{319.74604, 209.54150},\n\t\t{299.69791, 210.59487},\n\t\t{405.25688, 203.23706},\n\t\t{420.24655, 189.68711},\n\t\t{440.47753, 188.93026},\n\t\t{459.57889, 196.31247},\n\t\t{442.35281, 203.82019},\n\t\t{423.65388, 206.10059},\n\t\t{329.76923, 340.09600},\n\t\t{344.93415, 328.45414},\n\t\t{359.76855, 316.54668},\n\t\t{377.56618, 319.87236},\n\t\t{395.18127, 314.47085},\n\t\t{411.21730, 325.09745},\n\t\t{427.09559, 335.85024},\n\t\t{415.75540, 349.79882},\n\t\t{398.78054, 356.02983},\n\t\t{380.76123, 358.75053},\n\t\t{361.44337, 358.76781},\n\t\t{343.08983, 353.52445},\n\t\t{341.63086, 335.00864},\n\t\t{353.49249, 334.72611},\n\t\t{377.56554, 336.91333},\n\t\t{402.31187, 331.58481},\n\t\t{414.70373, 331.84948},\n\t\t{401.78216, 332.11416},\n\t\t{377.03251, 337.44653},\n\t\t{353.00775, 335.29117},\n\t};\n\n\t// Add the face feature nodes\n\tFaceFeatureNode *pPrevFeat = NULL;\n\tFaceFeatureNode *pCurFeat = NULL;\n\tfor(int i = 0; i < NUM_FACE_FEATURES; i++)\n\t{\n\t\tpCurFeat = addFaceFeature(QPoint(aFaceModel[i][0], aFaceModel[i][1]));\n\t\tif(!pPrevFeat)\n\t\t\tpPrevFeat = pCurFeat;\n\t\telse\n\t\t{\n\t\t\tconnectFaceFeatures(pPrevFeat, pCurFeat);\n\t\t\tpPrevFeat = pCurFeat;\n\t\t}\n\t}\n}\n\n// +-----------------------------------------------------------\nconst QList<ft::FaceFeatureNode*>& ft::FaceWidget::getFaceFeatures(int iNumFeats)\n{\n\tif(iNumFeats != -1)\n\t{\n\t\tint iDiff = m_lFaceFeatures.size() - iNumFeats;\n\n\t\tif(iDiff > 0)\n\t\t{\n\t\t\twhile(iDiff-- > 0)\n\t\t\t\tremoveFaceFeature(m_lFaceFeatures.last());\n\t\t}\n\t\telse if(iDiff < 0)\n\t\t{\n\t\t\twhile(iDiff++ < 0)\n\t\t\t\taddFaceFeature();\n\t\t}\n\n\t}\n\treturn m_lFaceFeatures;\n}\n\n// +-----------------------------------------------------------\nQList<ft::FaceFeatureNode*> ft::FaceWidget::getSelectedFeatures() const\n{\n\tQList<FaceFeatureNode*> lSelected;\n\tforeach(QGraphicsItem *pItem, m_pScene->selectedItems())\n\t\tlSelected.append((FaceFeatureNode*) pItem);\n\treturn lSelected;\n}\n\n// +-----------------------------------------------------------\nQList<ft::FaceFeatureEdge*> ft::FaceWidget::getSelectedConnections() const\n{\n\tQList<FaceFeatureNode*> lFeatures = getSelectedFeatures();\n\tQList<FaceFeatureEdge*> lSelected;\n\n\tQList<FaceFeatureNode*>::iterator oFirst, oSecond;\n\tFaceFeatureEdge *pEdge;\n\n\tfor(oFirst = lFeatures.begin(); oFirst != lFeatures.end(); ++oFirst)\n\t{\n\t\tfor(oSecond = oFirst + 1; oSecond != lFeatures.end(); ++oSecond)\n\t\t{\n\t\t\tpEdge = (*oFirst)->getEdgeTo(*oSecond);\n\t\t\tif(pEdge)\n\t\t\t{\n\t\t\t\tlSelected.append(pEdge);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn lSelected;\n}\n\n// +-----------------------------------------------------------\nft::FaceFeatureNode* ft::FaceWidget::addFaceFeature(const QPoint &oPos, bool bGlobal)\n{\n\tint iID = m_lFaceFeatures.size();\n\tFaceFeatureNode *pNode = new FaceFeatureNode(iID, this);\n\tm_pScene->addItem(pNode);\n\tm_lFaceFeatures.append(pNode);\n\tif(bGlobal)\n\t\tpNode->setPos(mapToScene(mapFromGlobal(oPos)));\n\telse\n\t\tpNode->setPos(oPos);\n\treturn pNode;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::removeFaceFeature(FaceFeatureNode* pNode)\n{\n\t// First, remove all edges connected to the node\n\tQList<FaceFeatureEdge*> lEdges = pNode->edges();\n\tfor(int i = 0; i < lEdges.size(); i++)\n\t\tremoveConnection(lEdges[i]);\n\n\t// Then, remove the node\n\tm_lFaceFeatures.removeOne(pNode);\n\tm_pScene->removeItem(pNode);\n\tdelete pNode;\n\n\t// And adjust the IDs of the remaining features\n\tint iID = 0;\n\tforeach(FaceFeatureNode *pNode, m_lFaceFeatures)\n\t\tpNode->setID(iID++);\n}\n\n// +-----------------------------------------------------------\nft::FaceFeatureEdge* ft::FaceWidget::connectFaceFeatures(FaceFeatureNode* pSource, FaceFeatureNode* pTarget)\n{\n\tFaceFeatureEdge* pEdge = pSource->getEdgeTo(pTarget);\n\tif(pEdge)\n\t\treturn pEdge;\n\n\tpEdge = new FaceFeatureEdge(this, pSource, pTarget);\n\tm_pScene->addItem(pEdge);\n\tm_lConnections.append(pEdge);\n\treturn pEdge;\n}\n\n// +-----------------------------------------------------------\nft::FaceFeatureEdge* ft::FaceWidget::connectFaceFeatures(int iSource, int iTarget)\n{\n\tFaceFeatureNode *pSource = NULL, *pTarget = NULL;\n\tQList<FaceFeatureNode *> lFeats = getFaceFeatures();\n\tforeach(FaceFeatureNode *pFeat, lFeats)\n\t{\n\t\tif (pFeat->getID() == iSource)\n\t\t\tpSource = pFeat;\n\t\telse if (pFeat->getID() == iTarget)\n\t\t\tpTarget = pFeat;\n\n\t\tif (pSource && pTarget)\n\t\t\tbreak;\n\t}\n\n\tif (pSource && pTarget)\n\t\treturn connectFaceFeatures(pSource, pTarget);\n\telse\n\t\treturn NULL;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::disconnectFaceFeatures(FaceFeatureNode* pSource, FaceFeatureNode* pTarget)\n{\n\tFaceFeatureEdge *pEdge = pSource->getEdgeTo(pTarget);\n\tif(pEdge)\n\t\tremoveConnection(pEdge);\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::removeConnection(FaceFeatureEdge* pEdge)\n{\n\tpEdge->sourceNode()->removeEdge(pEdge);\n\tpEdge->targetNode()->removeEdge(pEdge);\n\tm_lConnections.removeOne(pEdge);\n\tm_pScene->removeItem(pEdge);\n\tdelete pEdge;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::faceFeatureMoved(FaceFeatureNode *pNode)\n{\n\tQ_UNUSED(pNode);\n\tm_bFeaturesMoved = true;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::onSelectionChanged()\n{\n\tm_bSelectionChanged = true;\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceWidget::displayFaceFeatures() const\n{\n\treturn m_bDisplayFaceFeatures;\n}\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::setDisplayFaceFeatures(const bool bValue)\n{\n\tif(bValue == m_bDisplayFaceFeatures)\n\t\treturn;\n\n\tm_bDisplayFaceFeatures = bValue;\n\tforeach(FaceFeatureNode *pNode, m_lFaceFeatures)\n\t\tpNode->setVisible(bValue);\n\tupdate();\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceWidget::displayConnections() const\n{\n\treturn m_bDisplayConnections;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::setDisplayConnections(const bool bValue)\n{\n\tif(bValue == m_bDisplayConnections)\n\t\treturn;\n\n\tm_bDisplayConnections = bValue;\n\tforeach(FaceFeatureEdge *pEdge, m_lConnections)\n\t\tpEdge->setVisible(bValue);\n\tupdate();\n}\n\n// +-----------------------------------------------------------\nbool ft::FaceWidget::displayFeatureIDs() const\n{\n\treturn m_bDisplayFeatureIDs;\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::setDisplayFeatureIDs(const bool bValue)\n{\n\tm_bDisplayFeatureIDs = bValue;\n\tforeach(FaceFeatureNode *pNode, m_lFaceFeatures)\n\t\tpNode->update();\n\tupdate();\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::contextMenuEvent(QContextMenuEvent *pEvent)\n{\n\tif(m_pContextMenu)\n\t{\n\t\t// Set the context menu mouse position as the user data of the\n\t\t// first action (the 'add feature' action), so it can be used\n\t\t// as the position of the new feature point\n\t\tm_pContextMenu->actions()[0]->setData(pEvent->globalPos());\n\n\t\t// call the context menu\n\t\tm_pContextMenu->exec(pEvent->globalPos());\n\n\t\t// After the menu is closed, empty the data to avoid using it wrongly in the future\n\t\tm_pContextMenu->actions()[0]->setData(QVariant::Invalid);\n\t}\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidget::setContextMenu(QMenu *pMenu)\n{\n\tm_pContextMenu = pMenu;\n}"
  },
  {
    "path": "src/facewidget.h",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef FACEWIDGET_H\n#define FACEWIDGET_H\n\n#include <QGraphicsView>\n#include <QGraphicsPixmapItem>\n#include <QMouseEvent>\n#include <QMenu>\n#include <QAction>\n\n#include \"facefeaturenode.h\"\n#include \"facefeatureedge.h\"\n\nnamespace Ui {\n    class MainWindow;\n}\n\nnamespace ft\n{\n    /**\n     * Implements the widget used to display face images and to edit facial features by dragging its points.\n     */\n    class FaceWidget : public QGraphicsView\n    {\n        Q_OBJECT\n\tpublic:\n\n\t\t/** Scale value for the zoom in step. */\n\t\tstatic const double ZOOM_IN_STEP;\n\n\t\t/** Scale value for the zoom out step. */\n\t\tstatic const double ZOOM_OUT_STEP;\n\n\t\t/**\n\t\t * Class constructor.\n\t\t * @param pParent Instance of the parent widget.\n\t\t */\n\t\tFaceWidget(QWidget *pParent = 0);\n\n\t\t/**\n\t\t * Class destructor.\n\t\t */\n\t\tvirtual ~FaceWidget();\n\n\t\t/**\n\t\t * Updates the pixmap displayed at the central area.\n\t\t * @param oPixmap Reference for a QPixmap with the new pixmap to display.\n\t\t */\n\t\tvoid setPixmap(const QPixmap &oPixmap);\n\n\t\t/**\n\t\t * Gets the currently applied scale factor on the image displayed.\n\t\t * @return Double with the currently applied scale factor.\n\t\t */\n\t\tdouble getScaleFactor() const;\n\n\t\t/**\n\t\t * Sets the scale factor of the image displayed.\n\t\t * @param dScaleFactor Double with the new scale factor to be applied. It must be \n\t\t * in the interval [0.10, 10.0].\n\t\t */\n\t\tvoid setScaleFactor(const double dScaleFactor);\n\n\t\t/**\n\t\t * Performs one step of zoom in.\n\t\t */\n\t    void zoomIn();\n\n\t\t/**\n\t\t * Performs one step of zoom out.\n\t\t */\n\t\tvoid zoomOut();\n\n\t\t/**\n\t\t * Queries the list of existing face feature nodes. Optionally, guarantee that the\n\t\t * correct number of face features are available in the editor.\n\t\t * @param iNumFeats Integer with the expected number of face features in the editor.\n\t\t * If -1 is provided (the default), the method simply returns the current set of \n\t\t * face features without performing any checking. If the value is different than -1,\n\t\t * the method will create or remove face features to guarantee that given number of\n\t\t * features.\n\t\t * @param Const reference to the QList of existing nodes.\n\t\t */\n\t\tconst QList<FaceFeatureNode*>& getFaceFeatures(int iNumFeats = -1);\n\n\t\t/**\n\t\t * Queries the selected face feature nodes.\n\t\t * @return QList with the pointers to the selected face feature nodes.\n\t\t */\n\t\tQList<FaceFeatureNode*> getSelectedFeatures() const;\n\n\t\t/**\n\t\t * Queries the selected face feature edges.\n\t\t * @return QList with the pointers to the selected face feature edges.\n\t\t */\n\t\tQList<FaceFeatureEdge*> getSelectedConnections() const;\n\n\t\t/**\n\t\t * Adds a new face feature node in the given position.\n\t\t * @param oPos A QPoint with the coordinates for the new node. If not provided, (0, 0) is assumed.\n\t\t * @param bGlobal Bool indicating if the coordinate of the position is referenced to the global\n\t\t * coordinate system or to the scene coordinate system. The default is false (indicating that is related\n\t\t * to the scene coordinate system).\n\t\t * @return Pointer to the instance of the newly added face feature node.\n\t\t */\n\t\tFaceFeatureNode* addFaceFeature(const QPoint &oPos = QPoint(), bool bGlobal = false);\n\n\t\t/**\n\t\t * Removes an existing face feature node.\n\t\t * @param pNode Pointer to the instance of the face feature node to remove.\n\t\t */\n\t\tvoid removeFaceFeature(FaceFeatureNode* pNode);\n\n\t\t/**\n\t\t * Adds a new face feature edge connecting two existing nodes.\n\t\t * @param pSource Pointer to the instance of the first face feature node.\n\t\t * @param pTarget Pointer to the instance of the second face feature node.\n\t\t * @return Pointer to the instance of the newly added face feature edge connecting the two nodes.\n\t\t */\n\t\tFaceFeatureEdge* connectFaceFeatures(FaceFeatureNode* pSource, FaceFeatureNode* pTarget);\n\n\t\t/**\n\t\t* Adds a new face feature edge connecting two existing nodes, based on their IDs.\n\t\t* @param iSource Integer with the ID of the first face feature node.\n\t\t* @param iTarget Integer with the ID of the second face feature node.\n\t\t* @return Pointer to the instance of the newly added face feature edge connecting the two nodes.\n\t\t*/\n\t\tFaceFeatureEdge* connectFaceFeatures(int iSource, int iTarget);\n\n\t\t/**\n\t\t * Removes the face feature edge connecting two existing nodes.\n\t\t * @param pSource Pointer to the instance of the first face feature node.\n\t\t * @param pTarget Pointer to the instance of the second face feature node.\n\t\t */\n\t\tvoid disconnectFaceFeatures(FaceFeatureNode* pSource, FaceFeatureNode* pTarget);\n\n\t\t/**\n\t\t * Removes an existing face feature edge.\n\t\t * @param pEdge Pointer to the instance of the face feature edge to remove.\n\t\t */\n\t\tvoid removeConnection(FaceFeatureEdge* pEdge);\n\n\t\t/**\n\t\t * Captures the indication that a face feature node has been moved by the user.\n\t\t * @param pNode Instance of the Face Feature Node that has been moved.\n\t\t */\n\t\tvoid faceFeatureMoved(FaceFeatureNode *pNode);\n\n\t\t/**\n\t\t * Indicates if the face feature nodes are on display.\n\t\t * @return Boolean indicating if the face feature nodes are being displayed or not.\n\t\t */\n\t\tbool displayFaceFeatures() const;\n\n\t\t/**\n\t\t * Updates the indication on if the face feature nodes shall be displayed or not.\n\t\t * @param bValue Boolean with the new value (true means show, false means hide).\n\t\t */\n\t\tvoid setDisplayFaceFeatures(const bool bValue);\n\n\t\t/**\n\t\t * Indicates if the face feature edges are on display.\n\t\t * @return Boolean indicating if the face feature edges are being displayed or not.\n\t\t */\n\t\tbool displayConnections() const;\n\n\t\t/**\n\t\t * Updates the indication on if the face feature edges shall be displayed or not.\n\t\t * @param bValue Boolean with the new value (true means show, false means hide).\n\t\t */\n\t\tvoid setDisplayConnections(const bool bValue);\n\n\t\t/**\n\t\t * Indicates if the identifiers of the face feature nodes are on display.\n\t\t * @return Boolean indicating if the identifiers of the face feature nodes are being displayed or not.\n\t\t */\n\t\tbool displayFeatureIDs() const;\n\n\t\t/**\n\t\t * Updates the indication on if the identifiers of the face feature nodes shall be displayed or not.\n\t\t * @param bValue Boolean with the new value (true means show, false means hide).\n\t\t */\n\t\tvoid setDisplayFeatureIDs(const bool bValue);\n\n\t\t/**\n\t\t * Sets the menu to be displayed upon events of context menu on the face features editor.\n\t\t * The actions used in the menu must be controlled by the caller.\n\t\t * @param pMenu Instance of the QMenu to be used for the context of the editor.\n\t\t */\n\t\tvoid setContextMenu(QMenu *pMenu);\n\n\tpublic:\n\n\t\t/** Constant with the number of face features. */\n\t\tconst static int NUM_FACE_FEATURES;\n\n\tsignals:\n\n\t\t/**\n\t\t * Signal to indicate that the scale of the display image has changed from direct user interaction\n\t\t * with the widget (that is, a call to setScaleFactor does not emit this signal).\n\t\t * @param dScaleFactor Double with the new scale factor.\n\t\t */\n\t\tvoid onScaleFactorChanged(const double dScaleFactor);\n\n\t\t/**\n\t\t * Signal to indicate that the face features changed somehow: a face feature node was added, removed or moved\n\t\t * or a connection between two face feature nodes was created or removed.\n\t\t */\n\t\tvoid onFaceFeaturesChanged();\n\n\t\t/**\n\t\t * Signal to indicate that face features were selected or unselected in the editor.\n\t\t * The selection can be queried through getSelectedFeatures() and getSelectedConnections().\n\t\t */\n\t\tvoid onFaceFeaturesSelectionChanged();\n\n\tprotected:\n\n\t#ifndef QT_NO_WHEELEVENT\n\t\t/**\n\t\t * Captures and handles the mouse wheel events to automate user interactions.\n\t\t * @param pEvent Pointer to a QWheelEvent with the mouse event.\n\t\t */\n\t\tvoid wheelEvent(QWheelEvent *pEvent) Q_DECL_OVERRIDE;\n\t#endif\n\n\t\t/**\n\t\t * Captures the press of the mouse button to notify changes in the face feature editor.\n\t\t * @param pEvent Instance of the QMouseEvent with the event data.\n\t\t */\n\t\tvoid mousePressEvent(QMouseEvent* pEvent);\n\n\t\t/**\n\t\t * Captures the release of the mouse button to notify changes in the face feature editor.\n\t\t * @param pEvent Instance of the QMouseEvent with the event data.\n\t\t */\n\t\tvoid mouseReleaseEvent(QMouseEvent *pEvent);\n\n\t\t/**\n\t\t * Scales the widget view to emulate a zoom behaviour by the given factor.\n\t\t * @param dFactorBy Double with the scale to be added/removed.\n\t\t */\n\t\tvoid scaleViewBy(double dFactorBy);\n\n\t\t/**\n\t\t * Creates the face feature nodes and edges to be used by the face features editor.\n\t\t */\n\t\tvoid createFaceFeatures();\n\n\t\t/**\n\t\t * Captures the context menu event.\n\t\t * @param pEvent Instance of a QContextMenuEvent with the event data.\n\t\t */\n\t\tvoid contextMenuEvent(QContextMenuEvent *pEvent) Q_DECL_OVERRIDE;\n\n\tprotected slots:\n\n\t\t/**\n\t\t * Captures the signal of selection changed in the graphics scene.\n\t\t */\n\t\tvoid onSelectionChanged();\n\n\tprivate:\n\n\t\t/** Indication about the feature nodes being moved. */\n\t\tbool m_bFeaturesMoved;\n\n\t\t/** Indication about the selection of feature nodes being changed. */\n\t\tbool m_bSelectionChanged;\n\n\t\t/** The scene used to render the widget contents. */\n\t\tQGraphicsScene *m_pScene;\n\n\t\t/** Pixmap item used to display the face image. */\n\t\tQGraphicsPixmapItem *m_pPixmapItem;\n\n\t\t/** The current applied scale factor. */\n\t\tdouble m_dScaleFactor;\n\n\t\t/** List of nodes used to edit the coordinates of facial features. */\n\t\tQList<FaceFeatureNode*> m_lFaceFeatures;\n\n\t\t/** List of edges connecting two feature nodes. */\n\t\tQList<FaceFeatureEdge*> m_lConnections;\n\n\t\t/** Indicates if the face feature nodes should be displayed or not. */\n\t\tbool m_bDisplayFaceFeatures;\n\n\t\t/** Indicates if the face feature edges should be displayed or not. */\n\t\tbool m_bDisplayConnections;\n\n\t\t/** Indicates if the IDs of the face feature nodes should be displayed or not. */\n\t\tbool m_bDisplayFeatureIDs;\n\n\t\t/** Context menu for the face feature editor. */\n\t\tQMenu *m_pContextMenu;\n\t};\n};\n\n\n#endif //FACEWIDGET_H\n"
  },
  {
    "path": "src/facewidgetscene.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"facewidgetscene.h\"\n\n// +-----------------------------------------------------------\nft::FaceWidgetScene::FaceWidgetScene(QObject *pParent):\n\tQGraphicsScene(pParent)\n{\n}\n\n// +-----------------------------------------------------------\nvoid ft::FaceWidgetScene::mousePressEvent(QGraphicsSceneMouseEvent *pEvent)\n{\n\tif(pEvent->button() != Qt::LeftButton)\n\t{\n        pEvent->accept();\n        return;\n    }\n    QGraphicsScene::mousePressEvent(pEvent);\n}"
  },
  {
    "path": "src/facewidgetscene.h",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef FACEWIDGETSCENE_H\n#define FACEWIDGETSCENE_H\n\n#include <QGraphicsScene>\n#include <QGraphicsSceneMouseEvent>\n\nnamespace ft\n{\n\t/**\n\t * Inherits the base QGraphicsScene to implement specific interaction behaviours in the face features editor.\n\t */\n\tclass FaceWidgetScene: QGraphicsScene\n\t{\n\tpublic:\n\t\t/**\n\t\t * Class constructor.\n\t\t * @param pParent Instance of a QObject with the parent for the scene.\n\t\t */\n\t\tFaceWidgetScene(QObject *pParent = 0);\n\n\tprotected:\n\n\t\t/**\n\t\t * Captures the mouse press event.\n\t\t * @param pEvent Instance of a QGraphicsSceneMouseEvent with the event data.\n\t\t */\n\t\tvoid mousePressEvent(QGraphicsSceneMouseEvent *pEvent) Q_DECL_OVERRIDE;\n\t};\n};\n\n#endif //FACEWIDGETSCENE_H"
  },
  {
    "path": "src/main.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"mainwindow.h\"\n#include \"application.h\"\n\nusing namespace ft;\n\n// +-----------------------------------------------------------\nint main(int argc, char *argv[])\n{\n\tFtApplication oApp(argc, argv);\n\t\n\tMainWindow oMainWindow;\n\tQObject::connect(FtApplication::instance(), SIGNAL(statusMessageShown(const QString &, const int)), &oMainWindow, SLOT(showStatusMessage(const QString &, const int)));\n\n\toMainWindow.show();\n\treturn oApp.exec();\n}\n"
  },
  {
    "path": "src/mainwindow.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"mainwindow.h\"\n#include \"ui_mainwindow.h\"\n#include \"aboutwindow.h\"\n#include \"facefitconfig.h\"\n#include \"utils.h\"\n#include \"application.h\"\n\n#include <vector>\n\n#include <QApplication>\n#include <QImage>\n#include <QFileDialog>\n#include <QDesktopServices>\n#include <QAction>\n#include <QMessageBox>\n#include <QTemporaryFile>\n\nusing namespace std;\n\n// +-----------------------------------------------------------\nft::MainWindow::MainWindow(QWidget *pParent) :\n    QMainWindow(pParent),\n    ui(new Ui::MainWindow)\n{\n\t// Setup the UI\n    ui->setupUi(this);\n\tQPalette oROPalette = ui->textFileName->palette();\n\toROPalette.setColor(QPalette::Base, oROPalette.midlight().color());\n\tui->textFileName->setPalette(oROPalette);\n\n    setWindowState(Qt::WindowMaximized);\n    m_pAbout = NULL;\n\n    setWindowIcon(QIcon(\":/icons/fat\"));\n\tui->tabWidget->setAutoFillBackground(true);\n\tui->tabWidget->setBackgroundRole(QPalette::Midlight);\n\n\t// Setup the TAB changing events\n\tconnect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(on_tabCloseRequested(int)));\n\tconnect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(on_tabChanged(int)));\n\n\t// Add the view dropdown button manually (because Qt designer does not allow it...)\n\tm_pViewButton = new QMenu(ui->imagesToolbar);\n\tui->imagesToolbar->addSeparator();\n\tui->imagesToolbar->addAction(m_pViewButton->menuAction());\n\n\tQAction *pViewDetails = new QAction(QIcon(\":/icons/viewdetails\"), tr(\"&Details\"), this);\n\tpViewDetails->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));\n\tm_pViewButton->addAction(pViewDetails);\n\tQAction *pViewIcons = new QAction(QIcon(\":/icons/viewicons\"), tr(\"&Icons\"), this);\n\tpViewIcons->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I));\n\tm_pViewButton->addAction(pViewIcons);\n\n\tQSignalMapper *pMap = new QSignalMapper(ui->imagesToolbar);\n\tconnect(pViewDetails, SIGNAL(triggered()), pMap, SLOT(map()));\n\tconnect(pViewIcons, SIGNAL(triggered()), pMap, SLOT(map()));\n\tpMap->setMapping(pViewDetails, QString(\"details\"));\n\tpMap->setMapping(pViewIcons, QString(\"icons\"));\n\n\tconnect(pMap, SIGNAL(mapped(QString)), this, SLOT(setImageListView(QString)));\n\tconnect(m_pViewButton->menuAction(), SIGNAL(triggered()), this, SLOT(toggleImageListView()));\n\n\tm_pViewButton->setIcon(QIcon(\":/icons/viewicons\")); // By default display the image thumbnails\n\tui->treeImages->setVisible(false);\n\n\t// Default path for file dialogs is the standard documents path\n\tm_sLastPathUsed = QDir::toNativeSeparators(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)) + QDir::separator();\n\n\t// Default path for the face-fit utility\n\tm_sFaceFitPath = \"\";\n\tm_oFitProcess = new QProcess(this);\n\tconnect(m_oFitProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(onFitError(::ProcessError)));\n\tconnect(m_oFitProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(onFitFinished(int, QProcess::ExitStatus)));\n\n\t// Add the action shortcuts to the tooltips (in order to make it easier for the user to know they exist)\n\t// P.S.: I wonder why doesn't Qt do that automatically... :)\n\tQObjectList lsObjects = children();\n\tQAction *pAction;\n\tfor(int i = 0; i < lsObjects.size(); i++)\n\t{\n\t\tpAction = qobject_cast<QAction*>(lsObjects.at(i));\n\t\tif(pAction && !pAction->shortcut().isEmpty())\n\t\t\tpAction->setToolTip(QString(\"%1 (%2)\").arg(pAction->toolTip()).arg(pAction->shortcut().toString()));\n\t}\n\n\t// Connect the zoom slider\n\tconnect(ui->zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int)));\n}\n\n// +-----------------------------------------------------------\nft::MainWindow::~MainWindow()\n{\n\t// Save the current window state and geometry\n\tQSettings oSettings;\n\toSettings.setValue(\"geometry\", saveGeometry());\n\toSettings.setValue(\"windowState\", saveState());\n\toSettings.setValue(\"lastPathUsed\", m_sLastPathUsed);\n\toSettings.setValue(\"faceFitPath\", m_sFaceFitPath);\n\n    if(m_pAbout)\n        delete m_pAbout;\n\tif(m_pViewButton)\n\t\tdelete m_pViewButton;\n\tif (m_oFitProcess)\n\t\tdelete m_oFitProcess;\n    delete ui;\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::closeEvent(QCloseEvent *pEvent)\n{\n\tQList<ChildWindow*> lModified;\n\tChildWindow *pChild;\n\n\t// Get the list of modified child windows\n\tfor(int i = 0; i < ui->tabWidget->count(); i++)\n\t{\n\t\tpChild = (ChildWindow*) ui->tabWidget->widget(i);\n\t\tif(pChild->isWindowModified())\n\t\t\tlModified.append(pChild);\n\t}\n\n\t// Ask for saving the modifiled child windows\n\tif(lModified.size() > 0)\n\t{\n\t\tQString sMsg;\n\t\tif(lModified.size() == 1)\n\t\t{\n\t\t\tpChild = lModified[0];\n\t\t\tsMsg = tr(\"There are pending changes in the face annotation dataset named [%1]. Do you wish to save it before closing?\").arg(QFileInfo(pChild->windowFilePath()).baseName());\n\t\t}\n\t\telse\n\t\t\tsMsg = tr(\"There are %1 face annotation datasets opened with pending changes. Do you wish to save them before closing?\").arg(lModified.size());\n\n\t\tQMessageBox::StandardButton oResp = QMessageBox::question(this, tr(\"Pending changes\"), sMsg, QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel);\n\n\t\t// Do not close the tab if the user has chosen \"cancel\" or if she has chosen \"yes\" but then\n\t\t// cancelled the file save dialog in any of the modified tab\n\t\tif(oResp == QMessageBox::Cancel)\n\t\t{\n\t\t\tpEvent->ignore();\n\t\t\treturn;\n\t\t}\n\t\telse if(oResp == QMessageBox::Yes)\n\t\t{\n\t\t\tfor(int i = 0; i < lModified.size(); i++)\n\t\t\t{\n\t\t\t\tpChild = lModified[i];\n\t\t\t\tui->tabWidget->setCurrentWidget(pChild);\n\t\t\t\tif(!saveCurrentFile())\n\t\t\t\t{\n\t\t\t\t\tpEvent->ignore();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpEvent->accept();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::showEvent(QShowEvent *pEvent)\n{\n\t// Restore the previous window state and geometry\n\tQSettings oSettings;\n\trestoreState(oSettings.value(\"windowState\").toByteArray());\n\trestoreGeometry(oSettings.value(\"geometry\").toByteArray());\n\tQVariant vValue = oSettings.value(\"lastPathUsed\");\n\tif (vValue.isValid())\n\t\tm_sLastPathUsed = vValue.toString();\n\tvValue = oSettings.value(\"faceFitPath\");\n\tif (vValue.isValid())\n\t\tm_sFaceFitPath = vValue.toString();\n\t\n\t// Update UI elements\n\tupdateUI();\n\tui->actionShowImagesList->setChecked(ui->dockImages->isVisible());\n\tui->actionShowImageProperties->setChecked(ui->dockProperties->isVisible());\n\n\tpEvent->accept();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionNew_triggered()\n{\n    createChildWindow();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionOpen_triggered()\n{\n    QString sFile = QFileDialog::getOpenFileName(this, tr(\"Open face annotation dataset...\"), m_sLastPathUsed, tr(\"Face Annotation Dataset files (*.fad);; All files (*.*)\"));\n    if(sFile.length())\n\t{\n\t\tm_sLastPathUsed = QFileInfo(sFile).absolutePath();\n\t\tsFile = QDir::toNativeSeparators(sFile);\n\t\tint iPage = getFilePageIndex(sFile);\n\t\tif(iPage != -1)\n\t\t{\n\t\t\tui->tabWidget->setCurrentIndex(iPage);\n\t\t\tshowStatusMessage(QString(tr(\"The face annotation dataset [%1] is already opened in the editor.\")).arg(Utils::shortenPath(sFile)));\n\t\t}\n\t\telse\n\t\t{\n\t\t\tChildWindow *pChild = createChildWindow(sFile, false);\n\n\t\t\tQString sMsg;\n\t\t\tif(!pChild->loadFromFile(sFile, sMsg))\n\t\t\t{\n\t\t\t\tdestroyChildWindow(pChild);\n\t\t\t\tQMessageBox::warning(this, tr(\"Fail to load the face annotation dataset\"), tr(\"It was not possible to open the face annotation dataset:\\n%1\").arg(sMsg), QMessageBox::Ok);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(pChild->dataModel()->rowCount() > 0)\n\t\t\t\tpChild->selectionModel()->setCurrentIndex(pChild->dataModel()->index(0, 0), QItemSelectionModel::Select);\n\t\t\tupdateUI();\n\t\t}\n\t}\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionSave_triggered()\n{\n\tsaveCurrentFile();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionSaveAs_triggered()\n{\n\tsaveCurrentFile(true);\n}\n\n// +-----------------------------------------------------------\nbool ft::MainWindow::saveCurrentFile(bool bAskForFileName)\n{\n\tChildWindow *pChild = (ChildWindow*) ui->tabWidget->currentWidget();\n\tif(!pChild || (!bAskForFileName && !pChild->isWindowModified()))\n\t\treturn false;\n\n\tif(bAskForFileName)\n\t{\n\t\tQString sFileName = QFileDialog::getSaveFileName(this, tr(\"Save face annotation dataset...\"), windowFilePath(), tr(\"Face Annotation Dataset files (*.fad);; All files (*.*)\"));\n\t\tif(sFileName.length())\n\t\t{\n\t\t\tQString sMsg;\n\t\t\tif(!pChild->saveToFile(sFileName, sMsg))\n\t\t\t{\n\t\t\t\tQMessageBox::warning(this, tr(\"Fail to save the face annotation dataset\"), tr(\"It was not possible to save the face annotation dataset:\\n%1\").arg(sMsg), QMessageBox::Ok);\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tm_sLastPathUsed = QFileInfo(sFileName).absolutePath();\n\t\t\treturn true;\n\t\t}\n\t\telse\n\t\t\treturn false;\n\t}\n\telse\n\t{\n\t\t// Force the user to chose a file name if the dataset has not yet been saved\n\t\tif(pChild->property(\"new\").toBool())\n\t\t\treturn saveCurrentFile(true);\n\t\telse\n\t\t{\n\t\t\tQString sMsg;\n\t\t\tif(!pChild->save(sMsg))\n\t\t\t{\n\t\t\t\tQMessageBox::warning(this, tr(\"Fail to save the face annotation dataset\"), tr(\"It was not possible to save the face annotation dataset:\\n%1\").arg(sMsg), QMessageBox::Ok);\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t}\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionExit_triggered()\n{\n    QApplication::exit(0);\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionConfigure_triggered()\n{\n\tFaceFitConfig oConfig;\n\tif (oConfig.exec() == FaceFitConfig::Accepted)\n\t\tm_sFaceFitPath = oConfig.getFaceFitPath();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionFitLandmarks_triggered()\n{\n\t// Only continue if the face-fit utilility is properly configured\n\tif (m_sFaceFitPath.length() < 0 || !QFileInfo(m_sFaceFitPath).exists())\n\t{\n\t\tQMessageBox::critical(this, tr(\"Error running face-fit utility\"), tr(\"The face-fit utility executable could not be executed. Please check its configuration.\"), QMessageBox::Ok);\n\t\treturn;\n\t}\n\n\t// Get the selected face annotation dataset\n\tChildWindow *pChild = (ChildWindow*)ui->tabWidget->currentWidget();\n\tif (!pChild) // Sanity check\n\t\treturn;\n\n\t// Get the path of the selected image in the dataset\n\tQModelIndex oSelectedImage = pChild->selectionModel()->currentIndex();\n\tQModelIndex oIdx = pChild->dataModel()->index(oSelectedImage.row(), 1);\n\tQString sImageFile = pChild->dataModel()->data(oIdx, Qt::DisplayRole).toString();\n\n\t// Build the arguments for the face-fit utility\n\tQTemporaryFile oTemp(\"face-fit-results\");\n\toTemp.open();\n\tm_sFitTempFile = oTemp.fileName();\n\toTemp.close();\n\t\n\tQStringList oArgs;\n\toArgs << sImageFile << m_sFitTempFile;\n\tm_oFitProcess->start(m_sFaceFitPath, oArgs, QProcess::ReadOnly);\n\tshowStatusMessage(tr(\"Face fit started. Please wait...\"), 0);\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::onFitError(QProcess::ProcessError eError)\n{\n\tQ_UNUSED(eError);\n\tQFile::remove(m_sFitTempFile);\n\tm_sFitTempFile = \"\";\n\tshowStatusMessage(tr(\"The face fit utility executable failed to execute. Please check its configuration.\"));\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::onFitFinished(int iExitCode, QProcess::ExitStatus eExitStatus)\n{\n\tQFileInfo oFileInfo(m_sFitTempFile);\n\tif (!oFileInfo.exists())\n\t{\n\t\tshowStatusMessage(tr(\"The face fit utility could not fit the landmarks to this image.\"));\n\t\tQFile::remove(m_sFitTempFile);\n\t\tm_sFitTempFile = \"\";\n\t\treturn;\n\t}\n\n\tvector<QPoint> vPoints = Utils::readFaceFitPointsFile(m_sFitTempFile);\n\tif (vPoints.size() == 0)\n\t{\n\t\tshowStatusMessage(tr(\"The face fit utility could not fit the landmarks to this image.\"));\n\t\tQFile::remove(m_sFitTempFile);\n\t\tm_sFitTempFile = \"\";\n\t\treturn;\n\t}\n\n\tQFile::remove(m_sFitTempFile);\n\tm_sFitTempFile = \"\";\n\n\n\t// Get the selected face annotation dataset\n\tChildWindow *pChild = (ChildWindow*)ui->tabWidget->currentWidget();\n\tif (!pChild) // Sanity check\n\t\treturn;\n\n\t// Reposition the features according to the face-fit results\n\tpChild->positionFeatures(vPoints);\n\tshowStatusMessage(tr(\"Face fit completed successfully.\"));\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionExportPointsFile_triggered()\n{\n\tChildWindow *pChild = (ChildWindow*)ui->tabWidget->currentWidget();\n\tif (!pChild) // Sanity check\n\t\treturn;\n\n\tQList<FaceFeatureNode *> lFeats = pChild->getFaceFeatures();\n\tif(lFeats.size() == 0)\n\t{\n\t\tQMessageBox::critical(this, tr(\"Error exporting data\"), tr(\"The exporting can not be done because there are no landmarks to export.\"), QMessageBox::Ok);\n\t\treturn;\n\t}\n\n\tQString sFileName = QFileDialog::getSaveFileName(this, tr(\"Export CSIRO points file...\"), windowFilePath(), tr(\"CSIRO Face Analysis SDK points file (*.pts);; All files (*.*)\"));\n\tif (sFileName.length())\n\t{\n\t\tQFile oFile(sFileName);\n\t\tif (!oFile.open(QFile::WriteOnly | QFile::Text))\n\t\t{\n\t\t\tQMessageBox::critical(this, tr(\"Error exporting data\"), tr(\"The exporting failed because it was not possible to write to file [%1].\").arg(sFileName), QMessageBox::Ok);\n\t\t\treturn;\n\t\t}\n\n\t\tQTextStream oStream(&oFile);\n\t\tQString sData = QString(\"n_points: %1\").arg(lFeats.size());\n\t\toStream << sData << endl;\n\t\toStream << \"{\" << endl;\n\n\t\tforeach(FaceFeatureNode *pFeat, lFeats)\n\t\t{\n\t\t\tsData = QString(\"%1\\t%2\").arg(pFeat->x()).arg(pFeat->y());\n\t\t\toStream << sData << endl;\n\t\t}\n\t\toStream << \"}\" << endl;\n\t\toFile.close();\n\t}\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionProject_triggered()\n{\n\tQDesktopServices::openUrl(QUrl(\"https://github.com/luigivieira/Facial-Landmarks-Annotation-Tool.git\"));\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionAbout_triggered()\n{\n\t(new AboutWindow(this))->show();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_tabCloseRequested(int iTabIndex)\n{\n\tChildWindow* pChild = (ChildWindow*) ui->tabWidget->widget(iTabIndex);\n\n\tif(pChild->isWindowModified())\n\t{\n\t\tQString sMsg = tr(\"There are pending changes in the face annotation dataset named [%1]. Do you wish to save it before closing?\").arg(QFileInfo(pChild->windowFilePath()).baseName());\n\t\tQMessageBox::StandardButton oResp = QMessageBox::question(this, tr(\"Pending changes\"), sMsg, QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel);\n\n\t\t// Do not close the tab if the user has chosen \"cancel\" or if she has chosen \"yes\" but then\n\t\t// cancelled the file save dialog\n\t\tui->tabWidget->setCurrentIndex(iTabIndex);\n\t\tif(oResp == QMessageBox::Cancel || (oResp == QMessageBox::Yes && !saveCurrentFile()))\n\t\t\treturn;\n\t}\n\n\tdestroyChildWindow(pChild);\n\n\tif(ui->tabWidget->count() == 0) // no more tabs\n\t{\n\t\tui->textFileName->setText(\"\");\n\t\tui->zoomSlider->blockSignals(true);\n\t\tui->zoomSlider->setValue((ui->zoomSlider->maximum() - ui->zoomSlider->minimum()) / 2 + 1);\n\t\tui->zoomSlider->blockSignals(false);\n\t}\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_tabChanged(int iTabIndex)\n{\n\tQ_UNUSED(iTabIndex);\n\tupdateUI();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionAddImage_triggered()\n{\n\tChildWindow *pChild = (ChildWindow*) ui->tabWidget->currentWidget();\n\tif(!pChild)\n\t\treturn;\n\n    QStringList lsFiles = QFileDialog::getOpenFileNames(this, tr(\"Select face images...\"), m_sLastPathUsed, tr(\"Common image files (*.bmp *.png *.jpg *.gif);; All files (*.*)\"));\n\tif(lsFiles.size())\n\t{\n\t\tm_sLastPathUsed = QFileInfo(lsFiles[0]).absolutePath();\n\t\tpChild->dataModel()->addImages(lsFiles);\n\t\tif(!pChild->selectionModel()->currentIndex().isValid())\n\t\t\tpChild->selectionModel()->setCurrentIndex(pChild->dataModel()->index(0, 0), QItemSelectionModel::Select);\n\t}\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionRemoveImage_triggered()\n{\n\tChildWindow *pChild = (ChildWindow*) ui->tabWidget->currentWidget();\n\tif(!pChild)\n\t\treturn;\n\n\tQModelIndexList lsSelected = pChild->selectionModel()->selectedRows();\n\tif(lsSelected.size() > 0)\n\t{\n\t\tQString sMsg;\n\t\tif(lsSelected.size() == 1)\n\t\t\tsMsg = tr(\"Do you confirm the removal of the selected image?\");\n\t\telse\n\t\t\tsMsg = tr(\"Do you confirm the removal of %1 selected images?\").arg(lsSelected.size());\n\t\tif(QMessageBox::question(this, tr(\"Confirmation\"), sMsg, QMessageBox::Yes|QMessageBox::No) == QMessageBox::Yes)\n\t\t{\n\t\t\tQList<int> lIndexes;\n\t\t\tfor(int i = 0; i < lsSelected.size(); i++)\n\t\t\t\tlIndexes.append(lsSelected[i].row());\n\t\t\tpChild->dataModel()->removeImages(lIndexes);\n\t\t}\n\t}\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionShowImagesList_triggered(bool bChecked)\n{\n\tui->dockImages->setVisible(bChecked);\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionShowImageProperties_triggered(bool bChecked)\n{\n\tui->dockProperties->setVisible(bChecked);\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionShowFeatures_triggered(bool bChecked)\n{\n\tif(!bChecked)\n\t{\n\t\tui->actionShowConnections->setChecked(false);\n\t\tui->actionShowFeatureIDs->setChecked(false);\n\t}\n\tupdateUI();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionShowConnections_triggered(bool bChecked)\n{\n\tif(bChecked && !ui->actionShowFeatures->isChecked())\n\t\tui->actionShowFeatures->setChecked(true);\n\tupdateUI();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionShowFeatureIDs_triggered(bool bChecked)\n{\n\tif(bChecked && !ui->actionShowFeatures->isChecked())\n\t\tui->actionShowFeatures->setChecked(true);\n\tupdateUI();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionAddFeature_triggered()\n{\n\tChildWindow *pChild = (ChildWindow*) ui->tabWidget->currentWidget();\n\tif(!pChild)\n\t\treturn;\n\n\t// The position of the mouse  is stored in this action data\n\t// if the action is called from a context menu in the face features\n\t// editor (see method FaceWidget::contextMenuEvent)\n\tQVariant vPos = ui->actionAddFeature->data();\n\tQPoint oPos;\n\tif(vPos.isValid())\n\t\toPos = vPos.value<QPoint>();\n\telse\n\t\toPos = QCursor::pos();\n\n\tpChild->addFeature(oPos);\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionRemoveFeature_triggered()\n{\n\tChildWindow *pChild = (ChildWindow*) ui->tabWidget->currentWidget();\n\tif(!pChild)\n\t\treturn;\n\n\tQString sMsg = tr(\"Do you confirm the removal of the selected facial landmarks? This action can not be undone.\");\n\tQMessageBox::StandardButton oResp = QMessageBox::question(this, tr(\"Confirmation\"), sMsg, QMessageBox::Yes|QMessageBox::No);\n\n\tif(oResp == QMessageBox::Yes)\n\t\tpChild->removeSelectedFeatures();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionConnectFeatures_triggered()\n{\n\tChildWindow *pChild = (ChildWindow*) ui->tabWidget->currentWidget();\n\tif(!pChild)\n\t\treturn;\n\n\tpChild->connectFeatures();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::on_actionDisconnectFeatures_triggered()\n{\n\tChildWindow *pChild = (ChildWindow*) ui->tabWidget->currentWidget();\n\tif(!pChild)\n\t\treturn;\n\n\tpChild->disconnectFeatures();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::showStatusMessage(const QString &sMsg, const int iTimeout)\n{\n\tui->statusBar->showMessage(sMsg, iTimeout);\n}\n\n// +-----------------------------------------------------------\nint ft::MainWindow::getFilePageIndex(const QString &sFile)\n{\n\tint iRet = -1;\n\tfor(int iPage = 0; iPage < ui->tabWidget->count(); iPage++)\n\t{\n\t\tChildWindow* pChild = (ChildWindow*) ui->tabWidget->widget(iPage);\n\t\tif(pChild->windowFilePath() == sFile)\n\t\t{\n\t\t\tiRet = iPage;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn iRet;\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::setImageListView(QString sType)\n{\n\tif(sType == \"details\")\n\t{\n\t\tm_pViewButton->setIcon(QIcon(\":/icons/viewdetails\"));\n\t\tui->listImages->setVisible(false);\n\t\tui->treeImages->setVisible(true);\n\t}\n\telse if(sType == \"icons\")\n\t{\n\t\tm_pViewButton->setIcon(QIcon(\":/icons/viewicons\"));\n\t\tui->treeImages->setVisible(false);\n\t\tui->listImages->setVisible(true);\n\t}\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::toggleImageListView()\n{\n\tif(ui->treeImages->isVisible())\n\t\tsetImageListView(\"icons\");\n\telse\n\t\tsetImageListView(\"details\");\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::onChildUIUpdated(const QString sImageName, const int iZoomLevel)\n{\n\t// Image file name\n\tui->textFileName->setText(sImageName);\n\tui->textFileName->moveCursor(QTextCursor::End);\n\tui->textFileName->ensureCursorVisible();\n\t\t\t\n\t// Zoom level\n\tui->zoomSlider->blockSignals(true);\n\tui->zoomSlider->setValue(iZoomLevel);\n\tui->zoomSlider->blockSignals(false);\n\n\tupdateUI();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::updateUI()\n{\n\t// Setup the control variables\n\tChildWindow *pChild = (ChildWindow*) ui->tabWidget->currentWidget();\n\n\tbool bFileOpened = pChild != NULL;\n\tbool bFileChanged = bFileOpened ? pChild->isWindowModified() : false;\n\tbool bItemsSelected = bFileOpened && (pChild->selectionModel()->currentIndex().isValid() || pChild->selectionModel()->selectedIndexes().size() > 0);\n\tbool bFileNotNew = bFileOpened && !pChild->property(\"new\").toBool();\n\n\tQList<FaceFeatureNode*> lFeats;\n\tQList<FaceFeatureEdge*> lConns;\n\tif(bFileOpened)\n\t{\n\t\tlFeats = pChild->getSelectedFeatures();\n\t\tlConns = pChild->getSelectedConnections();\n\t}\n\n\tbool bFeaturesSelected = lFeats.size() > 0;\n\tbool bConnectionsSelected = lConns.size() > 0;\n\tbool bFeaturesConnectable = lFeats.size() == 2 && lConns.size() == 0;\n\n\t// Update the data and selection models\n\tif(bFileOpened)\n\t{\n\t\tui->listImages->setModel(pChild->dataModel());\n\t\tui->listImages->setSelectionModel(pChild->selectionModel());\n\t\tui->treeImages->setModel(pChild->dataModel());\n\t\tui->treeImages->setSelectionModel(pChild->selectionModel());\n\t}\n\telse\n\t{\n\t\tui->listImages->setModel(NULL);\n\t\tui->treeImages->setModel(NULL);\n\t}\n\n\t// Update the UI availability\n\tui->actionSave->setEnabled(bFileChanged);\n\tui->actionSaveAs->setEnabled(bFileNotNew);\n\tui->actionAddImage->setEnabled(bFileOpened);\n\tui->actionRemoveImage->setEnabled(bItemsSelected);\n\tui->actionAddFeature->setEnabled(bFileOpened);\n\tui->actionRemoveFeature->setEnabled(bFeaturesSelected);\n\tui->actionConnectFeatures->setEnabled(bFeaturesConnectable);\n\tui->actionDisconnectFeatures->setEnabled(bConnectionsSelected);\n\tui->actionFitLandmarks->setEnabled(bItemsSelected);\n\tui->actionExportPointsFile->setEnabled(bItemsSelected);\n\tm_pViewButton->setEnabled(bFileOpened);\n\tui->zoomSlider->setEnabled(bFileOpened);\n\n\t// Update the tab title and tooltip\n\tif(bFileOpened)\n\t{\n\t\tQString sTitle = QFileInfo(pChild->windowFilePath()).baseName() + (pChild->isWindowModified() ? \"*\" : \"\");\n\t\tui->tabWidget->setTabText(ui->tabWidget->currentIndex(), sTitle);\n\t\tif(bFileNotNew) // Complete file path only if the file has been saved before\n\t\t\tui->tabWidget->setTabToolTip(ui->tabWidget->currentIndex(), pChild->windowFilePath());\n\t}\n\n\t// Display of face features\n\tif(bFileOpened)\n\t{\n\t\tpChild->setDisplayFaceFeatures(ui->actionShowFeatures->isChecked());\n\t\tpChild->setDisplayConnections(ui->actionShowFeatures->isChecked() && ui->actionShowConnections->isChecked());\n\t\tpChild->setDisplayFeatureIDs(ui->actionShowFeatures->isChecked() && ui->actionShowFeatureIDs->isChecked());\n\t}\n\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::onSliderValueChanged(int iValue)\n{\n\tChildWindow *pChild = (ChildWindow*) ui->tabWidget->currentWidget();\n\tif(pChild)\n\t\tpChild->setZoomLevel(iValue);\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::onZoomLevelChanged(int iValue)\n{\n\tui->zoomSlider->blockSignals(true);\n\tui->zoomSlider->setValue(iValue);\n\tui->zoomSlider->blockSignals(false);\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::onUpdateUI()\n{\n\tupdateUI();\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::keyPressEvent(QKeyEvent *pEvent)\n{\n\tChildWindow *pChild = (ChildWindow*) ui->tabWidget->currentWidget();\n\tif(!pChild)\n\t{\n\t\tQMainWindow::keyPressEvent(pEvent);\n\t\treturn;\n\t}\n\n    switch(pEvent->key())\n\t{\n\t\tcase Qt::Key_Plus:\n\t\t\tpChild->zoomIn();\n\t\t\tpEvent->accept();\n\t\t\tbreak;\n\n\t\tcase Qt::Key_Minus:\n\t\t\tpChild->zoomOut();\n\t\t\tpEvent->accept();\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tQMainWindow::keyPressEvent(pEvent);\n    }\n}\n\n// +-----------------------------------------------------------\nft::ChildWindow* ft::MainWindow::createChildWindow(QString sFileName, bool bModified)\n{\n\tChildWindow *pChild = new ChildWindow(this);\n\n\t// Define the window attributes\n\tif(!sFileName.length())\n\t{\n\t\tsFileName = QString(tr(\"%1new face annotation dataset.fad\")).arg(m_sLastPathUsed);\n\t\tbModified = true;\n\t}\n\n\tpChild->setWindowIcon(QIcon(\":/icons/face-dataset\"));\n\tpChild->setWindowFilePath(sFileName);\n\tpChild->setWindowModified(bModified);\n\n\t// Connect to its signals\n\tconnect(pChild, SIGNAL(onUIUpdated(const QString, const int)), this, SLOT(onChildUIUpdated(const QString, const int)));\n\tconnect(pChild, SIGNAL(onDataModified()), this, SLOT(onUpdateUI()));\n\tconnect(pChild, SIGNAL(onFeaturesSelectionChanged()), this, SLOT(onUpdateUI()));\n\n\t// Create the context menu for the features editor, using the same actions from the main window\n\tQMenu *pContextMenu = new QMenu(pChild);\n\tpContextMenu->addAction(ui->actionAddFeature);\n\tpContextMenu->addAction(ui->actionRemoveFeature);\n\tpContextMenu->addAction(ui->actionConnectFeatures);\n\tpContextMenu->addAction(ui->actionDisconnectFeatures);\n\tpChild->setContextMenu(pContextMenu);\n\n\t// Add the window to the tab widget\n\tint iIndex = ui->tabWidget->addTab(pChild, pChild->windowIcon(), \"\");\n\tui->tabWidget->setCurrentIndex(iIndex);\n\n\treturn pChild;\n}\n\n// +-----------------------------------------------------------\nvoid ft::MainWindow::destroyChildWindow(ChildWindow *pChild)\n{\n\tint iTabIndex = ui->tabWidget->indexOf(pChild);\n\tui->tabWidget->removeTab(iTabIndex);\n\n\tdisconnect(pChild, SIGNAL(onUIUpdated(const QString, const int)), this, SLOT(onChildUIUpdated(const QString, const int)));\n\tdisconnect(pChild, SIGNAL(onDataModified()), this, SLOT(onUpdateUI()));\n\tdisconnect(pChild, SIGNAL(onFeaturesSelectionChanged()), this, SLOT(onUpdateUI()));\n\n\tdelete pChild;\n}"
  },
  {
    "path": "src/mainwindow.h",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef MAINWINDOW_H\n#define MAINWINDOW_H\n\n#include <QMainWindow>\n#include <QProcess>\n\n#include \"aboutwindow.h\"\n#include \"childwindow.h\"\n\nnamespace Ui {\n    class MainWindow;\n}\n\nnamespace ft\n{\n    /**\n     * Main GUI window class.\n     */\n    class MainWindow : public QMainWindow\n    {\n        Q_OBJECT\n\n    public:\n        /**\n         * Class constructor.\n         * @param pParent QWidget with the window parent.\n         */\n        explicit MainWindow(QWidget *pParent = 0);\n\n        /**\n         * Class destructor.\n         */\n        virtual ~MainWindow();\n\n\tprotected:\n\n\t\t/**\n\t\t * Captures the close event of the main window.\n\t\t * @param pEvent Instance of the QCloseEvent with the close event data.\n\t\t */\n\t\tvoid closeEvent(QCloseEvent *pEvent);\n\n\t\t/**\n\t\t * Captures the show event of the main window.\n\t\t * @param pEvent Instance of the QShowEvent with the show event data.\n\t\t */\n\t\tvoid showEvent(QShowEvent *pEvent);\n\n\t\t/**\n\t\t * Helper method to request the saving of the current face annotation dataset opened\n\t\t * to the user.\n\t\t * @param bAskForFileName Boolean indicating if the UI should ask the user for a file\n\t\t * name. If the value is true, the user is requested to choose a file name, otherwise \n\t\t * (the default) the current file name is used. If the file has not yet been saved,\n\t\t * a file name is requested despite the value on this parameter.\n\t\t * @return Boolean indicating if the save was performed or false if the user cancelled\n\t\t * the operation.\n\t\t */\n\t\tbool saveCurrentFile(bool bAskForFileName=false);\n\n\t\t/**\n\t\t * Gets the page index of the file if already opened in the editor.\n\t\t * @param sFile QString with the complete file name (path + name) of the file to be searched.\n\t\t * @return Integer with the index (in range [0,...]) of the page where the file is opened\n\t\t * or -1 if the file is not already opened in the editor.\n\t\t */\n\t\tint getFilePageIndex(const QString &sFile);\n\n\t\t/**\n\t\t * Updates all the user interface components according to the current state of the application\n\t\t * (i.e. disables action buttons when there is no opened face annotation dataset, etc).\n\t\t */\n\t\tvoid updateUI();\n\n\t\t/**\n\t\t * Captures and handles the keyboard events to automate user interactions.\n\t\t * @param pEvent Instance of the QKeyEvent with the parameters of the event that happened.\n\t\t */\n\t\tvoid keyPressEvent(QKeyEvent *pEvent) Q_DECL_OVERRIDE;\n\n\t\t/**\n\t\t * Creates a new child window instance.\n\t\t * @return Instance of the newly created ChildWindow.\n\t\t */\n\t\tChildWindow *createChildWindow(QString sFileName = QString(), bool bModified = true);\n\n\t\t/**\n\t\t * Destroys the given child window instance.\n\t\t * @param pChild Instance of the ChildWindow to be destroyed.\n\t\t */\n\t\tvoid destroyChildWindow(ChildWindow *pChild);\n\n\tpublic slots:\n\n\t\t/**\n\t\t * Displays a text message in the main window status bar.\n\t\t * @param sMsg QString with the message to be displayed.\n\t\t * @param iTimeout Integer with the number of miliseconds\n\t\t * by which the message will be displayed. The default is 5000\n\t\t * (i.e. 5 seconds).\n\t\t */\n\t\tvoid showStatusMessage(const QString &sMsg, const int iTimeout = 5000);\n\n    private slots:\n\t\t/**\n\t\t * Slot for the menu New trigger event.\n\t\t */ \n\t\tvoid on_actionNew_triggered();\n\n\t\t/**\n\t\t * Slot for the menu Open trigger event.\n\t\t */ \n\t\tvoid on_actionOpen_triggered();\n\n\t\t/**\n\t\t * Slot for the menu Save trigger event.\n\t\t */ \n\t\tvoid on_actionSave_triggered();\n\n\t\t/**\n\t\t * Slot for the menu Save As trigger event.\n\t\t */ \n\t\tvoid on_actionSaveAs_triggered();\n\n        /**\n         * Slot for the menu Exit trigger event.\n         */\n        void on_actionExit_triggered();\n\n\t\t/**\n\t\t * Slot for the menu Configure trigger event.\n\t\t */\n\t\tvoid on_actionConfigure_triggered();\n\n\t\t/**\n\t\t * Slot for the menu Fit Landmarks trigger event.\n\t\t */\n\t\tvoid on_actionFitLandmarks_triggered();\n\n\t\t/**\n\t\t* Slot for the menu Export Points File trigger event.\n\t\t*/\n\t\tvoid on_actionExportPointsFile_triggered();\n\n        /**\n         * Slot for the menu Project trigger event.\n         */\n        void on_actionProject_triggered();\n\n        /**\n         * Slot for the menu About trigger event.\n         */\n        void on_actionAbout_triggered();\n\n\t\t/**\n\t\t * Slot for the tab (child window) closing request (by clicking in the close button).\n\t\t * @param iTabIndex Integer with the index of the tab requested to close.\n\t\t */\n\t\tvoid on_tabCloseRequested(int iTabIndex);\n\n\t\t/**\n\t\t * Slot for the tab (child window) change event (when a new tab is selected).\n\t\t * @param iTabIndex Integer with the index of the tab now selected.\n\t\t */\n\t\tvoid on_tabChanged(int iTabIndex);\n\n\t\t/**\n\t\t * Slot for the button Add Image trigger event.\n\t\t */\n\t\tvoid on_actionAddImage_triggered();\n\n\t\t/**\n\t\t * Slot for the button Add Image trigger event.\n\t\t */\n\t\tvoid on_actionRemoveImage_triggered();\n\n\t\t/**\n\t\t * Slot for the menu Show Image List trigger event.\n\t\t */\n\t\tvoid on_actionShowImagesList_triggered(bool bChecked);\n\n\t\t/**\n\t\t * Slot for the menu Show Image Properties trigger event.\n\t\t */\n\t\tvoid on_actionShowImageProperties_triggered(bool bChecked);\n\n\t\t/**\n\t\t * Slot for the menu Show Face Feature Nodes trigger event.\n\t\t */\n\t\tvoid on_actionShowFeatures_triggered(bool bChecked);\n\n\t\t/**\n\t\t * Slot for the menu Show Face Feature Edges trigger event.\n\t\t */\n\t\tvoid on_actionShowConnections_triggered(bool bChecked);\n\n\t\t/**\n\t\t * Slot for the menu Show Ids of Face Feature Nodes trigger event.\n\t\t */\n\t\tvoid on_actionShowFeatureIDs_triggered(bool bChecked);\n\n\t\t/**\n\t\t * Slot for the menu Add Feature trigger event.\n\t\t */\n\t\tvoid on_actionAddFeature_triggered();\n\n\t\t/**\n\t\t * Slot for the menu Remove Feature trigger event.\n\t\t */\n\t\tvoid on_actionRemoveFeature_triggered();\n\n\t\t/**\n\t\t * Slot for the menu Connect Features trigger event.\n\t\t */\n\t\tvoid on_actionConnectFeatures_triggered();\n\n\t\t/**\n\t\t * Slot for the menu Disconnect Features trigger event.\n\t\t */\n\t\tvoid on_actionDisconnectFeatures_triggered();\n\n\t\t/**\n\t\t * Define the view to be used for the list of images (icons, a list view, or \"details\", a tree view).\n\t\t * @param sType String with the type to be used (either \"icons\" or \"details\").\n\t\t */\n\t\tvoid setImageListView(QString sType);\n\n\t\t/**\n\t\t * Helper method to toggle the current view for the list of images (used in the shortcut button).\n\t\t */\n\t\tvoid toggleImageListView();\n\n\t\t/**\n\t\t * Slot to capture indications of update in the UI due to changes in the child window selection model.\n\t\t * @param sImageName QString with the name of the current selected face image.\n\t\t * @param iZoomLevel Current level of zoom in the face image displayed.\n\t\t */\n\t\tvoid onChildUIUpdated(const QString sImageName, const int iZoomLevel);\n\n\t\t/**\n\t\t * Captures the updates in the zoom slider by user interaction.\n\t\t * @param iValue Integer with the new value of the slider (in the range [1, 21]).\n\t\t */\n\t\tvoid onSliderValueChanged(int iValue);\n\n\t\t/**\n\t\t * Captures the updates in the zoom by user interaction in other sources that not the slider.\n\t\t * @param iValue Integer with the new value of the zoom (in the range [1, 21]).\n\t\t */\n\t\tvoid onZoomLevelChanged(int iValue);\n\n\t\t/**\n\t\t * Captures indications that the UI needs to be updated due to changes in the data model\n\t\t * or selection in the features editor.\n\t\t */\n\t\tvoid onUpdateUI();\n\n\t\t/**\n\t\t * Captures the result (error) of the process executed for the face-fit utility.\n\t\t * @param eError QProcess::ProcessError enumeration with the error type.\n\t\t */\n\t\tvoid onFitError(QProcess::ProcessError eError);\n\n\t\t/**\n\t\t* Captures the conclusion of the process executed for the face-fit utility.\n\t\t* @param eExitStatus QProcess::ExitStatus enumeration with the utility exit status.\n\t\t*/\n\t\tvoid onFitFinished(int iExitCode, QProcess::ExitStatus eExitStatus);\n\n    private:\n        /** Instance of the ui for GUI element access. */\n        Ui::MainWindow *ui;\n\n        /** Instance of the about dialog box. */\n        AboutWindow* m_pAbout;\n\n\t\t/** Last path used in File Dialogs. */\n\t\tQString m_sLastPathUsed;\n\n\t\t/** Path to the face-fit utility. */\n\t\tQString m_sFaceFitPath;\n\n\t\t/** Instance of a dropdown button for the view mode of the image list. */\n\t\tQMenu *m_pViewButton;\n\n\t\t/** Process instance to execute the face-fit utility. */\n\t\tQProcess *m_oFitProcess;\n\n\t\t/** Name of the temporary file used for the face-fit utility. */\n\t\tQString m_sFitTempFile;\n    };\n};\n\n#endif // MAINWINDOW_H\n"
  },
  {
    "path": "src/mainwindow.ui",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ui version=\"4.0\">\n <class>MainWindow</class>\n <widget class=\"QMainWindow\" name=\"MainWindow\">\n  <property name=\"geometry\">\n   <rect>\n    <x>0</x>\n    <y>0</y>\n    <width>912</width>\n    <height>548</height>\n   </rect>\n  </property>\n  <property name=\"windowTitle\">\n   <string>FLAT - Facial Landmarks Annotation Tool</string>\n  </property>\n  <property name=\"autoFillBackground\">\n   <bool>false</bool>\n  </property>\n  <property name=\"locale\">\n   <locale language=\"English\" country=\"UnitedKingdom\"/>\n  </property>\n  <widget class=\"QWidget\" name=\"centralWidget\">\n   <layout class=\"QVBoxLayout\" name=\"verticalLayout\">\n    <property name=\"leftMargin\">\n     <number>0</number>\n    </property>\n    <property name=\"topMargin\">\n     <number>0</number>\n    </property>\n    <property name=\"rightMargin\">\n     <number>0</number>\n    </property>\n    <property name=\"bottomMargin\">\n     <number>0</number>\n    </property>\n    <item>\n     <widget class=\"QTabWidget\" name=\"tabWidget\">\n      <property name=\"locale\">\n       <locale language=\"English\" country=\"UnitedKingdom\"/>\n      </property>\n      <property name=\"tabPosition\">\n       <enum>QTabWidget::North</enum>\n      </property>\n      <property name=\"tabShape\">\n       <enum>QTabWidget::Triangular</enum>\n      </property>\n      <property name=\"iconSize\">\n       <size>\n        <width>24</width>\n        <height>24</height>\n       </size>\n      </property>\n      <property name=\"elideMode\">\n       <enum>Qt::ElideNone</enum>\n      </property>\n      <property name=\"documentMode\">\n       <bool>true</bool>\n      </property>\n      <property name=\"tabsClosable\">\n       <bool>true</bool>\n      </property>\n      <property name=\"movable\">\n       <bool>true</bool>\n      </property>\n      <property name=\"tabBarAutoHide\">\n       <bool>false</bool>\n      </property>\n     </widget>\n    </item>\n   </layout>\n  </widget>\n  <widget class=\"QMenuBar\" name=\"menuBar\">\n   <property name=\"geometry\">\n    <rect>\n     <x>0</x>\n     <y>0</y>\n     <width>912</width>\n     <height>21</height>\n    </rect>\n   </property>\n   <widget class=\"QMenu\" name=\"menuFile\">\n    <property name=\"locale\">\n     <locale language=\"English\" country=\"UnitedKingdom\"/>\n    </property>\n    <property name=\"title\">\n     <string>&amp;File</string>\n    </property>\n    <addaction name=\"actionNew\"/>\n    <addaction name=\"separator\"/>\n    <addaction name=\"actionOpen\"/>\n    <addaction name=\"actionSave\"/>\n    <addaction name=\"actionSaveAs\"/>\n    <addaction name=\"separator\"/>\n    <addaction name=\"actionExit\"/>\n   </widget>\n   <widget class=\"QMenu\" name=\"menuHelp\">\n    <property name=\"locale\">\n     <locale language=\"English\" country=\"UnitedKingdom\"/>\n    </property>\n    <property name=\"title\">\n     <string>&amp;Help</string>\n    </property>\n    <addaction name=\"actionProject\"/>\n    <addaction name=\"separator\"/>\n    <addaction name=\"actionAbout\"/>\n   </widget>\n   <widget class=\"QMenu\" name=\"menuShow\">\n    <property name=\"locale\">\n     <locale language=\"English\" country=\"UnitedKingdom\"/>\n    </property>\n    <property name=\"title\">\n     <string>&amp;Show</string>\n    </property>\n    <widget class=\"QMenu\" name=\"menuWindows\">\n     <property name=\"title\">\n      <string>&amp;Windows</string>\n     </property>\n     <addaction name=\"actionShowImageProperties\"/>\n     <addaction name=\"actionShowImagesList\"/>\n    </widget>\n    <widget class=\"QMenu\" name=\"menu_Image_Elements\">\n     <property name=\"locale\">\n      <locale language=\"English\" country=\"UnitedKingdom\"/>\n     </property>\n     <property name=\"title\">\n      <string>&amp;Image Elements</string>\n     </property>\n     <addaction name=\"actionShowFeatures\"/>\n     <addaction name=\"actionShowConnections\"/>\n     <addaction name=\"actionShowFeatureIDs\"/>\n    </widget>\n    <addaction name=\"menuWindows\"/>\n    <addaction name=\"separator\"/>\n    <addaction name=\"menu_Image_Elements\"/>\n   </widget>\n   <widget class=\"QMenu\" name=\"menuEdit\">\n    <property name=\"locale\">\n     <locale language=\"English\" country=\"UnitedKingdom\"/>\n    </property>\n    <property name=\"title\">\n     <string>&amp;Edit</string>\n    </property>\n    <widget class=\"QMenu\" name=\"menu_Images\">\n     <property name=\"locale\">\n      <locale language=\"English\" country=\"UnitedKingdom\"/>\n     </property>\n     <property name=\"title\">\n      <string>&amp;Images</string>\n     </property>\n     <addaction name=\"actionAddImage\"/>\n     <addaction name=\"actionRemoveImage\"/>\n    </widget>\n    <widget class=\"QMenu\" name=\"menu_Facial_Landmarks\">\n     <property name=\"title\">\n      <string>&amp;Facial Landmarks</string>\n     </property>\n     <addaction name=\"actionAddFeature\"/>\n     <addaction name=\"actionRemoveFeature\"/>\n     <addaction name=\"separator\"/>\n     <addaction name=\"actionConnectFeatures\"/>\n     <addaction name=\"actionDisconnectFeatures\"/>\n    </widget>\n    <addaction name=\"menu_Images\"/>\n    <addaction name=\"separator\"/>\n    <addaction name=\"menu_Facial_Landmarks\"/>\n   </widget>\n   <widget class=\"QMenu\" name=\"menuTools\">\n    <property name=\"locale\">\n     <locale language=\"English\" country=\"UnitedKingdom\"/>\n    </property>\n    <property name=\"title\">\n     <string>&amp;Tools</string>\n    </property>\n    <widget class=\"QMenu\" name=\"menu_CSIRO_Face_Analysis_SDK\">\n     <property name=\"title\">\n      <string>&amp;CSIRO Face Analysis SDK</string>\n     </property>\n     <addaction name=\"actionFitLandmarks\"/>\n     <addaction name=\"actionExportPointsFile\"/>\n     <addaction name=\"separator\"/>\n     <addaction name=\"actionConfigure\"/>\n    </widget>\n    <addaction name=\"menu_CSIRO_Face_Analysis_SDK\"/>\n   </widget>\n   <addaction name=\"menuFile\"/>\n   <addaction name=\"menuEdit\"/>\n   <addaction name=\"menuShow\"/>\n   <addaction name=\"menuTools\"/>\n   <addaction name=\"menuHelp\"/>\n  </widget>\n  <widget class=\"QToolBar\" name=\"fileToolBar\">\n   <property name=\"windowTitle\">\n    <string>File</string>\n   </property>\n   <property name=\"locale\">\n    <locale language=\"English\" country=\"UnitedKingdom\"/>\n   </property>\n   <property name=\"iconSize\">\n    <size>\n     <width>32</width>\n     <height>32</height>\n    </size>\n   </property>\n   <attribute name=\"toolBarArea\">\n    <enum>TopToolBarArea</enum>\n   </attribute>\n   <attribute name=\"toolBarBreak\">\n    <bool>false</bool>\n   </attribute>\n   <addaction name=\"actionNew\"/>\n   <addaction name=\"separator\"/>\n   <addaction name=\"actionOpen\"/>\n   <addaction name=\"actionSave\"/>\n  </widget>\n  <widget class=\"QStatusBar\" name=\"statusBar\"/>\n  <widget class=\"QDockWidget\" name=\"dockProperties\">\n   <property name=\"locale\">\n    <locale language=\"English\" country=\"UnitedKingdom\"/>\n   </property>\n   <property name=\"windowTitle\">\n    <string>Image Properties</string>\n   </property>\n   <attribute name=\"dockWidgetArea\">\n    <number>1</number>\n   </attribute>\n   <widget class=\"QWidget\" name=\"Content\">\n    <layout class=\"QVBoxLayout\" name=\"verticalLayout_7\">\n     <item>\n      <layout class=\"QVBoxLayout\" name=\"verticalLayout_3\">\n       <property name=\"sizeConstraint\">\n        <enum>QLayout::SetMinimumSize</enum>\n       </property>\n       <item>\n        <layout class=\"QHBoxLayout\" name=\"horizontalLayout\">\n         <property name=\"sizeConstraint\">\n          <enum>QLayout::SetMinimumSize</enum>\n         </property>\n         <item>\n          <widget class=\"QLabel\" name=\"labelPath\">\n           <property name=\"font\">\n            <font>\n             <pointsize>12</pointsize>\n            </font>\n           </property>\n           <property name=\"text\">\n            <string>Path:</string>\n           </property>\n           <property name=\"buddy\">\n            <cstring>textFileName</cstring>\n           </property>\n          </widget>\n         </item>\n         <item>\n          <widget class=\"QTextEdit\" name=\"textFileName\">\n           <property name=\"maximumSize\">\n            <size>\n             <width>16777215</width>\n             <height>25</height>\n            </size>\n           </property>\n           <property name=\"verticalScrollBarPolicy\">\n            <enum>Qt::ScrollBarAlwaysOff</enum>\n           </property>\n           <property name=\"horizontalScrollBarPolicy\">\n            <enum>Qt::ScrollBarAlwaysOff</enum>\n           </property>\n           <property name=\"undoRedoEnabled\">\n            <bool>false</bool>\n           </property>\n           <property name=\"lineWrapMode\">\n            <enum>QTextEdit::NoWrap</enum>\n           </property>\n           <property name=\"readOnly\">\n            <bool>true</bool>\n           </property>\n           <property name=\"acceptRichText\">\n            <bool>false</bool>\n           </property>\n           <property name=\"textInteractionFlags\">\n            <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>\n           </property>\n           <property name=\"placeholderText\">\n            <string notr=\"true\"/>\n           </property>\n          </widget>\n         </item>\n        </layout>\n       </item>\n      </layout>\n     </item>\n     <item>\n      <layout class=\"QHBoxLayout\" name=\"horizontalLayout_4\">\n       <item>\n        <widget class=\"QLabel\" name=\"label_Zoom\">\n         <property name=\"font\">\n          <font>\n           <pointsize>12</pointsize>\n          </font>\n         </property>\n         <property name=\"text\">\n          <string>Zoom:</string>\n         </property>\n         <property name=\"buddy\">\n          <cstring>zoomSlider</cstring>\n         </property>\n        </widget>\n       </item>\n       <item>\n        <layout class=\"QVBoxLayout\" name=\"verticalLayout_2\">\n         <item>\n          <widget class=\"QSlider\" name=\"zoomSlider\">\n           <property name=\"font\">\n            <font>\n             <pointsize>12</pointsize>\n            </font>\n           </property>\n           <property name=\"toolTip\">\n            <string>Altera o zoom nas imagens (+/- ou Ctrl+Roda do Mouse)</string>\n           </property>\n           <property name=\"minimum\">\n            <number>1</number>\n           </property>\n           <property name=\"maximum\">\n            <number>21</number>\n           </property>\n           <property name=\"singleStep\">\n            <number>1</number>\n           </property>\n           <property name=\"pageStep\">\n            <number>1</number>\n           </property>\n           <property name=\"value\">\n            <number>11</number>\n           </property>\n           <property name=\"sliderPosition\">\n            <number>11</number>\n           </property>\n           <property name=\"orientation\">\n            <enum>Qt::Horizontal</enum>\n           </property>\n           <property name=\"tickPosition\">\n            <enum>QSlider::TicksBelow</enum>\n           </property>\n           <property name=\"tickInterval\">\n            <number>0</number>\n           </property>\n          </widget>\n         </item>\n         <item>\n          <layout class=\"QHBoxLayout\" name=\"horizontalLayout_3\">\n           <property name=\"sizeConstraint\">\n            <enum>QLayout::SetMinimumSize</enum>\n           </property>\n           <item>\n            <widget class=\"QLabel\" name=\"label1000\">\n             <property name=\"minimumSize\">\n              <size>\n               <width>45</width>\n               <height>0</height>\n              </size>\n             </property>\n             <property name=\"maximumSize\">\n              <size>\n               <width>45</width>\n               <height>16777215</height>\n              </size>\n             </property>\n             <property name=\"text\">\n              <string>10%</string>\n             </property>\n            </widget>\n           </item>\n           <item>\n            <spacer name=\"horizontalSpacer\">\n             <property name=\"orientation\">\n              <enum>Qt::Horizontal</enum>\n             </property>\n             <property name=\"sizeHint\" stdset=\"0\">\n              <size>\n               <width>40</width>\n               <height>20</height>\n              </size>\n             </property>\n            </spacer>\n           </item>\n           <item>\n            <widget class=\"QLabel\" name=\"label100\">\n             <property name=\"minimumSize\">\n              <size>\n               <width>45</width>\n               <height>0</height>\n              </size>\n             </property>\n             <property name=\"maximumSize\">\n              <size>\n               <width>45</width>\n               <height>16777215</height>\n              </size>\n             </property>\n             <property name=\"text\">\n              <string>100%</string>\n             </property>\n             <property name=\"alignment\">\n              <set>Qt::AlignCenter</set>\n             </property>\n            </widget>\n           </item>\n           <item>\n            <spacer name=\"horizontalSpacer_2\">\n             <property name=\"orientation\">\n              <enum>Qt::Horizontal</enum>\n             </property>\n             <property name=\"sizeHint\" stdset=\"0\">\n              <size>\n               <width>40</width>\n               <height>20</height>\n              </size>\n             </property>\n            </spacer>\n           </item>\n           <item>\n            <widget class=\"QLabel\" name=\"label10\">\n             <property name=\"minimumSize\">\n              <size>\n               <width>45</width>\n               <height>0</height>\n              </size>\n             </property>\n             <property name=\"maximumSize\">\n              <size>\n               <width>45</width>\n               <height>16777215</height>\n              </size>\n             </property>\n             <property name=\"text\">\n              <string>1000%</string>\n             </property>\n             <property name=\"alignment\">\n              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>\n             </property>\n            </widget>\n           </item>\n          </layout>\n         </item>\n        </layout>\n       </item>\n      </layout>\n     </item>\n     <item>\n      <spacer name=\"verticalSpacer\">\n       <property name=\"orientation\">\n        <enum>Qt::Vertical</enum>\n       </property>\n       <property name=\"sizeHint\" stdset=\"0\">\n        <size>\n         <width>20</width>\n         <height>40</height>\n        </size>\n       </property>\n      </spacer>\n     </item>\n    </layout>\n   </widget>\n  </widget>\n  <widget class=\"QDockWidget\" name=\"dockImages\">\n   <property name=\"locale\">\n    <locale language=\"English\" country=\"UnitedKingdom\"/>\n   </property>\n   <property name=\"windowTitle\">\n    <string>Image List</string>\n   </property>\n   <attribute name=\"dockWidgetArea\">\n    <number>1</number>\n   </attribute>\n   <widget class=\"QWidget\" name=\"Content_2\">\n    <layout class=\"QGridLayout\" name=\"gridLayout\">\n     <property name=\"leftMargin\">\n      <number>3</number>\n     </property>\n     <property name=\"topMargin\">\n      <number>3</number>\n     </property>\n     <property name=\"rightMargin\">\n      <number>3</number>\n     </property>\n     <property name=\"bottomMargin\">\n      <number>3</number>\n     </property>\n     <property name=\"horizontalSpacing\">\n      <number>3</number>\n     </property>\n     <property name=\"verticalSpacing\">\n      <number>6</number>\n     </property>\n     <item row=\"0\" column=\"0\">\n      <widget class=\"QToolBar\" name=\"imagesToolbar\">\n       <property name=\"windowTitle\">\n        <string/>\n       </property>\n       <property name=\"iconSize\">\n        <size>\n         <width>24</width>\n         <height>24</height>\n        </size>\n       </property>\n       <property name=\"floatable\">\n        <bool>false</bool>\n       </property>\n       <addaction name=\"actionAddImage\"/>\n       <addaction name=\"actionRemoveImage\"/>\n      </widget>\n     </item>\n     <item row=\"1\" column=\"0\">\n      <widget class=\"QListView\" name=\"listImages\">\n       <property name=\"editTriggers\">\n        <set>QAbstractItemView::NoEditTriggers</set>\n       </property>\n       <property name=\"selectionMode\">\n        <enum>QAbstractItemView::ExtendedSelection</enum>\n       </property>\n       <property name=\"selectionBehavior\">\n        <enum>QAbstractItemView::SelectRows</enum>\n       </property>\n       <property name=\"viewMode\">\n        <enum>QListView::IconMode</enum>\n       </property>\n       <property name=\"selectionRectVisible\">\n        <bool>false</bool>\n       </property>\n      </widget>\n     </item>\n     <item row=\"2\" column=\"0\">\n      <widget class=\"QTreeView\" name=\"treeImages\">\n       <property name=\"editTriggers\">\n        <set>QAbstractItemView::AllEditTriggers</set>\n       </property>\n       <property name=\"selectionMode\">\n        <enum>QAbstractItemView::ExtendedSelection</enum>\n       </property>\n       <attribute name=\"headerDefaultSectionSize\">\n        <number>150</number>\n       </attribute>\n      </widget>\n     </item>\n    </layout>\n   </widget>\n  </widget>\n  <widget class=\"QToolBar\" name=\"editToolBar\">\n   <property name=\"windowTitle\">\n    <string>Edit</string>\n   </property>\n   <property name=\"iconSize\">\n    <size>\n     <width>32</width>\n     <height>32</height>\n    </size>\n   </property>\n   <attribute name=\"toolBarArea\">\n    <enum>TopToolBarArea</enum>\n   </attribute>\n   <attribute name=\"toolBarBreak\">\n    <bool>false</bool>\n   </attribute>\n   <addaction name=\"actionAddFeature\"/>\n   <addaction name=\"actionRemoveFeature\"/>\n   <addaction name=\"separator\"/>\n   <addaction name=\"actionConnectFeatures\"/>\n   <addaction name=\"actionDisconnectFeatures\"/>\n  </widget>\n  <widget class=\"QToolBar\" name=\"viewToolBar\">\n   <property name=\"windowTitle\">\n    <string>View</string>\n   </property>\n   <property name=\"iconSize\">\n    <size>\n     <width>32</width>\n     <height>32</height>\n    </size>\n   </property>\n   <attribute name=\"toolBarArea\">\n    <enum>TopToolBarArea</enum>\n   </attribute>\n   <attribute name=\"toolBarBreak\">\n    <bool>false</bool>\n   </attribute>\n   <addaction name=\"actionShowFeatures\"/>\n   <addaction name=\"actionShowConnections\"/>\n   <addaction name=\"actionShowFeatureIDs\"/>\n  </widget>\n  <widget class=\"QToolBar\" name=\"toolsToolBar\">\n   <property name=\"windowTitle\">\n    <string>Tools</string>\n   </property>\n   <property name=\"iconSize\">\n    <size>\n     <width>32</width>\n     <height>32</height>\n    </size>\n   </property>\n   <attribute name=\"toolBarArea\">\n    <enum>TopToolBarArea</enum>\n   </attribute>\n   <attribute name=\"toolBarBreak\">\n    <bool>false</bool>\n   </attribute>\n   <addaction name=\"actionFitLandmarks\"/>\n   <addaction name=\"actionExportPointsFile\"/>\n  </widget>\n  <widget class=\"QToolBar\" name=\"helpTollBar\">\n   <property name=\"windowTitle\">\n    <string>toolBar</string>\n   </property>\n   <property name=\"iconSize\">\n    <size>\n     <width>32</width>\n     <height>32</height>\n    </size>\n   </property>\n   <attribute name=\"toolBarArea\">\n    <enum>TopToolBarArea</enum>\n   </attribute>\n   <attribute name=\"toolBarBreak\">\n    <bool>false</bool>\n   </attribute>\n   <addaction name=\"actionProject\"/>\n  </widget>\n  <action name=\"actionExit\">\n   <property name=\"text\">\n    <string>&amp;Exit</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Terminates the program</string>\n   </property>\n  </action>\n  <action name=\"actionAbout\">\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/information.png</normaloff>:/icons/resources/icons/information.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;About...</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Displays information on this program</string>\n   </property>\n  </action>\n  <action name=\"actionOpen\">\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/open.png</normaloff>:/icons/resources/icons/open.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;Open...</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Loads an existing face annotation dataset from a file</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>Ctrl+O</string>\n   </property>\n  </action>\n  <action name=\"actionNew\">\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/new.png</normaloff>:/icons/resources/icons/new.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;New</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Creates a new face annotation dataset</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>Ctrl+N</string>\n   </property>\n  </action>\n  <action name=\"actionSave\">\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/save.png</normaloff>:/icons/resources/icons/save.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;Save</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Saves the changes in the face annotation dataset</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>Ctrl+S</string>\n   </property>\n  </action>\n  <action name=\"actionSaveAs\">\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/saveas.png</normaloff>:/icons/resources/icons/saveas.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Save &amp;as...</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Saves the changes in the face annotation dataset to a different file</string>\n   </property>\n  </action>\n  <action name=\"actionProject\">\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/help.png</normaloff>:/icons/resources/icons/help.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;Project Docs</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Displays the project's documentation page on Github</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>F1</string>\n   </property>\n  </action>\n  <action name=\"actionAddImage\">\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/add.png</normaloff>:/icons/resources/icons/add.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Add...</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Adds new images to the face annotation dataset</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>Ctrl+Ins</string>\n   </property>\n  </action>\n  <action name=\"actionRemoveImage\">\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/delete.png</normaloff>:/icons/resources/icons/delete.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>Remove</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Removes the selected images from the face annotation dataset</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>Ctrl+Del</string>\n   </property>\n  </action>\n  <action name=\"actionShowImagesList\">\n   <property name=\"checkable\">\n    <bool>true</bool>\n   </property>\n   <property name=\"checked\">\n    <bool>true</bool>\n   </property>\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/image-list.png</normaloff>:/icons/resources/icons/image-list.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;List of Images</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Displays or hides the window with the list of images in the face annotation dataset</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>F2</string>\n   </property>\n  </action>\n  <action name=\"actionShowImageProperties\">\n   <property name=\"checkable\">\n    <bool>true</bool>\n   </property>\n   <property name=\"checked\">\n    <bool>true</bool>\n   </property>\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/image-properties.png</normaloff>:/icons/resources/icons/image-properties.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;Image Properties</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Displays/hides the window with the propriedades of the selected image</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>F3</string>\n   </property>\n  </action>\n  <action name=\"actionShowFeatures\">\n   <property name=\"checkable\">\n    <bool>true</bool>\n   </property>\n   <property name=\"checked\">\n    <bool>true</bool>\n   </property>\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/features.png</normaloff>:/icons/resources/icons/features.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;Landmarks</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Displays/hides the facial landmarks</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>F4</string>\n   </property>\n  </action>\n  <action name=\"actionShowConnections\">\n   <property name=\"checkable\">\n    <bool>true</bool>\n   </property>\n   <property name=\"checked\">\n    <bool>true</bool>\n   </property>\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/links.png</normaloff>:/icons/resources/icons/links.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;Links</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Displays/hides the links between facial landmarks</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>F5</string>\n   </property>\n  </action>\n  <action name=\"actionShowFeatureIDs\">\n   <property name=\"checkable\">\n    <bool>true</bool>\n   </property>\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/feature-ids.png</normaloff>:/icons/resources/icons/feature-ids.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;Labels</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Shows/hides the labels of the facial landmarks</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>F6</string>\n   </property>\n  </action>\n  <action name=\"actionAddFeature\">\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/add-feature.png</normaloff>:/icons/resources/icons/add-feature.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;Add</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Add a new facial landmark to the face annotation dataset</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>Shift+A</string>\n   </property>\n  </action>\n  <action name=\"actionRemoveFeature\">\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/remove-feature.png</normaloff>:/icons/resources/icons/remove-feature.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;Remove</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Removes the selected facial landmarks (and their links) from the face annotation dataset</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>Shift+R</string>\n   </property>\n  </action>\n  <action name=\"actionConnectFeatures\">\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/connect.png</normaloff>:/icons/resources/icons/connect.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;Link</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Links two selected facial landmarks</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>Shift+L</string>\n   </property>\n  </action>\n  <action name=\"actionDisconnectFeatures\">\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/disconnect.png</normaloff>:/icons/resources/icons/disconnect.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;Unlink</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Unlinks the selected facial landmarks</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>Shift+U</string>\n   </property>\n  </action>\n  <action name=\"actionFitLandmarks\">\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/fat</normaloff>:/icons/fat</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;Fit Landmarks</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Attempts to automaticaly fit the face model (with 66 landmarks) to the currently selected face image using the face-fit utility from the CSIRO Face Analysis SDK</string>\n   </property>\n   <property name=\"shortcut\">\n    <string>Ctrl+F</string>\n   </property>\n  </action>\n  <action name=\"actionConfigure\">\n   <property name=\"text\">\n    <string>&amp;Configure...</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Configure the face-fit utility from the CSIRO Face Analysis SDK</string>\n   </property>\n  </action>\n  <action name=\"actionExportPointsFile\">\n   <property name=\"icon\">\n    <iconset resource=\"resources.qrc\">\n     <normaloff>:/icons/resources/icons/image-properties.png</normaloff>:/icons/resources/icons/image-properties.png</iconset>\n   </property>\n   <property name=\"text\">\n    <string>&amp;Export points file...</string>\n   </property>\n   <property name=\"toolTip\">\n    <string>Exports the annotation in current selected image to a CSIRO Face Analysis SDK points file</string>\n   </property>\n  </action>\n </widget>\n <layoutdefault spacing=\"6\" margin=\"11\"/>\n <tabstops>\n  <tabstop>tabWidget</tabstop>\n  <tabstop>textFileName</tabstop>\n  <tabstop>listImages</tabstop>\n  <tabstop>treeImages</tabstop>\n </tabstops>\n <resources>\n  <include location=\"resources.qrc\"/>\n </resources>\n <connections/>\n</ui>\n"
  },
  {
    "path": "src/resources.qrc",
    "content": "<RCC>\n    <qresource prefix=\"/icons\">\n        <file alias=\"fat\">resources/icons/fat.png</file>\n        <file>resources/icons/new.png</file>\n        <file>resources/icons/open.png</file>\n        <file>resources/icons/save.png</file>\n        <file>resources/icons/saveas.png</file>\n        <file>resources/icons/help.png</file>\n        <file alias=\"viewdetails\">resources/icons/viewdetails.png</file>\n        <file alias=\"viewicons\">resources/icons/viewicons.png</file>\n        <file>resources/icons/add.png</file>\n        <file>resources/icons/database.png</file>\n        <file>resources/icons/delete.png</file>\n        <file>resources/icons/information.png</file>\n        <file>resources/icons/image-list.png</file>\n        <file>resources/icons/image-properties.png</file>\n        <file>resources/icons/remove-feature.png</file>\n        <file>resources/icons/add-feature.png</file>\n        <file>resources/icons/feature-ids.png</file>\n        <file>resources/icons/features.png</file>\n        <file>resources/icons/disconnect.png</file>\n        <file>resources/icons/connect.png</file>\n        <file>resources/icons/links.png</file>\n    </qresource>\n    <qresource prefix=\"/images\">\n        <file alias=\"noface\">resources/images/noface.png</file>\n        <file alias=\"brokenimage\">resources/images/brokenimage.png</file>\n        <file alias=\"imagemissing\">resources/images/imagemissing.png</file>\n    </qresource>\n</RCC>\n"
  },
  {
    "path": "src/utils.cpp",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#include \"utils.h\"\n\n#include <QRegExp>\n#include <QStringList>\n#include <QMultiMap>\n#include <QDir>\n#include <QTextStream>\n\nusing namespace std;\n\n// +-----------------------------------------------------------\nft::Utils::Utils()\n{\n}\n\n// +-----------------------------------------------------------\nQString ft::Utils::shortenPath(const QString &sPath, int iMaxLen)\n{\n\t// If the string is not long enough, simply return it\n\tif(sPath.length() <= iMaxLen)\n\t\treturn QDir::toNativeSeparators(sPath);\n\n\tQFileInfo oFile = QFileInfo(sPath);\n\tQString sPathOnly = oFile.path();\n\tQString sFileName = QDir::separator() + oFile.fileName();\n\tQString sDriveLetter = \"\"; // In case it is running on a Windows OS\n\n    // Firstly, split the path (only) into parts (for the drive letter and/or each subfolder)\n    QRegExp oRegex(\"([\\\\\\\\\\\\/][\\\\w -\\\\.]*)\");\n    QStringList lsParts;\n\tQMultiMap<int, int> mpSortedParts;\n    QString sPart;\n\n    bool bFirst = true;\n    int iPos = 0;\n    while((iPos = oRegex.indexIn(sPathOnly, iPos)) != -1)\n    {\n        if(bFirst)\n        {\n            sDriveLetter = sPathOnly.left(iPos);\n            bFirst = false;\n        }\n        sPart = oRegex.cap(1);\n        lsParts.push_back(sPart);\n\t\tmpSortedParts.insert(sPart.length(), lsParts.count() - 1);\n        iPos += oRegex.matchedLength();\n    }\n\n\t// Then, iteratively remove the larger parts while the path is bigger than\n\t// the maximum number of characters desired\n\tQString sNewPath;\n\tdo\n\t{\n\t\tsNewPath = \"\";\n\n\t\t// Rebuild the path replacing the so far larger part for \"...\"\n\t\tQMapIterator<int, int> oSorted(mpSortedParts);\n\t\toSorted.toBack();\n\t\tif(oSorted.hasPrevious())\n\t\t{\n\t\t\tint iLength = oSorted.peekPrevious().key();\n\t\t\tint iIndex = oSorted.peekPrevious().value();\n\t\t\tmpSortedParts.remove(iLength, iIndex);\n\n\t\t\tlsParts.replace(iIndex, QDir::separator() + QString(\"...\"));\n\t\t\n\t\t\tfor(QStringList::iterator it = lsParts.begin(); it != lsParts.end(); ++it)\n\t\t\t\tsNewPath += *it;\n\t\t}\n\t} while(sNewPath.length() > 0 && QString(sDriveLetter + sNewPath + sFileName).length() > iMaxLen);\n\n\tif(sNewPath.length() == 0)\n\t\tsNewPath = QDir::separator() + QString(\"...\");\n\n\treturn QDir::toNativeSeparators(sDriveLetter + sNewPath + sFileName);\n}\n\n// +-----------------------------------------------------------\nvector<QPoint> ft::Utils::readFaceFitPointsFile(QString sFileName)\n{\n\tQFile oFile(sFileName);\n\tif (!oFile.open(QFile::ReadOnly))\n\t\treturn vector<QPoint>();\n\n\tQTextStream oStream(&oFile);\n\tQString sLine;\n\tQStringList lData;\n\tint iNumPoints;\n\n\t// Read the number of points from the first line\n\tsLine = oStream.readLine();\n\tlData = sLine.split(\" \");\n\tif (lData.size() != 2 || lData.at(0) != \"n_points:\")\n\t{\n\t\toFile.close();\n\t\treturn vector<QPoint>();\n\t}\n\telse\n\t\tiNumPoints = lData[1].toInt();\n\n\t// Read the points\n\tvector<QPoint> vPoints;\n\twhile (!oStream.atEnd())\n\t{\n\t\tsLine = oStream.readLine();\n\t\tif (sLine == \"{\" || sLine == \"}\")\n\t\t\tcontinue;\n\n\t\tlData = sLine.split(\"\\t\");\n\t\tif (lData.size() != 2)\n\t\t{\n\t\t\toFile.close();\n\t\t\treturn vector<QPoint>();\n\t\t}\n\n\t\tfloat x = lData[0].toFloat();\n\t\tfloat y = lData[1].toFloat();\n\t\tvPoints.push_back(QPoint(x, y));\n\t}\n\n\toFile.close();\n\n\tif (vPoints.size() != iNumPoints)\n\t\treturn vector<QPoint>();\n\telse\n\t\treturn vPoints;\n}\n"
  },
  {
    "path": "src/utils.h",
    "content": "/*\n * Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#ifndef UTILS_H\n#define UTILS_H\n\n#include <QString>\n#include <QPoint>\n#include <vector>\n\nnamespace ft\n{\n     /**\n      * Static class with utilitary functions of general use.\n      */\n    class Utils\n    {\n    protected:\n        /**\n         * Protected class constructor to prevent this class from being instantiated.\n         */\n        Utils();\n\n    public:\n        /**\n         * Shorten the given path by replacing subdirectories with \"...\". Mainly used\n         * for path displaying in the user interface. Exiting file name and drive letter\n\t\t * (in case of Windows) are not replaced. Hence, the minimum string returned\n\t\t * by this method will be the composition of a drive letter at the beginning, \n\t\t * a file name at the end, and a single \"/.../\" in between.\n         * @param sPath QString with the path to be shortened.\n\t\t * @param iMaxLen Maximum length in characters to trigger the shortening (that is,\n\t\t * the path will be shortened only if its current length exceeds this maximum value).\n\t\t * The default is 100 characters.\n         * @return QString with the path shortened and all separators changed to the native OS\n\t\t * standard.\n         */\n        static QString shortenPath(const QString &sPath, int iMaxLen = 100);\n\n\t\t/**\n\t\t * Reads a points file produced by the face-fit utility.\n\t\t * @return A std::vector with a list of QPoint instances with the points\n\t\t * of facial landmarks fitted to an image, or an empty vector if the reading\n\t\t * failed.\n\t\t */\n\t\tstatic std::vector<QPoint> readFaceFitPointsFile(QString sFileName);\n    };\n}\n\n#endif // UTILS_H"
  },
  {
    "path": "version.h.in",
    "content": "/* Copyright (C) 2016 Luiz Carlos Vieira (http://www.luiz.vieira.nom.br)\n *\n * This file is part of FLAT.\n *\n * FLAT is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * FLAT is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\n#define FLAT_VERSION_MAJOR @FLAT_VERSION_MAJOR@\n#define FLAT_VERSION_MINOR @FLAT_VERSION_MINOR@\n#define FLAT_VERSION_PATCH @FLAT_VERSION_PATCH@\n#define FLAT_VERSION \"@FLAT_VERSION@\""
  }
]