Beispiel #1
0
        public void RaisePostBackEvent(string eventArgument)
        {
            GDIMap m = ControlMap;

            string[] arg = eventArgument.Split('|');

            string cmd = arg[0].ToUpper();

            switch (cmd)
            {
            case "CLICK":
            {
                if (MapClick != null)
                {
                    Point      pt1 = new Point(Convert.ToInt32(arg[2]), Convert.ToInt32(arg[3]));
                    Coordinate pm1 = m.PixelToProj(pt1);

                    MapClickEventArgs mc = new MapClickEventArgs
                    {
                        Button = Convert.ToInt32(arg[1]),
                        X      = pm1.X,
                        Y      = pm1.Y
                    };

                    MapClick(this, mc);
                }
            }
            break;

            //                case "ADDFEATURE":  //moved to RaiseCallbackEvent

            //                case "DATAGRID":  //never gets here - wrong place? moved to RaiseCallbackEvent

            case "FORCEREFRESH":
            {
                //simply do nothing
            }
            break;
            }
        }
Beispiel #2
0
        public void RaisePostBackEvent(string eventArgument)
        {
            GDIMap m = ControlMap;

            string[] arg = eventArgument.Split('|');

            string cmd = arg[0].ToUpper();

            switch (cmd)
            {

                case "CLICK":
                    {

                        if (MapClick != null)
                        {
                            System.Drawing.Point pt1 = new System.Drawing.Point(Convert.ToInt32(arg[2]), Convert.ToInt32(arg[3]));
                            Coordinate pm1 = m.PixelToProj(pt1);

                            MapClickEventArgs mc = new MapClickEventArgs();

                            mc.button = Convert.ToInt32(arg[1]); ;
                            mc.x = pm1.X;
                            mc.y = pm1.Y;

                            MapClick(this, mc);
                        }

                    }
                    break;

//                case "ADDFEATURE":  //moved to RaiseCallbackEvent

//                case "DATAGRID":  //never gets here - wrong place? moved to RaiseCallbackEvent

                case "FORCEREFRESH":
                    {
                        //simply do nothing 
                    }
                    break;

            }
        }
Beispiel #3
0
        public void RaisePostBackEvent(string eventArgument)
        {
            GDIMap m = ControlMap;

            string[] arg = eventArgument.Split('|');

            string cmd = arg[0].ToUpper();

            switch (cmd)
            {
            case "CLICK":
            {
                if (MapClick != null)
                {
                    System.Drawing.Point pt1 = new System.Drawing.Point(Convert.ToInt32(arg[2]), Convert.ToInt32(arg[3]));
                    Coordinate           pm1 = m.PixelToProj(pt1);

                    MapClickEventArgs mc = new MapClickEventArgs();

                    mc.button = Convert.ToInt32(arg[1]);;
                    mc.x      = pm1.X;
                    mc.y      = pm1.Y;

                    MapClick(this, mc);
                }
            }
            break;

            case "ADDFEATURE":
            {
                int num = Convert.ToInt32(arg[1]);

                System.Drawing.Point pt = new System.Drawing.Point();
                Coordinate[]         pm = new Coordinate[num];

                for (int i = 0; i < num; i++)
                {
                    pt.X = Convert.ToInt32(arg[(i + 1) * 2]);
                    pt.Y = Convert.ToInt32(arg[(i + 1) * 2 + 1]);

                    pm[i] = m.PixelToProj(pt);
                }


                FeatureSet  fs = m.Layers.SelectedLayer.DataSet as FeatureSet;
                Feature     f;
                FeatureType ft = FeatureType.Unspecified;

                if (m.Layers.SelectedLayer != null)
                {
                    IMapFeatureLayer MFL = (IMapFeatureLayer)m.Layers.SelectedLayer;

                    if (MFL.GetType() == typeof(MapPointLayer))
                    {
                        ft = FeatureType.Point;
                    }
                    if (MFL.GetType() == typeof(MapLineLayer))
                    {
                        ft = FeatureType.Line;
                    }
                    if (MFL.GetType() == typeof(MapPolygonLayer))
                    {
                        ft = FeatureType.Polygon;
                    }

                    if (ft != FeatureType.Unspecified)
                    {
                        f = new Feature(ft, pm);

                        if (AddFeature != null)
                        {
                            AddFeature(this, fs, f);
                        }
                        else
                        {
                            fs.AddFeature(f);
                            fs.InitializeVertices();
                        }
                    }
                }
            }
            break;

            case "DATAGRID":
            {
                if (m.Layers.SelectedLayer != null)
                {
                    //string script=null;

                    if (DataOnGrid != null)
                    {
                        DataGridEventArgs e   = new DataGridEventArgs();
                        IMapFeatureLayer  MFL = (IMapFeatureLayer)m.Layers.SelectedLayer;

                        int n = MFL.Selection.Count;

                        if (n > 0)
                        {
                            FeatureSet fs = MFL.Selection.ToFeatureSet();
                            e.Recordsource = fs.DataTable;
                        }
                        else
                        {
                            e.Recordsource = MFL.DataSet.DataTable;
                        }

                        DataOnGrid(this, e);
                    }
                }
            }
            break;

            case "FORCEREFRESH":
            {
                //simply do nothing
            }
            break;
            }
        }
Beispiel #4
0
        public void RaisePostBackEvent(string eventArgument)
        {

            GDIMap m = ControlMap;

            string[] arg = eventArgument.Split('|');

            string cmd = arg[0].ToUpper();

            switch (cmd)
            {

                case "CLICK":
                    {

                        if (MapClick != null)
                        {
                            System.Drawing.Point pt1 = new System.Drawing.Point(Convert.ToInt32(arg[2]), Convert.ToInt32(arg[3]));
                            Coordinate pm1 = m.PixelToProj(pt1);

                            MapClickEventArgs mc = new MapClickEventArgs();

                            mc.button = Convert.ToInt32(arg[1]); ;
                            mc.x = pm1.X;
                            mc.y = pm1.Y;

                            MapClick(this, mc);
                        }

                    }
                    break;

                case "ADDFEATURE":
                    {
                        int num = Convert.ToInt32(arg[1]);

                        System.Drawing.Point pt = new System.Drawing.Point();
                        Coordinate[] pm = new Coordinate[num];

                        for (int i = 0; i < num; i++)
                        {
                            pt.X = Convert.ToInt32(arg[(i + 1) * 2]);
                            pt.Y = Convert.ToInt32(arg[(i + 1) * 2 + 1]);

                            pm[i] = m.PixelToProj(pt);
                        }

                        
                        FeatureSet fs = m.Layers.SelectedLayer.DataSet as FeatureSet;
                        Feature f;
                        FeatureType ft = FeatureType.Unspecified;

                        if (m.Layers.SelectedLayer != null)
                        {
                            IMapFeatureLayer MFL = (IMapFeatureLayer)m.Layers.SelectedLayer;
                        
                            if(MFL.GetType() == typeof(MapPointLayer))
                            {
                                ft = FeatureType.Point;
                            }
                            if(MFL.GetType() == typeof( MapLineLayer))
                            {
                                ft = FeatureType.Line;
                            }
                            if(MFL.GetType() == typeof( MapPolygonLayer))
                            {
                                ft = FeatureType.Polygon;
                            }

                            if (ft != FeatureType.Unspecified)
                            {
                                
                                f = new Feature(ft, pm);

                                if (AddFeature != null)
                                {
                                    AddFeature(this, fs, f);
                                }
                                else
                                {
                                    fs.AddFeature(f);
                                    fs.InitializeVertices();
                                }
                            }
                        }

                    }
                    break;

                case "DATAGRID":
                    {
                        if (m.Layers.SelectedLayer != null)
                        {
                            //string script=null;

                            if (DataOnGrid != null)
                            {
                                DataGridEventArgs e = new DataGridEventArgs();
                                IMapFeatureLayer MFL = (IMapFeatureLayer)m.Layers.SelectedLayer;

                                int n = MFL.Selection.Count;

                                if (n > 0)
                                {
                                    FeatureSet fs = MFL.Selection.ToFeatureSet();
                                    e.Recordsource = fs.DataTable;
                                }
                                else
                                {
                                    e.Recordsource = MFL.DataSet.DataTable;
                                }

                                DataOnGrid(this, e);

                            }

                        }

                    }
                    break;

                case "FORCEREFRESH":
                    {
                        //simply do nothing 
                    }
                    break;

            }
        }