Пример #1
0
        public mrMap GetDroneMapper()
        {
            var geoMapPlotterHelper = gameObject.AddComponent <GeoMapPlotHelper>();
            var columnsByName       = CsvUtils.GetColumnsByIndex <float>(CsvResourcePath, LatitudeIndex, LongitudeIndex, AltitudeIndex);
            var count  = columnsByName[AltitudeIndex].Count;
            var colors = Enumerable.Range(0, count).Select(i => new Color(138, 43, 226)).ToList();

            var locationStrings = Enumerable.Range(0, count).Select(i =>
                                                                    columnsByName[LongitudeIndex][i].ToString("n4") + ", " + columnsByName[LatitudeIndex][i].ToString("n4")
                                                                    ).ToList();

            var data = new GeoMapPlotHelper.GeoMapData(
                Title,
                Longitude,
                Latitude,
                Zoom,
                GeoMapPlotHelper.GeoDefaultPlotScale,
                locationStrings,
                columnsByName[AltitudeIndex],
                colors,
                SpawnScale,
                HeightScaleMax,
                HeightScaleMin,
                PlotHelper.GetPlotHolder()
                );

            return(geoMapPlotterHelper.GetMrMap(data));
        }
        public mrMap GetCarletonMapper()
        {
            var geoMapPlotterHelper = gameObject.AddComponent <GeoMapPlotHelper>();

            var colors = Enumerable.Range(0, _locationStrings.Count).Select(i =>
                                                                            new Color(Random.value, Random.value, Random.value)
                                                                            ).ToList();

            var data = new GeoMapPlotHelper.GeoMapData(
                Title,
                Longitude,
                Latitude,
                Zoom,
                GeoMapPlotHelper.GeoDefaultPlotScale,
                _locationStrings,
                _locationValues,
                colors,
                SpawnScale,
                HeightScaleMax,
                HeightScaleMin,
                PlotHelper.GetPlotHolder()
                );

            return(geoMapPlotterHelper.GetMrMap(data));
        }
        public mrMap GetParliamentMapper()
        {
            var data             = new GeoMapPlotHelper.GeoMapData(Title, Longitude, Latitude, Zoom);
            var parliamentMapper = gameObject.AddComponent <GeoMapPlotHelper>().GetMrMap(data);

            parliamentMapper.enable3DTerrain = true;
            return(parliamentMapper);
        }
Пример #4
0
        private void PlotGeographicMapFile(string fileName, string csv, List <string> headers)
        {
            var   columnsByIndex      = CsvUtils.GetContentColumnsByIndex <float>(csv, GeoMapLongitude, GeoMapLatitude, GeoMapValue, GeoMapR, GeoMapG, GeoMapB);
            var   geoMapPlotterHelper = gameObject.AddComponent <GeoMapPlotHelper>();
            var   numLocations        = columnsByIndex[GeoMapLongitude].Count;
            int   halfIndex           = numLocations / 2;
            float longitude;
            float latitude;

            var colors = Enumerable.Range(0, numLocations).Select(i =>
                                                                  new Color(columnsByIndex[GeoMapR][i], columnsByIndex[GeoMapG][i], columnsByIndex[GeoMapB][i])
                                                                  ).ToList();


            var sortedLongitudes = new List <float>(columnsByIndex[GeoMapLongitude]);
            var sortedLatitudes  = new List <float>(columnsByIndex[GeoMapLatitude]);

            if ((numLocations % 2) == 0)
            {
                longitude = (sortedLongitudes.ElementAt(halfIndex) +
                             sortedLongitudes.ElementAt(halfIndex - 1)) / 2;
                latitude = (sortedLatitudes.ElementAt(halfIndex) +
                            sortedLatitudes.ElementAt(halfIndex - 1)) / 2;
            }
            else
            {
                longitude = sortedLongitudes.ElementAt(halfIndex);
                latitude  = sortedLatitudes.ElementAt(halfIndex);
            }

            var locationStrings = Enumerable.Range(0, numLocations).Select(i =>
                                                                           columnsByIndex[GeoMapLongitude][i].ToString("n4") + ", " + columnsByIndex[GeoMapLatitude][i].ToString("n4")
                                                                           ).ToList();

            var data = new GeoMapPlotHelper.GeoMapData(
                fileName,
                longitude,
                latitude,
                16,
                GeoMapPlotHelper.GeoDefaultPlotScale,
                locationStrings,
                columnsByIndex[GeoMapValue],
                colors,
                GeoSpawnScale,
                GeoHeightScaleMax,
                GeoHeightScaleMin,
                PlotHelper.GetPlotHolder()
                );

            var plotter       = geoMapPlotterHelper.GetMrMap(data);
            var plotContainer = Instantiate(plotter);

            SetSpawn(plotContainer.MapHolder);
        }