Ejemplo n.º 1
0
        internal PostGisFields(Layer postGisLayer)
        {
            log.enterFunc("ctor");

            try
            {
                bool hasGIDField = false;
                if (log.IsDebugEnabled)
                {
                    log.Debug("1");
                }
                DataTable dataFields = postGisLayer.getDataFields(false);
                if (log.IsDebugEnabled)
                {
                    log.Debug("2");
                }
                m_flds = new PostGisField[dataFields.Rows.Count];
                m_ids  = new Hashtable(fields.Length);
                PostGisField pgisFld;
                int          i = 0;
                foreach (DataRow r in dataFields.Rows)
                {
                    pgisFld   = new PostGisField(postGisLayer, r, i);
                    m_flds[i] = pgisFld;
                    m_ids.Add(pgisFld.Name, i);
                    if (pgisFld.Name.ToLower() == "gid")
                    {
                        hasGIDField = true;
                    }
                    ++i;
                }
                //gid (int4 or int8) is mandatory as GDB unique OID
                if (hasGIDField == false)
                {
                    System.Windows.Forms.MessageBox.Show("This PostGis layer will be added in ArcMap but will not correctly work for some funcitonality (selections, rendering, ...): it misses a mandatory gid (int) field as unique OID for each feature. This gid field is necessary for the Esri Geodatabase model.");
                }
            }
            catch (Exception e)
            {
                log.Error("", e);
                throw;
            }
            finally
            {
                log.leaveFunc();
            }
        }
Ejemplo n.º 2
0
        internal PostGisFields(Layer postGisLayer)
        {
            log.enterFunc("ctor");

            try
            {
				bool hasGIDField = false;
                if (log.IsDebugEnabled) log.Debug("1");
                DataTable dataFields = postGisLayer.getDataFields(false);
                if (log.IsDebugEnabled) log.Debug("2");
                m_flds = new PostGisField[dataFields.Rows.Count];
                m_ids = new Hashtable(fields.Length);
                PostGisField pgisFld;
                int i = 0;
                foreach (DataRow r in dataFields.Rows)
                {
                    pgisFld = new PostGisField(postGisLayer, r, i);
                    m_flds[i] = pgisFld;
                    m_ids.Add(pgisFld.Name, i);
					if(pgisFld.Name.ToLower()=="gid")
					{
						hasGIDField=true;
					}
                    ++i;
                }
				//gid (int4 or int8) is mandatory as GDB unique OID
				if (hasGIDField==false)
				{
					System.Windows.Forms.MessageBox.Show("This PostGis layer will be added in ArcMap but will not correctly work for some funcitonality (selections, rendering, ...): it misses a mandatory gid (int) field as unique OID for each feature. This gid field is necessary for the Esri Geodatabase model.");
				}
            }
            catch (Exception e)
            {
                log.Error("", e);
                throw;
            }
            finally
            {
                log.leaveFunc();
            }
        }