本文整理汇总了C++中ResetReading函数的典型用法代码示例。如果您正苦于以下问题:C++ ResetReading函数的具体用法?C++ ResetReading怎么用?C++ ResetReading使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ResetReading函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ResetReading
OGRFeature *OGRAVCBinLayer::GetNextFeature()
{
if( bNeedReset )
ResetReading();
OGRFeature *poFeature = GetFeature( -3 );
// Skip universe polygon.
if( poFeature != NULL && poFeature->GetFID() == 1
&& psSection->eType == AVCFilePAL )
{
OGRFeature::DestroyFeature( poFeature );
poFeature = GetFeature( -3 );
}
while( poFeature != NULL
&& ((m_poAttrQuery != NULL
&& !m_poAttrQuery->Evaluate( poFeature ) )
|| !FilterGeometry( poFeature->GetGeometryRef() ) ) )
{
OGRFeature::DestroyFeature( poFeature );
poFeature = GetFeature( -3 );
}
if( poFeature == NULL )
ResetReading();
return poFeature;
}
示例2: extractAllPoints
FeatureInfo extractAllPoints(const QString& fname, OGRCoordinateTransformation *trans)
{
FeatureInfo ret = FeatureInfo();
DataSourcePtr ds(OGRSFDriverRegistrar::Open(fname.toLocal8Bit(), false));
if (ds == nullptr)
{
qWarning() << "Error opening file:" << fname;
}
else
{
size_t verts, objs;
auto layer = ds->GetLayer(0);
layer->ResetReading();
std::tie(verts, objs) = countGeometry(layer);
qDebug() << "Points:" << verts << "Objects:" << objs;
// Initialize the info
ret.verts.reserve(verts);
ret.starts.reserve(objs);
ret.counts.reserve(objs);
layer->ResetReading();
extractGeometry(layer, trans, ret);
}
return ret;
}
示例3: ResetReading
int OGRCSVLayer::GetFeatureCount( int bForce )
{
if (bInWriteMode || m_poFilterGeom != NULL || m_poAttrQuery != NULL)
return OGRLayer::GetFeatureCount(bForce);
if (nTotalFeatures >= 0)
return nTotalFeatures;
if (fpCSV == NULL)
return 0;
ResetReading();
char **papszTokens;
nTotalFeatures = 0;
while(TRUE)
{
papszTokens = OGRCSVReadParseLineL( fpCSV, chDelimiter, bDontHonourStrings );
if( papszTokens == NULL )
break;
if( papszTokens[0] != NULL )
nTotalFeatures ++;
CSLDestroy(papszTokens);
}
ResetReading();
return nTotalFeatures;
}
示例4: ResetReading
int OGRHTFSoundingLayer::GetFeatureCount(int bForce)
{
if (m_poFilterGeom != NULL || m_poAttrQuery != NULL)
return OGRHTFLayer::GetFeatureCount(bForce);
if (nTotalSoundings != 0)
return nTotalSoundings;
ResetReading();
if (fpHTF == NULL)
return 0;
int nCount = 0;
const char* pszLine;
while( (pszLine = CPLReadLine2L(fpHTF, 1024, NULL)) != NULL)
{
if (pszLine[0] == ';')
{
/* comment */ ;
}
else if (pszLine[0] == 0)
break;
else if (strcmp(pszLine, "END OF SOUNDING DATA") == 0)
break;
else
nCount ++;
}
ResetReading();
return nCount;
}
示例5: VSIFSeekL
void OGRGeoJSONSeqLayer::Init()
{
if( STARTS_WITH(m_poDS->GetDescription(), "/vsimem/") ||
!STARTS_WITH(m_poDS->GetDescription(), "/vsi") )
{
VSIFSeekL(m_fp, 0, SEEK_END);
m_nFileSize = VSIFTellL(m_fp);
}
ResetReading();
while( true )
{
auto poObject = GetNextObject();
if( !poObject )
break;
if( OGRGeoJSONGetType(poObject) == GeoJSONObject::eFeature )
{
m_oReader.GenerateFeatureDefn(this, poObject);
}
json_object_put(poObject);
m_nTotalFeatures ++;
}
ResetReading();
m_nFileSize = 0;
m_nIter = 0;
m_oReader.FinalizeLayerDefn( this, m_osFIDColumn );
}
示例6: switch
void OGRGMELayer::SetSpatialFilter( OGRGeometry *poGeomIn)
{
if (poGeomIn == NULL) {
osIntersects.clear();
OGRLayer::SetSpatialFilter( poGeomIn );
return;
}
switch( poGeomIn->getGeometryType() )
{
case wkbPolygon:
WindPolygonCCW((OGRPolygon *) poGeomIn);
case wkbPoint:
case wkbLineString:
if( poGeomIn == NULL ) {
osIntersects = "";
}
else {
char * pszWkt;
poGeomIn->exportToWkt(&pszWkt);
char * pszEscaped = CPLEscapeString(pszWkt, -1, CPLES_URL);
osIntersects = CPLString(pszEscaped);
CPLFree(pszEscaped);
CPLFree(pszWkt);
}
ResetReading();
break;
default:
m_iGeomFieldFilter = 0;
if( InstallFilter( poGeomIn ) )
ResetReading();
break;
}
}
示例7: ResetReading
OGRErr OGRLayer::GetExtent(OGREnvelope *psExtent, int bForce )
{
OGRFeature *poFeature;
OGREnvelope oEnv;
GBool bExtentSet = FALSE;
/* -------------------------------------------------------------------- */
/* If this layer has a none geometry type, then we can */
/* reasonably assume there are not extents available. */
/* -------------------------------------------------------------------- */
if( GetLayerDefn()->GetGeomType() == wkbNone )
{
psExtent->MinX = 0.0;
psExtent->MaxX = 0.0;
psExtent->MinY = 0.0;
psExtent->MaxY = 0.0;
return OGRERR_FAILURE;
}
/* -------------------------------------------------------------------- */
/* If not forced, we should avoid having to scan all the */
/* features and just return a failure. */
/* -------------------------------------------------------------------- */
if( !bForce )
return OGRERR_FAILURE;
/* -------------------------------------------------------------------- */
/* OK, we hate to do this, but go ahead and read through all */
/* the features to collect geometries and build extents. */
/* -------------------------------------------------------------------- */
ResetReading();
while( (poFeature = GetNextFeature()) != NULL )
{
OGRGeometry *poGeom = poFeature->GetGeometryRef();
if (poGeom && !bExtentSet)
{
poGeom->getEnvelope(psExtent);
bExtentSet = TRUE;
}
else if (poGeom)
{
poGeom->getEnvelope(&oEnv);
if (oEnv.MinX < psExtent->MinX)
psExtent->MinX = oEnv.MinX;
if (oEnv.MinY < psExtent->MinY)
psExtent->MinY = oEnv.MinY;
if (oEnv.MaxX > psExtent->MaxX)
psExtent->MaxX = oEnv.MaxX;
if (oEnv.MaxY > psExtent->MaxY)
psExtent->MaxY = oEnv.MaxY;
}
delete poFeature;
}
ResetReading();
return (bExtentSet ? OGRERR_NONE : OGRERR_FAILURE);
}
示例8: SetSpatialFilter
OGRFeature *OGROGDILayer::GetFeature( GIntBig nFeatureId )
{
ecs_Result *psResult;
if (m_nTotalShapeCount != -1 && nFeatureId > m_nTotalShapeCount)
return NULL;
/* Unset spatial filter */
OGRGeometry* poOldFilterGeom = ( m_poFilterGeom != NULL ) ? m_poFilterGeom->clone() : NULL;
if( poOldFilterGeom != NULL )
SetSpatialFilter(NULL);
/* Reset reading if we are not the current layer */
/* WARNING : this does not allow interleaved reading of layers */
if( m_poODS->GetCurrentLayer() != this )
{
m_poODS->SetCurrentLayer(this);
ResetReading();
}
else if ( nFeatureId < m_iNextShapeId )
ResetReading();
while(m_iNextShapeId != nFeatureId)
{
psResult = cln_GetNextObject(m_nClientID);
if (ECSSUCCESS(psResult))
m_iNextShapeId++;
else
{
// We probably reached EOF... keep track of shape count.
m_nTotalShapeCount = m_iNextShapeId;
if( poOldFilterGeom != NULL )
{
SetSpatialFilter(poOldFilterGeom);
delete poOldFilterGeom;
}
return NULL;
}
}
// OK, we're ready to read the requested feature...
OGRFeature* poFeature = GetNextRawFeature();
if( poOldFilterGeom != NULL )
{
SetSpatialFilter(poOldFilterGeom);
delete poOldFilterGeom;
}
return poFeature;
}
示例9: ResetReading
OGRFeature *OGROGDILayer::GetFeature( long nFeatureId )
{
ecs_Result *psResult;
if (m_nTotalShapeCount != -1 && nFeatureId > m_nTotalShapeCount)
return NULL;
if (m_iNextShapeId > nFeatureId )
ResetReading();
while(m_iNextShapeId != nFeatureId)
{
psResult = cln_GetNextObject(m_nClientID);
if (ECSSUCCESS(psResult))
m_iNextShapeId++;
else
{
// We probably reached EOF... keep track of shape count.
m_nTotalShapeCount = m_iNextShapeId;
return NULL;
}
}
// OK, we're ready to read the requested feature...
return GetNextFeature();
}
示例10: SetDescription
OGRPLScenesLayer::OGRPLScenesLayer(OGRPLScenesDataset* poDS,
const char* pszName,
const char* pszBaseURL,
json_object* poObjCount10)
{
this->poDS = poDS;
osBaseURL = pszBaseURL;
SetDescription(pszName);
poFeatureDefn = new OGRFeatureDefn(pszName);
poFeatureDefn->SetGeomType(wkbMultiPolygon);
for(int i = 0; i < (int)sizeof(apsAttrs) / (int)sizeof(apsAttrs[0]); i++)
{
OGRFieldDefn oField(apsAttrs[i].pszName, apsAttrs[i].eType);
poFeatureDefn->AddFieldDefn(&oField);
}
poFeatureDefn->Reference();
poSRS = new OGRSpatialReference(SRS_WKT_WGS84);
poFeatureDefn->GetGeomFieldDefn(0)->SetSpatialRef(poSRS);
bEOF = FALSE;
nFeatureCount = -1;
nNextFID = 1;
poGeoJSONDS = NULL;
poGeoJSONLayer = NULL;
poMainFilter = NULL;
nPageSize = atoi(CPLGetConfigOption("PLSCENES_PAGE_SIZE", "1000"));
bStillInFirstPage = FALSE;
bAcquiredAscending = -1;
bFilterMustBeClientSideEvaluated = FALSE;
ResetReading();
if( poObjCount10 != NULL )
{
json_object* poCount = json_object_object_get(poObjCount10, "count");
if( poCount != NULL )
nFeatureCount = MAX(0, json_object_get_int64(poCount));
OGRGeoJSONDataSource* poTmpDS = new OGRGeoJSONDataSource();
OGRGeoJSONReader oReader;
oReader.SetFlattenNestedAttributes(true, '.');
oReader.ReadLayer( poTmpDS, "layer", poObjCount10 );
OGRLayer* poTmpLayer = poTmpDS->GetLayer(0);
if( poTmpLayer )
{
OGRFeatureDefn* poTmpFDefn = poTmpLayer->GetLayerDefn();
std::vector<CPLString> aosNewFields;
for(int i=0;i<poTmpFDefn->GetFieldCount();i++)
{
if( poFeatureDefn->GetFieldIndex(poTmpFDefn->GetFieldDefn(i)->GetNameRef()) < 0 )
aosNewFields.push_back(poTmpFDefn->GetFieldDefn(i)->GetNameRef());
}
std::sort(aosNewFields.begin(), aosNewFields.end(), OGRPLScenesLayerFieldNameComparator);
for(int i=0;i<(int)aosNewFields.size();i++)
{
OGRFieldDefn oField(poTmpFDefn->GetFieldDefn(poTmpFDefn->GetFieldIndex(aosNewFields[i])));
poFeatureDefn->AddFieldDefn(&oField);
}
}
delete poTmpDS;
}
}
示例11: ResetReading
void OGRBNALayer::FastParseUntil ( int interestFID)
{
if (partialIndexTable)
{
ResetReading();
BNARecord* record;
if (nFeatures > 0)
{
VSIFSeekL( fpBNA, offsetAndLineFeaturesTable[nFeatures-1].offset, SEEK_SET );
curLine = offsetAndLineFeaturesTable[nFeatures-1].line;
/* Just skip the last read one */
int ok = FALSE;
record = BNA_GetNextRecord(fpBNA, &ok, &curLine, TRUE, BNA_READ_NONE);
BNA_FreeRecord(record);
}
while(1)
{
int ok = FALSE;
int offset = (int) VSIFTellL(fpBNA);
int line = curLine;
record = BNA_GetNextRecord(fpBNA, &ok, &curLine, TRUE, BNA_READ_NONE);
if (ok == FALSE)
{
failed = TRUE;
return;
}
if (record == NULL)
{
/* end of file */
eof = TRUE;
/* and we have finally build the whole index table */
partialIndexTable = FALSE;
return;
}
if (record->featureType == bnaFeatureType)
{
nFeatures++;
offsetAndLineFeaturesTable =
(OffsetAndLine*)CPLRealloc(offsetAndLineFeaturesTable, nFeatures * sizeof(OffsetAndLine));
offsetAndLineFeaturesTable[nFeatures-1].offset = offset;
offsetAndLineFeaturesTable[nFeatures-1].line = line;
BNA_FreeRecord(record);
if (nFeatures - 1 == interestFID)
return;
}
else
{
BNA_FreeRecord(record);
}
}
}
}
示例12: ResetReading
OGRFeature *OGRFMELayerCached::ReadNextIndexFeature()
{
OGRFeature *poOGRFeature = NULL;
FME_Boolean endOfQuery;
if( poIndex == NULL )
return NULL;
if( !bQueryActive )
ResetReading();
poDS->AcquireSession();
if( poIndex->fetch( *poFMEFeature, endOfQuery ) == 0
&& !endOfQuery )
{
poOGRFeature = poDS->ProcessFeature( this, poFMEFeature );
if( poOGRFeature != NULL )
{
poOGRFeature->SetFID( ++nPreviousFeature );
m_nFeaturesRead++;
}
}
poDS->ReleaseSession();
return poOGRFeature;
}
示例13: if
void OGRSQLiteSelectLayerCommonBehaviour::SetSpatialFilter( int iGeomField, OGRGeometry * poGeomIn )
{
if( iGeomField == 0 && poGeomIn == NULL && poLayer->GetLayerDefn()->GetGeomFieldCount() == 0 )
{
/* do nothing */
}
else if( iGeomField < 0 || iGeomField >= poLayer->GetLayerDefn()->GetGeomFieldCount() )
{
CPLError(CE_Failure, CPLE_AppDefined,
"Invalid geometry field index : %d", iGeomField);
return;
}
bAllowResetReadingEvenIfIndexAtZero = TRUE;
int& m_iGeomFieldFilter = poLayer->GetIGeomFieldFilter();
m_iGeomFieldFilter = iGeomField;
if( poLayer->InstallFilter( poGeomIn ) )
{
BuildSQL();
ResetReading();
}
}
示例14: OGRFeatureDefn
OGRSEGP1Layer::OGRSEGP1Layer( const char* pszFilename,
VSILFILE* fp,
int nLatitudeCol )
{
this->fp = fp;
this->nLatitudeCol = nLatitudeCol;
nNextFID = 0;
bEOF = FALSE;
poSRS = NULL;
poFeatureDefn = new OGRFeatureDefn( CPLGetBasename(pszFilename) );
SetDescription( poFeatureDefn->GetName() );
poFeatureDefn->Reference();
poFeatureDefn->SetGeomType( wkbPoint );
for(int i=0;i<(int)(sizeof(SEGP1Fields)/sizeof(SEGP1Fields[0]));i++)
{
OGRFieldDefn oField( SEGP1Fields[i].pszName,
SEGP1Fields[i].eType );
poFeatureDefn->AddFieldDefn( &oField );
}
bUseEastingNorthingAsGeometry =
CSLTestBoolean(CPLGetConfigOption("SEGP1_USE_EASTING_NORTHING", "NO"));
ResetReading();
}
示例15: ResetReading
void OGRDWGLayer::SetBlockTable( OdDbBlockTableRecordPtr poNewBlock )
{
m_poBlock = poNewBlock;
ResetReading();
}