Esempio n. 1
0
        internal void DrawTrack(Transformation trans, System.Drawing.Graphics g)
        {
            if (!IsTrackDisplayed)
            {
                return;
            }

            if (trackPointList.Count < 2)
            {
                return;
            }


            List <System.Drawing.Point> drawingPointList = new List <System.Drawing.Point>();

            foreach (int t in trackPointList.Keys)
            {
                if (t < trans.TrackStartTime || t > trans.TrackEndTime)
                {
                    continue;
                }

                System.Drawing.Point p = trans.CalculatePixel(trackPointList[t]);
                drawingPointList.Add(p);
            }
            if (drawingPointList.Count <= 0)
            {
                return;
            }

            System.Drawing.Point[] drawingPointArray = drawingPointList.ToArray();
            g.DrawLines(new System.Drawing.Pen(StyleManager.PassengerTrackColor, 4), drawingPointArray);
        }
Esempio n. 2
0
        public static void Draw3DButton(System.Drawing.Graphics g, System.Drawing.Rectangle rect, bool isPressed)
        {
            // background
            WFRect bgRect = rect;

            //bgRect.Inflate(-1, -1);
            bgRect.Offset(1, 1);
            g.FillRectangle(isPressed ? RGBrushes.Black : RGBrushes.White, bgRect);

            // outter frame
            g.DrawLine(System.Drawing.Pens.Black, rect.X + 1, rect.Y, rect.Right - 1, rect.Y);
            g.DrawLine(System.Drawing.Pens.Black, rect.X + 1, rect.Bottom, rect.Right - 1, rect.Bottom);
            g.DrawLine(System.Drawing.Pens.Black, rect.X, rect.Y + 1, rect.X, rect.Bottom - 1);
            g.DrawLine(System.Drawing.Pens.Black, rect.Right, rect.Y + 1, rect.Right, rect.Bottom - 1);

            // content
            WFRect bodyRect = rect;

            bodyRect.Inflate(-1, -1);
            bodyRect.Offset(1, 1);
            g.FillRectangle(System.Drawing.Brushes.LightGray, bodyRect);

            // shadow
            g.DrawLines(isPressed ? RGPens.White : System.Drawing.Pens.DimGray, new System.Drawing.Point[] {
                new System.Drawing.Point(rect.Left + 1, rect.Bottom - 1),
                new System.Drawing.Point(rect.Right - 1, rect.Bottom - 1),
                new System.Drawing.Point(rect.Right - 1, rect.Top + 1),
            });
        }
Esempio n. 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="g"></param>
 public void draw(System.Drawing.Graphics g)
 {
     if (null != this.Points && this.Points.Length > 0)
     {
         g.DrawLines(System.Drawing.Pens.Black, this.Points);
     }
 }
Esempio n. 4
0
        private void DrawVObjectBounds(System.Drawing.Graphics g)
        {
            if (g == null)
            {
                throw new System.ArgumentNullException("g");
            }

            if (_objectBorderPen != null)
            {
                System.Drawing.RectangleF baseRect = _obj.GetVObjectBounds();
                System.Drawing.PointF[]   points   = new System.Drawing.PointF[5];
                points[0] = baseRect.Location;
                points[1] = new System.Drawing.PointF(baseRect.Right, baseRect.Top);
                points[2] = new System.Drawing.PointF(baseRect.Right, baseRect.Bottom);
                points[3] = new System.Drawing.PointF(baseRect.Left, baseRect.Bottom);
                points[4] = System.Drawing.PointF.Empty;

                VObjectsUtils.TransformPointsInplace(_obj.Transform, points);
                for (int i = 0; i < points.Length; i++)
                {
                    points[i] = _hostControl.WorkspaceToControl(points[i], Aurigma.GraphicsMill.Unit.Point);
                }

                points[points.Length - 1] = points[0];
                g.DrawLines(_objectBorderPen, points);
            }
        }
        internal void PrepareTextureForDrawDevice(IDrawDevice device)
        {
            System.Drawing.PointF[] points = new System.Drawing.PointF[_verticesPositions.Count];

            /**
             * Drawing texture based on displacement for each camera
             **/
            Vector3 start = _absoluteStart * device.GetScaleAtZ(_absoluteStart.Z);
            Vector3 end   = _absoluteEnd * device.GetScaleAtZ(_absoluteEnd.Z);

            Vector2 tangent = (end - start).Xy;
            float   length  = tangent.Length;

            for (int i = 0; i < points.Length; i++)
            {
                points[i] = new System.Drawing.PointF(_verticesPositions[i].X * length, _verticesPositions[i].Y);
            }

            System.Drawing.Bitmap pixelData = new System.Drawing.Bitmap((int)MathF.Ceiling(length), (int)MathF.Ceiling(_sway2));

            using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(pixelData))
            {
                g.Clear(System.Drawing.Color.Transparent);
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
                g.DrawLines(_pen, points);
            }

            if (!BatchInfos.ContainsKey(device))
            {
                BatchInfo bi = new BatchInfo(
                    DrawTechnique.Add,
                    Colors.White,
                    new ContentRef <Texture>(
                        new Texture(new ContentRef <Pixmap>(new Pixmap()))
                {
                    FilterMin   = TextureMinFilter.LinearMipmapLinear,
                    FilterMag   = TextureMagFilter.LinearSharpenSgis,
                    WrapX       = TextureWrapMode.ClampToEdge,
                    WrapY       = TextureWrapMode.ClampToEdge,
                    TexSizeMode = Texture.SizeMode.Stretch
                }));

                BatchInfos.Add(device, new BoltData()
                {
                    BatchInfo = bi
                });
            }

            BoltData bd = BatchInfos[device];

            Texture tx = bd.BatchInfo.MainTexture.Res;

            tx.BasePixmap.Res.MainLayer.FromBitmap(pixelData);
            tx.ReloadData();

            bd.Start   = start;
            bd.End     = end;
            bd.IsReady = true;
        }
Esempio n. 6
0
 public void Draw(System.Drawing.Graphics graphics)
 {
     graphics.DrawLines(System.Drawing.Pens.Black, new[]
     {
         new System.Drawing.PointF((float)Begin * Helpers.GraphSettings.scale + Helpers.GraphSettings.center_X, Helpers.GraphSettings.center_Y)
         , new System.Drawing.PointF((float)Top * Helpers.GraphSettings.scale + Helpers.GraphSettings.center_X, Helpers.GraphSettings.center_Y - Helpers.GraphSettings.scale)
     });
 }
Esempio n. 7
0
 public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
 {
     System.Drawing.Point[] points = new System.Drawing.Point[nPoints];
     for (int i = 0; i < nPoints; i++)
     {
         points[i] = new System.Drawing.Point(xPoints[i], yPoints[i]);
     }
     nativeGraphics.DrawLines(stroke.pen, points);
 }
Esempio n. 8
0
        /// <summary>
        /// Method to render the arrow
        /// </summary>
        /// <param name="map">The map</param>
        /// <param name="graphics">The graphics object</param>
        /// <param name="arrow">The arrow</param>
        private void RenderArrow(SharpMap.MapViewport map, System.Drawing.Graphics graphics, GeoAPI.Geometries.ILineString arrow)
        {
            var pts = new System.Drawing.PointF[arrow.Coordinates.Length];

            for (var i = 0; i < pts.Length; i++)
            {
                pts[i] = map.WorldToImage(arrow.GetCoordinateN(i));
            }
            graphics.DrawLines(ArrowPen, pts);
        }
Esempio n. 9
0
 private static void DrawRandomLines(System.Drawing.Graphics g, System.Random rand)
 {
     using (System.Drawing.SolidBrush green = new System.Drawing.SolidBrush(System.Drawing.Color.Green))
     {
         //For Creating Lines on The Captcha
         for (int i = 0; i < 20; i++)
         {
             g.DrawLines(new System.Drawing.Pen(green, 2), GetRandomPoints(rand));
         }
     }
 }
Esempio n. 10
0
        private void DrawCorner(System.Drawing.Pen pen, System.Drawing.Graphics gr, System.Drawing.Point corner, int xDiff, int yDiff)
        {
            var lines = new System.Drawing.Point[]
            {
                new System.Drawing.Point(corner.X + xDiff, corner.Y),
                corner,
                new System.Drawing.Point(corner.X, corner.Y + yDiff)
            };

            gr.DrawLines(pen, lines);
        }
Esempio n. 11
0
 private void DrawRandomLines(System.Drawing.Graphics g)
 {
     using (System.Drawing.SolidBrush green =
                new System.Drawing.SolidBrush(System.Drawing.Color.Blue))
     {
         for (int i = 0; i < 30; i++)
         {
             using (System.Drawing.Pen p = new System.Drawing.Pen(green, 2))
             {
                 g.DrawLines(p, GetRandomPoints());
             }
         }
     }
 }
Esempio n. 12
0
        public void Draw(System.Drawing.Graphics graphics, System.Drawing.Brush brush)
        {
            foreach (Link link in net.Links)
            {
                var w = link.Wrap();

                if (!pencilBox.Keys.Contains(w.Height))
                {
                    pencilBox[w.Height] = new System.Drawing.Pen(brush, (float)w.Height);
                }

                graphics.DrawLines(pencilBox[w.Height], w.LineF);
            }
        }
Esempio n. 13
0
 private static void DrawLines(System.Drawing.Graphics graphics, Line[] lines)
 {
     for (int i = 0; i < lines.Length; i++)
     {
         System.Drawing.PointF[] points = new System.Drawing.PointF[lines[i].Points.Length];
         for (int j = 0; j < lines[i].Points.Length; j++)
         {
             points[j].X = lines[i].Points[j].X;
             points[j].Y = lines[i].Points[j].Y;
         }
         if (lines[i].Pen.Width >= 2 && graphics.SmoothingMode != System.Drawing.Drawing2D.SmoothingMode.HighQuality)
         {
             graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
         }
         graphics.DrawLines(lines[i].Pen, points);
     }
     graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;
 }
        public override void Draw(System.Drawing.Graphics g)
        {
            if (g == null)
            {
                throw new System.ArgumentNullException("g");
            }

            if (_points.Count > 0)
            {
                System.Drawing.Point[] points = GetViewportPoints(_points.Count + 1);
                points[points.Length - 1] = _viewportMousePosition;

                if (_closePath)
                {
                    if (base.Brush != null)
                    {
                        System.Drawing.Drawing2D.Matrix prevBrushMatrix = PathVObjectCreateDesigner.AdaptBrushToViewport(base.Brush, this.VObjectHost.HostViewer);
                        try
                        {
                            g.FillPolygon(base.Brush, points, _fillMode);
                        }
                        finally
                        {
                            if (prevBrushMatrix != null)
                            {
                                VObjectsUtils.SetBrushMatrix(base.Brush, prevBrushMatrix);
                            }
                        }
                    }
                    if (base.Pen != null)
                    {
                        g.DrawPolygon(base.CreateViewportPen(), points);
                    }
                }
                else
                {
                    if (base.Pen != null)
                    {
                        g.DrawLines(base.CreateViewportPen(), points);
                    }
                }
            }
        }
        public override void Draw(System.Drawing.Graphics g)
        {
            if (g == null)
            {
                throw new System.ArgumentNullException("g");
            }

            if (_points.Count > 1)
            {
                using (System.Drawing.Pen pen = CreateViewportPen())
                {
                    System.Drawing.Point[] points = (System.Drawing.Point[])_points.ToArray(typeof(System.Drawing.Point));

                    if (_closePath)
                    {
                        if (base.Brush != null)
                        {
                            System.Drawing.Drawing2D.Matrix prevBrushMatrix = PathVObjectCreateDesigner.AdaptBrushToViewport(base.Brush, base.VObjectHost.HostViewer);
                            try
                            {
                                g.FillPolygon(base.Brush, points, _fillMode);
                            }
                            finally
                            {
                                if (prevBrushMatrix != null)
                                {
                                    VObjectsUtils.SetBrushMatrix(base.Brush, prevBrushMatrix);
                                }
                            }
                        }
                        g.DrawPolygon(pen, points);
                    }
                    else
                    {
                        g.DrawLines(pen, points);
                    }
                }
            }
        }
Esempio n. 16
0
        public static void drawCrossSection2(List <double> xs, List <double> ys, double w_height, System.Windows.Forms.Panel panel)
        {
            double maxX      = xs.Max();
            double maxY      = ys.Max();
            double width     = maxX - xs.Min();
            double maxheight = maxY - ys.Min();
            double xscale    = panel.Width / width;
            double yscale    = panel.Height / maxheight;

            System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Tan, 3);

            System.Drawing.SolidBrush waterFill    = new System.Drawing.SolidBrush(System.Drawing.Color.AliceBlue);
            System.Drawing.Graphics   crossSection = panel.CreateGraphics();
            crossSection.ScaleTransform((float)xscale, (float)yscale);
            System.Drawing.PointF[] points = new System.Drawing.PointF[xs.Count];

            for (int i = 0; i < xs.Count - 1; i++)
            {
                double y  = maxY - ys[i];
                double y2 = maxY - ys[i + 1];
                double x  = xs[i];
                if (x == maxX)
                {
                    points[i] = new System.Drawing.PointF((float)x, (float)maxY);
                }
                else
                {
                    points[i] = new System.Drawing.PointF((float)x, (float)y);
                }
                if (xs[i + 1] == maxX)
                {
                    points[i + 1] = new System.Drawing.PointF((float)x, (float)maxY);
                }
            }
            crossSection.DrawLines(pen, points);
        }