本文整理汇总了C++中IRasterCoverage类的典型用法代码示例。如果您正苦于以下问题:C++ IRasterCoverage类的具体用法?C++ IRasterCoverage怎么用?C++ IRasterCoverage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IRasterCoverage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AttributeModel
void IlwisObjectModel::resetAttributeModel(const QString& attributeName){
auto setAttributeModel = [&](int i, const ColumnDefinition& coldef, const QString& attributeName){
if ( coldef.name() == attributeName){
AttributeModel *attribute = new AttributeModel(coldef, this, _ilwisobject);
_attributes[i] = attribute;
}
};
IlwisTypes objecttype = _ilwisobject->ilwisType();
if ( objecttype == itRASTER){
IRasterCoverage raster = _ilwisobject.as<RasterCoverage>();
if ( raster->hasAttributes()){
for(int i = 0; i < raster->attributeTable()->columnCount(); ++i){
setAttributeModel(i,raster->attributeTable()->columndefinition(i), attributeName);
}
}
} else if ( hasType(objecttype,itFEATURE)){
IFeatureCoverage features = _ilwisobject.as<FeatureCoverage>();
for(int i = 0; i < features->attributeDefinitions().definitionCount(); ++i){
setAttributeModel(i,features->attributeTable()->columndefinition(i), attributeName);
}
} else if ( hasType(objecttype,itTABLE)){
ITable tbl = _ilwisobject.as<Table>();
for(int i = 0; i < tbl->columnCount(); ++i){
setAttributeModel(i,tbl->columndefinition(i),attributeName);
}
}
}
示例2: resource
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;
}
示例3: 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 "";
}
示例4: changeCoords
void CrosssectionTool::changeCoords(int index, int c, int r, bool useScreenPixels)
{
if (index >= 0 && index < _pins.size()) {
if (_panelCoverage->ilwisType() == itRASTER) {
IRasterCoverage raster = _panelCoverage.as<RasterCoverage>();
if (raster.isValid()) {
Coordinate crd;
if (useScreenPixels) {
crd = vpmodel()->layer()->layerManager()->rootLayer()->screenGrf()->pixel2Coord(Pixel(c, r));
Pixel pix = raster->georeference()->coord2Pixel(crd);
c = pix.x;
r = pix.y;
}
crd = raster->georeference()->pixel2Coord(Pixel(c, r));
_pins[index]->x(crd.x);
_pins[index]->y(crd.y);
_pins[index]->column(c);
_pins[index]->row(r);
_pins[index]->update();
vpmodel()->layer()->layerManager()->updatePostDrawers();
changePinData(index, crd);
}
}
}
}
示例5: doRasterOperation
IRasterCoverage operator*(const IRasterCoverage &raster1, const IRasterCoverage &raster2)
{
QString name = Identity::newAnonymousName();;
QString stmt = QString("script %1=%2 * %3").arg(name).arg(raster1->name()).arg(raster2->name());
return doRasterOperation(stmt);
}
示例6: op
void OperationWorker::process(){
try {
Operation op(_expression);
SymbolTable tbl;
ExecutionContext ctx;
if(op->execute(&ctx, tbl)){
if ( ctx._results.size() > 0){
for(auto resultName : ctx._results){
Symbol symbol = tbl.getSymbol(resultName);
if ( hasType(symbol._type, itNUMBER)){
result += symbol._var.toDouble();
}else if ( hasType(symbol._type, itSTRING)){
result += symbol._var.toString();
}else if ( hasType(symbol._type, (itCOVERAGE | itTABLE))){
if ( symbol._type == itRASTER){
IRasterCoverage raster = symbol._var.value<IRasterCoverage>();
if ( raster.isValid())
result = raster->source().url().toString();
}
}
}
}
}else {
qDebug() << "operation failed";
}
emit finished();
}catch(const ErrorObject& err){
}
emit finished();
}
示例7: 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;
}
示例8: 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);
}
}
示例9:
void SelectionBase::ExpressionPart::setEnvelopePolygon(const IRasterCoverage& raster)
{
double deltax = _envelope.size().xsize() / 10.0;
double deltay = _envelope.size().ysize() / 10.0;
std::vector<geos::geom::Coordinate> *coords = new std::vector<geos::geom::Coordinate>();
double x,y = _envelope.min_corner().y;
for(x = _envelope.min_corner().x; x < _envelope.max_corner().x; x+= deltax){
Pixel px = raster->georeference()->coord2Pixel(Coordinate(x,y));
coords->push_back(geos::geom::Coordinate(px.x, px.y,0));
}
for(y = _envelope.min_corner().y; y < _envelope.max_corner().y; y+= deltay){
Pixel px = raster->georeference()->coord2Pixel(Coordinate(x,y));
coords->push_back(geos::geom::Coordinate(px.x, px.y,0));
}
for(x = _envelope.max_corner().x; x > _envelope.min_corner().x; x-= deltax){
Pixel px = raster->georeference()->coord2Pixel(Coordinate(x,y));
coords->push_back(geos::geom::Coordinate(px.x, px.y,0));
}
for(y = _envelope.max_corner().y; y > _envelope.min_corner().y; y-= deltay){
Pixel px = raster->georeference()->coord2Pixel(Coordinate(x,y));
coords->push_back(geos::geom::Coordinate(px.x, px.y,0));
}
Pixel px = raster->georeference()->coord2Pixel(Coordinate(_envelope.min_corner().x,_envelope.min_corner().y));
coords->push_back(geos::geom::Coordinate(px.x, px.y,0));
geos::geom::CoordinateArraySequence *points = new geos::geom::CoordinateArraySequence(coords);
geos::geom::LinearRing *ring = _geomfactory->createLinearRing(points);
_polygon.reset( _geomfactory->createPolygon(ring, 0));
}
示例10: 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;
}
示例11: kernel
Ilwis::OperationImplementation::State CreateSimpelRasterCoverage::prepare(ExecutionContext *ctx,const SymbolTable&){
IRasterCoverage inputRaster;
if ( _expression.parm(0).valuetype() == itRASTER){
if(!inputRaster.prepare(_expression.input<QString>(0))){
kernel()->issues()->log(TR("Invalid raster used to create new raster:") + _expression.input<QString>(0));
return sPREPAREFAILED;
}
_outputRaster = OperationHelperRaster::initialize(inputRaster,itRASTER,itRASTERSIZE|itDOMAIN|itCOORDSYSTEM|itGEOREF);
return sPREPARED;
}
QString grf = _expression.input<QString>(0);
if ( ! _grf.prepare(grf)){
kernel()->issues()->log(QString(TR("%1 is and invalid georeference")).arg(grf));
return sPREPAREFAILED;
}
_empty = _expression.input<bool>(1);
_domain.prepare("code=domain:value");
_stackDomain = IDomain("count");
if (!_empty){
_stackValueStrings = {"1"};
_stackValueNumbers = {1};
}
_outputRaster.prepare();
_outputRaster->georeference(_grf);
_outputRaster->setDataDefintions(_domain, _stackValueNumbers , _stackDomain);
return sPREPARED;
}
示例12: doRasterOperation
IRasterCoverage operator*(const IRasterCoverage &raster1, const IRasterCoverage &raster2)
{
QString name = ANONYMOUS_PREFIX;
QString stmt = QString("script %1=%2 * %3").arg(name).arg(raster1->name()).arg(raster2->name());
return doRasterOperation(stmt);
}
示例13: runApplication
bool runApplication( OperationExpression opExpr, QString *result){
Operation op(opExpr);
SymbolTable tbl;
ExecutionContext ctx;
if(op->execute(&ctx, tbl)){
if ( ctx._results.size() > 0){
for(auto resultName : ctx._results){
Symbol symbol = tbl.getSymbol(resultName);
if ( hasType(symbol._type, itNUMBER)){
*result += symbol._var.toDouble();
}else if ( hasType(symbol._type, itSTRING)){
*result += symbol._var.toString();
}else if ( hasType(symbol._type, (itCOVERAGE | itTABLE))){
if ( symbol._type == itRASTER){
IRasterCoverage raster = symbol._var.value<IRasterCoverage>();
QUrl url = raster->source().container();
}
}
}
}
return true;
}
return false;
}
示例14: mastercatalog
void GridBlockInternal::fetchFromSource()
{
IIlwisObject obj = mastercatalog()->get(_rasterid);
if ( obj.isValid()){
IRasterCoverage raster = obj.as<RasterCoverage>();
raster->getData(_id);
}
}
示例15: maxC
int CrosssectionTool::maxC() const {
if (_panelCoverage.isValid() && _panelCoverage->ilwisType() == itRASTER) {
IRasterCoverage raster = _panelCoverage.as<RasterCoverage>();
if (raster.isValid()) {
return raster->georeference()->size().xsize();
}
}
return 0;
}