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

            box.Width    = new Length(this.width);
            box.Height   = new Length(this.height);
            box.Depth    = new Length(this.depth);
            box.RefPoint = new Vector3WithUnit(this.refPoint);

            return(box);
        }