Ejemplo n.º 1
0
        public string ToString(string format)
        {
            string timeStart = TimeStart.ToString(format);
            string timeStep  = TimeStep.ToString(format);

            return(GetType().Name + $"{{{timeStart}, {timeStep}, {Count}}}");
        }
Ejemplo n.º 2
0
 internal static async Task <Stream> LoadClimateByIdFromATBWebService(String dataObjId, DateTime start, DateTime end, TimeStep step)
 {
     try
     {
         String url = String.Format(
             SpongeJsUrlDataId,
             dataObjId,
             start.ToUniversalTime().ToString("s") + "Z",
             end.ToUniversalTime().ToString("s") + "Z",
             step.ToString()
             );
         return(await WebApiRequest.ExecuteWebApiRequest(url));
     }
     catch
     {
         return(null);
     }
 }
Ejemplo n.º 3
0
 internal static async Task <Stream> LoadClimateByLocationTagFromATBWebService(Location location, String tag, DateTime start, DateTime end, TimeStep step)
 {
     try
     {
         String url = String.Format(
             SpongeJsUrlDataLocation,
             String.IsNullOrEmpty(tag) ? DefaultTag : tag,
             location.lon.ToString(CultureInfo.InvariantCulture),
             location.lat.ToString(CultureInfo.InvariantCulture),
             start.ToUniversalTime().ToString("s") + "Z",
             end.ToUniversalTime().ToString("s") + "Z",
             step.ToString()
             );
         return(await WebApiRequest.ExecuteWebApiRequest(url));
     }
     catch
     {
         return(null);
     }
 }
Ejemplo n.º 4
0
        public override void WriteLayerProperties(System.Xml.XmlTextWriter xmlWriter)
        {
            xmlWriter.WriteAttributeString("North", North.ToString());
            xmlWriter.WriteAttributeString("South", South.ToString());
            xmlWriter.WriteAttributeString("East", East.ToString());
            xmlWriter.WriteAttributeString("West", West.ToString());
            xmlWriter.WriteAttributeString("Rotation", Rotation.ToString());
            xmlWriter.WriteAttributeString("Altitude", Altitude.ToString());

            xmlWriter.WriteAttributeString("Height", Height.ToString());
            xmlWriter.WriteAttributeString("Width", Width.ToString());
            xmlWriter.WriteAttributeString("SeriesStartTime", SeriesStartTime.ToString("o"));
            xmlWriter.WriteAttributeString("SeriesEndTime", SeriesEndTime.ToString("o"));
            xmlWriter.WriteAttributeString("TimeStep", TimeStep.ToString());
            xmlWriter.WriteAttributeString("ServiceUrl", ServiceUrl);
            xmlWriter.WriteAttributeString("Layers", Layers);
            xmlWriter.WriteAttributeString("Styles", Styles);
            xmlWriter.WriteAttributeString("Version", WmsVersion);
            xmlWriter.WriteAttributeString("TimeRanges", GetDateRangeString());
        }
Ejemplo n.º 5
0
        /// <summary>
        /// outputs the editor's timestep. set silent to true if no message logs should be generated.
        /// </summary>
        /// <param name="silent"></param>
        /// <returns></returns>
        public bool outputTimestepNow(TimeStep timeStep, bool silent, bool showErrorDialog)
        {
            List <string> unconnectedServers = Storage.settingsData.unconnectedRequiredServers();

            if (!Storage.sequenceData.Lists.ListLocked)
            {
                WordGenerator.MainClientForm.instance.variablesEditor.tryLockLists();
            }
            if (!Storage.sequenceData.Lists.ListLocked)
            {
                if (!silent)
                {
                    messageLog(this, new MessageEvent("Unable to output timestep, lists not locked."));
                }
                if (showErrorDialog)
                {
                    MessageBox.Show("Unable to output timestep, lists not locked.");
                }
                return(false);
            }

            if (unconnectedServers.Count == 0)
            {
                WordGenerator.MainClientForm.instance.cursorWait();
                ServerManager.ServerActionStatus actionStatus;
                try
                {
                    actionStatus = Storage.settingsData.serverManager.outputSingleTimestepOnConnectedServers(
                        Storage.settingsData,
                        Storage.sequenceData.getSingleOutputFrameAtEndOfTimestep(timeStep, Storage.settingsData, Storage.settingsData.OutputAnalogDwellValuesOnOutputNow),
                        messageLog);
                }
                finally
                {
                    WordGenerator.MainClientForm.instance.cursorWaitRelease();
                }

                if (actionStatus == ServerManager.ServerActionStatus.Success)
                {
                    if (!silent)
                    {
                        messageLog(this, new MessageEvent("Successfully output timestep " + timeStep.ToString()));
                    }
                    WordGenerator.MainClientForm.instance.CurrentlyOutputtingTimestep = timeStep;
                    return(true);
                }
                else
                {
                    if (!silent)
                    {
                        messageLog(this, new MessageEvent("Communication or server error attempting to output this timestep: " + actionStatus.ToString()));
                    }
                    if (showErrorDialog)
                    {
                        MessageBox.Show("Communication or server error attempting to output this timestep: " + actionStatus.ToString());
                    }
                }
            }
            else
            {
                string missingServerList = ServerManager.convertListOfServersToOneString(unconnectedServers);
                if (!silent)
                {
                    messageLog(this, new MessageEvent("Unable to output this timestep. The following required servers are not connected: " + missingServerList));
                }

                if (showErrorDialog)
                {
                    MessageBox.Show("Unable to output this timestep. The following required servers are not connected: " + missingServerList);
                }
            }
            return(false);
        }