Ejemplo 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;
        }
Ejemplo n.º 2
0
 public MG_MultiPoint(MG_MultiPoint mp)
 {
     this.Type = MG_GeometryType.MULTIPOINT;
     this.Points = new List<MG_Point>();
     if (mp != null)
     {
         for (int i = 0; i < mp.Count(); i++)
         {
             MG_Point p = new MG_Point(mp.GetAt(i));
             this.Add(p);
         }
     }
 }
Ejemplo n.º 3
0
 public MG_MultiPoint(MG_MultiPoint mp)
 {
     this.Type   = MG_GeometryType.MULTIPOINT;
     this.Points = new List <MG_Point>();
     if (mp != null)
     {
         for (int i = 0; i < mp.Count(); i++)
         {
             MG_Point p = new MG_Point(mp.GetAt(i));
             this.Add(p);
         }
     }
 }
Ejemplo n.º 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;
        }
Ejemplo n.º 5
0
        private void testGeometry()
        {
            MG_Point p = new MG_Point(100, 200);
            string type = p.Type.ToString();
            string wkt = p.AsWKT();
            string wkt_reduced = p.AsWKT_Reduced();
            byte[] wkb = p.AsWKB();

            MG_MultiPoint mp = new MG_MultiPoint();
            for (int i = 0; i < 10; i++)
            {
                MG_Point pp = new MG_Point(i, i);
                mp.Add(pp);
            }
            type = mp.Type.ToString();
            wkt = mp.AsWKT();
            wkt_reduced = mp.AsWKT_Reduced();
            wkb = mp.AsWKB();

            MG_LineString l = new MG_LineString();
            for (int i = 0; i < 10; i++)
            {
                MG_Point pp = new MG_Point(i, i);
                l.Add(pp);
            }
            type = l.Type.ToString();
            wkt = l.AsWKT();
            wkt_reduced = l.AsWKT_Reduced();
            wkb = l.AsWKB();

            MG_MultiLineString ml = new MG_MultiLineString();
            for (int i = 0; i < 5; i++)
            {
                MG_LineString l2 = new MG_LineString();
                for (int j = 0; j < 3; j++)
                {
                    MG_Point pp = new MG_Point(i, j);
                    l2.Add(pp);
                }
                ml.Add(l2);
            }
            type = ml.Type.ToString();
            wkt = ml.AsWKT();
            wkt_reduced = ml.AsWKT_Reduced();
            wkb = ml.AsWKB();

            MG_Polygon pg = new MG_Polygon();
            for (int i = 0; i < 5; i++)
            {
                MG_LineString l2 = new MG_LineString();
                for (int j = 0; j < 3; j++)
                {
                    MG_Point pp = new MG_Point(i, j);
                    l2.Add(pp);
                }
                pg.Add(l2);
            }
            type = pg.Type.ToString();
            wkt = pg.AsWKT();
            wkt_reduced = pg.AsWKT_Reduced();
            wkb = pg.AsWKB();
        }
Ejemplo n.º 6
0
 public static void RenderMultiPoint(Graphics g, Brush brush, int radius, MG_MapView mapview, MG_MultiPoint multiPoint)
 {
     for (int i = 0; i < multiPoint.Count(); i++)
     {
         RenderPoint(g, brush, radius, mapview, multiPoint.GetAt(i));
     }
 }