Ticket #267: 0001-provisional-patch-adding-tiling-support-to-rasimport.patch

File 0001-provisional-patch-adding-tiling-support-to-rasimport.patch, 7.5 KB (added by Alexander Herzig, 11 years ago)
  • applications/rasgeo/RasdamanHelper2.cxx

    From 6e98dd2875b3339cebc9faacfa8c6bb668b49f54 Mon Sep 17 00:00:00 2001
    From: Alexander Herzig <herziga@landcareresearch.co.nz>
    Date: Thu, 7 Feb 2013 09:36:56 +1300
    Subject: [PATCH] provisional patch: adding tiling support to rasimport
    
    ---
     applications/rasgeo/RasdamanHelper2.cxx |    9 ++++++++-
     applications/rasgeo/RasdamanHelper2.h   |    4 ++--
     applications/rasgeo/rimport.cxx         |   19 +++++++++++++------
     applications/rasgeo/rimport.h           |    4 ++--
     4 files changed, 25 insertions(+), 11 deletions(-)
    
    diff --git a/applications/rasgeo/RasdamanHelper2.cxx b/applications/rasgeo/RasdamanHelper2.cxx
    index 498fda9..5ec486b 100644
    a b unsigned int RasdamanHelper2::getBaseTypeSize(std::string collname)  
    480480
    481481double RasdamanHelper2::insertImage(std::string collname,
    482482                                    char* buf, r_Point& shift, r_Minterval& sdom, bool bRowMajor2ColMajor,
    483                                     std::string marraytypename)
     483                                    std::string marraytypename, std::string tiling)
    484484{
    485485    NMDebugCtx(ctxrhelper, << "...");
    486486
    double RasdamanHelper2::insertImage(std::string collname,  
    532532        }
    533533    }
    534534
     535    // if the specified tiling string is not empty, we just append it to the insert query
     536    // string - we rely on r_oql to throw an execption, if anything is wrong ...
     537    if (!tiling.empty())
     538    {
     539        qstr += " " + tiling;
     540    }
     541
    535542    NMDebugAI( << "dummy grid query: " << qstr << std::endl);
    536543
    537544    r_OQL_Query qins(qstr.c_str());
  • applications/rasgeo/RasdamanHelper2.h

    diff --git a/applications/rasgeo/RasdamanHelper2.h b/applications/rasgeo/RasdamanHelper2.h
    index 049b81b..fde97cc 100644
    a b public:  
    148148    /*! insert an image into the collection */
    149149    double insertImage(std::string collname, char* buf,
    150150                       r_Point& shift, r_Minterval& sdom, bool bRowMajor2ColMajor,
    151                        std::string marraytypename = "");
     151                       std::string marraytypename, std::string tiling);
    152152
    153153    /*! update an already present image in the collection */
    154154    void updateImage(std::string collname, double imgid,
    155155                     char* buf, r_Point& shift, r_Minterval& sdom, bool bRowMajor2ColMajor,
    156                      std::string marraytypename = "")
     156                     std::string marraytypename)
    157157    throw (r_Error);
    158158
    159159
  • applications/rasgeo/rimport.cxx

    diff --git a/applications/rasgeo/rimport.cxx b/applications/rasgeo/rimport.cxx
    index ab8661f..1d27aef 100644
    a b int  
    461461processImageFiles(vector<string>& filenames, string collname,
    462462                  vector<double>& oids, Header& processRegion,
    463463                  string mode3D, r_Point& shiftPt, RasdamanHelper2& helper,
    464                   std::string marraytypename)
     464                  std::string marraytypename, std::string tiling)
    465465{
    466466    /* PROCEDURE
    467467     * - read source geospatial region (srcGeoRegion)
    processImageFiles(vector<string>& filenames, string collname,  
    678678        printRegion(newGeoRegion, "newGeoRegion");
    679679
    680680        importImage(helper, pDs, collname, oids, readGDALImgDOM, writeShift,
    681                     newGeoRegion, b3D, marraytypename);
     681                    newGeoRegion, b3D, marraytypename, tiling);
    682682
    683683        // release data set
    684684        GDALClose(pDs);
    processImageFiles(vector<string>& filenames, string collname,  
    709709
    710710int importImage(RasdamanHelper2& helper, GDALDataset* pDs, string& collname, vector<double>& oids,
    711711                r_Minterval& readGDALImgDOM, r_Point& writeShift, Header& newGeoRegion,
    712                 bool asCube, std::string marraytypename)
     712                bool asCube, std::string marraytypename, std::string tiling)
    713713{
    714714    NMDebugCtx(ctxRimport, << "...");
    715715
    int importImage(RasdamanHelper2& helper, GDALDataset* pDs, string& collname, vec  
    791791
    792792                if (iter == 0 && oids.size() < b)
    793793                    oids.push_back(helper.insertImage(collname, (char*)gdalbuf, seqWriteShift, rint, true,
    794                                                       marraytypename));
     794                                                      marraytypename, tiling));
    795795                else
    796796                    helper.updateImage(collname, oids[b-1], (char*)gdalbuf, seqWriteShift, rint, true,
    797797                                       marraytypename);
    int importImage(RasdamanHelper2& helper, GDALDataset* pDs, string& collname, vec  
    810810                if (iter == 0 && oids.size() == 0)
    811811                {
    812812                    oids.push_back(helper.insertImage(collname, (char*)gdalbuf, seqWriteShift, rint, true,
    813                                                       marraytypename));
     813                                                      marraytypename, tiling));
    814814                }
    815815                else
    816816                {
    main(int argc, char** argv)  
    10681068    std::string collname;                                        // -coll
    10691069    std::string connfile;                                        // -conn
    10701070    std::string mode3D;                                          // -3D
     1071    std::string tilingSpec;                                                                              // -tiling
    10711072
    10721073    double cellsizez = -1;                                       // -csz
    10731074    std::vector<double> bnd;                                     // -bnd
    main(int argc, char** argv)  
    12031204                return EXIT_FAILURE;
    12041205            }
    12051206        }
     1207        else if (theArg == "-tiling")
     1208        {
     1209                tilingSpec = argv[arg+1];
     1210        }
    12061211        else if (theArg == "--help")
    12071212        {
    12081213            showHelp();
    main(int argc, char** argv)  
    12411246        NMDebug(<< usertype.at(t) << " ");
    12421247    NMDebug(<< std::endl);
    12431248
     1249    NMDebugInd(1, << "tiling scheme: " << tilingSpec << std::endl);
     1250
    12441251    // -----------------------------------------------------------------------
    12451252    // EVALUATE ARGUMENTS
    12461253    // get the connection file and check readability
    main(int argc, char** argv)  
    13531360            marraytypename = usertype.at(0);
    13541361
    13551362        if (!processImageFiles(vimportnames, collname, oids, header, mode3D,
    1356                                shiftPt, helper, marraytypename))
     1363                               shiftPt, helper, marraytypename, tilingSpec))
    13571364        {
    13581365            NMErr(ctxRimport, << "Failed processing image file(s)!");
    13591366            return EXIT_FAILURE;
  • applications/rasgeo/rimport.h

    diff --git a/applications/rasgeo/rimport.h b/applications/rasgeo/rimport.h
    index ecdb91b..0aace0e 100644
    a b void showHelp();  
    133133
    134134int importImage(RasdamanHelper2& helper, GDALDataset* pDs, string& collname, vector<double>& oids,
    135135                r_Minterval& readGDALImgDOM, r_Point& writeShift, Header& newGeoRegion,
    136                 bool asCube, std::string marraytypename = "");
     136                bool asCube, std::string marraytypename, string tiling);
    137137
    138138int processImageFiles(vector<string>& filenames, string collname, vector<double>& oids,
    139139                      Header& processRegion, string mode3D, r_Point& shiftPt, RasdamanHelper2& helper,
    140                       std::string marraytypename = "");
     140                      std::string marraytypename, string tiling);
    141141
    142142void intersectRegions2D(Header& inoutRegion, Header& intersectRegion);
    143143void intersectRegions2D(Header& inoutRegion, std::vector<double>& intersectRegions);