コード例 #1
0
ファイル: tools.cpp プロジェクト: xinll/virtualhost
void RmDir(const char *path)
{
	if(IsFile(path) || IsLnk(path))
	{
		remove(path);
		return;
	}
	char filePath[PATH_MAX];
	if(IsDir(path))
	{
		DIR *dir;
		struct dirent *ptr;
		dir = opendir(path);
		while(ptr = readdir(dir))
		{
			if(IsSpecial(ptr->d_name))
				continue;
			GetFilePath(path,ptr->d_name,filePath);
			if(IsDir(filePath))
			{
				RmDir(filePath);
				rmdir(filePath);
			}
			else if(IsFile(filePath) || IsLnk(filePath))
			{
				remove(filePath);
			}
		}
		closedir(dir);
	}
}
コード例 #2
0
ファイル: libamp.c プロジェクト: GSI-CS-CO/kernel_modules
static void EscapeOBuf() {

int i, j;
unsigned char c;

   if ((OBufSize > 0) && (OBuf[0] == STX) && (OBuf[OBufSize-1] == ETX)) {

      bzero((void *) EscBuf, ESC_BUF_SIZE);
      EscBufSize = 0;
      EscBuf[0] = STX;

      for (i=1,j=1; i<OBufSize-1; i++) {
	 c = OBuf[i];
	 if (IsSpecial(c)) {
	    EscBuf[j++] = ESC;
	    EscBuf[j++] = c + 0x40;
	 } else {
	    EscBuf[j++] = OBuf[i];
	 }
      }
      EscBuf[j++] = ETX;

      for (i=0; i<j; i++) OBuf[i] = EscBuf[i];
      EscBufSize = j;
      OBufSize = j;
      return;
   }
   fprintf(stderr,"libamp:Error:EscapeBuffer:Illegal size or not delimited by STX ETX\n");
}
コード例 #3
0
ファイル: Latitude.cpp プロジェクト: jlaura/isis3
  /**
   * Set the latitude given a value in the Planetographic coordinate system
   *
   * @param latitude The planetographic latitude to set ourselves to
   * @param units The angular units latitude is in
   */
  void Latitude::setPlanetographic(double latitude, Angle::Units units) {
    if (m_equatorialRadius == NULL || m_polarRadius == NULL) {
      IString msg = "Latitude [" + IString(latitude) + "] cannot be "
          "converted to Planetocentic without the planetary radii, please use "
          "the other Latitude constructor";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }

    Angle inputAngle(latitude, units);

    if (inputAngle > Angle(90.0, Angle::Degrees) ||
        inputAngle < Angle(-90.0, Angle::Degrees)) {
      IString msg = "Latitudes outside of the -90/90 range cannot be converted "
          "between Planetographic and Planetocentric";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }

    if(IsSpecial(latitude)) {
      IString msg = "Invalid planetographic latitudes are not currently "
          "supported";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }

    double ocentricLatitude = atan(tan(inputAngle.radians()) *
        (*m_polarRadius / *m_equatorialRadius) *
        (*m_polarRadius / *m_equatorialRadius));

    // Sometimes the trig functions return the negative of the expected value at the pole.
    if ((ocentricLatitude > 0) != (inputAngle.radians() > 0)) {
      ocentricLatitude *= -1;
    }

    setAngle(ocentricLatitude, Angle::Radians);
  }
コード例 #4
0
ファイル: quote.hpp プロジェクト: zjucsxxd/carmel
template <class Output, class Ch, class Tr, class IsSpecial> inline
Output
in_quote(std::basic_istream<Ch, Tr> &i, Output out, IsSpecial is_special = IsSpecial(),
         char quote_char='"', char escape_char='\\')
{
  char c;
  if (i.get(c)) {
    *out++=c;
    if (c==quote_char) { // quoted - end delimited by unescape quote
      for (;;) {
        if (!i.get(c))
          goto fail;
        if (c==quote_char)
          break;
        if (c==escape_char)
          if (!i.get(c))
            goto fail;
        *out++=c;
      }
    } else { // unquoted - end delimited by an is_special char
      while (i.get(c)) {
        if (is_special(c)) {
          i.unget();
          break;
        }
        *out++=c;
      }
    }
  } // else end of stream.  shouldn't interpret as empty token but not throwing exception either.  check status of i before you use.
  return out;
fail:
  throw std::runtime_error("end of file reached when parsing quoted string (in_quote)");
}
コード例 #5
0
ファイル: MosaicControlNetTool.cpp プロジェクト: jlaura/isis3
  /**
   * Get the current max. residual magnitude to become fully colored. This will return Null if it's
   *   undefined.
   */
  double MosaicControlNetTool::maxMovementColorResidualMagnitude() const {
    double result = Null;

    if (!IsSpecial(m_residualMagnitude))
      result = m_residualMagnitude;

    return result;
  }
コード例 #6
0
ファイル: ScatterPlotData.cpp プロジェクト: corburn/ISIS
  /**
   * Get the 2D (x/y) index position given an x/y dn value.
   *
   * @param x The x-dn value of the bin
   * @param y The y-dn value of the bin
   * @return The 2D (x/y) bin index position
   */
  QPair<int, int> ScatterPlotData::binXYIndices(double x, double y) const {
    QPair<int, int> indices(-1, -1);

    if (m_counts->size() && m_counts->at(0).size()) {
      double xBinPosition = m_xDnToBinStretch->Map(x);
      double yBinPosition = m_yDnToBinStretch->Map(y);

      if (!IsSpecial(xBinPosition) && !IsSpecial(yBinPosition)) {
        int discreteXBin = qRound(xBinPosition);
        int discreteYBin = qRound(yBinPosition);

        if (discreteXBin >= 0 && discreteXBin < m_counts->at(0).size() &&
            discreteYBin >= 0 && discreteYBin < m_counts->size()) {
          indices = QPair<int, int>(discreteXBin, discreteYBin);
        }
      }
    }

    return indices;
  }
コード例 #7
0
ファイル: quote.hpp プロジェクト: zjucsxxd/carmel
template <class Ch, class Tr, class IsSpecial> inline
std::string
in_quote(std::basic_istream<Ch, Tr> &i, IsSpecial is_special = IsSpecial(),
         char quote_char='"', char escape_char='\\')
{
  //    std::basic_stringstream<Ch,Tr> s;
  std::vector<Ch> v;
  in_quote(i, back_inserter(v)//std::ostreambuf_iterator<Ch,Tr>(s)
           , is_special, quote_char, escape_char);
  return std::string(v.begin(), v.end());
  //    return s.str();
}
コード例 #8
0
ファイル: cursesstring.cpp プロジェクト: ajakubek/plim
int cCursesString::GetFlags(int index, int* flags, int* colors) {
	char ch = GetChar(index);

	*colors = 0;

	if ( IsSpecial(index) ) {
		switch (ch)
		{
			case ATTR_BOLD: {
				*flags |= A_BOLD;
				break;
			}
			case ATTR_COLOR: {
				*colors = 1;
				break;
			} 

			case ATTR_RESET: {
				*flags = ATTR_RESET;
				break;
			}

			case ATTR_FIXED: {
				/* dunno */
				break;
			}

			case ATTR_REVERSE:
			case ATTR_REVERSE2: {
				*flags |= A_REVERSE;
				break;
			}

			case ATTR_ITALIC: {
				/* Dunno, ncurses doesnt support italic stuff */
				break;
			}

			case ATTR_UNDERLINE2:
			case ATTR_UNDERLINE: {
				*flags |= A_UNDERLINE;
				break;
			}

			default:
				break;
		}

	}

	return 0;
}
コード例 #9
0
ファイル: XmlTree.cpp プロジェクト: dbremner/WinLib
	void Attribute::SetTransformValue (std::string const & value)
	{
		std::string::const_iterator current = 
			std::find_if (value.begin (), value.end (), IsSpecial ());
		if (current == value.end ())
		{
			_value = value;
			return;
		}

		std::string::const_iterator firstNotAdded = value.begin ();
		do 
		{
			Assert (current != value.end ());
			_value.append (firstNotAdded, current);
			_value.append (XML::TransformSpecial (*current));
			++current;
			firstNotAdded = current;
			current = std::find_if (current, value.end (), IsSpecial ());
		} while (current != value.end ());
		_value.append (firstNotAdded, value.end ());
	}
コード例 #10
0
ファイル: Pixel.cpp プロジェクト: corburn/ISIS
  /**
   * Takes a double pixel value and returns the name of the pixel type as a
   * string
   *
   * @param d Pixel value
   *
   * @return string The name of the pixel type
   */
  string Pixel::ToString(double d) {
    if(IsSpecial(d)) {
      if(IsNull(d))     return string("Null");
      else if(IsLrs(d)) return string("Lrs");
      else if(IsHrs(d)) return string("Hrs");
      else if(IsHis(d)) return string("His");
      else if(IsLis(d)) return string("Lis");
      else               return string("Invalid");
    }

    QString result;
    return result.setNum(d).toStdString();
  }
コード例 #11
0
wxString SFTPAttribute::GetTypeAsString() const
{
    if ( IsSpecial() ) {
        return "Special";
    } else if ( IsFolder() ) {
        return "Folder";
    } else if ( IsSymlink() ) {
        return "Symlink";
    } else if ( IsFile() ) {
        return "File";
    } else {
        return "Unknown";
    }
}
コード例 #12
0
ファイル: Latitude.cpp プロジェクト: jlaura/isis3
  /**
   * We're overriding this method in order to do -90/90 degree checking
   *
   * @param angle The numeric value of the angle
   * @param units The units angle is in (radians or degrees typically)
   */
  void Latitude::setAngle(double angle, const Angle::Units &units) {
    // Check for passing 90 degrees if that error checking is on
    if (!IsSpecial(angle) && (m_errors & AllowPastPole) != AllowPastPole) {
      Angle tmpAngle(angle, units);
      if(tmpAngle > Angle(90, Angle::Degrees) ||
         tmpAngle < Angle(-90, Angle::Degrees)) {
        IString msg = "Latitudes past 90 degrees are not valid. The latitude "
            "[" + IString(tmpAngle.degrees()) + " degrees] is not allowed";
        throw IException(IException::Programmer, msg, _FILEINFO_);
      }
    }

    Angle::setAngle(angle, units);
  }
コード例 #13
0
ファイル: RasterBuffer.cpp プロジェクト: damianob/xcsoar
short
RasterBuffer::GetInterpolated(unsigned lx, unsigned ly,
                               unsigned ix, unsigned iy) const
{
  assert(IsDefined());
  assert(lx < GetWidth());
  assert(ly < GetHeight());
  assert(ix < 0x100);
  assert(iy < 0x100);

  // perform piecewise linear interpolation
  const unsigned int dx = (lx == GetWidth() - 1) ? 0 : 1;
  const unsigned int dy = (ly == GetHeight() - 1) ? 0 : GetWidth();
  const short *tm = GetDataAt(lx, ly);

  if (IsSpecial(*tm) || IsSpecial(tm[dx]) ||
      IsSpecial(tm[dy]) || IsSpecial(tm[dx + dy]))
    return *tm;

  unsigned kx = 0x100 - ix;
  unsigned ky = 0x100 - iy;

  return (*tm * kx * ky + tm[dx] * ix * ky + tm[dy] * kx * iy + tm[dx + dy] * ix * iy) >> 16;
}
コード例 #14
0
// -----------------------------------------------------------------------------
// TSTSCharacterSetConverter::EscapedUnicodeToPrintableL
// Converts string from escaped unicode to printable string
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
HBufC8* TSTSCharacterSetConverter::EscapedUnicodeToPrintableLC(
    const TDesC& aValue) const
{
    TInt valueLength = aValue.Length();
    // returned value can never be longer than the original (it can be shorter)
    HBufC8* value = HBufC8::NewL(valueLength);
    CleanupStack::PushL(value);
    TPtr8 valueDes = value->Des();

    TLex lexer(aValue);

    while (!lexer.Eos())
    {
        TChar currentChar = lexer.Get();
        if (currentChar == '\\')
        {
            // we are escaping
            if (lexer.Eos())
            {
                User::Leave(KSTSErrInvalidCAName);
            }
            lexer.Mark();
            currentChar = lexer.Get();
            if (!IsSpecial(currentChar))
            {
                if (lexer.Eos())
                {
                    User::Leave(KSTSErrInvalidCAName);
                }
                lexer.Get();
                TLex hexPair(lexer.MarkedToken());
                TUint hexChar;
                User::LeaveIfError(hexPair.Val(hexChar, EHex));
                currentChar = hexChar;
            }
        }
        if (IsPrintable(currentChar))
        {
            valueDes.Append(currentChar);
        }
        else
        {
            User::Leave(KSTSErrInvalidCharactersInCAName);
        }
    }

    return value;
}
コード例 #15
0
ファイル: Wcsv.cpp プロジェクト: JacobCWard/PyPNL
void WLex::PutValue(String &str)
{
    if(!IsEol())
    {
	putc(Delimiter(), m_File);
    }
    else
    {
	m_bEOL = false;
    }
    for(int i = 0; i < int(str.length()); ++i)
    {
	if(IsSpecial(str[i]))
	{
	    putc('\\', m_File);
	}
	putc(str[i], m_File);
    }
}
コード例 #16
0
ファイル: RasterRenderer.cpp プロジェクト: Advi42/XCSoar
void
RasterRenderer::GenerateUnshadedImage(unsigned height_scale,
                                      const unsigned contour_height_scale)
{
  const auto *src = height_matrix.GetData();
  const RawColor *oColorBuf = color_table + 64 * 256;
  RawColor *dest = image->GetTopRow();

  for (unsigned y = height_matrix.GetHeight(); y > 0; --y) {
    RawColor *p = dest;
    dest = image->GetNextRow(dest);

    unsigned contour_row_base = ContourInterval(*src, contour_height_scale);
    unsigned char *contour_this_column_base = contour_column_base;

    for (unsigned x = height_matrix.GetWidth(); x > 0; --x) {
      const auto e = *src++;
      if (gcc_likely(!e.IsSpecial())) {
        unsigned h = std::max(0, (int)e.GetValue());

        const unsigned contour_interval =
          ContourInterval(h, contour_height_scale);

        h = std::min(254u, h >> height_scale);
        if (gcc_unlikely((contour_interval != contour_row_base)
                         || (contour_interval != *contour_this_column_base))) {

          *p++ = oColorBuf[(int)h - 64 * 256];
          *contour_this_column_base = contour_row_base = contour_interval;
        } else {
          *p++ = oColorBuf[h];
        }
      } else if (e.IsWater()) {
        // we're in the water, so look up the color for water
        *p++ = oColorBuf[255];
      } else {
        /* outside the terrain file bounds: white background */
        *p++ = RawColor(0xff, 0xff, 0xff);
      }
      contour_this_column_base++;

    }
コード例 #17
0
ファイル: StatisticsTool.cpp プロジェクト: corburn/ISIS
  /**
   * Called when the mouse moves over this widget
   *
   * @param event
   */
  void VisualDisplay::mouseMoveEvent(QMouseEvent *event) {
    double startX = width() / 2 - (p_boxWidth * (int)floor(p_boxSamps / 2) + (p_boxWidth / 2));
    double startY = height() / 2 - (p_boxHeight * (int)floor(p_boxLines / 2) + (p_boxHeight / 2));

    int x = (int)ceil((event->x() - startX) / p_boxWidth);
    int y = (int)ceil((event->y() - startY) / p_boxHeight);

    if(!p_set || x < 1 || y < 1 || x > p_boxSamps || y > p_boxLines) {
      emit setSample("Sample: n/a");
      emit setLine("Line: n/a");
      emit setDn("DN: n/a");
    }
    else {
      emit setSample(QString("Sample: %1").arg(p_ulSamp + x - 1));
      emit setLine(QString("Line: %1").arg(p_ulLine + y - 1));
      double dn = p_pixelData[y-1][x-1];
      if(IsSpecial(dn))
        emit setDn(QString("DN: %1").arg(PixelToString(dn)));
      else
        emit setDn(QString("DN: %1").arg(dn));
    }
  }
コード例 #18
0
ファイル: iTime.cpp プロジェクト: corburn/ISIS
 void iTime::setEt(double et) {
   if(!IsSpecial(et))
     p_et = et;
   else
     p_et = 0.0;
 }
コード例 #19
0
ファイル: iTime.cpp プロジェクト: corburn/ISIS
 void iTime::operator +=(const double &secondsToAdd) {
   if(!IsSpecial(secondsToAdd) && !IsSpecial(p_et) && (p_et != 0.0))
     p_et += secondsToAdd;
 }
コード例 #20
0
ファイル: WriteTabular.cpp プロジェクト: assutech/isis3
  /**
   * Writes a floating-point value out to the next column in the current row
   * 
   * @param item The value to be printed out
   */
  void WriteTabular::Write(double item){
    Column thisCol = p_cols[p_curCol];
    if (thisCol.DataType() != Column::Real &&
        thisCol.DataType() != Column::Pixel) {
      std::string message = "Wrong data type for this Column";
      throw Isis::iException::Message(Isis::iException::User,message,_FILEINFO_);
    }

    //Check for special pixels, if it's a pixel column
    if (thisCol.DataType() == Column::Pixel && IsSpecial(item)) {
      if (IsNullPixel(item)) {
        Write("Null");
        return;
      }
      if (IsHisPixel(item)) {
        Write("His");
        return;
      }
      if (IsHrsPixel(item)) {
        Write("Hrs");
        return;
      }
      if (IsLisPixel(item)) {
        Write("Lis");
        return;
      }
      if (IsLrsPixel(item)) {
        Write("Lrs");
        return;
      }
    }

    iString thisItem(item);


    if (thisCol.Alignment() == Column::Decimal) {

      //Format and round the number

      //First, split the number at the decimal point
      iString tempString = thisItem;
      iString intPart = tempString.Token(".");
      //Make the fractional portion appear as such, so the iomanipulators
      //handle it properly
      if (tempString != "") {
        tempString = "0." + tempString;
      }
      else tempString = "0.0";

      //Put the fractional portion into a stringstream, and use
      //stream manipulators to round it properly
      std::stringstream b;
      b << std::showpoint
        << std::setprecision(thisCol.Precision())
        << tempString.ToDouble();

      //if the rounding causes a rollover (i.e. the decimal portion is greater
      //than 0.95) increment the integer portion
      if (iString(b.str()).ToDouble() >= 1) {
        intPart = iString(intPart.ToInteger() + 1);
      }

      //Put it back into an iString, for easier manipulation
      tempString = b.str();
      tempString.Token(".");
      //Add any zeros necessary to pad the number
      while (tempString.size() < thisCol.Precision()) {
        tempString += "0";
      }

      //Put the number back together, adding the decimal point in the right location
      thisItem = intPart + "." + tempString;
    }
    std::stringstream tempStream;
    tempStream.width(thisCol.Width());
    tempStream.fill(' ');

    if (thisCol.Alignment() == Column::Left) {
      tempStream.setf(std::ios::left);
    }
    else tempStream.setf(std::ios::right);

    tempStream << thisItem;
    thisItem = tempStream.str();

    if (p_curCol == 0) {
      p_rows++;
    }

    //If the number is too wide for the column, replace with a string of stars
    if (thisItem.length() > thisCol.Width()) {
      thisItem = "*";
      while (thisItem.length() < thisCol.Width()) {
        thisItem += "*";
      }
    }

    if (p_curCol < (p_cols.size()-1)) {
      thisItem += p_delimiter;
      p_curCol++;
    }
    else {
      thisItem += "\n";
      p_curCol = 0;
    }
    p_outfile << thisItem;

  }
コード例 #21
0
ファイル: quote.hpp プロジェクト: zjucsxxd/carmel
inline void out_quote(std::basic_ostream<Ch, Tr> &out, const C& data, IsSpecial is_special = IsSpecial(), char quote_char='"', char escape_char='\\') {
  std::basic_stringstream<Ch, Tr> s;
  s << data;
  or_true_for_chars<IsSpecial> needs_quote(quote_char, escape_char, is_special);
  typedef std::istreambuf_iterator<Ch, Tr> i_iter;
  typedef std::ostream_iterator<Ch, Tr> o_iter;
  i_iter i(s), end;
  bool quote = (std::find_if (i, end, needs_quote) != end);
  rewind(s);
  if (quote) {
    out << quote_char;
    for (i_iter i(s); i!=end; ++i) {
      Ch c=*i;
      if (c == quote_char || c== escape_char)
        out.put(escape_char);
      out.put(c);
    }
    out << quote_char;
  } else {
    //        std::copy(i_iter(s),end,o_iter(out));
    /*
      for (i_iter i(s);i!=end;++i)
      out.put(*i);
    */
    Ch c;
    while (s.get(c))
      out.put(c);
  }
}
コード例 #22
0
ファイル: StatisticsTool.cpp プロジェクト: corburn/ISIS
  /**
   * Paint the pixmap
   *
   */
  void VisualDisplay::paintPixmap() {
    p_pixmap = QPixmap(p_boxSamps * p_boxWidth, p_boxLines * p_boxHeight);
    p_pixmap.fill();
    QPainter p(&p_pixmap);
    QRect rect(0, 0, p_boxWidth, p_boxHeight);

    int midX = p_pixmap.width() / 2 - ((p_boxWidth / 2) * (p_boxSamps % 2));
    int midY = p_pixmap.height() / 2 - ((p_boxHeight / 2) * (p_boxLines % 2));

    int x, y;
    y = 0;

    for(int i = 0; i < p_boxLines; i++) {
      x = 0;
      for(int j = 0; j < p_boxSamps; j++) {
        double dn = p_pixelData[i][j];
        QColor c;
        if(p_showPixels || p_showDeviation) {
          if(p_showDeviation) {
            if(!IsSpecial(dn) && p_stats.TotalPixels() > 0 && p_stats.StandardDeviation() != 0) {
              double diff;

              if(dn < p_stats.Average()) {
                diff = p_stats.Average() - dn;
                diff /= p_stats.Average() - p_stats.Minimum();
              }
              else {
                diff = dn - p_stats.Average();
                diff /= p_stats.Maximum() - p_stats.Average();
              }

              int i = (int)(diff * 255.0);
              c = QColor(i, 255 - i, 0);
            }
            else {
              c = QColor(0, 0, 0);
            }
          }
          else {
            double visualValue = p_stretch.Map(dn);

            c = QColor(visualValue, visualValue, visualValue);
          }
        }
        p.save();
        p.translate(x, y);

        if(p_showText) {
          p.drawRect(rect);

          if (!IsSpecial(dn))
            p.drawText(rect, Qt::AlignCenter, QString::number(dn));
          else
            p.drawText(rect, Qt::AlignCenter, PixelToString(dn));
        }
        else {
          p.fillRect(rect, c);
        }

        p.restore();
        x += p_boxWidth;
      }
      y += p_boxHeight;
    }

    p.setPen(QPen(Qt::red, 1));
    p.save();
    p.translate(midX, midY);
    p.drawRect(rect);
    p.restore();
    update();
  }
コード例 #23
0
ファイル: ScatterPlotData.cpp プロジェクト: corburn/ISIS
  /**
   * ScatterPlotDataConstructor
   *
   * @param xCube The x-axis cube
   * @param xCubeBand The x-axis cube's band to get DN values from
   * @param xBinCount The resolution of the x-axis
   * @param yCube The y-axis cube
   * @param yCubeBand The y-axis cube's band to get DN values from
   * @param yBinCount The resolution of the y-axis
   * @param sampleRange The sample range to gather the histogram from, this is
   *                    the same for the x cube and y cube.
   * @param lineRange The line range to gather the histogram from, this is
   *                  the same for the x cube and y cube.
   */
  ScatterPlotData::ScatterPlotData(
      Cube *xCube, int xCubeBand, int xBinCount,
      Cube *yCube, int yCubeBand, int yBinCount,
      QwtInterval sampleRange, QwtInterval lineRange) : QwtRasterData(),
      m_xDnToBinStretch(new Stretch), m_yDnToBinStretch(new Stretch),
      m_counts(
        new QVector< QVector<int> >(yBinCount, QVector<int>(xBinCount))),
      m_alarmedBins(new QMap<int, bool>) {
    int startLine = qRound(lineRange.minValue());
    int endLine = qRound(lineRange.maxValue());
    ASSERT(xCube->lineCount() == yCube->lineCount());

    Histogram *xCubeHist = new Histogram(*xCube, xCubeBand, NULL,
        sampleRange.minValue(), lineRange.minValue(),
        sampleRange.maxValue(), lineRange.maxValue(),
        xBinCount, true);
    m_xCubeMin = xCubeHist->Minimum();
    m_xCubeMax = xCubeHist->Maximum();


    Histogram *yCubeHist = new Histogram(*yCube, yCubeBand, NULL,
        sampleRange.minValue(), lineRange.minValue(),
        sampleRange.maxValue(), lineRange.maxValue(),
        yBinCount, true);
    m_yCubeMin = yCubeHist->Minimum();
    m_yCubeMax = yCubeHist->Maximum();


    m_xDnToBinStretch->AddPair(m_xCubeMin, 0);
    m_xDnToBinStretch->AddPair(m_xCubeMax, xBinCount - 1);

    m_yDnToBinStretch->AddPair(m_yCubeMin, 0);
    m_yDnToBinStretch->AddPair(m_yCubeMax, yBinCount - 1);

    m_maxCount = 0;

    Brick brick1((int)(sampleRange.maxValue() - sampleRange.minValue() + 1),
                 1, 1, xCube->pixelType());
    Brick brick2((int)(sampleRange.maxValue() - sampleRange.minValue() + 1),
                 1, 1, yCube->pixelType());
    ASSERT(xCube->sampleCount() == yCube->sampleCount());
    ASSERT(brick1.size() == brick2.size());

    for (int line = startLine; line <= endLine; line++) {
      brick1.SetBasePosition(qRound(sampleRange.minValue()), line, xCubeBand);
      xCube->read(brick1);

      brick2.SetBasePosition(qRound(sampleRange.minValue()), line, yCubeBand);
      yCube->read(brick2);

      for (int i = 0; i < brick1.size(); i++) {
        double xDn = brick1[i];
        double yDn = brick2[i];

        if (!IsSpecial(xDn) && !IsSpecial(yDn)) {
          double x = m_xDnToBinStretch->Map(xDn);
          double y = m_yDnToBinStretch->Map(yDn);

          if (!IsSpecial(x) && !IsSpecial(y)) {
            int roundedX = qRound(x);
            int roundedY = qRound(y);

            if (roundedX >= 0 && roundedX < xBinCount &&
                roundedY >= 0 && roundedY < yBinCount) {
              int value = (*m_counts)[roundedY][roundedX] + 1;
              (*m_counts)[roundedY][roundedX] = value;

              m_maxCount = qMax(m_maxCount, value);
            }
          }
        }
      }
    }

    setInterval(Qt::XAxis, QwtInterval(m_xCubeMin, m_xCubeMax));
    setInterval(Qt::YAxis, QwtInterval(m_yCubeMin, m_yCubeMax));
    setInterval(Qt::ZAxis, QwtInterval(0, m_maxCount));
  }