OSDN Git Service

Merge branch 'vgd' of into Split_renderers
[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                 [ProtoMember(1)]
22                 public string Name;
23
24                 [DisplayName(1, "Notes")]
25                 [ProtoMember(2)]
26                 public string Notes;
27
28                 [DisplayName(0, "Loc.")]
29                 [ProtoMember(3)]
30                 public BlockPos Location;
31
32                 [DisplayName(2, "Time")]
33                 [ProtoMember(4)]
34                 public DateTime Timestamp;
35
36
37         }
38
39         public class PointsOfInterest : KeyedCollection<BlockPos, PointOfInterest>
40         {
41                 protected override BlockPos GetKeyForItem(PointOfInterest item)
42                         => item.Location;
43
44                 internal void AddReplace(PointOfInterest poi)
45                 {
46                         if (Contains(poi.Location))
47                                 Remove(poi.Location);
48
49                         Add(poi);
50                 }
51         }
52
53 }
54