本文整理汇总了C++中ITable::columndefinitionRef方法的典型用法代码示例。如果您正苦于以下问题:C++ ITable::columndefinitionRef方法的具体用法?C++ ITable::columndefinitionRef怎么用?C++ ITable::columndefinitionRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITable
的用法示例。
在下文中一共展示了ITable::columndefinitionRef方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: storeMetaData
bool FeatureConnector::storeMetaData(FeatureCoverage *fcov, IlwisTypes type) {
if ( type == itUNKNOWN)
return true;//if type is itUNKNOWN we dont store
DataDefinition datadef;
ITable attTable = fcov->attributeTable();
QString primkey = attTable->primaryKey();
if (primkey == sUNDEF)
primkey = COVERAGEKEYCOLUMN;
int index = attTable->columnIndex(primkey);
if ( index != iUNDEF ) {
const ColumnDefinition& coldef = attTable->columndefinitionRef(index);
if ( coldef.datadef().domain<>()->ilwisType() == itITEMDOMAIN)
datadef = DataDefinition(coldef.datadef().domain(),coldef.datadef().range()->clone());
}
if ( !datadef.isValid()) {
INamedIdDomain indexdom;
indexdom.prepare();
indexdom->name(fcov->name());
NamedIdentifierRange range;
for(quint32 i=0; i < fcov->featureCount(type); ++i){
QStringList parts = Ilwis3Connector::ilwis3ClassName(type).split(" ");
QString itemname = QString("%1_%2").arg(parts[0]).arg(i);
range << itemname;
}
indexdom->setRange(range);
datadef.domain(indexdom);
QFileInfo inf ( _resource.url(true).toLocalFile());
QString filename = context()->workingCatalog()->filesystemLocation().toLocalFile() + "/" + inf.baseName() + ".dom";
indexdom->connectTo(filename,"domain","ilwis3", Ilwis::IlwisObject::cmOUTPUT);
indexdom->store();
}
bool isMulti = (fcov->featureTypes() & (fcov->featureTypes() - 1)) != 0;
QString baseName = Ilwis3Connector::outputNameFor(fcov, isMulti, type);
index = baseName.lastIndexOf(".");
if ( index != -1) {
baseName = baseName.left(index);
}
bool ok = CoverageConnector::storeMetaData(fcov, type, datadef, baseName);
if ( !ok)
return false;
if ( datadef.domain()->valueType() == itINDEXEDITEM) {
_odf->setKeyValue("Domain","Type","DomainUniqueID");
_odf->setKeyValue("DomainSort","Sorting","AlphaNumeric");
_odf->setKeyValue("DomainSort","Prefix","feature");
_odf->setKeyValue("DomainSort","Class","Domain UniqueID");
_odf->setKeyValue("DomainIdentifier","Nr",IniFile::FormatElement(fcov->featureCount(type)));
}
Envelope bounds = fcov->envelope();
if ( bounds.isNull() || !bounds.isValid())
bounds = fcov->coordinateSystem()->envelope();
_odf->setKeyValue("BaseMap","CoordBounds",QString("%1 %2 %3 %4").
arg(bounds.min_corner().x,0,'f',10).
arg(bounds.max_corner().y,0,'f',10).
arg(bounds.max_corner().x,0,'f',10).
arg(bounds.min_corner().y,0,'f',10));
QString ext = "mpa";
if ( hasType(type, itPOLYGON)){
ok = storeMetaPolygon(fcov, baseName);
}
if ( hasType(type, itLINE)){
ok = storeMetaLine(fcov, baseName);
ext = "mps";
}
if ( hasType(type, itPOINT)){
ok = storeMetaPoint(fcov, baseName);
ext = "mpp";
}
if ( attTable.isValid() && attTable->columnCount() > 0) {
QFileInfo basename (baseName);
QScopedPointer<TableConnector> conn(createTableStoreConnector(attTable, fcov, type, basename.baseName()));
std::vector<quint32> recs(_itemCount);
conn->selectedRecords(recs);
conn->storeMetaData(attTable.ptr());
}
_odf->store(ext, QFileInfo(baseName));
return ok;
}