Exemplo n.º 1
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;
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
0
 public MG_Value(MG_Value v)
 {
     this.Index = v.Index;
     this.Value = v.Value;
 }
Exemplo n.º 4
0
        public void SetValue(int index, object value)
        {
            MG_Value v = new MG_Value(index, value);

            this.ValueSet.Add(v);
        }
Exemplo n.º 5
0
 public void SetValue(int index, object value)
 {
     MG_Value v = new MG_Value(index, value);
     this.ValueSet.Add(v);
 }
Exemplo n.º 6
0
 public void Add(MG_Value value)
 {
     this.Values.Add(value);
 }
Exemplo n.º 7
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;
        }
Exemplo n.º 8
0
 public MG_Value(MG_Value v)
 {
     this.Index = v.Index;
     this.Value = v.Value;
 }