Skip to content

Commit

Permalink
Fix bounding box by forcing sequential scan when envelope is null. Al…
Browse files Browse the repository at this point in the history
…so, let the cursor's exceptions percolate passed cursor helper functions
  • Loading branch information
rburhum committed Sep 22, 2012
1 parent 9640dc3 commit 8760eb0
Showing 1 changed file with 16 additions and 30 deletions.
46 changes: 16 additions & 30 deletions src/OGRPlugin/OGRPlugin/OGRDataset.cs
Expand Up @@ -156,6 +156,12 @@ public IEnvelope Bounds
OSGeo.OGR.Envelope ogrEnvelope = new OSGeo.OGR.Envelope();
m_layer.GetExtent(ogrEnvelope,0);

if (ogrEnvelope.MinX == 0 &&
ogrEnvelope.MaxX == 0 &&
ogrEnvelope.MinY == 0 &&
ogrEnvelope.MaxY == 0)
m_layer.GetExtent(ogrEnvelope, 1);

return ogr_utils.get_extent(ogrEnvelope, m_spatialReference);
}
}
Expand Down Expand Up @@ -197,44 +203,24 @@ public int get_ClassIndex(string Name)
#region Fetching - returns cursor
public IPlugInCursorHelper FetchAll(int ClassIndex, string whereClause, object fieldMap)
{
try
{
OGRCursor allCursor = new OGRCursor(this, whereClause, (System.Array) fieldMap, null);
return (IPlugInCursorHelper)allCursor;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
return null;
}
OGRCursor allCursor = new OGRCursor(this, whereClause, (System.Array) fieldMap, null);

return (IPlugInCursorHelper)allCursor;
}

public IPlugInCursorHelper FetchByID(int ClassIndex, int ID, object fieldMap)
{
try
{
OGRCursor allCursor = new OGRCursor(this, null, (System.Array)fieldMap, null, ID);
return (IPlugInCursorHelper)allCursor;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
return null;
}
OGRCursor allCursor = new OGRCursor(this, null, (System.Array)fieldMap, null, ID);

return (IPlugInCursorHelper)allCursor;

}

public IPlugInCursorHelper FetchByEnvelope(int ClassIndex, IEnvelope env, bool strictSearch, string whereClause, object fieldMap)
{
try
{
OGRCursor allCursor = new OGRCursor(this, whereClause, (System.Array)fieldMap, env);
return (IPlugInCursorHelper)allCursor;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
return null;
}
OGRCursor allCursor = new OGRCursor(this, whereClause, (System.Array)fieldMap, env);

return (IPlugInCursorHelper)allCursor;
}

#endregion
Expand Down

0 comments on commit 8760eb0

Please sign in to comment.