本文整理汇总了C++中IDomain::ilwisType方法的典型用法代码示例。如果您正苦于以下问题:C++ IDomain::ilwisType方法的具体用法?C++ IDomain::ilwisType怎么用?C++ IDomain::ilwisType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDomain
的用法示例。
在下文中一共展示了IDomain::ilwisType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: kernel
Ilwis::OperationImplementation::State CreateNumericDomain::prepare(ExecutionContext *ctx, const SymbolTable &)
{
bool ok1, ok2, ok3;
_vmin = _expression.input<double>(0, ok1);
_vmax = _expression.input<double>(1, ok2);
_vres = _expression.input<double>(2, ok3);
if ((!ok1 || !ok2 || !ok3) || _vmin > _vmax || _vres < 0) {
kernel()->issues()->log(QString(TR("incompatible values in numeric domain creation : %1, %2, %3").arg(_expression.input<QString>(0), _expression.input<QString>(1), _expression.input<QString>(2))));
return sPREPAREFAILED;
}
_strict = _expression.input<bool>(3);
_domaindesc = _expression.input<QString>(4);
if ( _expression.parameterCount() == 6) {
QString parentdom = _expression.input<QString>(5);
if ( parentdom != "") {
IDomain dom;
if ( dom.prepare(parentdom, {"mustexist",true})) {
if ( dom->ilwisType() == itNUMERICDOMAIN) {
auto rng = dom->range<Ilwis::NumericRange>();
if ( _vmin < rng->min() || _vmax > rng->max()) {
kernel()->issues()->log(QString(TR("incompatible domain definition with parent domain, ranges incorrect")));
return sPREPAREFAILED; ;
}
_parent = dom;
}
}
}
}
return sPREPARED;
}
示例2: setStackDomain
bool PinDataSource::setStackDomain(const QString& id) {
IRasterCoverage raster;
raster.prepare(_objid);
bool ok;
_actives.clear();
quint64 oid = id.toULongLong(&ok);
if (!ok) {
kernel()->issues()->log(TR("No valid object id used: ") + id);
return false;
}
RasterStackDefinition& stack = raster->stackDefinitionRef();
IDomain dom;
if (dom.prepare(oid) && dom->ilwisType() == itITEMDOMAIN) {
_stackDomain = dom;
IItemDomain itemdom = dom.as< ItemDomain<DomainItem>>();
if (itemdom->count() == raster->size().zsize()) {
std::vector<QString> items;
for (auto item : itemdom) {
items.push_back(item->name());
}
stack.setSubDefinition(itemdom, items);
}
else {
kernel()->issues()->log(TR("Item domain must have same size as tjhe number of bands in the container"));
return false;
}
}
for (quint32 i = 0; i < stack.count(); ++i) {
QString name = QString::number(i + 1); // stack.index(i+1);
QVariantMap data;
data["name"] = name;
data["active"] = true;
if (_stackDomain->valueType() != itNUMERICITEM) {
data["minvalue"] = "?";
data["maxvalue"] = "?";
}
else {
IIntervalDomain idomain = _stackDomain.as<IntervalDomain>();
if (idomain->count() == stack.count()) {
auto item = idomain->item(i)->as<Interval>();
data["name"] = item->name();
auto range = item->range().as<NumericRange>();
data["minvalue"] = QString::number(range->min());
data["maxvalue"] = QString::number(range->max());
}
}
_actives.push_back(data);
}
return true;
}
示例3: setParent
void NumericDomain::setParent(const IDomain &dm)
{
if ( isReadOnly())
return;
changed(true);
if ( _range.isNull()) {
return;
}
if ( dm->ilwisType() != itNUMERICDOMAIN || hasType(dm->valueType(), itNUMBER) == false)
return;
SPNumericRange numrange = dm->range<NumericRange>();
if ( !numrange->contains(_range))
return;
Domain::setParent(dm);
}
示例4: DomainItemModel
QQmlListProperty<DomainItemModel> IlwisObjectModel::domainitems()
{
IlwisTypes objectype = _ilwisobject->ilwisType();
if ( hasType( objectype, itDOMAIN)){
IDomain domain = _ilwisobject.as<Domain>();
if ( hasType(domain->ilwisType(), itITEMDOMAIN)){
SPItemRange itemrange =domain->range<ItemRange>();
if ( !itemrange.isNull()){
for(auto item : *(itemrange.data())) {
if ( item){
DomainItemModel *domainitem = new DomainItemModel(itemrange,item->name(), this);
_domainItems.push_back(domainitem);
}
}
if ( _domainItems.size() > 0)
return QQmlListProperty<DomainItemModel>(this, _domainItems) ;
}
}
}
return QQmlListProperty<DomainItemModel>();
}
示例5: canUse
bool RasterCoverage::canUse(const IlwisObject *obj, bool strict) const
{
if ( Coverage::canUse(obj, strict))
return true;
if ( hasType(obj->ilwisType(),itDOMAIN)){
IDomain dom;
dom.prepare(obj->id());
if ( dom.isValid()){
if (strict){
}else {
if ( hasType(dom->valueType(), itNUMBER) && hasType( datadef().domain()->valueType(), itNUMBER)){
return true;
}
if ( hasType(dom->ilwisType(), itITEMDOMAIN) && hasType( datadef().domain()->valueType(), itITEMDOMAIN)){
return datadef().domain()->isCompatibleWith(obj);
}
}
}
}
return false;
}
示例6: storeMetaData
bool CoverageConnector::storeMetaData(IlwisObject *obj, IlwisTypes type, const DataDefinition& datadef)
{
bool ok = Ilwis3Connector::storeMetaData(obj, type);
if ( !ok)
return false;
Coverage *coverage = static_cast<Coverage *>(obj);
const ICoordinateSystem csy = coverage->coordinateSystem();
if (!csy.isValid())
return ERROR2(ERR_NO_INITIALIZED_2, "CoordinateSystem", coverage->name());
QString localName = Resource::toLocalFile(csy->source().url(),true);
if ( localName == sUNDEF) {
localName = CoordinateSystemConnector::createCsyFromCode(csy->code());
}
if ( localName == sUNDEF) {
return ERROR2(ERR_NO_INITIALIZED_2, "CoordinateSystem", coverage->name());
}
_odf->setKeyValue("BaseMap","CoordSystem", localName);
Box2D<double> bounds = coverage->envelope();
if(!bounds.isValid())
return ERROR2(ERR_NO_INITIALIZED_2, "Bounds", coverage->name());
_odf->setKeyValue("BaseMap","CoordBounds",QString("%1 %2 %3 %4").
arg(bounds.min_corner().x(),10,'f').
arg(bounds.min_corner().y(),10,'f').
arg(bounds.max_corner().x(),10,'f').
arg(bounds.max_corner().y(),10,'f'));
const IDomain dom = datadef.domain();
if (!dom.isValid())
return ERROR2(ERR_NO_INITIALIZED_2, "Domain", coverage->name());
calcStatics(obj,NumericStatistics::pBASIC);
if ( dom->ilwisType() == itNUMERICDOMAIN) {
quint16 digits = coverage->statistics().significantDigits();
qint32 delta = coverage->statistics()[NumericStatistics::pDELTA];
if ( delta >= 0 && delta < 256 && digits == 0){
if ( delta >= 0 && delta < 256 && digits == 0){
if ( datadef.domain()->code() == "boolean"){
QString domInfo = QString("bool.dom;Byte;bool;0;;");
_odf->setKeyValue("BaseMap","DomainInfo",domInfo);
_odf->setKeyValue("BaseMap","Range","0:1:offset=-1");
_odf->setKeyValue("BaseMap","Domain","bool.dom");
}
else{
QString domInfo = QString("Image.dom;Byte;image;0;;");
_odf->setKeyValue("BaseMap","DomainInfo",domInfo);
_odf->setKeyValue("BaseMap","Range","0:255:offset=0");
_odf->setKeyValue("BaseMap","MinMax","0:255");
_odf->setKeyValue("BaseMap","Domain","Image.dom");
}
}
}
else {
const NumericStatistics& stats = coverage->statistics();
int digits = stats.significantDigits();
RawConverter conv(stats[NumericStatistics::pMIN], stats[NumericStatistics::pMAX],pow(10, - digits));
QString rangeString = QString("%1:%2:%3:offset=%4").arg(stats[NumericStatistics::pMIN]).arg(stats[NumericStatistics::pMAX]).arg(conv.scale()).arg(conv.offset());
_odf->setKeyValue("BaseMap","Range",rangeString);
_odf->setKeyValue("BaseMap","Domain","value.dom");
_odf->setKeyValue("BaseMap","MinMax",QString("%1:%2").arg(stats[NumericStatistics::pMIN]).arg(stats[NumericStatistics::pMAX]));
QString domInfo = QString("value.dom;Long;value;0;-9999999.9:9999999.9:0.1:offset=0");
_odf->setKeyValue("BaseMap","DomainInfo",domInfo);
}
} if ( dom->ilwisType() == itITEMDOMAIN) {
QString source = Resource::toLocalFile(dom->source().url(), true);
if ( dom->valueType() == itTHEMATICITEM && coverage->ilwisType() == itRASTER) {
IThematicDomain themdom = dom.get<ThematicDomain>();
if ( themdom.isValid()) {
QString domInfo = QString("%1;Byte;class;%2;;").arg(source).arg(themdom->count());
_odf->setKeyValue("BaseMap","DomainInfo",domInfo);
_odf->setKeyValue("BaseMap","Domain",source);
}
} else if(dom->valueType() == itINDEXEDITEM) {
QString domName = _odf->fileinfo().fileName();
QString domInfo = QString("%1;Long;UniqueID;0;;").arg(domName);
_odf->setKeyValue("BaseMap","DomainInfo",domInfo);
_odf->setKeyValue("BaseMap","Domain",domName);
} else if ( dom->valueType() == itNAMEDITEM) {
INamedIdDomain iddom = dom.get<NamedIdDomain>();
QString domName = _odf->fileinfo().fileName();
int index;
if ( (index=domName.lastIndexOf("."))!= -1) {
domName = domName.left(index);
}
QString domInfo = QString("%1;;Int;id;%2;;").arg(domName).arg(iddom->count());
_odf->setKeyValue("BaseMap","DomainInfo",domInfo);
_odf->setKeyValue("BaseMap","Domain",domName);
iddom->connectTo(QUrl(),"domain","ilwis3", IlwisObject::cmOUTPUT);
iddom->store(Ilwis::IlwisObject::smMETADATA | Ilwis::IlwisObject::smBINARYDATA);
}
}
ITable attTable = coverage->attributeTable();
if ( attTable.isValid()) {
QScopedPointer<TableConnector> conn(createTableConnector(attTable, coverage, type));
//.........这里部分代码省略.........