KbPlot::KbPlot(GLWidget *_container, double _xmin, double _xmax, double _ymin, double _ymax){ xtick = ytick = 0; xgtick = ygtick = 0; isGridEnabled = false; datasetCounter = 0; const double framePos = 1.0 - KbPlot::c_frameThickness; framePoints.push_back(Txy(-1.0, 1.0)); framePoints.push_back(Txy(-1.0, -1.0)); framePoints.push_back(Txy(1.0, -1.0)); framePoints.push_back(Txy(1.0, 1.0)); framePoints.push_back(Txy(-1.0, 1.0)); frame = new Polyline(&framePoints); frame->style.lineColor = 0x444444FF; frame->style.lineThickness = 15.0; frame->toggleFixed(); this->container = _container; if(container != NULL){ axisRebuild(); this->xtick = (xmax - xmin)/20.0; this->ytick = (ymax - ymin)/20.0; container->subscribeToMouse(this); setRanges(_xmin, _xmax, _ymin, _ymax); } }
Camera::Camera(float zNear, float zFar, float frustumScale) : worldToCamera(), cameraToClip(0.0f), orientation(), position() { setRanges(zNear, zFar); setFrustumScale(frustumScale); cameraToClip[2][3] = -1; dirChanged = true; posChanged = true; }
void particle::genParticles(glm::vec3 particleV) { particleCenterM.setTo(cv::Scalar(0)); //Bereich der Partikelstreuung setRanges(particleV.x, particleV.y, particleV.z, 0.5); CvMat LB, UB; cvInitMatHeader(&LB, 3, 1, CV_32FC1, minRange); cvInitMatHeader(&UB, 3, 1, CV_32FC1, maxRange); CvConDensation* condens = cvCreateConDensation(dim, dim, nParticles); cvConDensInitSampleSet(condens, &LB, &UB); //Einheitsmatrix condens->DynamMatr[0] = 1.0; condens->DynamMatr[1] = 0.0; condens->DynamMatr[2] = 0.0; condens->DynamMatr[3] = 0.0; condens->DynamMatr[4] = 1.0; condens->DynamMatr[5] = 0.0; condens->DynamMatr[6] = 0.0; condens->DynamMatr[7] = 0.0; condens->DynamMatr[8] = 1.0; cameraV.clear(); newCameraV.clear(); for (int i = 0; i < condens->SamplesNum; i++) { //Berechnung der Abweichung // float diffX = (particleV.x - condens->flSamples[i][0])/xRange; // float diffY = (particleV.y - condens->flSamples[i][1])/yRange; // float diffZ = (particleV.z - condens->flSamples[i][2])/zRange; // condens->flConfidence[i] = 1.0 / (sqrt(diffX * diffX + diffY * diffY + diffZ * diffZ)); // Partikelstreuung werde ich benötigen //cv::Point3f partPt(condens->flSamples[i][0], condens->flSamples[i][1], condens->flSamples[i][2]); glm::vec3 partCenter(condens->flSamples[i][0], condens->flSamples[i][1], condens->flSamples[i][2]); particleCenterM(i,0) = partCenter.x; particleCenterM(i,1) = partCenter.y; particleCenterM(i,2) = partCenter.z; genParticles(lookAtCamera, partCenter, i); //cout << "PartikelPos: X-Achse: " << condens->flSamples[i][0] << "/" << lastCam(0) << " Y-Achse: " << condens->flSamples[i][1] << "/" << lastCam(1)<< " Z-Achse: " << condens->flSamples[i][2] << "/" << lastCam(2)<< endl; //writeFile(condens->flSamples[i][0], condens->flSamples[i][1], condens->flSamples[i][2], "particlePos.txt"); } //cvConDensUpdateByTime(condens); //Bester Partikel, ist aber keine der Partikelpositionen //cv::Point3f statePt(condens->State[0], condens->State[1], condens->State[2]); //newCameraV.push_back(statePt); //cout << "NeuePose: X-Achse: " << condens->State[0] << "/" << lastCam(0) << " Y-Achse: " << condens->State[1] << "/" << lastCam(1)<< " Z-Achse: " << condens->State[2] << "/" << lastCam(2)<< endl; }
meegoaccelerometer::meegoaccelerometer(QSensor *sensor) : meegosensorbase(sensor) { initSensor<AccelerometerSensorChannelInterface>(m_initDone); setDescription(QLatin1String("x, y, and z axes accelerations in m/s^2")); setRanges(GRAVITY_EARTH_THOUSANDTH); setReading<QAccelerometerReading>(&m_reading); }
meegomagnetometer::meegomagnetometer(QSensor *sensor) : meegosensorbase(sensor) { initSensor<MagnetometerSensorChannelInterface>(m_initDone); setDescription(QLatin1String("magnetic flux density in teslas (T)")); setRanges(NANO); setReading<QMagnetometerReading>(&m_reading); }
void KbPlot::mouseScrollEvent(int a){ double xrange = xmax - xmin; double yrange = ymax - ymin; double xscale = xrange*10e-5 * (double)a; double yscale = yrange*10e-5 * (double)a; setRanges(xmin-xscale, xmax+xscale, ymin-yscale, ymax+yscale); Txy t = myglPlaneWH(); qDebug() << "plane wh: " << t.x << "; " << t.y; }
TEST_F(getFunctionStatementsTest, should_store_statments_source_code) { parse("void f(int) {\n f(1 + 3); int a =\n 9; }"); setRanges({ { stmtNo(0), {15, 24} }, { stmtNo(1), {25, 36} } }); auto stmts = getFunctionStatements(); EXPECT_EQ("f(1 + 3);", stmts[0]->getSourceCode()); ASSERT_EQ("int a =\n 9;", stmts[1]->getSourceCode()); }
//------------------------------------------------------------------------------ // setSlotRanges() -- Our list of valid ranges (nm) //------------------------------------------------------------------------------ bool RfSensor::setSlotRanges(Basic::List* const list) { bool ok = false; if (list != 0) { LCreal rngs[100]; int n = list->getNumberList(rngs,100); ok = setRanges(rngs, n); } return ok; }
TEST_F(getFunctionStatementsTest, should_store_source_code_between_statements) { parse("void f() {\n f();/* text */f(); /* whitespace */ f( );// not stored\n }"); setRanges({ { stmtNo(0), {12, 16} }, { stmtNo(1), {26, 30} }, { stmtNo(2), {50, 55} } }); auto stmts = getFunctionStatements(); EXPECT_EQ("/* text */", stmts[0]->getSourceCodeAfter()); EXPECT_EQ(" /* whitespace */ ", stmts[1]->getSourceCodeAfter()); EXPECT_EQ("", stmts[2]->getSourceCodeAfter()); }
//------------------------------------------------------------------------------ // setSlotRanges() -- Our list of valid ranges (nm) //------------------------------------------------------------------------------ bool RfSensor::setSlotRanges(base::List* const list) { bool ok = false; if (list != nullptr) { double rngs[100]; int n = list->getNumberList(rngs,100); ok = setRanges(rngs, n); } return ok; }
meegogyroscope::meegogyroscope(QSensor *sensor) : meegosensorbase(sensor) { initSensor<GyroscopeSensorChannelInterface>(m_initDone); setDescription(QLatin1String("angular velocities around x, y, and z axis in degrees per second")); setRanges(MILLI); setReading<QGyroscopeReading>(&m_reading); addDataRate(10, 10); addDataRate(50, 50); }
SensorfwMagnetometer::SensorfwMagnetometer(QSensor *sensor) : SensorfwSensorBase(sensor) , m_initDone(false) { init(); setDescription(QLatin1String("magnetic flux density in teslas (T)")); setRanges(NANO); setReading<QMagnetometerReading>(&m_reading); sensor->setDataRate(50);//set a default rate }
void ArmSideView::configDraw(std::string name, int w, int h) { // create an image of the specified size // able to represent the arm in 3 directions (up, down and right) // with isotropic scaling (same scale in all directions) setIsotropic(true); initPlot(w, h, name); // only positive x ranges setRanges(0, maxLen, -maxLen, maxLen); }
TEST_F(getFunctionStatementsTest, should_return_the_ranges_of_each_statements) { parse("void f() {\n int x = 1; if (x == 1)\n; }"); ast::SourceOffsetRange range0{1, 2}, range1{3, 4}; setRanges({{ stmtNo(0), range0 }, { stmtNo(1), range1 }}); auto stmts = getFunctionStatements(); ASSERT_EQ(2u, stmts.size()); ASSERT_EQ(range0, stmts[0]->getRange()); ASSERT_EQ(range1, stmts[1]->getRange()); }
void KbPlot::mouseMoveEvent(int x, int y){ static int px = x; static int py = y; if(mouseNewMovement) {px = x; py = y;} //Avoid long jumps when release point mouseNewMovement = false;// is far from new press point double dx = (xmax-xmin)*(double)(px - x)/(double)container->width(); double dy = (ymax-ymin)*(double)(y - py)/(double)container->height(); setRanges(xmin + dx, xmax + dx, ymin + dy, ymax + dy); px = x; py = y; }
AxisBase::AxisBase(Qt::Orientation orient, PlotterBase *parent) : QObject(parent), m_orient(orient) { setTicks(0, 10); setRanges(0, 100); setOffset(30); setType(AxisData); setMinorGridPen(Qt::NoPen); setMajorGridPen(Qt::NoPen); setModel(0); }
CcgView::CcgView(QWidget *parent) : QMainWindow(parent), ui(new Ui::CcgView) { ui->setupUi(this); // check that the command line program is installed if (!fileExists(QString(CCG_BINARY))) { QMessageBox::information(this, "ccg binary not found", "The ccg command line program " \ "must be installed in order for " \ "this GUI to work"); close(); return; } setRanges(); setDefaults(); setupData(); // When the calculate button is pressed connect(ui->pushButtonCalculate, SIGNAL(clicked()), this, SLOT(calculate())); // When data sources is selected open the data dialog connect(ui->actionDataSources,SIGNAL(triggered()), this,SLOT(openDataSources())); // Save the current image connect(ui->actionSaveImage,SIGNAL(triggered()), this,SLOT(saveImageAs())); // Exit the application connect(ui->actionExit,SIGNAL(triggered()), this,SLOT(close())); // open the about dialog connect(ui->actionAbout,SIGNAL(triggered()), this,SLOT(openAbout())); // Event for detecting mouse click on image ui->graphicsView->installEventFilter(this); statusLabel.setText("Ready"); statusLabel.setIndent(3); ui->statusBar->addWidget(&statusLabel); ui->spinBoxStartYear->setValue(globals.startYear); ui->spinBoxEndYear->setValue(globals.endYear); ui->comboBoxPlotType->setCurrentIndex(globals.plotTypeIndex); ui->comboBoxRegion->setCurrentIndex(globals.regionIndex); showingImage=false; }
void IdacDriverES::initDataFirmware() { // Connect to the IDAC DLL long lVersion = IdacLibVersion(); if (lVersion != IDAC_LIB_VERSION) { addError(tr("Incorrect DLL version!")); return; } LPCSTR pResult = IdacLock("IdacTest"); if (pResult) { addError(tr("DLL in use by: %0").arg(pResult)); return; } m_bFirmwareSent = boot(); if (!m_bFirmwareSent) { IdacUnlock(); return; } // Get range information from the hardware LPDWORD pRanges = IdacGetRanges(); QList<int> ranges; for (LPDWORD pnRange = pRanges; int(*pnRange) != -1; pnRange++) { ranges << *pnRange; } setRanges(ranges); qDebug() << ranges; // Get low-pass filter information from the hardware int nStrings; const char** asStrings; IdacLowPassStrings(&nStrings, &asStrings); QStringList list; for (int i = 0; i < nStrings; i++) list << asStrings[i]; setHighcutStrings(list); // Get high-pass filter information from the hardware IdacHighPassStrings(&nStrings, &asStrings); list.clear(); for (int i = 0; i < nStrings; i++) list << asStrings[i]; setLowcutStrings(list); }
void KbPlot::setBackground(const unsigned int color){ this->stBkgnd.fillColor = color; setRanges(xmin,xmax,ymin,ymax); }
int main(int argc, char** argv) { // Create a value array of all possible code points. const UChar32 size = kMaxCodepoint + 1; CharacterProperty* values = new CharacterProperty[size]; memset(values, 0, sizeof(CharacterProperty) * size); setRanges(values, cjkIdeographRanges, ARRAY_LENGTH(cjkIdeographRanges), CharacterProperty::isCJKIdeographOrSymbol); setRanges(values, cjkSymbolRanges, ARRAY_LENGTH(cjkSymbolRanges), CharacterProperty::isCJKIdeographOrSymbol); setValues(values, cjkIsolatedSymbolsArray, ARRAY_LENGTH(cjkIsolatedSymbolsArray), CharacterProperty::isCJKIdeographOrSymbol); setRanges(values, isUprightInMixedVerticalRanges, ARRAY_LENGTH(isUprightInMixedVerticalRanges), CharacterProperty::isUprightInMixedVertical); setValues(values, isUprightInMixedVerticalArray, ARRAY_LENGTH(isUprightInMixedVerticalArray), CharacterProperty::isUprightInMixedVertical); // Create a trie from the value array. UErrorCode error = U_ZERO_ERROR; UTrie2* trie = utrie2_open(0, 0, &error); assert(error == U_ZERO_ERROR); UChar32 start = 0; CharacterProperty value = values[0]; for (UChar32 c = 1;; c++) { if (c < size && values[c] == value) continue; if (static_cast<uint32_t>(value)) { utrie2_setRange32(trie, start, c - 1, static_cast<uint32_t>(value), TRUE, &error); assert(error == U_ZERO_ERROR); } if (c >= size) break; start = c; value = values[start]; } // Freeze and serialize the trie to a byte array. utrie2_freeze(trie, UTrie2ValueBits::UTRIE2_16_VALUE_BITS, &error); assert(error == U_ZERO_ERROR); int32_t serializedSize = utrie2_serialize(trie, nullptr, 0, &error); error = U_ZERO_ERROR; uint8_t* serialized = new uint8_t[serializedSize]; serializedSize = utrie2_serialize(trie, serialized, serializedSize, &error); assert(error == U_ZERO_ERROR); // Write the serialized array to the source file. if (argc <= 1) { generate(stdout, serializedSize, serialized); } else { FILE* fp = fopen(argv[1], "wb"); generate(fp, serializedSize, serialized); fclose(fp); } utrie2_close(trie); return 0; }
void KbPlot::setGridColor(const unsigned int color){ this->stGridX.lineColor = color; this->stGridY.lineColor = color; setRanges(xmin,xmax,ymin,ymax); }
void KbPlot::toggleGrid(bool b){ this->isGridEnabled = b; setRanges(xmin,xmax,ymin,ymax);//<=> refresh, TODO:fix it, GLupdate() is the way }
bool SensorfwSensorBase::initSensorInterface(QString const &name) { if (!m_sensorInterface) { sensorError(KErrNotFound); return false; } //metadata const QList<DataRange> intervals = m_sensorInterface->getAvailableIntervals(); for (int i = 0, l = intervals.size(); i < l; i++) { qreal intervalMax = intervals.at(i).max; qreal intervalMin = intervals.at(i).min; if (intervalMin == 0 && intervalMax == 0) { // 0 interval has different meanings in e.g. magge/acce // magge -> best-effort // acce -> lowest possible // in Qt API setting 0 means default continue; } qreal rateMin = intervalMax < 1 ? 1 : 1 / intervalMax * 1000; rateMin = rateMin < 1 ? 1 : rateMin; intervalMin = intervalMin < 1 ? 10: intervalMin; // do not divide with 0 qreal rateMax = 1 / intervalMin * 1000; addDataRate(rateMin, rateMax); } //bufferSizes if (m_bufferingSensors.contains(sensor()->identifier())) { IntegerRangeList sizes = m_sensorInterface->getAvailableBufferSizes(); for (int i = 0; i < sizes.size(); i++) { int second = sizes.at(i).second; m_maxBufferSize = second > m_bufferSize ? second : m_maxBufferSize; } m_maxBufferSize = m_maxBufferSize < 0 ? 1 : m_maxBufferSize; //SensorFW guarantees to provide the most efficient size first //TODO: remove from comments //m_efficientBufferSize = m_sensorInterface->hwBuffering()? (l>0?sizes.at(0).first:1) : 1; } else { m_maxBufferSize = 1; } sensor()->setMaxBufferSize(m_maxBufferSize); sensor()->setEfficientBufferSize(m_efficientBufferSize); // TODO deztructor: Leaking abstraction detected. Just copied code // from initSensor<>() here, need to QByteArray type = sensor()->type(); if ((type == QAmbientLightSensor::type) // SensorFW returns lux values, plugin enumerated values || (type == QIRProximitySensor::type) // SensorFW returns raw reflectance values, plugin % of max reflectance || (name == "accelerometersensor") // SensorFW returns milliGs, plugin m/s^2 || (name == "magnetometersensor") // SensorFW returns nanoTeslas, plugin Teslas || (name == "gyroscopesensor")) // SensorFW returns DSPs, plugin milliDSPs return true; setDescription(m_sensorInterface->description()); if (name == "tapsensor") return true; setRanges(); return true; }