private bool ParseSearchParams(string searchLocation, out string searchPano, out LatLngPoint searchPoint)
        {
            searchPano  = null;
            searchPoint = null;

            if (!string.IsNullOrEmpty(searchLocation))
            {
                var panoMatch   = GMAPS_URL_PANO_PATTERN.Match(searchLocation);
                var latLngMatch = GMAPS_URL_LATLNG_PATTERN.Match(searchLocation);

                if (panoMatch.Success && MetadataResponse.IsPano(panoMatch.Groups[1].Value))
                {
                    searchPano = panoMatch.Groups[1].Value;
                }
                else if (MetadataResponse.IsPano(searchLocation))
                {
                    searchPano = searchLocation;
                }

                if (latLngMatch.Success && LatLngPoint.TryParse(latLngMatch.Groups[1].Value, out var point))
                {
                    searchPoint = point;
                }
                else if (LatLngPoint.TryParse(searchLocation, out var point2))
                {
                    searchPoint = point2;
                }
            }

            return(metadata == null ||
                   searchPano != null &&
                   metadata.Pano_ID != searchPano ||
                   searchPoint != null &&
                   searchPoint.Distance(metadata.Location) > 3f);
        }
Exemple #2
0
 private void LatLngTextbox_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         latLngTextbox.Text   = latLngTextbox.Text.Trim();
         panoTextbox.Text     = string.Empty;
         locationTextBox.Text = string.Empty;
         if (latLngTextbox.Text.Length > 0 &&
             LatLngPoint.TryParse(latLngTextbox.Text, out var point))
         {
             OnLatLngSubmitted(point);
         }
     }
 }