Пример #1
0
        /// <summary>
        /// Adds all factions in the current scenario to the "Owner" <see cref="ComboBox"/>.
        /// </summary>
        /// <remarks><para>
        /// <b>AddScenarioFactions</b> adds the <see cref="FactionClass.Id"/> strings of all <see
        /// cref="FactionClass"/> objects in the current scenario to the "Owner" combo box.
        /// </para><para>
        /// These identifiers are collected in three different locations:
        /// </para><list type="number"><item>
        /// All elements in the <see cref="FactionSection.Collection"/> of the current <see
        /// cref="FactionSection"/>.
        /// </item><item>
        /// Any <see cref="Area.Owner"/> identifiers of <see cref="Area"/> objects that were not
        /// encountered in step 1.
        /// </item><item>
        /// Any <see cref="Area.UnitOwner"/> identifiers of <b>Area</b> objects that were not
        /// encountered in steps 1 and 2.</item></list></remarks>

        private void AddScenarioFactions()
        {
            var items = OwnerCombo.Items;

            // add all scenario factions to combo box
            FactionSection factions = MasterSection.Instance.Factions;

            foreach (string id in factions.Collection.Keys)
            {
                items.Add(id);
            }

            // add any additional area owners
            AreaSection areas = MasterSection.Instance.Areas;

            foreach (Area area in areas.Collection)
            {
                string id = area.Owner;
                if (id.Length > 0 && !items.Contains(id))
                {
                    items.Add(id);
                }
            }

            // add any additional unit owners
            foreach (Area area in areas.Collection)
            {
                string id = area.UnitOwner;
                if (id.Length > 0 && id != area.Owner && !items.Contains(id))
                {
                    items.Add(id);
                }
            }
        }
        /// <summary>
        /// Sets the area section property layers.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="table">The table.</param>
        internal static void SetAREA_SECTION_PROPERTY_LAYERS(Model model, List <Dictionary <string, string> > table)
        {
            foreach (Dictionary <string, string> tableRow in table)
            {
                AreaSection area = model.Components.AreaSections[tableRow["Section"]];
                if (!(area is Shell areaShellLayered))
                {
                    continue;
                }

                areaShellLayered.Layers.Properties.Layers.Add(
                    new ShellLayerProperties
                {
                    LayerName                 = tableRow["LayerName"],
                    DistanceOffset            = Adaptor.toDouble(tableRow["Distance"]),
                    Thickness                 = Adaptor.toDouble(tableRow["Thickness"]),
                    LayerType                 = Enums.EnumLibrary.ConvertStringToEnumByDescription <eShellLayerType>(tableRow["Type"]),
                    NumberOfIntegrationPoints = Adaptor.toInteger(tableRow["NumIntPts"]),
                    MaterialName              = tableRow["Material"],
                    MaterialAngle             = Adaptor.toDouble(tableRow["MatAngle"]),
                    S11Type = Enums.EnumLibrary.ConvertStringToEnumByDescription <eMaterialComponentBehaviorType>(tableRow["S11Opt"]),
                    S22Type = Enums.EnumLibrary.ConvertStringToEnumByDescription <eMaterialComponentBehaviorType>(tableRow["S22Opt"]),
                    S12Type = Enums.EnumLibrary.ConvertStringToEnumByDescription <eMaterialComponentBehaviorType>(tableRow["S12Opt"])
                }
                    );
            }
        }
Пример #3
0
        /// <summary>
        /// Shows a <see cref="FileDialogs.SaveSectionDialog"/> allowing the user to enter or select
        /// an <see cref="AreaSection"/> file to save the current <see cref="WorldState"/> to.
        /// </summary>
        /// <param name="file">
        /// The file initially selected in the dialog.</param>
        /// <remarks><para>
        /// The specified <paramref name="file"/> may be a null reference or an empty string to
        /// indicate that no file should be initially selected. Otherwise, any directory prefix it
        /// contains overrides the specified <paramref name="file"/>. Files without an absolute path
        /// are interpreted as relative to the <see cref="ScenarioSection.Areas"/> section folder.
        /// </para><para>
        /// <b>SaveAreas</b> attempts to create a new <see cref="AreaSection"/> object from the <see
        /// cref="WorldState"/> of the current session, using the latter's <see
        /// cref="WorldState.CreateAreaSection"/> method, and then invokes <see
        /// cref="ScenarioElement.Save"/> on the new <see cref="AreaSection"/> object. If either
        /// operation fails, an error message is shown but no exception is thrown.</para></remarks>

        public static void SaveAreas(string file)
        {
            // abort if no world state to save
            if (Session.Instance == null)
            {
                return;
            }

            // let user select file path for Areas section
            RootedPath path = FilePaths.GetSectionFile(ScenarioSection.Areas, file);

            path = FileDialogs.SaveSectionDialog(ScenarioSection.Areas, path.AbsolutePath);
            if (path.IsEmpty)
            {
                return;
            }

            try {
                // create Areas section from world state
                AreaSection areas = Session.Instance.WorldState.CreateAreaSection(0, 0, 0, 0);
                areas.Save(path.AbsolutePath);
            }
            catch (Exception e) {
                string message = String.Format(ApplicationInfo.Culture,
                                               Global.Strings.DialogSectionSaveError, path.AbsolutePath);

                MessageDialog.Show(MainWindow.Instance, message,
                                   Global.Strings.TitleSectionError, e, MessageBoxButton.OK, Images.Error);
            }
        }
        /// <summary>
        /// Sets the area section property design parameters.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="table">The table.</param>
        internal static void SetAREA_SECTION_PROPERTY_DESIGN_PARAMETERS(Model model, List <Dictionary <string, string> > table)
        {
            foreach (Dictionary <string, string> tableRow in table)
            {
                AreaSection area = model.Components.AreaSections[tableRow["Section"]];
                if (!(area is ShellBase areaShell))
                {
                    continue;
                }

                areaShell.DesignProperties.Properties.MaterialName = tableRow["RebarMat"];
                areaShell.DesignProperties.Properties.RebarLayout  = Enums.EnumLibrary.ConvertStringToEnumByDescription <eShellSteelLayoutOption>(tableRow["RebarOpt"]);
                if (tableRow.ContainsKey("CoverTop1"))
                {
                    areaShell.DesignProperties.Properties.CoverTopDirection1    = Adaptor.toDouble(tableRow["CoverTop1"]);
                    areaShell.DesignProperties.Properties.CoverBottomDirection1 = Adaptor.toDouble(tableRow["CoverBot1"]);
                }

                if (!(tableRow.ContainsKey("CoverTop2")))
                {
                    continue;
                }
                areaShell.DesignProperties.Properties.CoverTopDirection2    = Adaptor.toDouble(tableRow["CoverTop2"]);
                areaShell.DesignProperties.Properties.CoverBottomDirection2 = Adaptor.toDouble(tableRow["CoverBot2"]);
            }
        }
Пример #5
0
 //TABLE:  "AREA SECTION PROPERTY - TIME DEPENDENT"
 //Section=ASEC1 TypeSize = Auto   AutoSFSize=1
 //Section=ASEC2 TypeSize = None   AutoSFSize=1
 //Section=ASEC3 TypeSize = User   AutoSFSize=1   UserValSize=1
 /// <summary>
 /// Sets the area section property time dependent.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="table">The table.</param>
 /// <exception cref="NotImplementedException"></exception>
 internal static void SetAREA_SECTION_PROPERTY_TIME_DEPENDENT(Model model, List <Dictionary <string, string> > table)
 {
     foreach (Dictionary <string, string> tableRow in table)
     {
         AreaSection area = model.Components.AreaSections[tableRow["Section"]];
         throw new NotImplementedException();
     }
 }
Пример #6
0
 // IChangeableSection
 /// <summary>
 /// Assigns the section property to a frame object.
 /// </summary>
 /// <param name="section">The section.</param>
 public void SetSection(AreaSection section)
 {
     if (section == null)
     {
         return;
     }
     Section = section;
     SetSection();
 }
 public void ChangeAreaSectionTo(AreaSection newAreaSection, IEnumerable <SurveyTemplateQuestion> details)
 {
     details.ToList().ForEach((item) =>
     {
         item.AreaSectionId = newAreaSection.Id;
         item.AreaSection   = newAreaSection;
         item.SetAsModified();
     });
     SetAsModified();
 }
        public bool AssignAreaSection(SurveyTemplateQuestion detail, AreaSection areaSection)
        {
            bool exists = Details.Any(e => e.AreaSectionId.Equals(areaSection.Id) && !e.IsDeletedState);

            //if (exists)
            //{
            //    return false;
            //}

            detail.AreaSectionId = areaSection.Id;
            detail.AreaSection   = areaSection;
            SetAsModified();

            return(!exists);
        }
        /// <summary>
        /// Sets the area section properties.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="table">The table.</param>
        internal static void SetAREA_SECTION_PROPERTIES(Model model, List <Dictionary <string, string> > table)
        {
            // TODO: Incomplete
            foreach (Dictionary <string, string> tableRow in table)
            {
                AreaSections.AreaSectionType = Enums.EnumLibrary.ConvertStringToEnumByDescription <eAreaSectionType>(tableRow["AreaType"]);
                AreaSection areaSection = model.Components.AreaSections.FillItem(tableRow["Section"]);
                areaSection.MaterialName = tableRow["Material"];
                areaSection.ColorName    = tableRow["Color"];
                if (tableRow.ContainsKey("Notes"))
                {
                    areaSection.Notes = tableRow["Notes"];
                }
                if (tableRow.ContainsKey("GUID"))
                {
                    areaSection.GUID = tableRow["GUID"];
                }
                areaSection.Modifiers = new AreaModifier
                {
                    MembraneF11    = Adaptor.toDouble(tableRow["F11Mod"]),
                    MembraneF22    = Adaptor.toDouble(tableRow["F22Mod"]),
                    MembraneF12    = Adaptor.toDouble(tableRow["F12Mod"]),
                    BendingM11     = Adaptor.toDouble(tableRow["M11Mod"]),
                    BendingM22     = Adaptor.toDouble(tableRow["M22Mod"]),
                    BendingM12     = Adaptor.toDouble(tableRow["M12Mod"]),
                    ShearV13       = Adaptor.toDouble(tableRow["V13Mod"]),
                    ShearV23       = Adaptor.toDouble(tableRow["V23Mod"]),
                    MassModifier   = Adaptor.toDouble(tableRow["MMod"]),
                    WeightModifier = Adaptor.toDouble(tableRow["WMod"])
                };
                areaSection.AreaType = Enums.EnumLibrary.ConvertStringToEnumByDescription <eAreaSectionType>(tableRow["AreaType"]);

                switch (areaSection)
                {
                case Shell areaShell:
                    areaShell.SectionProperties.ShellType         = convertToShellType(tableRow["Type"]);
                    areaShell.SectionProperties.MaterialAngle     = Adaptor.toDouble(tableRow["MatAngle"]);
                    areaShell.SectionProperties.MembraneThickness = Adaptor.toDouble(tableRow["Thickness"]);
                    areaShell.SectionProperties.BendingThickness  = Adaptor.toDouble(tableRow["BendThick"]);
                    if (tableRow.ContainsKey("DrillDOF"))
                    {
                        areaShell.SectionProperties.IncludeDrillingDOF = Adaptor.fromYesNo(tableRow["DrillDOF"]);
                    }
                    break;

                case Plane areaPlane:
                    areaPlane.SectionProperties.PlaneType         = convertToPlaneType(tableRow["Type"]);
                    areaPlane.SectionProperties.MaterialAngle     = Adaptor.toDouble(tableRow["MatAngle"]);
                    areaPlane.SectionProperties.Thickness         = Adaptor.toDouble(tableRow["Thickness"]);
                    areaPlane.SectionProperties.IncompatibleModes = Adaptor.fromYesNo(tableRow["InComp"]);
                    break;

                case ASolid areaASolid:
                    areaASolid.SectionProperties.MaterialAngle            = Adaptor.toDouble(tableRow["MatAngle"]);
                    areaASolid.SectionProperties.ArcAngle                 = Adaptor.toDouble(tableRow["Arc"]);
                    areaASolid.SectionProperties.IncompatibleBendingModes = Adaptor.fromYesNo(tableRow["InComp"]);
                    areaASolid.SectionProperties.CoordinateSystem         = tableRow["CoordSys"];
                    break;
                }
            }
        }
 public void ConfigureDetail(SurveyTemplateQuestion detail, Question question, AreaSection areaSection)
 {
     AssignQuestion(detail, question);
     AssignAreaSection(detail, areaSection);
 }
Пример #11
0
        /// <summary>
        /// Returns the section property name assigned.
        /// This item is None if there is no section property assigned to the element/object.
        /// </summary>
        /// <exception cref="CSiException"><see cref="CSiApiBase.API_DEFAULT_ERROR_CODE" /></exception>
        public override void FillSection()
        {
            string sectionName = getSection(_areaObject);

            Section = AreaSection.Factory(sectionName);
        }