public OrphanedInputSpaceTime(ITimeSpaceOutput output)
        {
            var describes = new Describes("Temporal Target", "= Temporal Target");
            SetIdentity(new Identity("FluidEarth2.Sdk.OrphanedInputSpaceTime", describes));

            Component = null;

            ValueDefinition = output.ValueDefinition;
            SpatialDefinition = output.SpatialDefinition;

            TimeSet = new TimeSet();
        }
Пример #2
0
 public static Time GetHour(int turn, TimeSet ts)
 {
     switch(turn)
     {
         case 0:
             if (ts == TimeSet.START)
                 return new Time { Hour = 8, Minute = 0 };
             else
                 return new Time { Hour = 9, Minute = 30 };
         case 1:
             if (ts == TimeSet.START)
                 return new Time { Hour = 9, Minute = 30 };
             else
                 return new Time { Hour = 11, Minute = 0 };
         case 2:
             if (ts == TimeSet.START)
                 return new Time { Hour = 11, Minute = 0 };
             else
                 return new Time { Hour = 12, Minute = 30 };
         case 3:
             if (ts == TimeSet.START)
                 return new Time { Hour = 12, Minute = 30 };
             else
                 return new Time { Hour = 14, Minute = 0 };
         case 4:
             if (ts == TimeSet.START)
                 return new Time { Hour = 14, Minute = 0 };
             else
                 return new Time { Hour = 15, Minute = 30 };
         case 5:
             if (ts == TimeSet.START)
                 return new Time { Hour = 15, Minute = 30 };
             else
                 return new Time { Hour = 17, Minute = 0 };
         case 6:
             if (ts == TimeSet.START)
                 return new Time { Hour = 17, Minute = 0 };
             else
                 return new Time { Hour = 18, Minute = 30 };
         case 7:
             if (ts == TimeSet.START)
                 return new Time { Hour = 18, Minute = 30 };
             else
                 return new Time { Hour = 21, Minute = 30 };
         default:
             return null;
     }
 }
        /// <summary>
        /// Constructor for native coded IEngine
        /// </summary>
        /// <param name="identity">Identity for the component</param>
        /// <param name="derivedComponentType">Type of derived class encapsulated as an ExternalType</param>
        /// <param name="engineType">Type of IEngine derived class encapsulated as an ExternalType</param>
        /// <param name="useNativeDllArgument">True if engineType is actually a .NEt wrapper for
        /// a native implementation of IEngine, i.e. uses C interface to talk to engine which
        /// might be in some non .NET language e.g. C++/FORTRAN/Python etc</param>
        public BaseComponentTimeWithEngine(IIdentifiable identity, ExternalType derivedComponentType, ExternalType engineType, bool useNativeDllArgument)
            : base(identity, derivedComponentType, engineType, useNativeDllArgument)
        {
            _timeExtent = new TimeSet();
            _timeExtent.SetTimeHorizon(new Time());

            var argTime = new ArgumentTime(GetArgumentIdentity(ArgsWithEngineTime.TimeHorizon),
                new Time(_timeExtent.TimeHorizon));

            argTime.ValueChanged += new EventHandler<Argument<ArgumentValueTime>.ValueChangedEventArgs>(OnArgumentChangedTimeHorizon);

            Arguments.Add(argTime);

            // Base class sets typeof(RemotingServerEngineTime) not typeof(RemotingServerEngine)
            // Dont have a RemotingServerEngine as RemotingServerEngineTime only has one additional time method
            // which we can jsut ensure not to call!
            //((ArgumentParametersRemoting)Argument(GetArgumentIdentity(ArgsWithEngine.Remoting))).ParametersRemoting
            //    = new ParametersRemoting(typeof(RemotingServerEngineTime);
        }
    private void UpdateStuff(TimeSet currentTimeSet)
    {
        //Update Skybox
        RenderSettings.skybox = currentTimeSet.skybox;

        //Update Sun Light
        sun.intensity           = currentTimeSet.sunIntensity;
        sun.color               = currentTimeSet.SunColor;
        sun.transform.rotation  = Quaternion.Euler(currentTimeSet.sunAngle);

        sun.GetComponent<LensFlare>().brightness= currentTimeSet.sunIntensity;

        //Update Ambient Lighting
        RenderSettings.ambientLight = currentTimeSet.ambientLightingColor;

        // Update Fog
        RenderSettings.fog              = currentTimeSet.enableFog;
        RenderSettings.fogColor         = currentTimeSet.fogColor;
        RenderSettings.fogMode          = currentTimeSet.fogMode;
        RenderSettings.fogDensity       = currentTimeSet.fogDensity;
        RenderSettings.fogStartDistance = currentTimeSet.linearFogStart;
        RenderSettings.fogEndDistance   = currentTimeSet.linearFogEnd;
    }
 private void UpdateSkydome(TimeSet currentTimeSet)
 {
     //Material skydomeMaterial = skydome.GetComponent<MeshRenderer>().material;
 }
        public override void Initialise(XElement xElement, IDocumentAccessor accessor)
        {
            xElement = Persistence.ThisOrSingleChild(XName, xElement);

            base.Initialise(xElement, accessor);

            _timeExtent = Persistence.TimeSet.Parse(xElement, accessor);

            _engineDone = false;
        }
        protected override ITimeSpaceValueSet GetValuesTimeImplementation(IBaseExchangeItem querySpecifier)
        {
            if (!(querySpecifier is ITimeSpaceExchangeItem))
                return _valueSetConverterTime.GetValueSetLatest() as ITimeSpaceValueSet;

            TimeSet = ((ITimeSpaceExchangeItem)querySpecifier).TimeSet;
            TimeSet queryTime = new TimeSet(((ITimeSpaceExchangeItem)querySpecifier).TimeSet);

            if (Component == null) // Orphaned Exchange item
                return _valueSetConverterTime.GetValueSetAt(TimeSet) as ITimeSpaceValueSet;

            int updateCount = 0;

            while (!_valueSetConverterTime.CanGetValueSetWithoutExtrapolationAt(queryTime))
            {
                if (Component.Status == LinkableComponentStatus.Updating)
                {
                    // Bidirectional link and component is busy

                    string warning = string.Format("WARNING: Component \"{0}\" busy extrapolated for required values", Component.Caption);

                    Trace.TraceWarning(warning);
                    SendItemChangedEvent(warning);

                    return _valueSetConverterTime.GetValueSetAt(queryTime) as ITimeSpaceValueSet;
                }
                else if (updateCount > _updatelimitBeforeExtrapolating)
                {
                    string error = string.Format(
                        "ERROR: Component \"{0}\" reached update limit of {1}, aborted updates and extrapolated for required values",
                        Component.Caption, _updatelimitBeforeExtrapolating);

                    Trace.TraceError(error);
                    SendItemChangedEvent(error);

                    return _valueSetConverterTime.GetValueSetAt(queryTime) as ITimeSpaceValueSet;
                }
                else
                {
                    Component.Update(this);
                    ++updateCount;
                }
            }

            return _valueSetConverterTime.GetValueSetAt(queryTime) as ITimeSpaceValueSet;
        }