public LayerTemplate SaveTemplate()
 {
     return(new LayerTemplate(Width, Height,
                              Pins.Select(x => new Pin(x.Width, x.Height, x.Y, x.X, x.Name, x.ValuesFunction.Build(), x.IsOutputPin, x.IsSignificant)).ToArray(),
                              DeadZones.Select(x => new Zone(new Position(x.X, x.Y), x.Width, x.Height)).ToArray(),
                              Functions.ToDictionary(x => x.Name, x => x.Function.Build())));
 }
Beispiel #2
0
        public void FocusPins()
        {
            var pins = Pins.Select(x => x.Position);

            if (pins != null && pins.Count() > 1)
            {
                MoveToRegion(MapSpanGenerator.Generate(pins));
            }
        }
Beispiel #3
0
        // ===========================================================================
        // = Public Methods
        // ===========================================================================

        public void ClearSearchResults()
        {
            // Clear search results.
            var pinsToRemove = Pins
                               .Select((X, I) => new { Index = I, Object = X })
                               .Where(X => X.Object.IsSearchResult)
                               .Select(X => X.Index)
                               .OrderByDescending(X => X)
                               .ToList();

            foreach (var index in pinsToRemove)
            {
                Pins.RemoveAt(index);
            }

            SearchResults.Clear();

            if (pinsToRemove.Count > 0)
            {
                RaiseChanged();
            }
        }
Beispiel #4
0
 public override string ToString()
 {
     return(string.Format($"{string.Join("--", Pins.Select(p => $"{p.p1}/{p.p2}"))} :{Strength}"));
 }