本文整理汇总了C++中OGRPoint::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRPoint::IsEmpty方法的具体用法?C++ OGRPoint::IsEmpty怎么用?C++ OGRPoint::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRPoint
的用法示例。
在下文中一共展示了OGRPoint::IsEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PointOnSurface
int OGRPolygon::PointOnSurface( OGRPoint *poPoint ) const
{
if( poPoint == NULL )
return OGRERR_FAILURE;
OGRGeometryH hInsidePoint = OGR_G_PointOnSurface( (OGRGeometryH) this );
if( hInsidePoint == NULL )
return OGRERR_FAILURE;
OGRPoint *poInsidePoint = (OGRPoint *) hInsidePoint;
if( poInsidePoint->IsEmpty() )
poPoint->empty();
else
{
poPoint->setX( poInsidePoint->getX() );
poPoint->setY( poInsidePoint->getY() );
}
return OGRERR_NONE;
}
示例2: exportToWkt
OGRErr OGRMultiPoint::exportToWkt( char ** ppszDstText,
OGRwkbVariant eWkbVariant ) const
{
size_t nMaxString = static_cast<size_t>(getNumGeometries()) * 22 + 130;
size_t nRetLen = 0;
/* -------------------------------------------------------------------- */
/* Return MULTIPOINT EMPTY if we get no valid points. */
/* -------------------------------------------------------------------- */
if( IsEmpty() )
{
if( eWkbVariant == wkbVariantIso )
{
if( (flags & OGR_G_3D) && (flags & OGR_G_MEASURED) )
*ppszDstText = CPLStrdup("MULTIPOINT ZM EMPTY");
else if( flags & OGR_G_MEASURED )
*ppszDstText = CPLStrdup("MULTIPOINT M EMPTY");
else if( flags & OGR_G_3D )
*ppszDstText = CPLStrdup("MULTIPOINT Z EMPTY");
else
*ppszDstText = CPLStrdup("MULTIPOINT EMPTY");
}
else
*ppszDstText = CPLStrdup("MULTIPOINT EMPTY");
return OGRERR_NONE;
}
*ppszDstText = static_cast<char *>(VSI_MALLOC_VERBOSE( nMaxString ));
if( *ppszDstText == NULL )
return OGRERR_NOT_ENOUGH_MEMORY;
if( eWkbVariant == wkbVariantIso )
{
if( (flags & OGR_G_3D) && (flags & OGR_G_MEASURED) )
snprintf( *ppszDstText, nMaxString, "%s ZM (", getGeometryName() );
else if( flags & OGR_G_MEASURED )
snprintf( *ppszDstText, nMaxString, "%s M (", getGeometryName() );
else if( flags & OGR_G_3D )
snprintf( *ppszDstText, nMaxString, "%s Z (", getGeometryName() );
else
snprintf( *ppszDstText, nMaxString, "%s (", getGeometryName() );
}
else
snprintf( *ppszDstText, nMaxString, "%s (", getGeometryName() );
bool bMustWriteComma = false;
for( int i = 0; i < getNumGeometries(); i++ )
{
OGRPoint *poPoint = (OGRPoint *) getGeometryRef( i );
if( poPoint->IsEmpty() )
{
CPLDebug("OGR",
"OGRMultiPoint::exportToWkt() - skipping POINT EMPTY.");
continue;
}
if( bMustWriteComma )
strcat( *ppszDstText + nRetLen, "," );
bMustWriteComma = true;
nRetLen += strlen(*ppszDstText + nRetLen);
if( nMaxString < nRetLen + 100 )
{
nMaxString = nMaxString * 2;
*ppszDstText =
static_cast<char *>(CPLRealloc(*ppszDstText, nMaxString));
}
if( eWkbVariant == wkbVariantIso )
{
strcat( *ppszDstText + nRetLen, "(" );
nRetLen++;
}
OGRMakeWktCoordinateM(
*ppszDstText + nRetLen,
poPoint->getX(),
poPoint->getY(),
poPoint->getZ(),
poPoint->getM(),
poPoint->Is3D(),
poPoint->IsMeasured() && (eWkbVariant == wkbVariantIso));
if( eWkbVariant == wkbVariantIso )
{
strcat( *ppszDstText + nRetLen, ")" );
nRetLen++;
}
}
strcat( *ppszDstText+nRetLen, ")" );
return OGRERR_NONE;
}
示例3: paintMap
//.........这里部分代码省略.........
x/=scaleFactor; y/=scaleFactor;
if(i==0)
path = WPainterPath( WPointF(x, y));
else
path.lineTo( x , y);
}
painter.drawPath(path);
poGeometry->Centroid(centroid);
}
else if( (poGeometry != NULL) && wkbFlatten(poGeometry->getGeometryType()) == wkbPolygon)
{
OGRPolygon *poPoint = (OGRPolygon *) poGeometry;
OGRLinearRing *extring = poPoint->getExteriorRing();
int n = extring->getNumPoints();
double x, y;
for(int i=0;i<n;i++)
{
x = extring->getX(i); y = extring->getY(i);
x/=scaleFactor; y/=scaleFactor;
if(i==0)
path = WPainterPath( WPointF(x , y));
else
path.lineTo( x , y);
}
painter.drawPath(path);
poGeometry->Centroid(centroid);
}
else if( (poGeometry != NULL) && wkbFlatten(poGeometry->getGeometryType()) == wkbMultiPolygon)
{
double x, y;
OGRMultiPolygon *poPoint = (OGRMultiPolygon *) poGeometry;
int p = poPoint->getNumGeometries();
for(int k=0;k<p;k++) {
OGRGeometry* geom = poPoint->getGeometryRef(k);
OGRPolygon *poly = (OGRPolygon *) geom;
OGRLinearRing *ring = poly->getExteriorRing();
for(int i=0;i<ring->getNumPoints();i++)
{
x = ring->getX(i); y = ring->getY(i);
x/=scaleFactor; y/=scaleFactor;
if(i==0)
path = WPainterPath( WPointF(x , y));
else
path.lineTo( x , y);
}
painter.drawPath(path);
poGeometry->Centroid(centroid);
}
}
if(labelindex>0 && !centroid->IsEmpty()){
LABELS l={centroid->getX(),centroid->getY(),label};
label_list.push_back(l);
}
}
painter.restore();
//labelling the contents
if(increase_width<100 && increase_height<100){
painter.setWindow(0.0, 0.0, (paintDevice->width()).value(),(paintDevice->height()).value());
font= new WFont(WFont::SansSerif);
font->setSize(WLength(10*labelpercentage));
painter.setFont(*font);
pen.setColor(labelcolor);
painter.setPen(pen);
std::vector<LABELS>::iterator the_iterator = label_list.begin();
double x, y, minx=(xMin+(-x_pos_shift+increase_width/2)/100*gWidth* widthFactor),miny=(yMax+(y_pos_shift-increase_height/2)/100*gHeight*widthFactor);
double multx=(paintDevice->width().value())/(gWidth* widthFactor*(100-increase_width)/100);
double multy=(paintDevice->height().value())/(gHeight*widthFactor*(-1+increase_height/100));
while( the_iterator != label_list.end() ) {
x=((*the_iterator).x/scaleFactor-minx)*multx;
y=((*the_iterator).y/scaleFactor-miny)*multy;
painter.drawText(WRectF( x-(*the_iterator).label.size()*5*labelpercentage, y-5*labelpercentage, (*the_iterator).label.size() *10*labelpercentage,10*labelpercentage),AlignCenter,(*the_iterator).label);
++the_iterator;
}
pen.setColor(red);
painter.setPen(pen);
painter.setFont(*font);
//painter.drawText(WRectF(paintDevice->width().value()-dfile.size()*10*labelpercentage,paintDevice->height().value()-10*labelpercentage*(paintDevice->height()).value(), dfile.size()*10*labelpercentage,10*labelpercentage ),AlignCenter,dfile); //this text is not seen in the picture when painted.
}
}
}
示例4: exportToWkt
OGRErr OGRMultiPoint::exportToWkt( char ** ppszDstText,
OGRwkbVariant eWkbVariant ) const
{
int nMaxString = getNumGeometries() * 22 + 128;
int nRetLen = 0;
/* -------------------------------------------------------------------- */
/* Return MULTIPOINT EMPTY if we get no valid points. */
/* -------------------------------------------------------------------- */
if( IsEmpty() )
{
if( getCoordinateDimension() == 3 && eWkbVariant == wkbVariantIso )
*ppszDstText = CPLStrdup("MULTIPOINT Z EMPTY");
else
*ppszDstText = CPLStrdup("MULTIPOINT EMPTY");
return OGRERR_NONE;
}
*ppszDstText = (char *) VSIMalloc( nMaxString );
if( *ppszDstText == NULL )
return OGRERR_NOT_ENOUGH_MEMORY;
if( getCoordinateDimension() == 3 && eWkbVariant == wkbVariantIso )
sprintf( *ppszDstText, "%s Z (", getGeometryName() );
else
sprintf( *ppszDstText, "%s (", getGeometryName() );
int bMustWriteComma = FALSE;
for( int i = 0; i < getNumGeometries(); i++ )
{
OGRPoint *poPoint = (OGRPoint *) getGeometryRef( i );
if (poPoint->IsEmpty())
{
CPLDebug( "OGR", "OGRMultiPoint::exportToWkt() - skipping POINT EMPTY.");
continue;
}
if( bMustWriteComma )
strcat( *ppszDstText + nRetLen, "," );
bMustWriteComma = TRUE;
nRetLen += strlen(*ppszDstText + nRetLen);
if( nMaxString < nRetLen + 100 )
{
nMaxString = nMaxString * 2;
*ppszDstText = (char *) CPLRealloc(*ppszDstText,nMaxString);
}
if( eWkbVariant == wkbVariantIso )
{
strcat( *ppszDstText + nRetLen, "(" );
nRetLen ++;
}
OGRMakeWktCoordinate( *ppszDstText + nRetLen,
poPoint->getX(),
poPoint->getY(),
poPoint->getZ(),
poPoint->getCoordinateDimension() );
if( eWkbVariant == wkbVariantIso )
{
strcat( *ppszDstText + nRetLen, ")" );
nRetLen ++;
}
}
strcat( *ppszDstText+nRetLen, ")" );
return OGRERR_NONE;
}