From 9c6d016c186a0488f498c31cdc9970fb83dd0cc3 Mon Sep 17 00:00:00 2001 From: acpaquette Date: Wed, 3 Mar 2021 15:27:51 -0700 Subject: [PATCH] Removed gisblob from isis (#4329) --- isis/src/base/objs/GisBlob/GisBlob.cpp | 91 --- isis/src/base/objs/GisBlob/GisBlob.h | 53 -- isis/src/base/objs/GisBlob/GisBlob.truth | 9 - isis/src/base/objs/GisBlob/Makefile | 7 - isis/src/base/objs/GisBlob/unitTest.cpp | 70 -- .../src/base/objs/GisGeometry/GisGeometry.cpp | 611 +++++++++--------- isis/src/base/objs/GisGeometry/unitTest.cpp | 47 +- isis/src/base/objs/GisTopology/unitTest.cpp | 18 +- .../src/base/objs/ImagePolygon/ImagePolygon.h | 5 + 9 files changed, 343 insertions(+), 568 deletions(-) delete mode 100644 isis/src/base/objs/GisBlob/GisBlob.cpp delete mode 100644 isis/src/base/objs/GisBlob/GisBlob.h delete mode 100644 isis/src/base/objs/GisBlob/GisBlob.truth delete mode 100644 isis/src/base/objs/GisBlob/Makefile delete mode 100644 isis/src/base/objs/GisBlob/unitTest.cpp diff --git a/isis/src/base/objs/GisBlob/GisBlob.cpp b/isis/src/base/objs/GisBlob/GisBlob.cpp deleted file mode 100644 index db6f6d0edc..0000000000 --- a/isis/src/base/objs/GisBlob/GisBlob.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/** This is free and unencumbered software released into the public domain. -The authors of ISIS do not claim copyright on the contents of this file. -For more details about the LICENSE terms and the AUTHORS, you will -find files of those names at the top level of this repository. **/ - -/* SPDX-License-Identifier: CC0-1.0 */ -#include "GisBlob.h" - -// Qt library -#include -#include - -// other ISIS -#include "Blob.h" -#include "Cube.h" - -namespace Isis { - - /** - * Constructs an Isis polygon-type Blob named "Footprint." - */ - GisBlob::GisBlob() : Blob("Footprint", "Polygon"), m_wkt() { - } - - - /** - * Constructs an Isis polygon-type Blob named "Footprint" and sets the - * well-known text string that defines the polygon by reading the - * given cube. - * @param cube - */ - GisBlob::GisBlob(Cube &cube) : Blob("Footprint", "Polygon"), m_wkt() { - cube.read(*this); - m_wkt = scrub(p_buffer, p_nbytes); - } - - - /** - * Destroys the GisBlob object. - */ - GisBlob::~GisBlob() { - } - - - /** - * Accesses the well-known text string that defines the polygon. - * - * @return QString A well-known text string containing the polygon definition. - */ - QString GisBlob::polygon() const { - return (m_wkt); - } - - - /** - * Sets the polygon using the given well-known text string. - * - * @param wkt A string containing the well-known text that defines a polygon. - */ - void GisBlob::setPolygon(const QString &wkt) { - delete [] p_buffer; - p_nbytes = wkt.size(); - p_buffer = new char[p_nbytes+1]; - for (int i = 0 ; i < p_nbytes ; i++) { - p_buffer[i] = wkt[i].toLatin1(); - } - p_buffer[p_nbytes] = 0; - m_wkt = scrub(p_buffer, p_nbytes); - return; - } - - - /** - * This method will scrub all zeros that prefix the given buffer and convert - * it to a string using the number of allocated bytes given. - * - * @param rawbuf A pointer containing the raw buffer to be converted. - * @param rbytes The number of bytes to be read in. - * - * @return QString A string converted from the given raw buffer. - */ - QString GisBlob::scrub(const char *rawbuf, int rbytes) const { - int i; - for (i = 0 ; i < rbytes ; i++) { - if (rawbuf[i] != 0) break; - } - int nbytes = rbytes - i; - return (QString::fromLatin1(&rawbuf[i], nbytes)); - } - -} // Namespace Isis diff --git a/isis/src/base/objs/GisBlob/GisBlob.h b/isis/src/base/objs/GisBlob/GisBlob.h deleted file mode 100644 index 6ca28e6242..0000000000 --- a/isis/src/base/objs/GisBlob/GisBlob.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef GisBlob_h -#define GisBlob_h -/** This is free and unencumbered software released into the public domain. -The authors of ISIS do not claim copyright on the contents of this file. -For more details about the LICENSE terms and the AUTHORS, you will -find files of those names at the top level of this repository. **/ - -/* SPDX-License-Identifier: CC0-1.0 */ - -// parent class -#include "Blob.h" - -// Qt library -#include - -namespace Isis { - class Cube; - - /** - * This class creates a polygon-type Isis Blob named "Footprint". It inherits - * from the Isis Blob class. This Blob may be read from a given cube or the - * polygon maybe set using a wkt polygon string. - * - * @author 2012-07-15 Kris Becker - * @internal - * @history 2012-07-15 Kris Becker - Original version. - * @history 2015-03-18 Jeannie Backer - Brought class files closer to ISIS coding standards. - * @history 2015-03-31 Jeannie Backer - Updated documentation. - * @history 2016-03-02 Ian Humphrey - Updated for coding standards compliance in preparation - * for adding this class to ISIS. Fixes #2398. - */ - class GisBlob : public Blob { - public: - GisBlob(); - - GisBlob(Cube &cube); - - ~GisBlob(); - - QString polygon() const; - - void setPolygon(const QString &wkt); - - private: - QString scrub(const char *rawbuf, int rbytes) const; - - QString m_wkt; //!< Well-known text string containing the polygon defintion for this GIS blob. - }; -} // Namespace Isis - -#endif - - diff --git a/isis/src/base/objs/GisBlob/GisBlob.truth b/isis/src/base/objs/GisBlob/GisBlob.truth deleted file mode 100644 index ee75776376..0000000000 --- a/isis/src/base/objs/GisBlob/GisBlob.truth +++ /dev/null @@ -1,9 +0,0 @@ - -Testing GisBlob's constructor from cube... - Polygon = "MULTIPOLYGON (((291.6482444065063646 54.0748894594413585, 291.7020280173438778 54.0296213291622252, 291.7549863030990878 53.9855163702604841, 291.8077241043083063 53.9408969996877730, 291.8597668189949559 53.8946553693238144, 291.9115817220681492 53.8481113710558290, 291.9632972250017247 53.8015908846553899, 292.0149168432692477 53.7550951640192096, 292.0663616370068212 53.7084560328413261, 292.1175651154498496 53.6615584860058590, 292.1685668928934660 53.6145070190250905, 292.2194413771372865 53.5674528855087715, 292.2702805486716215 53.5205538615438172, 292.3211200787451389 53.4738490257722603, 292.3718951696537829 53.4272104110366328, 292.4225915190824026 53.3806060588361007, 292.4731960443905336 53.3340102581895863, 292.5235491233975154 53.2871937647895280, 292.5737242366652140 53.2402789357434756, 292.6237816497238668 53.1933537780923942, 292.6739185641310428 53.1466663964377020, 292.7240335911182001 53.1000657976819284, 292.7739222679502973 53.0533009388871761, 292.8232431340212543 53.0060022579488432, 292.8720776771814371 52.9583140917663684, 292.9205947272178037 52.9104549807315365, 292.9693168006734822 52.8629718702368621, 293.0180243131512725 52.8156123812802676, 293.0664607895325844 52.7681230400179473, 293.1152230547680801 52.7210579699985686, 293.1641964887326139 52.6742723067946770, 293.2131949281665584 52.6275784848334709, 293.2619983325158728 52.5807860608043711, 293.3106949564739807 52.5339721869144824, 293.3593726059783080 52.4872032262072921, 293.4080105056222578 52.4404570781291142, 293.4564648886776581 52.3936281659687495, 293.5048154773041347 52.3467767520141436, 293.5532286649856815 52.3000111651323678, 293.6016151052821215 52.2532636570787332, 293.6496102604362477 52.2063096901261545, 293.6972856371680223 52.1592109716392258, 293.7448142048647810 52.1120784019265457, 293.7921346113900540 52.0648815632344082, 293.8392722446478729 52.0176397744607399, 293.8863180705967579 51.9704024852086377, 293.9335962428397693 51.9233227111062661, 293.9808809459452732 51.8762775325007652, 294.0278825655254309 51.8291340534371301, 294.0748257771958833 51.7819966404094458, 294.1217863418343086 51.7348933433405946, 294.1686076850560312 51.6877577856796790, 294.2154245767899283 51.6406415633166205, 294.2621689200627770 51.5935160974246045, 294.3088424299793928 51.5463808135885628, 294.3554786257141132 51.4992452332349870, 294.4020474869581676 51.4520976068226830, 294.4487032212942950 51.4049811909859713, 294.4952914913296240 51.3578458802051472, 294.5418969895747523 51.3107127023418883, 294.5884347400872798 51.2635564562394208, 294.6348785316565682 51.2163704162111344, 294.6813714906026576 51.1691860297657186, 294.7276923109479299 51.1219529737556186, 294.7738344522448415 51.0746736215991461, 294.8197718395178981 51.0273470951758696, 294.8654929360217238 50.9799761011058834, 294.9112626249865343 50.9326058392748848, 294.9571326309937263 50.8852385824861955, 295.0028081042060535 50.8378299359886867, 295.0483599950314328 50.7903921654531985, 295.0938159376023577 50.7429295926595358, 295.1394393952502355 50.6954672716803998, 295.1849886311760542 50.6479769473739339, 295.2302510328869403 50.6004433494925010, 295.2751700987382151 50.5528698438340527, 295.3200302318319359 50.5052789709472236, 295.3651817746400638 50.4576837161567440, 295.4102514173258101 50.4100616461730695, 295.4554187475314393 50.3624162955004522, 295.5005451617301446 50.3147411900532333, 295.5454941248207774 50.2670354744187762, 295.5901264260956509 50.2193036524553094, 295.6345902381398218 50.1715496780019024, 295.6788486553651296 50.1237772068778114, 295.7231187033184483 50.0759813438211268, 295.7673408602476002 50.0281624317159554, 295.8116127406512987 49.9803140857962518, 295.8560810864870518 49.9324232409902393, 295.9005769971004156 49.8844953496522550, 295.9446838645065441 49.8365625667986407, 295.9886221285325405 49.7886128304107629, 296.0323211243245396 49.7406556427859172, 296.0759910747153185 49.6926722818829845, 296.1194565103898526 49.6446821048827829, 296.1624897088751709 49.5967167487294276, 296.2054086607993213 49.5487424737293551, 296.2484396719925712 49.5007281817789533, 296.2915134711480505 49.4526796665121608, 296.3350389573967618 49.4045300978008015, 296.3786114499501991 49.3563338330455679, 296.4222302019360313 49.3080883623094124, 296.4656892412461389 49.2598280749685955, 296.4782574023010966 49.2419677041339625, 296.4032185014780225 49.2138422027338365, 296.3291599281647564 49.1861284721513243, 296.2549758604650378 49.1584150628567116, 296.1805181984752267 49.1307377732130348, 296.1059958275960753 49.1030596410174311, 296.0319753508879330 49.0752577913664254, 295.9588442320529111 49.0472336740290160, 295.8861134027861226 49.0190860042944365, 295.8124228918390486 48.9911441745806684, 295.7382596561083119 48.9633095596598835, 295.6644117428859886 48.9353885153610904, 295.5913488263511795 48.9072473769558513, 295.5188683870677551 48.8789250825906123, 295.4460786412217885 48.8506686873925204, 295.3732701352031427 48.8224019007348673, 295.2999915852694244 48.7942691567235656, 295.2264283102026639 48.7662284257375518, 295.1533647828368316 48.7380309852390639, 295.0810040310718705 48.7095944639431977, 295.0091863998481472 48.6809554786322849, 294.9373959127930220 48.6522880295360594, 294.8652730269428730 48.6237309200630392, 294.7932479399684667 48.5951308767385797, 294.7213583334407758 48.5664725545892892, 294.6494236802788578 48.5378302049381105, 294.5773206088004486 48.5092633660961496, 294.5054333742040171 48.4806113445442151, 294.4346026686405366 48.4514789854476291, 294.3647067933559924 48.4218794804552743, 294.2947492459967975 48.3922649000824663, 294.2238142620729491 48.3631107066558954, 294.1527610573676839 48.3340145652618460, 294.0815147202526987 48.3050286789722350, 294.0099980936771544 48.2762131959080136, 293.9382460173290497 48.2475698037275080, 293.8668697140522568 48.2187474532939362, 293.7962609736145509 48.1894822988117610, 293.7255394666512416 48.1603063113648275, 293.6547781318735133 48.1311843990246970, 293.5843065515867352 48.1018949307871537, 293.5141586740939488 48.0723985331187009, 293.4444700902735121 48.0425737339503200, 293.3749064547343437 48.0126509102984969, 293.3050575999341731 47.9829593986607890, 293.2352034076224072 47.9532950309601915, 293.1654531168650806 47.9235700964377784, 293.0958477939764748 47.8937448880645533, 293.0263787567034228 47.8638207881203996, 292.9568858384029113 47.8339501037519241, 292.8874362986734923 47.8040757589463183, 292.8180445861410703 47.7741872572646500, 292.7487592169084678 47.7442337012970270, 292.6796079813448159 47.7141793537199916, 292.6105254595862561 47.6840965526444549, 292.5414489407279461 47.6540678195429379, 292.4724300337906016 47.6240374558369268, 292.4035989135194882 47.5938277490541424, 292.3350381260194695 47.5632960657097072, 292.2666059363026534 47.5326200150254294, 292.1981252697848390 47.5020738206643074, 292.1295887369751654 47.4716991949019018, 292.0611460375269530 47.4412605827019220, 291.9928009984063806 47.4107468251615103, 291.9245641102601780 47.3801307584919442, 291.8563543684800266 47.3495759935504452, 291.7882006024591419 47.3190364969257899, 291.7201019385726113 47.2885256469011352, 291.6521393383902705 47.2578461482878325, 291.5843787631462760 47.2267846937686215, 291.5168317396303905 47.1952282052031080, 291.4492464832235896 47.1638894034807024, 291.3816293898299818 47.1328167907642452, 291.3140627606528597 47.1017797901754420, 291.2465582098835739 47.0707529404682532, 291.1791118217741996 47.0397717627595284, 291.1117364145860620 47.0087996190138426, 291.0444662616026221 46.9776521074006155, 290.9772966918184238 46.9463014906870910, 290.9102084353484088 46.9148200635959469, 290.8431866098990213 46.8832984418343415, 290.7762173982538911 46.8519018482588834, 290.7093152517370527 46.8205640770849811, 290.6424914170170837 46.7891699520966071, 290.5757490817570670 46.7575740040825778, 290.5090796708282710 46.7257398497000977, 290.4424748469443784 46.6939354890210154, 290.3759385704620968 46.6621558917914996, 290.3094735853126735 46.6303799301904860, 290.2430782179271773 46.5985395060219361, 290.1767412655061662 46.5665028466696711, 290.1104620752193455 46.5343432693806136, 290.0442657086978215 46.5023241289388807, 289.9781432507954264 46.4703032081830543, 289.9120787066955813 46.4381525977341951, 289.8460907244865439 46.4060177803553273, 289.7802251110452403 46.3741527167005287, 289.7144742069608583 46.3424423196200763, 289.6488095562927469 46.3107023232924249, 289.5832003916290205 46.2787873333416186, 289.5176388907983096 46.2466885757636845, 289.4520462285495341 46.2141017607484343, 289.3864267339227467 46.1811141464289676, 289.3618561776004867 46.1711714273995071, 289.3147779156129218 46.2173242257311614, 289.2682700210863231 46.2625948223290919, 289.2216498274489140 46.3077334989910909, 289.1748745355735650 46.3526214941802124, 289.1280376293947256 46.3975741281184426, 289.0812223379438706 46.4428210011357905, 289.0343472417508792 46.4880973442382484, 288.9874257852919186 46.5334322049573217, 288.9405044417976569 46.5789322394382452, 288.8934837043753419 46.6243341170829027, 288.8463427575331366 46.6695988190028146, 288.7991799003812048 46.7149574330253188, 288.7519302493046780 46.7602581950852993, 288.7044789857983460 46.8052713999669052, 288.6569388683359421 46.8502485880938977, 288.6094424913905527 46.8954406931386885, 288.5620397675693312 46.9409105839929666, 288.5146096371197473 46.9864133831112767, 288.4669533014785543 47.0316098743400701, 288.4189979084742959 47.0764138053209535, 288.3708092782399603 47.1209678506684355, 288.3225205926835883 47.1654960549336408, 288.2743455744467838 47.2103062528499819, 288.2260406104195454 47.2550301230308776, 288.1776038116196332 47.2996724655994498, 288.1290910621896728 47.3443118275832120, 288.0806004866909689 47.3890679637712893, 288.0320864200181177 47.4338721088212836, 287.9835128725551385 47.4786755144914636, 287.9348544417925382 47.5234476156226791, 287.8860935537533692 47.5681703825700382, 287.8372773616805489 47.6128949787879847, 287.7883288015262906 47.6575421974380475, 287.7393085634204795 47.7021757070334687, 287.6902605832405015 47.7468350283393193, 287.6410876324868013 47.7914283366073178, 287.5917481486421821 47.8359242643672431, 287.5423471737791488 47.8804175478147940, 287.4929818798205474 47.9249836617375706, 287.4435300772136657 47.9695183131695515, 287.3939311769159985 48.0139770798353211, 287.3442363755654014 48.0584018935020794, 287.2944182676178571 48.1027748648423952, 287.2447020877938826 48.1472485026180692, 287.1950591428314397 48.1917908022441068, 287.1452952545445783 48.2362713471827362, 287.0953441578890875 48.2806539821297562, 287.0451863503462278 48.3249349211713550, 286.9949077614967337 48.3691695420140064, 286.9444735218841629 48.4133416921263873, 286.8940363669749445 48.4575332864047326, 286.8434760753363548 48.5016805430202851, 286.7926138665326903 48.5457016207637011, 286.7414943640096112 48.5896286026594737, 286.6903929526483807 48.6335896342714165, 286.6393507379582388 48.6775956709724866, 286.5883160953767970 48.7216182199543653, 286.5371352461281163 48.7655935946100314, 286.4858893720233937 48.8095542615773539, 286.4345830897714222 48.8535006122709063, 286.3831420753027146 48.8974063618426840, 286.3313949286018101 48.9412186275038579, 286.2794287606336638 48.9849733476629297, 286.2271237527501171 49.0286407173921361, 286.1747934942748657 49.0723176450905072, 286.1226207794685479 49.1160491477687486, 286.0705778239361052 49.1598179149401204, 286.0185387849462586 49.2035851470715215, 285.9663555293917057 49.2473136664860647, 285.9139828228739475 49.2909956681908312, 285.8615048751227050 49.3346515723928292, 285.8089409308830682 49.3782853448059882, 285.7561709971500932 49.4218750455458391, 285.7033744198886325 49.4654544937027154, 285.6505294182767898 49.5090178755621935, 285.5977727123407135 49.5525837744106425, 285.5447446092979362 49.5960970702829229, 285.4914875549942508 49.6395684556400170, 285.4379846370865152 49.6829997262990304, 285.3843843052756597 49.7264110256648948, 285.3308342690713175 49.7698167182288245, 285.2773646050080174 49.8132152409817408, 285.2239238309639404 49.8565975374196668, 285.1703158928399375 49.8999460743720107, 285.1164481902447960 49.9432567010531869, 285.0625323547681660 49.9865451770147544, 285.0082665476087413 50.0297957865672416, 284.9537084881674787 50.0730166730696595, 284.8991894805907918 50.1162226853946606, 284.8446182125073278 50.1594081318238167, 284.7898601929547908 50.2025694147422996, 284.7349043728681863 50.2457080812009522, 284.6799771552385323 50.2888265780296280, 284.6248540494665917 50.3319228431918049, 284.5695238923811416 50.3749986845891300, 284.5144490571994993 50.4180478736866817, 284.4593856466942725 50.4610690021459973, 284.4040790806055838 50.5040674495806385, 284.3484586308211988 50.5470482927714784, 284.2935341408388581 50.5899723488597601, 284.2391049473005182 50.6328348676932407, 284.1837853403296208 50.6757005534934777, 284.1663273815096318 50.6919534014300766, 284.2345597693270065 50.7277015503154161, 284.3020640473581579 50.7628777224099892, 284.3702656899958470 50.7979746069000484, 284.4387418467628663 50.8330150873104074, 284.5071713340328188 50.8680245376072975, 284.5755687379514143 50.9030045092247363, 284.6443164345435548 50.9379171054902500, 284.7135533824027220 50.9727405217829670, 284.7829461739408430 51.0075059628211491, 284.8521768237749825 51.0422529775025851, 284.9213779308003609 51.0769691887487411, 284.9906032701824756 51.1116495917477351, 285.0598819033065183 51.1462913063788349, 285.1294270280205865 51.1808602737040772, 285.1992202696198433 51.2153549031564808, 285.2689486693911363 51.2498278200912978, 285.3385407699790335 51.2842969395446175, 285.4080991362617965 51.3187480716453166, 285.4778056611060606 51.3531464893620608, 285.5483833920509369 51.3873301698831071, 285.6193015406489053 51.4213979996852473, 285.6897321570879740 51.4555427015166273, 285.7594982587881987 51.4898277189353308, 285.8295266909508996 51.5240324011132174, 285.8995795188444049 51.5582171669147584, 285.9694603052748789 51.5924415814695649, 286.0394555568004762 51.6266293964584264, 286.1098454748561153 51.6606923298506473, 286.1806846868420280 51.6946012555894825, 286.2515634685805139 51.7284818757417852, 286.3217610437835106 51.7625925450240558, 286.3918947636801136 51.7967386371245837, 286.4624479942411881 51.8307423644522842, 286.5336661467025579 51.8644918118881932, 286.6050516772942274 51.8981677383684854, 286.6765569414309311 51.9317872895232000, 286.7481309225292421 51.9653721726498503, 286.8199530521117708 51.9988397589956506, 286.8920127214390163 52.0321867072350770, 286.9640676739491596 52.0655270933311627, 287.0361337373960282 52.0988579772036928, 287.1084521342681342 52.1320521938549248, 287.1808429436290453 52.1652016017904359, 287.2528037265199146 52.1986044777616200, 287.3251766498365214 52.2317791050783669, 287.3976852881675086 52.2648798818484437, 287.4697242670244464 52.2983072795676875, 287.5421226029587842 52.3315320485897573, 287.6148867344307405 52.3645289209294447, 287.6877004396365578 52.3975127478532059, 287.7605440724607888 52.4305033881260840, 287.8332983279560722 52.4636054057247634, 287.9057493954031202 52.4970217668427779, 287.9780316068848265 52.5306795409256608, 288.0504439921309086 52.5643367368246146, 288.1234401644522904 52.5975550143054207, 288.1976382829452064 52.6296474297664219, 288.2721681013861144 52.6613877226737159, 288.3463897438006143 52.6934494034029157, 288.4202322563753569 52.7259736328181674, 288.4939397938130696 52.7587388913465958, 288.5678468760376063 52.7913568215394164, 288.6419218814429541 52.8238536973012103, 288.7165029135949794 52.8557306608363362, 288.7912456624506490 52.8874137480644535, 288.8656727128577586 52.9196471844023790, 288.9400718311589458 52.9520515232037781, 289.0145695908635162 52.9844388557765029, 289.0890412533441349 53.0170554947797967, 289.1635635592601830 53.0497993040304365, 289.2382911325804002 53.0823639878877032, 289.3132195813146836 53.1147272726123987, 289.3882373382535889 53.1471368006245015, 289.4633522768713192 53.1795932616528120, 289.5386395897923535 53.2118916057759463, 289.6140551665824887 53.2441442933252560, 289.6895157143202368 53.2766587857948153, 289.7651099666896926 53.3091747733643402, 289.8409073665112601 53.3413820299417480, 289.9168235491238192 53.3736136015565563, 289.9928758081005071 53.4057942992804442, 290.0690425949051701 53.4380804602550015, 290.1453574173241918 53.4702653414589975, 290.2218095760875372 53.5024220046409624, 290.2983878999274339 53.5347670501741035, 290.3751182413015499 53.5670164502047257, 290.4519987557255263 53.5988030640775577, 290.5290061844957563 53.6305483723634140, 290.6061466002392422 53.6623930165058809, 290.6834140633079642 53.6940874221143645, 290.7608043693315949 53.7256675476979808, 290.8382970713091709 53.7569901973408975, 290.9159587660024044 53.7886645754515271, 290.9938283926157396 53.8207705659212365, 291.0717891428241728 53.8524693735371756, 291.1498394700072367 53.8838731934801629, 291.2279334662110841 53.9148453185582071, 291.3061172279390689 53.9456783680282825, 291.3844357241167131 53.9765654329084370, 291.4627282140606894 54.0069110349376871, 291.5408564454050975 54.0363542888421122, 291.6190588029043624 54.0657945141910190, 291.6482444065063646 54.0748894594413585)))" - -Testing GisBlob's default constructor... - Polygon = "" - -Adding WKT polygon to GisBlob... - Polygon = "MULTIPOLYGON (((291.6482444065063646 54.0748894594413585, 291.7020280173438778 54.0296213291622252, 291.7549863030990878 53.9855163702604841, 291.8077241043083063 53.9408969996877730, 291.8597668189949559 53.8946553693238144, 291.9115817220681492 53.8481113710558290, 291.9632972250017247 53.8015908846553899, 292.0149168432692477 53.7550951640192096, 292.0663616370068212 53.7084560328413261, 292.1175651154498496 53.6615584860058590, 292.1685668928934660 53.6145070190250905, 292.2194413771372865 53.5674528855087715, 292.2702805486716215 53.5205538615438172, 292.3211200787451389 53.4738490257722603, 292.3718951696537829 53.4272104110366328, 292.4225915190824026 53.3806060588361007, 292.4731960443905336 53.3340102581895863, 292.5235491233975154 53.2871937647895280, 292.5737242366652140 53.2402789357434756, 292.6237816497238668 53.1933537780923942, 292.6739185641310428 53.1466663964377020, 292.7240335911182001 53.1000657976819284, 292.7739222679502973 53.0533009388871761, 292.8232431340212543 53.0060022579488432, 292.8720776771814371 52.9583140917663684, 292.9205947272178037 52.9104549807315365, 292.9693168006734822 52.8629718702368621, 293.0180243131512725 52.8156123812802676, 293.0664607895325844 52.7681230400179473, 293.1152230547680801 52.7210579699985686, 293.1641964887326139 52.6742723067946770, 293.2131949281665584 52.6275784848334709, 293.2619983325158728 52.5807860608043711, 293.3106949564739807 52.5339721869144824, 293.3593726059783080 52.4872032262072921, 293.4080105056222578 52.4404570781291142, 293.4564648886776581 52.3936281659687495, 293.5048154773041347 52.3467767520141436, 293.5532286649856815 52.3000111651323678, 293.6016151052821215 52.2532636570787332, 293.6496102604362477 52.2063096901261545, 293.6972856371680223 52.1592109716392258, 293.7448142048647810 52.1120784019265457, 293.7921346113900540 52.0648815632344082, 293.8392722446478729 52.0176397744607399, 293.8863180705967579 51.9704024852086377, 293.9335962428397693 51.9233227111062661, 293.9808809459452732 51.8762775325007652, 294.0278825655254309 51.8291340534371301, 294.0748257771958833 51.7819966404094458, 294.1217863418343086 51.7348933433405946, 294.1686076850560312 51.6877577856796790, 294.2154245767899283 51.6406415633166205, 294.2621689200627770 51.5935160974246045, 294.3088424299793928 51.5463808135885628, 294.3554786257141132 51.4992452332349870, 294.4020474869581676 51.4520976068226830, 294.4487032212942950 51.4049811909859713, 294.4952914913296240 51.3578458802051472, 294.5418969895747523 51.3107127023418883, 294.5884347400872798 51.2635564562394208, 294.6348785316565682 51.2163704162111344, 294.6813714906026576 51.1691860297657186, 294.7276923109479299 51.1219529737556186, 294.7738344522448415 51.0746736215991461, 294.8197718395178981 51.0273470951758696, 294.8654929360217238 50.9799761011058834, 294.9112626249865343 50.9326058392748848, 294.9571326309937263 50.8852385824861955, 295.0028081042060535 50.8378299359886867, 295.0483599950314328 50.7903921654531985, 295.0938159376023577 50.7429295926595358, 295.1394393952502355 50.6954672716803998, 295.1849886311760542 50.6479769473739339, 295.2302510328869403 50.6004433494925010, 295.2751700987382151 50.5528698438340527, 295.3200302318319359 50.5052789709472236, 295.3651817746400638 50.4576837161567440, 295.4102514173258101 50.4100616461730695, 295.4554187475314393 50.3624162955004522, 295.5005451617301446 50.3147411900532333, 295.5454941248207774 50.2670354744187762, 295.5901264260956509 50.2193036524553094, 295.6345902381398218 50.1715496780019024, 295.6788486553651296 50.1237772068778114, 295.7231187033184483 50.0759813438211268, 295.7673408602476002 50.0281624317159554, 295.8116127406512987 49.9803140857962518, 295.8560810864870518 49.9324232409902393, 295.9005769971004156 49.8844953496522550, 295.9446838645065441 49.8365625667986407, 295.9886221285325405 49.7886128304107629, 296.0323211243245396 49.7406556427859172, 296.0759910747153185 49.6926722818829845, 296.1194565103898526 49.6446821048827829, 296.1624897088751709 49.5967167487294276, 296.2054086607993213 49.5487424737293551, 296.2484396719925712 49.5007281817789533, 296.2915134711480505 49.4526796665121608, 296.3350389573967618 49.4045300978008015, 296.3786114499501991 49.3563338330455679, 296.4222302019360313 49.3080883623094124, 296.4656892412461389 49.2598280749685955, 296.4782574023010966 49.2419677041339625, 296.4032185014780225 49.2138422027338365, 296.3291599281647564 49.1861284721513243, 296.2549758604650378 49.1584150628567116, 296.1805181984752267 49.1307377732130348, 296.1059958275960753 49.1030596410174311, 296.0319753508879330 49.0752577913664254, 295.9588442320529111 49.0472336740290160, 295.8861134027861226 49.0190860042944365, 295.8124228918390486 48.9911441745806684, 295.7382596561083119 48.9633095596598835, 295.6644117428859886 48.9353885153610904, 295.5913488263511795 48.9072473769558513, 295.5188683870677551 48.8789250825906123, 295.4460786412217885 48.8506686873925204, 295.3732701352031427 48.8224019007348673, 295.2999915852694244 48.7942691567235656, 295.2264283102026639 48.7662284257375518, 295.1533647828368316 48.7380309852390639, 295.0810040310718705 48.7095944639431977, 295.0091863998481472 48.6809554786322849, 294.9373959127930220 48.6522880295360594, 294.8652730269428730 48.6237309200630392, 294.7932479399684667 48.5951308767385797, 294.7213583334407758 48.5664725545892892, 294.6494236802788578 48.5378302049381105, 294.5773206088004486 48.5092633660961496, 294.5054333742040171 48.4806113445442151, 294.4346026686405366 48.4514789854476291, 294.3647067933559924 48.4218794804552743, 294.2947492459967975 48.3922649000824663, 294.2238142620729491 48.3631107066558954, 294.1527610573676839 48.3340145652618460, 294.0815147202526987 48.3050286789722350, 294.0099980936771544 48.2762131959080136, 293.9382460173290497 48.2475698037275080, 293.8668697140522568 48.2187474532939362, 293.7962609736145509 48.1894822988117610, 293.7255394666512416 48.1603063113648275, 293.6547781318735133 48.1311843990246970, 293.5843065515867352 48.1018949307871537, 293.5141586740939488 48.0723985331187009, 293.4444700902735121 48.0425737339503200, 293.3749064547343437 48.0126509102984969, 293.3050575999341731 47.9829593986607890, 293.2352034076224072 47.9532950309601915, 293.1654531168650806 47.9235700964377784, 293.0958477939764748 47.8937448880645533, 293.0263787567034228 47.8638207881203996, 292.9568858384029113 47.8339501037519241, 292.8874362986734923 47.8040757589463183, 292.8180445861410703 47.7741872572646500, 292.7487592169084678 47.7442337012970270, 292.6796079813448159 47.7141793537199916, 292.6105254595862561 47.6840965526444549, 292.5414489407279461 47.6540678195429379, 292.4724300337906016 47.6240374558369268, 292.4035989135194882 47.5938277490541424, 292.3350381260194695 47.5632960657097072, 292.2666059363026534 47.5326200150254294, 292.1981252697848390 47.5020738206643074, 292.1295887369751654 47.4716991949019018, 292.0611460375269530 47.4412605827019220, 291.9928009984063806 47.4107468251615103, 291.9245641102601780 47.3801307584919442, 291.8563543684800266 47.3495759935504452, 291.7882006024591419 47.3190364969257899, 291.7201019385726113 47.2885256469011352, 291.6521393383902705 47.2578461482878325, 291.5843787631462760 47.2267846937686215, 291.5168317396303905 47.1952282052031080, 291.4492464832235896 47.1638894034807024, 291.3816293898299818 47.1328167907642452, 291.3140627606528597 47.1017797901754420, 291.2465582098835739 47.0707529404682532, 291.1791118217741996 47.0397717627595284, 291.1117364145860620 47.0087996190138426, 291.0444662616026221 46.9776521074006155, 290.9772966918184238 46.9463014906870910, 290.9102084353484088 46.9148200635959469, 290.8431866098990213 46.8832984418343415, 290.7762173982538911 46.8519018482588834, 290.7093152517370527 46.8205640770849811, 290.6424914170170837 46.7891699520966071, 290.5757490817570670 46.7575740040825778, 290.5090796708282710 46.7257398497000977, 290.4424748469443784 46.6939354890210154, 290.3759385704620968 46.6621558917914996, 290.3094735853126735 46.6303799301904860, 290.2430782179271773 46.5985395060219361, 290.1767412655061662 46.5665028466696711, 290.1104620752193455 46.5343432693806136, 290.0442657086978215 46.5023241289388807, 289.9781432507954264 46.4703032081830543, 289.9120787066955813 46.4381525977341951, 289.8460907244865439 46.4060177803553273, 289.7802251110452403 46.3741527167005287, 289.7144742069608583 46.3424423196200763, 289.6488095562927469 46.3107023232924249, 289.5832003916290205 46.2787873333416186, 289.5176388907983096 46.2466885757636845, 289.4520462285495341 46.2141017607484343, 289.3864267339227467 46.1811141464289676, 289.3618561776004867 46.1711714273995071, 289.3147779156129218 46.2173242257311614, 289.2682700210863231 46.2625948223290919, 289.2216498274489140 46.3077334989910909, 289.1748745355735650 46.3526214941802124, 289.1280376293947256 46.3975741281184426, 289.0812223379438706 46.4428210011357905, 289.0343472417508792 46.4880973442382484, 288.9874257852919186 46.5334322049573217, 288.9405044417976569 46.5789322394382452, 288.8934837043753419 46.6243341170829027, 288.8463427575331366 46.6695988190028146, 288.7991799003812048 46.7149574330253188, 288.7519302493046780 46.7602581950852993, 288.7044789857983460 46.8052713999669052, 288.6569388683359421 46.8502485880938977, 288.6094424913905527 46.8954406931386885, 288.5620397675693312 46.9409105839929666, 288.5146096371197473 46.9864133831112767, 288.4669533014785543 47.0316098743400701, 288.4189979084742959 47.0764138053209535, 288.3708092782399603 47.1209678506684355, 288.3225205926835883 47.1654960549336408, 288.2743455744467838 47.2103062528499819, 288.2260406104195454 47.2550301230308776, 288.1776038116196332 47.2996724655994498, 288.1290910621896728 47.3443118275832120, 288.0806004866909689 47.3890679637712893, 288.0320864200181177 47.4338721088212836, 287.9835128725551385 47.4786755144914636, 287.9348544417925382 47.5234476156226791, 287.8860935537533692 47.5681703825700382, 287.8372773616805489 47.6128949787879847, 287.7883288015262906 47.6575421974380475, 287.7393085634204795 47.7021757070334687, 287.6902605832405015 47.7468350283393193, 287.6410876324868013 47.7914283366073178, 287.5917481486421821 47.8359242643672431, 287.5423471737791488 47.8804175478147940, 287.4929818798205474 47.9249836617375706, 287.4435300772136657 47.9695183131695515, 287.3939311769159985 48.0139770798353211, 287.3442363755654014 48.0584018935020794, 287.2944182676178571 48.1027748648423952, 287.2447020877938826 48.1472485026180692, 287.1950591428314397 48.1917908022441068, 287.1452952545445783 48.2362713471827362, 287.0953441578890875 48.2806539821297562, 287.0451863503462278 48.3249349211713550, 286.9949077614967337 48.3691695420140064, 286.9444735218841629 48.4133416921263873, 286.8940363669749445 48.4575332864047326, 286.8434760753363548 48.5016805430202851, 286.7926138665326903 48.5457016207637011, 286.7414943640096112 48.5896286026594737, 286.6903929526483807 48.6335896342714165, 286.6393507379582388 48.6775956709724866, 286.5883160953767970 48.7216182199543653, 286.5371352461281163 48.7655935946100314, 286.4858893720233937 48.8095542615773539, 286.4345830897714222 48.8535006122709063, 286.3831420753027146 48.8974063618426840, 286.3313949286018101 48.9412186275038579, 286.2794287606336638 48.9849733476629297, 286.2271237527501171 49.0286407173921361, 286.1747934942748657 49.0723176450905072, 286.1226207794685479 49.1160491477687486, 286.0705778239361052 49.1598179149401204, 286.0185387849462586 49.2035851470715215, 285.9663555293917057 49.2473136664860647, 285.9139828228739475 49.2909956681908312, 285.8615048751227050 49.3346515723928292, 285.8089409308830682 49.3782853448059882, 285.7561709971500932 49.4218750455458391, 285.7033744198886325 49.4654544937027154, 285.6505294182767898 49.5090178755621935, 285.5977727123407135 49.5525837744106425, 285.5447446092979362 49.5960970702829229, 285.4914875549942508 49.6395684556400170, 285.4379846370865152 49.6829997262990304, 285.3843843052756597 49.7264110256648948, 285.3308342690713175 49.7698167182288245, 285.2773646050080174 49.8132152409817408, 285.2239238309639404 49.8565975374196668, 285.1703158928399375 49.8999460743720107, 285.1164481902447960 49.9432567010531869, 285.0625323547681660 49.9865451770147544, 285.0082665476087413 50.0297957865672416, 284.9537084881674787 50.0730166730696595, 284.8991894805907918 50.1162226853946606, 284.8446182125073278 50.1594081318238167, 284.7898601929547908 50.2025694147422996, 284.7349043728681863 50.2457080812009522, 284.6799771552385323 50.2888265780296280, 284.6248540494665917 50.3319228431918049, 284.5695238923811416 50.3749986845891300, 284.5144490571994993 50.4180478736866817, 284.4593856466942725 50.4610690021459973, 284.4040790806055838 50.5040674495806385, 284.3484586308211988 50.5470482927714784, 284.2935341408388581 50.5899723488597601, 284.2391049473005182 50.6328348676932407, 284.1837853403296208 50.6757005534934777, 284.1663273815096318 50.6919534014300766, 284.2345597693270065 50.7277015503154161, 284.3020640473581579 50.7628777224099892, 284.3702656899958470 50.7979746069000484, 284.4387418467628663 50.8330150873104074, 284.5071713340328188 50.8680245376072975, 284.5755687379514143 50.9030045092247363, 284.6443164345435548 50.9379171054902500, 284.7135533824027220 50.9727405217829670, 284.7829461739408430 51.0075059628211491, 284.8521768237749825 51.0422529775025851, 284.9213779308003609 51.0769691887487411, 284.9906032701824756 51.1116495917477351, 285.0598819033065183 51.1462913063788349, 285.1294270280205865 51.1808602737040772, 285.1992202696198433 51.2153549031564808, 285.2689486693911363 51.2498278200912978, 285.3385407699790335 51.2842969395446175, 285.4080991362617965 51.3187480716453166, 285.4778056611060606 51.3531464893620608, 285.5483833920509369 51.3873301698831071, 285.6193015406489053 51.4213979996852473, 285.6897321570879740 51.4555427015166273, 285.7594982587881987 51.4898277189353308, 285.8295266909508996 51.5240324011132174, 285.8995795188444049 51.5582171669147584, 285.9694603052748789 51.5924415814695649, 286.0394555568004762 51.6266293964584264, 286.1098454748561153 51.6606923298506473, 286.1806846868420280 51.6946012555894825, 286.2515634685805139 51.7284818757417852, 286.3217610437835106 51.7625925450240558, 286.3918947636801136 51.7967386371245837, 286.4624479942411881 51.8307423644522842, 286.5336661467025579 51.8644918118881932, 286.6050516772942274 51.8981677383684854, 286.6765569414309311 51.9317872895232000, 286.7481309225292421 51.9653721726498503, 286.8199530521117708 51.9988397589956506, 286.8920127214390163 52.0321867072350770, 286.9640676739491596 52.0655270933311627, 287.0361337373960282 52.0988579772036928, 287.1084521342681342 52.1320521938549248, 287.1808429436290453 52.1652016017904359, 287.2528037265199146 52.1986044777616200, 287.3251766498365214 52.2317791050783669, 287.3976852881675086 52.2648798818484437, 287.4697242670244464 52.2983072795676875, 287.5421226029587842 52.3315320485897573, 287.6148867344307405 52.3645289209294447, 287.6877004396365578 52.3975127478532059, 287.7605440724607888 52.4305033881260840, 287.8332983279560722 52.4636054057247634, 287.9057493954031202 52.4970217668427779, 287.9780316068848265 52.5306795409256608, 288.0504439921309086 52.5643367368246146, 288.1234401644522904 52.5975550143054207, 288.1976382829452064 52.6296474297664219, 288.2721681013861144 52.6613877226737159, 288.3463897438006143 52.6934494034029157, 288.4202322563753569 52.7259736328181674, 288.4939397938130696 52.7587388913465958, 288.5678468760376063 52.7913568215394164, 288.6419218814429541 52.8238536973012103, 288.7165029135949794 52.8557306608363362, 288.7912456624506490 52.8874137480644535, 288.8656727128577586 52.9196471844023790, 288.9400718311589458 52.9520515232037781, 289.0145695908635162 52.9844388557765029, 289.0890412533441349 53.0170554947797967, 289.1635635592601830 53.0497993040304365, 289.2382911325804002 53.0823639878877032, 289.3132195813146836 53.1147272726123987, 289.3882373382535889 53.1471368006245015, 289.4633522768713192 53.1795932616528120, 289.5386395897923535 53.2118916057759463, 289.6140551665824887 53.2441442933252560, 289.6895157143202368 53.2766587857948153, 289.7651099666896926 53.3091747733643402, 289.8409073665112601 53.3413820299417480, 289.9168235491238192 53.3736136015565563, 289.9928758081005071 53.4057942992804442, 290.0690425949051701 53.4380804602550015, 290.1453574173241918 53.4702653414589975, 290.2218095760875372 53.5024220046409624, 290.2983878999274339 53.5347670501741035, 290.3751182413015499 53.5670164502047257, 290.4519987557255263 53.5988030640775577, 290.5290061844957563 53.6305483723634140, 290.6061466002392422 53.6623930165058809, 290.6834140633079642 53.6940874221143645, 290.7608043693315949 53.7256675476979808, 290.8382970713091709 53.7569901973408975, 290.9159587660024044 53.7886645754515271, 290.9938283926157396 53.8207705659212365, 291.0717891428241728 53.8524693735371756, 291.1498394700072367 53.8838731934801629, 291.2279334662110841 53.9148453185582071, 291.3061172279390689 53.9456783680282825, 291.3844357241167131 53.9765654329084370, 291.4627282140606894 54.0069110349376871, 291.5408564454050975 54.0363542888421122, 291.6190588029043624 54.0657945141910190, 291.6482444065063646 54.0748894594413585)))" diff --git a/isis/src/base/objs/GisBlob/Makefile b/isis/src/base/objs/GisBlob/Makefile deleted file mode 100644 index f122bc8822..0000000000 --- a/isis/src/base/objs/GisBlob/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -ifeq ($(ISISROOT), $(BLANK)) -.SILENT: -error: - echo "Please set ISISROOT"; -else - include $(ISISROOT)/make/isismake.objs -endif \ No newline at end of file diff --git a/isis/src/base/objs/GisBlob/unitTest.cpp b/isis/src/base/objs/GisBlob/unitTest.cpp deleted file mode 100644 index 69d2861870..0000000000 --- a/isis/src/base/objs/GisBlob/unitTest.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/** This is free and unencumbered software released into the public domain. -The authors of ISIS do not claim copyright on the contents of this file. -For more details about the LICENSE terms and the AUTHORS, you will -find files of those names at the top level of this repository. **/ - -/* SPDX-License-Identifier: CC0-1.0 */ -#include -#include -#include -#include - -#include "Cube.h" -#include "GisBlob.h" -#include "IException.h" -#include "IString.h" -#include "Preference.h" - -using namespace Isis; -using namespace std; - -/** - * Unit test for GisBlob class - * - * - * @author 2016-02-23 Jeannie Backer - * - * @internal - * @history 2016-02-23 Jeannie Backer - Original version. - * - */ -int main() { - try { - Preference::Preferences(true); - qDebug() << ""; - qDebug() << "Testing GisBlob's constructor from cube..."; - QString inputFile = "$ISISTESTDATA/isis/src/messenger/unitTestData/EW0211286081G.lev1.cub"; - Cube cube; - cube.open(inputFile); - GisBlob cubeBlob(cube); - qDebug() << " Polygon = " << cubeBlob.polygon(); - - qDebug() << ""; - qDebug() << "Testing GisBlob's default constructor..."; - GisBlob blob; - qDebug() << " Polygon = " << blob.polygon(); - - qDebug() << ""; - qDebug() << "Adding WKT polygon to GisBlob..."; - /* - QFile file("unitTest.wkt"); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - throw IException(IException::Io, "Unable to open wkt file, [unitTest.wkt]", _FILEINFO_); - } - QString wkt; - QTextStream stream(&file); - wkt.append(stream.readAll()); - */ - QString wkt = cubeBlob.polygon(); - blob.setPolygon(wkt); - qDebug() << " Polygon = " << blob.polygon(); - } - catch (IException &e) { - qDebug() << ""; - qDebug() << ""; - QString msg = "**************** UNIT TEST FAILED! **************** "; - IException(e, IException::Unknown, msg, _FILEINFO_).print(); - } -} - - diff --git a/isis/src/base/objs/GisGeometry/GisGeometry.cpp b/isis/src/base/objs/GisGeometry/GisGeometry.cpp index 5524746c35..ab1e870e6b 100644 --- a/isis/src/base/objs/GisGeometry/GisGeometry.cpp +++ b/isis/src/base/objs/GisGeometry/GisGeometry.cpp @@ -17,7 +17,7 @@ find files of those names at the top level of this repository. **/ // other ISIS #include "Cube.h" #include "IException.h" -#include "GisBlob.h" +#include "ImagePolygon.h" #include "GisTopology.h" #include "SpecialPixel.h" @@ -27,62 +27,62 @@ using namespace std; namespace Isis { - /** + /** * Fundamental constructor of an empty object - */ - GisGeometry::GisGeometry() : m_type(None), m_geom(0), m_preparedGeom(0) { + */ + GisGeometry::GisGeometry() : m_type(None), m_geom(0), m_preparedGeom(0) { // Must ensure GEOS is initialized GisTopology::instance(); } - - /** - * @brief Construct a point geometry - * - * This constructor will create a point geometry. Note this can either be used - * to create a geometric geometry with a longitude/latitude or a grid geometry - * in any system with an X/Y value. It is up to the caller to maintain the - * coordinate system. - * + + /** + * @brief Construct a point geometry + * + * This constructor will create a point geometry. Note this can either be used + * to create a geometric geometry with a longitude/latitude or a grid geometry + * in any system with an X/Y value. It is up to the caller to maintain the + * coordinate system. + * * @param xlongitude X or longitude coordinate * @param ylatitude Y or latitude coordinate - */ + */ GisGeometry::GisGeometry(const double xlongitude, const double ylatitude) : m_type(GeosGis), m_geom(0), m_preparedGeom(0){ - + GisTopology::instance(); m_geom = makePoint(xlongitude, ylatitude); m_preparedGeom = makePrepared(this->m_geom); return; } - - - /** - * @brief Create a geometry from a cube file. - * - * This constructor will read the contents of the Polygon blob of an ISIS cube - * file and create a geometry from its contents. - * + + + /** + * @brief Create a geometry from a cube file. + * + * This constructor will read the contents of the Polygon blob of an ISIS cube + * file and create a geometry from its contents. + * * @param cube Cube object to create the geomtery from - */ + */ GisGeometry::GisGeometry(Cube &cube) : m_type(IsisCube), m_geom(0), m_preparedGeom(0) { - + GisTopology::instance(); m_geom = fromCube(cube); m_preparedGeom = makePrepared(this->m_geom); return; } - - /** - * @brief Create a geometry from a character WKT/WKB source - * - * @param gisSource String containing the text representation of a GIS + + /** + * @brief Create a geometry from a character WKT/WKB source + * + * @param gisSource String containing the text representation of a GIS * geometry. This can be either a WKT or WKB formatted string * @param t Type of GisGeometry - WKT or WKB - * - */ - GisGeometry::GisGeometry(const QString &gisSource, const GisGeometry::Type t) : + * + */ + GisGeometry::GisGeometry(const QString &gisSource, const GisGeometry::Type t) : m_type(t), m_geom(0), m_preparedGeom(0) { GisTopology *gis(GisTopology::instance()); if (WKT == t) { @@ -97,70 +97,70 @@ namespace Isis { m_geom = fromCube(cube); } else { - throw IException(IException::Programmer, - QString("Unknown GIS type given [%1]").arg(typeToString(t)), + throw IException(IException::Programmer, + QString("Unknown GIS type given [%1]").arg(typeToString(t)), _FILEINFO_); } - + // Get the prepared geometry m_preparedGeom = makePrepared(this->m_geom); m_type = t; return; } - - /** - * @brief Create a geometry from another geometry by cloning - * - * This contructor uses the GISTopology clone method to generate a new - * geometry. - * + + /** + * @brief Create a geometry from another geometry by cloning + * + * This contructor uses the GISTopology clone method to generate a new + * geometry. + * * @param geom GISGeometry to create new geometry from - */ + */ GisGeometry::GisGeometry(const GisGeometry &geom) : m_type(geom.m_type), m_geom(0), m_preparedGeom(0) { - + GisTopology *gis(GisTopology::instance()); if ( geom.isDefined() ) { m_geom = gis->clone(geom.m_geom); m_preparedGeom = makePrepared(this->m_geom); } } - - /** - * @brief Create a GISGeometry directly from a GEOS-C GEOSGeometry - * - * This constructor will create a new GISGeometry object that takes ownership - * from the caller and is managed for the life of this new object. - * + + /** + * @brief Create a GISGeometry directly from a GEOS-C GEOSGeometry + * + * This constructor will create a new GISGeometry object that takes ownership + * from the caller and is managed for the life of this new object. + * * @param geom GEOSGeometry instance to use - */ + */ GisGeometry::GisGeometry(GEOSGeometry *geom) : m_type(GeosGis), m_geom(geom), m_preparedGeom(0) { GisTopology::instance(); m_preparedGeom = makePrepared(this->m_geom); return; } - - /** + + /** * Destructor - */ - GisGeometry::~GisGeometry() { - destroy(); + */ + GisGeometry::~GisGeometry() { + destroy(); } - - /** - * @brief Assignment operator for GISGeomtries - * - * This assignment operator essentially clones the right side geomemtry - * + + /** + * @brief Assignment operator for GISGeomtries + * + * This assignment operator essentially clones the right side geomemtry + * * @param geom Geometry to assign to current object * @return GisGeometry New geometry - */ + */ GisGeometry &GisGeometry::operator=(GisGeometry const &geom) { if ( this != &geom ) { destroy(); @@ -173,15 +173,15 @@ namespace Isis { } return (*this); } - - + + /** - * @brief Set the geometry directly taking ownership - * - * This method will replace the current geoemetry with the geom parameter - * contents. The existing contents of this object is destroyed before taking - * ownership of the geom paramter object. - * + * @brief Set the geometry directly taking ownership + * + * This method will replace the current geoemetry with the geom parameter + * contents. The existing contents of this object is destroyed before taking + * ownership of the geom paramter object. + * * @param geom GEOSGeometry to incoporate into this object */ void GisGeometry::setGeometry(GEOSGeometry *geom) { @@ -190,40 +190,40 @@ namespace Isis { m_preparedGeom = makePrepared(this->m_geom); return; } - - - /** - * Determines if the current geometry is valid - * + + + /** + * Determines if the current geometry is valid + * * @return bool True if contents are valid, otherwise false - */ + */ bool GisGeometry::isDefined() const { return (m_geom != 0); } - - /** + + /** * Determines validity of the geometry contained in this object - * + * * First determines if it contains a geometry and then validates with the * GEOS toolkit. - * + * * @return bool True if valid, false if invalid or non-existant - */ + */ bool GisGeometry::isValid() const { if (!isDefined()) { return (false); } - + return (1 == GEOSisValid(this->m_geom)); } - - /** + + /** * Returns a string describing reason for invalid geometry - * + * * @return QString Description of the reason the geometry is invalid - */ + */ QString GisGeometry::isValidReason() const { QString result = "Not defined!"; if ( isDefined() ) { @@ -234,25 +234,25 @@ namespace Isis { } return (result); } - - /** + + /** * Returns the type (origin) of the geometry - * + * * @return GisGeometry::Type Enum type of geometry origin - */ + */ GisGeometry::Type GisGeometry::type() const { return (m_type); } - - /** + + /** * Returns enum representation of the geometry origin from string type - * + * * @see type(QString) * @param gstrType Character representation of geometry origin - * @return GisGeometry::Type Enum type of origin - */ + * @return GisGeometry::Type Enum type of origin + */ GisGeometry::Type GisGeometry::type(const QString &gstrType) { QString gtype = gstrType.toLower(); if ("wkt" == gtype) return (WKT); @@ -267,13 +267,13 @@ namespace Isis { } - /** - * Returns the type of the Geometry as a QString. + /** + * Returns the type of the Geometry as a QString. * * @see type(QString) * @param gstrType Enum type of origin * @return GisGeometry::Type Character representation of geometry or origin - */ + */ QString GisGeometry::typeToString(const GisGeometry::Type &type) { if (WKT == type) return "WKT"; if (WKB == type) return "WKB"; @@ -281,149 +281,149 @@ namespace Isis { if (GeosGis == type) return "GeosGis"; return "None"; } - - /** + + /** * Returns the GEOSGeometry object to extend functionality * * @return GEOSGeometry Pointer to GEOSGeometry structure - */ + */ const GEOSGeometry *GisGeometry::geometry() const { return (m_geom); } - - /** + + /** * @brief Returns special GEOS prepared geometry if it exists - * + * * This method will return a pointer to the prepared version of the * GEOSGeometry data. Caller should test for a NULL pointer as it may be * disabled or non-existant. - * + * * @return GEOSPreparedGeometry Pointer to prepared geometry - */ + */ const GEOSPreparedGeometry *GisGeometry::preparedGeometry() const { return (m_preparedGeom); } - - + + /** * @brief Clones the contents of this geometry to a new instance - * + * * This method will clone the contents of this geometry and return a new * instance to the caller. - * + * * @return GisGeometry Geometry to clone - */ + */ GisGeometry *GisGeometry::clone() const { if (!isDefined()) { return (new GisGeometry()); } - + GisTopology *gis(GisTopology::instance()); QScopedPointer geom(new GisGeometry()); - + geom->m_type = m_type; geom->m_geom = gis->clone(m_geom); geom->m_preparedGeom = makePrepared(geom->m_geom); return (geom.take()); } - - - /** + + + /** * Tests for a defined but empty geometry - * + * * @return bool True if empty, false if has content - */ + */ bool GisGeometry::isEmpty() const { - if ( !isValid() ) { - return (true); + if ( !isValid() ) { + return (true); } return (1 == GEOSisEmpty(this->m_geom)); } - - /** + + /** * @brief Computes the area of a geometry - * + * * This method will compute the area of a geometry. Note the area is in the * units of the coordinates. For example, if the coordinates of the geometry * are in latitude/longitude, then the units are in degrees. Callers must * maintain the units of the coordinates. - * + * * Point geometries will have 0 area. - * - * @return double Area of the geometry in units of data coordinates of the + * + * @return double Area of the geometry in units of data coordinates of the * geometry - */ + */ double GisGeometry::area( ) const { - if ( !isValid() ) { - return (0.0); + if ( !isValid() ) { + return (0.0); } - + int result = 0; double gisArea = 0.0; result = GEOSArea(this->m_geom, &gisArea); - if (1 != result) { - gisArea = 0.0; + if (1 != result) { + gisArea = 0.0; } return (gisArea); } - - /** + + /** * @brief Computes the length of a geometry - * + * * This method will compute the length of a geometry. This is suitable for * Linestring and spatial geometries. - * + * * @return double Length of the geometry in units of the coordinates - */ + */ double GisGeometry::length( ) const { - if ( !isValid() ) { - return (0.0); + if ( !isValid() ) { + return (0.0); } - + int result = 0; double gisLength = 0.0; result = GEOSLength(this->m_geom, &gisLength); - if (1 != result) { - gisLength = 0.0; + if (1 != result) { + gisLength = 0.0; } return (gisLength); } - - /** + + /** * @brief Computes the distance between two geometries - * + * * This method computes the distance between two geometries. Refer to the * GEOS documentation as to the details of this computation. - * + * * @param target Target geometry to compute distance to * @return double Distance in units of geometry coordinates - */ + */ double GisGeometry::distance(const GisGeometry &target) const { - if ( !isValid() ) { - return (false); + if ( !isValid() ) { + return (false); } - if ( !target.isValid() ) { - return (false); + if ( !target.isValid() ) { + return (false); } - + int result = 0; double dist = Null; result = GEOSDistance(this->m_geom, target.geometry(), &dist); - if ( 1 != result ) { - dist = Null; + if ( 1 != result ) { + dist = Null; } return (dist); } - - /** - * Get number of points in geometry - * + + /** + * Get number of points in geometry + * * @return int Number of points contained in the geometry */ int GisGeometry::points() const { @@ -439,50 +439,50 @@ namespace Isis { } - /** + /** * @brief Computes a new geometry from the intersection of the two geomtries - * + * * This method will compute the union of two geometries and return a new * geometry that represents the combination of them. - * + * * @param target Other geometry to combine by union opertor * @return bool True if operation is successful, false otherwise - */ + */ bool GisGeometry::intersects(const GisGeometry &target) const { - if ( !isValid() ) { + if ( !isValid() ) { return (false); } - if ( !target.isValid() ) { - return (false); + if ( !target.isValid() ) { + return (false); } - + int result = 0; if ( 0 != this->m_preparedGeom) { - result = GEOSPreparedIntersects(this->m_preparedGeom, target.geometry()); + result = GEOSPreparedIntersects(this->m_preparedGeom, target.geometry()); } else { result = GEOSIntersects(this->m_geom, target.geometry()); } - + return (1 == result); } - - /** + + /** * Test if the target geometry is contained within this geometry - * + * * @param target Other geometry to test - * @return bool True if target is contained with this geometry, false + * @return bool True if target is contained with this geometry, false * otherwise - */ + */ bool GisGeometry::contains(const GisGeometry &target) const { - if ( !isValid() ) { - return (false); + if ( !isValid() ) { + return (false); } - if ( !target.isValid() ) { + if ( !target.isValid() ) { return (false); } - + int result = 0; if ( 0 != this->m_preparedGeom) { result = GEOSPreparedContains(this->m_preparedGeom, target.geometry()); @@ -490,25 +490,25 @@ namespace Isis { else { result = GEOSContains(this->m_geom, target.geometry()); } - + return (1 == result); } - - /** + + /** * Tests for disjoint geometries - * + * * @param target Other geometry to test * @return bool True if geometries are disjoint, false otherwise - */ + */ bool GisGeometry::disjoint(const GisGeometry &target) const { - if ( !isValid() ) { - return (false); + if ( !isValid() ) { + return (false); } - if ( !target.isValid() ) { - return (false); + if ( !target.isValid() ) { + return (false); } - + int result = 0; if ( 0 != m_preparedGeom) { result = GEOSPreparedDisjoint(m_preparedGeom, target.geometry()); @@ -516,26 +516,26 @@ namespace Isis { else { result = GEOSDisjoint(m_geom, target.geometry()); } - + return (1 == result); } - - /** + + /** * Test for overlapping geometries - * + * * @param target Geometry to test for overlap with this geometry - * @return bool True if target geometry overlaps with this geometry, false + * @return bool True if target geometry overlaps with this geometry, false * otherwise - */ + */ bool GisGeometry::overlaps(const GisGeometry &target) const { - if ( !isValid() ) { - return (false); + if ( !isValid() ) { + return (false); } - if ( !target.isValid() ) { - return (false); + if ( !target.isValid() ) { + return (false); } - + int result = 0; if ( 0 != m_preparedGeom) { result = GEOSPreparedOverlaps(m_preparedGeom, target.geometry()); @@ -543,52 +543,52 @@ namespace Isis { else { result = GEOSOverlaps(m_geom, target.geometry()); } - + return (1 == result); } - -/** + +/** * Test if target and this geometry are equal - * + * * @param target Geometry to test for equality * @return bool True if geometries are equal, false if not */ - bool GisGeometry::equals(const GisGeometry &target) const { - if ( !isValid() ) { - return (false); + bool GisGeometry::equals(const GisGeometry &target) const { + if ( !isValid() ) { + return (false); } - if ( !target.isValid() ) { - return (false); + if ( !target.isValid() ) { + return (false); } - + int result = GEOSEquals(this->m_geom, target.geometry()); return ( 1 == result ); } - /** + /** * @brief Computes intersect ratio between two geometries - * + * * This method computes the intersection of two geometries and the returns * the ratio of the area of intersection with this geometry. Units must be * the same for both geometries or result will not be valid. - * + * * @param target Geometry to compute intersect ratio for - * @return double Area of common intersection of two geometries in units of + * @return double Area of common intersection of two geometries in units of * the two geometries. - */ + */ double GisGeometry::intersectRatio(const GisGeometry &target) const { - if ( !isValid() ) { - return (0.0); + if ( !isValid() ) { + return (0.0); } - if ( !target.isValid() ) { - return (0.0); + if ( !target.isValid() ) { + return (0.0); } - + // Check for any intersection at all - // if ( !intersects(target) ) { + // if ( !intersects(target) ) { // return (0.0); // } @@ -596,64 +596,64 @@ namespace Isis { if (this->area() == 0) { return (0.0); } - + QScopedPointer inCommon(intersection(target)); double ratio = inCommon->area() / this->area(); return (ratio); } - - - /** + + + /** * @brief Computes the envelope or bounding box of this geometry - * + * * This method computes the envelope or bounding box of the geometry in this * object. A new geometry is computed and a pointer is returned to the * caller. The caller assumes ownership of this geometry. - * + * * A null geometry will be returned if an error is occured or the current * geometry is invalid. - * - * @return GisGeometry Pointer to envelope/bounding box. A null geometry, not + * + * @return GisGeometry Pointer to envelope/bounding box. A null geometry, not * NULL pointer, is returned in problems occur. - */ + */ GisGeometry *GisGeometry::envelope() const { - if ( !isValid() ) { - return (new GisGeometry()); + if ( !isValid() ) { + return (new GisGeometry()); } - + GEOSGeometry *geom = GEOSEnvelope(m_geom); return (new GisGeometry(geom)); } - + /** * Computes the convex hull of the geometry - * - * @return GisGeometry Pointer to new geometry that represents the convex + * + * @return GisGeometry Pointer to new geometry that represents the convex * hull of this geometry. A null geometry, not NULL * pointer is returned if problems occur. - */ + */ GisGeometry *GisGeometry::convexHull() const { - if ( !isValid() ) { - return (new GisGeometry()); + if ( !isValid() ) { + return (new GisGeometry()); } - + GEOSGeometry *geom = GEOSConvexHull(m_geom); return (new GisGeometry(geom)); } - + /** - * @brief Simplify complex or overdetermined geoemtry - * - * This method will simplify a geometry with a Douglas -Peucker algorithm using - * a tolerance specifying the maximum distance from the original (multi)polygon. - * The use of this algorithm is designed to prevent oversimplification - * - * + * @brief Simplify complex or overdetermined geoemtry + * + * This method will simplify a geometry with a Douglas -Peucker algorithm using + * a tolerance specifying the maximum distance from the original (multi)polygon. + * The use of this algorithm is designed to prevent oversimplification + * + * * @param tolerance Maximum distance from the original geometry expressed in the * coordinate system of the geometry. - * + * * @return GisGeometry* Simplified geometry */ GisGeometry *GisGeometry::simplify(const double &tolerance) const { @@ -669,63 +669,63 @@ namespace Isis { } - /** + /** * @brief Computes the intersection of two geometries - * + * * The area of common interesction of the target geometry and this geometry * are computed and returned to the caller. - * + * * @param target Other geometry to compute intersection * @return GisGeometry Intersection geometry - */ + */ GisGeometry *GisGeometry::intersection(const GisGeometry &target) const { // Non-valid geometries return empty geometries - if ( !isValid() ) { - return (new GisGeometry()); + if ( !isValid() ) { + return (new GisGeometry()); } - if ( !target.isValid() ) { - return (new GisGeometry()); + if ( !target.isValid() ) { + return (new GisGeometry()); } - + GEOSGeometry *geom = GEOSIntersection(m_geom, target.geometry()); return (new GisGeometry(geom)); } - - /** + + /** * Computes the union of two geometries - * + * * @param target Other geometry to union with this geometry * @return GisGeometry Result of unioning the two geometries - */ + */ GisGeometry *GisGeometry::g_union(const GisGeometry &target) const { - if ( !isValid() ) { - return (new GisGeometry()); + if ( !isValid() ) { + return (new GisGeometry()); } - if ( !target.isValid() ) { - return (new GisGeometry()); + if ( !target.isValid() ) { + return (new GisGeometry()); } - + GEOSGeometry *geom = GEOSUnion(m_geom, target.geometry()); return (new GisGeometry(geom)); } - - /** + + /** * @brief Computes the centroid of a spatial geometry - * + * * This method will compute the coordinate centroid of a spatial geometry. - * + * * @param xlongitude X/longitude coordinate of centroid * @param ylatitude Y/latitude coordinate of centroid * @return bool True if successful, false if failed - */ + */ bool GisGeometry::centroid(double &xlongitude, double &ylatitude) const { xlongitude = ylatitude = Null; - if ( !isValid() ) { - return (false); + if ( !isValid() ) { + return (false); } - + GEOSGeometry *center = GEOSGetCentroid(m_geom); if ( 0 != center ) { GEOSGeomGetX(center, &xlongitude); @@ -733,33 +733,33 @@ namespace Isis { GisTopology::instance()->destroy(center); return (true); } - + return (false); } - - /** + + /** * Computes the centroid of the geometry and returns it as a new geometry - * + * * @return GisGeometry Pointer to point geometry of centroid of this geometry - */ - GisGeometry *GisGeometry::centroid() const { - if ( !isValid() ) { - return (new GisGeometry()); + */ + GisGeometry *GisGeometry::centroid() const { + if ( !isValid() ) { + return (new GisGeometry()); } - + GEOSGeometry *center = GEOSGetCentroid(m_geom); return (new GisGeometry(center)); } - - /** + + /** * Creates a prepared geometry of current geometry - * + * * @param geom * @return GEOSPreparedGeometry - */ - GEOSPreparedGeometry const *GisGeometry::makePrepared(const GEOSGeometry *geom) + */ + GEOSPreparedGeometry const *GisGeometry::makePrepared(const GEOSGeometry *geom) const { #if defined(DISABLE_PREPARED_GEOMETRY) return (0); @@ -768,40 +768,41 @@ namespace Isis { return (gis->preparedGeometry(geom)); #endif } - - /** + + /** * Create a point geometry - * + * * @param y Y or latitude coordinate * @return GEOSGeometry Pointer to point geometry. Caller assumes ownership - */ + */ GEOSGeometry *GisGeometry::makePoint(const double x, const double y) const { - + GEOSCoordSequence *point = GEOSCoordSeq_create(1, 2); GEOSCoordSeq_setX(point, 0, x); GEOSCoordSeq_setY(point, 0, y); - + return (GEOSGeom_createPoint(point)); } - - /** + + /** * Reads Polygon from ISIS Cube and returns geometry from contents * * @param cube ISIS Cube contaning a Polygon geometry object * @return GEOSGeometry Pointer to GEOS-C type geometry from Polygon BLOB - */ + */ GEOSGeometry *GisGeometry::fromCube(Cube &cube) const { - GisBlob myGis(cube); + ImagePolygon myGis = cube.readFootprint(); GisTopology *gis(GisTopology::instance()); - return (gis->geomFromWKT(myGis.polygon())); + QString polyStr = QString::fromStdString(myGis.polyStr()); + return (gis->geomFromWKT(polyStr)); } - - /** - * Destroys the GEOS elements of this geometry object - */ + + /** + * Destroys the GEOS elements of this geometry object + */ void GisGeometry::destroy() { GisTopology *gis(GisTopology::instance()); gis->destroy(m_geom); diff --git a/isis/src/base/objs/GisGeometry/unitTest.cpp b/isis/src/base/objs/GisGeometry/unitTest.cpp index 92b31de53e..3c8f70d325 100644 --- a/isis/src/base/objs/GisGeometry/unitTest.cpp +++ b/isis/src/base/objs/GisGeometry/unitTest.cpp @@ -13,10 +13,10 @@ find files of those names at the top level of this repository. **/ #include #include "Cube.h" -#include "GisBlob.h" #include "GisGeometry.h" #include "GisTopology.h" #include "IException.h" +#include "ImagePolygon.h" #include "IString.h" #include "Preference.h" @@ -37,7 +37,7 @@ void printTypes(); * @history 2016-02-23 Jeannie Backer - Original version. * @history 2016-03-02 Ian Humphrey - Added tests for remaining untested methods. * References #2398. - * @history 2016-03-04 Ian Humphrey - Updated test and truthdata for equals() method. + * @history 2016-03-04 Ian Humphrey - Updated test and truthdata for equals() method. * References #2398. * * @@ -47,12 +47,12 @@ void printTypes(); * For the other methods, if (0 != this->m_preparedGeom)'s else clause * is untested. Only the default constructor will create a GisGeometry * without a prepared geometry being instantiated. All the other constructors - * as well as setGeometry() instantiate prepared geometries. + * as well as setGeometry() instantiate prepared geometries. * So, to test the else clause, the prepared geometry would have to be NULL after - * instantiation. + * instantiation. * The prepared geometry is created with makePrepared(), which calls * GisTopology::preparedGeometry(). This method throws an exception - * if the prepared geometry is NULL. + * if the prepared geometry is NULL. * * NOTE - setGeometry() is also untested. */ @@ -69,20 +69,20 @@ int main() { double xlongitude = 0; double ylatitude = 0; GisGeometry geomLatLon(xlongitude, ylatitude); - printBasicInfo(geomLatLon, + printBasicInfo(geomLatLon, "Construct Geometry from Lat/Lon"); QString inputFile = "$ISISTESTDATA/isis/src/messenger/unitTestData/EW0211286081G.lev1.cub"; Cube cube; cube.open(inputFile); GisGeometry geomCube(cube); - printBasicInfo(geomCube, + printBasicInfo(geomCube, "Construct Geometry from Cube"); - GisBlob footprint(cube); - QString wkt = footprint.polygon(); + ImagePolygon footprint = cube.readFootprint(); + QString wkt = QString::fromStdString(footprint.polyStr()); GisGeometry geomGisWKT(wkt, GisGeometry::WKT); - printBasicInfo(geomGisWKT, + printBasicInfo(geomGisWKT, "Construct Geometry from WKT GIS source"); const GEOSGeometry *g = geomCube.geometry(); @@ -90,18 +90,18 @@ int main() { //QString wkb = topo->wkb(clone, GisTopology::DestroyGeometry); QString wkb = topo->wkb(clone); GisGeometry geomGisWKB(wkb, GisGeometry::WKB); - printBasicInfo(geomGisWKB, + printBasicInfo(geomGisWKB, "Construct Geometry from WKB GIS source"); GisGeometry geomGisIsisCube("$ISISTESTDATA/isis/src/messenger/unitTestData/EW0213634118G.lev1.cub", GisGeometry::IsisCube); - printBasicInfo(geomGisIsisCube, + printBasicInfo(geomGisIsisCube, "Construct Geometry from IsisCube GIS source"); GEOSGeometry *geos = topo->geomFromWKT(wkt); GisGeometry geomGEOS(geos); - printBasicInfo(geomGEOS, + printBasicInfo(geomGEOS, "Construct Geometry from GEOSGeometry"); //??? GisGeometry geomDefault; @@ -152,7 +152,7 @@ int main() { // Test intersectRatio where target has area of 0 qDebug() << "Intersect Ratio of WKT Geometry with Lat/Lon (single point) Geometry: " - << geomGisWKT.intersectRatio(geomLatLon); + << geomGisWKT.intersectRatio(geomLatLon); qDebug() << ""; GisGeometry *envelopeGeom = geomCube.envelope(); @@ -179,14 +179,14 @@ int main() { // These two tests below should output empty geometries GisGeometry *intersectionInvalidSourceGeometry = geomDefault.intersection(geomGisWKT); - printBasicInfo(*intersectionInvalidSourceGeometry, + printBasicInfo(*intersectionInvalidSourceGeometry, "Intersection Geometry of Invalid Geometry with WKT Geometry as target"); GisGeometry *intersectionInvalidTargetGeometry = geomGisWKT.intersection(geomDefault); printBasicInfo(*intersectionInvalidTargetGeometry, "Intersection Geometry of WKT Geometry with Invalid Geometry as target"); - + GisGeometry *intersectionGeom = geomGisIsisCube.intersection(geomGisWKT); printBasicInfo(*intersectionGeom, "Intersection Geometry of GisIsisCube Geometry with WKT Geometry"); @@ -204,7 +204,7 @@ int main() { GisGeometry *unionGeom = geomGisIsisCube.g_union(geomGisWKT); printBasicInfo(*unionGeom, "Union Geometry of GisIsisCube Geometry with WKT Geometry"); - + GisGeometry *centroidInvalidGeom = geomDefault.centroid(); printBasicInfo(*centroidInvalidGeom, "Centroid Geometry of Invalid Geometry"); @@ -246,8 +246,8 @@ int main() { } -/** - * Method to print basic information about the given geometry +/** + * Method to print basic information about the given geometry */ void printBasicInfo(GisGeometry geom, QString description) { qDebug() << description; @@ -263,8 +263,8 @@ void printBasicInfo(GisGeometry geom, QString description) { } -/** - * Method to print information about this GisGeometry with relation to another +/** + * Method to print information about this GisGeometry with relation to another */ void printTargetInfo(GisGeometry geom, GisGeometry target, QString description) { qDebug() << description; @@ -275,11 +275,11 @@ void printTargetInfo(GisGeometry geom, GisGeometry target, QString description) qDebug() << " overlaps? " << toString(geom.overlaps(target)); qDebug() << " equals? " << toString(geom.equals(target)); qDebug() << " intersect ratio? " << toString(geom.intersectRatio(target)); - qDebug() << ""; + qDebug() << ""; } -/** +/** * Method to test the static type() and typeToString() methods. */ void printTypes() { @@ -296,4 +296,3 @@ void printTypes() { qDebug() << ""; } - diff --git a/isis/src/base/objs/GisTopology/unitTest.cpp b/isis/src/base/objs/GisTopology/unitTest.cpp index 7cbd8133a9..b112003e58 100644 --- a/isis/src/base/objs/GisTopology/unitTest.cpp +++ b/isis/src/base/objs/GisTopology/unitTest.cpp @@ -10,10 +10,10 @@ find files of those names at the top level of this repository. **/ #include #include "Cube.h" -#include "GisBlob.h" #include "GisGeometry.h" #include "GisTopology.h" #include "IException.h" +#include "ImagePolygon.h" #include "IString.h" #include "Preference.h" @@ -30,7 +30,7 @@ using namespace std; * @history 2016-02-23 Jeannie Backer - Original version. * @history 2016-03-01 Ian Humphrey - Added a few more tests for clone(), wkb() and wkt()'s * scope coverage. References #2398. - * + * */ int main() { try { @@ -45,8 +45,8 @@ int main() { QString inputFile = "$ISISTESTDATA/isis/src/messenger/unitTestData/EW0211286081G.lev1.cub"; Cube cube; cube.open(inputFile); - GisBlob footprint(cube); - QString wktFromCube = footprint.polygon(); + ImagePolygon footprint = cube.readFootprint(); + QString wktFromCube = QString::fromStdString(footprint.polyStr()); qDebug() << "wkt from cube: " << wktFromCube; // create geometry from wkt string and make sure the output string matches @@ -61,7 +61,7 @@ int main() { qDebug() << "=============================================================================="; qDebug() << ""; - // get wkb string from previous geometry and use it to create a new geometry from wkb + // get wkb string from previous geometry and use it to create a new geometry from wkb QString wkbFromGeom = topo->wkb(fromWKT, GisTopology::PreserveGeometry); qDebug() << "WKB: " << wkbFromGeom; qDebug() << "wkt from cube == wkb from geometry? " << (wktFromCube == wkbFromGeom); @@ -104,7 +104,7 @@ int main() { qDebug() << "=============================================================================="; qDebug() << ""; - + // create a "clone" using NULL GEOSGeometry *nullClone = topo->clone(NULL); if (!nullClone) @@ -152,7 +152,7 @@ int main() { catch (IException &e) { e.print(); } - + qDebug() << ""; qDebug() << "Try to get a GEOSGeometry from bad wkt..."; try { @@ -163,7 +163,7 @@ int main() { e.print(); } */ - + } catch (IException &e) { qDebug() << ""; @@ -171,5 +171,5 @@ int main() { QString msg = "**************** UNIT TEST FAILED! **************** "; IException(e, IException::Unknown, msg, _FILEINFO_).print(); } - + } diff --git a/isis/src/base/objs/ImagePolygon/ImagePolygon.h b/isis/src/base/objs/ImagePolygon/ImagePolygon.h index 5662001250..671832962e 100644 --- a/isis/src/base/objs/ImagePolygon/ImagePolygon.h +++ b/isis/src/base/objs/ImagePolygon/ImagePolygon.h @@ -211,6 +211,11 @@ namespace Isis { return p_polygons; }; + //! Return a geos Multipolygon + std::string polyStr() const { + return p_polyStr; + }; + double validSampleDim(); double validLineDim();