本文整理汇总了C++中ITable::primaryKey方法的典型用法代码示例。如果您正苦于以下问题:C++ ITable::primaryKey方法的具体用法?C++ ITable::primaryKey怎么用?C++ ITable::primaryKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITable
的用法示例。
在下文中一共展示了ITable::primaryKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}