本文整理汇总了C++中ITable::name方法的典型用法代码示例。如果您正苦于以下问题:C++ ITable::name方法的具体用法?C++ ITable::name怎么用?C++ ITable::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITable
的用法示例。
在下文中一共展示了ITable::name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadData
bool PostgresqlFeatureCoverageLoader::loadData(FeatureCoverage *fcoverage) const
{
//qDebug() << "PostgresqlFeatureCoverageLoader::loadData()";
ITable table;
PostgresqlDatabaseUtil pgUtil(_resource,_options);
Resource tableResource = pgUtil.resourceForType(itFLATTABLE);
table.prepare(tableResource, _options);
PostgresqlTableLoader tableLoader(table->source(), _options);
if (!tableLoader.loadData(table.ptr())) {
ERROR1("Could not load table data for table '%1'", table->name());
return false;
}
// metadata already set it to correct number, creating new features will up the count agains; so reset to 0.
fcoverage->setFeatureCount(itFEATURE, iUNDEF, FeatureInfo::ALLFEATURES);
QList<MetaGeometryColumn> metaGeometries;
pgUtil.getMetaForGeometryColumns(metaGeometries);
QSqlQuery query = pgUtil.doQuery(selectGeometries(metaGeometries), "featurecoverageloader");
quint32 geometriesPerFeature = metaGeometries.size();
IDomain semantics;
pgUtil.prepareSubFeatureSemantics(semantics, metaGeometries);
while (query.next()) {
if (geometriesPerFeature == 0) {
fcoverage->newFeature(0);
} else {
// index 0 is root, indeces > 0 are subfeatures of root
bool atRoot = true;
SPFeatureI rootFeature;
// iterate semantics to keep predefined order
ItemRangeIterator iter(semantics->range<>().data());
while (iter.isValid()) {
QString geomName = (*iter)->name();
ICoordinateSystem crs;
std::for_each(metaGeometries.begin(), metaGeometries.end(), [&crs,geomName](MetaGeometryColumn c) {
if (c.geomColumn == geomName) {
crs = c.crs;
}
});
if (atRoot) {
atRoot = false;
geos::geom::Geometry *rootGeometry = createGeometry(query, geomName, crs);
rootFeature = fcoverage->newFeature(rootGeometry, false);
} else {
geos::geom::Geometry *subGeometry = createGeometry(query, geomName, crs);
rootFeature->createSubFeature(geomName,subGeometry);
}
++iter;
}
}
}
fcoverage->attributesFromTable(table);
return true;
}
示例2: createAttributes
bool GdalFeatureConnector::createAttributes(const ITable& tbl, OGRLayerH layer, const std::vector<OGRFieldDefnH>& fielddefs,std::vector<bool>& validAttributes) {
if ( layer == 0)
return false;
int index=0;
for(int i=0; i < tbl->columnCount(); ++i){
if ( validAttributes[i]) {
if(gdal()->addAttribute(layer,fielddefs[index],TRUE) != OGRERR_NONE){
validAttributes[i] = false;
WARN2(ERR_NO_INITIALIZED_2,tbl->columndefinition(i).name(),tbl->name());
}
++index;
}
}
return true;
}
示例3: evaluate
bool AssignmentNode::evaluate(SymbolTable& symbols, int scope, ExecutionContext *ctx)
{
if ( _expression.isNull())
return false;
try{
bool ok = _expression->evaluate(symbols, scope, ctx);
if ( ok) {
// we save the additional info as we might need it but for the rest clear
// the results as the result of the assignment node is a newly filled ctx
auto additionalInfo = ctx->_additionalInfo;
ctx->clear(true);
NodeValue val = _expression->value();
for(int i = 0; i < val.size(); ++i) {
Symbol sym = symbols.getSymbol(val.id(i),SymbolTable::gaREMOVEIFANON);
IlwisTypes tp = sym.isValid() ? sym._type : itUNKNOWN;
QString result = _outParms->id(i);
if ( hasType(tp, itILWISOBJECT | itCOLUMN)) {
if ( hasType(tp, itRASTER)) {
ok &= copyObject<RasterCoverage>(sym, result,symbols);
}
else if (hasType(tp, itFEATURE))
ok &= copyObject<FeatureCoverage>(sym, result,symbols);
else if (hasType(tp, itCOORDSYSTEM))
ok &= copyObject<CoordinateSystem>(sym, result,symbols);
else if ( hasType(tp, itDOMAIN)){
ok &= copyObject<Domain>(sym, result,symbols);
} else if ( hasType(tp, itGEOREF)){
ok &= copyObject<GeoReference>(sym, result,symbols);
} else if (hasType(tp, itTABLE | itCOLUMN)){
ok &= copyObject<Table>(sym, result,symbols,true);
QSharedPointer<Selector> selector = _outParms->selector(result);
if (!selector.isNull()){
QString varName = selector->variable();
ITable source = sym._var.value<ITable>();
QString oldColName = additionalInfo[source->name()].toString();
QVariant newT= symbols.getValue(result);
ITable newTable = newT.value<ITable>();
ColumnDefinition& coldef = newTable->columndefinitionRef(oldColName);
if ( coldef.isValid()){
coldef.name(varName);
}
}
}
if(!ok) {
throw ErrorObject(QString(TR(ERR_OPERATION_FAILID1).arg("assignment")));
}
QSharedPointer<ASTNode> specifier = _outParms->specifier(_outParms->id(i));
if ( !specifier.isNull()) {
if ( specifier->noOfChilderen()!= 1)
return ERROR2(ERR_NO_OBJECT_TYPE_FOR_2, "Output object", "expression");
store2Format(specifier, sym, result);
}
ctx->_results.push_back(result);
} else {
sym = symbols.getSymbol(result,SymbolTable::gaREMOVEIFANON);
tp = sym.isValid() ? sym._type : itUNKNOWN;
if ( tp == itUNKNOWN) {
tp = Domain::ilwType(val);
}
}
//ctx->addOutput(symbols,_expression->value(),result, tp, Resource());
}
}
return ok;
} catch(const ErrorObject&){
}
return false;
}