void ossimImageGaussianFilter::updateKernels() { //update kernels based on GaussStd value :2.5 sigma on each side // symetric kernel static const ossim_float64 sigmaN = 2.5; ossim_float64 sig22 = getGaussStd()*getGaussStd()*2.0; ossim_uint32 halfw = (ossim_uint32)(std::floor(getGaussStd() * sigmaN + 0.5)); ossim_uint32 supsize = 2*halfw + 1; //fill with sym. gaussian (unnormalized) vector<ossim_float64> newk(supsize); ossim_float64 sum=1.0; ossim_float64 v; newk[halfw] = 1.0; for(ossim_int32 i=(ossim_int32)halfw; i>0 ;--i) //reverse for summing { newk[halfw + i] = newk[halfw - i] = v = std::exp(-i*i/sig22); sum += 2.0 * v; } //normalize ossim_float64 invsum=1.0/sum; for(ossim_uint32 i=0; i<supsize ;++i) { newk[i] *= invsum; } //send to 1d conv filters theHF->setKernel(newk); theVF->setKernel(newk); theHF->setCenterOffset(halfw); theVF->setCenterOffset(halfw); }
void kMyMoneyLineEdit::keyPressEvent(QKeyEvent* k) { if (d->m_forceMonetaryDecimalSymbol) { if (k->modifiers() & Qt::KeypadModifier) { if (k->key() == Qt::Key_Comma || k->key() == Qt::Key_Period) { if (KGlobal::locale()->monetaryDecimalSymbol() == ",") { QKeyEvent newk(k->type(), Qt::Key_Comma, k->modifiers(), ",", k->isAutoRepeat(), k->count()); KLineEdit::keyPressEvent(&newk); k->accept(); return; } if (KGlobal::locale()->monetaryDecimalSymbol() == ".") { QKeyEvent newk(k->type(), Qt::Key_Period, k->modifiers(), ".", k->isAutoRepeat(), k->count()); KLineEdit::keyPressEvent(&newk); k->accept(); return; } } } } KLineEdit::keyPressEvent(k); }
void kMyMoneyLineEdit::keyPressEvent(QKeyEvent* k) { if (d->m_forceMonetaryDecimalSymbol) { if (k->modifiers() & Qt::KeypadModifier) { if (k->key() == Qt::Key_Comma || k->key() == Qt::Key_Period) { if (QLocale().decimalPoint() == QLatin1Char(',')) { QKeyEvent newk(k->type(), Qt::Key_Comma, k->modifiers(), ",", k->isAutoRepeat(), k->count()); KLineEdit::keyPressEvent(&newk); k->accept(); return; } if (QLocale().decimalPoint() == QLatin1Char('.')) { QKeyEvent newk(k->type(), Qt::Key_Period, k->modifiers(), ".", k->isAutoRepeat(), k->count()); KLineEdit::keyPressEvent(&newk); k->accept(); return; } } } } KLineEdit::keyPressEvent(k); }