protected StaticZoneClusterConsumption(
     Func <ZoneInfoFinder> createZoneInfoFinderFunc,
     IElectricityBehaviour electricityBehaviour,
     int pollutionInUnits,
     Color color,
     int widthInZones,
     int heightInZones)
     : base(createZoneInfoFinderFunc, electricityBehaviour, color, widthInZones, heightInZones)
 {
     PollutionBehaviour = new DynamicPollutionBehaviour(() => pollutionInUnits);
 }
Exemplo n.º 2
0
        public QueryResult <IPollutionBehaviour> GetPollutionBehaviour()
        {
            var consumptionState = ConsumptionState.GetZoneConsumption();
            IPollutionBehaviour pollutionBehaviour = null;

            if (consumptionState is ZoneClusterMemberConsumption)
            {
                pollutionBehaviour = (consumptionState as ZoneClusterMemberConsumption).ParentBaseZoneClusterConsumption
                                     .PollutionBehaviour;
            }
            else if (consumptionState is ISingleZoneConsumptionWithPollutionBehaviour)
            {
                pollutionBehaviour = (consumptionState as ISingleZoneConsumptionWithPollutionBehaviour).PollutionBehaviour;
            }
            else
            {
                ConsumptionState.WithNetworkMember <RoadZoneConsumption>(roadZoneConsumption => pollutionBehaviour = roadZoneConsumption.PollutionBehaviour);
            }

            return(QueryResult <IPollutionBehaviour> .Create(pollutionBehaviour));
        }