public City(string name, Region region, ICityLevelRule cityLevelRule = null, Tuple <decimal, decimal> coords = null) : base(name, region) { if (string.IsNullOrWhiteSpace(name) || region == null) { throw new ArgumentException("Can't create city: unnamed city or undentified region"); } BaseConstructor(region, cityLevelRule, coords); }
public City(string name, ICityLevelRule cityLevelRule = null, Tuple <decimal, decimal> coords = null) : base(name, null) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("Can't create city: unnamed city"); } BaseConstructor(null, cityLevelRule, coords); }
public City AddLevels(ICityLevelRule cityLevelRule) { var lvls = cityLevelRule.GetLevels(); foreach (var lvl in lvls) { AddLevel(lvl.Key, lvl.Value); } return(this); }
public Map AddCity(string name, Region region, ICityLevelRule rule = null, Tuple <decimal, decimal> coords = null) { if (string.IsNullOrWhiteSpace(name) || region == null) { throw new ArgumentException("Can't add undefined city or udentified region"); } var city = new City(name, region, rule, coords); return(this); }
public Map AddCity(string name, string regionName, ICityLevelRule rule = null, Tuple <decimal, decimal> coords = null) { if (string.IsNullOrWhiteSpace(name) || string.IsNullOrWhiteSpace(regionName)) { throw new ArgumentException("Can't add undefined city or udentified region"); } var region = LookupOrCreateRegion(regionName); AddCity(name, region, rule, coords); return(this); }
private void BaseConstructor(Region region = null, ICityLevelRule cityLevelRule = null, Tuple <decimal, decimal> coords = null) { TmpLevels = new Dictionary <int, int>(); Coords = coords; //todo: need to remove it (and parameter too) and move to abstract class if (region != null) { region.AddCity(this); } if (cityLevelRule != null) { var lvls = cityLevelRule.GetLevels(); foreach (var lvl in lvls) { AddLevel(lvl.Key, lvl.Value); } } }
public Region AddCity(string name, ICityLevelRule cityLvlRule = null, Tuple <decimal, decimal> coords = null) { var city = new City(name, this, cityLvlRule, coords); return(this); }