public void UpdateRegion(FenceRegionsInfo info, string[] gateIds) { if (gateIds == null || gateIds.Length == 0) { return; } lock (_obj) { Name = info.Name; IsInner = info.IsInner; GateIds = gateIds; Regions = new PolygonD(); Regions.AddPoints(new PointDArray(info.Region)); RegionId = info.ID; double left = info.Region.Min(r => r.X); double right = info.Region.Max(r => r.X); double top = info.Region.Min(r => r.Y); double bottom = info.Region.Max(r => r.Y); ValidPoly = RectangleD.FromLTRB(left - 0.04, top - 0.04, right + 0.04, bottom + 0.04); _strictValidPoly = RectangleD.FromLTRB(left - 0.01, top - 0.01, right + 0.01, bottom + 0.01); string gateStrs = ""; if (GateIds != null) { foreach (var gate in GateIds) { gateStrs += " - " + gate; } } trace($"更新区域,{Name} - 区域ID {RegionId} - 闸机数量 {GateIds?.Length}\r\n{gateStrs}。"); } }
public PolygonTrack(FenceRegionsInfo info, string[] gateIds) { UpdateRegion(info, gateIds); }