public void AssignFields(object d2oObject)
        {
            MapReference mapReference = (MapReference)d2oObject;

            this.Id     = mapReference.id;
            this.MapId  = mapReference.mapId;
            this.CellId = mapReference.cellId;
        }
Пример #2
0
 public void AddElement(MapReference key, MapOverlay element)
 {
     if (Pushpins.ContainsKey(key))
     {
         Pushpins[key].Add(element);
     }
     else
     {
         Pushpins.Add(key, new List <MapOverlay> {
             element
         });
     }
 }
Пример #3
0
 public void AddElement(MapReference key, MapPolyline element)
 {
     if (Lines.ContainsKey(key))
     {
         Lines[key].Add(element);
     }
     else
     {
         Lines.Add(key, new List <MapPolyline> {
             element
         });
     }
 }
Пример #4
0
        public override void LoadFromWz(WzFile file)
        {
            Logger.Information("Loading Maps");

            file.WzDirectory.GetDirectoryByName("Map")
            .GetDirectoryByName("Map")
            .WzDirectories
            .SelectMany(subDir => subDir.WzImages)
            .ToList()
            .ForEach(img =>
            {
                var map = new MapReference(img);
                Data.Data.Add(map.MapleId, map);
            });
        }
        public void MapReferenceCanBeEncodedAndDecoded()
        {
            var reference = new MapReference("map[var.my_variable].second", 2);
            var jtoken    = JObject.Parse(json);

            var property = (JProperty)jtoken.SelectToken("Property")?.Parent;

            property.Value = reference.ToJConstructor();
            var token1 = JObject.Parse(jtoken.ToString(Formatting.None));

            var con          = (JConstructor)token1.SelectToken("Property");
            var outReference = Reference.FromJConstructor(con);

            outReference.ReferenceExpression.Should().Be(reference.ReferenceExpression);
        }
Пример #6
0
    public static IEnumerator LoadLevel(string levelname, MapReference mf)
    {
        if (!instance_)
        {
            yield break;
        }
        isSceneTexLoadComplete = false;
        instance_.mapref       = mf;
        XYCoroutineEngine.Execute(LoadShader(shaderPath));
        while (!instance_.myshaderLoadDone)
        {
            yield return(null);
        }

        XYCoroutineEngine.Execute(LoadPublic(PublicPath));
        while (!instance_.PublicLoadDone)
        {
            yield return(null);
        }
        XYCoroutineEngine.Execute(LoadNormal(NormalPath));
        while (!instance_.NormalLoadDone)
        {
            yield return(null);
        }
        XYCoroutineEngine.Execute(LoadTexture(TexturePath));
        while (!instance_.TextureLoadDone)
        {
            yield return(null);
        }

        XYCoroutineEngine.Execute(LoadCtrl(CtrlAssets));
        while (!isCtrlLoadDone)
        {
            yield return(null);
        }
        XYCoroutineEngine.Execute(LoadSceneTex(levelname));
        while (!isSceneTexLoadComplete)
        {
            yield return(null);
        }
        XYCoroutineEngine.Execute(LoadScene(levelname));
    }
Пример #7
0
        public static void SetMapModel(string linea)
        {
            App.MapViewModel.Reset();

            var lineas = DataTren.GetData(linea);

            var trazadoMapReference = new MapReference {
                Id = 1, Nombre = "Trazado", Checked = true
            };
            var estacionesMapReference = new MapReference {
                Id = 2, Nombre = "Estaciones", Checked = false
            };

            foreach (var line in lineas)
            {
                //linea
                var routeLine = new MapPolyline
                {
                    Path            = new GeoCoordinateCollection(),
                    StrokeColor     = line.Color,
                    StrokeThickness = 5.0,
                };
                foreach (var location in line.Trazado)
                {
                    routeLine.Path.Add(new GeoCoordinate(location.X, location.Y));
                }
                App.MapViewModel.AddElement(trazadoMapReference, routeLine);

                //estaciones
                foreach (var ml in line.Postas)
                {
                    var nuevoLugar = new MapOverlay
                    {
                        Content       = ml.Name,
                        GeoCoordinate = new GeoCoordinate(ml.X, ml.Y),
                    };
                    App.MapViewModel.AddElement(estacionesMapReference, nuevoLugar);
                }
            }
        }
Пример #8
0
        private void Button_Click_SubteMapaReal(object sender, RoutedEventArgs e)
        {
            App.MapViewModel.Reset();
            var mapReferenceLines = new MapReference {
                Id = 1, Nombre = "Trazado", Checked = true
            };
            var mapReferencePushpins = new MapReference {
                Id = 2, Nombre = "Estaciones", Checked = false
            };
            var lineas = DataSubte.GetData();

            foreach (var line in lineas)
            {
                //linea
                var routeLine = new MapPolyline
                {
                    Path            = new GeoCoordinateCollection(),
                    StrokeColor     = line.Color,
                    StrokeThickness = 5.0,
                };
                foreach (var location in line.Trazado)
                {
                    routeLine.Path.Add(new GeoCoordinate(location.X, location.Y));
                }
                App.MapViewModel.AddElement(mapReferenceLines, routeLine);

                //estaciones
                foreach (var nuevoLugar in line.Postas.Select(ml => new MapOverlay
                {
                    Content = ml.Name,
                    GeoCoordinate = new GeoCoordinate(ml.X, ml.Y),
                }))
                {
                    App.MapViewModel.AddElement(mapReferencePushpins, nuevoLugar);
                }
            }


            NavigationService.Navigate(new Uri("/Views/Mapa.xaml", UriKind.Relative));
        }
Пример #9
0
        public async Task <Map> GetMapAsync(MapReference reference)
        {
            // get the map page
            var mapDocument = await GetDocumentAsync(reference.Href);

            // extract the polyline
            var polylineScript = mapDocument
                                 .QuerySelectorAll("script")
                                 .OfType <IHtmlScriptElement>()
                                 .Select(x => new { Element = x, Match = PolylineRegex.Match(x.Text) })
                                 .FirstOrDefault(x => x.Match.Success);

            if (polylineScript == null)
            {
                throw new ConnectorRideException($"The polyline data could not be found on the schedule map page: {reference.Href}");
            }

            var polyline = ExtractObject <Polyline>(polylineScript.Element.Text, polylineScript.Match.Groups["Start"].Index);

            // extract the stops
            var stopsScript = mapDocument
                              .QuerySelectorAll("script")
                              .OfType <IHtmlScriptElement>()
                              .Select(x => new { Element = x, Match = StopsRegex.Match(x.Text) })
                              .FirstOrDefault(x => x.Match.Success);

            if (stopsScript == null)
            {
                throw new ConnectorRideException($"The stop data could not be found on the schedule map page: {reference.Href}");
            }

            var stops = ExtractObject <MapStop[]>(stopsScript.Element.Text, stopsScript.Match.Groups["Start"].Index);

            return(new Map
            {
                Stops = stops,
                Polyline = polyline
            });
        }