private object GetModel(string name, ModelProperties properties) { ModelInterface model = Plugins.Instance.GetModel(name); PropertyTable propertyTable = new PropertyTable(model); Starter starter = Factory.Starter.DesignStarter(); starter.Run(model); starter.Wait(); propertyTable.UpdateAfterInitialize(); if (properties != null) { model.OnProperties(properties); propertyTable.UpdateAfterProjectFile(); string[] keys = properties.GetModelKeys(); for (int i = 0; i < keys.Length; i++) { ModelProperties nestedProperties = properties.GetModel(keys[i]); if (nestedProperties.ModelType == ModelType.Indicator) { Add(nestedProperties); } } } else { LoadIndicators(model); } return(propertyTable); }
protected override void Context() { _objectBaseFactory = A.Fake <IObjectBaseFactory>(); _simulationBuildingBlockUpdater = A.Fake <ISimulationBuildingBlockUpdater>(); _simulationModelCreator = A.Fake <ISimulationModelCreator>(); _simulationParametersUpdater = A.Fake <ISimulationParametersUpdater>(); _modelPropertiesTask = A.Fake <IModelPropertiesTask>(); _cloner = A.Fake <ICloner>(); _diagramModelFactory = A.Fake <IDiagramModelFactory>(); _interactionTask = A.Fake <IInteractionTask>(); _individual = A.Fake <Individual>(); _compounds = new List <Compound>(); A.CallTo(() => _individual.BuildingBlockType).Returns(PKSimBuildingBlockType.Individual); _population = A.Fake <Population>(); A.CallTo(() => _population.BuildingBlockType).Returns(PKSimBuildingBlockType.Population); _originData = new OriginData(); _modelProperties = A.Fake <ModelProperties>(); _individualSimulation = A.Fake <IndividualSimulation>(); _populationSimulation = A.Fake <PopulationSimulation>(); _objectIdResetter = A.Fake <IObjectIdResetter>(); _compoundPropertiesUpdater = A.Fake <ICompoundPropertiesUpdater>(); A.CallTo(() => _objectBaseFactory.Create <IndividualSimulation>()).Returns(_individualSimulation); A.CallTo(() => _objectBaseFactory.Create <PopulationSimulation>()).Returns(_populationSimulation); _individual.OriginData = _originData; A.CallTo(() => _individual.Organism).Returns(A.Fake <Organism>()); sut = new SimulationFactory(_objectBaseFactory, _simulationBuildingBlockUpdater, _simulationModelCreator, _objectIdResetter, _compoundPropertiesUpdater, _simulationParametersUpdater, _modelPropertiesTask, _cloner, _diagramModelFactory, _interactionTask); }
private PortfolioNode ReloadPortfolio(ModelProperties properties) { PortfolioNode portfolio = new PortfolioNode(properties.Type, properties); portfolio.Name = properties.Name; string[] keys = properties.GetModelKeys(); for (int i = 0; i < keys.Length; i++) { ModelProperties modelProperties = properties.GetModel(keys[i]); if (modelProperties.ModelType == ModelType.Indicator) { } else { // type null for performance, positionsize, exitstrategy, etc. if (modelProperties.Type == null) { // HandlePropertySet( model, modelProperties); } else { PortfolioNode node = ReloadPortfolio(modelProperties); portfolio.Nodes.Add(node); } } } return(portfolio); }
protected override void Context() { base.Context(); _c1 = new CalculationMethod { Name = "C1", Category = "C" }; _c1.AddSpecies(_originData.Species.Name); _c2 = new CalculationMethod { Name = "C2", Category = "C" }; _c2.AddSpecies(_originData.Species.Name); var modelConfiguration = new ModelConfiguration(); modelConfiguration.ModelName = "Model"; modelConfiguration.SpeciesName = "Species"; var category = new CalculationMethodCategory { Name = "C" }; category.Add(_c1); category.Add(_c2); modelConfiguration.AddCalculationMethodCategory(category); _oldModelProperties = new ModelProperties { ModelConfiguration = modelConfiguration }; _newModelProperties = new ModelProperties { ModelConfiguration = modelConfiguration }; _oldModelProperties.AddCalculationMethod(_c1); _newModelProperties.AddCalculationMethod(_c2); }
/// <summary> /// Validates the Ampla Field Mapping. /// </summary> /// <returns></returns> public IList <string> ValidateMapping(TModel model) { List <string> messages = new List <string>(); IAmplaViewProperties <TModel> viewProperties = GetViewProperties(model); messages.AddRange(viewProperties.ValidateViewPermissions()); IEnumerable <FieldMapping> fieldMappings = viewProperties.GetFieldMappings(); List <string> missingFields = new List <string>(modelProperties.GetProperties()); foreach (FieldMapping fieldMapping in fieldMappings) { string field = fieldMapping.Name; string message; if (!ModelProperties.CanMapField(fieldMapping, out message)) { messages.Add(message ?? "Error message"); } if (missingFields.Contains(field)) { missingFields.Remove(field); } } if (missingFields.Count > 0) { messages.AddRange(missingFields.Select(modelField => string.Format("The property '{0}' is not mapped to an Ampla Field.", modelField))); } return(messages); }
/// Constructor for the BasicModel being created. (Quick Load) /// </summary> /// <param name="TextureType">Flag for the Texture, if at any point in time it will be alpha make it so.</param> /// <param name="strAssetLocation">Asset Location of our Model.</param> /// <param name="v3StartingPos">Location in 3D space where the model will start in.</param> public BasicModel(ContentManager Content, ModelProperties TextureType, String strAssetLocation, Vector3 v3StartingPos) { this._Properties = TextureType; if (_ID == Engine.NULLED_INT) { switch (_Properties) { case ModelProperties.Alpha: this._ID = mModel.Peek.CreateMessageIDAlpha(); PrepareModel(Content, mModel.Peek.AlphaContainer, this, strAssetLocation, v3StartingPos); HelpCreateBoundingBox(mModel.Peek.AlphaContainer, this); HelpPrepareMasterEffect(mModel.Peek.AlphaContainer, this); break; case ModelProperties.Opaque: this._ID = mModel.Peek.CreateMessageIDOpaque(); PrepareModel(Content, mModel.Peek.OpaqueContainer, this, strAssetLocation, v3StartingPos); HelpCreateBoundingBox(mModel.Peek.OpaqueContainer, this); HelpPrepareMasterEffect(mModel.Peek.OpaqueContainer, this); break; case ModelProperties.Full3D: this._ID = mModel.Peek.CreateMessageIDOpaque(); PrepareModel(Content, mModel.Peek.OpaqueContainer, this, strAssetLocation, v3StartingPos); HelpCreateBoundingBox(mModel.Peek.OpaqueContainer, this); break; case ModelProperties.Vegetation: this._ID = mModel.Peek.CreateMessageIDOpaque(); PrepareModel(Content, mModel.Peek.OpaqueContainer, this, strAssetLocation, v3StartingPos); Dictionary<string, object> tagData = (Dictionary<string, object>)mModel.Peek.OpaqueContainer[this._ID].Model.Tag; mModel.Peek.OpaqueContainer[this._ID].PureBoundingBox = (BoundingBox)tagData["BoundingBox"]; mModel.Peek.OpaqueContainer[this._ID].BoundingBox = mModel.Peek.OpaqueContainer[this._ID].PureBoundingBox; break; } } }
public Struct(string name, ModelProperties modelProperties, string parentHash) { Name = name; ParentHash = parentHash; ModelProperties = modelProperties; Properties = new List <Property>(); }
private void applyModelProperties(ModelProperties properties, GameObject gameObject) { Debug.Log(JsonUtility.ToJson(properties.Orientation)); gameObject.transform.localPosition = new Vector3(properties.Position[0], properties.Position[1], properties.Position[2]); gameObject.transform.eulerAngles = new Vector3(properties.Orientation[0], properties.Orientation[1], properties.Orientation[2]); gameObject.transform.localScale = new Vector3(properties.Scale[0], properties.Scale[1], properties.Scale[2]); }
protected override void Context() { _view = A.Fake <ISimulationModelSelectionView>(); _categoryCalculationMethodDTOMapper = A.Fake <ICalculationMethodToCategoryCalculationMethodDTOMapper>(); _modelPropertiesTask = A.Fake <IModelPropertiesTask>(); _modelConfigurationRepository = A.Fake <IModelConfigurationRepository>(); _modelPropertiesMapper = A.Fake <IModelConfigurationDTOToModelPropertiesMapper>(); _representationInfoRepository = A.Fake <IRepresentationInfoRepository>(); _simulation = A.Fake <Simulation>(); _species = A.Fake <Species>(); _individual = A.Fake <Individual>(); _modelProperties = A.Fake <ModelProperties>(); _modelConfiguration = A.Fake <ModelConfiguration>(); _modelConfiguration.ModelName = "4Comp"; _originData = new OriginData(); _modelProperties.ModelConfiguration = _modelConfiguration; _simulation.ModelProperties = _modelProperties; _simulation.ModelConfiguration = _modelConfiguration; A.CallTo(() => _simulation.BuildingBlock <ISimulationSubject>()).Returns(_individual); _individual.OriginData = _originData; _originData.Species = _species; A.CallTo(() => _modelPropertiesTask.Update(A <ModelProperties> ._, A <ModelProperties> ._, _originData)).Returns(_modelProperties); sut = new SimulationModelSelectionPresenter(_view, _modelConfigurationRepository, _modelPropertiesTask, _modelPropertiesMapper, _representationInfoRepository, _categoryCalculationMethodDTOMapper); }
private Matrix GetMarkerTransform(ModelProperties model, string markerName) { var marker = model.MarkerGroups.FirstOrDefault(g => g.Name == markerName)?.Markers.FirstOrDefault(); if (marker == null) { return(Matrix.Identity); } var transfoms = new List <Matrix>(); if (marker.NodeIndex != byte.MaxValue) { int parentIndex = marker.NodeIndex; while (parentIndex >= 0) { var node = model.Nodes[parentIndex]; var t = Matrix.RotationQuaternion(node.Rotation.ToQuaternion()); t.TranslationVector = node.Position.ToVector3(); transfoms.Insert(0, t); parentIndex = node.ParentIndex; } } var mat = Matrix.RotationQuaternion(marker.Rotation.ToQuaternion()); mat.TranslationVector = marker.Position.ToVector3(); transfoms.Add(mat); return(transfoms.Aggregate((m1, m2) => m1 * m2)); }
public void Add(ModelProperties properties) { PortfolioNode node = new PortfolioNode(properties.Type, properties); node.Name = properties.Name; Nodes.Add(node); }
public static void OnProperties(this object obj, ModelProperties properties) { string[] propertyKeys = properties.GetPropertyKeys(); for (int i = 0; i < propertyKeys.Length; i++) { obj.HandleProperty(propertyKeys[i], properties.GetProperty(propertyKeys[i]).Value); } }
private static HB.ModelProperties LoadFromUserLibraryFolder(bool loadEnergy, string userLibFolder = default) { var python = Path.Combine(PythonFolder, "python"); var userPath = Directory.Exists(userLibFolder) ? $"-s \"{userLibFolder}\"" : string.Empty; var prop = new ModelProperties(); var module = loadEnergy? "honeybee_energy": "honeybee_radiance"; // load property var cmd = $"-m {module} lib to-model-properties {userPath}"; var json = ExecuteCMD(cmd); if (!string.IsNullOrEmpty(json)) { if (loadEnergy) { prop.Energy = HB.ModelEnergyProperties.FromJson(json); } else { prop.Radiance = HB.ModelRadianceProperties.FromJson(json); } } return(prop); string ExecuteCMD(string command) { using (var p = new System.Diagnostics.Process()) { p.StartInfo.FileName = python; p.StartInfo.Arguments = command; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; p.Start(); var outputs = p.StandardOutput.ReadToEnd(); var errs = p.StandardError.ReadToEnd(); p.WaitForExit(); if (!string.IsNullOrEmpty(errs)) { throw new ArgumentException($"Failed to load user library: {errs}"); } if (outputs.StartsWith("{") && outputs.EndsWith("}")) { return(outputs); } var s = outputs.IndexOf('{'); var e = outputs.LastIndexOf('}'); outputs = outputs.Substring(s, e - s + 1); return(outputs); } } }
public IEnumerable <PKSimTransport> AllFor(ModelProperties modelProperties) { Start(); return(from passiveTransport in All() where _modelProcessRepo.Contains(modelProperties.ModelConfiguration.ModelName, passiveTransport.Name) where modelProperties.ContainsCalculationMethod(passiveTransport.CalculationMethod) select passiveTransport); }
public Dialog_ProgramTypeManager(ref ModelProperties libSource, bool returnSelectedOnly = false) : this() { libSource.FillNulls(); this._returnSelectedOnly = returnSelectedOnly; this._vm = new ProgramTypeManagerViewModel(libSource, this); Content = Init(out var gd); this._vm.GridControl = gd; }
public IEnumerable <IPKSimObserverBuilder> AllFor(ModelProperties modelProperties) { Start(); return(from pkSimObserverBuilder in All() where _modelObserversRepository.Contains(modelProperties.ModelConfiguration.ModelName, pkSimObserverBuilder.ObserverBuilder.Name) where modelProperties.ContainsCalculationMethod(pkSimObserverBuilder.CalculationMethod) select pkSimObserverBuilder); }
public void CanMapFieldDouble() { ModelFieldMapping fieldMapping = new ModelFieldMapping("Value", typeof(double)); ModelProperties <Model> modelProperties = new ModelProperties <Model>(); string message; Assert.That(fieldMapping.CanMapField(modelProperties, out message), Is.False); Assert.That(message, Is.StringContaining("'Value'").And.StringContaining("Int32").And.StringContaining("Double")); }
public void CanMapFieldDoubleValue() { ModelFieldMapping fieldMapping = new ModelFieldMapping("DoubleValue", typeof(double)); ModelProperties <Model> modelProperties = new ModelProperties <Model>(); string message; Assert.That(fieldMapping.CanMapField(modelProperties, out message), Is.True); Assert.That(message, Is.Null.Or.Empty); }
public void should_update_calculation_methods_with_2pores_calcmethods() { ModelProperties modelProperties2Pores = sut.DefaultFor(_originData, CoreConstants.Model.TwoPores); foreach (var calcMethod in modelProperties2Pores.AllCalculationMethods()) { _updatedProperties.ContainsCalculationMethod(calcMethod.Name).ShouldBeTrue(); } }
private void button1_Click(object sender, EventArgs e) { try { SCAPI.Application app = new SCAPI.Application(); SCAPI.PersistenceUnits units = app.PersistenceUnits; Sessions sessions = app.Sessions; Session session = sessions.Add(); foreach (PersistenceUnit unit in units) { MessageBox.Show(unit.Name); session.Open(unit, null, null); } ModelObjects models = session.ModelObjects; MessageBox.Show("갯수 " + models.Count); foreach (ModelObject model in models) { if (model.ClassName == "Entity" && !string.IsNullOrEmpty(model.Name)) { ModelProperties properties = model.Properties; foreach (ModelProperty property in properties) { //MessageBox.Show(property.ClassName + "," + property.FormatAsString()); object trid = session.BeginTransaction(); if (property.ClassName == "Name") { property.set_Value(null, null, "TEST"); //PropertyValue value = new PropertyValue(); //property.FormatAsString() } //MessageBox.Show(model.Name + "," + property.ClassName + "," + property.PropertyValues.ToString()); session.CommitTransaction(trid); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void editModelProperties(ModelProperties newModelProperties) { var modelProperties = _modelPropertiesTask.Update(ModelProperties, newModelProperties, _originData); _modelConfigurationDTO = new ModelConfigurationDTO { ModelConfiguration = modelProperties.ModelConfiguration }; _view.BindTo(_modelConfigurationDTO); updateModelProperties(modelProperties); }
public void CanMapField() { RequiredFieldMapping <string> fieldMapping = new RequiredFieldMapping <string>("Field", () => "Default"); ModelProperties <Model> modelProperties = new ModelProperties <Model>(); string message; Assert.That(fieldMapping.CanMapField(modelProperties, out message), Is.True); Assert.That(message, Is.Null.Or.Empty); }
public Class(Modifiers modifier, string name, ModelProperties modelProperties, string parentHash) { Modifier = modifier; Name = name; ParentHash = parentHash; ModelProperties = modelProperties; Fields = new List <Field>(); Constructors = new List <Constructor>(); Methods = new List <Method>(); }
public void Test_CreateModel() { var bbox = new BoundingBox(new Point3d(0, 0, 0), new Point3d(10, 10, 3)); var box = new Box(bbox).ToBrep(); var hbFaces = box.Faces.Select(_ => _.ToHBFace(maxRoofFloorAngle: 30)).ToList(); var room = new Room($"Room_{Guid.NewGuid()}", hbFaces, new RoomPropertiesAbridged(energy: new RoomEnergyPropertiesAbridged())); var modelProp = new ModelProperties(energy: ModelEnergyProperties.Default); //var stone = new EnergyMaterial( // name: "Thick Stone", // thickness: 0.3, // conductivity: 2.31, // density: 2322, // specificHeat: 832, // roughness: EnergyMaterial.RoughnessEnum.Rough, // thermalAbsorptance: 0.95, // solarAbsorptance: 0.75, // visibleAbsorptance: 0.8 // ); //modelProp.Energy.Materials.Add(stone); //var thermalMassConstr = new OpaqueConstructionAbridged("Thermal Mass Floor", new List<string>() { stone.Name }); //modelProp.Energy.Constructions.Add(thermalMassConstr); //var faceEnergyProp = new FaceEnergyPropertiesAbridged(); //faceEnergyProp.Construction = thermalMassConstr.Name; //room.Faces[0].Properties.Energy = faceEnergyProp; var model = new Model( "modelName", modelProp, "a new displace name" ); model.Rooms = new List <HoneybeeSchema.Room>(); model.Rooms.Add(room); var json = model.ToJson(); var modelPath = @"D:\Dev\test\HB\model.json"; File.WriteAllText(modelPath, json); //var studyFolder = @"D:\Dev\test\HB"; //var simuParPath = @"D:\Dev\test\HB\simPar.json"; //Runner.RunOpenStudio(studyFolder, modelPath, simuParPath); //TestContext.WriteLine(room.ToJson()); Assert.AreEqual(room.Faces.Count, 6); }
protected override void Context() { _originData = new OriginData(); _originData.Species = new Species(); _originData.Species.Name = CoreConstants.Species.Human; sut = IoC.Resolve <IModelPropertiesTask>(); _modelProperties_4Comp = sut.DefaultFor(_originData, CoreConstants.Model.FourComp); _modelProperties_2Pores = sut.DefaultFor(_originData, CoreConstants.Model.TwoPores); }
private void moveMoleculeCalculationMethod(ModelProperties modelProperties, CompoundProperties compoundProperties, string category) { var cm = modelProperties.CalculationMethodFor(category); if (cm == null) { return; } modelProperties.RemoveCalculationMethod(cm); compoundProperties.AddCalculationMethod(cm); }
protected override void Context() { _originData = new OriginData(); _originData.Species = new Species(); _originData.Species.Name = CoreConstants.Species.HUMAN; sut = IoC.Resolve <IModelPropertiesTask>(); _modelProperties_4Comp = sut.DefaultFor(_originData, CoreConstants.Model.FOUR_COMP); _modelProperties_2Pores = sut.DefaultFor(_originData, CoreConstants.Model.TWO_PORES); }
public void MergeWith(ModelProperties other) { if (other == null) { return; } this.Energy = this.Energy ?? new ModelEnergyProperties(); this.Radiance = this.Radiance ?? new ModelRadianceProperties(); this.Energy.MergeWith(other.Energy); this.Radiance.MergeWith(other.Radiance); }
public async Task GetModelProperties() { using (MockContext.Start(this.GetType())) { HttpMockServer.Initialize(this.GetType(), "GetModelProperties"); IPersonalizerClient client = GetClient(HttpMockServer.CreateInstance()); ModelProperties modelProperties = await client.Model.GetPropertiesAsync(); Assert.True(modelProperties.CreationTime != null); Assert.True(modelProperties.LastModifiedTime != null); } }
public ITreeNode CreateFor(ModelProperties modelProperties) { if (modelProperties == null || modelProperties.ModelConfiguration == null) { return(null); } var node = CreateFor(nodeText: modelProperties.ModelConfiguration.ModelName); node.ToolTip = _toolTipPartCreator.ToolTipFor(modelProperties); return(node); }
private void setupTransportMoleculeNames(PKSimTransport transport, ModelProperties modelProperties, IReadOnlyList <string> compoundNames) { string modelName = modelProperties.ModelConfiguration.ModelName; string transportName = transport.Name; var moleculeNames = _modelPassiveTransportMoleculeNameRepo.MoleculeNamesFor(modelName, transportName, compoundNames); if (moleculeNames == null) { return; //no special molecule settings for this transport } transport.MoleculeList.Update(moleculeNames); }
//A lot of this is experimental code. Will be able to test //it on the next merge and clean it up afterwards. Needs some cleaning up, will //go into different classes. public BasicModel[] XmlReaderLoadLevel(string level) { string newLevel = level; XmlTextReader xmlReader; this.StaticItems.Clear(); xmlReader = new XmlTextReader(newLevel); while (xmlReader.Read()) { switch (xmlReader.NodeType) { case XmlNodeType.Element: { String asset = xmlReader.Name; switch (xmlReader.Name) { case "doodad": { /* Example: <doodad position ="0 0 0" rotation="0 0 0" scalar="1" diffuseEnabled="true" locationModel="Models\" locationTexture="Textures\" modelProps="Opaque" tileVec="1 1" flipVec="1 1" /> */ pos = xmlReader.GetAttribute("position"); rot = xmlReader.GetAttribute("rotation"); scal = xmlReader.GetAttribute("scalar"); strLocModel = xmlReader.GetAttribute("locationModel"); strLocTexture = xmlReader.GetAttribute("locationTexture"); props = xmlReader.GetAttribute("modelProps"); tile = xmlReader.GetAttribute("tileVec"); flip = xmlReader.GetAttribute("flipVec"); diffEn = xmlReader.GetAttribute("diffuseEnabled"); position = ReadFloat3(pos); rotation = ReadFloat3(rot); scalar = ReadFloat(scal); properties = (ModelProperties)Enum.Parse(typeof(ModelProperties), props); tileAmount = ReadFloat2(tile); flipVec = ReadFloat2(flip); a = new BasicModel(Engine.GameContainer, properties, strLocModel, position); a.Link.Texture = Engine.GameContainer.Load<Texture2D>(strLocTexture); a.Link.DiffuseEnabled = Convert.ToBoolean(diffEn); if (a.Link.DiffuseEnabled) { a.Link.DiffuseIntensity = 0.8f; a.Link.AmbientIntensity = 0.4f; a.Link.AmbientColor = Color.White.ToVector4(); } a.Link.TileAmount = tileAmount; a.Link.RotationMatrix *= Matrix.CreateRotationX(rotation.X); a.Link.RotationMatrix *= Matrix.CreateRotationY(rotation.Y); a.Link.RotationMatrix *= Matrix.CreateRotationZ(rotation.Z); a.Link.ScalerMatrix *= Matrix.CreateScale(scalar); StaticItems.Add(a); break; } case "enemy": { ET = xmlReader.GetAttribute("EnemyType"); pos = xmlReader.GetAttribute("position"); EnemyType = (Enemy.EnemyType)Enum.Parse(typeof(Enemy.EnemyType), ET); position = ReadFloat3(pos); mAI.Peek.SpawnEnemy(EnemyType, position); break; } } break; } } } return StaticItems.ToArray(); }