本文整理汇总了C++中IOOptions::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ IOOptions::contains方法的具体用法?C++ IOOptions::contains怎么用?C++ IOOptions::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOOptions
的用法示例。
在下文中一共展示了IOOptions::contains方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pos
SelectionDrawer::SelectionDrawer(DrawerInterface *parentDrawer, RootDrawer *rootdrawer, const IOOptions &options) : SimpleDrawer("SelectionDrawer", parentDrawer,rootdrawer, options)
{
_vertexShader = "featurevertexshader_nvdia.glsl";
_fragmentShader = "featurefragmentshader_nvdia.glsl";
QColor clr;
_colors.resize(13);
if ( options.contains("areacolor")){
clr = options["areacolor"].value<QColor>();
}else {
clr = QColor(80,80,0);
clr.setAlphaF(0.15);
}
_colors[9] = _colors[10] = _colors[11] = _colors[12] = clr;
clr.setAlphaF(0.5);
_colors[5] = _colors[6] = _colors[7] = _colors[8] = clr;
if ( options.contains("bordercolor")){
clr = options["bordercolor"].value<QColor>();
}else {
clr = QColor(0,0,0);
clr.setAlphaF(1);
}
_colors[0] = _colors[1] = _colors[2] = _colors[3] = _colors[4] = clr;
QVector3D pos(0,0,0);
_vertices = { pos,pos,pos,pos,pos, pos,pos,pos,pos, pos,pos,pos,pos};
_indices.push_back(VertexIndex(0, 5, itLINE, iUNDEF));
_indices.push_back(VertexIndex(5, 2, itLINE, iUNDEF));
_indices.push_back(VertexIndex(7, 2, itLINE, iUNDEF));
_indices.push_back(VertexIndex(9, 4, itPOLYGON, iUNDEF));
}
示例2: prepare
void OperationCatalogModel::prepare(const IOOptions& opt){
if ( opt.contains("globaloperationscatalog")){
_isGlobalOperationsCatalog = opt["globaloperationscatalog"].toBool();
}
_refresh = true;
gatherItems();
}
示例3: storeMetaData
bool Ilwis3Connector::store(IlwisObject *obj, const IOOptions &options)
{
bool ok = true;
int storemode = options.contains("storemode") ? options["storemode"].toInt() : IlwisObject::smMETADATA | IlwisObject::smBINARYDATA;
if ( storemode & IlwisObject::smMETADATA)
ok &= storeMetaData(obj, options);
if ( ok && storemode & IlwisObject::smBINARYDATA)
ok &= storeBinaryData(obj);
return ok;
}
示例4: prepare
void OperationCatalogModel::prepare(const IOOptions& opt){
if ( opt.contains("globaloperationscatalog")){
_isGlobalOperationsCatalog = opt["globaloperationscatalog"].toBool();
QString filter = "(type=" + QString::number(itSINGLEOPERATION) + " or type=" + QString::number(itWORKFLOW) + ")";
_view.filter("basefilter", filter);
}
_refresh = true;
catalogType(CatalogModel::ctOPERATION|CatalogModel::ctINTERNAL);
catalogViewManager()->registerCatalogModel(this);
gatherItems();
}
示例5: store
bool SpreadSheetTableConnector::store(IlwisObject *object, const IOOptions &options ){
if ( !_spreadsheet){
ERROR2(ERR_NO_INITIALIZED_2,TR("Spreadsheet"), object->name());
return false;
}
QString file = _resource.toLocalFile();
if ( QFileInfo(file).suffix() == "")
if ( options.contains("format"))
file += "." + options["format"].toString();
_spreadsheet->openSheet(file, false);
if (!_spreadsheet->isValid())
return false;
Table * tbl = static_cast<Table *>(object);
bool allDeafultNames = true;
for(int col = 0; col < tbl->columnCount() && allDeafultNames; ++col){
allDeafultNames &= tbl->columndefinition(col).name().indexOf("column_") == 0;
}
if ( !allDeafultNames){
for(int col = 0; col < tbl->columnCount(); ++col){
_spreadsheet->cellValue(col, 0, tbl->columndefinition(col).name(), true );
}
}
int rowStart = allDeafultNames ? 0 : 1;
std::vector<ColumnDefinition *> coldefs(tbl->columnCount(),0);
for(int col = 0; col < tbl->columnCount(); ++col) {
if(hasType(tbl->columndefinition(col).datadef().domain()->ilwisType(), itITEMDOMAIN))
coldefs[col] = &tbl->columndefinitionRef(col);
}
for(int row = 0; row < tbl->recordCount(); ++row){
const Record& rec = tbl->record(row);
for(int col = 0; col < tbl->columnCount(); ++col) {
if ( coldefs[col]){
QVariant v = coldefs[col]->datadef().domain<>()->impliedValue(rec.cell(col));
_spreadsheet->cellValue(col, row + rowStart, v, true);
} else {
_spreadsheet->cellValue(col, row + rowStart, rec.cell(col), true);
}
}
}
QString error = _spreadsheet->storeSheet(_resource.toLocalFile());
if ( !error.isEmpty()){
kernel()->issues()->log(error);
return false;
}
return true;
}
示例6: loadData
bool DownloadManager::loadData(IlwisObject *object, const IOOptions &options){
QUrl url = _resource.url(true);
QUrlQuery query(url);
if ( object->ilwisType() == itRASTER){
RasterCoverage *raster = static_cast<RasterCoverage*>(object);
_blockSizeBytes = raster->grid()->blockSize(0);
if ( options.contains("blockindex")){
_currentBlock = options["blockindex"].toInt();
int layer = _currentBlock / raster->grid()->blocksPerBand();
int relativeBlock = _currentBlock - layer * raster->grid()->blocksPerBand();
unsigned int minLine = raster->grid()->maxLines() * relativeBlock ;
unsigned int maxLine = std::min( minLine + raster->grid()->maxLines(), raster->size().ysize());
query.addQueryItem("lines",QString("%1 %2 %3").arg(layer).arg(minLine).arg(maxLine));
}
}
query.addQueryItem("datatype","data");
url.setQuery(query);
QString urltxt = url.toString();
_object = object;
QNetworkRequest request(url);
QNetworkReply *reply = kernel()->network().get(request);
if ( object->ilwisType() == itRASTER)
connect(reply, &QNetworkReply::readyRead, this, &DownloadManager::readReadyRaster);
else
connect(reply, &QNetworkReply::readyRead, this, &DownloadManager::readReady);
connect(reply, &QNetworkReply::downloadProgress, this, &DownloadManager::downloadProgress);
connect(reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), this, &DownloadManager::error);
connect(reply, &QNetworkReply::finished, this, &DownloadManager::finishedData);
QEventLoop loop; // waits for request to complete
connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
loop.exec();
delete reply;
return true;
}
示例7: setConnector
bool IlwisObject::setConnector(ConnectorInterface *connector, int mode, const IOOptions &options)
{
if ( (!(mode == cmOUTPUT)) && isReadOnly())
return false;
if (mode & cmINPUT){
quint64 pointer = (quint64) ( _connector.data());
quint64 npointer = (quint64) ( connector);
if ( pointer != npointer || npointer == 0){
_connector.reset(connector);
if ( !_connector.isNull()){
bool ok = true;
connector->addProperty("connectormode",IlwisObject::cmINPUT);
if ( !(options.contains("create") && options.find("create").value().toBool() == true))
ok = _connector->loadMetaData(this, options);
changed(false);
return ok;
}
}
else {
kernel()->issues()->log(QString("Duplicate (out)connector assignement for input/output in %1").arg(name()),IssueObject::itWarning);
}
}
if ( mode == cmOUTPUT ){ // skip cmOUTPUt | cmINPUT;
quint64 pointer = (quint64) ( _outConnector.data());
quint64 npointer = (quint64) ( connector);
if ( pointer != npointer || npointer == 0){
connector->addProperty("connectormode",IlwisObject::cmOUTPUT);
_outConnector.reset(connector);
}
else {
kernel()->issues()->log(QString("Duplicate (out)connector assignement for input/output in %1").arg(name()),IssueObject::itWarning);
}
}
return true;
}
示例8: prepare
bool FeatureLayerDrawer::prepare(DrawerInterface::PreparationType prepType, const IOOptions &options)
{
if(!LayerDrawer::prepare(prepType, options))
return false;
if ( hasType(prepType, ptSHADERS) && !isPrepared(ptSHADERS)){
_vboColor = _shaders.attributeLocation("vertexColor");
_scaleCenter = _shaders.uniformLocation("scalecenter");
_scaleFactor = _shaders.uniformLocation("scalefactor");
_prepared |= DrawerInterface::ptSHADERS;
}
if ( hasType(prepType, DrawerInterface::ptGEOMETRY) && !isPrepared(DrawerInterface::ptGEOMETRY)){
IFeatureCoverage features = coverage().as<FeatureCoverage>();
if ( !features.isValid()){
return ERROR2(ERR_COULDNT_CREATE_OBJECT_FOR_2,"FeatureCoverage", TR("Visualization"));
}
// set all to 0
//_indices = std::vector<VertexIndex>();
_vertices = QVector<QVector3D>();
_normals = QVector<QVector3D>();
_colors = std::vector<VertexColor>();
// get a description of how to render
VisualAttribute attr = visualProperty(activeAttribute());
std::vector<std::shared_ptr<BaseSpatialAttributeSetter>> setters(5); // types are 1 2 4, for performance a vector is used thoug not all elements are used
// for the moment I use the simple setters, in the future this will be representation dependent
createAttributeSetter(features, setters, rootDrawer());
_featureDrawings.resize(features->featureCount());
int featureIndex = 0;
for(const SPFeatureI& feature : features){
QVariant value = attr.columnIndex() != iUNDEF ? feature(attr.columnIndex()) : featureIndex;
IlwisTypes geomtype = feature->geometryType();
_featureDrawings[featureIndex] = setters[geomtype]->setSpatialAttributes(feature,_vertices,_normals);
const QColor& clr = geomtype == itPOLYGON ? _boundaryColor : _lineColor;
setters[geomtype]->setColorAttributes(attr,value,clr,_featureDrawings[featureIndex],_colors) ;
++featureIndex;
}
// implicity the redoing of the geometry is also redoing the representation stuff(a.o. colors)
_prepared |= ( DrawerInterface::ptGEOMETRY | DrawerInterface::ptRENDER);
}
if ( hasType(prepType, DrawerInterface::ptRENDER) && !isPrepared(DrawerInterface::ptRENDER)){
IFeatureCoverage features = coverage().as<FeatureCoverage>();
int featureIndex = 0;
std::vector<std::shared_ptr<BaseSpatialAttributeSetter>> setters(5); // types are 1 2 4, for performance a vector is used thoug not all elements are used
// for the moment I use the simple setters, in the future this will be representation dependent
createAttributeSetter(features, setters, rootDrawer());
VisualAttribute attr = visualProperty(activeAttribute());
if ( !features.isValid()){
return ERROR2(ERR_COULDNT_CREATE_OBJECT_FOR_2,"FeatureCoverage", TR("Visualization"));
}
_colors.resize(0);
bool polygononly = false;
if ( options.contains("polygononly"))
polygononly = options["polygononly"].toBool();
for(const SPFeatureI& feature : features){
if ( polygononly && feature->geometryType() != itPOLYGON){
++featureIndex;
continue;
}
QVariant value = attr.columnIndex() != iUNDEF ? feature(attr.columnIndex()) : featureIndex;
IlwisTypes geomtype = feature->geometryType();
const QColor& clr = geomtype == itPOLYGON ? _boundaryColor : _lineColor;
setters[geomtype]->setColorAttributes(attr,value,clr,_featureDrawings[featureIndex],_colors) ;
++featureIndex;
}
_prepared |= DrawerInterface::ptRENDER;
}
//initialize();
return true;
}