// create a Cartesian image suitable for texture mapping from the raw // bearing/range measurements; also return a mask of valid image regions shared_ptr<DidsonCartesian> Didson::getCartesian(int width, int widthTmp) const { // generate map for Cartesian image vector<int> map; int height; pair<vector<int>, int> tmp1 = createMapping(width, maxRange(), minRange(), consts.bearingFov * 0.5, numBearings(), numRanges()); map = tmp1.first; height = tmp1.second; // avoid having to write out the inverse mapping function by creating // a map with sufficiently high resolution as a lookup table for the inverse map // not ideal, but works... vector<int> invMap(consts.numRanges * consts.numBearings); vector<int> mapTmp; int heightTmp; pair<vector<int>, int> tmp2 = createMapping(widthTmp, maxRange(), minRange(), consts.bearingFov * 0.5, numBearings(), consts.numRanges); mapTmp = tmp2.first; heightTmp = tmp2.second; int c = 0; for (int y = 0; y < heightTmp; y++) { for (int x = 0; x < widthTmp; x++) { int idx = mapTmp[c]; if (idx != -1) { int icol = x * ((double) width / (double) widthTmp); int irow = y * ((double) height / (double) heightTmp); int i = irow * width + icol; invMap[idx] = i; } c++; } } shared_ptr<DidsonCartesian> cartesian(new DidsonCartesian(map, invMap)); cartesian->image = cv::Mat(height, width, CV_8UC1); cartesian->mask = cv::Mat(height, width, CV_8UC1); for (int i = 0; i < width * height; i++) { if (map[i] == -1) { cartesian->image.data[i] = 0; cartesian->mask.data[i] = 0; } else { cartesian->image.data[i] = _image.data[map[i]]; cartesian->mask.data[i] = 255; } } return cartesian; }
void ValidParentStylesProxyModel::setCurrentChildStyleId(int styleId) { m_currentChildStyleId = styleId; emit layoutAboutToBeChanged(); createMapping(); emit layoutChanged(); }
void SlaveMapper::executeMapping(int processID, int numberOfProcesses, std::string mappingConfigurationFileURI) { int operationType; MappingConfigurationFileManager *mcfm = MappingConfigurationFileManager::getInstance(); mcfm->loadConfigurationFile(mappingConfigurationFileURI); while (true) { MPI_Bcast(&operationType, 1, MPI_INT, GlobalConstants::MASTER, MPI_COMM_WORLD); if (operationType == TERMINATE_MAPPING) { return; } if (operationType == CHECK_MAPPING_EXISTENCE) { checkMappingExistence(processID); } if (operationType == CREATE_MAPPING) { createMapping(processID, numberOfProcesses); } if (operationType == LOAD_MAPPING && hasToLoad) { loadMapping(processID); } } }
/* QImage StylesFilteredModelBase::stylePreview(QModelIndex &index, const QSize &size) { if (!index.isValid()) { return QImage(); } return m_sourceModel->stylePreview(index, size); //TODO be carefull there. this is assuming the sourceModel is only using the internalId, and the index's internalId matches the model's } */ void StylesFilteredModelBase::setStylesModel(AbstractStylesModel *sourceModel) { if (m_sourceModel == sourceModel) { return; } if (m_sourceModel) { disconnect(m_sourceModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int))); disconnect(m_sourceModel, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); disconnect(m_sourceModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int))); disconnect(m_sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex,int,int))); disconnect(m_sourceModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(rowsMoved(QModelIndex,int,int,QModelIndex,int))); disconnect(m_sourceModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); disconnect(m_sourceModel, SIGNAL(modelAboutToBeReset()), this, SLOT(modelAboutToBeReset())); disconnect(m_sourceModel, SIGNAL(modelReset()), this, SLOT(modelReset())); } m_sourceModel = sourceModel; connect(m_sourceModel, SIGNAL(rowsAboutToBeInserted(QModelIndex,int,int)), this, SLOT(rowsAboutToBeInserted(QModelIndex,int,int))); connect(m_sourceModel, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int))); connect(m_sourceModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int))); connect(m_sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(rowsInserted(QModelIndex,int,int))); connect(m_sourceModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)), this, SLOT(rowsMoved(QModelIndex,int,int,QModelIndex,int))); connect(m_sourceModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); connect(m_sourceModel, SIGNAL(modelAboutToBeReset()), this, SLOT(modelAboutToBeReset())); connect(m_sourceModel, SIGNAL(modelReset()), this, SLOT(modelReset())); beginResetModel(); createMapping(); endResetModel(); }
void HuffmanCode::createTree(const vector<Probability>& values) { // priority_queue<Node*> nodes(&Node::compareNode); // priority_queue<Node*> nodes(Node::compareNode, vector<Node*>); priority_queue<Node*, vector<Node*>, NodeCompare> nodes; for (int i = 0; i < values.size(); i++) { Node* node = new Node(); node->probability = values[i]; nodes.push(node); } while (nodes.size() > 1) { Node* firstChild = nodes.top(); nodes.pop(); Node* secondChild = nodes.top(); nodes.pop(); Node* parent = new Node(); parent->right = firstChild; parent->left = secondChild; parent->probability = firstChild->probability + secondChild->probability; nodes.push(parent); } //root node root = nodes.top(); createMapping(); }
void StylesFilteredModelBase::rowsRemoved(const QModelIndex &parent, int start, int end) { Q_UNUSED(parent); Q_UNUSED(start); Q_UNUSED(end); createMapping(); endResetModel(); }
void StylesFilteredModelBase::rowsMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow) { Q_UNUSED(sourceParent); Q_UNUSED(sourceStart); Q_UNUSED(sourceEnd); Q_UNUSED(destinationParent); Q_UNUSED(destinationRow); createMapping(); endResetModel(); }
void DockerStylesComboModel::setStyleManager(KoStyleManager *sm) { Q_ASSERT(sm); Q_ASSERT(m_sourceModel); if (!sm || !m_sourceModel || m_styleManager == sm) { return; } m_styleManager = sm; createMapping(); }
void DockerStylesComboModel::styleApplied(const KoCharacterStyle *style) { QModelIndex sourceIndex = m_sourceModel->indexOf(*style); if (!sourceIndex.isValid()) { return; // Probably default style. } if (m_usedStylesId.contains(style->styleId())) { return; // Style already among used styles. } beginResetModel(); createMapping(); endResetModel(); }
void g_lapic::prepare(g_physical_address lapicAddress) { physicalBase = lapicAddress; prepared = true; // Warn if APIC not at expected location if (physicalBase != G_EXPECTED_APIC_PHYSICAL_ADDRESS) { g_log_warn("%! is at %h, not %h as expected", "lapic", physicalBase, G_EXPECTED_APIC_PHYSICAL_ADDRESS); } g_log_debug("%! base is %h", "lapic", physicalBase); // Map it to virtual space createMapping(); }
Mapping* FGeoSession::mapping(const SiPrefix* o) { (void) o; String mn = "SiPrefix"; if (hasMapping(mn)) { return mappingByName(mn); } Table* t = connection()->database()->table("core.si_prefixes"); Mapping* m = createMapping(mn, t); m->createProperty("id", t->column("id")); m->createProperty("name", t->column("name")); m->createProperty("code", t->column("code")); m->createProperty("symbol", t->column("symbol")); m->createProperty("description", t->column("description")); m->createProperty("factor", t->column("factor")); return mapping(o); }
void GroupProxyModel::setSourceModel(QAbstractItemModel *sourceModel) { QAbstractProxyModel::setSourceModel(sourceModel); createMapping(); }
void StylesFilteredModelBase::modelReset() { createMapping(); endResetModel(); }
void CDPlayer::configureChannels() { if (m_channelMappingWindow) { m_channelMappingWindow = std::make_unique<ChannelMappingWindow>(m_outputChannelNames, m_soloBusSettings, createMapping(), [&](int source, int target) { m_remappingAudioSource.setOutputChannelMapping(source, target); }, [&]() { // clear is not working delete m_channelMappingWindow.release(); }); } m_channelMappingWindow->addToDesktop(); m_channelMappingWindow->toFront(true); }