Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public override GeometryOperation Clone(int newId, GEMSSingle parent)
        {
            CreateCylinder cylinder = new CreateCylinder(newId, parent);

            cylinder.AlineAxis = this.alineAxis;
            cylinder.Radius    = new Length(this.radius);
            cylinder.Height    = new Length(this.height);
            cylinder.Center    = new Vector3WithUnit(this.center);

            return(cylinder);
        }