int main() { // Turn off miniblip buzzer PwmOut speaker(P0_8); speaker=0.0; // Create a temporary DigitalIn so we can configure the pull-down resistor. DigitalIn(DATA_PIN, PullDown); // The pixel array control class. neopixel::PixelArray array(DATA_PIN); neopixel::Pixel vector[25]; void_matrix(vector); while (1) { float pot = ain.read() * 100.0f; if(pot<25) drawVector(sonrisaTriste,vector,0,0,255); else if(pot >=25 && pot <75) drawVector(sonrisaRegular,vector,0,255,0); else drawVector(sonrisa,vector,255,0,0); float pushed = din.read(); if(pushed>0.5) drawVector(bocaAbierta,vector,255,255,0); array.update(vector, 64); wait_ms(75); } }
int main() { // Turn off miniblip buzzer PwmOut speaker(P0_8); speaker=0.0; // Create a temporary DigitalIn so we can configure the pull-down resistor. DigitalIn(DATA_PIN, PullDown); // The pixel array control class. neopixel::PixelArray array(DATA_PIN); neopixel::Pixel vector[25]; void_matrix(vector); while (1) { float pot = ain.read() * 100.0f; if(pot<50){ drawVector(sonrisa,vector,255,0,0); }else{ drawVector(sonrisaTriste,vector,0,0,255); } array.update(vector, 64); wait_ms(500); } }
void sysuVideo::MVDrawer::Draw(ImgBlock *block, CDC *pDC) { static CPen *oldPen; static RECT curCU; static POINT mv; if (!enable) return; if (IMGBLOCKTYPETAG::CMD_FLAG == block->type) { getMVsForNextLCU(); return; } if ((IMGBLOCKTYPETAG::PU_HORZ_SPLIT != block->type && IMGBLOCKTYPETAG::PU_VERT_SPLIT != block->type && IMGBLOCKTYPETAG::ACTOMIC_BLOCK != block->type && IMGBLOCKTYPETAG::PU_QUARTILE_SPLIT != block->type)) return; // Motion vector is for PU only if (pVOffset >= pVSize - 1) { MessageBox(NULL, _T("MV buffer overrun"), _T("Oops"), MB_OK); return; //getMVsForNextLCU(); } oldPen = pDC->SelectObject(&pen); switch (pPUVectors[++pVOffset]) { // No motion vector case case 0: break; // One motion vector cases case 1: case 2: mv.x = pPUVectors[++pVOffset]; mv.y = pPUVectors[++pVOffset]; drawVector(&(block->area), mv, pDC); break; // Two motion vector case case 3: mv.x = pPUVectors[++pVOffset]; mv.y = pPUVectors[++pVOffset]; drawVector(&(block->area), mv, pDC); mv.x = pPUVectors[++pVOffset]; mv.y = pPUVectors[++pVOffset]; drawVector(&(block->area), mv, pDC); break; default: break; } pDC->SelectObject(oldPen); }
int frGeomStrip::drawEdge( IplImage* imEdg ) { // if(edgeA.size() > 5){ drawVector( imEdg, edgeA, CVX_BLACK ); drawVector( imEdg, edgeB, CVX_BLACK ); drawVector( imEdg, centLine, CVX_GREEN ); return 0; } else { return -1; } return -2; }
// render vectors to screen for debugging void SmokeRenderer::debugVectors() { glColor3f(1.0, 1.0, 0.0); drawVector(m_lightVector); glColor3f(0.0, 1.0, 0.0); drawVector(m_viewVector); glColor3f(0.0, 0.0, 1.0); drawVector(-m_viewVector); glColor3f(1.0, 0.0, 0.0); drawVector(m_halfVector); }
// --------------------------------------------------------------------------- void __fastcall TForm2::imgBezierMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { coordPoint p(X, Y); user_points.push_back(p); drawVector(user_points); }
void drawContext::drawVectorArray(PViewOptions *opt, VertexArray *va) { if(!va || va->getNumVerticesPerElement() != 2) return; for(int i = 0; i < va->getNumVertices(); i += 2){ float *s = va->getVertexArray(3 * i); float *v = va->getVertexArray(3 * (i + 1)); double l = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); double lmax = opt->tmpMax; if((l && opt->vectorType) && lmax){ double scale = (opt->arrowSizeMax - opt->arrowSizeMin) / lmax; if(opt->arrowSizeMin && l) scale += opt->arrowSizeMin / l; double dx = scale * v[0]; double dy = scale * v[1]; double dz = scale * v[2]; GLubyte *color = (GLubyte *)va->getColorArray(4 * i); glColor4ub(*(color), *(color+1), *(color+2), *(color+3)); if(fabs(dx) > 1. || fabs(dy) > 1. || fabs(dz) > 1.){ double d = (_right - _left) / _width / _scale[0]; dx *= d; dy *= d; dz *= d; double x = s[0], y = s[1], z = s[2]; drawVector(x,y,z,dx,dy,dz); } } } }
void PlotFunction::drawVector(DoubleVector& energyVec, int minIndex, int maxIndex, const WindowRegion& window, const double& maxResolution){ minIndex = max(0, minIndex); maxIndex = min((int)energyVec.size()-1, maxIndex); int tmpTwenty = 20; double maximumValue = 1.1*getMaximum(energyVec, minIndex, maxIndex, tmpTwenty); drawVector(energyVec, minIndex, maxIndex, window, maxResolution, maximumValue); }
void renderMagneticField(const RenderContext* context) { size_t i, count; pthread_mutex_lock(&_fieldPointsMutex); for (i = 0, count = arrayGetLength(_fieldPoints); i < count; ++i) { VectorFieldPoint* point = (VectorFieldPoint*) arrayGetAt(_fieldPoints, i); drawVector(point->position, point->direction, colorWhite, colorRed); } pthread_mutex_unlock(&_fieldPointsMutex); for (i = 0, count = arrayGetLength(_conductors); i < count; ++i) { Conductor* conductor = (Conductor*) arrayGetAt(_conductors, i); renderParallelepiped(conductor->position, vectorSum(conductor->position, conductor->l), colorBlue); } }
// Draw every vector void FlowField2D::display() { if (!bSetup) { ofLog(OF_LOG_WARNING, "call setup() first"); return; } for (int i = 0; i < cols; i++) { for (int j = 0; j < rows; j++) { drawVector(field[i][j], i * resolution, j * resolution, resolution - 2); } } }
void VectorCurve::draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, int from, int to) const { if (!painter || dataSize() <= 0) return; if (to < 0) to = dataSize() - 1; QwtPlotCurve::draw(painter, xMap, yMap, from, to); painter->save(); painter->setPen(pen); drawVector(painter, xMap, yMap, from, to); painter->restore(); }
// Draw every vector void FlowField::display() { if (!bSetup) { ofLog(OF_LOG_WARNING, "call setup() first"); return; } for (int i = 0; i < cols; ++i) { for (int j = 0; j < rows; ++j) { for( int k = 0; k < depth; ++k) { drawVector(field[i][j][k], i * resolution, j * resolution, k * resolution ,resolution - 2); } } } }
void __fastcall TForm2::btnRandomClick(TObject *Sender) { std::vector<coordPoint> random_points; // fill vector from random int max_x = imgBezier->Width - 40; int max_y = imgBezier->Height - 40; randomize(); int count_point = random(8) + 3; for (int i = 0; i < count_point; i++) { int x = random(random(max_x)) + 20; int y = random(random(max_y)) + 20; coordPoint p(x, y); random_points.push_back(p); }; drawVector(random_points); }
void LegendWidget::drawSymbol(PlotCurve *c, int point, QPainter *p, int x, int y, int l) { if (!c || c->rtti() == QwtPlotItem::Rtti_PlotSpectrogram) return; if (c->type() == Graph::VectXYXY || c->type() == Graph::VectXYAM){ drawVector(c, p, x, y, l); return; } if (c->type() == Graph::Pie){ QwtPieCurve *pie = (QwtPieCurve *)c; const QBrush br = QBrush(pie->color(point), pie->pattern()); QPen pen = pie->pen(); p->save(); p->setPen (QPen(pen.color(), pen.widthF(), Qt::SolidLine)); QRect lr = QRect(x, y - 4, l, 10); p->setBrush(br); QwtPainter::drawRect(p, lr); p->restore(); return; } QwtSymbol symb = c->symbol(); const QBrush br = c->brush(); QPen pen = c->pen(); p->save(); if (c->style()!=0){ p->setPen (pen); if (br.style() != Qt::NoBrush || c->type() == Graph::Box){ QRect lr = QRect(x, y-4, l, 10); p->setBrush(br); QwtPainter::drawRect(p, lr); } else QwtPainter::drawLine(p, x, y, x + l, y); } int symb_size = symb.size().width(); if (symb_size > 15) symb_size = 15; else if (symb_size < 3) symb_size = 3; symb.setSize(symb_size); symb.draw(p, x + l/2, y); p->restore(); }
void QtVectorHistogram::paintEvent ( QPaintEvent * ) { QPainter painter( this ); painter.setRenderHint( QPainter::Antialiasing ); painter.setPen( Qt::transparent ); painter.setBrush( QBrush( QColor( 162, 207, 158, 128 ), Qt::SolidPattern ) ); painter.drawRect( scaledXPosition( 0.0 ), scaledYPosition( 0.0 ), scaledXPosition( valuesOnX ) - scaledXPosition( 0.0 ), scaledYPosition( minValue ) - scaledYPosition( 0.0 ) ); painter.setPen( Qt::black ); painter.setBrush( QBrush( Qt::black, Qt::SolidPattern ) ); std::list< std::vector<int> >::iterator it; std::list< QColor >::iterator itColor; for ( it = listOfDatas.begin(), itColor = listOfColor.begin() ; it != listOfDatas.end(); it++, itColor++ ) { drawVector( &painter, *it, *itColor ); } painter.setPen( Qt::black ); painter.setBrush( QBrush( Qt::black, Qt::SolidPattern ) ); painter.drawText( 0, scaledYPosition( maxValue ), QString::number( maxValue ) ); painter.drawText( 0, scaledYPosition( minValue ), QString::number( minValue ) ); painter.drawText( 0, scaledYPosition( 0.5 * ( maxValue + minValue ) ), QString::number( ( minValue + maxValue ) * 0.5 ) ); painter.drawText( scaledXPosition( 0.0 ) , height() - bottomBorder * 0.5, QString::number( -70.0 ) ); painter.drawText( scaledXPosition( valuesOnX ), height() - bottomBorder * 0.5, QString::number( 5.0 ) ); //painter.drawText( scaledXPosition( -23.0 ) , scaledYPosition( minValue - 0.1 ), QString::number( -23.0 ) ); painter.drawLine( scaledXPosition( 0.0 ), scaledYPosition( minValue ), scaledXPosition( 0.0 ), scaledYPosition( maxValue ) ); painter.drawLine( scaledXPosition( 0.0 ), scaledYPosition( minValue ), scaledXPosition( valuesOnX ), scaledYPosition( minValue ) ); QRect rect; rect.setSize ( QSize ( width(), height() ) ); }
// render vectors to screen for debugging void VHParticlesRender::debugVectors() { glColor3f(1.0, 1.0, 0.0); drawVector(lightVector); glColor3f(0.0, 1.0, 0.0); drawVector(viewVector); glColor3f(0.0, 0.0, 1.0); drawVector(-viewVector); glColor3f(1.0, 0.0, 0.0); drawVector(halfVector); /*glColor3f(1.0, 1.0, 0.0); glBegin(GL_LINES); glVertex3f(0.0, 0.0, 0.0); glVertex3f(lightVector.x,lightVector.y,lightVector.z); glEnd(); glColor3f(0.0, 1.0, 0.0); //drawVector(viewVector); glBegin(GL_LINES); glVertex3f(0.0, 0.0, 0.0); glVertex3f(viewVector.x,viewVector.y,viewVector.z); glEnd(); glColor3f(0.0, 0.0, 1.0); glBegin(GL_LINES); glVertex3f(0.0, 0.0, 0.0); glVertex3f(-viewVector.x,-viewVector.y,-viewVector.z); glEnd(); //drawVector(-viewVector); glColor3f(1.0, 0.0, 0.0); glBegin(GL_LINES); glVertex3f(0.0, 0.0, 0.0); glVertex3f(halfVector.x,halfVector.y,halfVector.z); glEnd(); //drawVector(halfVector); printf("light : %f, %f, %f \n", lightVector.x, lightVector.y, lightVector.z); printf("view : %f, %f, %f \n", viewVector.x, viewVector.y, viewVector.z); printf("half : %f, %f, %f \n", halfVector.x, halfVector.y, halfVector.z); printf("-------------------------\n"); float lx,ly,lz; float vx,vy,vz; float hx, hy, hz; lx = lightVector.x; ly = lightVector.y; lz = lightVector.z; vx = viewVector.x; vy = viewVector.y; vz = viewVector.z; hx = halfVector.x; hy = halfVector.y; hz = halfVector.z; glColor3f(1.0, 1.0, 0.0); glBegin(GL_LINES); glVertex3f(0.0, 0.0, 0.0); glVertex3f(lx,ly,lz); glEnd(); glColor3f(0.0, 1.0, 0.0); glBegin(GL_LINES); glVertex3f(0.0, 0.0, 0.0); glVertex3f(vx,vy,vz); glEnd(); glColor3f(1.0, 0.0, 0.0); glBegin(GL_LINES); glVertex3f(0.0, 0.0, 0.0); glVertex3f(hx,hy,hz); glEnd();*/ }
void __fastcall TForm2::btnDrawUsersPointsClick(TObject *Sender) { drawVector(user_points); }
// --------------------------------------------------------------------------- void __fastcall TForm2::btnClearClick(TObject *Sender) { user_points.clear(); drawVector(user_points); }
void FlowField::drawVectorAt( const ofVec2f &vec, const ofVec2f &pos, const float &strength ) { ofVec2f np = pos; drawVector( np, np + vec.normalized() * strength, 5, 3 ); }
//-------------------------------------------------------------- void ofApp::draw(){ ps->display(); drawVector(wind, *new ofPoint(ofGetWidth()/2,50), 500); }
void LegendMarker::drawSymbols(QPainter *p, const QRect& rect, QwtArray<long> height, int symbolLineLength) const { Graph *g = (Graph *) d_plot->parent(); int w = rect.x() + 10; int l = symbolLineLength + 20; QString text=d_text->text(); QStringList titles=QStringList::split ("\n",text,FALSE); for (int i=0;i<(int)titles.count();i++) { if (titles[i].contains("\\c{")) { int pos=titles[i].find("{",0); int pos2=titles[i].find("}",pos); QString aux=titles[i].mid(pos+1,pos2-pos-1); int cv = aux.toInt() - 1; if (cv < 0) continue; if (g->curveType(cv) == Graph :: VectXYXY || g->curveType(cv) == Graph :: VectXYAM) drawVector(p, w, height[i], l, cv); else { const QwtPlotCurve *curve = g->curve(cv); if (curve) { const QwtSymbol symb=curve->symbol(); const QBrush br=curve->brush(); QPen pen=curve->pen(); p->save(); if (curve->style()!=0) { p->setPen (pen); if (br.style() != Qt::NoBrush || g->curveType(cv) == Graph::Box) { QRect lr=QRect(w,height[i]-4,l,10); p->setBrush(br); p->drawRect (lr); } else p->drawLine (w,height[i],w+l,height[i]); } symb.draw(p,w+l/2,height[i]); p->restore(); } } } else if (titles[i].contains("\\p{")) { int pos=titles[i].find("{",0); int pos2=titles[i].find("}",pos); QString aux=titles[i].mid(pos+1,pos2-pos-1); int id=aux.toInt(); Graph* g=(Graph*)d_plot->parent(); if (g->isPiePlot()) { QwtPieCurve *curve = (QwtPieCurve *)d_plot->curve(1); if (curve) { const QBrush br=QBrush(curve->color(id-1), curve->pattern()); QPen pen=curve->pen(); p->save(); p->setPen (QPen(pen.color(),1,Qt::SolidLine)); QRect lr=QRect(w,height[i]-4,l,10); p->setBrush(br); p->drawRect(lr); p->restore(); } } } } }
void LegendMarker::drawSymbols(QPainter *p, const QRect& rect, QwtArray<long> height, int symbolLineLength) const { Graph *g = (Graph *) d_plot->parent(); int w = rect.x() + 10; int l = symbolLineLength + 20; QString text = d_text->text().trimmed(); QStringList titles = text.split("\n", QString::KeepEmptyParts); for (int i=0;i<(int)titles.count();i++) { if (titles[i].contains("\\c{") || titles[i].contains("\\l(")) { QString aux; if (titles[i].contains("\\c{")) {//QtiPlot symbol specification int pos=titles[i].find("{",0); int pos2=titles[i].find("}",pos); aux=titles[i].mid(pos+1,pos2-pos-1); } else if (titles[i].contains("\\l(")) {//Origin project legend int pos=titles[i].find("(",0); int pos2=titles[i].find(")",pos); aux=titles[i].mid(pos+1,pos2-pos-1); } int cv = aux.toInt() - 1; if (cv < 0) continue; if (g->curveType(cv) == Graph :: VectXYXY || g->curveType(cv) == Graph :: VectXYAM) drawVector(p, w, height[i], l, cv); else { const QwtPlotCurve *curve = g->curve(cv); if (curve && curve->rtti() != QwtPlotItem::Rtti_PlotSpectrogram) { QwtSymbol symb=curve->symbol(); const QBrush br=curve->brush(); QPen pen=curve->pen(); p->save(); if (curve->style()!=0) { p->setPen (pen); if (br.style() != Qt::NoBrush || g->curveType(cv) == Graph::Box) { QRect lr=QRect(w,height[i]-4,l,10); p->setBrush(br); QwtPainter::drawRect(p, lr); } else QwtPainter::drawLine(p, w,height[i],w+l,height[i]); } int symb_size = symb.size().width(); if (symb_size > 15) symb_size = 15; else if (symb_size < 3) symb_size = 3; symb.setSize(symb_size); symb.draw(p,w+l/2,height[i]); p->restore(); } } } else if (titles[i].contains("\\p{")) { int pos=titles[i].find("{",0); int pos2=titles[i].find("}",pos); QString aux=titles[i].mid(pos+1,pos2-pos-1); int id=aux.toInt(); Graph* g=(Graph*)d_plot->parent(); if (g->isPiePlot()) { QwtPieCurve *curve = (QwtPieCurve *)d_plot->curve(1); if (curve) { const QBrush br=QBrush(curve->color(id-1), curve->pattern()); QPen pen=curve->pen(); p->save(); p->setPen (QPen(pen.color(),1,Qt::SolidLine)); QRect lr=QRect(w,height[i]-4,l,10); p->setBrush(br); QwtPainter::drawRect(p, lr); p->restore(); } } } } }
void FlowField::drawVectorAt( const ofVec2f &vec, const ofVec2f &pos ) { ofVec2f np = pos - (vec.normalized()) * 5.0; drawVector( np, np + vec.normalized() * 10.0, 5, 3 ); }
void drawVector(RenderingContext & rc, const Geometry::Vec3f & from, const Geometry::Vec3f & to, const Util::Color4f & color) { rc.pushAndSetColorMaterial(color); drawVector(rc, from, to); rc.popMaterial(); }
void CtrlPoint::draw(bool isShadowed) const { float size=2.0; glPushMatrix(); glTranslatef(_pos.x(), _pos.y(), _pos.z()); float theta1 = -radToDeg(atan2(_orient.z(), _orient.x())); glRotatef(theta1,0,1,0); float theta2 = -radToDeg(acos(_orient.y())); glRotatef(theta2,0,0,1); glBegin(GL_QUADS); glNormal3f( 0,0,1); glVertex3f( size, size, size); glVertex3f(-size, size, size); glVertex3f(-size,-size, size); glVertex3f( size,-size, size); glNormal3f( 0, 0, -1); glVertex3f( size, size, -size); glVertex3f( size,-size, -size); glVertex3f(-size,-size, -size); glVertex3f(-size, size, -size); // no top - it will be the point glNormal3f( 0,-1,0); glVertex3f( size,-size, size); glVertex3f(-size,-size, size); glVertex3f(-size,-size,-size); glVertex3f( size,-size,-size); glNormal3f( 1,0,0); glVertex3f( size, size, size); glVertex3f( size,-size, size); glVertex3f( size,-size,-size); glVertex3f( size, size,-size); glNormal3f(-1,0,0); glVertex3f(-size, size, size); glVertex3f(-size, size,-size); glVertex3f(-size,-size,-size); glVertex3f(-size,-size, size); glEnd(); glBegin(GL_TRIANGLE_FAN); glNormal3f(0,1.0f,0); glVertex3f(0,3.0f*size,0); glNormal3f( 1.0f, 0.0f , 1.0f); glVertex3f( size, size , size); glNormal3f(-1.0f, 0.0f , 1.0f); glVertex3f(-size, size , size); glNormal3f(-1.0f, 0.0f ,-1.0f); glVertex3f(-size, size ,-size); glNormal3f( 1.0f, 0.0f ,-1.0f); glVertex3f( size, size ,-size); glNormal3f( 1.0f, 0.0f , 1.0f); glVertex3f( size, size , size); glEnd(); //error with shadows! if(!isShadowed) { drawVector(Vec3f(0.f, 0.f, 0.f), Vec3f(0.f, 8.f, 0.f), Vec3f(0.f, 1.f, 0.f)); } glPopMatrix(); }
void TIGLViewerWindow::connectSignals() { connect(newAction, SIGNAL(triggered()), this, SLOT(newFile())); connect(openAction, SIGNAL(triggered()), this, SLOT(open())); connect(openScriptAction, SIGNAL(triggered()), this, SLOT(openScript())); connect(closeAction, SIGNAL(triggered()), this, SLOT(closeConfiguration())); for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActions[i] = new QAction(this); recentFileActions[i]->setVisible(false); connect(recentFileActions[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); } connect(saveAction, SIGNAL(triggered()), this, SLOT(save())); connect(saveScreenshotAction, SIGNAL(triggered()), this, SLOT(makeScreenShot())); connect(setBackgroundAction, SIGNAL(triggered()), this, SLOT(setBackgroundImage())); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(about())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(aboutQtAction, SIGNAL(triggered()), this, SLOT(aboutQt())); // Misc drawing actions connect(drawPointAction, SIGNAL(triggered()), this, SLOT(drawPoint())); connect(drawVectorAction, SIGNAL(triggered()), this, SLOT(drawVector())); // view->actions menu connect(fitAction, SIGNAL(triggered()), myOCC, SLOT(fitExtents())); connect(fitAllAction, SIGNAL(triggered()), myOCC, SLOT(fitAll())); //connect(zoomAction, SIGNAL(triggered()), myOCC, SLOT(fitArea())); connect(zoomAction, SIGNAL(triggered()),myOCC, SLOT(zoom())); connect(panAction, SIGNAL(triggered()), myOCC, SLOT(pan())); connect(rotAction, SIGNAL(triggered()), myOCC, SLOT(rotation())); connect(selectAction, SIGNAL(triggered()), myOCC, SLOT(selecting())); // view->grid menu connect(gridOnAction, SIGNAL(toggled(bool)), myScene, SLOT(toggleGrid(bool))); connect(gridXYAction, SIGNAL(triggered()), myScene, SLOT(gridXY())); connect(gridXZAction, SIGNAL(triggered()), myScene, SLOT(gridXZ())); connect(gridYZAction, SIGNAL(triggered()), myScene, SLOT(gridYZ())); connect(gridRectAction, SIGNAL(triggered()), myScene, SLOT(gridRect())); connect(gridCircAction, SIGNAL(triggered()), myScene, SLOT(gridCirc())); // Standard View connect(viewFrontAction, SIGNAL(triggered()), myOCC, SLOT(viewFront())); connect(viewBackAction, SIGNAL(triggered()), myOCC, SLOT(viewBack())); connect(viewTopAction, SIGNAL(triggered()), myOCC, SLOT(viewTop())); connect(viewBottomAction, SIGNAL(triggered()), myOCC, SLOT(viewBottom())); connect(viewLeftAction, SIGNAL(triggered()), myOCC, SLOT(viewLeft())); connect(viewRightAction, SIGNAL(triggered()), myOCC, SLOT(viewRight())); connect(viewAxoAction, SIGNAL(triggered()), myOCC, SLOT(viewAxo())); connect(viewGridAction, SIGNAL(triggered()), myOCC, SLOT(viewGrid())); connect(viewResetAction, SIGNAL(triggered()), myOCC, SLOT(viewReset())); connect(viewZoomInAction, SIGNAL(triggered()), myOCC, SLOT(zoomIn())); connect(viewZoomOutAction, SIGNAL(triggered()), myOCC, SLOT(zoomOut())); connect(showConsoleAction, SIGNAL(toggled(bool)), consoleDockWidget, SLOT(setVisible(bool))); connect(consoleDockWidget, SIGNAL(visibilityChanged(bool)), showConsoleAction, SLOT(setChecked(bool))); connect(showWireframeAction, SIGNAL(toggled(bool)), myScene, SLOT(wireFrame(bool))); connect(openTimer, SIGNAL(timeout()), this, SLOT(reopenFile())); // The co-ordinates from the view connect( myOCC, SIGNAL(mouseMoved(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)), this, SLOT(xyzPosition(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)) ); // Add a point from the view connect( myOCC, SIGNAL(pointClicked(V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)), this, SLOT (addPoint (V3d_Coordinate,V3d_Coordinate,V3d_Coordinate)) ); connect( myOCC, SIGNAL(sendStatus(const QString)), this, SLOT (statusMessage(const QString)) ); connect(stdoutStream, SIGNAL(sendString(QString)), console, SLOT(output(QString))); connect(errorStream , SIGNAL(sendString(QString)), console, SLOT(output(QString))); connect(logDirect.get(), SIGNAL(newMessage(QString)), console, SLOT(output(QString))); connect(scriptEngine, SIGNAL(scriptResult(QString)), console, SLOT(output(QString))); connect(scriptEngine, SIGNAL(scriptError(QString)), console, SLOT(outputError(QString))); connect(scriptEngine, SIGNAL(evalDone()), console, SLOT(endCommand())); connect(console, SIGNAL(onChange(QString)), scriptEngine, SLOT(textChanged(QString))); connect(console, SIGNAL(onCommand(QString)), scriptEngine, SLOT(eval(QString))); connect(settingsAction, SIGNAL(triggered()), this, SLOT(changeSettings())); }
// --------------------------------------------------------------------------- __fastcall TForm2::TForm2(TComponent* Owner) : TForm(Owner) { drawVector(user_points); }
void geocacheMenu(void) { int pressedKey = mySwitch.checkKeypad(); switch (menuState) { case MENU0: tft.fillScreen(ST7735_BLACK); setCursorTFT(0,0); tft.print(menuHeader); setCursorTFT(1,0); tft.setTextColor(ST7735_WHITE,ST7735_BLUE); tft.print(monGPSLocn); setCursorTFT(2,0); tft.setTextColor(ST7735_WHITE,ST7735_BLACK); tft.print(monGPSClk); setCursorTFT(3,0); tft.print(downldWays); setCursorTFT(4,0); tft.print(goToWaypts); setCursorTFT(5,0); tft.print(setActWays); setCursorTFT(6,0); tft.print(showWaypts); menuState = MENU0B; break; case MENU0B: if (pressedKey != NOKEY) { if ((pressedKey == SELECT) || (pressedKey == RIGHT)) { tft.fillScreen(ST7735_BLACK); setCursorTFT(0,0); tft.setTextColor(ST7735_WHITE,ST7735_BLUE); tft.print(monGPSLocn); tft.setTextColor(ST7735_WHITE,ST7735_BLACK); clearLine(1); clearLine(2); clearLine(3); clearLine(4); clearLine(5); clearLine(6); menuState = MENU0C; } else if (pressedKey == DOWN) menuState = MENU1; } break; case MENU0C: if (pressedKey != NOKEY) menuState = MENU0; readGPS(); break; case MENU1: tft.fillScreen(ST7735_BLACK); setCursorTFT(0,0); tft.print(menuHeader); setCursorTFT(1,0); tft.print(monGPSLocn); setCursorTFT(2,0); tft.setTextColor(ST7735_WHITE,ST7735_BLUE); tft.print(monGPSClk); tft.setTextColor(ST7735_WHITE,ST7735_BLACK); setCursorTFT(3,0); tft.print(downldWays); setCursorTFT(4,0); tft.print(goToWaypts); setCursorTFT(5,0); tft.print(setActWays); setCursorTFT(6,0); tft.print(showWaypts); menuState = MENU1B; break; case MENU1B: if (pressedKey != NOKEY) { if ((pressedKey == SELECT) || (pressedKey == RIGHT)) { clearLine(0); tft.setTextColor(ST7735_WHITE,ST7735_BLUE); tft.print(monGPSClk); tft.setTextColor(ST7735_WHITE,ST7735_BLACK); clearLine(1); clearLine(2); clearLine(3); clearLine(4); clearLine(5); clearLine(6); menuState = MENU1C; } else if (pressedKey == UP) menuState = MENU0; else if (pressedKey == DOWN) menuState = MENU2; } break; case MENU1C: if (pressedKey != NOKEY) { tft.fillScreen(ST7735_BLACK); menuState = MENU1; } GPSClock(); break; case MENU2: tft.fillScreen(ST7735_BLACK); setCursorTFT(0,0); tft.print(menuHeader); setCursorTFT(1,0); tft.print(monGPSLocn); setCursorTFT(2,0); tft.print(monGPSClk); setCursorTFT(3,0); tft.setTextColor(ST7735_WHITE,ST7735_BLUE); tft.print(downldWays); tft.setTextColor(ST7735_WHITE,ST7735_BLACK); setCursorTFT(4,0); tft.print(goToWaypts); setCursorTFT(5,0); tft.print(setActWays); setCursorTFT(6,0); tft.print(showWaypts); menuState = MENU2B; break; case MENU2B: { int charIn; if (pressedKey != NOKEY) { if ((pressedKey == SELECT) || (pressedKey == RIGHT)) { rxCount = 0; clearLine(2); clearLine(3); clearLine(4); clearLine(5); clearLine(6); clearLine(1); tft.setTextColor(ST7735_WHITE,ST7735_BLUE); tft.print(downldWays); tft.setTextColor(ST7735_WHITE,ST7735_BLACK); setCursorTFT(2,0); menuState = MENU2C; while (Serial.available()) // flush the serial read port charIn = Serial.read(); Serial.println("<DL>"); // signals host that it's time to load waypoints } else if (pressedKey == UP) menuState = MENU1; else if (pressedKey == DOWN) menuState = MENU3; } } break; case MENU2C: { int charIn; int errorCode; if (Serial.available()) { charIn = Serial.read(); if (charIn == '\n') { tft.print("."); rxBuffer[rxCount] = 0; errorCode = parseRxBuffer(); if (errorCode == -1) { clearLine(2); tft.print("Error: Missing equal"); } else if (errorCode == -2) { clearLine(2); tft.print("Error: Bad waypt num"); } rxCount = 0; Serial.write('A'); if ((rxBuffer[0] == '1') && (rxBuffer[1]=='9')) { clearLine(3); tft.print("Download Completed "); EEPROM_writeAnything(0, myStoreVals); Serial.println("</SERIN>"); // signals host that it's time to load waypoints delay(2000); // 2 second message menuState = MENU2; } } else { rxBuffer[rxCount++] = charIn; } } if (pressedKey == UP) { Serial.println("</DL>"); // signals host that it's time to load waypoints clearLine(2); tft.print("Download Terminated "); delay(2000); // 2 second message menuState = MENU2; } } break; case MENU3: tft.fillScreen(ST7735_BLACK); setCursorTFT(0,0); tft.print(menuHeader); setCursorTFT(1,0); tft.print(monGPSLocn); setCursorTFT(2,0); tft.print(monGPSClk); setCursorTFT(3,0); tft.print(downldWays); setCursorTFT(4,0); tft.setTextColor(ST7735_WHITE,ST7735_BLUE); tft.print(goToWaypts); tft.setTextColor(ST7735_WHITE,ST7735_BLACK); setCursorTFT(5,0); tft.print(setActWays); setCursorTFT(6,0); tft.print(showWaypts); menuState = MENU3B; break; case MENU3B: if (pressedKey != NOKEY) { if ((pressedKey == SELECT) || (pressedKey == RIGHT)) { quietReadGPS(); delay(500); menuState = MENU3C; } else if (pressedKey == UP) menuState = MENU2; else if (pressedKey == DOWN) menuState = MENU4; } break; case MENU3C: tft.fillScreen(ST7735_BLACK); tft.drawCircle(64,110,45,ST7735_WHITE); setCursorTFT(0,0); tft.print(menuHeader); setCursorTFT(1,0); tft.print("Going to Waypoint "); setCursorTFT(1,18); tft.print(currentWayPoint, DEC); setCursorTFT(2,0); tft.print("Bearing ="); setCursorTFT(3,0); tft.print("Distance ="); setCursorTFT(4,0); tft.print("Direction ="); setCursorTFT(5,0); tft.print("Satellites ="); quietReadGPS(); setCursorTFT(2,10); tft.print(" "); setCursorTFT(2,10); bearing = calc_bearing(fLat2,fLon2,myStoreVals.lats[currentWayPoint],myStoreVals.lons[currentWayPoint]); tft.print(bearing); lastLat = fLat2; setCursorTFT(3,11); tft.print(" "); setCursorTFT(3,11); tft.print(calc_dist(fLat2,fLon2,myStoreVals.lats[currentWayPoint],myStoreVals.lons[currentWayPoint])); lastLon = fLon2; setCursorTFT(4,12); tft.print(GPS.angle-bearing); lastAngle = GPS.angle; lastBearing = bearing; setCursorTFT(5,13); tft.print(GPS.satellites); lastSats = GPS.satellites; menuState = MENU3D; break; case MENU3D: { if (pressedKey != NOKEY) { menuState = MENU3; break; } if (quietReadGPS() != 0) { break; } float distCalc = calc_dist(fLat2,fLon2,myStoreVals.lats[currentWayPoint],myStoreVals.lons[currentWayPoint]); bearing = calc_bearing(fLat2,fLon2,myStoreVals.lats[currentWayPoint],myStoreVals.lons[currentWayPoint]); if ((fLat2 != lastLat) || (fLon2 != lastLon)) { setCursorTFT(2,10); tft.print(" "); setCursorTFT(2,10); tft.print(bearing); setCursorTFT(3,11); tft.print(" "); setCursorTFT(3,11); tft.print(distCalc); lastLat = fLat2; lastLon = fLon2; } if ((GPS.angle != lastAngle) || (bearing != lastBearing)) { setCursorTFT(4,12); tft.print(" "); setCursorTFT(4,12); tft.print(GPS.angle-bearing); drawVector(GPS.angle-bearing); lastAngle = GPS.angle; lastBearing = bearing; } if (lastSats != GPS.satellites) { setCursorTFT(5,13); tft.print(GPS.satellites); tft.print(" "); } } break; case MENU4: tft.fillScreen(ST7735_BLACK); setCursorTFT(0,0); tft.print(menuHeader); setCursorTFT(1,0); tft.print(monGPSLocn); setCursorTFT(2,0); tft.print(monGPSClk); setCursorTFT(3,0); tft.print(downldWays); setCursorTFT(4,0); tft.print(goToWaypts); setCursorTFT(5,0); tft.setTextColor(ST7735_WHITE,ST7735_BLUE); tft.print(setActWays); tft.setTextColor(ST7735_WHITE,ST7735_BLACK); setCursorTFT(6,0); tft.print(showWaypts); menuState = MENU4B; break; case MENU4B: if (pressedKey != NOKEY) { if ((pressedKey == SELECT) || (pressedKey == RIGHT)) { tft.fillScreen(ST7735_BLACK); setCursorTFT(0,0); tft.setTextColor(ST7735_WHITE,ST7735_BLUE); tft.print(setActWays); tft.setTextColor(ST7735_WHITE,ST7735_BLACK); setCursorTFT(1,0); tft.print(currentWayPoint, DEC); menuState = MENU4C; } else if (pressedKey == UP) { menuState = MENU3; } else if (pressedKey == DOWN) { menuState = MENU5; } } break; case MENU4C: { if (pressedKey != NOKEY) { switch(pressedKey) { case SELECT: myStoreVals.myCurrentWayPoint = currentWayPoint; EEPROM_writeAnything(0, myStoreVals); menuState = MENU4; break; case UP: if (currentWayPoint < 19) currentWayPoint++; delay(250); break; case DOWN: if (currentWayPoint > 0) currentWayPoint--; delay(250); break; } clearLine(1); tft.print(currentWayPoint, DEC); } } break; case MENU5: tft.fillScreen(ST7735_BLACK); setCursorTFT(0,0); tft.print(menuHeader); setCursorTFT(1,0); tft.print(monGPSLocn); setCursorTFT(2,0); tft.print(monGPSClk); setCursorTFT(3,0); tft.print(downldWays); setCursorTFT(4,0); tft.print(goToWaypts); setCursorTFT(5,0); tft.print(setActWays); setCursorTFT(6,0); tft.setTextColor(ST7735_WHITE,ST7735_BLUE); tft.print(showWaypts); tft.setTextColor(ST7735_WHITE,ST7735_BLACK); menuState = MENU5B; break; case MENU5B: if (pressedKey != NOKEY) { if ((pressedKey == SELECT) || (pressedKey == RIGHT)) { tft.fillScreen(ST7735_BLACK); setCursorTFT(0,0); tft.setTextColor(ST7735_WHITE,ST7735_BLUE); tft.print(showWaypts); tft.setTextColor(ST7735_WHITE,ST7735_BLACK); for (int row = 0; row < 15; row++) { setCursorTFT(row+1,0); tft.print(row); tft.print(","); tft.print(myStoreVals.lats[row],4); tft.print(","); tft.print(myStoreVals.lons[row],4); } menuState = MENU5C; } else if (pressedKey == UP) { menuState = MENU4; } } break; case MENU5C: { if (pressedKey != NOKEY) { switch(pressedKey) { case SELECT: case UP: tft.fillScreen(ST7735_BLACK); menuState = MENU5; break; } } break; } } }
void Thing::draw() { ofFill(); ofSetHexColor(0x999999); ofCircle(loc.x, loc.y, mass*5); drawVector(10); }