Beispiel #1
0
        protected override void OnPaint(PaintEventArgs pe)
        {
            if (viewDrawing == null)
            {
                base.OnPaint(pe);
                return;
            }

            try
            {
                using (var g = new LJD.Graphics(backBufferCanvas.Graphics, ownsGraphics: false))
                {
                    g.FillRectangle(graphicsResources.DefaultBackgroundBrush, LJD.PrimitivesExtensions.ToRectangle(pe.ClipRectangle));

                    UpdateDrawContextScrollPos();

                    int maxRight;
                    viewDrawing.PaintControl(g, LJD.PrimitivesExtensions.ToRectangle(pe.ClipRectangle), this.Focused, out maxRight);

                    backBufferCanvas.Render(pe.Graphics);

                    UpdateScrollSize(maxRight);
                }
            }
            catch (Exception e)
            {
                if (viewModel != null)
                {
                    viewModel.OnDrawingError(e);
                }
                throw;
            }

            base.OnPaint(pe);
        }
Beispiel #2
0
 ViewPart GetViewPart(object sender, System.Drawing.Point pt)
 {
     if (sender == plotsPanel)
     {
         return new ViewPart()
                {
                    Part = ViewPart.PartId.Plots
                }
     }
     ;
     else if (sender == xAxisPanel)
     {
         return new ViewPart()
                {
                    Part   = ViewPart.PartId.XAxis,
                    AxisId = eventsHandler.OnDrawPlotsArea().XAxis.Id,
                }
     }
     ;
     else if (sender == yAxisPanel)
     {
         using (var g = new LJD.Graphics(yAxisPanel.CreateGraphics(), ownsGraphics: true))
             return new ViewPart()
                    {
                        Part   = ViewPart.PartId.YAxis,
                        AxisId = Drawing.GetYAxisId(g, resources, eventsHandler.OnDrawPlotsArea(), pt.X, yAxisPanel.Width)
                    }
     }
     ;
     return(new ViewPart());
 }
Beispiel #3
0
        public static void DrawYAxes(LJD.Graphics g, Resources resources, PlotsDrawingData pdd, float yAxesAreaWidth, PlotsViewMetrics m)
        {
            float x    = yAxesAreaWidth;
            var   font = resources.AxesFont;

            foreach (var axis in pdd.YAxes)
            {
                float maxLabelWidth = 0;
                foreach (var p in axis.Points)
                {
                    var pt = new PointF(x - (p.IsMajorMark ? resources.MajorAxisMarkSize : resources.MinorAxisMarkSize), p.Position);
                    g.DrawLine(resources.AxesPen, pt, new PointF(x, p.Position));
                    if (p.Label != null)
                    {
                        g.DrawString(p.Label, font, resources.DataPointLabelBrush, pt, resources.YAxisPointLabelFormat);
                    }
                    maxLabelWidth = Math.Max(maxLabelWidth, g.MeasureString(p.Label ?? "", resources.AxesFont).Width);
                }
                x -= (resources.MajorAxisMarkSize + maxLabelWidth);
                g.PushState();
                g.TranslateTransform(x, m.Size.Height / 2);
                g.RotateTransform(-90);
                g.DrawString(axis.Label, resources.AxesFont, resources.DataPointLabelBrush, new PointF(0, 0), resources.YAxisLabelFormat);
                g.PopState();
                x -= (g.MeasureString(axis.Label, resources.AxesFont).Height + resources.YAxesPadding);
            }
        }
Beispiel #4
0
        public static void DrawFocusedMessage(
            LJD.Graphics g,
            ViewMetrics viewMetrics,
            IViewEvents eventsHandler,
            DrawScope scope,
            Size sz)
        {
            var pos = eventsHandler.OnDrawFocusedMessage(scope);

            if (pos == null)
            {
                return;
            }
            if (pos.Value < 0 || pos.Value > 1)
            {
                return;
            }
            var x = (int)(pos.Value * (double)sz.Width);

            g.DrawLine(viewMetrics.FocusedMessagePen, x, 0, x, sz.Height);
            var img   = viewMetrics.FocusedMessageLineTop;
            var imgsz = img.GetSize(height: 4f);

            g.DrawImage(img, new RectangleF
                            (x - imgsz.Width / 2, 1, imgsz.Width, imgsz.Height));
        }
Beispiel #5
0
 public static void DrawEvents(
     LJD.Graphics g,
     ViewMetrics viewMetrics,
     IViewEvents eventsHandler)
 {
     foreach (var evt in Metrics.GetEventMetrics(g, eventsHandler, viewMetrics))
     {
         if (evt.VertLinePoints != null)
         {
             g.PushState();
             g.EnableAntialiasing(true);
             g.DrawLines(viewMetrics.UserEventPen, evt.VertLinePoints);
             g.PopState();
         }
         else
         {
             g.DrawLine(viewMetrics.UserEventPen, evt.VertLineA, evt.VertLineB);
         }
         if (evt.Icon != null)
         {
             g.DrawImage(evt.Icon, evt.IconRect);
         }
         g.FillRectangle(viewMetrics.EventRectBrush, evt.CaptionRect);
         g.DrawRectangle(viewMetrics.EventRectPen, evt.CaptionRect);
         g.DrawString(evt.Event.Caption, viewMetrics.EventCaptionFont,
                      viewMetrics.EventCaptionBrush, evt.CaptionDrawingOrigin,
                      viewMetrics.EventCaptionStringFormat);
     }
 }
Beispiel #6
0
        public CaptionsMarginMetrics ComputeCaptionsMarginMetrics(
            LJD.Graphics g,
            IViewModel eventsHandler
            )
        {
            var   viewMetrics  = this;
            float maxTextWidth = 0;
            bool  needsFolding = false;

            if (eventsHandler != null)
            {
                foreach (var a in eventsHandler.OnDrawActivities())
                {
                    if (!string.IsNullOrEmpty(a.SequenceDiagramText))
                    {
                        var w = g.MeasureString(a.SequenceDiagramText, res.ActivitesCaptionsFont).Width;
                        maxTextWidth = Math.Max(maxTextWidth, w);
                    }
                    if (a.IsFolded != null)
                    {
                        needsFolding = true;
                    }
                }
            }
            return(new CaptionsMarginMetrics()
            {
                SequenceDiagramAreaWidth = Math.Min((int)Math.Ceiling(maxTextWidth), viewMetrics.ActivitesCaptionsViewWidth / 2),
                FoldingAreaWidth = needsFolding ? 10 : 0
            });
        }
        void DrawFocusedMessage()
        {
            Tuple <int, int> focused = owner.ViewModel.OnDrawFocusedMessageMark();

            if (focused != null)
            {
                var   frame = this.Frame.ToRectangleF();
                float y;
                float itemH    = frame.Height;
                SizeF markSize = UIUtils.FocusedItemMarkFrame.Size;
                if (focused.Item1 != focused.Item2)
                {
                    y = itemH * focused.Item1 + itemH / 2;
                }
                else
                {
                    y = itemH * focused.Item1;
                }
                if (Math.Abs(y) < .01f)
                {
                    y = markSize.Height / 2;
                }
                y -= frame.Y;
                using (var g = new LogJoint.Drawing.Graphics())
                {
                    UIUtils.DrawFocusedItemMark(g,
                                                (float)owner.HistoryTableView.GetCellFrame(1, row).Left - 2, y, drawOuterFrame: true);
                }
            }
        }
Beispiel #8
0
 void DrawCaptionsView(RectangleF dirtyRect)
 {
     using (var g = new LJD.Graphics()) {
         drawing.Value.DrawCaptionsView(
             g,
             MakeViewMetrics(),
             model,
             (captionText, captionRect, highlightBegin, highlightLen, isError) => {
             var attrString = new NSMutableAttributedString(captionText);
             attrString.AddAttribute(NSStringAttributeKey.ParagraphStyle, new NSMutableParagraphStyle()
             {
                 LineBreakMode = NSLineBreakMode.TruncatingTail,
                 TighteningFactorForTruncation = 0
             }, new NSRange(0, captionText.Length));
             if (isError)
             {
                 attrString.AddAttribute(NSStringAttributeKey.ForegroundColor, NSColor.Red,
                                         new NSRange(0, captionText.Length));
             }
             else
             {
                 attrString.AddAttribute(NSStringAttributeKey.ForegroundColor, NSColor.Text,
                                         new NSRange(0, captionText.Length));
             }
             if (highlightLen > 0 && highlightBegin >= 0 && (highlightBegin + highlightLen <= captionText.Length))
             {
                 var r = new NSRange(highlightBegin, highlightLen);
                 attrString.AddAttribute(NSStringAttributeKey.BackgroundColor, NSColor.Yellow, r);
                 attrString.AddAttribute(NSStringAttributeKey.ForegroundColor, NSColor.Black, r);
             }
             attrString.DrawString(captionRect.ToCGRect());
         }
             );
     }
 }
Beispiel #9
0
        public IEnumerable <RoleCaptionMetrics> GetRoleCaptionsMetrics(LJD.Graphics g)
        {
            if (eventsHandler == null)
            {
                yield break;
            }

            foreach (var role in eventsHandler.RolesDrawInfo)
            {
                if (role.Bounds.Width < 2)
                {
                    continue;
                }
                var   sz      = g.MeasureString(role.DisplayName, resources.Font, resources.RoleCaptionFormat, role.Bounds.Size);
                float padding = 3;
                sz.Width = Math.Min(
                    Math.Max(sz.Width + padding, role.Bounds.Height),
                    role.Bounds.Width
                    );
                yield return(new RoleCaptionMetrics()
                {
                    DrawInfo = role,
                    Box = new Rectangle(
                        role.X - (int)sz.Width / 2,
                        role.Bounds.Y,
                        (int)sz.Width,
                        role.Bounds.Height
                        ),
                    IsLink = role.LogSourceTrigger != null,
                    IsFocused = role.ContainsFocusedMessage
                });
            }
        }
Beispiel #10
0
            void DrawFocusedMessage()
            {
                Tuple <int, int> focused = owner.viewModel.FocusedMessagePosition;

                if (focused != null)
                {
                    var   frame = this.Frame;
                    float y;
                    float itemH    = (float)frame.Height;
                    SizeF markSize = UIUtils.FocusedItemMarkFrame.Size;
                    if (focused.Item1 != focused.Item2)
                    {
                        y = itemH * focused.Item1 + itemH / 2;
                    }
                    else
                    {
                        y = itemH * focused.Item1;
                    }
                    var maxY = itemH * owner.dataSource.items.Count;
                    if (Math.Abs(y) < .01f)
                    {
                        y = markSize.Height / 2;
                    }
                    else if (y >= maxY - 0.0f)
                    {
                        y = maxY - markSize.Height / 2;
                    }
                    y -= (float)frame.Y;
                    using (var g = new LogJoint.Drawing.Graphics())
                        UIUtils.DrawFocusedItemMark(g,
                                                    (float)owner.tableView.GetCellFrame(1, row).Left, y);
                }
            }
Beispiel #11
0
 void IView.UpdateSequenceDiagramAreaMetrics()
 {
     using (var g = new LJD.Graphics(CreateGraphics(), ownsGraphics: true))
     {
         sequenceDiagramAreaWidth = Metrics.GetSequenceDiagramAreaMetrics(g, GetUpToDateViewMetrics(), eventsHandler);
     }
 }
Beispiel #12
0
        public static void DrawActivities(LJD.Graphics g, ViewMetrics viewMetrics, IViewEvents eventsHandler)
        {
            PushGraphicsStateForDrawingActivites(g, viewMetrics, HitTestResult.AreaCode.ActivitiesPanel);

            foreach (var a in Metrics.GetActivitiesMetrics(viewMetrics, eventsHandler))
            {
                g.FillRectangle(GetActivityBrush(viewMetrics, a.Activity.Type), a.ActivityBarRect);

                foreach (var ph in a.Phases)
                {
                    var phaseMargin = a.ActivityBarRect.Height / 3;
                    g.FillRectangle(ph.Brush, ph.X1, a.ActivityBarRect.Top + phaseMargin,
                                    Math.Max(ph.X2 - ph.X1, 2), a.ActivityBarRect.Height - phaseMargin - 2);
                }

                foreach (var ms in a.Milestones)
                {
                    g.DrawLine(viewMetrics.MilestonePen, ms.X, a.ActivityBarRect.Top, ms.X, a.ActivityBarRect.Bottom);
                }

                g.DrawRectangle(viewMetrics.ActivityBarBoundsPen, a.ActivityBarRect);

                if (a.PairedActivityConnectorBounds != null)
                {
                    var r = a.PairedActivityConnectorBounds.Value;
                    g.DrawLine(viewMetrics.ActivitiesConnectorPen, r.Left, r.Top, r.Left, r.Bottom);
                    g.DrawLine(viewMetrics.ActivitiesConnectorPen, r.Right, r.Top, r.Right, r.Bottom);
                }
            }

            g.PopState();
        }
Beispiel #13
0
        protected override void OnPaint(PaintEventArgs pe)
        {
            if (viewModel == null)
            {
                return;
            }
            using (var g = new LJD.Graphics(pe.Graphics))
            {
                drawing.FillBackground(g, pe.ClipRectangle.ToRectangle());

                Metrics m = GetMetrics();

                var drawInfo = viewModel.OnDraw();
                if (drawInfo == null)
                {
                    return;
                }

                drawing.DrawSources(g, drawInfo);
                drawing.DrawContainerControls(g, drawInfo);
                drawing.DrawRulers(g, m, drawInfo);
                drawing.DrawDragAreas(g, m, drawInfo);
                drawing.DrawBookmarks(g, m, drawInfo);
                drawing.DrawCurrentViewTime(g, m, drawInfo);
                drawing.DrawHotTrackRange(g, m, drawInfo);
                drawing.DrawHotTrackDate(g, m, drawInfo);

                DrawFocusRect(pe.Graphics, drawInfo);
            }

            base.OnPaint(pe);
        }
Beispiel #14
0
        public IEnumerable <BookmarkMetrics> GetBookmarksMetrics(LJD.Graphics g, IViewModel eventsHandler)
        {
            var    viewMetrics    = this;
            double availableWidth = viewMetrics.ActivitiesViewWidth;

            foreach (var bmk in eventsHandler.OnDrawBookmarks(DrawScope.VisibleRange))
            {
                if (bmk.X < 0 || bmk.X > 1)
                {
                    continue;
                }

                BookmarkMetrics m = new BookmarkMetrics()
                {
                    Bookmark = bmk
                };

                int x          = SafeGetScreenX(bmk.X, availableWidth);
                int bmkLineTop = viewMetrics.RulersPanelHeight - 7;
                m.VertLineA = new Point(x, bmkLineTop);
                m.VertLineB = new Point(x, viewMetrics.ActivitiesViewHeight);

                m.Icon = res.BookmarkIcon;
                var sz = m.Icon.GetSize(height: 5.1f).Scale(viewMetrics.DPIScale);
                m.IconRect = new RectangleF(
                    x - sz.Width / 2, bmkLineTop - sz.Height, sz.Width, sz.Height);

                yield return(m);
            }
        }
Beispiel #15
0
 void IView.UpdateSequenceDiagramAreaMetrics()
 {
     using (var g = new LJD.Graphics(CreateGraphics(), ownsGraphics: true))
     {
         captionsMarginMetrics = GetUpToDateViewMetrics().ComputeCaptionsMarginMetrics(g, viewModel);
     }
 }
Beispiel #16
0
        void IView.UpdateFontDependentData(string fontName, LogFontSize fontSize)
        {
            if (drawContext.Font != null)
            {
                drawContext.Font.Dispose();
            }

            var oldDpp = drawContext.LineHeight > 0 ? ((IView)this).DisplayLinesPerPage : 0;

            drawContext.Font = new LJD.Font(GetFontFamily(fontName).Name, ToFontEmSize(fontSize));

            using (var nativeGraphics = CreateGraphics())
                using (var tmp = new LJD.Graphics(nativeGraphics))
                {
                    int count = 8 * 1024;
                    drawContext.CharSize = tmp.MeasureString(new string('0', count), drawContext.Font);
                    drawContext.CharWidthDblPrecision = (double)drawContext.CharSize.Width / (double)count;
                    drawContext.CharSize.Width       /= (float)count;
                    drawContext.LineHeight            = (int)Math.Floor(drawContext.CharSize.Height);
                }

            UpdateTimeAreaSize();

            if (oldDpp != 0 && oldDpp != ((IView)this).DisplayLinesPerPage && viewEvents != null)
            {
                viewEvents.OnDisplayLinesPerPageChanged();
            }
        }
Beispiel #17
0
 void DrawNavigationPanel(RectangleF dirtyRect)
 {
     using (var g = new LJD.Graphics())
     {
         Drawing.DrawNavigationPanel(g, viewMetrics, eventsHandler);
     }
 }
Beispiel #18
0
 void DrawCaptionsView(RectangleF dirtyRect)
 {
     using (var g = new LJD.Graphics()) {
         Drawing.DrawCaptionsView(
             g,
             viewMetrics,
             eventsHandler,
             sequenceDiagramAreaWidth,
             (captionText, captionRect, highlightBegin, highlightLen, isError) =>
         {
             var attrString = new NSMutableAttributedString(captionText);
             attrString.AddAttribute(NSStringAttributeKey.ParagraphStyle, new NSMutableParagraphStyle()
             {
                 LineBreakMode = NSLineBreakMode.TruncatingTail,
                 TighteningFactorForTruncation = 0
             }, new NSRange(0, captionText.Length));
             if (isError)
             {
                 attrString.AddAttribute(NSStringAttributeKey.ForegroundColor, NSColor.Red,
                                         new NSRange(0, captionText.Length));
             }
             if (highlightLen > 0 && highlightBegin >= 0 && (highlightBegin + highlightLen <= captionText.Length))
             {
                 attrString.AddAttribute(NSStringAttributeKey.BackgroundColor, NSColor.Yellow,
                                         new NSRange(highlightBegin, highlightLen));
             }
             attrString.DrawString(LJD.Extensions.ToCGRect(captionRect));
         }
             );
     }
 }
Beispiel #19
0
        public void DrawCaptionsView(
            LJD.Graphics g,
            ViewMetrics viewMetrics,
            IViewModel eventsHandler,
            Action <string, Rectangle, int, int, bool> drawCaptionWithHighlightedRegion
            )
        {
            PushGraphicsStateForDrawingActivites(g, viewMetrics, HitTestResult.AreaCode.CaptionsPanel);

            int  availableHeight = viewMetrics.ActivitiesViewHeight;
            bool darkMode        = eventsHandler.ColorTheme == Presenters.ColorThemeMode.Dark;

            foreach (var a in eventsHandler.OnDrawActivities())
            {
                int y = viewMetrics.GetActivityY(a.Index);
                if (y < 0)
                {
                    continue;
                }
                if (y > availableHeight)
                {
                    break;
                }

                var h = viewMetrics.LineHeight - 1;
                var sequenceDiagramTextRect = new Rectangle(0, y, viewMetrics.SequenceDiagramAreaWidth, h);
                var foldingAreaRect         = new Rectangle(
                    sequenceDiagramTextRect.Right + 1 /* box padding */, y + (h - viewMetrics.FoldingAreaWidth) / 2, viewMetrics.FoldingAreaWidth, viewMetrics.FoldingAreaWidth);
                var textRect = new Rectangle(
                    foldingAreaRect.Right + 3 /* text padding */, y, viewMetrics.ActivitesCaptionsViewWidth - foldingAreaRect.Right, h);
                var lineRect = new Rectangle(0, y, viewMetrics.ActivitesCaptionsViewWidth, h);
                if (a.IsSelected)
                {
                    g.FillRectangle(res.SelectedActivityBackgroundBrush, lineRect);
                }
                else if (!darkMode && a.Color.HasValue)
                {
                    using (var bgBrush = MakeBrush(a.Color.Value))
                        g.FillRectangle(bgBrush, lineRect);
                }
                if (!string.IsNullOrEmpty(a.SequenceDiagramText))
                {
                    g.DrawString(a.SequenceDiagramText, res.ActivitesCaptionsFont, res.ActivitesCaptionsBrush, sequenceDiagramTextRect);
                }
                if (a.IsFolded.HasValue)
                {
                    g.DrawRectangle(res.FoldingSignPen, foldingAreaRect);
                    int pad = 2;
                    g.DrawLine(res.FoldingSignPen, foldingAreaRect.Left + pad, foldingAreaRect.MidY(), foldingAreaRect.Right - pad, foldingAreaRect.MidY());
                    if (a.IsFolded == true)
                    {
                        g.DrawLine(res.FoldingSignPen, foldingAreaRect.MidX(), foldingAreaRect.Top + pad, foldingAreaRect.MidX(), foldingAreaRect.Bottom - pad);
                    }
                }
                drawCaptionWithHighlightedRegion(a.Caption, textRect, a.CaptionSelectionBegin, a.CaptionSelectionLength, a.IsError);
            }

            g.PopState();
        }
Beispiel #20
0
 private void navigationPanel_Paint(object sender, PaintEventArgs e)
 {
     if (eventsHandler == null)
     {
         return;
     }
     using (var g = new LJD.Graphics(e.Graphics))
         Drawing.DrawNavigationPanel(g, GetUpToDateViewMetrics(), eventsHandler);
 }
 void PaintRolesCaptionsView(RectangleF dyrtyRect)
 {
     if (drawingUtils == null)
     {
         return;
     }
     using (var g = new LJD.Graphics())
         drawingUtils.DrawRoleCaptions(g);
 }
 private void leftPanel_Paint(object sender, PaintEventArgs e)
 {
     if (drawingUtils == null)
     {
         return;
     }
     using (var g = new LJD.Graphics(e.Graphics))
         drawingUtils.DrawLeftPanelView(g, leftPanel.PointToClient(arrowsPanel.PointToScreen(new System.Drawing.Point())).ToPoint(), leftPanel.ClientSize.ToSize());
 }
 private void rolesCaptionsPanel_Paint(object sender, PaintEventArgs e)
 {
     if (drawingUtils == null)
     {
         return;
     }
     using (var g = new LJD.Graphics(e.Graphics))
         drawingUtils.DrawRoleCaptions(g);
 }
Beispiel #24
0
 void IView.UpdateYAxesSize()
 {
     using (var g = new LJD.Graphics(yAxisPanel.CreateGraphics(), ownsGraphics: true))
     {
         var width = Drawing.GetYAxesMetrics(g, resources, eventsHandler.OnDrawPlotsArea()).Select(x => x.Width).Sum();
         mainLayoutPanel.ColumnStyles[mainLayoutPanel.GetColumn(yAxisPanel)] =
             new ColumnStyle(SizeType.Absolute, Math.Max(width, mainLayoutPanel.Margin.Right));
     }
 }
Beispiel #25
0
 public static void DrawFocusedItemMark(LJD.Graphics g, float x, float y, bool drawOuterFrame = false)
 {
     if (drawOuterFrame)
     {
         g.FillPolygon(white, MakeFocusedItemMarkPoints(x - 1f, y, new SizeF(
                                                            FocusedItemMarkFrame.Size.Width + 2.3f, FocusedItemMarkFrame.Size.Height + 4.4f)));
     }
     g.FillPolygon(blue, MakeFocusedItemMarkPoints(x, y, FocusedItemMarkFrame.Size));
 }
Beispiel #26
0
 private void activitiesViewPanel_Paint(object sender, PaintEventArgs e)
 {
     e.Graphics.FillRectangle(System.Drawing.Brushes.White, e.ClipRectangle);
     if (viewModel == null)
     {
         return;
     }
     using (var g = new LJD.Graphics(e.Graphics))
         drawing.DrawActivtiesView(g, GetUpToDateViewMetrics(), viewModel);
 }
Beispiel #27
0
        private void legendLabel_Paint(object sender, PaintEventArgs e)
        {
            var ctrl = (Control)sender;
            var data = (LegendItemInfo)ctrl.Tag;
            int w    = ctrl.Padding.Left;
            int pad  = 3;

            using (var g = new LJD.Graphics(e.Graphics))
                Drawing.DrawLegendSample(g, resources, data.Color, data.Marker, new RectangleF(pad, pad, w - pad * 2, ctrl.Height - pad * 2));
        }
Beispiel #28
0
 private void activitiesViewPanel_Paint(object sender, PaintEventArgs e)
 {
     e.Graphics.FillRectangle(Brushes.White, e.ClipRectangle);
     if (eventsHandler == null)
     {
         return;
     }
     using (var g = new LJD.Graphics(e.Graphics))
         Drawing.DrawActivtiesView(g, GetUpToDateViewMetrics(), eventsHandler);
 }
Beispiel #29
0
        static void DrawPlotMarker(LJD.Graphics g, Resources resources, LJD.Pen pen, PointF p, MarkerType markerType)
        {
            float markerSize = resources.MarkerSize;

            switch (markerType)
            {
            case MarkerType.Cross:
                g.DrawLine(pen, new PointF(p.X - markerSize, p.Y - markerSize), new PointF(p.X + markerSize, p.Y + markerSize));
                g.DrawLine(pen, new PointF(p.X - markerSize, p.Y + markerSize), new PointF(p.X + markerSize, p.Y - markerSize));
                break;

            case MarkerType.Circle:
                g.DrawEllipse(pen, new RectangleF(p.X - markerSize, p.Y - markerSize, markerSize * 2, markerSize * 2));
                break;

            case MarkerType.Square:
                g.DrawRectangle(pen, new RectangleF(p.X - markerSize, p.Y - markerSize, markerSize * 2, markerSize * 2));
                break;

            case MarkerType.Diamond:
                g.DrawLines(pen, new[]
                {
                    new PointF(p.X - markerSize, p.Y),
                    new PointF(p.X, p.Y - markerSize),
                    new PointF(p.X + markerSize, p.Y),
                    new PointF(p.X, p.Y + markerSize),
                    new PointF(p.X - markerSize, p.Y),
                });
                break;

            case MarkerType.Triangle:
                g.DrawLines(pen, new[]
                {
                    new PointF(p.X - markerSize, p.Y + markerSize / 2),
                    new PointF(p.X, p.Y - markerSize),
                    new PointF(p.X + markerSize, p.Y + markerSize / 2),
                    new PointF(p.X - markerSize, p.Y + markerSize / 2),
                });
                break;

            case MarkerType.Plus:
                g.DrawLine(pen, new PointF(p.X - markerSize, p.Y), new PointF(p.X + markerSize, p.Y));
                g.DrawLine(pen, new PointF(p.X, p.Y - markerSize), new PointF(p.X, p.Y + markerSize));
                break;

            case MarkerType.Star:
                // plus
                g.DrawLine(pen, new PointF(p.X - markerSize, p.Y), new PointF(p.X + markerSize, p.Y));
                g.DrawLine(pen, new PointF(p.X, p.Y - markerSize), new PointF(p.X, p.Y + markerSize));
                // cross
                g.DrawLine(pen, new PointF(p.X - markerSize, p.Y - markerSize), new PointF(p.X + markerSize, p.Y + markerSize));
                g.DrawLine(pen, new PointF(p.X - markerSize, p.Y + markerSize), new PointF(p.X + markerSize, p.Y - markerSize));
                break;
            }
        }
Beispiel #30
0
 public void HandleRoleCaptionsMouseDown(LJD.Graphics g, Point pt)
 {
     foreach (var role in GetRoleCaptionsMetrics(g))
     {
         if (role.IsLink && role.Box.Contains(pt))
         {
             eventsHandler.OnTriggerClicked(role.DrawInfo.LogSourceTrigger);
             return;
         }
     }
 }