示例#1
0
        /// <summary>
        /// Helper
        /// </summary>
        /// <returns></returns>
        private bool ValidateWallUI()
        {
            bool bWallIsEnabled = this.GetProperty <bool>(HelloWallViewProperties.WALL_IS_ENABLED);

            if (!bWallIsEnabled)
            {
                this.SetProperty(HelloWallViewProperties.WALL_SETTINGS_ARE_ENABLED, false);

                return(true);
            }

            this.SetProperty(HelloWallViewProperties.WALL_SETTINGS_ARE_ENABLED, true);

            IfcView view = this.GetProperty <IfcView>(HelloWallViewProperties.VIEW);

            this.SetProperty(HelloWallViewProperties.WALL_EXTRUDED_POLYGON_IS_ENABLED, view == IfcView.Coordination);
            if (view == IfcView.Presentation)
            {
                this.SetProperty(HelloWallViewProperties.WALL_BODY_REPRESENTATION, IfcBodyRepresentation.BRep);
            }

            string strWallName = this.View.GetProperty(HelloWallViewProperties.WALL_NAME).ToString();

            if (string.IsNullOrEmpty(strWallName))
            {
                this.View.SetError(HelloWallViewProperties.WALL_NAME, "Wall name is empty.");

                return(false);
            }

            string strWallThickness = this.View.GetProperty(HelloWallViewProperties.WALL_THICKNESS).ToString();

            if (!this.IsInteger(strWallThickness))
            {
                this.View.SetError(HelloWallViewProperties.WALL_THICKNESS, Resources.ERR_INVALID_INTEGER);

                return(false);
            }

            string strWallHeight = this.View.GetProperty(HelloWallViewProperties.WALL_HEIGHT).ToString();

            if (!this.IsInteger(strWallHeight))
            {
                this.View.SetError(HelloWallViewProperties.WALL_HEIGHT, Resources.ERR_INVALID_INTEGER);

                return(false);
            }

            string strWallWidth = this.View.GetProperty(HelloWallViewProperties.WALL_WIDTH).ToString();

            if (!this.IsInteger(strWallWidth))
            {
                this.View.SetError(HelloWallViewProperties.WALL_WIDTH, Resources.ERR_INVALID_INTEGER);

                return(false);
            }

            return(true);
        }
示例#2
0
        /// <summary>
        /// Helper
        /// </summary>
        /// <returns></returns>
        private bool SetGeneralProperty(string strProperty, object property)
        {
            switch (strProperty)
            {
            case HelloWallViewProperties.SCHEMA_FILE:
            {
                _tbSchemaFileName.Text = HelloWallViewProperties.ConvertProperty <string>(strProperty, property);

                return(true);
            }

            case HelloWallViewProperties.OUTPUT_FILE:
            {
                _tbOutputFileName.Text = HelloWallViewProperties.ConvertProperty <string>(strProperty, property);

                return(true);
            }

            case HelloWallViewProperties.VIEW:
            {
                IfcView view = HelloWallViewProperties.ConvertProperty <IfcView>(strProperty, property);

                if (view == IfcView.Coordination)
                {
                    _rbCoordinationView.Checked = true;
                }
                else
                {
                    _rbPresentationView.Checked = true;
                }

                return(true);
            }

            case HelloWallViewProperties.INCLUDE_QUANTITIES:
            {
                _cbIncludeQuantites.Checked = HelloWallViewProperties.ConvertProperty <bool>(strProperty, property);

                return(true);
            }

            case HelloWallViewProperties.USE_METERS:
            {
                _cbUseMeters.Checked = HelloWallViewProperties.ConvertProperty <bool>(strProperty, property);

                return(true);
            }
            } // switch (strProperty)

            return(false);
        }
示例#3
0
        /// <summary>
        /// Helper
        /// </summary>
        /// <returns></returns>
        private bool ValidateWindowUI()
        {
            bool bWallIsEnabled    = this.GetProperty <bool>(HelloWallViewProperties.WALL_IS_ENABLED);
            bool bOpeningIsEnabled = this.GetProperty <bool>(HelloWallViewProperties.OPENING_IS_ENABLED);

            bool bWindowUIIsEnabled = !bWallIsEnabled /*the Opening is disabled too*/ ||
                                      (bWallIsEnabled && bOpeningIsEnabled) /*both the Wall and the Opening are disabled*/;

            if (!bWindowUIIsEnabled)
            {
                this.SetProperty(HelloWallViewProperties.WINDOW_UI_IS_ENABLED, false);

                return(true);
            }

            this.SetProperty(HelloWallViewProperties.WINDOW_UI_IS_ENABLED, true);

            bool bWindowIsEnabled = this.GetProperty <bool>(HelloWallViewProperties.WINDOW_IS_ENABLED);

            if (!bWindowIsEnabled)
            {
                this.SetProperty(HelloWallViewProperties.WINDOW_SETTINGS_ARE_ENABLED, false);

                return(true);
            }

            this.SetProperty(HelloWallViewProperties.WINDOW_SETTINGS_ARE_ENABLED, true);

            bool bWindowDimesnonsUIIsEnabled = !bWallIsEnabled;

            this.SetProperty(HelloWallViewProperties.WINDOW_DIMENSIONS_UI_IS_ENABLED, bWindowDimesnonsUIIsEnabled);

            IfcView view = this.GetProperty <IfcView>(HelloWallViewProperties.VIEW);

            this.SetProperty(HelloWallViewProperties.WINDOW_EXTRUDED_POLYGON_IS_ENABLED, view == IfcView.Coordination);
            if (view == IfcView.Presentation)
            {
                this.SetProperty(HelloWallViewProperties.WINDOW_BODY_REPRESENTATION, IfcBodyRepresentation.BRep);
            }

            string strWindowName = this.View.GetProperty(HelloWallViewProperties.WINDOW_NAME).ToString();

            if (string.IsNullOrEmpty(strWindowName))
            {
                this.View.SetError(HelloWallViewProperties.WINDOW_NAME, "Window name is empty.");

                return(false);
            }

            string strWindowThickness = this.View.GetProperty(HelloWallViewProperties.WINDOW_THICKNESS).ToString();

            if (!this.IsInteger(strWindowThickness))
            {
                this.View.SetError(HelloWallViewProperties.WINDOW_THICKNESS, Resources.ERR_INVALID_INTEGER);

                return(false);
            }

            string strWindowYOffset = this.View.GetProperty(HelloWallViewProperties.WINDOW_Y_OFFSET).ToString();

            if (!this.IsInteger(strWindowYOffset))
            {
                this.View.SetError(HelloWallViewProperties.WINDOW_Y_OFFSET, Resources.ERR_INVALID_INTEGER);

                return(false);
            }

            if (bWindowDimesnonsUIIsEnabled)
            {
                string strWindowHeight = this.View.GetProperty(HelloWallViewProperties.WINDOW_HEIGHT).ToString();
                if (!this.IsInteger(strWindowHeight))
                {
                    this.View.SetError(HelloWallViewProperties.WINDOW_HEIGHT, Resources.ERR_INVALID_INTEGER);

                    return(false);
                }

                string strWindowWidth = this.View.GetProperty(HelloWallViewProperties.WINDOW_WIDTH).ToString();
                if (!this.IsInteger(strWindowWidth))
                {
                    this.View.SetError(HelloWallViewProperties.WINDOW_WIDTH, Resources.ERR_INVALID_INTEGER);

                    return(false);
                }
            }

            return(true);
        }
示例#4
0
        /// <summary>
        /// Helper
        /// </summary>
        /// <returns></returns>
        private bool ValidateOpeningUI()
        {
            bool bWallIsEnabled = this.GetProperty <bool>(HelloWallViewProperties.WALL_IS_ENABLED);

            if (!bWallIsEnabled)
            {
                this.SetProperty(HelloWallViewProperties.OPENING_UI_IS_ENABLED, false);

                return(true);
            }

            this.SetProperty(HelloWallViewProperties.OPENING_UI_IS_ENABLED, true);

            bool bOpeningIsEnabled = this.GetProperty <bool>(HelloWallViewProperties.OPENING_IS_ENABLED);

            if (!bOpeningIsEnabled)
            {
                this.SetProperty(HelloWallViewProperties.OPENING_SETTINGS_ARE_ENABLED, false);

                return(true);
            }

            this.SetProperty(HelloWallViewProperties.OPENING_SETTINGS_ARE_ENABLED, true);

            IfcView view = this.GetProperty <IfcView>(HelloWallViewProperties.VIEW);

            this.SetProperty(HelloWallViewProperties.OPENING_EXTRUDED_POLYGON_IS_ENABLED, view == IfcView.Coordination);
            if (view == IfcView.Presentation)
            {
                this.SetProperty(HelloWallViewProperties.OPENING_BODY_REPRESENTATION, IfcBodyRepresentation.BRep);
            }

            this.SetProperty(HelloWallViewProperties.OPENING_BOUNDING_BOX_IS_ENABLED, view == IfcView.Coordination);

            string strOpeningName = this.View.GetProperty(HelloWallViewProperties.OPENING_NAME).ToString();

            if (string.IsNullOrEmpty(strOpeningName))
            {
                this.View.SetError(HelloWallViewProperties.OPENING_NAME, "Opening name is empty.");

                return(false);
            }

            string strOpeningXOffset = this.View.GetProperty(HelloWallViewProperties.OPENING_X_OFFSET).ToString();

            if (!this.IsInteger(strOpeningXOffset))
            {
                this.View.SetError(HelloWallViewProperties.OPENING_X_OFFSET, Resources.ERR_INVALID_INTEGER);

                return(false);
            }

            string strOpeningYOffset = this.View.GetProperty(HelloWallViewProperties.OPENING_Z_OFFSET).ToString();

            if (!this.IsInteger(strOpeningYOffset))
            {
                this.View.SetError(HelloWallViewProperties.OPENING_Z_OFFSET, Resources.ERR_INVALID_INTEGER);

                return(false);
            }

            string strOpeningHeight = this.View.GetProperty(HelloWallViewProperties.OPENING_HEIGHT).ToString();

            if (!this.IsInteger(strOpeningHeight))
            {
                this.View.SetError(HelloWallViewProperties.OPENING_HEIGHT, Resources.ERR_INVALID_INTEGER);

                return(false);
            }

            this.SetProperty(HelloWallViewProperties.WINDOW_HEIGHT, strOpeningHeight);

            string strOpeningWidth = this.View.GetProperty(HelloWallViewProperties.OPENING_WIDTH).ToString();

            if (!this.IsInteger(strOpeningWidth))
            {
                this.View.SetError(HelloWallViewProperties.OPENING_WIDTH, Resources.ERR_INVALID_INTEGER);

                return(false);
            }

            this.SetProperty(HelloWallViewProperties.WINDOW_WIDTH, strOpeningWidth);

            // Validate position/measures
            if (view == IfcView.Presentation)
            {
                int iWallHeight     = int.Parse(this.GetProperty <string>(HelloWallViewProperties.WALL_HEIGHT));
                int iWallWidth      = int.Parse(this.GetProperty <string>(HelloWallViewProperties.WALL_WIDTH));
                int iOpeningHeight  = int.Parse(this.GetProperty <string>(HelloWallViewProperties.OPENING_HEIGHT));
                int iOpeningWidth   = int.Parse(this.GetProperty <string>(HelloWallViewProperties.OPENING_WIDTH));
                int iOpeningXOffset = int.Parse(this.GetProperty <string>(HelloWallViewProperties.OPENING_X_OFFSET));
                int iOpeningZOffset = int.Parse(this.GetProperty <string>(HelloWallViewProperties.OPENING_Z_OFFSET));

                if ((iOpeningXOffset <= 0) ||
                    (iOpeningXOffset + iOpeningWidth >= iWallWidth) ||
                    (iOpeningZOffset <= 0) ||
                    (iOpeningZOffset + iOpeningHeight >= iWallHeight))
                {
                    this.View.SetError(HelloWallViewProperties.CREATE_IFC_BUTTON, Resources.ERR_OPENING_MEASURES);

                    return(false);
                }
            }

            return(true);
        }