예제 #1
0
        public MG_GeometryType Type; // default NONE

        public MG_Layer()
        {
            layerCount++;
            this.LayerName  = "Layer_" + layerCount.ToString();
            this.LayerPath  = null;
            this.IsVisible  = true;
            this.FeatureSet = new MG_FeatureSet();
            this.FieldSet   = new MG_FieldSet(this.LayerName);
            this.Extent     = new MG_MapExtent();
            this.Type       = MG_GeometryType.NONE;
        }
예제 #2
0
        private string LayerPath; // null or not

        #endregion Fields

        #region Constructors

        public MG_Layer()
        {
            layerCount++;
            this.LayerName = "Layer_" + layerCount.ToString();
            this.LayerPath = null;
            this.IsVisible = true;
            this.FeatureSet = new MG_FeatureSet();
            this.FieldSet = new MG_FieldSet(this.LayerName);
            this.Extent = new MG_MapExtent();
            this.Type = MG_GeometryType.NONE;
        }
예제 #3
0
        protected MG_FeatureSet GetFeatureSet(MG_FieldSet fieldSet,string table)
        {
            NpgsqlDataReader reader = this.SelectAll(table);
            if (reader == null || !reader.HasRows)
            return null;

            MG_FeatureSet featureSet = new MG_FeatureSet();
            int fc = reader.FieldCount; // 4
            while (reader.Read())
            {// oid f1,f2,f3... geom
                MG_Feature f = new MG_Feature(fieldSet);
                MG_ValueSet valueSet = new MG_ValueSet();
                string oid = reader["oid"].ToString();
                string geom = reader["geomtext"].ToString();

                for (int i = 1; i < fc-1; i++)
                {
                    string str = reader[i].ToString();
                    MG_Value value = new MG_Value(i - 1, str);
                    valueSet.Add(value);
                }
                f.ValueSet = valueSet;
                f.Geometry = MG_ShapeFileOper.AsGeometry(geom);
                featureSet.Add(f);
            }
            reader.Close();
            reader.Dispose();
            return featureSet;
        }