コード例 #1
0
        private void Map(Round t)
        {
            AxMapWinGIS.AxMap map = new AxMapWinGIS.AxMap();
            map.Width  = 380;
            map.Height = 380;
            host.Child = map;
            map.Show();
            map.CreateControl();
            map.ShowZoomBar     = false;
            map.ShowCoordinates = MapWinGIS.tkCoordinatesDisplay.cdmNone;
            map.CursorMode      = MapWinGIS.tkCursorMode.cmNone;

            MapWinGIS.Shapefile shapeFileMap = new MapWinGIS.Shapefile();
            shapeFileMap.Open(@"D:\Projets\TheManager\TheManager_GUI\bin\Debug\gis\world\World_Countries.shp", null);
            map.AddLayer(shapeFileMap, true);
            ILocalisation localisation = Session.Instance.Game.kernel.LocalisationTournament(t.Tournament);
            double        logoSize     = 30.0;

            if (localisation as Country != null)
            {
                map.ZoomToShape(0, (localisation as Country).ShapeNumber);
            }
            else
            {
                if (localisation.Name() == "Europe")
                {
                    map.ZoomToShape(0, 68 /*12 101*/);
                    map.CurrentZoom = 4;
                }
                else if (localisation.Name() == "Africa")
                {
                    map.ZoomToShape(0, 40);
                    map.CurrentZoom = 3;
                }
                logoSize = 15.0;
            }

            foreach (Club c in t.clubs)
            {
                CityClub cc = c as CityClub;
                if (cc != null)
                {
                    double projX = -1;
                    double projY = -1;
                    map.DegreesToProj(cc.city.Position.Longitude, cc.city.Position.Latitude, ref projX, ref projY);

                    MapWinGIS.Image img = new MapWinGIS.Image();
                    img.Open(Utils.Logo(c));

                    MapWinGIS.Shapefile sf = new MapWinGIS.Shapefile();
                    sf.CreateNew("", MapWinGIS.ShpfileType.SHP_POINT);
                    sf.DefaultDrawingOptions.AlignPictureByBottom = false;
                    sf.DefaultDrawingOptions.PointType            = MapWinGIS.tkPointSymbolType.ptSymbolPicture;
                    sf.DefaultDrawingOptions.Picture       = img;
                    sf.DefaultDrawingOptions.PictureScaleX = Math.Round(logoSize / img.OriginalWidth, 2);
                    sf.DefaultDrawingOptions.PictureScaleY = Math.Round(logoSize / img.OriginalHeight, 2);
                    sf.CollisionMode = MapWinGIS.tkCollisionMode.AllowCollisions;

                    MapWinGIS.Shape shp = new MapWinGIS.Shape();
                    shp.Create(MapWinGIS.ShpfileType.SHP_POINT);
                    shp.AddPoint(projX, projY);
                    sf.EditAddShape(shp);

                    map.AddLayer(sf, true);
                }
            }
            if (_competition.rounds[_indexTour].clubs.Count > 0 && _competition.rounds[_indexTour].clubs[0] as NationalTeam != null)
            {
                shapeFileMap.StartEditingTable();
                int fieldIndex = shapeFileMap.EditAddField("Qualification", MapWinGIS.FieldType.INTEGER_FIELD, 1, 1);
                shapeFileMap.DefaultDrawingOptions.FillType = MapWinGIS.tkFillType.ftStandard;
                for (int i = 0; i < shapeFileMap.NumShapes; i++)
                {
                    shapeFileMap.EditCellValue(fieldIndex, i, 0);
                }
                Dictionary <NationalTeam, int> clubCourses = new Dictionary <NationalTeam, int>();
                for (int i = 0; i < _competition.rounds.Count; i++)
                {
                    Round round = _competition.rounds[i];
                    foreach (Club c in round.clubs)
                    {
                        NationalTeam nt = c as NationalTeam;
                        if (!clubCourses.ContainsKey(nt))
                        {
                            clubCourses.Add(nt, 1);
                        }
                        clubCourses[nt] = i + 1;
                    }
                }
                foreach (KeyValuePair <NationalTeam, int> kvp in clubCourses)
                {
                    shapeFileMap.EditCellValue(fieldIndex, kvp.Key.country.ShapeNumber, kvp.Value);
                }
                shapeFileMap.Categories.Generate(fieldIndex, MapWinGIS.tkClassificationType.ctUniqueValues, _competition.rounds.Count + 1);
                shapeFileMap.Categories.ApplyExpressions();
                MapWinGIS.ColorScheme colorScheme = new MapWinGIS.ColorScheme();
                colorScheme.SetColors2(MapWinGIS.tkMapColor.AliceBlue, MapWinGIS.tkMapColor.DarkBlue);
                shapeFileMap.Categories.ApplyColorScheme(MapWinGIS.tkColorSchemeType.ctSchemeGraduated, colorScheme);
            }
            map.Redraw();
        }
コード例 #2
0
        private void Map()
        {
            AxMapWinGIS.AxMap map = new AxMapWinGIS.AxMap();
            map.Width           = 450;
            map.MouseDownEvent += Map_MouseDownEvent;
            map.Height          = 600;
            host.Child          = map;
            map.Show();
            map.ShapeHighlighted += Map_ShapeHighlighted;
            map.CreateControl();
            map.ShowZoomBar     = false;
            map.ShowCoordinates = MapWinGIS.tkCoordinatesDisplay.cdmNone;
            map.CursorMode      = MapWinGIS.tkCursorMode.cmIdentify;

            MapWinGIS.Shapefile shapeFileMap = new MapWinGIS.Shapefile();
            shapeFileMap.Open(@"D:\Projets\TheManager\TheManager_GUI\bin\Debug\gis\world\World_Countries.shp", null);
            shapeFileMap.Identifiable = false;
            map.AddLayer(shapeFileMap, true);
            map.ZoomToShape(0, 77);

            MapWinGIS.Shapefile sf = new MapWinGIS.Shapefile();
            sf.Identifiable = true;
            sf.CreateNew("", MapWinGIS.ShpfileType.SHP_POINT);
            sf.DefaultDrawingOptions.AlignPictureByBottom = false;
            sf.DefaultDrawingOptions.PointType            = MapWinGIS.tkPointSymbolType.ptSymbolStandard;
            sf.CollisionMode = MapWinGIS.tkCollisionMode.AllowCollisions;

            List <City> takenCities = new List <City>();

            foreach (Journalist journalist in _media.journalists)
            {
                double projX = -1;
                double projY = -1;
                map.DegreesToProj(journalist.baseCity.Position.Longitude, journalist.baseCity.Position.Latitude, ref projX, ref projY);

                if (takenCities.Contains(journalist.baseCity))
                {
                    projY += Session.Instance.Random(3, 12) / 10.0;
                }

                MapWinGIS.Shape shp = new MapWinGIS.Shape();
                shp.Create(MapWinGIS.ShpfileType.SHP_POINT);
                shp.AddPoint(projX, projY);
                _indexOrders.Add(sf.EditAddShape(shp));
                takenCities.Add(journalist.baseCity);
            }
            int layer = map.AddLayer(sf, true);

            foreach (Journalist journalist in _media.journalists)
            {
                int    handle = map.NewDrawing(MapWinGIS.tkDrawReferenceList.dlScreenReferencedList);
                double pixX   = -1;
                double pixY   = -1;
                map.DegreesToPixel(journalist.baseCity.Position.Longitude, journalist.baseCity.Position.Latitude, ref pixX, ref pixY);

                float maxDistance = -1;
                foreach (Match m in journalist.CommentedGames)
                {
                    float dist = Utils.Distance(m.home.stadium.city, journalist.baseCity);
                    if (dist > maxDistance)
                    {
                        maxDistance = dist;
                    }
                }

                map.DrawCircleEx(handle, pixX, pixY, maxDistance / 2, 2883, true, 25);
            }

            map.ShapeIdentified += Map_ShapeIdentified;
            map.Redraw();
        }