本文整理汇总了C++中IOOptions类的典型用法代码示例。如果您正苦于以下问题:C++ IOOptions类的具体用法?C++ IOOptions怎么用?C++ IOOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IOOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SimpleDrawer
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: loadMetaData
bool PostgresqlTableConnector::loadMetaData(IlwisObject *data, const IOOptions& options)
{
Table *table = static_cast<Table *>(data);
IOOptions iooptions = options.isEmpty() ? this->ioOptions() : options;
PostgresqlTableLoader loader = PostgresqlTableLoader(source(), iooptions);
return loader.loadMetadata(table);
}
示例3: blocksPerBand
std::map<quint32, std::vector<quint32> > Grid::calcBlockLimits(const IOOptions& options ){
std::map<quint32, std::vector<quint32> > result;
int blockplayer = blocksPerBand();
if ( options.size() == 0){
quint32 lastblock = 0;
for(int layer = 0; layer < size().zsize(); ++layer){
for(int block = 0; block < blockplayer; ++block){
result[layer].push_back(lastblock + block);
}
lastblock += blockplayer;
}
}else {
auto bindex = options["blockindex"];
if ( bindex.isValid()){
quint32 index = bindex.toUInt();
int layer = index / blockplayer;
result[layer].push_back(index);
}
}
return result;
}
示例4: prepare
void OperationCatalogModel::prepare(const IOOptions& opt){
if ( opt.contains("globaloperationscatalog")){
_isGlobalOperationsCatalog = opt["globaloperationscatalog"].toBool();
}
_refresh = true;
gatherItems();
}
示例5: lock
void IlwisObject::connectTo(const QUrl& outurl, const QString& format, const QString& fnamespace, ConnectorMode cmode, const IOOptions& options) {
Locker<> lock(_mutex);
if ( (!(cmode == cmOUTPUT)) && isReadOnly())
return throw ErrorObject(TR(QString("format %1 or data object is readonly").arg(format)));
QUrl url(outurl);
if (!url.isValid()){
url = resource(cmode).url(true);
if ( !url.isValid()){
ERROR2(ERR_ILLEGAL_VALUE_2, "Url","");
throw ErrorObject(TR(QString("illegal url %1 for format %2").arg(url.toString()).arg(format)));
}
}
Resource res = resource();
if ( !res.isValid()) {
res = Resource(url,ilwisType(), false);
res.setId(id());
}
if ( url != QUrl()) {
QString currenturl = res.url().toString();
// we dont replace the normalized urls for internal objects if the url is pointing to the (disk based) cache
if ( !(currenturl.indexOf(INTERNAL_CATALOG) == 0 && !outurl.isValid())){
res.setUrl(url);
}
if ( url.scheme() != "ilwis") // raw urls can never go to an ilwis scheme
res.setUrl(url,true);
else {
// if we are going to the internalcatalog ensure that the physical path is good
if ( url.toString().indexOf(INTERNAL_CATALOG) == 0){
QString rawUrl = context()->persistentInternalCatalog().toString() + "/" + res.name();
res.setUrl(rawUrl, true);
}
}
}
const Ilwis::ConnectorFactory *factory = kernel()->factory<Ilwis::ConnectorFactory>("ilwis::ConnectorFactory");
if ( !factory)
throw ErrorObject(TR(QString("couldnt find factory for %1").arg(format)));
IOOptions opt = options;
opt.addOption("format", format);
Ilwis::ConnectorInterface *conn = factory->createFromFormat(res, format,fnamespace,opt);
if (!conn){
throw ErrorObject(TR(QString("couldnt connect to %1 datasource for %2").arg(format).arg(url.toString())));
}
setConnector(conn, cmode, options);
}
示例6: lock
void IlwisObject::connectTo(const QUrl& outurl, const QString& format, const QString& fnamespace, ConnectorMode cmode, const IOOptions& options) {
Locker<> lock(_mutex);
if ( isReadOnly())
return throw ErrorObject(TR(QString("format %1 or data object is readonly").arg(format)));
QUrl url(outurl);
if (!url.isValid()){
url = source(cmode).url(true);
if ( !url.isValid()){
ERROR2(ERR_ILLEGAL_VALUE_2, "Url","");
throw ErrorObject(TR(QString("illegal url %1 for format %2").arg(url.toString()).arg(format)));
}
}
Resource resource;
resource = mastercatalog()->id2Resource(id());
if ( !resource.isValid()) {
resource = Resource(url,ilwisType(), false);
resource.setId(id());
}
if ( url != QUrl()) {
QString currenturl = resource.url().toString();
// we dont replace the normalized urls for internal objects if the url is pointing to the (disk based) cache
if ( !(currenturl.indexOf("ilwis://internalcatalog") == 0 && !outurl.isValid()))
resource.setUrl(url);
resource.setUrl(url,true);
}
const Ilwis::ConnectorFactory *factory = kernel()->factory<Ilwis::ConnectorFactory>("ilwis::ConnectorFactory");
if ( !factory)
throw ErrorObject(TR(QString("couldnt find factory for %1").arg(format)));
IOOptions opt = options;
opt.addOption("format", format);
Ilwis::ConnectorInterface *conn = factory->createFromFormat(resource, format,fnamespace,opt);
if (!conn){
throw ErrorObject(TR(QString("couldnt connect to %1 datasource for %2").arg(format).arg(url.toString())));
}
setConnector(conn, cmode, options);
if ( Identity::name() == sUNDEF)
name(resource.name());
}
示例7: loadData
bool PostgresqlFeatureConnector::loadData(IlwisObject *data, const IOOptions& options)
{
if ( _binaryIsLoaded)
return true;
FeatureCoverage *fcoverage = static_cast<FeatureCoverage *>(data);
IOOptions iooptions = options.isEmpty() ? this->ioOptions() : options;
PostgresqlFeatureCoverageLoader loader = PostgresqlFeatureCoverageLoader(sourceRef(), iooptions);
bool ok = loader.loadData(fcoverage);
_binaryIsLoaded = ok;
return ok;
}
示例8: 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();
}
示例9: 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;
}
示例10: loadData
bool PostgresqlTableConnector::loadData(IlwisObject *data,const IOOptions& options)
{
Table *table = static_cast<Table *>(data);
IOOptions iooptions = options.isEmpty() ? this->ioOptions() : options;
PostgresqlTableLoader loader = PostgresqlTableLoader(source(), iooptions);
if ( !loader.loadMetadata(table)) {
return false;
}
bool ok = loader.loadData(table);
_binaryIsLoaded = ok;
return ok;
}
示例11: loadMetaData
bool PostgresqlFeatureConnector::loadMetaData(IlwisObject *data, const IOOptions &options)
{
FeatureCoverage *fcoverage = static_cast<FeatureCoverage *>(data);
IOOptions iooptions = options.isEmpty() ? this->ioOptions() : options;
PostgresqlFeatureCoverageLoader loader = PostgresqlFeatureCoverageLoader(sourceRef(), iooptions);
if ( !loader.loadMetadata(fcoverage)) {
ERROR1(ERR_NO_INITIALIZED_1, sourceRef().name());
return false;
}
return true;
}
示例12: 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;
}
示例13: 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;
}
示例14: qDebug
bool WfsFeatureConnector::loadMetaData(Ilwis::IlwisObject *data, const IOOptions& options)
{
qDebug() << "WfsFeatureConnector::loadMetaData()";
if (options.size() > 0) {
qWarning() << "IOOptions not empty .. not handled for now.";
}
QUrl featureUrl = sourceRef().url(true);
WebFeatureService wfs(featureUrl);
QUrlQuery queryFeatureType(featureUrl);
SPWfsResponse featureDescriptionResponse = wfs.describeFeatureType(queryFeatureType);
WfsFeatureDescriptionParser schemaParser(featureDescriptionResponse);
FeatureCoverage *fcoverage = static_cast<FeatureCoverage *>(data);
_context.setResource(_resource);
return schemaParser.parseMetadata(fcoverage, _context);
}
示例15: merge
IOOptions PostgresqlFeatureConnector::merge(const IOOptions &first, const IOOptions &second) {
IOOptions result;
auto end = first.end();
for (auto it = first.begin(); it != end; ++it)
{
result.addOption( it.key(), it.value());
}
end = second.end();
for (auto it = second.begin(); it != end; ++it)
{
result.addOption( it.key(), it.value());
}
return result;
}