Commit 1321aeba authored by Jesse Mapel's avatar Jesse Mapel Committed by Jesse Mapel
Browse files

Port #3910 to 4.1

parent 0ff503c9
Loading
Loading
Loading
Loading
+24 −9
Original line number Diff line number Diff line
@@ -71,6 +71,10 @@
    <change name="Adam Paquette" date="2016-06-15">
      Added the ability for a user to specify the special pixel values
    </change>
    <change name="Adam Paquette" date="2020-06-09">
      Changed output formatting to use a delimiter that is placed after each
      entry, rather than depending on a set width.
    </change>
  </history>


@@ -108,6 +112,17 @@
          <item>YES</item>
        </default>
      </parameter>
      <parameter name="DELIMITER">
        <type>string</type>
        <brief>Output Delimiter</brief>
        <description>
          Sets the value to place between entries in the output file. This will
          default to a space if nothing is entered.
        </description>
        <default>
          <item></item>
        </default>
      </parameter>
    </group>

    <group name="Special Pixels">
+15 −6
Original line number Diff line number Diff line
@@ -33,12 +33,12 @@ public:
                                 QString hrs,
                                 QString his,
                                 QString lrs,
                                 QString lis) :
        null(null), hrs(hrs), his(his), lrs(lrs), lis(lis) {}
                                 QString lis,
                                 QString delimiter) :
        null(null), hrs(hrs), his(his), lrs(lrs), lis(lis), delimiter(delimiter) {}

    void operator() (Buffer &in) const {
        for(int i = 0; i < in.size(); i++) {
          fout.width(13);        //  Width must be set everytime
          if(IsSpecial(in[i])) {
            if(IsNullPixel(in[i])) fout << null;
            if(IsHrsPixel(in[i])) fout << hrs;
@@ -49,6 +49,9 @@ public:
          else {
            fout << in[i];
          }
          if (i != in.size() - 1) {
            fout << delimiter;
          }
        }
        fout << endl;
    }
@@ -58,6 +61,7 @@ private:
    QString his;
    QString lrs;
    QString lis;
    QString delimiter;
};

void IsisMain() {
@@ -78,6 +82,11 @@ void IsisMain() {
  QString to = ui.GetFileName("TO", "txt");
  fout.open(to.toLatin1().data());

  QString delimiter = ui.GetString("DELIMITER");
  if (delimiter.isEmpty()) {
    delimiter = " ";
  }

  // Print header if needed
  if(ui.GetBoolean("HEADER")) {
    fout << "Input Cube:  " << icube->fileName() << endl;
@@ -101,7 +110,7 @@ void IsisMain() {
    lis = "LIS";
  }

  SpecialPixelFunctor isis2ascii(null, hrs, his, lrs, lis);
  SpecialPixelFunctor isis2ascii(null, hrs, his, lrs, lis, delimiter);

  fout << std::setprecision(7);