GameObject Spawn(Transform parent, ProcessUnit unit, int generation) { if (unit.Content == '0') { return(null); } float upRadius = 0.8f * 0.1f; float lengthUp = 0.5f + (0.1f * generation); float lengthDown = 0.05f; float dynamicFactor = 0.5f + ((float)unit.Dynamic / 127.0f) * 1.0f; int sides = 32; if (unit.Children.Count == 0) { Material flowerMaterial = materialLookup.Get(unit.Content); return(wedgeMeshGen.GetWedgeObject(sides, 0.5f, flowerRadius * dynamicFactor, flowerLength, 0.5f, lengthDown, flowerSquish, flowerSquish, flowerSquish, parent, flowerMaterial)); } else { // GetWedgeObject(int sides, float radiusCenter, float radiusUp, float lengthUp, float radiusDown, float lengthDown, float squish, float squishUp, float squishDown, Transform transform, Material material) return(wedgeMeshGen.GetWedgeObject(sides, 0.5f * 0.1f * radiusMul * dynamicFactor, upRadius * radiusMul * dynamicFactor, lengthUp, bottomRadius * radiusMul * dynamicFactor, lengthDown, mainSquish, bottomSquish, bottomSquish, parent, BranchMaterial)); } }
GameObject Spawn(Transform parent, ProcessUnit unit, int generation) { if (unit.Content == '0') { return(Object.Instantiate(ProtoEmpty, parent)); } GameObject obj = Object.Instantiate(ProtoCube, parent); SineStripesCycler ssc = obj.GetComponent <SineStripesCycler>(); ssc.PhaseFrequencyX = RandomRange(0.2f, 8.0f - (generation * 0.5f)); ssc.PhaseFrequencyY = RandomRange(0.2f, generation * 0.05f); float xyAmb = 4.0f - (generation * 0.3333f); ssc.PhaseOffsetX = Random.Range(-xyAmb, xyAmb); ssc.PhaseOffsetY = Random.Range(-xyAmb, xyAmb); if (generation % 2 == 1) { ssc.Color = Color.black; ssc.BackgroundColor = materialLookup.GetColor(unit.Content); } else { ssc.Color = Color.white; ssc.BackgroundColor = Color.black; } return(obj); }
public void Test2() { var f1 = new ProcessFlowHelper.Implementation.Flow(); f1.RatedFlow = 10; var f2 = new ProcessFlowHelper.Implementation.Flow(); f2.RatedFlow = 20; var medi = new Medium(); Pump jetpump = new Pump(f1, 20); Blower blower = new Blower(98, 90, f2); blower.SetTagNumber("AR-001"); jetpump.SetTagNumber("P-002"); jetpump.SetDenomination("Jetpump for equalization tank"); var eqtankunit = new ProcessUnit(); eqtankunit.AddEquipment(jetpump); eqtankunit.AddEquipment(blower); eqtankunit.SetDenomination("U-001"); eqtankunit.SetDenomination("Equalization tank process unit"); Assert.AreEqual("P-002", eqtankunit.ListSubEquipment[0].TagNumber); Assert.AreEqual("AR-001", eqtankunit.ListSubEquipment[1].TagNumber); Assert.AreEqual(500, eqtankunit.InstalledPower); }
GameObject Spawn(Transform parent, ProcessUnit unit) { float upRadius = 0.8f * 0.1f; float lengthUp = 0.3f; float lengthDown = 0.05f; float dynamicFactor = 0.5f + ((float)unit.Dynamic / 127.0f) * 1.0f; int sides = 16; if (unit.Children.Count == 0) { if (unit.Content == '6' || unit.Content == '7') { return(wedgeMeshGen.GetWedgeObject(sides, dynamicFactor * 0.1f, 0.0f, lengthUp, 1.0f * 0.1f, lengthDown, 0.01f, 0.2f, bottomSquish, parent, BranchMaterial)); } else { Material flowerMaterial = materialLookup.Get(unit.Content); return(wedgeMeshGen.GetWedgeObject(sides, 0.5f * 0.1f, flowerRadius * dynamicFactor, flowerLength, 0.5f * 0.1f, lengthDown, 0.2f, flowerSquish, 0.2f, parent, flowerMaterial)); } } else { return(wedgeMeshGen.GetWedgeObject(sides, 0.5f * 0.1f * radiusMul * dynamicFactor, upRadius * radiusMul * dynamicFactor, lengthUp, bottomRadius * radiusMul * dynamicFactor, lengthDown, mainSquish, 0.5f, bottomSquish, parent, BranchMaterial)); } }
private static void DetermineCheckEnabled(ProcessUnit unit, out bool checkEnabled, out bool commentEnabled) { checkEnabled = false; commentEnabled = false; try { if (unit.PresentationCreate.IsSelected || unit.PresentationUpdate.IsSelected) { checkEnabled = true; commentEnabled = true; return; } if (!string.IsNullOrEmpty(unit.CheckingReport.PdfFile) || !string.IsNullOrEmpty(unit.CheckingReport.RtfFile)) { checkEnabled = true; } if (!string.IsNullOrEmpty(unit.PresentationReport.PdfFile) || !string.IsNullOrEmpty(unit.PresentationReport.RtfFile) || !string.IsNullOrEmpty(unit.BCFReport.File) || !string.IsNullOrEmpty(unit.CoordReport.File)) { checkEnabled = true; commentEnabled = true; } } catch (Exception ex) { string message = ex.Message; } }
private void StartProcess(string[] files) { AProgressBar.Value = 0; DropGrid.AllowDrop = false; ((Storyboard)Resources["StartStoryboard"]).Begin(); ProcessThread = new Thread(() => { IsProcessing = true; ProgressUpdateThread = new Thread(ProgressUpdateLoop); ProgressUpdateThread.Start(); string message = ProcessUnit.Process(files); IsProcessing = false; Dispatcher.Invoke(() => { AProgressBar.Value = -1; DropGrid.AllowDrop = true; ((Storyboard)Resources["EndStoryboard"]).Begin(); MessageBox.Show(this, message); ProcessFinished?.Invoke(); }); }); ProcessThread.Start(); }
public void OnGenerate(LSystemController lsysController) { OSCMessage msg = new OSCMessage("/ckartree"); List <string> keyList = new List <string>(lsysController.Forest.Keys); keyList.Sort(); foreach (string key in keyList) { LSystem lsys = lsysController.Forest[key]; int numResults = lsys.Results.Count; if (numResults > 0) { string result = lsys.Results[numResults - 1]; string dynamicsString = ""; List <ProcessUnit> lastUnits = lsys.Units[numResults - 1]; for (int i = 0; i < lastUnits.Count; i++) { ProcessUnit unit = lastUnits[i]; dynamicsString += unit.Dynamic; if (i != (lastUnits.Count - 1)) { dynamicsString += "|"; } } msg.Append($"{key}@{result}A{lsys.Axiom}G{numResults}S{lsys.Shape}D{dynamicsString}"); } } osc.Send(msg); }
// Functions //--------------------------------------- public void Add(FUNC_PROCESS_UNIT funcProcess, int count) { ProcessUnit newUnit = new ProcessUnit(count); newUnit.AddProcess(funcProcess); _units.Add(newUnit); _totalProcessCount += count; //전체 카운트를 높인다. (나중에 퍼센트 체크를 위함) }
void Start() { m_pRelayConnector = null; m_pSocketManager = null; m_pProcessUnit = null; m_pProcessUnitBank = null; m_PUUID = 0; m_RPCID = 0; }
protected bool VisitUnit(ProcessUnit unit) { if (!visitedUnitDict.ContainsKey(unit.Id)) { visitedUnitDict[unit.Id] = unit; return(true); } else { return(false); } }
GameObject Spawn(Transform parent, ProcessUnit unit, float lengthUp, float baseRadius, float lastBaseRadius) { const int sides = 16; float radiusCenter = baseRadius * 1.5f; float radiusUp = baseRadius; float radiusDown = baseRadius * 0.25f; float lengthDown = 0.15f * lengthUp; float squish = 0.3f; float squishUp = squish; float squishDown = squish * 2.0f; return(wedgeMeshGen.GetWedgeObject(sides, radiusCenter, radiusUp, lengthUp, radiusDown, lengthDown, squish, squishUp, squishDown, parent, BranchMaterial)); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { Visibility visibility = Visibility.Visible; if (null != value) { ProcessUnit unit = value as ProcessUnit; if (null != unit) { visibility = Visibility.Hidden; } } return(visibility); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { bool isExpanded = false; if (null != value) { ProcessUnit unit = value as ProcessUnit; if (null != unit) { isExpanded = true; } } return(isExpanded); }
// serialize a ProcessUnit to Xml using Linq to Xml private XElement SerializeProcessUnit(ProcessUnit processUnit) { // main body of the processUnit var ret = new XElement("ProcessUnit", new XAttribute("id", processUnit.Id.ToString()), new XAttribute("status", processUnit.Status), new XElement("creationDate", processUnit.CreationDate), new XElement("completionDate", processUnit.CompletionDate), new XElement("title", processUnit.Title), new XElement("description", processUnit.Description), new XElement("activityId", processUnit.ActivityId.ToString())); return(ret); }
public void Report(ProcessUnit unit) { WriteLine(""); WriteLine("Report for unit " + unit.Name + "[" + unit.Class + "]"); WriteLine("================================================"); WriteLine("Material Ports"); WriteLine(""); WriteLine(String.Format("{0,-15} {1,-10} {2,-5} {3,-5} {4,-25}", "Name", "Direction", "Multi", "Num", "Streams")); foreach (var port in unit.MaterialPorts) { WriteLine(String.Format("{0,-15} {1,-10} {2,-5} {3,-5} {4,-25}", port.Name, port.Direction, port.Multiplicity, port.NumberOfStreams, String.Join(", ", port.Streams.Select(s => s.Name)))); } if (unit.HeatPorts.Count > 0) { WriteLine(""); WriteLine("Heat Ports"); WriteLine(""); WriteLine(String.Format("{0,-15} {1,-10} {2,-5} {3,-5} {4,-25}", "Name", "Direction", "Multi", "Num", "Streams")); foreach (var port in unit.HeatPorts) { WriteLine(String.Format("{0,-15} {1,-10} {2,-5} {3,-5} {4,-25}", port.Name, port.Direction, port.Multiplicity, port.NumberOfStreams, String.Join(", ", port.Streams.Select(s => s.Name)))); } } WriteLine(""); WriteLine("Variables"); WriteLine(""); WriteLine(String.Format("{0,-15} {1,-15} {2,-15} {3,-15} {4,15} {5,-15} {6,-15} {7,-15} {8,-25} {9,-15}", "Name", "Model", "Class", "Group", "Value", "Unit", "Min", "Max", "Dimension", "Description")); foreach (var vari in unit.Variables) { WriteLine(String.Format("{0,-15} {1,-15} {2,-15} {3,-15} {4,15} {5,-15} {6,-15} {7,-15} {8,-25} {9,-15}", vari.FullName, vari.ModelName, vari.ModelClass, vari.Group, vari.ValueInOutputUnit.ToString("G6", System.Globalization.NumberFormatInfo.InvariantInfo), vari.OutputUnit.Symbol, Unit.Convert(vari.InternalUnit, vari.OutputUnit, vari.LowerBound).ToString("G6", System.Globalization.NumberFormatInfo.InvariantInfo), Unit.Convert(vari.InternalUnit, vari.OutputUnit, vari.UpperBound).ToString("G6", System.Globalization.NumberFormatInfo.InvariantInfo), vari.Dimension, vari.Description)); } WriteLine(""); }
public void Test3() { var f1 = new ProcessFlowHelper.Implementation.Flow(); f1.RatedFlow = 10; Pump jetpump = new Pump(f1, 20); CoarseScreen cs = new CoarseScreen(f1, 1); var eqtankunit = new ProcessUnit(); eqtankunit.AddEquipment(cs); eqtankunit.AddEquipment(jetpump); eqtankunit.SetDenomination("U-001"); eqtankunit.SetDenomination("Equalization tank process unit"); Assert.AreEqual(253.7, eqtankunit.InstalledPower); }
public virtual void Start() { m_PUUID = 0; m_IsUpdate = false; m_pPU = null; m_pProcessUnit = null; m_pProcessUnitBank = new ProcessUnitBank(); do { m_pSocketManager = new SocketManager(); if (null == m_pSocketManager) { Logger.MLNLOG_ERR("Error SocketManager"); break; } if (SocketManager.SOCKETMANAGER_RET_CODE.ERROR == m_pSocketManager.Initialize()) { Logger.MLNLOG_ERR("Error SocketManager Initialize"); break; } m_PUUID = CreatePU(); if (ProcessUnitManager.INVALID_PUUID == m_PUUID) { Logger.MLNLOG_ERR("Error CreatePU"); m_IsUpdate = false; break; } m_pProcessUnit = m_pProcessUnitBank.GetProcessUnitFromId(m_PUUID); m_pPU = (BTL.PU_Client)m_pProcessUnit as BTL.PU_Client; m_pPU.Start(); m_pPU.SetCharaId(m_CharaId); m_pPU.GetRpcConnector().SetSocketManager(m_pSocketManager); m_pPU.GetRpcConnector().SetProcessUnit(m_pProcessUnitBank.GetProcessUnitFromId(m_PUUID)); m_pPU.GetRpcConnector().SetProcessUnitBank(m_pProcessUnitBank); m_pPU.GetRpcConnector().NewRelayConnector(); m_IsUpdate = true; }while (false); }
GameObject Spawn(Transform parent, ProcessUnit unit) { GameObject obj = Object.Instantiate(ProtoPlanet, parent); PlanetStripesCycler psc = obj.transform.GetChild(0).GetComponent <PlanetStripesCycler>(); psc.PhaseFreqeuncy = new Vector4(RandomRange(1, 3), RandomRange(1, 5), RandomRange(1, 3), RandomRange(1, 5)); psc.PhaseOffset = new Vector4(RandomRange(-3, 3), RandomRange(-3, 3), RandomRange(-3, 3), RandomRange(-3, 3)); psc.Offset = RandomRange(0.0f, 10.0f); Color col = materialLookup.GetColor(unit.Content); psc.Color = col; float bgDarken = RandomRange(0.15f, 0.3f); psc.BackgroundColor = new Color(col.r * bgDarken, col.g * bgDarken, col.b * bgDarken); return(obj); }
public void Run() { if (!_isRunning) { return; } if (_iCurUnit >= _units.Count) { //끝. 성공! _isRunning = false; _isSuccess = true; _curProcessX100 = 100; //Debug.Log("Process Success : " + _strProcessLabel); return; } ProcessUnit curUnit = _units[_iCurUnit]; //실행하고 퍼센트를 높이자 if (!curUnit.Run(_iSubProcess)) { //실패 했네염.. _isRunning = false; _isSuccess = false; _curProcessX100 = 0; Debug.LogError("AnyPortrait : PSD Process Failed : " + _strProcessLabel + " (Current Step : " + _iCurUnit + " / Sub Procss : " + _iSubProcess + ")"); return; } _iTotalProcess++; _iSubProcess++; if (_iSubProcess >= curUnit._count) { _iSubProcess = 0; _iCurUnit++; } _curProcessX100 = (int)Mathf.Clamp((((float)_iTotalProcess * 100.0f) / (float)_totalProcessCount), 0, 100); }
GameObject Spawn(Transform parent, ProcessUnit unit, float lengthUp, float baseRadius, float lastBaseRadius) { const int sides = 16; float radiusCenter = lastBaseRadius; float radiusUp = baseRadius; float radiusDown = 0.0f; float lengthDown = 0.05f * lengthUp; float squish = 1.0f; float squishUp = 1.0f; float squishDown = 1.0f; if (unit.Children.Count == 0) { radiusUp = baseRadius * 4.0f; lengthUp = lengthUp * 0.5f; squishUp = 0.1f; } return(wedgeMeshGen.GetWedgeObject(sides, radiusCenter, radiusUp, lengthUp, radiusDown, lengthDown, squish, squishUp, squishDown, parent, BranchMaterial)); }
public virtual void Start() { m_PUUID = 0; m_IsUpdate = false; m_pPU = null; m_pProcessUnit = null; m_pProcessUnitBank = new ProcessUnitBank(); do{ m_pSocketManager = new SocketManager(); if ( null == m_pSocketManager ){ Logger.MLNLOG_ERR("Error SocketManager"); break; } if ( SocketManager.SOCKETMANAGER_RET_CODE.ERROR == m_pSocketManager.Initialize() ){ Logger.MLNLOG_ERR( "Error SocketManager Initialize" ); break; } m_PUUID = CreatePU(); if (ProcessUnitManager.INVALID_PUUID == m_PUUID) { Logger.MLNLOG_ERR("Error CreatePU"); m_IsUpdate = false; break; } m_pProcessUnit = m_pProcessUnitBank.GetProcessUnitFromId(m_PUUID); m_pPU = (BTL.PU_Client)m_pProcessUnit as BTL.PU_Client; m_pPU.Start(); m_pPU.SetCharaId( m_CharaId ); m_pPU.GetRpcConnector().SetSocketManager(m_pSocketManager); m_pPU.GetRpcConnector().SetProcessUnit(m_pProcessUnitBank.GetProcessUnitFromId(m_PUUID)); m_pPU.GetRpcConnector().SetProcessUnitBank(m_pProcessUnitBank); m_pPU.GetRpcConnector().NewRelayConnector(); m_IsUpdate = true; }while ( false ); }
public static ObservableCollection <ProcessUnit> ExtractProcessUnits(Batch batch) { ObservableCollection <ProcessUnit> processUnits = new ObservableCollection <ProcessUnit>(); try { ProcessUnit unit = new ProcessUnit(); ObservableCollection <GenericElement> elements = batch.Target.Elements; for (int i = 0; i < elements.Count; i++) { GenericElement element = elements[i]; string elementType = element.GetType().Name; switch (elementType) { case "OpenModel": OpenModel openModel = element as OpenModel; if (openModel.FileExtension == ".smc") { unit.OpenSolibri = openModel; } else if (modelExtensions.Contains(openModel.FileExtension)) { InputModel modeltoOpen = new InputModel(openModel); unit.Models.Add(modeltoOpen); } break; case "UpdateModel": UpdateModel updateModel = element as UpdateModel; InputModel modeltoUpdate = new InputModel(updateModel); unit.Models.Add(modeltoUpdate); break; case "OpenRuleset": OpenRuleset ruleset = element as OpenRuleset; unit.Rulesets.Add(ruleset); break; case "OpenClassification": OpenClassification classification = element as OpenClassification; unit.Classifications.Add(classification); break; case "Check": Check check = element as Check; check.IsSpecified = true; unit.CheckTask = check; break; case "AutoComment": AutoComment comment = element as AutoComment; comment.IsSpecified = true; unit.CommentTask = comment; break; case "WriterReport": unit.CheckingReport = element as WriterReport; break; case "CreatePresentation": CreatePresentation createP = element as CreatePresentation; createP.IsSelected = true; unit.PresentationCreate = createP; break; case "UpdatePresentation": UpdatePresentation updateP = element as UpdatePresentation; updateP.IsSelected = true; unit.PresentationUpdate = updateP; break; case "GeneralReport": unit.PresentationReport = element as GeneralReport; break; case "BCFReport": unit.BCFReport = element as BCFReport; break; case "CoordinationReport": unit.CoordReport = element as CoordinationReport; break; case "SaveModel": unit.SaveSolibri = element as SaveModel; unit.TaskName = System.IO.Path.GetFileNameWithoutExtension(unit.SaveSolibri.File); break; case "CloseModel": processUnits.Add(unit); unit = new ProcessUnit(); break; } } } catch (Exception ex) { MessageBox.Show("Failed to extract process units.\n" + ex.Message, "Extract Process Unit", MessageBoxButton.OK, MessageBoxImage.Warning); } return(processUnits); }
public void SetProcessUnit(ProcessUnit pProcessUnit) { m_pProcessUnit = pProcessUnit; }
private List <ProcessUnit> ProcessList(List <ProcessUnit> input, List <RuleSet> sortedRules) { List <ProcessUnit> list = new List <ProcessUnit>(); // do an identity copy foreach (ProcessUnit unit in input) { ProcessUnit copy = new ProcessUnit(false, unit.Content, unit.Dynamic); unit.AddChild(copy); list.Add(copy); } foreach (RuleSet rule in sortedRules) { int len = rule.From.Length; string from = rule.From; List <ProcessUnit> newList = new List <ProcessUnit>(); int i = 0; while (i < list.Count) { // early exits if (i + len > list.Count) { newList.Add(list[i]); i++; continue; } bool matches = true; for (int e = 0; e < len; e++) { matches = matches && (from[e] == list[i + e].Content) && !list[i + e].Processed; } if (matches) { rule.Touched = Generation; for (int f = 0; f < rule.To.Length; f++) { char toSymbol = rule.To[f]; int toDynamic = rule.Dynamics[f]; if (toSymbol != 'N') { // new dynamic should be average of fromDynamics and the toDynamic int contributors = 1 + len; int sum = toDynamic; for (int e = 0; e < len; e++) { sum += list[i + e].Dynamic; // this should be our old Dynamics } ProcessUnit newUnit = new ProcessUnit(true, toSymbol, sum / contributors); for (int e = 0; e < len; e++) { foreach (ProcessUnit parent in list[i + e].Parents) { parent.Children.Remove(list[i + e]); parent.AddChild(newUnit); } } newList.Add(newUnit); } } i = i + len; } else { newList.Add(list[i]); i++; } } list = newList; } if (list.Count > maxStringLength) { TooWide = true; return(new List <ProcessUnit>()); } else { return(list); } }
//Add any additional necessary data to persist here //protected override void CollectValues(out IDictionary<XName, object> readWriteValues, out IDictionary<XName, object> writeOnlyValues) //{ // base.CollectValues(out readWriteValues, out writeOnlyValues); //} //Implementations of MapValues are given all the values collected from all participants implementations of CollectValues protected override IDictionary <XName, object> MapValues(IDictionary <XName, object> readWriteValues, IDictionary <XName, object> writeOnlyValues) { var statusXname = XName.Get("Status", PropertiesNamespace); var mappedValues = base.MapValues(readWriteValues, writeOnlyValues); var processUnit = new ProcessUnit { Id = _id, ActivityId = _activityId }; string status = string.Empty; object value; //retrieve the status of the workflow if (writeOnlyValues.TryGetValue(statusXname, out value)) { status = (string)value; processUnit.Status = status; } /*foreach (KeyValuePair<System.Xml.Linq.XName, object> item in writeOnlyValues) * { * }*/ IoHelper.EnsureAllProcessUnitFileExists(); var fileName = IoHelper.GetAllProcessUnitsFileName(); // load the document XElement doc; using (var fs = File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) { using (var tw = new StreamReader(fs, Encoding.UTF8)) { doc = XElement.Load(tw); } } IEnumerable <XElement> current = from r in doc.Elements("ProcessUnit") where r.Attribute("id").Value.Equals(_id.ToString()) select r; if (status == "Closed") { // erase nodes for the current processUnit foreach (var xe in current) { xe.Attribute("status").Value = "finished"; } } else { // erase nodes for the current processUnit foreach (XElement xe in current) { xe.Remove(); } // get the Xml version of the Rfp, add it to the document and save it var e = SerializeProcessUnit(processUnit); doc.Add(e); } doc.Save(fileName); return(mappedValues); }
public void AddChild(ProcessUnit unit) { Children.Add(unit); unit.Parents.Add(this); }
internal void StartProcessUnit(ref UnitProperty unitProperty, params object[] inputData) { ProcessUnit.Invoke(ref unitProperty, inputData); }
public RingSegment(ProcessUnit unit, int numSegments, float startRotation) { Unit = unit; NumSegments = numSegments; StartRotation = startRotation; }