OSDN Git Service

3ad779bc42a37d78f4ed178a5870e3b69dc20b44
[automap/automap.git] / Automap / Data / PointOfInterest.cs
1 using System;
2 using System.Collections.ObjectModel;
3 using System.IO;
4
5 using Vintagestory.API.Client;
6 using Vintagestory.API.Common;
7 using Vintagestory.API.MathTools;
8
9 using ProtoBuf;
10
11 using Newtonsoft.Json;
12
13 namespace Automap
14 {
15         /// <summary>
16         /// Actual Physical Point in space - that is interesting.
17         /// </summary>
18         [ProtoContract]
19         public struct PointOfInterest
20         {
21                 [DisplayName(0, "Name")]
22                 [ProtoMember(1)]
23                 public string Name;
24
25                 [DisplayName(2, "Notes")]
26                 [ProtoMember(2)]
27                 public string Notes;
28
29                 [DisplayName(1, "Loc.")]
30                 public string PrettyLocation;
31
32                 [ProtoMember(3)]
33                 public BlockPos Location;
34
35                 [DisplayName(3, "Time")]
36                 [ProtoMember(4)]
37                 public DateTime Timestamp;
38
39
40         }
41
42         public class PointsOfInterest : KeyedCollection<BlockPos, PointOfInterest>
43         {
44                 protected override BlockPos GetKeyForItem(PointOfInterest item)
45                         => item.Location;
46
47                 internal void AddReplace(PointOfInterest poi)
48                 {
49                         if (Contains(poi.Location))
50                                 Remove(poi.Location);
51
52                         Add(poi);
53                 }
54         }
55
56 }
57