本文整理汇总了C++中boost::shared_ptr::Error方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::Error方法的具体用法?C++ shared_ptr::Error怎么用?C++ shared_ptr::Error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::Error方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _createmapniklayer
int _createmapniklayer(const std::string& sLayerName, const std::string& sLayerPath, const std::vector<double>& vecBoundary, boost::shared_ptr<Logger> qLogger)
{
if (!FileSystem::makedir(sLayerPath))
{
qLogger->Error("Can't create directory " + sLayerPath);
return ERROR_LAYERDIR;
}
boost::shared_ptr<PointLayerSettings> qPointLayerSettings = boost::shared_ptr<PointLayerSettings>(new PointLayerSettings());
if (!qPointLayerSettings) {return ERROR_OUTOFMEMORY;}
qPointLayerSettings->SetLayerName(sLayerName);
qPointLayerSettings->SetBoundary(vecBoundary[0], vecBoundary[1], vecBoundary[2], vecBoundary[3], vecBoundary[4], vecBoundary[5]);
if (!qPointLayerSettings->Save(sLayerPath))
{
qLogger->Error("Can't write into layer path: " + sLayerPath);
return ERROR_WRITE_PERMISSION;
}
return 0;
}
示例2: _createimagelayer
int _createimagelayer(const std::string& sLayerName, const std::string& sLayerPath, int nLod, const std::vector<int64>& vecExtent, boost::shared_ptr<Logger> qLogger, bool temp)
{
if (!FileSystem::makedir(sLayerPath))
{
qLogger->Error("Can't create directory " + sLayerPath);
return ERROR_LAYERDIR;
}
boost::shared_ptr<ImageLayerSettings> qImageLayerSettings = boost::shared_ptr<ImageLayerSettings>(new ImageLayerSettings());
if (!qImageLayerSettings) {return ERROR_OUTOFMEMORY;}
qImageLayerSettings->SetLayerName(sLayerName);
qImageLayerSettings->SetMaxLod(nLod);
qImageLayerSettings->SetTileExtent(vecExtent[0], vecExtent[1], vecExtent[2], vecExtent[3]);
if (!qImageLayerSettings->Save(sLayerPath))
{
qLogger->Error("Can't write into layer path: " + sLayerPath);
return ERROR_WRITE_PERMISSION;
}
return _createDirectoriesXY(sLayerPath, qLogger, vecExtent, nLod, temp);
}
示例3: process
int process( boost::shared_ptr<Logger> qLogger, boost::shared_ptr<ProcessingSettings> qSettings, std::string sLayer, bool bVerbose, bool bLock, int epsg, std::string sImagefile, bool bFill, int& out_lod, int64& out_x0, int64& out_y0, int64& out_x1, int64& out_y1)
{
DataSetInfo oInfo;
if (!ProcessingUtils::init_gdal())
{
qLogger->Error("gdal-data directory not found!");
return ERROR_GDAL;
}
//---------------------------------------------------------------------------
// Retrieve ImageLayerSettings:
std::ostringstream oss;
std::string sImageLayerDir = FilenameUtils::DelimitPath(qSettings->GetPath()) + sLayer;
std::string sTileDir = FilenameUtils::DelimitPath(FilenameUtils::DelimitPath(sImageLayerDir) + "tiles");
boost::shared_ptr<ImageLayerSettings> qImageLayerSettings = ImageLayerSettings::Load(sImageLayerDir);
if (!qImageLayerSettings)
{
qLogger->Error("Failed retrieving image layer settings! Make sure to create it using 'createlayer'.");
ProcessingUtils::exit_gdal();
return ERROR_IMAGELAYERSETTINGS;
}
int lod = qImageLayerSettings->GetMaxLod();
out_lod = lod;
int64 layerTileX0, layerTileY0, layerTileX1, layerTileY1;
qImageLayerSettings->GetTileExtent(layerTileX0, layerTileY0, layerTileX1, layerTileY1);
if (bVerbose)
{
oss << "\nImage Layer:\n";
oss << " name = " << qImageLayerSettings->GetLayerName() << "\n";
oss << " maxlod = " << lod << "\n";
oss << " extent = " << layerTileX0 << ", " << layerTileY0 << ", " << layerTileX1 << ", " << layerTileY1 << "\n";
}
//---------------------------------------------------------------------------
boost::shared_ptr<CoordinateTransformation> qCT;
qCT = boost::shared_ptr<CoordinateTransformation>(new CoordinateTransformation(epsg, 3785));
clock_t t0,t1;
t0 = clock();
ProcessingUtils::RetrieveDatasetInfo(sImagefile, qCT.get(), &oInfo, bVerbose);
if (!oInfo.bGood)
{
qLogger->Error("Failed retrieving info!");
}
if (bVerbose)
{
oss << "Loaded image info:\n Image Size: w= " << oInfo.nSizeX << ", h= " << oInfo.nSizeY << "\n";
oss << " dest: " << oInfo.dest_lrx << ", " << oInfo.dest_lry << ", " << oInfo.dest_ulx << ", " << oInfo.dest_uly << "\n";
qLogger->Info(oss.str());
oss.str("");
}
boost::shared_ptr<MercatorQuadtree> qQuadtree = boost::shared_ptr<MercatorQuadtree>(new MercatorQuadtree());
int64 px0, py0, px1, py1;
qQuadtree->MercatorToPixel(oInfo.dest_ulx, oInfo.dest_uly, lod, px0, py0);
qQuadtree->MercatorToPixel(oInfo.dest_lrx, oInfo.dest_lry, lod, px1, py1);
int64 imageTileX0, imageTileY0, imageTileX1, imageTileY1;
qQuadtree->PixelToTileCoord(px0, py0, imageTileX0, imageTileY0);
qQuadtree->PixelToTileCoord(px1, py1, imageTileX1, imageTileY1);
if (bVerbose)
{
oss << "\nTile Coords (image):";
oss << " (" << imageTileX0 << ", " << imageTileY0 << ")-(" << imageTileX1 << ", " << imageTileY1 << ")\n";
qLogger->Info(oss.str());
oss.str("");
}
// check if image is outside layer
if (imageTileX0 > layerTileX1 ||
imageTileY0 > layerTileY1 ||
imageTileX1 < layerTileX0 ||
imageTileY1 < layerTileY0)
{
qLogger->Info("The dataset is outside of the layer and not being added!");
ProcessingUtils::exit_gdal();
return 0;
}
// clip tiles to layer extent
imageTileX0 = math::Max<int64>(imageTileX0, layerTileX0);
imageTileY0 = math::Max<int64>(imageTileY0, layerTileY0);
imageTileX1 = math::Min<int64>(imageTileX1, layerTileX1);
imageTileY1 = math::Min<int64>(imageTileY1, layerTileY1);
out_x0 = imageTileX0;
out_y0 = imageTileY0;
out_x1 = imageTileX1;
out_y1 = imageTileY1;
//.........这里部分代码省略.........
示例4: _start
int _start(int argc, char *argv[], boost::shared_ptr<Logger> qLogger, const std::string& processpath)
{
bool bError = false;
po::options_description desc("Program-Options");
desc.add_options()
("name", po::value<std::string>(), "layer name (string)")
("lod", po::value<int>(), "desired level of detail (integer)")
("extent", po::value< std::vector<int64> >()->multitoken(), "tile boundary (tx0 ty0 tx1 ty1) for elevation/image data")
("boundary", po::value<std::vector<double> >()->multitoken(), "WGS84 boundary for point data or mapnik rendering")
("force", "[optional] force creation. (Warning: if this layer already exists it will be deleted)")
("numthreads", po::value<int>(), "[optional] force number of threads")
("type", po::value<std::string>(), "[optional] layer type. This can be image, elevation, poi, point, geometry. image is default value.")
;
po::variables_map vm;
try
{
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);
}
catch (std::exception&)
{
bError = true;
}
std::string sLayerName;
int nLod = 0;
std::vector<int64> vecExtent;
std::vector<double> vecBoundary;
bool bForce = false;
ELayerType eLayer = IMAGE_LAYER;
if (!vm.count("name"))
{
qLogger->Error("layer name is not specified!");
bError = true;
}
else
{
sLayerName = vm["name"].as<std::string>();
if (sLayerName.length() == 0)
{
qLogger->Error("layer name is empty!");
bError = true;
}
}
if (!vm.count("lod"))
{
if(vm["type"].as< std::string >() != "mapnik")
{
qLogger->Error("lod not specified!");
bError = true;
}
}
else
{
nLod = vm["lod"].as<int>();
}
if (vm.count("force"))
{
bForce = true;
}
if (vm.count("extent"))
{
vecExtent = vm["extent"].as< std::vector<int64> >();
}
if (vm.count("boundary"))
{
vecBoundary = vm["boundary"].as< std::vector<double> >();
}
if (vm.count("numthreads"))
{
int n = vm["numthreads"].as<int>();
if (n>0 && n<65)
{
std::ostringstream oss;
oss << "Forcing number of threads to " << n;
qLogger->Info(oss.str());
omp_set_num_threads(n);
}
}
if (vm.count("type"))
{
std::string sLayerType = vm["type"].as< std::string >();
if (sLayerType == "image")
{
eLayer = IMAGE_LAYER;
}
else if (sLayerType == "imagepostprocessing")
{
eLayer = IMAGE_POSTPROCESSING_LAYER;
//.........这里部分代码省略.........
示例5: process
int process( boost::shared_ptr<Logger> qLogger, boost::shared_ptr<ProcessingSettings> qSettings, std::string sLayer, bool bVerbose, bool bLock, int epsg, std::string sPointFile, bool bFill, int& out_lod, int64& out_x0, int64& out_y0, int64& out_z0, int64& out_x1, int64& out_y1, int64& out_z1)
{
clock_t t0,t1;
t0 = clock();
if (!ProcessingUtils::init_gdal())
{
qLogger->Error("gdal-data directory not found!");
return ERROR_GDAL;
}
boost::shared_ptr<CoordinateTransformation> qCT;
qCT = boost::shared_ptr<CoordinateTransformation>(new CoordinateTransformation(epsg, 4326));
//---------------------------------------------------------------------------
// Retrieve PointLayerSettings:
std::ostringstream oss;
std::string sPointLayerDir = FilenameUtils::DelimitPath(qSettings->GetPath()) + sLayer;
std::string sTileDir = FilenameUtils::DelimitPath(FilenameUtils::DelimitPath(sPointLayerDir) + "tiles");
std::string sTempDir = FilenameUtils::DelimitPath(FilenameUtils::DelimitPath(sPointLayerDir) + "temp/tiles");
std::string sIndexFile = FilenameUtils::DelimitPath(sPointLayerDir) + "temp/" + FilenameUtils::ExtractBaseFileName(sPointFile) + ".idx";
boost::shared_ptr<PointLayerSettings> qPointLayerSettings = PointLayerSettings::Load(sPointLayerDir);
if (!qPointLayerSettings)
{
qLogger->Error("Failed retrieving point layer settings! Make sure to create it using 'createlayer'.");
ProcessingUtils::exit_gdal();
return ERROR_ELVLAYERSETTINGS;
}
int lod = qPointLayerSettings->GetMaxLod();
double x0, y0, z0, x1, y1, z1;
qPointLayerSettings->GetBoundary(x0, y0, z0, x1, y1, z1);
if (bVerbose)
{
oss << "Point Layer:\n";
oss << " name = " << qPointLayerSettings->GetLayerName() << "\n";
oss << " maxlod = " << lod << "\n";
oss << " boundary = (" << x0 << ", " << y0 << ", " << z0 << ")-(" << x1 << ", " << y1 << ", " << z1 << ")\n";
qLogger->Info(oss.str());
oss.str("");
}
double lodlen = pow(2.0,lod);
//------------------------------------------------------------------------
// Calculate matrix for octree voxel data transformation
double xcenter, ycenter, zcenter;
xcenter = x0 + fabs(x1-x0)*0.5;
ycenter = y0 + fabs(y1-y0)*0.5;
zcenter = z0 + fabs(z1-z0)*0.5; // elevation is currently ignored and set to 0
double len = OCTREE_CUBE_SIZE; // octree cube size
mat4<double> L, Linv;
// center to radiant
double lng = DEG2RAD(xcenter);
double lat = DEG2RAD(ycenter);
// center to cartesian coord
vec3<double> vCenter;
GeoCoord geoCenter(xcenter, ycenter, zcenter);
geoCenter.GetCartesian(vCenter);
// create orthonormal basis
// (and create 4x4 matrix with translation to vCenter)
// scale to normalized geozentric cartesian coordinates (scaled meters)
double scalelen = CARTESIAN_SCALE_INV * len;
// translate to center (lng,lat)
mat4<double> matTrans;
matTrans.SetTranslation(vCenter);
mat4<double> matNavigation;
//matNavigation.CalcNavigationFrame(lng, lat);
// Navigation frame with z-axis up!
matNavigation.Set(
-sin(lng), -sin(lat)*cos(lng), cos(lat)*cos(lng), 0,
cos(lng), -sin(lat)*sin(lng), cos(lat)*sin(lng), 0,
0, cos(lat), sin(lat), 0,
0, 0, 0, 1);
// scale to range [-0.5,0.5] (local coordinates)
mat4<double> matScale;
matScale.SetScale(scalelen);
// translate to range [0,1]
mat4<double> matTrans2;
matTrans2.SetTranslation(-0.5, -0.5, -0.5);
L = matTrans; // translate to vCenter
L *= matNavigation; // rotate to align ellipsoid normal
L *= matScale; // scale to [-0.5, 0.5]
L *= matTrans2; // translate [0.5, 0.5, 0.5] to have range [0,1]
//.........这里部分代码省略.........