the properties of beam system; can be displayed in PropertyGrid
예제 #1
0
        /// <summary>
        /// create BeamSystemParam's subclass according to LayoutMethod
        /// </summary>
        /// <param name="layoutType">LayoutMethod</param>
        /// <returns>created BeamSystemParam's subclass</returns>
        public static BeamSystemParam CreateInstance(LayoutMethod layoutType)
        {
            BeamSystemParam param = null;

            switch (layoutType)
            {
            case LayoutMethod.ClearSpacing:
                param = new ClearSpacingParam();
                break;

            case LayoutMethod.FixedDistance:
                param = new FixedDistanceParam();
                break;

            case LayoutMethod.FixedNumber:
                param = new FixedNumberParam();
                break;

            case LayoutMethod.MaximumSpacing:
                param = new MaximumSpacingParam();
                break;

            default:
                break;
            }
            // it is absolutely impossible unless layoutType is wrong
            Debug.Assert(null != param);
            return(param);
        }
예제 #2
0
 /// <summary>
 /// clone BeamSystemParam to one of its subclass according to LayoutMethod
 /// </summary>
 /// <param name="layoutType">LayoutMethod</param>
 /// <returns>cloned BeamSystemParam's subclass</returns>
 public BeamSystemParam CloneInstance(LayoutMethod layoutType)
 {
     // create a BeamSystemParam instance and set its properties
     BeamSystemParam param = CreateInstance(layoutType);
     param.m_fixedSpacing  = m_fixedSpacing;
     param.m_justifyType   = m_justifyType;
     param.m_numberOfLines = m_numberOfLines;
     param.m_beamType      = m_beamType;
     return param;            
 }
예제 #3
0
        /// <summary>
        /// layout rule of beam system has changed
        /// </summary>
        /// <param name="layoutMethod">changed method</param>
        private void LayoutRuleChanged(ref LayoutMethod layoutMethod)
        {
            // create BeamSystemParams instance according to changed LayoutMethod
            m_param = m_param.CloneInstance(layoutMethod);

            // raise DataUpdated event
            OnParamsUpdated(new EventArgs());

            // rebind delegate
            m_param.LayoutRuleChanged += new LayoutRuleChangedHandler(LayoutRuleChanged);
        }
예제 #4
0
        /// <summary>
        /// constructor
        /// if precondition in current Revit project isn't enough,
        /// ErrorMessageException will be throw out
        /// </summary>
        /// <param name="commandData">data from Revit</param>
        public BeamSystemData(ExternalCommandData commandData)
        {
            // initialize members
            m_commandData = commandData;
            PrepareData();
            InitializeProfile(m_beams);

            m_param = BeamSystemParam.CreateInstance(LayoutMethod.ClearSpacing);
            List <FamilySymbol> beamTypes = new List <FamilySymbol>(m_beamTypes.Values);

            m_param.BeamType           = beamTypes[0];
            m_param.LayoutRuleChanged += new LayoutRuleChangedHandler(LayoutRuleChanged);
        }
예제 #5
0
        /// <summary>
        /// constructor
        /// if precondition in current Revit project isn't enough,
        /// ErrorMessageException will be throw out
        /// </summary>
        /// <param name="commandData">data from Revit</param>
        public BeamSystemData(ExternalCommandData commandData)
        {
            // initialize members
            m_commandData = commandData;
            PrepareData();
            InitializeProfile(m_beams);

            m_param                      = BeamSystemParam.CreateInstance(LayoutMethod.ClearSpacing);
            List<FamilySymbol> beamTypes = new List<FamilySymbol>(m_beamTypes.Values);
            m_param.BeamType             = beamTypes[0];
            m_param.LayoutRuleChanged   += new LayoutRuleChangedHandler(LayoutRuleChanged);
        }
예제 #6
0
        /// <summary>
        /// layout rule of beam system has changed
        /// </summary>
        /// <param name="layoutMethod">changed method</param>
        private void LayoutRuleChanged(ref LayoutMethod layoutMethod)
        {
            // create BeamSystemParams instance according to changed LayoutMethod
            m_param = m_param.CloneInstance(layoutMethod);

            // raise DataUpdated event
            OnParamsUpdated(new EventArgs());

            // rebind delegate
            m_param.LayoutRuleChanged += new LayoutRuleChangedHandler(LayoutRuleChanged);
        }