Example #1
0
        internal void Copy()
        {
            Shape shape = new Shape();

            if (selection != null)
            {
                shape = selection;
                if (shape.ShapeType == "Rectangle")
                {
                    shape = new RectangleShape(new Rectangle((int)shape.Location.X, (int)shape.Location.Y,
                                                             (int)shape.Width, (int)shape.Height));

                    CopyHelp(shape);
                }
                if (shape.ShapeType == "Ellipse")
                {
                    shape = new EllipseShape(new Rectangle((int)shape.Location.X, (int)shape.Location.Y,
                                                           (int)shape.Width, (int)shape.Height));
                    CopyHelp(shape);
                }


                ShapeList.Add(shape);
            }
        }
Example #2
0
        }//end rotate

        internal void DeleteSelected()
        {
            if (selection != null)
            {
                ShapeList.Remove(selection);
            }
        }
Example #3
0
        internal void Paste()
        {
            BinaryFormatter bf = new BinaryFormatter();

            ms.Position = 0;
            List <Shape> pastedShapeList = new List <Shape>();

            try
            {
                pastedShapeList = (List <Shape>)bf.Deserialize(ms);
                foreach (var item in pastedShapeList)
                {
                    ShapeList.Add(item);
                }
                Clipboard.SetData("My Format", ms);
            }
            catch (IOException e)
            {
                MessageBox.Show("something happened");
            }
            catch (SerializationException e)
            {
                MessageBox.Show("copy something so you can paste it");
            }
        }
Example #4
0
 internal void Paste()
 {
     if (Current != null)
     {
         try
         {
             if (isGroupActive && !isMultigroupActive)
             {
                 GroupShape gs = (GroupShape)DeSerialize();
                 PointF     p  = gs.Location;
                 TranslateTo(p);
                 ShapeList.Add(gs);
             }
             else
             {
                 Shape  s = (Shape)DeSerialize();
                 PointF p = s.Location;
                 s.Location = Current;
                 TranslateTo(p);
                 ShapeList.Add(s);
             }
         }
         catch (Exception e)
         {
         }
     }
 }
Example #5
0
 public void Delete()
 {
     if (isMultigroupActive && isGroupActive)
     {
         foreach (GroupShape group in multigroups)
         {
             foreach (Shape s in group.GetListShapes())
             {
                 ShapeList.Remove(s);
             }
             group.clear();
         }
     }
     else if (isGroupActive && !isMultigroupActive)
     {
         if (group.isEmpty())
         {
             foreach (Shape s in group.GetListShapes())
             {
                 ShapeList.Remove(s);
             }
             group.clear();
         }
     }
     else if (selection != null)
     {
         ShapeList.Remove(selection);
         selection = null;
     }
 }
Example #6
0
 internal void DeleteLastShape()
 {
     if (ShapeList.Count != 0)
     {
         ShapeList.RemoveAt(ShapeList.Count - 1);
     }
 }
Example #7
0
        public AISInteractiveObject UpdateNodesInteractive(Node node)
        {
            AISInteractiveObject interactive;
            var haveInteractive = ShapeList.TryGetValue(node.Index, out interactive);

            if (ShapeIsInvisible(node))
            {
                if (haveInteractive)
                {
                    RemoveShapeFromContext(node);
                }
                return(null);
            }
            var isShapeBasedInteractive = false;
            var topoDsInterpreter       = node.Get <TopoDsShapeInterpreter>();

            if (topoDsInterpreter != null)
            {
                isShapeBasedInteractive = true;
                var topoDsShape = topoDsInterpreter.Shape;
                if (topoDsShape == null)
                {
                    RemoveShapeFromContext(node);
                    return(null);
                }

                interactive = UpdateShapeInteractive(node, topoDsShape);
            }
            else
            {
                if (haveInteractive)
                {
                    RemoveShapeFromContext(node);
                }
                var interactiveShapeInterpreter = node.Get <InteractiveShapeInterpreter>();
                //Ensure.IsNotNull(interactiveShapeInterpreter,
                //                 "Your node should have either a TopoDS or an InteractiveShape associated to it");
                if (interactiveShapeInterpreter == null)
                {
                    return(null);
                }
                interactive = interactiveShapeInterpreter.Interactive;
                if (interactive == null)
                {
                    RemoveShapeFromContext(node);
                    return(null);
                }
                ShapeList[node.Index] = interactive;
            }

            if (Context == null)
            {
                return(null);
            }

            UpdateInteractiveColor(Context, node, interactive, isShapeBasedInteractive);
            UpdateTransparency(Context, node, interactive);
            return(interactive);
        }
Example #8
0
 internal void Delete()
 {
     foreach (var item in Selection)
     {
         ShapeList.Remove(item);
         Selection = new List <Shape>();
     }
 }
 public void Delete()
 {
     foreach (var item in Selection)
     {
         ShapeList.Remove(item);
     }
     Selection.Clear();
 }
Example #10
0
 public void RemoveSpecific(Shape selected)
 {
     if (ShapeList.Count != 0)
     {
         Selection.RemoveAll(x => x == selected);
         ShapeList.RemoveAll(x => x == selected);
     }
 }
Example #11
0
 public void SelectAll()
 {
     Selection = new List <Shape>(ShapeList);
     foreach (Shape item in Selection)
     {
         ShapeList.Add(item);
     }
 }
Example #12
0
 internal void DeleteSelected()
 {
     foreach (var item in Selection)
     {
         ShapeList.Remove(item);
     }
     Selection.Clear();
 }
Example #13
0
 public void DeleteSelected()
 {
     foreach (var item in SelectionShape)
     {
         ShapeList.Remove(item);
     }
     SelectionShape = new List <Shape>();
 }
Example #14
0
 public void RemoveAll()
 {
     if (ShapeList.Count != 0)
     {
         Selection.Clear();
         ShapeList.Clear();
     }
 }
Example #15
0
 public void PopulatePanel(List <Shape> shapePanel)
 {
     shapePanel.Clear();
     foreach (var item in ShapeList.ToList())
     {
         shapePanel.Add(item);
     }
 }
Example #16
0
 public void DeleteAll()
 {
     Selection = new List <Shape>(ShapeList);
     foreach (Shape item in Selection)
     {
         ShapeList.Remove(item);
     }
     Selection = new List <Shape>();
 }
Example #17
0
 private static BoundingShapes CreateSimpleCircleBoundingShapes()
 {
     return(new BoundingShapes(ShapeList.New()
                               .AddCircle(c =>
     {
         c.Radius = 1;
         c.Tag = ShapeTags.BodyShape;
     })));
 }
        public static void FontGlyphComparision2(IVisio.Document doc, string[] fontnames, List <string> samplechars)
        {
            double w  = 2.0;
            double h  = 1;
            double th = 1;

            int chunksize = 12;
            var chunks    = LinqUtil.Split(samplechars, chunksize);

            foreach (var chunk in chunks)
            {
                var domshapescol = new ShapeList();

                for (int j = 0; j < fontnames.Count(); j++)
                {
                    string fontname = fontnames[j];
                    double x0       = j * w;

                    var r  = new VA.Drawing.Rectangle(x0, 0 - th, x0 + w, 0);
                    var n1 = domshapescol.Drop("Rectangle", "basic_u.vss", r);
                    n1.Text = new VisioAutomation.Models.Text.TextElement(fontname.ToUpper());
                    n1.Cells.FillForegnd = "rgb(255,255,255)";
                    n1.Cells.LineWeight  = 0.0;
                    n1.Cells.LinePattern = 0;
                    n1.Cells.CharSize    = "16pt";
                }


                for (int j = 0; j < fontnames.Count(); j++)
                {
                    for (int i = 0; i < chunksize; i++)
                    {
                        double x0 = j * w;
                        double y0 = i * h * -1 - th - h;

                        var r  = new VA.Drawing.Rectangle(x0, y0, x0 + w, y0 + h);
                        var n1 = domshapescol.Drop("Rectangle", "basic_u.vss", r);
                        if (i < chunk.Count)
                        {
                            n1.Text = new VisioAutomation.Models.Text.TextElement(chunk[i]);
                        }
                        n1.CharFontName      = fontnames[j];
                        n1.Cells.CharSize    = "36pt";
                        n1.Cells.FillForegnd = "rgb(255,255,255)";
                        n1.Cells.LineWeight  = 0.0;
                        n1.Cells.LinePattern = 0;
                    }
                }

                var page = doc.Pages.Add();
                domshapescol.Render(page);

                var bordersize = new VA.Drawing.Size(0.5, 0.5);
                page.ResizeToFitContents(bordersize);
            }
        }
Example #19
0
        public void AddCustomRectangle(int x, int y, Color col)
        {
            RectangleShape rect = new RectangleShape(new Rectangle(211, 100, x, y));

            rect.FillColor   = col;
            rect.BorderColor = Pens.Black;
            rect.ShapeType   = "Rectangle";

            ShapeList.Add(rect);
        }
 internal void PasteItems(PointF mouseLocation)
 {
     foreach (var s in shapeCopies)
     {
         Shape copy = (Shape)s.Clone();
         copy.Location    = mouseLocation;
         copy.BorderColor = Color.Black;
         ShapeList.Add(copy);
     }
 }
Example #21
0
        public void AddRandomLine()
        {
            // Random rnd = new Random();

            LineShape line = new LineShape(PointStart, PointEnd);

            line.BorderColor = ColorBorder;

            ShapeList.Add(line);
        }
Example #22
0
        public void AddElipse()
        {
            Random      rnd   = new Random();
            int         x     = rnd.Next(100, 1000);
            int         y     = rnd.Next(100, 600);
            ElipseShape shape = new ElipseShape(new Rectangle(x, y, 100, 100));

            shape.FillColor = Color.White;
            ShapeList.Add(shape);
        }
Example #23
0
        /// <summary>
        /// Добавя примитив - правоъгълник на произволно място върху клиентската област.
        /// </summary>
        public void AddRandomRectangle()
        {
            Random         rnd  = new Random();
            int            x    = rnd.Next(100, 1000);
            int            y    = rnd.Next(100, 600);
            RectangleShape rect = new RectangleShape(new Rectangle(x, y, 100, 200));

            rect.FillColor = Color.White;
            ShapeList.Add(rect);
        }
 public virtual void Draw(Graphics grfx)
 {
     if (ShapeList.ContainsKey(CurrentTab))
     {
         foreach (Shape item in ShapeList[CurrentTab])
         {
             DrawShape(grfx, item);
         }
     }
 }
Example #25
0
        public void addModelShape()
        {
            Random rnd = new Random();
            int    x   = rnd.Next(100, 1000);
            int    y   = rnd.Next(100, 600);

            ModelShape shape = new ModelShape(new RectangleF(x, y, 100, 100));

            ShapeList.Add(shape);
        }
Example #26
0
        public void AddCustomEllipse(int x, int y, Color col)
        {
            EllipseShape elipse = new EllipseShape(new Rectangle(211, 100, x, y));

            elipse.FillColor   = col;
            elipse.BorderColor = Pens.Black;
            elipse.ShapeType   = "Ellipse";

            ShapeList.Add(elipse);
        }
Example #27
0
        public void addRandomSquare()
        {
            Random rnd = new Random();
            int    x   = rnd.Next(100, 1000);
            int    y   = rnd.Next(100, 600);

            SquareShape square = new SquareShape(new RectangleF(x, y, 50, 50));

            ShapeList.Add(square);
        }
Example #28
0
 internal void PastSelected()
 {
     try
     {
         List <Shape> copyShapes = (List <Shape>)MyDeSerialize();
         ShapeList.AddRange(copyShapes);
     }catch (Exception e)
     {
     }
 }
Example #29
0
        public void addRandomDot()
        {
            Random rnd = new Random();
            int    x   = rnd.Next(100, 1000);
            int    y   = rnd.Next(100, 600);

            DotShape dot = new DotShape(new RectangleF(x, y, 20, 20));

            ShapeList.Add(dot);
        }
Example #30
0
 public void DeleteTriangle()
 {
     foreach (Shape item in Selection)
     {
         if (item.GetType() == typeof(TriangleShape))
         {
             ShapeList.Remove(item);
         }
     }
     Selection = new List <Shape>();
 }
        public Page(double width, double height)
        {
            if (width < 0)
            {
                throw new System.ArgumentOutOfRangeException("width");
            }

            if (height < 0)
            {
                throw new System.ArgumentOutOfRangeException("height");
            }

            this.Shapes = new ShapeList(this);
            this.Connects = new List<Connect>();
            this.PageProperties = new Sections.PageProperties();
            this.PageProperties.PageWidth.Result = width;
            this.PageProperties.PageHeight.Result = height;
            this.PrintProperties = new Sections.PrintProperties();
            this.PageLayout = new Sections.PageLayout();
            this._id = Page.idgen.GetNextID();
            var culture = System.Globalization.CultureInfo.InvariantCulture;
            this.Name = string.Format(culture, "Page-{0}", this._id + 1);
            this.Layers = new LayerList();
        }
Example #32
0
 public ShapeModel()
 {
     _shapeList = new ShapeList();
     _currentState = new PointerState(this);
     _commandManager = new CommandManager();
 }
Example #33
0
 public void StoreNewCircle(Vector3 centre, float radius, Color colour, string onPlane)
 {
     ShapeList vertexList = new ShapeList();
     vertexList.shape = GetCircle(radius, loopLowerQuality, colour, centre, onPlane);
     savedShapes.Add(vertexList);
 }
Example #34
0
 public Drawing()
 {
     this.Shapes = new ShapeList();
     this.Connectors = new ConnectorList();
 }
Example #35
0
        // Stored shapes are drawn ONCE from the EditorScreen.cs Draw(...) method
        /// <summary>
        /// Store a list of points that make up a shape when a line is drawn
        /// between each point.
        /// </summary>
        /// <param name="vertices">Points or corners</param>
        /// <param name="colour">Colour of the lines</param>
        /// <param name="Closed">If true then the last point is connected back to the first</param>
        public void StoreNewShape(ref Vector3[] vertices, Color colour, bool Closed)
        {
            int points = vertices.Length;

            ShapeList vertexList = new ShapeList();
            if (Closed)
            {
                vertexList.shape = new VertexPositionColor[points + 1];
            }
            else
            {
                vertexList.shape = new VertexPositionColor[points];
            }

            for (int i = 0; i < points; i++)
            {
                vertexList.shape[i] = new VertexPositionColor(vertices[i], colour);
            }

            if (Closed)
            {
                vertexList.shape[points] = vertexList.shape[0];
            }

            savedShapes.Add(vertexList);
        }