本文整理汇总了C++中IRasterCoverage::datadef方法的典型用法代码示例。如果您正苦于以下问题:C++ IRasterCoverage::datadef方法的具体用法?C++ IRasterCoverage::datadef怎么用?C++ IRasterCoverage::datadef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRasterCoverage
的用法示例。
在下文中一共展示了IRasterCoverage::datadef方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: domainCase
void domainCase(const IIlwisObject& obj, const QString& condition, int parmIndex, QVariantList& result)
{
if (hasType(obj->ilwisType(), itRASTER)) {
IRasterCoverage raster = obj.as<RasterCoverage>();
QStringList parts = condition.split("=");
QVariantMap mp;
if ( parts.size() == 2){
if (parts[0] == "domain"){
QString domainType = parts[1];
if ( domainType == "numericdomain"){
mp["parameterIndex"] = parmIndex;
mp["result"] = hasType(raster->datadef().domain()->ilwisType(), itNUMERICDOMAIN) ? obj->resource().url().toString() : "";
mp["uielement"] = "textfield";
}else if ( domainType == "itemdomain"){
mp["parameterIndex"] = parmIndex;
mp["result"] = hasType(raster->datadef().domain()->ilwisType(), itITEMDOMAIN) ? obj->resource().url().toString() : "";
mp["uielement"] = "textfield";
}
} else if ( parts[0] == "valuetype"){
QString valueType = parts[1];
IlwisTypes vt = IlwisObject::name2Type(valueType);
mp["parameterIndex"] = parmIndex;
mp["result"] = hasType(raster->datadef().domain()->valueType(), vt) ? obj->resource().url().toString() : "";
mp["uielement"] = "textfield";
}
}
result.append(mp);
}
}
示例2: initialize
BoundingBox OperationHelperRaster::initialize(const IRasterCoverage &inputRaster, IRasterCoverage &outputRaster, quint64 what)
{
Resource resource(itRASTER);
Size<> sz = inputRaster->size();
BoundingBox box(sz);
if ( what & itRASTERSIZE) {
resource.addProperty("size", IVARIANT(sz.toString()));
}
if ( what & itENVELOPE) {
if ( box.isNull() || !box.isValid()) {
sz = inputRaster->size();
box = BoundingBox(sz);
}
Envelope bounds = inputRaster->georeference()->pixel2Coord(box);
resource.addProperty("envelope", IVARIANT(bounds.toString()));
}
if ( what & itCOORDSYSTEM) {
resource.addProperty("coordinatesystem", IVARIANT(inputRaster->coordinateSystem()->id()));
}
if ( what & itGEOREF) {
if ( box.isNull() || !box.isValid()) {
sz = inputRaster->size();
box = BoundingBox(sz);
}
if ( sz.xsize() == box.xlength() && sz.ysize() == box.ylength())
resource.addProperty("georeference", IVARIANT(inputRaster->georeference()->id()));
}
if ( what & itDOMAIN) {
resource.addProperty("domain", IVARIANT(inputRaster->datadef().domain<>()->id()));
}
resource.prepare();
outputRaster.prepare(resource);
if ( what & itTABLE) {
if ( inputRaster->attributeTable().isValid()) {
if ( inputRaster->datadef().domain<>() == outputRaster->datadef().domain<>()) {
if ( outputRaster.isValid())
outputRaster->setAttributes(inputRaster->attributeTable());
}
}
}
if ( what & itDOMAIN){
for(quint32 i = 0; i < outputRaster->size().zsize(); ++i){
QString index = outputRaster->stackDefinition().index(i);
outputRaster->setBandDefinition(index,DataDefinition(outputRaster->datadef().domain()));
}
}
return box;
}
示例3: rangeDefinition
QString IlwisObjectModel::rangeDefinition(bool defaultRange, bool calc, const QString& columnName) {
try {
IlwisTypes objectype = _ilwisobject->ilwisType();
QString rangeString;
if ( hasType( objectype, itCOVERAGE|itDOMAIN)){
if ( objectype == itRASTER){
IRasterCoverage raster = _ilwisobject.as<RasterCoverage>();
if ( defaultRange){
rangeString = raster->datadef().domain()->range()->toString();
}else{
if ( calc){
raster->loadData();
raster->statistics(NumericStatistics::pBASIC);
}
rangeString = raster->datadef().range()->toString();
}
} else if ( hasType( objectype , itFEATURE)){
IFeatureCoverage features = _ilwisobject.as<FeatureCoverage>();
ColumnDefinition coldef = features->attributeDefinitions().columndefinition(COVERAGEKEYCOLUMN);
if ( coldef.isValid()){
if ( defaultRange)
rangeString = coldef.datadef().domain()->range()->toString();
else{
if ( calc){
features->loadData();
std::vector<QVariant> data = features->attributeTable()->column(columnName);
if ( data.size() != 0){
std::vector<double> values(data.size());
int i=0;
for(auto v : data)
values[i++] = v.toDouble();
NumericStatistics stats; // realy like to do this with a template specialization of the proper calculate function, but the syntax was unclear to me
stats.calculate(values.begin(), values.end());
NumericRange *rng = new NumericRange(stats.prop(NumericStatistics::pMIN),stats.prop(NumericStatistics::pMAX));
features->attributeDefinitionsRef().columndefinitionRef(columnName).datadef().range(rng);
}
}
rangeString = coldef.datadef().range()->toString();
}
}
} else if ( hasType( objectype , itDOMAIN)){
rangeString = _ilwisobject.as<Domain>()->range()->toString();
}
}
return rangeString;
}catch(const ErrorObject& ){
// no exceptions may escape here
}
return "";
}
示例4: valuetype
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 "";
}
示例5: initialize
IIlwisObject OperationHelperRaster::initialize(const IIlwisObject &inputObject, IlwisTypes tp, quint64 what)
{
Resource resource(tp);
if (inputObject->ilwisType() & itCOVERAGE) {
ICoverage cov = inputObject.as<Coverage>();
if (inputObject->ilwisType() == itRASTER) {
IRasterCoverage gcInput = inputObject.as<RasterCoverage>();
if ( what & itRASTERSIZE) {
Size<> sz = gcInput->size();
BoundingBox box(sz);
resource.addProperty("size", IVARIANT(box.size()));
}
if ( what & itGEOREF) {
resource.addProperty("georeference", IVARIANT(gcInput->georeference()));
}
if ( what & itDOMAIN) {
resource.addProperty("domain", IVARIANT(gcInput->datadef().domain()));
}
}
if ( what & itCOORDSYSTEM) {
resource.addProperty("coordinatesystem", IVARIANT(cov->coordinateSystem()));
}
}
resource.prepare();
IIlwisObject obj;
obj.prepare(resource);
if (inputObject->ilwisType() & itCOVERAGE) {
OperationHelper::initialize(inputObject, obj, tp, what);
}
return obj;
}
示例6: findParameterDataDef
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;
}
示例7: findParameterDataDef
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;
}
示例8: datadef
DataDefinition MapCalc::datadef(int index)
{
auto iterP = _inputRasters.find(index);
if ( iterP != _inputRasters.end()){
IRasterCoverage raster = _inputRasters[index].raster();
return raster->datadef();
}
return DataDefinition();
}
示例9: prepare
bool RasterLayerDrawer::prepare(DrawerInterface::PreparationType prepType, const IOOptions &options)
{
if(!LayerDrawer::prepare(prepType, options))
return false;
IRasterCoverage raster = coverage().as<RasterCoverage>();
if ( !_rasterImage){
setActiveVisualAttribute(PIXELVALUE);
_visualAttribute = visualProperty(activeAttribute());
_rasterImage.reset(RasterImageFactory::create(raster->datadef().domain()->ilwisType(), rootDrawer(),raster,_visualAttribute,IOOptions()));
if (!_rasterImage){
ERROR2(ERR_NO_INITIALIZED_2,"RasterImage",raster->name());
return false;
}
}
if ( hasType(prepType, ptSHADERS) && !isPrepared(ptSHADERS)){
_texcoordid = _shaders.attributeLocation("texCoord");
_textureid = _shaders.uniformLocation( "tex" );
_prepared |= DrawerInterface::ptSHADERS;
}
if ( hasType(prepType, DrawerInterface::ptGEOMETRY) && !isPrepared(DrawerInterface::ptGEOMETRY)){
Envelope env = rootDrawer()->coordinateSystem()->convertEnvelope(raster->coordinateSystem(), raster->envelope());
_vertices.resize(6);
_vertices[0] = QVector3D(env.min_corner().x, env.min_corner().y, 0);
_vertices[1] = QVector3D(env.max_corner().x, env.min_corner().y, 0);
_vertices[2] = QVector3D(env.min_corner().x, env.max_corner().y, 0);
_vertices[3] = QVector3D(env.max_corner().x, env.min_corner().y, 0);
_vertices[4] = QVector3D(env.max_corner().x, env.max_corner().y, 0);
_vertices[5] = QVector3D(env.min_corner().x, env.max_corner().y, 0);
_texcoords.resize(6);
_texcoords = {{0,1},{1,1},{0,0},
{1,1},{1,0},{0,0}
};
_prepared |= ( DrawerInterface::ptGEOMETRY);
}
if ( hasType(prepType, DrawerInterface::ptRENDER) && !isPrepared(DrawerInterface::ptRENDER)){
setActiveVisualAttribute(PIXELVALUE);
_visualAttribute = visualProperty(activeAttribute());
_rasterImage->visualAttribute(_visualAttribute);
_prepared |= ( DrawerInterface::ptRENDER);
}
if (_rasterImage->prepare((int)prepType)){
_texture.reset( new QOpenGLTexture(*(_rasterImage->image().get())));
_texture->setMinMagFilters(QOpenGLTexture::Nearest,QOpenGLTexture::Nearest);
}
return true;
}
示例10: coverage
void RasterLayerDrawer::coverage(const ICoverage &cov)
{
LayerDrawer::coverage(cov);
setActiveVisualAttribute(PIXELVALUE);
IRasterCoverage raster = cov.as<RasterCoverage>();
if (!raster.isValid())
return;
// fot the moment test only single band value maps with no attribute table; will extend when this works
IlwisTypes attrType = raster->datadef().domain()->valueType();
VisualAttribute attr(raster->datadef().domain());
if ( hasType(attrType, itNUMBER)){
auto numrange = raster->datadef().range<NumericRange>();
attr.actualRange(NumericRange(numrange->min(), numrange->max(), numrange->resolution()));
visualProperty(PIXELVALUE, attr);
} else if ( hasType(attrType, itCONTINUOUSCOLOR)){
visualProperty(PIXELVALUE, attr);
}else if ( hasType(attrType, itPALETTECOLOR)){
auto colorrange = raster->datadef().range<ColorPalette>();
}
}
示例11: toString
QString IlwisObjectModel::value2string(const QVariant &value, const QString &attrName)
{
auto v2s = [](const ColumnDefinition& coldef, const QVariant& value)->QString {
if ( coldef.isValid()){
if ( coldef.datadef().domain()->ilwisType() == itTEXTDOMAIN)
return value.toString();
return coldef.datadef().domain()->impliedValue(value).toString();
}
if ( value.toDouble() == rUNDEF)
return sUNDEF;
return value.toString();
};
if ( attrName != "") {
IlwisTypes objectype = _ilwisobject->ilwisType();
if ( hasType(objectype, itFEATURE)){
IFeatureCoverage features = _ilwisobject.as<FeatureCoverage>();
ColumnDefinition coldef = features->attributeDefinitions().columndefinition(attrName);
return v2s(coldef, value);
}else if (hasType(objectype, itRASTER)){
IRasterCoverage raster = _ilwisobject.as<RasterCoverage>();
if ( raster->hasAttributes()){
ColumnDefinition coldef = raster->attributeTable()->columndefinition(attrName);
return v2s(coldef, value);
}
if ( raster->datadef().domain()->ilwisType() == itCOLORDOMAIN){
auto clr = ColorRangeBase::toColor(value, ColorRangeBase::cmRGBA);
return ColorRangeBase::toString(clr,ColorRangeBase::cmRGBA) ;
}
}
}
if ( value.toDouble() == rUNDEF)
return sUNDEF;
return value.toString();
}
示例12: execute
bool SelectionRaster::execute(ExecutionContext *ctx, SymbolTable& symTable)
{
if (_prepState == sNOTPREPARED)
if((_prepState = prepare(ctx, symTable)) != sPREPARED)
return false;
IRasterCoverage outputRaster = _outputObj.as<RasterCoverage>();
IRasterCoverage inputRaster = _inputObj.as<RasterCoverage>();
std::map<Raw, quint32> raw2record;
int keyColumn = _inputAttributeTable.isValid() ? _inputAttributeTable->columnIndex(inputRaster->primaryKey()) : iUNDEF;
if (keyColumn != iUNDEF){
std::vector<QVariant> values = _inputAttributeTable->column(keyColumn);
for(quint32 rec=0; rec < values.size(); ++rec){
Raw r = values[rec].toDouble();
if ( !isNumericalUndef(r)){
raw2record[r] = rec;
}
}
}
std::vector<int> extraAtrrib = organizeAttributes();
std::vector<QString> selectionBands = bands(inputRaster);
initialize(outputRaster->size().linearSize() * selectionBands.size());
PixelIterator iterOut(outputRaster);
int count = 0;
bool numeric = outputRaster->datadef().domain()->ilwisType() == itNUMERICDOMAIN;
for(QString band : selectionBands){
PixelIterator iterIn = inputRaster->band(band, _box);
PixelIterator iterEnd = iterIn.end();
while(iterIn != iterEnd) {
bool ok = true;
double pixValue = *iterIn;
double matchValue = pixValue;
for(const auto& epart : _expressionparts){
bool partOk = epart.match(iterIn.position(), matchValue,this);
if ( epart._andor != loNONE)
ok = epart._andor == loAND ? ok && partOk : ok || partOk;
else
ok &= partOk;
if (epart._type == ExpressionPart::ptATTRIBUTE && extraAtrrib.size() == 1){
if ( pixValue < 0 || pixValue >= _inputAttributeTable->recordCount()){
ok = false;
continue;
}
// pixValue == ID; ID < zero means undef, ID's start at zero.
if (pixValue >= 0) {
if (keyColumn != iUNDEF){
auto iter = raw2record.find(pixValue);
if ( iter != raw2record.end()){
quint32 rec = iter->second;
const Record& record = _inputAttributeTable->record(rec);
pixValue = record.cell(extraAtrrib[0]).toDouble();
}else
pixValue = rUNDEF;
}
}
else
pixValue = rUNDEF;
}
}
if ( ok){
*iterOut = pixValue;
}else
*iterOut = rUNDEF;
++iterIn;
++iterOut;
updateTranquilizer(++count, 100);
}
// if there is an attribute table we must copy the correct attributes and records
if ( keyColumn != iUNDEF && _attTable.isValid()){
for(int recIndex=0; recIndex < _inputAttributeTable->recordCount(); ++recIndex){
const Record& rec = _inputAttributeTable->record(recIndex);
for(int i=0; i < extraAtrrib.size(); ++i){
_attTable->setCell(i, recIndex, rec.cell(extraAtrrib[i]));
}
}
}
}
if ( numeric)
outputRaster->statistics(ContainerStatistics<double>::pBASIC);
outputRaster->setAttributes(_attTable);
QVariant value;
value.setValue<IRasterCoverage>(outputRaster);
logOperation(outputRaster, _expression);
ctx->setOutput(symTable, value, outputRaster->name(), itRASTER,outputRaster->resource());
return true;
}
示例13: resource
Ilwis::OperationImplementation::State SelectionRaster::prepare(ExecutionContext *ctx, const SymbolTable &st)
{
OperationImplementation::prepare(ctx,st);
if ( _expression.parameterCount() != 2) {
ERROR3(ERR_ILLEGAL_NUM_PARM3,"rasvalue","1",QString::number(_expression.parameterCount()));
return sPREPAREFAILED;
}
IlwisTypes inputType = itRASTER;
QString raster = _expression.parm(0).value();
if (!_inputObj.prepare(raster, inputType)) {
ERROR2(ERR_COULD_NOT_LOAD_2,raster,"");
return sPREPAREFAILED;
}
IRasterCoverage inputRaster = _inputObj.as<RasterCoverage>();
_inputAttributeTable = inputRaster->attributeTable();
quint64 copylist = itCOORDSYSTEM ;
QString selector = _expression.parm(1).value();
parseSelector(selector, inputRaster);
std::vector<QString> selectionBands = bands(inputRaster);
_box = boundingBox(_inputObj.as<RasterCoverage>());
bool useOldGrf ;
if ( _box.isNull() || !_box.isValid()){
_box = inputRaster->size();
useOldGrf = true;
} else
useOldGrf = false;
if ( useOldGrf){
copylist |= itGEOREF | itRASTERSIZE | itENVELOPE;
}
int selectedAttributes = attributeNames().size();
if (selectedAttributes != 1)
copylist |= itDOMAIN;
_outputObj = OperationHelperRaster::initialize(_inputObj,inputType, copylist);
if ( !_outputObj.isValid()) {
ERROR1(ERR_NO_INITIALIZED_1, "output coverage");
return sPREPAREFAILED;
}
IRasterCoverage outputRaster = _outputObj.as<RasterCoverage>();
QString outputName = _expression.parm(0,false).value();
if ( outputName != sUNDEF)
_outputObj->name(outputName);
if ( selectedAttributes > 1) {
QString url = INTERNAL_CATALOG + "/" + outputName;
Resource resource(url, itFLATTABLE);
_attTable.prepare(resource);
}
if ( selectedAttributes == 1 && _inputAttributeTable.isValid()){
QStringList names = attributeNames();
//outputRaster->datadefRef().domain(_inputAttributeTable->columndefinition(names[0]).datadef().domain());
outputRaster->setDataDefintions(_inputAttributeTable->columndefinition(names[0]).datadef().domain(), selectionBands, inputRaster->stackDefinition().domain());
}else
outputRaster->setDataDefintions(inputRaster->datadef().domain(), selectionBands, inputRaster->stackDefinition().domain());
if ( (copylist & itGEOREF) == 0) {
Resource resource(QUrl(INTERNAL_CATALOG + "/" + outputRaster->name() + "_grf_" + QString::number(outputRaster->id())),itGEOREF);
resource.addProperty("size", IVARIANT(_box.size()));
auto envelope = inputRaster->georeference()->pixel2Coord(_box);
resource.addProperty("envelope", IVARIANT(envelope));
resource.addProperty("coordinatesystem", IVARIANT(inputRaster->coordinateSystem()));
resource.addProperty("name", _outputObj->name());
resource.addProperty("centerofpixel",inputRaster->georeference()->centerOfPixel());
IGeoReference grf;
grf.prepare(resource);
outputRaster->georeference(grf);
outputRaster->envelope(envelope);
}
return sPREPARED;
}
示例14: resource
Ilwis::OperationImplementation::State Selection::prepare(ExecutionContext *, const SymbolTable &)
{
if ( _expression.parameterCount() != 2) {
ERROR3(ERR_ILLEGAL_NUM_PARM3,"rasvalue","1",QString::number(_expression.parameterCount()));
return sPREPAREFAILED;
}
IlwisTypes inputType = itRASTER;
QString raster = _expression.parm(0).value();
if (!_inputObj.prepare(raster, inputType)) {
ERROR2(ERR_COULD_NOT_LOAD_2,raster,"");
return sPREPAREFAILED;
}
IRasterCoverage inputRaster = _inputObj.as<RasterCoverage>();
quint64 copylist = itCOORDSYSTEM;
QString selector = _expression.parm(1).value();
selector = selector.remove('"');
int index = selector.indexOf("box=");
Envelope box;
if ( index != -1) {
QString crdlist = "box(" + selector.mid(index+4) + ")";
_box = BoundingBox(crdlist);
box = inputRaster->georeference()->pixel2Coord(_box);
copylist |= itDOMAIN | itTABLE;
std::vector<qint32> vec{_box.min_corner().x, _box.min_corner().y,_box.min_corner().z};
_base = vec;
}
index = selector.indexOf("polygon=");
if ( index != -1)
{
//TODO:
copylist |= itDOMAIN | itTABLE;
}
index = selector.indexOf("attribute=");
if ( index != -1 ) {
if (! inputRaster->attributeTable().isValid()) {
ERROR2(ERR_NO_FOUND2,"attribute-table", "coverage");
return sPREPAREFAILED;
}
_attribColumn = selector.mid(index+10);
copylist |= itRASTERSIZE | itGEOREF | itENVELOPE;
}
int indexindex = selector.indexOf("index=");
if ( indexindex != -1) {
copylist |= itDOMAIN | itGEOREF | itENVELOPE | itTABLE;
_box = BoundingBox(inputRaster->size());
QString zvalues = selector.mid(6);
bool ok;
_zvalue = zvalues.toInt(&ok);
if ( !ok || _zvalue < 0) {
ERROR3(ERR_ILLEGAL_PARM_3, TR("layer index"), zvalues,"Selection");
return sPREPAREFAILED;
}
_box.min_corner().z = _zvalue;
_box.max_corner().z = _zvalue;
std::vector<qint32> vec{_box.min_corner().x, _box.min_corner().y,_box.min_corner().z};
_base = vec;
}
_outputObj = OperationHelperRaster::initialize(_inputObj,inputType, copylist);
if ( !_outputObj.isValid()) {
ERROR1(ERR_NO_INITIALIZED_1, "output coverage");
return sPREPAREFAILED;
}
IRasterCoverage outputRaster = _outputObj.as<RasterCoverage>();
if ( (copylist & itDOMAIN) == 0) {
outputRaster->datadefRef() = _attribColumn != "" ? inputRaster->attributeTable()->columndefinition(_attribColumn).datadef()
: outputRaster->datadefRef() = inputRaster->datadef();
}
QString outputName = _expression.parm(0,false).value();
if ( outputName != sUNDEF)
_outputObj->name(outputName);
if ( (copylist & itGEOREF) == 0) {
Resource resource(QUrl("ilwis://internalcatalog/georeference"),itGEOREF);
resource.addProperty("size", IVARIANT(_box.size()));
resource.addProperty("envelope", IVARIANT(box));
resource.addProperty("coordinatesystem", IVARIANT(inputRaster->coordinateSystem()));
resource.addProperty("name", _outputObj->name());
resource.addProperty("centerofpixel",inputRaster->georeference()->centerOfPixel());
IGeoReference grf;
grf.prepare(resource);
outputRaster->georeference(grf);
outputRaster->envelope(box);
}
if(indexindex != -1) {
Size<> sz(outputRaster->size().xsize(),outputRaster->size().xsize(), 1);
outputRaster->size(sz);
}
return sPREPARED;
}
示例15: AttributeModel
QQmlListProperty<AttributeModel> IlwisObjectModel::attributes()
{
try {
if ( _attributes.size() == 0){
if ( _ilwisobject.isValid()) {
IlwisTypes objecttype = _ilwisobject->ilwisType();
if ( objecttype == itRASTER){
IRasterCoverage raster = _ilwisobject.as<RasterCoverage>();
if ( raster->hasAttributes()){
for(int i = 0; i < raster->attributeTable()->columnCount(); ++i){
AttributeModel *attribute = new AttributeModel(raster->attributeTable()->columndefinition(i), this, _ilwisobject);
_attributes.push_back(attribute);
}
}else {
AttributeModel *attribute = new AttributeModel(ColumnDefinition(PIXELVALUE, raster->datadef(),i64UNDEF), this, _ilwisobject);
_attributes.push_back(attribute);
}
} else if ( hasType(objecttype,itFEATURE)){
IFeatureCoverage features = _ilwisobject.as<FeatureCoverage>();
for(int i = 0; i < features->attributeDefinitions().definitionCount(); ++i){
AttributeModel *attribute = new AttributeModel(features->attributeDefinitions().columndefinition(i), this, _ilwisobject);
_attributes.push_back(attribute);
}
} else if ( hasType(objecttype,itTABLE)){
ITable tbl = _ilwisobject.as<Table>();
for(int i = 0; i < tbl->columnCount(); ++i){
AttributeModel *attribute = new AttributeModel(tbl->columndefinition(i), this, _ilwisobject);
_attributes.push_back(attribute);
}
}
}
}
if ( _attributes.size() > 0){
return QQmlListProperty<AttributeModel>(this, _attributes) ;
}
}
catch(const ErrorObject& ){
// no exceptions may escape here
}
return QQmlListProperty<AttributeModel>();
}