Пример #1
0
        /// <summary>
        /// Create a new geometry operation object
        /// base the information in the xml
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public static GeometryOperation Create(XPathNavigator navigator, GEMSSingle parent)
        {
            GeometryOperation operation = null;

            try
            {
                //Get the type of the geometry operation
                GeometryOperation.GeometryOperationType operationType = (GeometryOperation.GeometryOperationType)Enum.Parse(typeof(GeometryOperation.GeometryOperationType), navigator.GetAttribute("name", string.Empty));

                //Create the geometry object based type
                switch (operationType)
                {
                case GeometryOperation.GeometryOperationType.CreateCone:
                    operation = new CreateCone(navigator, parent);
                    break;

                case GeometryOperation.GeometryOperationType.CreateCylinder:
                    operation = new CreateCylinder(navigator, parent);
                    break;

                case GeometryOperation.GeometryOperationType.CreateCuboid:
                    operation = new CreateCuboid(navigator, parent);
                    break;

                case GeometryOperation.GeometryOperationType.CreateLine:
                    operation = new CreateLine(navigator, parent);
                    break;

                case GeometryOperation.GeometryOperationType.CreatePoint:
                    operation = new CreatePoint(navigator, parent);
                    break;

                case GeometryOperation.GeometryOperationType.CreateRectangle:
                    operation = new CreateRectangle(navigator, parent);
                    break;

                case GeometryOperation.GeometryOperationType.CreateSphere:
                    operation = new CreateSphere(navigator, parent);
                    break;

                case GeometryOperation.GeometryOperationType.CreateRound:
                    operation = new CreateRound(navigator, parent);
                    break;

                default:
                    break;
                }
            }
            catch
            {
                return(operation);
            }

            return(operation);
        }
Пример #2
0
        public override GeometryOperation Clone(int newId, GEMSSingle parent)
        {
            CreateCone cone = new CreateCone(newId, parent);

            cone.AlineAxis    = this.alineAxis;
            cone.BottomRadius = new Length(this.bottomRadius);
            cone.TopRadius    = new Length(this.topRadius);
            cone.Height       = new Length(this.height);
            cone.Center       = new Vector3WithUnit(this.center);

            return(cone);
        }