Пример #1
0
    public void GetGeocoding(Model.DistanceModel model)
    {
        string Address = model.City + model.District + model.Address;

        Common.Location lnglat = Common.GetGeocoding.GetLngLat(Address, model.Province);

        if (lnglat != null)
        {
            model.Lat = lnglat.lat;
            model.Lng = lnglat.lng;

            Disdal.UpdateLngLat(model);
        }
    }
Пример #2
0
        void AssertRenamed(string OldStep, string OldContent, string NewStep, string NewContent, Location Location = null)
        {
            RenameStep = Substitute.For<RenameStep>
            (
                null, OldStep, NewStep
            );

            Feature.Content += OldContent;

            Step.Name = RenameStep.OriginalName;
            Step.Location = Location ?? new Location
            (
                Feature.Content.IndexOf(RenameStep.OriginalName),
                RenameStep.OriginalName
            );

            RenameStep.FeatureContent.Returns(Feature.Content);

            RenameStep.Execute();

            RenameStep.Received().Write(Feature.Content);

            Feature.Content.ShouldContain(NewContent);
        }
Пример #3
0
        public void should_rename_Step_with_Args()
        {
            Step.Args = new List<string> { "X" };

            var Location = new Location(129, @"old step ""X"" with Args");

            AssertRenamed
            (
                "old_step__with_Args",
                @"
                    old step
                    old step ""X"" with Args
                ",
                "renamed_step__with_Arg",
                @"
                    old step
                    renamed step ""X"" with Arg
                ",
                Location
            );
        }
 public EnviornmentMap(List<IObstruction> obstructions, Location bottomRightBound)
 {
     this.Obstructions = obstructions;
     this.Size = new System.Drawing.Size(bottomRightBound.X, bottomRightBound.Y);
     Obstructions.Add(new FourBorders(new Vector(0, 0), new Vector(Size.Width, Size.Height)));
 }
Пример #5
0
        private static Location GetLocation(string adress)
        {
            Location location = new Location();
            try
            {
                //adress = adress.Replace(" ", "+");
                XmlDocument doc = new XmlDocument();
                WebClient client = new WebClient();

                string key = "";
                try
                {
                    key = ConfigurationManager.AppSettings["GoogleKey"].ToString();
                }
                catch { }

                string adressFormated = HttpUtility.UrlEncode(adress);
                string url = "https://maps.googleapis.com/maps/api/geocode/json?address=" + adressFormated + "&key=" + key;
                string retorno = client.DownloadString(url);
                GoogleGeoCodeResponse googleGeoCodeResponse = JsonConvert.DeserializeObject<GoogleGeoCodeResponse>(retorno);

                if (googleGeoCodeResponse.results.Count() > 0)
                {
                    if (googleGeoCodeResponse.results[0].geometry.location != null && googleGeoCodeResponse.results[0].geometry.location != null)
                    {
                        if (googleGeoCodeResponse.results[0].geometry.location.lat != "" && googleGeoCodeResponse.results[0].geometry.location.lat != null && googleGeoCodeResponse.results[0].geometry.location.lat != "0" && googleGeoCodeResponse.results[0].geometry.location.lng != null && googleGeoCodeResponse.results[0].geometry.location.lng != "" && googleGeoCodeResponse.results[0].geometry.location.lng != "0")
                        {
                            location.latitude = Convert.ToDouble(googleGeoCodeResponse.results[0].geometry.location.lat.Replace(".", ","), new CultureInfo("pt-BR"));
                            location.longitude = Convert.ToDouble(googleGeoCodeResponse.results[0].geometry.location.lng.Replace(".", ","), new CultureInfo("pt-BR"));
                        }
                    }
                }
            }
            catch
            {
                return null;
            }
            return location;
        }
Пример #6
0
 public void SetLocation(Location t)
 {
     Latitude = t.a;
     Longitude = t.o;
     Save();
     return;
 }