bool ApplyUndefinedValueDefinition::canUse(const IIlwisObject &obj, const QString &name) const
{
    if (!obj.isValid())
        return false;
    if ( obj->ilwisType() == itRASTER)   {
        Ilwis::IRasterCoverage raster = obj.as<RasterCoverage>();
        return hasType(raster->datadef().domain()->ilwisType(), itNUMERICDOMAIN);
    }
    return false;
}
Example #2
0
void Rastercalc::addition() {

    Ilwis::IRasterCoverage map1;
    DOTEST(map1.prepare(makeInputPath("U_1001A.NTF")),"loading erdas imagine file");

      Ilwis::IRasterCoverage cov = map1 + 100.0;
    DOCOMPARE(cov->pix2value(Ilwis::Pixel(0,0)),225.0,"Checking pix(269,339) for expression raster <operator> number");
    DOCOMPARE(cov->pix2value(Ilwis::Pixel(269,339)),139.0,"Checking pix(269,339) for expression raster <operator> number");
    DOCOMPARE(cov->pix2value(Ilwis::Pixel(29,996)),127.0,"Checking pix(29,996) for expression raster <operator> number");
}
Example #3
0
void Rastercalc::substract(){
    Ilwis::IRasterCoverage map1;
    DOTEST(map1.prepare(makeInputPath("U_1001A.NTF")),"loading erdas imagine file");

    Ilwis::IRasterCoverage cov = 100.0 - map1;

    DOCOMPARE(cov->pix2value(Ilwis::Pixel(0,0)),-25.0,"Checking pix(269,339) for expression number <operator> raster");

    map1.prepare("small.mpl");
    Ilwis::IRasterCoverage cov4 = map1 + 100;

    map1.prepare("n000302_sub_kenya.mpr");
    Ilwis::IRasterCoverage map2("kenya_2009ndvi_cor_22.mpr");

    Ilwis::IRasterCoverage cov2 = map1 + map2 / 3;

    DOCOMPARE(cov2->pix2value(Ilwis::Pixel(50,50)),148.18,"Checking pix(50,50) for compound expression");

    Ilwis::IRasterCoverage cov3 = sqrt(cov2);

    DOCOMPARE(cov3->pix2value(Ilwis::Pixel(50,50)),12.173,"Checking pix(50,50) for sqrt");


}
Ilwis::IRasterCoverage sin(const Ilwis::IRasterCoverage &raster1)
{
    QString name = ANONYMOUS_PREFIX;
    QString stmt = QString("script %1=sin(%2)").arg(name).arg(raster1->name());
    return doRasterOperation(stmt);
}
Ilwis::IRasterCoverage sqrt(const Ilwis::IRasterCoverage &raster1)
{
    QString name = Identity::newAnonymousName();;
    QString stmt = QString("script %1=sqrt(%2)").arg(name).arg(raster1->name());
    return doRasterOperation(stmt);
}