本文整理汇总了C#中Location.PlaceName方法的典型用法代码示例。如果您正苦于以下问题:C# Location.PlaceName方法的具体用法?C# Location.PlaceName怎么用?C# Location.PlaceName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Location
的用法示例。
在下文中一共展示了Location.PlaceName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLocation
public Location GetLocation(object data)
{
var item = data as ItemCache;
var l = new Location(item.Latitude, item.Longitude);
logger.Info("Location: {0}, [{1}]", l, l.PlaceName(Location.PlaceNameFilter.None));
return l;
}
示例2: AddExifInfo
//.........这里部分代码省略.........
case "EXIF.GPSLongitudeRef":
lonRef = val;
break;
case "EXIF.GPSLatitude":
latitude = val;
break;
case "EXIF.GPSLongitude":
longitude = val;
break;
case "EXIF.DateTimeOriginal":
case "EXIF.CreateDate":
if (createdDate == null)
{
DateTime temp;
if (DateTime.TryParseExact(val, "yyyy:MM:dd HH:mm:ss", new CultureInfo("en-US"), DateTimeStyles.None, out temp))
{
createdDate = temp;
}
}
break;
}
string docKey;
if (StoredValues.TryGetValue(path, out docKey))
{
doc.add(new TextField(docKey.ToLower(), val, Field.Store.YES));
}
}
}
}
}
}
if (createdDate == null)
{
createdDate = new FileInfo(filename).CreationTime;
}
doc.add(new TextField(FieldName.Date, createdDate.Value.ToString("yyyyMMdd"), Field.Store.NO));
doc.add(new TextField(FieldName.CreatedDate, createdDate.Value.ToString("o"), Field.Store.YES));
doc.add(new TextField(FieldName.Day, createdDate.Value.AllDayNames(), Field.Store.NO));
doc.add(new TextField(FieldName.Month, createdDate.Value.AllMonthNames(), Field.Store.NO));
var facetDate = new []
{
createdDate.Value.Year.ToString(),
createdDate.Value.Month.ToString(),
createdDate.Value.Day.ToString(),
};
doc.add(new FacetField(FacetNames.Date, facetDate));
doc.add(new TextField(FieldName.HasExifInfo, "t", Field.Store.NO));
double latDouble, lonDouble;
if (ConvertLocationRef(latitude, latRef, longitude, lonRef, out latDouble, out lonDouble))
{
doc.add(new DoubleField(FieldName.Latitude, latDouble, Field.Store.YES));
doc.add(new DoubleField(FieldName.Longitude, lonDouble, Field.Store.YES));
var location = new Location(latDouble, lonDouble);
var placeName = location.PlaceName(Location.PlaceNameFilter.None);
if (placeName != null)
{
if (String.IsNullOrWhiteSpace(placeName))
{
logger.Warn("Unable to get a proper placename for {0} ({1})", filename, location);
}
var city = location.City;
if (city != null)
{
doc.add(new TextField(FieldName.LocationCity, city, Field.Store.YES));
}
if (location.Country != null)
{
doc.add(new TextField(FieldName.LocationCountry, location.Country, Field.Store.YES));
}
var site = location.SiteName;
if (site != null)
{
doc.add(new TextField(FieldName.LocationSite, site, Field.Store.YES));
}
var placeTokens = location.PlaceNameParts(Location.PlaceNameFilter.Detailed, true);
if (placeTokens.Length > 0)
doc.add(new FacetField(FacetNames.PlaceName, placeTokens));
doc.add(new TextField(FieldName.LocationPlaceName, placeName, Field.Store.YES));
doc.add(new TextField(FieldName.LocationStandardName, location.PlaceName(Location.PlaceNameFilter.Standard), Field.Store.YES));
}
else
{
logger.Warn("Unable to get placename for {0} ({1})", filename, location);
}
}
thumbnailIndexer.CheckThumbnail(filename, doc.get(FieldName.MimeType), doc.get(FieldName.Size));
}