/*! * Met à jour la liste des variables dans la fenêtre de gauche * */ void CSensorView::refreshListeVariables(void) { QStringList var_list; m_application->m_data_center->getListeVariablesName(var_list); m_ihm.ui.listWidget->clear(); bool bFilterTor=m_ihm.ui.pb_filtering_tor->isChecked(); bool bFilterAna=m_ihm.ui.pb_filtering_ana->isChecked(); bool bFilterComputed=m_ihm.ui.pb_filtering_computed->isChecked(); bool bFilterActuator=m_ihm.ui.pb_filtering_actuator->isChecked(); bool bFilterNothing= !(bFilterTor || bFilterAna || bFilterComputed || bFilterActuator); for (int i=0; i<var_list.count(); i++) { if (!isAdded(var_list.at(i))) { QVariant property_value=m_application->m_data_center->getDataProperty(var_list.at(i),"Type"); QString mime_property=property_value.toString(); if((mime_property.isEmpty()) && bFilterNothing) m_ihm.ui.listWidget->addElement(QPixmap(":/icons/mime_default.png"), var_list.at(i)); else if((mime_property.compare("sensor_tor")==0) && (bFilterTor || bFilterNothing)) m_ihm.ui.listWidget->addElement(QPixmap(":/icons/mime_sensor_tor.png"), var_list.at(i)); else if((mime_property.compare("computed_signal")==0) && (bFilterComputed || bFilterNothing)) m_ihm.ui.listWidget->addElement(QPixmap(":/icons/mime_computed_signal.png"), var_list.at(i)); else if (bFilterNothing) m_ihm.ui.listWidget->addElement(QPixmap(":/icons/mime_default.png"), var_list.at(i)); } } }
data* getUnion(data* start1, data* start2) { data * intersectionStart = NULL, *current = NULL, *newNode = NULL , * current1=start1, * current2=start2; while(current1!=NULL) { newNode = getNode(); newNode->data = current1->data; if(intersectionStart == NULL) { intersectionStart = newNode; current = newNode; } else { current->next = newNode; current=current->next; } current1 = current1->next; } while(current2!=NULL) { if(!isAdded(intersectionStart,current2->data)) { newNode = getNode(); newNode->data = current2->data; current->next = newNode; current=current->next; } current2=current2->next; } return intersectionStart; }
ZObject3dScan ZDvidInfo::getBlockIndex(const ZObject3dScan &obj) const { ZIntPoint gridSize = m_endBlockIndex - m_startBlockIndex + 1; size_t area = ((size_t) gridSize.getX()) * gridSize.getY(); size_t blockNumber = area * gridSize.getZ(); std::vector<bool> isAdded(blockNumber, false); //std::set<ZIntPoint> blockSet; //ZIntPointArray blockArray; ZObject3dScan blockObj; for (size_t i = 0; i < obj.getStripeNumber(); ++i) { #ifdef _DEBUG_2 if (i % 10000 == 0) { std::cout << i << "/" << obj.getStripeNumber() << std::endl; } #endif const ZObject3dStripe &stripe = obj.getStripe(i); int y = stripe.getY(); int z = stripe.getZ(); if (y > 0 && z > 0 && y < m_startCoordinates[1] + m_stackSize[1] && z < m_startCoordinates[2] + m_stackSize[2]) { for (int j = 0; j < stripe.getSegmentNumber(); ++j) { int x0 = stripe.getSegmentStart(j); int x1 = stripe.getSegmentEnd(j); if (x0 < 0) { x0 = 0; } else if (x0 >= m_startCoordinates[0] + m_stackSize[0]) { x0 = m_startCoordinates[0] + m_stackSize[0] - 1; } if (x1 < 0) { x1 = 0; } else if (x1 >= m_startCoordinates[0] + m_stackSize[0]) { x1 = m_startCoordinates[0] + m_stackSize[0] - 1; } ZIntPoint block1 = getBlockIndex(x0, y, z); size_t blockIndex1 = area * block1.getZ() + gridSize.getY() * block1.getY() + block1.getX(); ZIntPoint block2 = getBlockIndex(x1, y, z); size_t blockIndex2 = area * block2.getZ() + gridSize.getY() * block2.getY() + block2.getX(); if (!isAdded[blockIndex1] || !isAdded[blockIndex2]) { blockObj.addSegment( block1.getZ(), block1.getY(), block1.getX(), block2.getX(), false); isAdded[blockIndex1] = true; isAdded[blockIndex2] = true; } } } } //blockArray.append(blockSet.begin(), blockSet.end()); blockObj.canonize(); return blockObj; }
void MediaFrame::add(const QString &path, AddOption option) { if(isAdded(path)) { qWarning() << "Path" << path << "already added"; return; } QUrl url = QUrl(path); QString localPath = url.toString(QUrl::PreferLocalFile); //qDebug() << "Local path" << localPath << "Path" << path; QStringList paths; QString filePath; if(isDir(localPath)) { if(!isDirEmpty(localPath)) { QDirIterator dirIterator(localPath, m_filters, QDir::Files, (option == AddOption::RECURSIVE ? QDirIterator::Subdirectories | QDirIterator::FollowSymlinks : QDirIterator::NoIteratorFlags)); while (dirIterator.hasNext()) { dirIterator.next(); filePath = dirIterator.filePath(); paths.append(filePath); m_allFiles.append(filePath); //qDebug() << "Appended" << filePath; emit countChanged(); } if(paths.count() > 0) { m_pathMap.insert(path, paths); qDebug() << "Added" << paths.count() << "files from" << path; } else { qWarning() << "No images found in directory" << path; } } else { qWarning() << "Not adding empty directory" << path; } // the pictures have to be sorted before adding them to the list, // because the QDirIterator sorts them in a different way than QDir::entryList //paths.sort(); } else if(isFile(localPath)) { paths.append(path); m_pathMap.insert(path, paths); m_allFiles.append(path); qDebug() << "Added" << paths.count() << "files from" << path; emit countChanged(); } else { if (url.isValid() && !url.isLocalFile()) { qDebug() << "Adding" << url.toString() << "as remote file"; paths.append(path); m_pathMap.insert(path, paths); m_allFiles.append(path); emit countChanged(); } else { qWarning() << "Path" << path << "is not a valid file url or directory"; } } }