Exemple #1
0
        public override GeometryOperation Clone(int newId, GEMSSingle parent)
        {
            CreatePoint point = new CreatePoint(newId, parent);

            point.Position = new Vector3WithUnit(this.position);

            return(point);
        }
        /// <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);
        }