本文整理汇总了C++中IDomain::isValid方法的典型用法代码示例。如果您正苦于以下问题:C++ IDomain::isValid方法的具体用法?C++ IDomain::isValid怎么用?C++ IDomain::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDomain
的用法示例。
在下文中一共展示了IDomain::isValid方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parentDomain
QString IlwisObjectModel::parentDomain() const {
if ( hasType(_ilwisobject->ilwisType(),itDOMAIN)){
IDomain domain = _ilwisobject.as<Domain>();
if ( domain.isValid()){
IDomain parentDomain = domain->parent();
if ( parentDomain.isValid())
return parentDomain->name();
}
}
return "not defined";
}
示例2: setParent
void Domain::setParent(const IDomain &dm)
{
if ( dm.isValid())
dm->addChildDomain(id());
else
_parentDomain->removeChildDomain(id());
_parentDomain = dm;
}
示例3: valueType
QString IlwisObjectModel::valueType() const {
if ( hasType(_ilwisobject->ilwisType(),itDOMAIN)){
IDomain domain = _ilwisobject.as<Domain>();
if ( domain.isValid()){
IlwisTypes tp = domain->valueType();
return TypeHelper::type2name(tp);
}
}
return "";
}
示例4: prepare
OperationImplementation::State MapCalc::prepare(ExecutionContext *ctx,const SymbolTable &st) {
OperationImplementation::prepare(ctx,st);
QString expr = _expression.input<QString>(0);
RasterStackDefinition stackdef;
for(int parmIndex = 1 ; parmIndex < _expression.parameterCount(); ++parmIndex){
Parameter parm = _expression.parm(parmIndex);
if ( hasType(parm.valuetype(), itRASTER)){
QString url = parm.value();
IRasterCoverage raster;
if(!raster.prepare(url)){
return sPREPAREFAILED;
}
if ( stackdef.isValid()){
if(!stackdef.checkStackDefintion(raster->stackDefinition())){
kernel()->issues()->log(TR("Incompatible stack definition for ") +raster->name() ) ;
return sPREPAREFAILED;
}
}else if ( raster->stackDefinition().domain()->code().indexOf("count") == -1)
stackdef = raster->stackDefinition();
_inputRasters[parmIndex] = PixelIterator(raster);
}else if ( hasType(parm.valuetype(), itNUMBER)){
bool ok;
double v = parm.value().toDouble(&ok);
if (!ok){
return sPREPAREFAILED;
}
_inputNumbers[parmIndex] = v;
}
}
OperationHelperRaster helper;
helper.initialize((*_inputRasters.begin()).second.raster(), _outputRaster, itRASTERSIZE | itENVELOPE | itCOORDSYSTEM | itGEOREF);
if ( stackdef.isValid()){
_outputRaster->stackDefinitionRef() = stackdef;
}
IDomain outputDomain;
try {
outputDomain = linearize(shuntingYard(expr));
if( !outputDomain.isValid())
return sPREPAREFAILED;
} catch(ErrorObject& err){
return sPREPAREFAILED;
}
_outputRaster->datadefRef().domain(outputDomain);
for(quint32 i = 0; i < _outputRaster->size().zsize(); ++i){
QString index = _outputRaster->stackDefinition().index(i);
_outputRaster->setBandDefinition(index,DataDefinition(outputDomain));
}
initialize(_outputRaster->size().linearSize());
return sPREPARED;
}
示例5: createNumericDomain
NumericDomain* InternalIlwisObjectFactory::createNumericDomain(const QString& code, InternalDatabaseConnection& db, const IOOptions &options, const Resource& resource) const
{
QString query = QString("Select * from numericdomain where code='%1'").arg(code);
if (db.exec(query)) {
if ( db.next()){
QSqlRecord rec = db.record();
NumericDomain *dv = createFromResource<NumericDomain>(resource, options);
dv->fromInternal(rec);
double vmin = rec.field("minv").value().toDouble();
double vmax = rec.field("maxv").value().toDouble();
double step = rec.field("resolution").value().toDouble();
int range_strict = rec.field("range_strict").value().toInt();
QString parent = rec.field("parent").value().toString();
db.closeConnection();
QString unit = rec.field("unit").value().toString();
if (unit == "Days"){
if ( fmod(step,1.0) == 0 && step != 0)
dv->range(new TimeInterval(Time(vmin), Time(vmax)));
else
dv->range(new TimeInterval(Time(vmin), Time(vmax),Duration(QString("%1D").arg(step))));
}else {
if ( fmod(step,1.0) == 0 && step != 0)
dv->range(new NumericRange(vmin, vmax,1));
else
dv->range(new NumericRange(vmin, vmax));
}
dv->setStrict(range_strict ? true : false);
if ( parent != "" && parent != code) { // no parenting to itself
IDomain dom;
dom.prepare(parent, options);
if ( dom.isValid()) {
dv->setParent(dom);
}
}
return dv;
}else {
kernel()->issues()->log(TR(ERR_FIND_SYSTEM_OBJECT_1).arg(code));
}
}
return 0;
}
示例6: createDataDef
DataDefinition RasterCoverageConnector::createDataDef(double vmin, double vmax, double resolution, bool accurate, GdalOffsetScale gdalOffsetScale){
if (gdalOffsetScale.offset != rUNDEF && gdalOffsetScale.scale != rUNDEF) {
vmin = vmin * gdalOffsetScale.scale + gdalOffsetScale.offset ;
vmax = vmax * gdalOffsetScale.scale + gdalOffsetScale.offset ;
}
QString domName = NumericDomain::standardNumericDomainName(vmin, vmax, resolution);
IDomain dom;
dom.prepare(domName);
if(!dom.isValid()) {
ERROR1(ERR_FIND_SYSTEM_OBJECT_1, domName);
return DataDefinition();
}
DataDefinition def;
def.domain(dom);
if (accurate)
def.range(new NumericRange(vmin, vmax, dom->range<NumericRange>()->resolution()));
else
def.range(new NumericRange()); // invalid NumericRange, force computing raster statistics
return def;
}
示例7: 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;
}
示例8: 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));
//.........这里部分代码省略.........
示例9: createCoverage
bool InternalIlwisObjectFactory::createCoverage(const Resource& resource, Coverage *coverage, const IOOptions &options) const {
if (!coverage->prepare())
return false;
//coverage->setName(QString("%1%2").arg(ANONYMOUS_PREFIX).arg(coverage->id()));
ICoordinateSystem csy;
QString typnm = resource["coordinatesystem"].typeName();
if (typnm == "Ilwis::ICoordinateSystem")
csy = resource["coordinatesystem"].value<Ilwis::ICoordinateSystem>();
else if( typnm == "QString" &&
resource["coordinatesystem"].toString() != sUNDEF ) {
Resource newresource = resource.property2Resource("coordinatesystem", itCOORDSYSTEM);
if ( newresource.isValid()) {
if (!csy.prepare(newresource,options))
return false;
}
} else if ( typnm == "qulonglong"){
if(!csy.prepare(resource["coordinatesystem"].value<quint64>()))
return 0;
}
if ( csy.isValid()){
coverage->coordinateSystem(csy);
}
Envelope bounds;
QString envType = resource["envelope"].typeName();
if ( envType == "Ilwis::Box<double>" || envType == "Ilwis::Envelope") {
bounds = resource["envelope"].value<Envelope>();
}else if (QString(resource["envelope"].typeName()) == "QString" &&
resource["envelope"].toString() != sUNDEF) {
bounds = Envelope(resource["envelope"].toString());
}
if ( bounds.isValid()) {
coverage->envelope(bounds);
}
if ( resource.ilwisType() == itRASTER) {
IDomain dom;
QString tpname = resource["domain"].typeName();
if (tpname == "Ilwis::IDomain")
dom = resource["domain"].value<Ilwis::IDomain>();
else if( tpname == "QString" &&
resource["domain"].toString() != sUNDEF ) {
Resource newresource = resource.property2Resource("domain", itDOMAIN);
if ( newresource.isValid()) {
if (!dom.prepare(newresource, options))
return false;
}
} else if ( tpname == "qulonglong"){
if(!dom.prepare(resource["domain"].value<quint64>()))
return 0;
}
if ( dom.isValid()){
RasterCoverage *raster = static_cast<RasterCoverage *>(coverage);
raster->datadefRef().domain(dom);
}
}
return true;
}
示例10: initDomainViaType
bool WfsFeatureDescriptionParser::initDomainViaType(QString &type, IDomain &domain)
{
type = type.mid(type.indexOf(":") + 1);
if (type == "double" || type == "float" || type == "decimal") {
INumericDomain ndomain;
ndomain.prepare("value");
domain = ndomain;
return true;
}
if (type == "int" || type == "unsignedInt" || type.contains("Integer") || type == "unsignedShort") {
INumericDomain ndomain;
ndomain.prepare("integer");
domain = ndomain;
return domain.isValid();
}
if (type == "long" || type == "unsignedLong") {
INumericDomain ndomain;
ndomain.prepare("integer");
domain = ndomain;
return domain.isValid();
}
if (type == "string" || type == "token" || type == "normalizedString") {
domain.prepare("code=domain:text", itTEXTDOMAIN);
return domain.isValid();
}
if (type == "boolean") {
domain.prepare("boolean", itBOOL);
return domain.isValid();
}
if (type == "date") {
ITimeDomain tdomain;
tdomain.prepare();
tdomain->range(new TimeInterval(itDATE));
domain = tdomain;
return domain.isValid();
}
if (type == "dateTime") {
ITimeDomain tdomain;
tdomain.prepare();
tdomain->range(new TimeInterval(itDATETIME));
domain = tdomain;
return domain.isValid();
}
// -------------------------------------------------
/*
* NOTE: there are some more xsd:* types possible.
* Some make sense, some not ...
*
* see:
* http://infohost.nmt.edu/tcc/help/pubs/rnc/xsd.html
*
* Types which makes sense to be addded here
*/
// anyURI
// base64Binary => decode to itBINARY
// duration => decode to timeinterval with valid bounds
// gDay, gMonth, gMonthDay, gYear, gYearMonth
// ID
// hexBinary
/*
* types which makes less sense to be addded here
*/
// byte
// IDREF, IDREFS
// Name, NCName
// NMTOKEN, NMTOKENS
// QName
// unsignedByte
// -------------------------------------------------
ERROR1(TR("Could not create domain for schema type: %1"), type);
return false;
}