public PostGisFeature(PostGisFeatureClass postGisFeatureClass, IDataRecord dataRecord) { //log.enterFunc("ctor"); //if (log.IsDebugEnabled) log.Debug(CHelper.objectToString(postGisFeatureClass) + "," + CHelper.objectToString(dataRecord)); try { m_featClass = postGisFeatureClass; m_values = new object[Fields.FieldCount]; // Load the record. object o; string name; string idFld = PostGisConstants.idField.ToLower(); string geomFld = postGisFeatureClass.postGisLayer.geometryField.ToLower(); for (int i = 0; i < dataRecord.FieldCount; i++) { // Do some book keeping. o = dataRecord[i]; name = dataRecord.GetName(i).ToLower(); if (o == DBNull.Value) { continue; } // *--- Handle special fields ---* // Load the Id. if (name == idFld) { m_oid = dataRecord.GetInt32(i); } //m_oid = (int)o; // Load the geometry. else if (name == geomFld) { WkbParser parser = new WkbParser(); m_geom = parser.parseWkb((byte[])o); o = Shape; } // *-----------------------------* m_values[i] = o; } } finally { log.leaveFunc(); } }
/// <summary> /// Create a SelectionSet from a dataReader /// </summary> /// <param name="postGisFeatureClass"></param> /// <param name="dataReader"></param> public PostGisSelectionSet(PostGisFeatureClass postGisFeatureClass, AutoDataReader dataReader) { System.Diagnostics.Debug.WriteLine("NOT-Empty PostGisSelectionSet..."); m_featClass = postGisFeatureClass; //oids.Add(1); m_dr = dataReader; if (dataReader != null) { while (dataReader.Read()) { oids.Add((object)dataReader[PostGisConstants.idField]); } dataReader.Close(); } }
public PostGisFeatureCursor(PostGisFeatureClass postGisFeatureClass, IDataReader dataReader) { m_featClass = postGisFeatureClass; m_dr = dataReader; }
/// <summary> /// Create an empty SelectionSet /// </summary> /// <param name="postGisFeatureClass"></param> public PostGisSelectionSet(PostGisFeatureClass postGisFeatureClass) : this(postGisFeatureClass, null) { System.Diagnostics.Debug.WriteLine("Empty PostGisSelectionSet..."); m_featClass = postGisFeatureClass; }
public IFeatureClass OpenFeatureClass(string Name) { try { log.enterFunc("OpenFeatureClass"); // Name should look like "view" or "schema.view". // Default the schema to "public". string[] bits = Name.Split('.'); string schema = "public"; string view = bits[0]; if (bits.Length > 1) { schema = bits[0]; view = bits[1]; } PostGisDatasetName dsName = new PostGisDatasetName(); dsName.WorkspaceName = PostGisWorkspaceName; dsName.Name = schema; // Todo - ensure the schema exists. Is it possible? PostGisFeatureDataset featureDs = new PostGisFeatureDataset(dsName, this); IFeatureClass retVal = new PostGisFeatureClass(featureDs, view); log.leaveFunc(); return retVal; } catch (Exception ex) { System.Diagnostics.EventLog.WriteEntry("OpenFeatureClass", ex.ToString() + "///" + ex.StackTrace, System.Diagnostics.EventLogEntryType.Information); return null; } }
public PostGisFeature(PostGisFeatureClass postGisFeatureClass, IDataRecord dataRecord) { //log.enterFunc("ctor"); //if (log.IsDebugEnabled) log.Debug(CHelper.objectToString(postGisFeatureClass) + "," + CHelper.objectToString(dataRecord)); try { m_featClass = postGisFeatureClass; m_values = new object[Fields.FieldCount]; // Load the record. object o; string name; string idFld = PostGisConstants.idField.ToLower(); string geomFld = postGisFeatureClass.postGisLayer.geometryField.ToLower(); for (int i = 0; i < dataRecord.FieldCount; i++) { // Do some book keeping. o = dataRecord[i]; name = dataRecord.GetName(i).ToLower(); if (o == DBNull.Value) continue; // *--- Handle special fields ---* // Load the Id. if (name == idFld) m_oid = dataRecord.GetInt32(i); //m_oid = (int)o; // Load the geometry. else if (name == geomFld) { WkbParser parser = new WkbParser(); m_geom = parser.parseWkb((byte[])o); o = Shape; } // *-----------------------------* m_values[i] = o; } } finally { log.leaveFunc(); } }