本文整理汇总了C++中OGRPoint::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRPoint::empty方法的具体用法?C++ OGRPoint::empty怎么用?C++ OGRPoint::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRPoint
的用法示例。
在下文中一共展示了OGRPoint::empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: importFromWkt_Bracketed
OGRErr OGRMultiPoint::importFromWkt_Bracketed( char ** ppszInput,
int bHasM, int bHasZ )
{
/* -------------------------------------------------------------------- */
/* Skip MULTIPOINT keyword. */
/* -------------------------------------------------------------------- */
char szToken[OGR_WKT_TOKEN_MAX] = {};
const char *pszInput = *ppszInput;
pszInput = OGRWktReadToken( pszInput, szToken );
if( bHasZ || bHasM )
{
// Skip Z, M or ZM.
pszInput = OGRWktReadToken( pszInput, szToken );
}
/* -------------------------------------------------------------------- */
/* Read points till we get to the closing bracket. */
/* -------------------------------------------------------------------- */
OGRRawPoint *paoPoints = NULL;
double *padfZ = NULL;
double *padfM = NULL;
while( (pszInput = OGRWktReadToken( pszInput, szToken )) != NULL
&& (EQUAL(szToken, "(") || EQUAL(szToken, ",")) )
{
const char* pszNext = OGRWktReadToken( pszInput, szToken );
if( EQUAL(szToken, "EMPTY") )
{
OGRPoint *poGeom = new OGRPoint(0.0, 0.0);
poGeom->empty();
const OGRErr eErr = addGeometryDirectly( poGeom );
if( eErr != OGRERR_NONE )
{
CPLFree( paoPoints );
delete poGeom;
return eErr;
}
pszInput = pszNext;
continue;
}
int flagsFromInput = flags;
int nMaxPoint = 0;
int nPointCount = 0;
pszInput = OGRWktReadPointsM( pszInput, &paoPoints, &padfZ, &padfM,
&flagsFromInput,
&nMaxPoint, &nPointCount );
if( pszInput == NULL || nPointCount != 1 )
{
CPLFree( paoPoints );
CPLFree( padfZ );
CPLFree( padfM );
return OGRERR_CORRUPT_DATA;
}
if( (flagsFromInput & OGR_G_3D) && !(flags & OGR_G_3D) )
{
flags |= OGR_G_3D;
bHasZ = TRUE;
}
if( (flagsFromInput & OGR_G_MEASURED) && !(flags & OGR_G_MEASURED) )
{
flags |= OGR_G_MEASURED;
bHasM = TRUE;
}
OGRPoint *poPoint = new OGRPoint(paoPoints[0].x, paoPoints[0].y);
if( bHasM )
{
if( padfM != NULL )
poPoint->setM(padfM[0]);
else
poPoint->setM(0.0);
}
if( bHasZ )
{
if( padfZ != NULL )
poPoint->setZ(padfZ[0]);
else
poPoint->setZ(0.0);
}
const OGRErr eErr = addGeometryDirectly( poPoint );
if( eErr != OGRERR_NONE )
{
CPLFree( paoPoints );
CPLFree( padfZ );
CPLFree( padfM );
delete poPoint;
return eErr;
}
}
/* -------------------------------------------------------------------- */
/* Cleanup. */
//.........这里部分代码省略.........
示例2: paintMap
void DrawShape::paintMap(WPaintDevice *paintDevice)
{
WPainter painter(paintDevice);
painter.setRenderHint(WPainter::LowQualityShadows);
painter.save();
if(!sfile.empty()) {
vector<LABELS> label_list;
OGRDataSource *poDS,*PointDS;
string dfile = sfile + ".shp";
string shp = "g_4326/" + sfile + ".shp";
poDS = OGRSFDriverRegistrar::Open(shp.c_str(), FALSE ); //comment till here
if(poDS==NULL)
{
printf( "Open failed.\n" );
exit( 1 );
}
OGRLayer *poLayer;
poLayer = poDS->GetLayerByName( sfile.c_str() ); // comment here
OGRFeature *poFeature;
OGREnvelope * psExtent = new OGREnvelope();
poLayer->GetExtent(psExtent);
double xMin = psExtent->MinX;
double yMin = psExtent->MinY;
double xMax = psExtent->MaxX;
double yMax = psExtent->MaxY;
stringstream strm;
strm << xMin;
string exp;
double scaleFactor;
string bound_string = strm.str();
int size = bound_string.size();
size_t found=bound_string.find("+");
if (found!=string::npos) {
exp = bound_string.substr(found+1,size);
}
if(exp.empty()) {
stringstream strExtent;
strExtent << yMin;
bound_string = strExtent.str();
size = bound_string.size();
found = bound_string.find("+");
if(found!=string::npos) {
exp = bound_string.substr(found+1,size);
}
}
if(exp.empty()) {
stringstream strExtent;
strExtent << xMax;
bound_string = strExtent.str();
size = bound_string.size();
found = bound_string.find("+");
if(found!=string::npos) {
exp = bound_string.substr(found+1,size);
}
}
if(exp.empty()) {
stringstream strExtent;
strExtent << yMax;
bound_string = strExtent.str();
size = bound_string.size();
found = bound_string.find("+");
if(found!=string::npos) {
exp = bound_string.substr(found+1,size);
}
}
//cout << "EXXP: " << exp << endl;
if(!exp.empty()) {
int exponent = boost::lexical_cast<int>(exp);
exponent-=3;
scaleFactor = pow (10,exponent);
}
else
{
//cout << "EXXP is empty " << exp << endl;
scaleFactor = 1;
}
xMin/=scaleFactor;
xMax/=scaleFactor;
yMin/=scaleFactor;
yMax/=scaleFactor;
double gWidth = xMax - xMin;
double gHeight = yMax - yMin;
double widthFactor = 1;
double pwidth = abs(gWidth-gHeight);
double s = gWidth - gHeight;
if(s<0.16)
gWidth = gHeight + 0.16;
double ratio=gWidth/gHeight;
//for zoom n pan
if(increase_width<100 && increase_height<100){
//.........这里部分代码省略.........