private void Helper(IObjectData objData, UITreeData parUiTree) { var curUiTree = new UITreeData(objData.Name, objData.EntityLabel); if (objData is IElementData) { IElementData eleData = objData as IElementData; var typeUiTreeData = parUiTree.FindChildren(eleData.TypeName); if (typeUiTreeData == default) { typeUiTreeData = new UITreeData(eleData.TypeName, eleData.ProductGeoData.typeId); parUiTree.AddChild(typeUiTreeData); } var curEleUiTreeData = new UITreeData(objData.Name, objData.EntityLabel); typeUiTreeData.AddChild(curEleUiTreeData); foreach (var decEle in objData.RelatedObjects) { curEleUiTreeData.AddChild(new UITreeData(decEle.Name, decEle.EntityLabel)); } return; } parUiTree.AddChild(curUiTree); foreach (var p in objData.RelatedObjects) { Helper(p, curUiTree); } }
/// <summary> /// The constructor for the element. /// Called at runtime when the element is first referenced. /// </summary> /// <param name="data"></param> public MqttSubscriberElement(IElementData data) { _data = data; _props = _data.Properties; // The IElementData contains a reference to the execution context var context = _data.ExecutionContext; prServerElement = (IElementProperty)_props.GetProperty("MqttServer"); MqttConnector = (MqttSubscribeConnector)prServerElement.GetElement(context); // Get the Property Readers IPropertyReader prTopic = _data.Properties.GetProperty("Topic"); // Place simio events into a lookup array that will be used at runtime. TopicEventList = new List <IEvent>(); foreach (var eventDef in _data.Events) { TopicEventList.Add(eventDef); } LogIt($"SubscriberElement Start: Url={MqttConnector.ServerUrl} Port={MqttConnector.ServerPort} "); SubscribeTopic = prTopic.GetStringValue(_data.ExecutionContext); }
public void appendDataIntoLayoutData(IElementData element, bool updateLayout = true) { layoutData.Add(element); if (updateLayout) { this.updateLayout(); } }
public CalculationElement(IElementData data) { _data = data; IPropertyReader prFileName = _data.Properties.GetProperty("FilePath"); IPropertyReader prOutputToFile = _data.Properties.GetProperty("OutputToFile"); FilePath = prFileName.GetStringValue(_data.ExecutionContext); OutputToFile = bool.Parse(prOutputToFile.GetStringValue(_data.ExecutionContext)); }
/// <summary> /// Set up the pipeline and flow data with an element which contains /// properties which can used to test the GetWhere method. /// </summary> private void ConfigureGetWhere(bool includePropertyWithException = false) { // Mock the element var element1 = new Mock <IFlowElement>(); element1.SetupGet(e => e.ElementDataKey).Returns("element1"); // Set up the properties var propertyMetaData = new List <IElementPropertyMetaData>() { new ElementPropertyMetaData(element1.Object, "available", typeof(string), true, "category"), new ElementPropertyMetaData(element1.Object, "anotheravailable", typeof(string), true, "category"), new ElementPropertyMetaData(element1.Object, "unavailable", typeof(string), false, "category"), new ElementPropertyMetaData(element1.Object, "differentcategory", typeof(string), true, "another category"), new ElementPropertyMetaData(element1.Object, "nocategory", typeof(string), true) }; if (includePropertyWithException) { propertyMetaData.Add(new ElementPropertyMetaData(element1.Object, "throws", typeof(string), true)); } element1.SetupGet(e => e.Properties).Returns(propertyMetaData); IElementData elementData1 = null; // Use a different element data instance based on whether // we want it to be able to throw an exception or not. if (includePropertyWithException == false) { elementData1 = new DictionaryElementData(new TestLogger <DictionaryElementData>(), _pipeline.Object); } else { var data = new PropertyExceptionElementData(new TestLogger <DictionaryElementData>(), _pipeline.Object); data.ConfigureExceptionForProperty("throws", new Exception("This property is broken!")); elementData1 = data; } // Set up the values for the available properties elementData1["available"] = "a value"; elementData1["anotheravailable"] = "a value"; elementData1["differentcategory"] = "a value"; elementData1["nocategory"] = "a value"; // Set up the process method to add the values to the flow data _pipeline.Setup(p => p.Process(It.IsAny <IFlowData>())) .Callback((IFlowData data) => { data.GetOrAdd("element1", (p) => elementData1); }); // Set up the element in the pipeline _pipeline.SetupGet(i => i.FlowElements).Returns(new List <IFlowElement>() { element1.Object }); }
/// <summary> /// Constructor /// </summary> /// <param name="data"></param> public ExcelConnectElementEPPlus(IElementData data) { _data = data; IPropertyReader prExcelWorkbook = _data.Properties.GetProperty("ExcelWorkbook"); // get filename string fileName = prExcelWorkbook.GetStringValue(_data.ExecutionContext); _package = new ExcelPackage(new FileInfo(fileName)); if (String.IsNullOrEmpty(fileName) == false) { string fileRoot = null; string fileDirectoryName = null; string fileExtension = null; try { fileRoot = System.IO.Path.GetPathRoot(fileName); fileDirectoryName = System.IO.Path.GetDirectoryName(fileName); fileExtension = System.IO.Path.GetExtension(fileName); } catch (ArgumentException ex) { ReportError($"File Root={fileRoot} Directory={fileDirectoryName} Err={ex.Message}", ex.ToString()); } // Get information about the Simio run IExecutionInformation info = _data.ExecutionContext.ExecutionInformation; string projectFolder = info.ProjectFolder; if (String.IsNullOrEmpty(fileDirectoryName) || String.IsNullOrEmpty(fileRoot)) { fileDirectoryName = projectFolder; fileName = fileDirectoryName + "\\" + fileName; } _readerExcelFileName = fileName; string experimentName = info.ExperimentName; if (String.IsNullOrEmpty(experimentName)) { _writerExcelFileName = fileName; } else { string scenarioName = info.ScenarioName; string replicationNumber = info.ReplicationNumber.ToString(); fileName = Path.ChangeExtension(fileName, null); _writerExcelFileName = $"{fileName}_{experimentName}_{scenarioName}_Rep{replicationNumber}{fileExtension}"; } } }
public ArtaElement(IElementData data) { _data = data; IPropertyReader corr1 = _data.Properties.GetProperty("CorrelationCoefficent1"); IPropertyReader corr2 = _data.Properties.GetProperty("CorrelationCoefficent2"); _artaRunProp = (IProperty)_data.Properties.GetProperty("ArtaRun"); c1 = corr1.GetDoubleValue(_data.ExecutionContext); c2 = corr1.GetDoubleValue(_data.ExecutionContext); }
/// <summary> /// Constructor. The argument "data" includes run-time info, including ExecutionContext, /// I.e. data has members of Events, that can be indexed with the name /// and also Properties and ExecutionContext. /// </summary> /// <param name="data"></param> public MqttSubscribeConnector(IElementData data) { _data = data; try { IPropertyReader prUrl = _data.Properties.GetProperty("ServerUrl"); ServerUrl = prUrl.GetStringValue(_data.ExecutionContext); IPropertyReader prPort = _data.Properties.GetProperty("ServerPort"); ServerPort = int.Parse(prPort.GetStringValue(_data.ExecutionContext)); } catch (Exception ex) { LogIt($"Err={ex.Message}"); } }
/// <summary> /// Constructor called as the run begins. /// </summary> /// <param name="data"></param> public SimioTableElement(IElementData data) { _Data = data; _Props = _Data.Properties; // Property readers _Context = _Data.ExecutionContext; // run-time execution context rprTableFields = (IRepeatingPropertyReader)_Props.GetProperty(MyStrings.TableColumnMappingsName); prTableRowIndex = (IStateProperty)_Props.GetProperty(MyStrings.TableIndexName); IExpressionPropertyReader prExpression = (IExpressionPropertyReader)_Props.GetProperty(MyStrings.TableRowCountName); double tableRowCount = (double)prExpression.GetExpressionValue(data.ExecutionContext); // Build a structure to hold data?? ////CalcDataList = new List<CalculationRow>(); ////for (int tr = 1; tr <= NbrTableRows; tr++) ////{ //// CalculationRow cr = new CalculationRow(); //// cr.MyKey = tr; //// CalcDataList.Add(cr); ////} }
public static void AppendCollider(IProductData product) { if (product.ProductGeoData.Equals(MyBimProduct.Default) || product.ProductGeoData.shapeInstances.Count == 0) { return; } var mc = product.ThisGameObject.AddComponent <MeshCollider>(); CombineInstance[] combimes = new CombineInstance[product.ProductGeoData.shapeInstances.Count]; var mesh = new Mesh(); var thisTransform = product.ThisGameObject.transform; int j = 0; for (int i = 0; i < thisTransform.childCount; i++) { if (thisTransform.GetChild(i).GetComponent <MeshRenderer>() != null) { combimes[j].mesh = thisTransform.GetChild(i).GetComponent <MeshFilter>().mesh; combimes[j].transform = thisTransform.GetChild(i).localToWorldMatrix; j++; } } mesh.CombineMeshes(combimes); mesh.name = product.Name; mc.sharedMesh = mesh; if (product is IElementData) { IElementData ele = product as IElementData; if (ele.HasOpening == false) { mc.convex = true; } } }
public AgentConnection(IElementData data) { _data = data; _port = Convert.ToInt32(_data.Properties.GetProperty("Port").GetDoubleValue(data.ExecutionContext)); _requestSocket = new RequestSocket(); }
/// <summary> /// Method called to add a new instance of this element type to a model. /// Returns an instance of the class implementing the IElement interface. /// </summary> public IElement CreateElement(IElementData data) { return(new AgentConnection(data)); }
/// <summary> /// Method called to add a new instance of this element type to a model. /// Returns an instance of the class implementing the IElement interface. /// </summary> public IElement CreateElement(IElementData data) { return(new CalculationElement(data)); }
public void LogIt(IElementData data, string msg) { data.ExecutionContext.ExecutionInformation.ReportError($"Err={msg}"); }
public CalculationSample2Element(IElementData data) { _data = data; }
/// <summary> /// Method called to add a new instance of this element type to a model. /// Returns an instance of the class implementing the IElement interface. /// </summary> public IElement CreateElement(IElementData data) { return(new UserElement(data)); }
/// <summary> /// Method called to add a new instance of this element type to a model. /// Returns an instance of the class implementing the IElement interface. /// </summary> public IElement CreateElement(IElementData data) { return(new ExcelConnectElementEPPlus(data)); }
public ArtaElement(IElementData data) { _data = data; }
public Option <Option <IElementView> > get(IElementData key) => _items.get(key);
/// <summary> /// Method called to add a new instance of this element type to a model. /// Returns an instance of the class implementing the IElement interface. /// </summary> public IElement CreateElement(IElementData data) { return(new SimioTableElement(data)); }
public UserElement(IElementData data) { _data = data; }
/// <summary> /// Method called to add a new instance of this element type to a model. /// Returns an instance of the class implementing the IElement interface. /// </summary> public IElement CreateElement(IElementData data) { return(new MqttSubscriberElement(data)); }
/// <summary> /// Method called to add a new instance of this element type to a model. /// Returns an instance of the class implementing the IElement interface. /// Called as the Simulation Run begins. /// </summary> public IElement CreateElement(IElementData data) { return(new MqttSubscribeConnector(data)); }
/// <summary> /// Method called to add a new instance of this element type to a model. /// Returns an instance of the class implementing the IElement interface. /// </summary> public IElement CreateElement(IElementData data) { return(new SerializarElement()); }
public IElement CreateElement(IElementData data) { return(new ArtaElement(data)); }
/// <summary> /// Method called to add a new instance of this element type to a model. /// Returns an instance of the class implementing the IElement interface. /// Called as the Simulation Run begins. /// </summary> public IElement CreateElement(IElementData data) { return(new MqttPublishConnector(data)); }