예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="shape"></param>
        /// <returns></returns>
        public static double GetParameter(this Shape shape)
        {
            var visitor = new ComputeParameterVisitor();

            shape.Accept(visitor);
            return(visitor.Parameter);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="shape"></param>
        /// <returns></returns>
        public static double GetArea(this Shape shape)
        {
            var visitor = new ComputeAreaVisitor();

            shape.Accept(visitor);
            return(visitor.Area);
        }
예제 #3
0
        /// <summary>
        /// Loads the shapes from the file.
        /// </summary>
        public void Load()
        {
            currentLine = string.Empty;
            while ((currentLine = streamReader.ReadLine()) != null)
            {
                Shape shape = CreateShapeFromLine(currentLine);
                shape.Accept(this);
                shapeList.Add(shape);
            }

            streamReader.Close();
        }
예제 #4
0
        public override void Visit(ShapeComposite shapeComposite)
        {
            // For now we know groups are always 2 shapes big
            int childCount = 2;

            for (int i = 0; i < childCount; i++)
            {
                currentLine = streamReader.ReadLine();
                Shape shape = CreateShapeFromLine(currentLine);
                shape.Accept(this);
                shapeComposite.AddChild(shape);
            }
        }
예제 #5
0
        public override void Visit(ShapeDecorator shapeDecorator)
        {
            string[] lineSplit = SplitCurrentLine();
            string   text      = lineSplit[2];

            ShapeDecorator.OrnamentPosition position;
            Enum.TryParse(lineSplit[1], out position);

            currentLine = streamReader.ReadLine();
            Shape shape = CreateShapeFromLine(currentLine);

            shape.Accept(this);
            shapeDecorator.decoratedShape = shape;
            shapeDecorator.ornament       = text;
            shapeDecorator.position       = position;
        }
예제 #6
0
        public void Generate()
        {
            //TODO:Generate
            string fileName = File.FromFilePath;

            //TODO:Generate

            switch (Shape.LayerType)
            {
            case ProWrite.Core.LayerType.Image:
            case ProWrite.Core.LayerType.Text:
            case ProWrite.Core.LayerType.Paint:
                log.Debug("Begin Generate " + Shape.LayerType.ToString() + ".");
                UFEPaintVisitor.Instance.ImageFile = fileName;
                Shape.Accept(UFEPaintVisitor.Instance);
                if (fileName == null)
                {
                    throw new Exception("Generate shape file is failure!");
                }
                if (!System.IO.File.Exists(fileName))
                {
                    throw new Exception("Generate shape file is failure!");
                }
                log.Debug("End Generate " + Shape.LayerType.ToString() + ".");
                break;

            case ProWrite.Core.LayerType.Video:
            case ProWrite.Core.LayerType.DynamicText:
            case ProWrite.Core.LayerType.DynamicVideo:
                break;
            }

            if (Sign.Controller.Connection.Mode != ProWrite.UFE.ConnectionMode.Tcp)
            {
                File.Content = IOHelper.ReadAllBytes(File.FromFilePath);
            }
            File.Size = IOHelper.GetFileLength(File.FromFilePath);
        }
예제 #7
0
 public void Process(Shape shape)
 {
     shape.Accept(_visitor);
 }
예제 #8
0
        public void Do()
        {
            ResizeVisitor resizeVisitor = new ResizeVisitor(width, height);

            shape.Accept(resizeVisitor);
        }
        //double dispathch
        public void Export2(Shape shape)
        {
            Exporter exporter = new Exporter();

            shape.Accept(exporter);
        }
예제 #10
0
        public void Do()
        {
            MoveVisitor moveVisitor = new MoveVisitor(velocity);

            shape.Accept(moveVisitor);
        }