private void AddComponents(IDesign d, params string[] compNames) { foreach (var cn in compNames) { d.AddComponent(Mod.Current.ComponentTemplates.FindByName(cn)); } }
public override void ReportResourceKeys(IDesign design, List <string> KeyList) { foreach (ILayoutElement Item in Items) { Item.ReportResourceKeys(design, KeyList); } }
/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(IModelElement item) { IDesignLocation designLocationsCasted = item.As <IDesignLocation>(); if ((designLocationsCasted != null)) { this._parent.DesignLocations.Add(designLocationsCasted); } IDesignLocationCU designLocationCUsCasted = item.As <IDesignLocationCU>(); if ((designLocationCUsCasted != null)) { this._parent.DesignLocationCUs.Add(designLocationCUsCasted); } IDesign designsCasted = item.As <IDesign>(); if ((designsCasted != null)) { this._parent.Designs.Add(designsCasted); } if ((this._parent.Status == null)) { IStatus statusCasted = item.As <IStatus>(); if ((statusCasted != null)) { this._parent.Status = statusCasted; return; } } }
/// <summary> /// Removes the given item from the collection /// </summary> /// <returns>True, if the item was removed, otherwise False</returns> /// <param name="item">The item that should be removed</param> public override bool Remove(IModelElement item) { IDesignLocation designLocationItem = item.As <IDesignLocation>(); if (((designLocationItem != null) && this._parent.DesignLocations.Remove(designLocationItem))) { return(true); } IDesignLocationCU designLocationCUItem = item.As <IDesignLocationCU>(); if (((designLocationCUItem != null) && this._parent.DesignLocationCUs.Remove(designLocationCUItem))) { return(true); } IDesign designItem = item.As <IDesign>(); if (((designItem != null) && this._parent.Designs.Remove(designItem))) { return(true); } if ((this._parent.Status == item)) { this._parent.Status = null; return(true); } return(false); }
public PlotV3(IPythonProcess pythonProcess, IDesign <T, Q> design, IGeneralComposer <T, Q> composer) { Design1 = design; Process = pythonProcess; PairSource = new List <XyPair <T, Q> >(); Composer = composer; }
private IDesign CopyDesign(IDesign old) { var copy = old.CopyAndAssignNewID(); copy.TurnNumber = Galaxy.Current.TurnNumber; copy.Owner = Empire.Current; copy.Iteration++; copy.VehiclesBuilt = 0; copy.IsObsolete = false; // use real component templates and mounts from mod, not copies! copy.Components.Clear(); foreach (var mct in old.Components) { // reuse templates so components appear "condensed" on vehicle designer var same = copy.Components.FirstOrDefault(x => x.ComponentTemplate == mct.ComponentTemplate && x.Mount == mct.Mount); if (same == null) { copy.Components.Add(new MountedComponentTemplate(copy, mct.ComponentTemplate, mct.Mount)); } else { copy.Components.Add(same); } } return(copy); }
void IBLL.IPrint.Print(DataTable dtMain, DataTable dtDetail, string sheetType) { try { tbmain = dtMain; tbdetail = dtDetail; this.sheetType = sheetType; // string file = path + "\\print_style\\" + sheetType + ".xml"; if (System.IO.File.Exists(file) == true) { string xml = System.IO.File.ReadAllText(path + "\\print_style\\" + sheetType + ".xml", Encoding.GetEncoding("gb2312")); IDesign des = this; des.xml = xml; } else { pnl.Width = (int)(21 * Conv.getAnCMInterval()); pnl.Height = (int)(29.7 * Conv.getAnCMInterval()); } if (1 == 1) { IDesign des = this; operRecord = new OperRecord(des.xml); } // this.ShowDialog(); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }
public GeneratorDesign(IDesign design) { FileNames = design.FileNames; XamlName = design.XamlName; Root = design.Root; GeneratorDesignMap.Add(design, this); }
public static IHull <T> CreateHull <T>(this IDesign <T> design, string name = null) where T : IVehicle { var hull = CreateHull <T>(name ?? design.BaseName); design.Hull = hull; return(hull); }
public SokobanController(IGame game, IView view, IDesign design, IFiler filer, IFileManager fm) { Game = game; View = view; Designer = design; Filer = filer; FM = fm; }
/// <summary> /// Constructs a mask using all spatial filtering elements active in the supplied filter /// </summary> public static bool ConstructSubGridCellFilterMask(ISiteModel siteModel, SubGridCellAddress currentSubGridOrigin, InterceptList intercepts, int fromProfileCellIndex, SubGridTreeBitmapSubGridBits mask, ICellSpatialFilter cellFilter, IDesign surfaceDesignMaskDesign) { ConstructSubGridSpatialAndPositionalMask(currentSubGridOrigin, intercepts, fromProfileCellIndex, mask, cellFilter, siteModel.Grid); // If the filter contains an alignment design mask filter then compute this and AND it with the // mask calculated in the step above to derive the final required filter mask if (cellFilter.HasAlignmentDesignMask()) { if (cellFilter.AlignmentFence.IsNull()) // Should have been done in ASNode but if not { throw new ArgumentException($"Spatial filter does not contained pre-prepared alignment fence for design {cellFilter.AlignmentDesignMaskDesignUID}"); } var tree = siteModel.Grid; // Go over set bits and determine if they are in Design fence boundary mask.ForEachSetBit((x, y) => { tree.GetCellCenterPosition(currentSubGridOrigin.X + x, currentSubGridOrigin.Y + y, out var cx, out var cy); if (!cellFilter.AlignmentFence.IncludesPoint(cx, cy)) { mask.ClearBit(x, y); // remove interest as its not in design boundary } }); } // If the filter contains a design mask filter then compute this and AND it with the // mask calculated in the step above to derive the final required filter mask if (surfaceDesignMaskDesign != null) { var getFilterMaskResult = surfaceDesignMaskDesign.GetFilterMaskViaLocalCompute(siteModel, currentSubGridOrigin, siteModel.CellSize); if (getFilterMaskResult.errorCode == DesignProfilerRequestResult.OK || getFilterMaskResult.errorCode == DesignProfilerRequestResult.NoElevationsInRequestedPatch) { if (getFilterMaskResult.filterMask == null) { _log.LogWarning("FilterMask null in response from surfaceDesignMaskDesign.GetFilterMask, ignoring it's contribution to filter mask"); } else { mask.AndWith(getFilterMaskResult.filterMask); } } else { _log.LogError($"Call (A2) to {nameof(ConstructSubGridCellFilterMask)} returned error result {getFilterMaskResult.errorCode} for {cellFilter.SurfaceDesignMaskDesignUid}"); return(false); } } return(true); }
/// <summary> /// Get all the designs of the specified user. /// </summary> /// <param name="userId">Internal identifier of the user.</param> /// <returns>All the designs of the specified user.</returns> public List <DesignInfo> GetListAll(int userId) { // Get an instance of the Design DAO using the DALFactory IDesign dao = (IDesign)DALFactory.DAO.Create(DALFactory.Module.Design); List <DesignInfo> designs = dao.GetListAll(userId); return(designs); }
/// <summary> /// Gets the summary of designs. /// </summary> /// <returns>Summary of designs.</returns> public DataTable GetSummary() { // Get an instance of the Design DAO using the DALFactory IDesign dao = (IDesign)DALFactory.DAO.Create(DALFactory.Module.Design); DataTable summary = dao.GetSummary(); return(summary); }
/// <summary> /// Gets the design details of the specified design. /// </summary> /// <param name="designId">Internal identifier of the design.</param> /// <returns>Design details of the specified design.</returns> public DesignInfo Get(int designId) { // Get an instance of the Design DAO using the DALFactory IDesign dao = (IDesign)DALFactory.DAO.Create(DALFactory.Module.Design); DesignInfo design = dao.Get(designId); return(design); }
public override void ReportResourceKeys(IDesign design, List <string> KeyList, string styleName) { string Key = FormatStyleResourceKey(design.XamlName, styleName); if (!KeyList.Contains(Key)) { KeyList.Add(Key); } }
public override void ReportResourceKeys(IDesign design, List <string> KeyList) { string Key = ComponentText.FormatStyleResourceKey(design.XamlName, Style); if (!KeyList.Contains(Key)) { KeyList.Add(Key); } }
public VehicleDesignForm(IDesign design) { InitializeComponent(); ShowComponentDetails(null); Design = design; try { this.Icon = new Icon(FrEee.WinForms.Properties.Resources.FrEeeIcon); } catch { } }
private void Evaluation(Individual[] individuals) { for (int i = 0; i < swarmSize; i++) { IDesign design = designFactory.CreateDesign(individuals[i].Position); double fitness = design.ObjectiveValues[0]; individuals[i].ObjectiveValue = fitness; } CurrentFunctionEvaluations += swarmSize; }
public async Task <bool> DesignExists(IDesign design) { string query = @"SELECT * FROM Design WHERE TRIM(LOWER(Design_Title)) LIKE TRIM(LOWER(@Design_Title))"; var param = new { design.Design_Title }; return(await _dataBaseManager.Find <Design>(query, param) != null); }
//private readonly IConstraintFunction[] inequalityConstraints; //public DeathPenalty(IConstraintFunction[] inequalityConstraints) //{ // this.inequalityConstraints = inequalityConstraints; //} public double Evaluate(double fitness, IDesign design) { foreach (var constraintValue in design.ConstraintValues) { if (constraintValue > 0) { return(double.MaxValue); } } return(fitness); }
private void Initialise() { if (CellFilter != null && CellFilter.SurfaceDesignMaskDesignUid != Guid.Empty) { SurfaceDesignMaskDesign = SiteModel.Designs.Locate(CellFilter.SurfaceDesignMaskDesignUid); if (SurfaceDesignMaskDesign == null) { throw new ArgumentException($"Design {CellFilter.SurfaceDesignMaskDesignUid} not found in project {SiteModel.ID}"); } } }
/// <summary> /// Get the design statuses of the specified parameters. /// </summary> /// <param name="userId">Internal identifier of the user.</param> /// <param name="category">Category of the designs.</param> /// <param name="status">Status of the designs.</param> /// <returns>The design statuses of the specified parameters.</returns> public List <DesignStatusInfo> GetDesignStatuses(int userId, int category, int status) { // Get an instance of the Design DAO using the DALFactory IDesign dao = (IDesign)DALFactory.DAO.Create(DALFactory.Module.Design); List <DesignStatusInfo> designs = dao.GetDesignStatuses(userId, category, status); return(designs); }
protected virtual void Evaluation(Individual[] individuals) { for (int i = 0; i < populationSize; i++) { IDesign design = designFactory.CreateDesign(individuals[i].Position); double fitness = design.ObjectiveValues[0]; individuals[i].ObjectiveValue = penalty.Evaluate(fitness, design); } CurrentFunctionEvaluations += this.populationSize; }
public async Task <bool> ModifyDesign(IDesign modifiedDesign) { var param = new { modifiedDesign.UID, modifiedDesign.Date, modifiedDesign.Description, modifiedDesign.Design_Title, }; return(await _dataBaseManager.Modify("SP_UPDATE_Design", param)); }
public async Task <bool> AddDesign(IDesign design) { var param = new { design.UID, design.Date, design.Description, design.Design_Title, }; return(await _dataBaseManager.Add("SP_ADD_Design", param)); }
/// <summary> /// Deletes the specified design. /// </summary> /// <param name="designId">Internal identifier of the design to delete.</param> /// <param name="userId">Internal identifier of the user.</param> public void Delete(int designId, int userId) { // Get an instance of the Design DAO using the DALFactory IDesign dao = (IDesign)DALFactory.DAO.Create(DALFactory.Module.Design); try { dao.Delete(designId, userId); } catch { throw; } }
private void btnCopy_Click(object sender, EventArgs e) { if (lstDesigns.SelectedItems.Count == 1) { IDesign copy = CopyDesign((IDesign)lstDesigns.SelectedItems[0].Tag); var form = new VehicleDesignForm(); form.Design = copy; this.ShowChildForm(form); if (form.DialogResult == DialogResult.OK) { BindDesignList(); } } }
private void EvaluateCurrentIndividuals() { foreach (Individual <T> individual in population) { if (!individual.IsEvaluated) { double[] phenotype = encoding.ComputePhenotype(individual.Chromosome); IDesign design = designFactory.CreateDesign(phenotype); individual.Fitness = design.ObjectiveValues[0]; } } CurrentFunctionEvaluations += populationSize; UpdateBest(); }
public override void ReportResourceKeys(IDesign design, List <string> KeyList) { if (Type != null) { if (Type == "Button") { string Key = ComponentButton.FormatStyleResourceKey(design.XamlName, Style); if (!KeyList.Contains(Key)) { KeyList.Add(Key); } } } }
/// <summary> /// Updates the design of the specified user. /// </summary> /// <param name="userId">Internal identifier of the user.</param> /// <param name="design">Design of the user.</param> public void Update(int userId, DesignInfo design) { // Get an instance of the Design DAO using the DALFactory IDesign dao = (IDesign)DALFactory.DAO.Create(DALFactory.Module.Design); try { dao.Update(userId, design); } catch { throw; } }
public void Add(IDesign d) { _designs.Add(d); }