本文整理汇总了C++中OGRLinearRing::setPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRLinearRing::setPoint方法的具体用法?C++ OGRLinearRing::setPoint怎么用?C++ OGRLinearRing::setPoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRLinearRing
的用法示例。
在下文中一共展示了OGRLinearRing::setPoint方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadPolygon
OGRPolygon* OGRMSSQLGeometryParser::ReadPolygon(int iShape)
{
int iFigure, iPoint, iNextPoint, i;
int iNextFigure = NextFigureOffset(iShape);
OGRPolygon* poPoly = new OGRPolygon();
for (iFigure = FigureOffset(iShape); iFigure < iNextFigure; iFigure++)
{
OGRLinearRing* poRing = new OGRLinearRing();
iPoint = PointOffset(iFigure);
iNextPoint = NextPointOffset(iFigure);
poRing->setNumPoints(iNextPoint - iPoint);
i = 0;
while (iPoint < iNextPoint)
{
if ( chProps & SP_HASZVALUES )
poRing->setPoint(i, ReadX(iPoint), ReadY(iPoint), ReadZ(iPoint) );
else
poRing->setPoint(i, ReadX(iPoint), ReadY(iPoint) );
++iPoint;
++i;
}
poPoly->addRingDirectly( poRing );
}
return poPoly;
}
示例2: isSelected
int ICLayerLineString::isSelected(double x, double y, double scale)
{
OGRPolygon* Poly =
static_cast<OGRPolygon*> (OGRGeometryFactory::createGeometry(wkbPolygon));
OGRLinearRing* Ring =
static_cast<OGRLinearRing*> (OGRGeometryFactory::createGeometry(
wkbLinearRing));
Ring->setPoint(0, new OGRPoint(x - 3 / scale, y - 3 / scale));
Ring->setPoint(1, new OGRPoint(x + 3 / scale, y - 3 / scale));
Ring->setPoint(2, new OGRPoint(x + 3 / scale, y + 3 / scale));
Ring->setPoint(3, new OGRPoint(x - 3 / scale, y + 3 / scale));
Ring->closeRings();
Poly->addRingDirectly(Ring);
std::map<int, ICLayerObject*>::iterator it;
for (it = m_ICLayerObject.begin(); it != m_ICLayerObject.end(); it++)
{
if (Poly->Intersects(
static_cast<OGRGeometry*> ((*it).second->getOGRGeometryObject())))
{
return (*it).first;
}
}
return -1;
}
示例3: addPart
void addPart( const marching_squares::LineString& ring )
{
if ( currentGeometry_ && currentPart_ )
{
currentGeometry_->addGeometryDirectly(currentPart_);
}
OGRLinearRing* poNewRing = new OGRLinearRing();
poNewRing->setNumPoints( int(ring.size()) );
int iPoint = 0;
for ( const auto& p : ring )
{
poNewRing->setPoint( iPoint, p.x, p.y );
iPoint++;
}
currentPart_ = new OGRPolygon();
currentPart_->addRingDirectly(poNewRing);
}
示例4: if
OGRFeature *OGROGDILayer::GetNextRawFeature()
{
ecs_Result *psResult;
int i;
OGRFeature *poFeature;
/* -------------------------------------------------------------------- */
/* Retrieve object from OGDI server and create new feature */
/* -------------------------------------------------------------------- */
psResult = cln_GetNextObject(m_nClientID);
if (! ECSSUCCESS(psResult))
{
// We probably reached EOF... keep track of shape count.
m_nTotalShapeCount = m_iNextShapeId - m_nFilteredOutShapes;
return NULL;
}
poFeature = new OGRFeature(m_poFeatureDefn);
poFeature->SetFID( m_iNextShapeId++ );
m_nFeaturesRead++;
/* -------------------------------------------------------------------- */
/* Process geometry */
/* -------------------------------------------------------------------- */
if (m_eFamily == Point)
{
ecs_Point *psPoint = &(ECSGEOM(psResult).point);
OGRPoint *poOGRPoint = new OGRPoint(psPoint->c.x, psPoint->c.y);
poOGRPoint->assignSpatialReference(m_poSpatialRef);
poFeature->SetGeometryDirectly(poOGRPoint);
}
else if (m_eFamily == Line)
{
ecs_Line *psLine = &(ECSGEOM(psResult).line);
OGRLineString *poOGRLine = new OGRLineString();
poOGRLine->setNumPoints( psLine->c.c_len );
for( i=0; i < (int) psLine->c.c_len; i++ )
{
poOGRLine->setPoint(i, psLine->c.c_val[i].x, psLine->c.c_val[i].y);
}
poOGRLine->assignSpatialReference(m_poSpatialRef);
poFeature->SetGeometryDirectly(poOGRLine);
}
else if (m_eFamily == Area)
{
ecs_Area *psArea = &(ECSGEOM(psResult).area);
OGRPolygon *poOGRPolygon = new OGRPolygon();
for(int iRing=0; iRing < (int) psArea->ring.ring_len; iRing++)
{
ecs_FeatureRing *psRing = &(psArea->ring.ring_val[iRing]);
OGRLinearRing *poOGRRing = new OGRLinearRing();
poOGRRing->setNumPoints( psRing->c.c_len );
for( i=0; i < (int) psRing->c.c_len; i++ )
{
poOGRRing->setPoint(i, psRing->c.c_val[i].x,
psRing->c.c_val[i].y);
}
poOGRPolygon->addRingDirectly(poOGRRing);
}
// __TODO__
// When OGR supports polygon centroids then we should carry them here
poOGRPolygon->assignSpatialReference(m_poSpatialRef);
poFeature->SetGeometryDirectly(poOGRPolygon);
}
else if (m_eFamily == Text)
{
// __TODO__
// For now text is treated as a point and string is lost
//
ecs_Text *psText = &(ECSGEOM(psResult).text);
OGRPoint *poOGRPoint = new OGRPoint(psText->c.x, psText->c.y);
poOGRPoint->assignSpatialReference(m_poSpatialRef);
poFeature->SetGeometryDirectly(poOGRPoint);
}
else
{
CPLAssert(FALSE);
}
/* -------------------------------------------------------------------- */
/* Set attributes */
/* -------------------------------------------------------------------- */
char *pszAttrList = ECSOBJECTATTR(psResult);
for( int iField = 0; iField < m_poFeatureDefn->GetFieldCount(); iField++ )
{
char *pszFieldStart;
int nNameLen;
//.........这里部分代码省略.........
示例5: DumpViaSpatialIndex
/**********************************************************************
* DumpViaSpatialIndex()
*
* Open a .TAB file and print all the geogr. objects that match the
* specified filter. Scanes the file via the spatial index.
**********************************************************************/
static int DumpViaSpatialIndex(const char *pszFname,
double dXMin, double dYMin,
double dXMax, double dYMax)
{
IMapInfoFile *poFile;
TABFeature *poFeature;
/*---------------------------------------------------------------------
* Try to open source file
*--------------------------------------------------------------------*/
if ((poFile = IMapInfoFile::SmartOpen(pszFname)) == NULL)
{
printf("Failed to open %s\n", pszFname);
return -1;
}
poFile->Dump();
/*---------------------------------------------------------------------
* Check for indexed fields
*--------------------------------------------------------------------*/
for(int iField=0; iField<poFile->GetLayerDefn()->GetFieldCount(); iField++)
{
if (poFile->IsFieldIndexed(iField))
printf(" Field %d is indexed\n", iField);
}
/*---------------------------------------------------------------------
* Set spatial filter
*--------------------------------------------------------------------*/
OGRLinearRing oSpatialFilter;
oSpatialFilter.setNumPoints(5);
oSpatialFilter.setPoint(0, dXMin, dYMin);
oSpatialFilter.setPoint(1, dXMax, dYMin);
oSpatialFilter.setPoint(2, dXMax, dYMax);
oSpatialFilter.setPoint(3, dXMin, dYMax);
oSpatialFilter.setPoint(4, dXMin, dYMin);
poFile->SetSpatialFilter( &oSpatialFilter );
/*---------------------------------------------------------------------
* Read/Dump objects until EOF is reached
*--------------------------------------------------------------------*/
while ( (poFeature = (TABFeature*)poFile->GetNextFeature()) != NULL )
{
// poFeature->DumpReadable(stdout);
printf("\nFeature %ld:\n", poFeature->GetFID());
poFeature->DumpMID();
poFeature->DumpMIF();
}
/*---------------------------------------------------------------------
* Cleanup and exit.
*--------------------------------------------------------------------*/
poFile->Close();
delete poFile;
return 0;
}
示例6: extrude_box
OGRMultiPolygon* Building::extrude_box() const
{
OGRMultiPolygon* block = new OGRMultiPolygon;
//extrude roof
OGRPolygon roof;
{
roof.addRing(_footprint->getExteriorRing());
OGRLinearRing* ring = roof.getExteriorRing();
for(int i=0; i<ring->getNumPoints(); i++)
ring->setPoint(i,ring->getX(i),ring->getY(i),_height);
}
if(int n = _footprint->getNumInteriorRings())
{
for (int j=0; j<n; j++)
{
roof.addRing(_footprint->getInteriorRing(j));
OGRLinearRing* ring = roof.getInteriorRing(j);
for(int i=0; i<ring->getNumPoints(); i++)
ring->setPoint(i,ring->getX(i),ring->getY(i),_height);
}
}
block->addGeometry(&roof);
//extrude exter walls
OGRLinearRing* ringEx = _footprint->getExteriorRing();
for(int i=0; i<ringEx->getNumPoints()-1; i++)
{
OGRPolygon wall;
OGRLinearRing ring;
ring.addPoint(ringEx->getX(i),ringEx->getY(i),0);
ring.addPoint(ringEx->getX(i+1),ringEx->getY(i+1),0);
ring.addPoint(ringEx->getX(i+1),ringEx->getY(i+1),_height);
ring.addPoint(ringEx->getX(i),ringEx->getY(i),_height);
ring.addPoint(ringEx->getX(i),ringEx->getY(i),0);
wall.addRing(&ring);
block->addGeometry(&wall);
}
//extrude inner walls if exist
if(int n = _footprint->getNumInteriorRings())
{
for (int i=0; i<n; i++)
{
OGRLinearRing* ringIn = _footprint->getInteriorRing(i);
for(int j=0; j<ringIn->getNumPoints()-1; j++)
{
OGRPolygon wall;
OGRLinearRing ring;
ring.addPoint(ringIn->getX(j),ringIn->getY(j),0);
ring.addPoint(ringIn->getX(j+1),ringIn->getY(j+1),0);
ring.addPoint(ringIn->getX(j+1),ringIn->getY(j+1),_height);
ring.addPoint(ringIn->getX(j),ringIn->getY(j),_height);
ring.addPoint(ringIn->getX(j),ringIn->getY(j),0);
wall.addRing(&ring);
block->addGeometry(&wall);
}
}
}
return block;
}
示例7: OGRPoint
//.........这里部分代码省略.........
{
if( aoVertices.size() == 1 )
{
OGRPoint* poPoint =
new OGRPoint( aoVertices[0].x,
aoVertices[0].y,
aoVertices[0].z );
if (poSRS)
poPoint->assignSpatialReference(poSRS);
poFeature->SetGeometryDirectly(poPoint);
}
else
{
// report issue?
}
}
/* -------------------------------------------------------------------- */
/* LineString */
/* -------------------------------------------------------------------- */
else if( poFeatureDefn->GetGeomType() == wkbLineString25D
|| (wkbFlatten(poFeatureDefn->GetGeomType()) == wkbUnknown
&& aoVertices.size() > 1) )
{
// We should likely be applying ringstart to break things into
// a multilinestring in some cases.
if( aoVertices.size() > 1 )
{
OGRLineString *poLS = new OGRLineString();
poLS->setNumPoints( aoVertices.size() );
for( i = 0; i < aoVertices.size(); i++ )
poLS->setPoint( i,
aoVertices[i].x,
aoVertices[i].y,
aoVertices[i].z );
if (poSRS)
poLS->assignSpatialReference(poSRS);
poFeature->SetGeometryDirectly( poLS );
}
else
{
// report issue?
}
}
/* -------------------------------------------------------------------- */
/* Polygon - Currently we have no way to recognise if we are */
/* dealing with a multipolygon when we have more than one */
/* ring. Also, PCIDSK allows the rings to be in arbitrary */
/* order, not necessarily outside first which we are not yet */
/* ready to address in the following code. */
/* -------------------------------------------------------------------- */
else if( poFeatureDefn->GetGeomType() == wkbPolygon25D )
{
std::vector<PCIDSK::int32> anRingStart;
OGRPolygon *poPoly = new OGRPolygon();
unsigned int iRing;
if( iRingStartField != -1 )
anRingStart = aoFields[iRingStartField].GetValueCountedInt();
for( iRing = 0; iRing < anRingStart.size()+1; iRing++ )
{
示例8: OGRCreateFromGeomedia
OGRErr OGRCreateFromGeomedia( GByte *pabyGeom,
OGRGeometry **ppoGeom,
int nBytes )
{
*ppoGeom = NULL;
if( nBytes < 16 )
return OGRERR_FAILURE;
if( !(pabyGeom[1] == 0xFF && pabyGeom[2] == 0xD2 && pabyGeom[3] == 0x0F) )
return OGRERR_FAILURE;
int nGeomType = pabyGeom[0];
pabyGeom += 16;
nBytes -= 16;
if( nGeomType == GEOMEDIA_POINT ||
nGeomType == GEOMEDIA_ORIENTED_POINT )
{
if (nBytes < 3 * 8)
return OGRERR_FAILURE;
double dfX, dfY, dfZ;
memcpy(&dfX, pabyGeom, 8);
CPL_LSBPTR64(&dfX);
memcpy(&dfY, pabyGeom + 8, 8);
CPL_LSBPTR64(&dfY);
memcpy(&dfZ, pabyGeom + 16, 8);
CPL_LSBPTR64(&dfZ);
*ppoGeom = new OGRPoint( dfX, dfY, dfZ );
return OGRERR_NONE;
}
else if ( nGeomType == GEOMEDIA_POLYLINE )
{
if (nBytes < 4)
return OGRERR_FAILURE;
int nPoints;
memcpy(&nPoints, pabyGeom, 4);
CPL_LSBPTR32(&nPoints);
pabyGeom += 4;
nBytes -= 4;
if (nPoints < 0 || nPoints > INT_MAX / 24 || nBytes < nPoints * 24)
return OGRERR_FAILURE;
OGRLineString* poLS = new OGRLineString();
poLS->setNumPoints(nPoints);
int i;
for(i=0;i<nPoints;i++)
{
double dfX, dfY, dfZ;
memcpy(&dfX, pabyGeom, 8);
CPL_LSBPTR64(&dfX);
memcpy(&dfY, pabyGeom + 8, 8);
CPL_LSBPTR64(&dfY);
memcpy(&dfZ, pabyGeom + 16, 8);
CPL_LSBPTR64(&dfZ);
poLS->setPoint(i, dfX, dfY, dfZ);
pabyGeom += 24;
}
*ppoGeom = poLS;
return OGRERR_NONE;
}
else if ( nGeomType == GEOMEDIA_POLYGON )
{
if (nBytes < 4)
return OGRERR_FAILURE;
int nPoints;
memcpy(&nPoints, pabyGeom, 4);
CPL_LSBPTR32(&nPoints);
pabyGeom += 4;
nBytes -= 4;
if (nPoints < 0 || nPoints > INT_MAX / 24 || nBytes < nPoints * 24)
return OGRERR_FAILURE;
OGRLinearRing* poRing = new OGRLinearRing();
poRing->setNumPoints(nPoints);
int i;
for(i=0;i<nPoints;i++)
{
double dfX, dfY, dfZ;
memcpy(&dfX, pabyGeom, 8);
CPL_LSBPTR64(&dfX);
memcpy(&dfY, pabyGeom + 8, 8);
CPL_LSBPTR64(&dfY);
memcpy(&dfZ, pabyGeom + 16, 8);
CPL_LSBPTR64(&dfZ);
//.........这里部分代码省略.........
示例9: if
//.........这里部分代码省略.........
padfXY = (double *)
CPLRealloc(padfXY, sizeof(double) * nVertMax * 2 );
}
if( !ParseXY( &pszNext, padfXY + nVertCount*2 ) )
{
CPLDebug( "INGRES", "Error parsing geometry: %s",
pszGeom );
CPLFree( padfXY );
return NULL;
}
CPLAssert( *pszNext == ')' );
nVertCount++;
pszNext++;
nDepth--;
while( *pszNext == ' ' )
pszNext++;
}
CPLAssert( nDepth == 0 );
/* -------------------------------------------------------------------- */
/* Handle Box/IBox. */
/* -------------------------------------------------------------------- */
if( EQUAL(osIngresGeomType,"BOX")
|| EQUAL(osIngresGeomType,"IBOX") )
{
CPLAssert( nVertCount == 2 );
OGRLinearRing *poRing = new OGRLinearRing();
poRing->addPoint( padfXY[0], padfXY[1] );
poRing->addPoint( padfXY[2], padfXY[1] );
poRing->addPoint( padfXY[2], padfXY[3] );
poRing->addPoint( padfXY[0], padfXY[3] );
poRing->addPoint( padfXY[0], padfXY[1] );
OGRPolygon *poPolygon = new OGRPolygon();
poPolygon->addRingDirectly( poRing );
poGeom = poPolygon;
}
/* -------------------------------------------------------------------- */
/* Handle Point/IPoint */
/* -------------------------------------------------------------------- */
else if( EQUAL(osIngresGeomType,"POINT")
|| EQUAL(osIngresGeomType,"IPOINT") )
{
CPLAssert( nVertCount == 1 );
poGeom = new OGRPoint( padfXY[0], padfXY[1] );
}
/* -------------------------------------------------------------------- */
/* Handle various linestring types. */
/* -------------------------------------------------------------------- */
else if( EQUAL(osIngresGeomType,"LSEG")
|| EQUAL(osIngresGeomType,"ILSEG")
|| EQUAL(osIngresGeomType,"LINE")
|| EQUAL(osIngresGeomType,"LONG LINE")
|| EQUAL(osIngresGeomType,"ILINE") )
{
OGRLineString *poLine = new OGRLineString();
int iVert;
poLine->setNumPoints( nVertCount );
for( iVert = 0; iVert < nVertCount; iVert++ )
poLine->setPoint( iVert, padfXY[iVert*2+0], padfXY[iVert*2+1] );
poGeom = poLine;
}
/* -------------------------------------------------------------------- */
/* Handle Polygon/IPolygon/LongPolygon. */
/* -------------------------------------------------------------------- */
else if( EQUAL(osIngresGeomType,"POLYGON")
|| EQUAL(osIngresGeomType,"IPOLYGON")
|| EQUAL(osIngresGeomType,"LONG POLYGON") )
{
OGRLinearRing *poLine = new OGRLinearRing();
int iVert;
poLine->setNumPoints( nVertCount );
for( iVert = 0; iVert < nVertCount; iVert++ )
poLine->setPoint( iVert, padfXY[iVert*2+0], padfXY[iVert*2+1] );
// INGRES polygons are implicitly closed, but OGR expects explicit
if( poLine->getX(nVertCount-1) != poLine->getX(0)
|| poLine->getY(nVertCount-1) != poLine->getY(0) )
poLine->addPoint( poLine->getX(0), poLine->getY(0) );
OGRPolygon *poPolygon = new OGRPolygon();
poPolygon->addRingDirectly( poLine );
poGeom = poPolygon;
}
return poGeom;
}
示例10: BareGMLElement
//.........这里部分代码省略.........
/* PointType */
/* -------------------------------------------------------------------- */
if( EQUAL(pszBaseGeometry,"PointType")
|| EQUAL(pszBaseGeometry,"Point") )
{
OGRPoint *poPoint = new OGRPoint();
if( !ParseGMLCoordinates( psNode, poPoint ) )
{
delete poPoint;
return NULL;
}
return poPoint;
}
/* -------------------------------------------------------------------- */
/* Box */
/* -------------------------------------------------------------------- */
if( EQUAL(pszBaseGeometry,"BoxType") || EQUAL(pszBaseGeometry,"Box") )
{
OGRLineString oPoints;
if( !ParseGMLCoordinates( psNode, &oPoints ) )
return NULL;
if( oPoints.getNumPoints() < 2 )
return NULL;
OGRLinearRing *poBoxRing = new OGRLinearRing();
OGRPolygon *poBoxPoly = new OGRPolygon();
poBoxRing->setNumPoints( 5 );
poBoxRing->setPoint(
0, oPoints.getX(0), oPoints.getY(0), oPoints.getZ(0) );
poBoxRing->setPoint(
1, oPoints.getX(1), oPoints.getY(0), oPoints.getZ(0) );
poBoxRing->setPoint(
2, oPoints.getX(1), oPoints.getY(1), oPoints.getZ(1) );
poBoxRing->setPoint(
3, oPoints.getX(0), oPoints.getY(1), oPoints.getZ(0) );
poBoxRing->setPoint(
4, oPoints.getX(0), oPoints.getY(0), oPoints.getZ(0) );
poBoxPoly->addRingDirectly( poBoxRing );
return poBoxPoly;
}
/* -------------------------------------------------------------------- */
/* MultiPolygon */
/* -------------------------------------------------------------------- */
if( EQUAL(pszBaseGeometry,"MultiPolygon") )
{
CPLXMLNode *psChild;
OGRMultiPolygon *poMPoly = new OGRMultiPolygon();
// Find all inner rings
for( psChild = psNode->psChild;
psChild != NULL;
psChild = psChild->psNext )
{
if( psChild->eType == CXT_Element
&& EQUAL(BareGMLElement(psChild->pszValue),"polygonMember") )
{
OGRPolygon *poPolygon;
示例11: TestSpatialFilter
static int TestSpatialFilter( OGRLayer *poLayer )
{
int bRet = TRUE;
OGRFeature *poFeature, *poTargetFeature;
OGRPolygon oInclusiveFilter, oExclusiveFilter;
OGRLinearRing oRing;
OGREnvelope sEnvelope;
int nInclusiveCount;
/* -------------------------------------------------------------------- */
/* Read the target feature. */
/* -------------------------------------------------------------------- */
poLayer->ResetReading();
poTargetFeature = poLayer->GetNextFeature();
if( poTargetFeature == NULL )
{
printf( "INFO: Skipping Spatial Filter test for %s.\n"
" No features in layer.\n",
poLayer->GetName() );
return bRet;
}
if( poTargetFeature->GetGeometryRef() == NULL )
{
printf( "INFO: Skipping Spatial Filter test for %s,\n"
" target feature has no geometry.\n",
poTargetFeature->GetDefnRef()->GetName() );
OGRFeature::DestroyFeature(poTargetFeature);
return bRet;
}
poTargetFeature->GetGeometryRef()->getEnvelope( &sEnvelope );
/* -------------------------------------------------------------------- */
/* Construct inclusive filter. */
/* -------------------------------------------------------------------- */
oRing.setPoint( 0, sEnvelope.MinX - 20.0, sEnvelope.MinY - 20.0 );
oRing.setPoint( 1, sEnvelope.MinX - 20.0, sEnvelope.MaxY + 10.0 );
oRing.setPoint( 2, sEnvelope.MaxX + 10.0, sEnvelope.MaxY + 10.0 );
oRing.setPoint( 3, sEnvelope.MaxX + 10.0, sEnvelope.MinY - 20.0 );
oRing.setPoint( 4, sEnvelope.MinX - 20.0, sEnvelope.MinY - 20.0 );
oInclusiveFilter.addRing( &oRing );
poLayer->SetSpatialFilter( &oInclusiveFilter );
/* -------------------------------------------------------------------- */
/* Verify that we can find the target feature. */
/* -------------------------------------------------------------------- */
poLayer->ResetReading();
while( (poFeature = poLayer->GetNextFeature()) != NULL )
{
if( poFeature->Equal(poTargetFeature) )
{
OGRFeature::DestroyFeature(poFeature);
break;
}
else
OGRFeature::DestroyFeature(poFeature);
}
if( poFeature == NULL )
{
bRet = FALSE;
printf( "ERROR: Spatial filter eliminated a feature unexpectedly!\n");
}
else if( bVerbose )
{
printf( "INFO: Spatial filter inclusion seems to work.\n" );
}
nInclusiveCount = poLayer->GetFeatureCount();
/* -------------------------------------------------------------------- */
/* Construct exclusive filter. */
/* -------------------------------------------------------------------- */
oRing.setPoint( 0, sEnvelope.MinX - 20.0, sEnvelope.MinY - 20.0 );
oRing.setPoint( 1, sEnvelope.MinX - 10.0, sEnvelope.MinY - 20.0 );
oRing.setPoint( 2, sEnvelope.MinX - 10.0, sEnvelope.MinY - 10.0 );
oRing.setPoint( 3, sEnvelope.MinX - 20.0, sEnvelope.MinY - 10.0 );
oRing.setPoint( 4, sEnvelope.MinX - 20.0, sEnvelope.MinY - 20.0 );
oExclusiveFilter.addRing( &oRing );
poLayer->SetSpatialFilter( &oExclusiveFilter );
/* -------------------------------------------------------------------- */
/* Verify that we can find the target feature. */
/* -------------------------------------------------------------------- */
poLayer->ResetReading();
while( (poFeature = poLayer->GetNextFeature()) != NULL )
{
if( poFeature->Equal(poTargetFeature) )
{
OGRFeature::DestroyFeature(poFeature);
//.........这里部分代码省略.........
示例12: if
//.........这里部分代码省略.........
else if( psElement->style == DGNS_LONG_DASH )
sprintf( szPen, "PEN(id:\"ogr-pen-4\"" );
else if( psElement->style == DGNS_DOT_DASH )
sprintf( szPen, "PEN(id:\"ogr-pen-6\"" );
else if( psElement->style == DGNS_SHORT_DASH )
sprintf( szPen, "PEN(id:\"ogr-pen-3\"" );
else if( psElement->style == DGNS_DASH_DOUBLE_DOT )
sprintf( szPen, "PEN(id:\"ogr-pen-7\"" );
else if( psElement->style == DGNS_LONG_DASH_SHORT_DASH )
sprintf( szPen, "PEN(p:\"10px 5px 4px 5px\"" );
else
sprintf( szPen, "PEN(id:\"ogr-pen-0\"" );
if( strlen(szFSColor) > 0 )
sprintf( szPen+strlen(szPen), ",%s", szFSColor );
if( psElement->weight > 1 )
sprintf( szPen+strlen(szPen), ",w:%dpx", psElement->weight );
strcat( szPen, ")" );
switch( psElement->stype )
{
case DGNST_MULTIPOINT:
if( psElement->type == DGNT_SHAPE )
{
OGRLinearRing *poLine = new OGRLinearRing();
OGRPolygon *poPolygon = new OGRPolygon();
DGNElemMultiPoint *psEMP = (DGNElemMultiPoint *) psElement;
poLine->setNumPoints( psEMP->num_vertices );
for( int i = 0; i < psEMP->num_vertices; i++ )
{
poLine->setPoint( i,
psEMP->vertices[i].x,
psEMP->vertices[i].y,
psEMP->vertices[i].z );
}
poPolygon->addRingDirectly( poLine );
poFeature->SetGeometryDirectly( poPolygon );
ConsiderBrush( psElement, szPen, poFeature );
}
else if( psElement->type == DGNT_CURVE )
{
DGNElemMultiPoint *psEMP = (DGNElemMultiPoint *) psElement;
OGRLineString *poLine = new OGRLineString();
DGNPoint *pasPoints;
int nPoints;
nPoints = 5 * psEMP->num_vertices;
pasPoints = (DGNPoint *) CPLMalloc(sizeof(DGNPoint) * nPoints);
DGNStrokeCurve( hDGN, psEMP, nPoints, pasPoints );
poLine->setNumPoints( nPoints );
for( int i = 0; i < nPoints; i++ )
{
poLine->setPoint( i,
pasPoints[i].x,
pasPoints[i].y,
pasPoints[i].z );
}