本文整理汇总了C++中IRasterCoverage::datadefRef方法的典型用法代码示例。如果您正苦于以下问题:C++ IRasterCoverage::datadefRef方法的具体用法?C++ IRasterCoverage::datadefRef怎么用?C++ IRasterCoverage::datadefRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRasterCoverage
的用法示例。
在下文中一共展示了IRasterCoverage::datadefRef方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setAttribute
void IlwisObjectModel::setAttribute(const QString &attrname, const QString &value, const QString &extra)
{
if ( _ilwisobject.isValid()){
if ( attrname == "domain"){
IDomain dom(value);
if ( _ilwisobject->ilwisType() == itRASTER){
IRasterCoverage raster = _ilwisobject.as<RasterCoverage>();
if ( dom->id() != raster->datadefRef().domain()->id()){
raster->datadefRef().domain(dom);
raster->changed(true);
mastercatalog()->changeResource(raster->id(),"domain",dom->id(), true);
}
}
}
}
}
示例2: 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;
}