当前位置: 首页>>代码示例>>C#>>正文


C# Location.PlaceName方法代码示例

本文整理汇总了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;
        }
开发者ID:kevintavog,项目名称:WatchThis.net,代码行数:9,代码来源:FindAPhotoProvider.cs

示例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));
        }
开发者ID:kevintavog,项目名称:FindAPhoto-1.net,代码行数:101,代码来源:DocumentIndexer.cs


注:本文中的Location.PlaceName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。