Exemple #1
0
        static IXEP_EmdElement FindReinforcementElement(IXEP_EmdElement elem4Work, int sectionID)
        {
            IXEP_EmdElement reinfElem = elem4Work;

            if (elem4Work.Name == XEP_EmdFileConstants.s_FakeRootElementName)
            { // more sections
                List <IXEP_EmdElement> sections    = XEP_BaseEmdFile.GetElements(elem4Work, XEP_EmdNames.s_KeySection);
                IXEP_EmdElement        needSection = sections.Where(item => item.GetAttribute(XEP_EmdNames.s_KeyID).GetIntValue() == sectionID).First();
                IXEP_EmdAttribute      attID       = needSection.GetAttribute(XEP_EmdNames.s_KeyID);
                if (attID == null)
                {
                    throw new InvalidOperationException("Section in reinforcement file does not have attribute: " + XEP_EmdNames.s_KeyID);
                }
                if (attID.Value != sectionID.ToString())
                {
                    throw new InvalidOperationException("Section ID attribute is not equals section ID inputed, actual:" + attID.Value + " wanted: " + sectionID.ToString());
                }
                reinfElem = XEP_BaseEmdFile.GetElement(needSection, XEP_EmdNames.s_KeyReinforcement);
            }
            if (reinfElem == null)
            {
                throw new InvalidOperationException("There is not reinforcemnt element for sectionID: " + sectionID.ToString());
            }
            XEP_BaseEmdFile.CheckName(reinfElem.Name, XEP_EmdNames.s_KeyReinforcement);
            return(reinfElem);
        }
 public void SetStirrupZoneIO(IXEP_StirrupZoneIO zoneIO, bool insertShapeInAfterAndBefore)
 {
     if (m_zone4Work == null)
     {
         throw new InvalidOperationException("Zone4Work was not created, please call 'PrepareZones' ");
     }
     m_zone4Work.CreateFrom(zoneIO, m_sectionPos, m_baseMat, m_zoneBeg, m_zoneEnd, m_zone4Work.ZoneID);
     XEP_BaseEmdFile.RemoveElements(m_reinf4Stirrups, XEP_EmdNames.s_KeyStirrupZone);
     if (zoneIO.IsValid())
     {
         foreach (var zone in m_zonesBefore)
         {
             m_reinf4Stirrups.Elements.Add(zone);
         }
         m_reinf4Stirrups.Elements.Add(m_zone4Work.CreateEmdElement());
         foreach (var zone in m_zonesAfter)
         {
             m_reinf4Stirrups.Elements.Add(zone);
         }
         if (insertShapeInAfterAndBefore)
         {
             foreach (var zone in m_zonesBefore)
             {
                 XEP_BaseEmdFile.RemoveElements(zone, XEP_EmdNames.s_KeyStirrupZoneShape);
                 zone.Elements.Add(m_zone4Work.ZoneShape.CreateEmdElement());
             }
             foreach (var zone in m_zonesAfter)
             {
                 XEP_BaseEmdFile.RemoveElements(zone, XEP_EmdNames.s_KeyStirrupZoneShape);
                 zone.Elements.Add(m_zone4Work.ZoneShape.CreateEmdElement());
             }
         }
     }
 }
        private List <IXEP_EmdElement> PrepareCurrentZoneCandidates()
        {
            List <IXEP_EmdElement> domStirrupZones = XEP_BaseEmdFile.GetElements(m_reinf4Stirrups, XEP_EmdNames.s_KeyStirrupZone);

            if (domStirrupZones == null || domStirrupZones.Count == 0)
            {
                return(null);
            }
            List <IXEP_EmdElement> currentZoneCandidates = new List <IXEP_EmdElement>();

            XEP_BaseEmdFile.RemoveElements(m_reinf4Stirrups, XEP_EmdNames.s_KeyStirrupZone);
            SortZones(domStirrupZones, currentZoneCandidates);
            return(currentZoneCandidates);
        }
Exemple #4
0
        static IXEP_EmdElement FindReinforcementElement4StirrupZones(IXEP_EmdElement elem4Work)
        {
            IXEP_EmdElement reinfElem = elem4Work;

            if (elem4Work.Name == XEP_EmdFileConstants.s_FakeRootElementName)
            { // more sections
                reinfElem = XEP_BaseEmdFile.GetElement(elem4Work, XEP_EmdNames.s_KeyReinforcement);
            }
            if (reinfElem == null)
            {
                throw new InvalidOperationException("There is not reinforcemnt element for stirrups !");
            }
            XEP_BaseEmdFile.CheckName(reinfElem.Name, XEP_EmdNames.s_KeyReinforcement);
            return(reinfElem);
        }
        public void PrepareZones(IXEP_EmdElement reinf4Stirrups, double sectionPos, string baseMat, double zoneBeg, double zoneEnd)
        {
            m_zonesBefore.Clear();
            m_zonesAfter.Clear();
            m_zone4Work      = null;
            m_sectionPos     = sectionPos;
            m_baseMat        = baseMat;
            m_zoneBeg        = zoneBeg;
            m_zoneEnd        = zoneEnd;
            m_reinf4Stirrups = reinf4Stirrups;
            XEP_BaseEmdFile.CheckName(m_reinf4Stirrups.Name, XEP_EmdNames.s_KeyReinforcement);
            List <IXEP_EmdElement> currentZoneCandidates = PrepareCurrentZoneCandidates();

            if (currentZoneCandidates == null || currentZoneCandidates.Count == 0)
            {
                PrepareZone4NoZones();
            }
            else if (currentZoneCandidates.Count == 1)
            {
                PrepareZoneFromElement(currentZoneCandidates[0]);
            }
            else
            {
                bool wasMatch = false;
                foreach (var zone in currentZoneCandidates)
                {
                    double actZoneBeg = zone.GetAttribute(XEP_EmdNames.s_KeyStirrupZoneZoneBeg).GetDoubleValue();
                    double actZoneEnd = zone.GetAttribute(XEP_EmdNames.s_KeyStirrupZoneZoneEnd).GetDoubleValue();
                    if (sectionPos > actZoneBeg && sectionPos < actZoneEnd)
                    {
                        PrepareZoneFromElement(zone);
                        wasMatch = true;
                        break;
                    }
                }
                if (!wasMatch)
                {
                    PrepareZoneFromElement(currentZoneCandidates[0]);
                }
            }
            if (m_zone4Work == null)
            {
                PrepareZone4NoZones();
            }
        }