Beispiel #1
0
        internal Layer(Connection connection, int oid)
            : this(connection)
        {
            m_oid = oid;

            loadLayer(true);
        }
Beispiel #2
0
        internal Layer(Connection connection, string schema, string view)
            : this(connection)
        {
            m_schema = schema;
            m_view = view;

            loadLayer(false);
        }
Beispiel #3
0
 public static ISpatialReference setEsriSpatiaReferenceFromSrText(int srid, Connection conn)
 {
     ISpatialReference sr = new UnknownCoordinateSystemClass();
     string srText = "";
     int i = 0;
     try
     {
         //Bill: query srtext associated with srid
         AutoDataReader dr = conn.doQuery("select * from spatial_ref_sys where srid = " + srid.ToString());
         if (dr.Read())
         {
             srText = dr["srtext"] + "";
             ISpatialReferenceFactory2 srf = new SpatialReferenceEnvironmentClass();
             if (srText == "")
             {
                 sr = new UnknownCoordinateSystemClass();
             }
             else
             {
                 //use srText to construct SR.
                 srf.CreateESRISpatialReference(srText, out sr, out i);
             }
         }
         return sr;
     }
     catch
     {
         //PostGis srid is not implemented as an Esri Factory Code
         sr = new UnknownCoordinateSystemClass();
         return sr;
     }
 }
Beispiel #4
0
 /// <summary>
 /// This constructor accepts a connection and loads the array that will drive the enumerator
 /// </summary>
 /// <param name="conn">connection</param>
 public PostGisEnumDatasetName(Connection conn) //constructor with connection
 {
     try
     {
         m_conn = conn; //save the connection. we save not need to do list.
         string sql = "select count(*) from public.geometry_columns;";
         AutoDataReader dr = conn.doQuery(sql); //get the number of layers in the database
         dr.Read();
        layerCount = Convert.ToInt32(dr["count"]); //capture the layer count
         dr.Close();
         sql = "select * from public.geometry_columns order by f_table_schema, f_table_name;";
         dr = conn.doQuery(sql); //get the records for the layers
         if (layerCount > 0) //if there's data
         {
             pgdsn = new PostGisDatasetName[layerCount]; //init the array
             int i = 0;
             while (dr.Read()) //loop the data reader
             {
                 pgdsn[i] = new PostGisDatasetName(); //instantiate a new dataset name
                 pgdsn[i].Name = dr["f_table_schema"] + "." + dr["f_table_name"]; //assign the name using the schema.view format
                 i += 1;
             }
         }
     }
     catch (Exception ex)
     {
         //what the heck went wrong here?
         System.Diagnostics.EventLog.WriteEntry("PostGisEnumDatasetName", ex.ToString() + "///" + ex.StackTrace, System.Diagnostics.EventLogEntryType.Error);
     }
 }		
Beispiel #5
0
 private Layer(Connection connection)
 {
     m_con = connection;
 }