本文整理汇总了C++中IDomain类的典型用法代码示例。如果您正苦于以下问题:C++ IDomain类的具体用法?C++ IDomain怎么用?C++ IDomain使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IDomain类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addColumn
bool AttributeDefinition::addColumn(const QString &name, const QString &domainname, bool readonly)
{
IDomain dom;
if(!dom.prepare(domainname))
return false;
return addColumn({name, dom, readonly});
}
示例2: 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;
}
示例3: if
QString IlwisObjectModel::valuetype() const
{
try{
if ( !_ilwisobject.isValid())
return "";
IlwisTypes objectype = _ilwisobject->ilwisType();
IlwisTypes valueType = itUNKNOWN;
if ( hasType( objectype, itCOVERAGE|itDOMAIN)){
if ( objectype == itRASTER){
IRasterCoverage raster = _ilwisobject.as<RasterCoverage>();
valueType = raster->datadef().domain()->valueType();
} else if ( hasType( objectype , itFEATURE)){
IFeatureCoverage features = _ilwisobject.as<FeatureCoverage>();
ColumnDefinition coldef = features->attributeDefinitions().columndefinition(COVERAGEKEYCOLUMN);
if ( coldef.isValid()){
valueType = coldef.datadef().domain()->valueType();
}
} else if ( hasType( objectype , itDOMAIN)){
IDomain dom = _ilwisobject.as<Domain>();
valueType = dom->valueType();
}
}
QString typeName = TypeHelper::type2HumanReadable(valueType);
return typeName == sUNDEF ? "" : typeName;
}catch(const ErrorObject& ){
// no exceptions may escape here
}
return "";
}
示例4: addColumn
bool BaseTable::addColumn(const QString &name, const QString &domainname)
{
IDomain dom;
if(!dom.prepare(domainname))
return false;
return addColumn(name, dom);
}
示例5: mastercatalog
DataDefinition IfOperation::findParameterDataDef(const OperationExpression &expr, int index) {
const Parameter& parm = expr.parm(index);
DataDefinition def;
QString parmvalue = parm.value().toLower();
quint64 gcid = mastercatalog()->name2id(parmvalue, itRASTER);
if ( gcid != i64UNDEF) {
IRasterCoverage cov;
if(cov.prepare(gcid)) {
def = cov->datadef();
_coverages[index - 1] = cov.get<Coverage>();
}
} else {
bool ok;
_number[index - 1] =parmvalue.toDouble(&ok);
if ( ok){
def.domain().prepare("value");
} else {
std::vector<QString> bools = {"true","false","yes","no","?"};
auto iter = std::find(bools.begin(), bools.end(), parmvalue.toLower());
if ( iter != bools.end()) {
int v = 0;
if ( parmvalue == "?" )
v= 2;
else if ( parmvalue == "yes" || parmvalue == "true")
v = 1;
_number[index - 1] = v;
IDomain dm;
dm.prepare("boolean");
def.domain(dm);
}
}
}
return def;
}
示例6: dom
DataDefinition IfOperation::findParameterDataDef(const OperationExpression &expr, int index) {
const Parameter& parm = expr.parm(index);
DataDefinition def;
QString parmvalue = parm.value();
IlwisTypes ptype = parm.valuetype();
if (hasType(ptype,itRASTER)) {
IRasterCoverage cov;
if (cov.prepare(parmvalue)) {
def = cov->datadef();
_coverages[index - 1] = cov.as<Coverage>();
}
} else {
bool ok;
_number[index - 1] = parmvalue.toDouble(&ok);
if ( ok){
IDomain dom("code=domain:value");
def.domain(dom);
} else {
std::vector<QString> bools = {"true","false","yes","no","?"};
auto iter = std::find(bools.begin(), bools.end(), parmvalue.toLower());
if ( iter != bools.end()) {
int v = 0;
if ( parmvalue == "?" )
v= 2;
else if ( parmvalue == "yes" || parmvalue == "true")
v = 1;
_number[index - 1] = v;
IDomain dm;
dm.prepare("boolean");
def.domain(dm);
}
}
}
return def;
}
示例7: createInputOutputRasters
Ilwis::OperationImplementation::State LaplaceFilter::prepare(ExecutionContext *ctx, const SymbolTable &)
{
try{
createInputOutputRasters(itCOORDSYSTEM | itGEOREF | itENVELOPE | itRASTERSIZE);
IDomain dom;
if ( _inputRaster->datadef().domain()->valueType() == itUINT8)
dom.prepare("image16");
else {
dom.prepare("value");
}
_outputRaster->datadefRef() = DataDefinition(dom);
_sourcedepth = hasType(_inputRaster->datadef().domain()->valueType(), (itCOLOR | itPALETTECOLOR)) ? 3 : 1;
OperationHelper::check([&] ()->bool {return OpenCVHelper::determineCVType(_inputRaster->datadef().domain()->valueType(), _sourcedepth);},
{ERR_OPERATION_NOTSUPPORTED2, "Value type", "Laplace filter"});
_kernelSize = _expression.parameterCount() == 2 ? _expression.input<quint32>(1) : 1;
std::vector<int> possibleValue = {1,3,5,7};
OperationHelper::check([&] ()->bool { return (std::find(possibleValue.begin(), possibleValue.end(), _kernelSize) != possibleValue.end());},
{ERR_ILLEGAL_VALUE_2, "Laplace filter, kernel size", QString::number(_kernelSize)});
return sPREPARED;
} catch(const CheckExpressionError& err){
ERROR0(err.message());
}
return sPREPAREFAILED;
}
示例8: kernel
bool BinaryLogical::prepareCoverageCoverage() {
QString raster = _expression.parm(0).value();
if (!_inputGC1.prepare(raster)) {
kernel()->issues()->log(TR(ERR_COULD_NOT_LOAD_2).arg(raster, ""));
return false;
}
raster = _expression.parm(1).value();
if (!_inputGC2.prepare(raster)) {
kernel()->issues()->log(TR(ERR_COULD_NOT_LOAD_2).arg(raster, ""));
return false;
}
bool isNumeric = _inputGC1->datadef().domain<>()->ilwisType() == itNUMERICDOMAIN && _inputGC2->datadef().domain<>()->ilwisType() == itNUMERICDOMAIN;
if (!isNumeric ){
return ERROR2(ERR_INVALID_PROPERTY_FOR_2,"domain","logical operation");
}
OperationHelperRaster helper;
_box = helper.initialize(_inputGC1, _outputGC, itRASTERSIZE | itENVELOPE | itCOORDSYSTEM | itGEOREF);
IDomain dom;
dom.prepare("bool");
_outputGC->datadefRef().domain(dom);
_coveragecoverage = true;
return true;
}
示例9: ERROR2
Ilwis::OperationImplementation::State RasterToPoint::prepare(ExecutionContext *ctx, const SymbolTable &st)
{
OperationImplementation::prepare(ctx,st);
QString raster = _expression.parm(0).value();
QString outputName = _expression.parm(0,false).value();
if (!_inputraster.prepare(raster, itRASTER)) {
ERROR2(ERR_COULD_NOT_LOAD_2,raster,"");
return sPREPAREFAILED;
}
Resource resource = outputName != sUNDEF ? Resource(INTERNAL_CATALOG + "/" + outputName, itFLATTABLE) : Resource(itFLATTABLE);
_attTable.prepare(resource);
IDomain covdom;
if (!covdom.prepare("count")){
return sPREPAREFAILED;
}
_inputgrf = _inputraster->georeference();
_outputfeatures.prepare(QString(INTERNAL_CATALOG + "/%1").arg(outputName));
_csy = _inputgrf->coordinateSystem();
_outputfeatures->coordinateSystem(_csy);
Envelope env = _inputraster->georeference()->envelope();
_outputfeatures->envelope(env);
return sPREPARED;
}
示例10: setDomain
bool GridCoverageGenerator::setDomain(const QString &nme)
{
IDomain dom;
if ( !dom.prepare(nme)) {
return ERROR2(ERR_NO_INITIALIZED_2, "domain", name());
}
GridCoverage::setDomain(dom);
}
示例11: kernel
bool BinaryMathRaster::prepareCoverageCoverage() {
QString raster = _expression.parm(0).value();
if (!_inputGC1.prepare(raster)) {
kernel()->issues()->log(TR(ERR_COULD_NOT_LOAD_2).arg(raster, ""));
return false;
}
raster = _expression.parm(1).value();
if (!_inputGC2.prepare(raster)) {
kernel()->issues()->log(TR(ERR_COULD_NOT_LOAD_2).arg(raster, ""));
return false;
}
bool isNumeric = _inputGC1->datadef().domain()->ilwisType() == itNUMERICDOMAIN && _inputGC2->datadef().domain()->ilwisType() == itNUMERICDOMAIN;
if (!isNumeric)
return false;
OperationHelperRaster helper;
_box = helper.initialize(_inputGC1, _outputGC, _expression.parm(0),
itRASTERSIZE | itENVELOPE | itCOORDSYSTEM | itGEOREF);
auto nrange1 = _inputGC1->datadef().range().dynamicCast<NumericRange>();
if (nrange1.isNull())
return false;
auto nrange2 = _inputGC2->datadef().range().dynamicCast<NumericRange>();
if (nrange2.isNull())
return false;
double rmax, rmin;
switch(_operator) {
case otPLUS:
rmin = nrange1->min() + nrange2->min();
rmax = nrange1->max() + nrange1->max();
break;
case otMINUS:
rmin = nrange1->min() - nrange2->min();
rmax = nrange1->max() - nrange1->max();
break;
case otDIV:
rmin = nrange2->min() != 0 ? nrange1->min() / nrange2->min() : std::min(nrange1->min(), nrange2->min());
rmax = nrange2->max() != 0 ? nrange1->max() / nrange2->max() : std::min(nrange1->max(), nrange2->max());
break;
case otMULT:
rmin = nrange1->min() * nrange2->min();
rmax = nrange1->max() * nrange1->max();
break;
}
NumericRange *newRange = new NumericRange(rmin,
rmax,
std::min(nrange1->step(), nrange2->step()));
IDomain dom;
dom.prepare("value");
_outputGC->datadef().domain(dom);
_outputGC->datadef().range(newRange);
_coveragecoverage = true;
return true;
}
示例12: setParent
void Domain::setParent(const IDomain &dm)
{
if ( dm.isValid())
dm->addChildDomain(id());
else
_parentDomain->removeChildDomain(id());
_parentDomain = dm;
}
示例13: 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 "";
}
示例14: ERROR2
OperationImplementation::State UnaryMathRasterAndNumber::prepare(ExecutionContext *ctx,const SymbolTable &st)
{
OperationImplementation::prepare(ctx,st);
IlwisTypes ptype = _expression.parm(0).valuetype();
if ( hasType(ptype,itNUMBER) ) {
_case = otNUMBER;
bool ok;
_number = _expression.parm(0).value().toDouble(&ok);
if (!ok) {
ERROR2(ERR_NO_OBJECT_TYPE_FOR_2,"Numerical value", "UnaryMathRasterAndNumber operation");
_number = rUNDEF;
return sPREPAREFAILED;
}
return sPREPARED;
} else if ( hasType(ptype,itRASTER)) {
QString raster = _expression.parm(0).value();
if (!_inputGC.prepare(raster)) {
ERROR2(ERR_COULD_NOT_LOAD_2,raster,"");
return sPREPAREFAILED;
}
OperationHelperRaster helper;
_box = helper.initialize(_inputGC, _outputGC, itRASTERSIZE | itENVELOPE | itCOORDSYSTEM | itGEOREF);
if ( !_outputGC.isValid()) {
ERROR1(ERR_NO_INITIALIZED_1, "output rastercoverage");
return sPREPAREFAILED;
}
QString outputName = _expression.parm(0,false).value();
if ( outputName != sUNDEF)
_outputGC->name(outputName);
auto nrange = _inputGC->datadef().range<NumericRange>();
if (nrange.isNull())
return sPREPAREFAILED;
NumericRange *newRange = constructRangeFrom(nrange);
IDomain dom;
if(!dom.prepare(_outputDomain))
return sPREPAREFAILED;
_outputGC->datadefRef().domain(dom);
_outputGC->datadefRef().range(newRange);
for(quint32 i=0; i<_outputGC->size().zsize(); ++i){
QString index = _outputGC->stackDefinition().index(i);
_outputGC->setBandDefinition(index,{dom, newRange->clone()});
}
_case = otSPATIAL;
return sPREPARED;
}
return sNOTPREPARED;
}
示例15: kernel
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;
}