Example #1
0
 public MG_Field(MG_Field f)
 {
     this.Name = f.Name;
     this.Type = f.Type;
     this.Width = f.Width;
     this.Precision = f.Precision;
 }
Example #2
0
 public MG_Field(MG_Field f)
 {
     this.Name      = f.Name;
     this.Type      = f.Type;
     this.Width     = f.Width;
     this.Precision = f.Precision;
 }
Example #3
0
        public MG_Feature(MG_Feature f)
        {
            this.FieldSet = new MG_FieldSet();
            this.ValueSet = new MG_ValueSet();
            this.Geometry = new MG_Geometry();
            this.Symbol   = new MG_Symbol();

            for (int i = 0; i < f.GetFieldCount(); i++)
            {
                MG_Field field    = f.GetFieldSet().GetAt(i);
                MG_Field newField = new MG_Field(field);
                this.FieldSet.Add(newField);

                MG_Value value    = f.GetValue(i);
                MG_Value newValue = new MG_Value(value);
                this.ValueSet.Add(newValue);
            }
            MG_Geometry g       = f.GetGeometry();
            MG_Geometry newGeom = new MG_Geometry();

            switch (g.Type)
            {
            case MG_GeometryType.NONE:
                break;

            case MG_GeometryType.POINT:
                newGeom = new MG_Point(g as MG_Point);
                break;

            case MG_GeometryType.MULTIPOINT:
                newGeom = new MG_MultiPoint(g as MG_MultiPoint);
                break;

            case MG_GeometryType.LINESTRING:
                newGeom = new MG_LineString(g as MG_LineString);
                break;

            case MG_GeometryType.MULTILINESTRING:
                newGeom = new MG_MultiLineString(g as MG_MultiLineString);
                break;

            case MG_GeometryType.POLYGON:
                newGeom = new MG_Polygon(g as MG_Polygon);
                break;

            case MG_GeometryType.MULTIPOLYGON:
                newGeom = new MG_MultiPolygon(g as MG_MultiPolygon);
                break;
            }
            this.Geometry = newGeom;
            MG_Symbol newSymbol = new MG_Symbol(f.GetSymbol());

            this.Symbol = newSymbol;
        }
Example #4
0
        public MG_Feature(MG_Feature f)
        {
            this.FieldSet = new MG_FieldSet();
            this.ValueSet = new MG_ValueSet();
            this.Geometry = new MG_Geometry();
            this.Symbol = new MG_Symbol();

            for (int i = 0; i < f.GetFieldCount();i++ )
            {
                MG_Field field = f.GetFieldSet().GetAt(i);
                MG_Field newField = new MG_Field(field);
                this.FieldSet.Add(newField);

                MG_Value value = f.GetValue(i);
                MG_Value newValue = new MG_Value(value);
                this.ValueSet.Add(newValue);
            }
            MG_Geometry g = f.GetGeometry();
            MG_Geometry newGeom = new MG_Geometry();
            switch (g.Type)
            {
                case MG_GeometryType.NONE:
                    break;
                case MG_GeometryType.POINT:
                    newGeom = new MG_Point(g as MG_Point);
                    break;
                case MG_GeometryType.MULTIPOINT:
                    newGeom = new MG_MultiPoint(g as MG_MultiPoint);
                    break;
                case MG_GeometryType.LINESTRING:
                    newGeom = new MG_LineString(g as MG_LineString);
                    break;
                case MG_GeometryType.MULTILINESTRING:
                    newGeom = new MG_MultiLineString(g as MG_MultiLineString);
                    break;
                case MG_GeometryType.POLYGON:
                    newGeom = new MG_Polygon(g as MG_Polygon);
                    break;
                case MG_GeometryType.MULTIPOLYGON:
                    newGeom = new MG_MultiPolygon(g as MG_MultiPolygon);
                    break;
            }
            this.Geometry = newGeom;
            MG_Symbol newSymbol = new MG_Symbol(f.GetSymbol());
            this.Symbol = newSymbol;
        }
Example #5
0
        private void newField_Click(object sender, EventArgs e)
        {
            MG_Layer layer = this.getSelectedLayer();

            // new a field
            MG_Field field = new MG_Field();
            MG_DlgNewField dlg = new MG_DlgNewField();
            dlg.InitializeFieldName(field.Name);
            dlg.InitializeFieldTypes();
            dlg.ShowDialog();
            field.Name = dlg.GetFieldName();
            field.Type = dlg.GetFieldType();

            //add field to layer
            layer.AddField(field);

            // set state
            this.setState();
        }
Example #6
0
 public void Add(MG_Field field)
 {
     this.Fields.Add(field);
 }
Example #7
0
 public void Add(MG_Field field)
 {
     this.Fields.Add(field);
 }
Example #8
0
 public void AddField(MG_Field field)
 {
     this.FieldSet.Add(field);
 }
Example #9
0
 public void AddField(MG_Field field)
 {
     this.FieldSet.Add(field);
 }
Example #10
0
        protected MG_FieldSet GetFieldSet(string table)
        {
            ArrayList columns = this.GetColumnNames(table);
            ArrayList types = this.GetColumnTypes(table);
            if (columns == null || types == null)
                return null;
            int columnCount = columns.Count;
            int typeCount = types.Count;
            if (columnCount != typeCount)
                return null;
            MG_FieldSet fieldSet = new MG_FieldSet(table);

            // oid .... geom
            for (int i = 0; i < columnCount;i++ )
            {
                string column = columns[i].ToString();
                string type = types[i].ToString();
                if (!column.Equals("oid") && !column.Equals("geom"))
                {
                    // oid      name                geom         no       length
                    // integer character varying  USER-DEFINED  integer double precision
                    MG_FieldDBType dbType = MG_FieldDBType.VARCHAR;
                    if (type.Equals("integer"))
                    {
                        dbType = MG_FieldDBType.INTEGER;
                    }
                    else if (type.Equals("character varying"))
                    {
                        dbType = MG_FieldDBType.VARCHAR;
                    }
                    else if (type.Equals("double precision"))
                    {
                        dbType = MG_FieldDBType.FLOAT8;
                    }

                    MG_Field field = new MG_Field(column,dbType);
                    fieldSet.Add(field);
                }
            }

            return fieldSet;
        }