void Map::createEmptyTiles() { // Create tiles and set coordinates. for (unsigned int j = 0; j < rows(); j++) { for (unsigned int i = 0; i < cols(); i++) { if (!getTile(i, j)) { TrackTileBase * newTile = new TrackTile( static_cast<TrackData &>(trackData()), QPointF(TrackTile::TILE_W / 2 + i * TrackTile::TILE_W, TrackTile::TILE_H / 2 + j * TrackTile::TILE_H), QPoint(i, j)); setTile(i, j, TrackTilePtr(newTile)); } else { getTile(i, j)->setLocation( QPointF( TrackTile::TILE_W / 2 + i * TrackTile::TILE_W, TrackTile::TILE_H / 2 + j * TrackTile::TILE_H)); getTile(i, j)->setMatrixLocation(QPoint(i, j)); } } } }
QVariant TrackViewModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); Track *track = trackByIndex(index); if (track) return trackData(track, index, role); Disk *disk = diskByIndex(index); if(disk) return diskData(disk, index, role); return QVariant(); }
bool Foam::faceOnlySet::trackToBoundary ( passiveParticle& singleParticle, DynamicList<point>& samplingPts, DynamicList<label>& samplingCells, DynamicList<label>& samplingFaces, DynamicList<scalar>& samplingCurveDist ) const { // distance vector between sampling points const vector offset = end_ - start_; const vector smallVec = tol*offset; const scalar smallDist = mag(smallVec); passiveParticleCloud particleCloud(mesh()); particle::TrackingData<passiveParticleCloud> trackData(particleCloud); // Alias const point& trackPt = singleParticle.position(); while(true) { point oldPoint = trackPt; singleParticle.trackToFace(end_, trackData); if (singleParticle.face() != -1 && mag(oldPoint - trackPt) > smallDist) { // Reached face. Sample. samplingPts.append(trackPt); samplingCells.append(singleParticle.cell()); samplingFaces.append(singleParticle.face()); samplingCurveDist.append(mag(trackPt - start_)); } if (mag(trackPt - end_) < smallDist) { // end reached return false; } else if (singleParticle.onBoundary()) { // Boundary reached. return true; } } }
bool Foam::faceOnlySet::trackToBoundary ( passiveParticleCloud& particleCloud, passiveParticle& singleParticle, const scalar smallDist, DynamicList<point>& samplingPts, DynamicList<label>& samplingCells, DynamicList<label>& samplingFaces, DynamicList<scalar>& samplingCurveDist ) const { particle::TrackingData<passiveParticleCloud> trackData(particleCloud); const point& trackPt = singleParticle.position(); while(true) { point oldPoint = trackPt; singleParticle.trackToFace(end_, trackData); if (singleParticle.face() != -1 && mag(oldPoint - trackPt) > smallDist) { // Reached face. Sample. samplingPts.append(trackPt); samplingCells.append(singleParticle.cell()); samplingFaces.append(singleParticle.face()); samplingCurveDist.append(mag(trackPt - start_)); } if (mag(trackPt - end_) < smallDist) { // End reached return false; } else if (singleParticle.onBoundary()) { // Boundary reached return true; } } }
void EditorData::pushTargetNodeToRoute(TargetNodePtr tnode) { Route & route = trackData()->route(); if (route.numNodes()) { TargetNodePtr prev = route.get(route.numNodes() - 1); prev->setNext(tnode); tnode->setPrev(prev); dynamic_cast<TargetNode *>(prev.get())->updateRouteLine(); } const bool loopClosed = route.push(tnode); QGraphicsLineItem * routeLine = new QGraphicsLineItem; TargetNode * ptr = dynamic_cast<TargetNode *>(tnode.get()); ptr->setRouteLine(routeLine); m_mainWindow->editorScene().addItem(ptr); m_mainWindow->editorScene().addItem(routeLine); const int routeLineZ = 10; ptr->setZValue(routeLineZ); routeLine->setZValue(routeLineZ); // Check if we might have a loop => end if (loopClosed) { setMode(EditorData::EM_NONE); m_mainWindow->endSetRoute(); TargetNodePtr firstNode = route.get(0); route.get(route.numNodes() - 1)->setLocation(firstNode->location()); tnode->setNext(firstNode); firstNode->setPrev(tnode); } }
bool Foam::polyLineSet::trackToBoundary ( passiveParticleCloud& particleCloud, passiveParticle& singleParticle, label& sampleI, DynamicList<point>& samplingPts, DynamicList<label>& samplingCells, DynamicList<label>& samplingFaces, DynamicList<scalar>& samplingCurveDist ) const { particle::TrackingData<passiveParticleCloud> trackData(particleCloud); while (true) { // Local geometry info const vector offset = sampleCoords_[sampleI+1] - sampleCoords_[sampleI]; const scalar smallDist = mag(tol*offset); singleParticle.track(offset, 0); const point trackPt = singleParticle.position(); if (singleParticle.onBoundaryFace()) { //Info<< "trackToBoundary : reached boundary" // << " trackPt:" << trackPt << endl; if ( mag(trackPt - sampleCoords_[sampleI+1]) < smallDist ) { // Reached samplePt on boundary //Info<< "trackToBoundary : boundary. also sampling." // << " trackPt:" << trackPt << " sampleI+1:" << sampleI+1 // << endl; samplingPts.append(trackPt); samplingCells.append(singleParticle.cell()); samplingFaces.append(singleParticle.face()); // trackPt is at sampleI+1 samplingCurveDist.append(1.0*(sampleI+1)); } return true; } // Reached samplePt in cell samplingPts.append(trackPt); samplingCells.append(singleParticle.cell()); samplingFaces.append(-1); // Convert trackPt to fraction inbetween sampleI and sampleI+1 scalar dist = mag(trackPt - sampleCoords_[sampleI]) / mag(sampleCoords_[sampleI+1] - sampleCoords_[sampleI]); samplingCurveDist.append(sampleI + dist); // go to next samplePt sampleI++; if (sampleI == sampleCoords_.size() - 1) { // no more samples. //Info<< "trackToBoundary : Reached end : sampleI now:" << sampleI // << endl; return false; } } }
bool Foam::uniformSet::trackToBoundary ( passiveParticleCloud& particleCloud, passiveParticle& singleParticle, point& samplePt, label& sampleI, DynamicList<point>& samplingPts, DynamicList<label>& samplingCells, DynamicList<label>& samplingFaces, DynamicList<scalar>& samplingCurveDist ) const { // distance vector between sampling points const vector offset = (end_ - start_)/(nPoints_ - 1); const vector smallVec = tol*offset; const scalar smallDist = mag(smallVec); // Alias const point& trackPt = singleParticle.position(); particle::TrackingData<passiveParticleCloud> trackData(particleCloud); while(true) { // Find next samplePt on/after trackPt. Update samplePt, sampleI if (!nextSample(trackPt, offset, smallDist, samplePt, sampleI)) { // no more samples. if (debug) { Pout<< "trackToBoundary : Reached end : samplePt now:" << samplePt << " sampleI now:" << sampleI << endl; } return false; } if (mag(samplePt - trackPt) < smallDist) { // trackPt corresponds with samplePt. Store and use next samplePt if (debug) { Pout<< "trackToBoundary : samplePt corresponds to trackPt : " << " trackPt:" << trackPt << " samplePt:" << samplePt << endl; } samplingPts.append(trackPt); samplingCells.append(singleParticle.cell()); samplingFaces.append(-1); samplingCurveDist.append(mag(trackPt - start_)); // go to next samplePt if (!nextSample(trackPt, offset, smallDist, samplePt, sampleI)) { // no more samples. if (debug) { Pout<< "trackToBoundary : Reached end : " << " samplePt now:" << samplePt << " sampleI now:" << sampleI << endl; } return false; } } if (debug) { Pout<< "Searching along trajectory from " << " trackPt:" << trackPt << " trackCelli:" << singleParticle.cell() << " to:" << samplePt << endl; } point oldPos = trackPt; label facei = -1; do { singleParticle.stepFraction() = 0; singleParticle.track(samplePt, trackData); if (debug) { Pout<< "Result of tracking " << " trackPt:" << trackPt << " trackCelli:" << singleParticle.cell() << " trackFacei:" << singleParticle.face() << " onBoundary:" << singleParticle.onBoundary() << " samplePt:" << samplePt << " smallDist:" << smallDist << endl; } } while ( !singleParticle.onBoundary() && (mag(trackPt - oldPos) < smallDist) ); if (singleParticle.onBoundary()) { //Pout<< "trackToBoundary : reached boundary" << endl; if (mag(trackPt - samplePt) < smallDist) { //Pout<< "trackToBoundary : boundary is also sampling point" // << endl; // Reached samplePt on boundary samplingPts.append(trackPt); samplingCells.append(singleParticle.cell()); samplingFaces.append(facei); samplingCurveDist.append(mag(trackPt - start_)); } return true; } //Pout<< "trackToBoundary : reached internal sampling point" << endl; // Reached samplePt in cell or on internal face samplingPts.append(trackPt); samplingCells.append(singleParticle.cell()); samplingFaces.append(-1); samplingCurveDist.append(mag(trackPt - start_)); // go to next samplePt } }
MainWidget::MainWidget(QWidget *parent) :Q3MainWindow(parent) { new RDApplication(RDApplication::Gui,"rdlogedit",RDLOGEDIT_USAGE); QString str1; QString str2; log_log_list=NULL; QString sql; RDSqlQuery *q; // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); // // Ensure that the system daemons are running // #ifndef WIN32 RDInitializeDaemons(); #endif // WIN32 // // Load Local Configs // str1=QString("RDLogEdit")+"v"+VERSION+" - "+tr("Host"); str2=tr("User")+": ["+tr("Unknown")+"]"; setCaption(QString().sprintf("%s: %s, %s",(const char *)str1, (const char *)rda->config()->stationName(), (const char *)str2)); log_import_path=RDGetHomeDir(); #ifndef WIN32 rda->cae()->connectHost(); #endif // WIN32 // // RIPC Connection // #ifndef WIN32 connect(rda->ripc(),SIGNAL(connected(bool)),this,SLOT(connectedData(bool))); connect(rda->ripc(),SIGNAL(userChanged()),this,SLOT(userData())); rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password()); #endif // WIN32 // // Create Fonts // QFont default_font("Helvetica",12,QFont::Normal); default_font.setPixelSize(12); qApp->setFont(default_font); QFont button_font=QFont("Helvetica",12,QFont::Bold); button_font.setPixelSize(12); // // Create Icons // log_rivendell_map=new QPixmap(rivendell_xpm); setIcon(*log_rivendell_map); log_greencheckmark_map=new QPixmap(greencheckmark_xpm); log_redx_map=new QPixmap(redx_xpm); log_whiteball_map=new QPixmap(whiteball_xpm); log_greenball_map=new QPixmap(greenball_xpm); log_redball_map=new QPixmap(redball_xpm); // // User // #ifndef WIN32 // // Load Audio Assignments // RDSetMixerPorts(rda->config()->stationName(),rda->cae()); #else rda->setUser(RD_USER_LOGIN_NAME); #endif // WIN32 // // Service Selector // log_service_box=new QComboBox(this); log_service_box->setFont(default_font); connect(log_service_box,SIGNAL(activated(const QString &)), this,SLOT(filterChangedData(const QString &))); log_service_box->insertItem(tr("ALL")); sql="select NAME from SERVICES order by NAME"; q=new RDSqlQuery(sql); while(q->next()) { log_service_box->insertItem(q->value(0).toString()); } delete q; log_service_label=new QLabel(log_service_box,tr("Service")+":",this); log_service_label->setFont(button_font); log_service_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); // // Filter // log_filter_edit=new QLineEdit(this); log_filter_edit->setFont(default_font); connect(log_filter_edit,SIGNAL(textChanged(const QString &)), this,SLOT(filterChangedData(const QString &))); log_filter_label=new QLabel(log_filter_edit,tr("Filter")+":",this); log_filter_label->setFont(button_font); log_filter_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); log_filter_button=new QPushButton(tr("Clear"),this); log_filter_button->setFont(button_font); connect(log_filter_button,SIGNAL(clicked()),this,SLOT(filterClearedData())); // // Show Recent Checkbox // log_recent_check=new QCheckBox(this); connect(log_recent_check,SIGNAL(toggled(bool)),this,SLOT(recentData(bool))); log_recent_label= new QLabel(log_recent_check,tr("Show Only Recent Logs"),this); log_recent_label->setFont(button_font); // // Log List // log_log_list=new Q3ListView(this); log_log_list->setFont(default_font); log_log_list->setAllColumnsShowFocus(true); log_log_list->setItemMargin(5); connect(log_log_list, SIGNAL(doubleClicked(Q3ListViewItem *,const QPoint &,int)), this, SLOT(logDoubleclickedData(Q3ListViewItem *,const QPoint &,int))); log_log_list->addColumn(""); log_log_list->setColumnAlignment(0,Qt::AlignCenter); log_log_list->addColumn(tr("LOG NAME")); log_log_list->setColumnAlignment(1,Qt::AlignHCenter); log_log_list->addColumn(tr("DESCRIPTION")); log_log_list->setColumnAlignment(2,Qt::AlignLeft); log_log_list->addColumn(tr("SERVICE")); log_log_list->setColumnAlignment(3,Qt::AlignLeft); log_log_list->addColumn(tr("MUSIC")); log_log_list->setColumnAlignment(4,Qt::AlignCenter); log_log_list->addColumn(tr("TRAFFIC")); log_log_list->setColumnAlignment(5,Qt::AlignCenter); log_log_list->addColumn(tr("TRACKS")); log_log_list->setColumnAlignment(6,Qt::AlignHCenter); log_log_list->addColumn(tr("VALID FROM")); log_log_list->setColumnAlignment(7,Qt::AlignHCenter); log_log_list->addColumn(tr("VALID TO")); log_log_list->setColumnAlignment(8,Qt::AlignHCenter); log_log_list->addColumn(tr("AUTO REFRESH")); log_log_list->setColumnAlignment(9,Qt::AlignHCenter); log_log_list->addColumn(tr("ORIGIN")); log_log_list->setColumnAlignment(10,Qt::AlignLeft); log_log_list->addColumn(tr("LAST LINKED")); log_log_list->setColumnAlignment(11,Qt::AlignLeft); log_log_list->addColumn(tr("LAST MODIFIED")); log_log_list->setColumnAlignment(12,Qt::AlignLeft); RefreshList(); // // Add Button // log_add_button=new QPushButton(this); log_add_button->setFont(button_font); log_add_button->setText(tr("&Add")); connect(log_add_button,SIGNAL(clicked()),this,SLOT(addData())); // // Edit Button // log_edit_button=new QPushButton(this); log_edit_button->setFont(button_font); log_edit_button->setText(tr("&Edit")); connect(log_edit_button,SIGNAL(clicked()),this,SLOT(editData())); // // Delete Button // log_delete_button=new QPushButton(this); log_delete_button->setFont(button_font); log_delete_button->setText(tr("&Delete")); connect(log_delete_button,SIGNAL(clicked()),this,SLOT(deleteData())); // // Tracker Button // log_track_button=new QPushButton(this); log_track_button->setFont(button_font); log_track_button->setText(tr("Voice\n&Tracker")); connect(log_track_button,SIGNAL(clicked()),this,SLOT(trackData())); #ifdef WIN32 log_track_button->hide(); #endif // // Log Report Button // log_report_button=new QPushButton(this); log_report_button->setFont(button_font); log_report_button->setText(tr("Log\nReport")); connect(log_report_button,SIGNAL(clicked()),this,SLOT(reportData())); // // Close Button // log_close_button=new QPushButton(this); log_close_button->setFont(button_font); log_close_button->setText(tr("&Close")); connect(log_close_button,SIGNAL(clicked()),this,SLOT(quitMainWidget())); #ifndef WIN32 // // Setup Signal Handling // ::signal(SIGCHLD,SigHandler); #endif // WIN32 }
AddMeta::AddMeta(QWidget *parent,const char *name) : QDialog(parent,name,true,Qt::WStyle_Customize|Qt::WStyle_DialogBorder) { setCaption(""); // // Fix the Window Size // setMinimumWidth(sizeHint().width()); setMaximumWidth(sizeHint().width()); setMinimumHeight(sizeHint().height()); setMaximumHeight(sizeHint().height()); // // Generate Fonts // QFont button_font=QFont("Helvetica",12,QFont::Bold); button_font.setPixelSize(12); QFont label_font=QFont("Helvetica",12,QFont::Bold); label_font.setPixelSize(12); QFont day_font=QFont("Helvetica",12,QFont::Normal); day_font.setPixelSize(12); // // Title Label // QLabel *label=new QLabel(tr("Insert a:"),this,"title_label"); label->setGeometry(0,0,sizeHint().width(),30); label->setFont(label_font); label->setAlignment(AlignCenter); // // Marker Button // QPushButton *button=new QPushButton(this,"marker_button"); button->setGeometry(10,30,sizeHint().width()-20,50); button->setFont(button_font); button->setText(tr("&Marker")); connect(button,SIGNAL(clicked()),this,SLOT(markerData())); // // Voice Track Button // button=new QPushButton(this,"track_button"); button->setGeometry(10,80,sizeHint().width()-20,50); button->setFont(button_font); button->setText(tr("Voice &Track")); connect(button,SIGNAL(clicked()),this,SLOT(trackData())); // // Chain Button // button=new QPushButton(this,"chain_button"); button->setGeometry(10,130,sizeHint().width()-20,50); button->setFont(button_font); button->setText(tr("Log C&hain")); connect(button,SIGNAL(clicked()),this,SLOT(chainData())); // // Cancel Button // button=new QPushButton(this,"cancel_button"); button->setGeometry(10,sizeHint().height()-60,sizeHint().width()-20,50); button->setFont(button_font); button->setText(tr("&Cancel")); button->setDefault(true); connect(button,SIGNAL(clicked()),this,SLOT(cancelData())); }