当前位置: 首页>>代码示例>>C++>>正文


C++ CoordinateSystem::prepare方法代码示例

本文整理汇总了C++中CoordinateSystem::prepare方法的典型用法代码示例。如果您正苦于以下问题:C++ CoordinateSystem::prepare方法的具体用法?C++ CoordinateSystem::prepare怎么用?C++ CoordinateSystem::prepare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CoordinateSystem的用法示例。


在下文中一共展示了CoordinateSystem::prepare方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(){
  int xsize, ysize;
  unsigned char * imgbuf;
  double inFluxScale;
#ifdef _WIN32
  if (!loadBitmap("G:\\sources2\\__BR\\RC\\crocodile\\reprojection-pseudocode\\lovell.bmp", &xsize, &ysize, &imgbuf, &inFluxScale)){
#else
  if (!loadBitmap("/home/awson/data/Work/crocodile/reprojection-pseudocode/lovell.bmp", &xsize, &ysize, &imgbuf, &inFluxScale)){
#endif
    printf("Can't load the input!");
    return -1;
  }
  CoordinateSystem inCS = {
  	{0, 0}
  , {500, 500}
  , { {-0.000027778, 0}
  	, { 0, 0.000027778}
    }
  };
  inCS.prepare();
  CoordinateSystem outCS = {
  	{0, 0}
  , {500, 500}
  , { {-0.00002, -0.00002}
  	, {-0.00002,  0.00002}
    }
  };
  outCS.prepare();

  vector<double> inp(xsize * ysize);
  vector<double> outp(xsize * ysize);

  unsigned char * it = imgbuf;
  for (double & v : inp) v = double(*it++);

  printf("Start repro ...\n");
  reprojection(
      inCS
    , outCS
    , {xsize, ysize}
    , {xsize, ysize}
    , inp.data()
    , outp.data()
  );
  printf("Done repro!\n");

  // Dirty! Reuse imgbuf.
  it = imgbuf;
  for (double v : outp) *it++ = (unsigned char)(min(255.0, v));

  saveBitmap("image.bmp", xsize, ysize, imgbuf, inFluxScale * pixelAreaRatio(inCS, outCS));
  free(imgbuf);
}
开发者ID:SKA-ScienceDataProcessor,项目名称:RC,代码行数:53,代码来源:reprojection.cpp

示例2: if

IlwisObject *InternalIlwisObjectFactory::createCsyFromCode(const Resource& resource, const IOOptions &options) const {
    QString code = resource.code();
    bool isUnknown = code == "unknown" || code == "csy:unknown";
    QString projParms = code;
    if ( code.left(6) == "proj4:"){
        projParms = code.mid(6);
    }else if(!isUnknown && code.left(5) == "epsg:"){
        QString query = QString("select * from projectedcsy where code='%1'").arg(code);
        InternalDatabaseConnection db;
        if ( db.exec(query)) {
            if (db.next()) {
                QSqlRecord rec = db.record();
                projParms = rec.value("proj_params").toString();
            } else {
                kernel()->issues()->log(TR(ERR_COULDNT_CREATE_OBJECT_FOR_2).arg("coordinatesystem", resource.name()));
                return 0;
            }
        }
    }
    CoordinateSystem *csy = 0;
    if ( isUnknown){
        csy = createFromResource<BoundsOnlyCoordinateSystem>(resource, options);
        csy->name("unknown");
        csy->code("unknown");
        csy->setDescription(TR("Unknown coordinate system"));
    }else {
        csy = createFromResource<ConventionalCoordinateSystem>(resource, options);
        csy->setDescription(resource.name());
        csy->prepare("proj4=" + projParms);
    }

    return csy;

}
开发者ID:MartinSchouwenburg,项目名称:IlwisTest,代码行数:34,代码来源:internalilwisobjectfactory.cpp


注:本文中的CoordinateSystem::prepare方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。