[Kst] extragear/graphics/kst/src/datasources/scuba2

Andrew Walker arwalker at sumusltd.com
Mon Mar 26 21:34:46 CEST 2007


SVN commit 646850 by arwalker:

correctly orient scuba matrices

 M  +56 -41    scuba.cpp  


--- trunk/extragear/graphics/kst/src/datasources/scuba2/scuba.cpp #646849:646850
@@ -575,12 +575,11 @@
 
               read = file.readBlock((char*)rawValues, length * sizeof( long ));
               if( read == length * (long)sizeof( long )) {
-                for (i=0; i<yNumSteps; ++i) {
-                  if (i < _numRows) {
-                    for (j=0; j<xNumSteps; j++) {
-                      if (j < _numEntriesInFormatBinaryLine) {
-                        lvalue = rawValues[numHousekeepingFields + ( i * _numEntriesInFormatBinaryLine ) + j];
-
+                for (i=0; i<xNumSteps; ++i) {
+                  if (i < _numEntriesInFormatBinaryLine) {
+                    for (j=0; j<yNumSteps; ++j) {
+                      if (j < _numRows) {
+                        lvalue = rawValues[numHousekeepingFields + ( j * _numEntriesInFormatBinaryLine ) + i];
                         switch (_datamode) {
                           case DataError:
                           case DataPreScaleFeedback:
@@ -626,8 +625,11 @@
                 }
               }
             } else if (_format == FormatText2) {
+              QStringList lines;
               QStringList entries;
               QString str;
+              int length = xNumSteps * yNumSteps;
+              long rawValues[length];
 
               //
               // always need to skip the first line as it is the header...
@@ -644,49 +646,62 @@
                     if (j < int(entries.size())) {
                       lvalue = entries[j].toInt(&ok, 10);
                       if (!ok) {
-                        *values = KST::NOPOINT;
+                        rawValues[(i * xNumSteps) + j] = KST::NOPOINT;
                       } else {
-                        switch (_datamode) {
-                          case DataError:
-                          case DataPreScaleFeedback:
-                          case DataFiltered:
-                          case DataRaw:
-                            break;
-                          case Data18_14:
-                            if (!error) {
-                              lvalue /= 0x4000;
-                            } else {
-                              lvalue &= 0x3FFF;
-                              if (lvalue & 0x2000) {
-                                lvalue -= 0x4000;
-                              }
+                        rawValues[(i * xNumSteps) + j] = lvalue;
+                      }
+                    }
+                  }
+                }
+              }
+
+              for (i=0; i<xNumSteps; ++i) {
+                for (j=0; j<yNumSteps; j++) {
+                  if ((j * xNumSteps) + i < length) {
+                    lvalue = rawValues[(j * xNumSteps) + i];
+                    if (!ok) {
+                      *values = KST::NOPOINT;
+                    } else {
+                      switch (_datamode) {
+                        case DataError:
+                        case DataPreScaleFeedback:
+                        case DataFiltered:
+                        case DataRaw:
+                          break;
+                        case Data18_14:
+                          if (!error) {
+                            lvalue /= 0x4000;
+                          } else {
+                            lvalue &= 0x3FFF;
+                            if (lvalue & 0x2000) {
+                              lvalue -= 0x4000;
                             }
-                            break;
-                          case Data24_8:
-                            if (!error) {
-                              lvalue /= 0x100;
-                            } else {
-                              lvalue &= 0xFF;
-                              if (lvalue & 0x80) {
-                                lvalue -= 0x100;
-                              }
+                          }
+                          break;
+                        case Data24_8:
+                          if (!error) {
+                            lvalue /= 0x100;
+                          } else {
+                            lvalue &= 0xFF;
+                            if (lvalue & 0x80) {
+                              lvalue -= 0x100;
                             }
-                            break;
-                        }
-
-                        if (max) {
-                          if (frame > frameStart && double(lvalue) > *values) {
-                            *values = double(lvalue);
                           }
-                        } else if (avg) {
-                          *values += double(lvalue);
-                        } else {
+                          break;
+                      }
+  
+                      if (max) {
+                        if (frame > frameStart && double(lvalue) > *values) {
                           *values = double(lvalue);
                         }
+                      } else if (avg) {
+                        *values += double(lvalue);
+                      } else {
+                        *values = double(lvalue);
                       }
-
-                      ++values;
                     }
+  
+                    ++values;
                   }
                 }
               }


More information about the Kst mailing list