public void NavigateTo(bool usePreviewPane = true) { if (LineMarker != null) { LineMarker?.NavigateTo(usePreviewPane); } else { // The user clicked an inline link with an integer target, which points to // a Location object that does NOT have a region associated with it. // Before anything else, see if this is an external link we should open in the browser. if (Uri.TryCreate(this.FilePath, UriKind.Absolute, out Uri uri)) { if (!uri.IsFile) { System.Diagnostics.Process.Start(uri.OriginalString); return; } } if (!File.Exists(this.FilePath)) { CodeAnalysisResultManager.Instance.TryRebaselineAllSarifErrors(RunId, this.UriBaseId, this.FilePath); } if (File.Exists(this.FilePath)) { SdkUIUtilities.OpenDocument(SarifViewerPackage.ServiceProvider, this.FilePath, usePreviewPane); } } }
public override void OnLeftMouseButtonDown(MarkerSet.Location clickLocation, Vector imageCor, Vector imageSizePixel) { // selection? if (_hoveredStartPoint >= 0 || _hoveredEndPoint >= 0) { _dragedEndPoint = _hoveredEndPoint; _dragedStartPoint = _hoveredStartPoint; return; } // add new _dragBoth = true; _dragedEndPoint = _markerList.Count; LineMarker newLine = new LineMarker() { StartMarker = new Line() { Start = imageCor, End = imageCor + new Vector(MIN_LINE_LENGTH, 0.0) }, EndMarker = new Line() { Start = imageCor, End = imageCor + new Vector(MIN_LINE_LENGTH, 0.0) }, InterpolatedMarker = new Line() { Start = imageCor, End = imageCor } }; _markerList.Add(newLine); }
public void OnDeselectKeyEvent() { // Remove hover marker LineMarker.RemoveMarker(); // Add default marker instead LineMarker.NavigateTo(true, null, false); }
public void ApplyDefaultSourceFileHighlighting() { // Remove hover marker LineMarker?.RemoveHighlightMarker(); // Add default marker instead LineMarker?.AddHighlightMarker(DefaultSourceHighlightColor); }
void CreateMarker() { marker = new LineMarker(financialChart1); marker.Lines = LineMarkerLines.Both; marker.Visible = ucToolbar.IsLineMarkerChecked; marker.LineWidth = 1; marker.DragThreshold = 10; marker.Paint += lineMarker_Paint; }
void flexChart1_Rendered(object sender, RenderEventArgs e) { if (lineMarker == null) { lineMarker = new LineMarker(flexChart1); lineMarker.LineWidth = 2; lineMarker.DragThreshold = 10; lineMarker.Paint += lineMarker_Paint; } }
/// <summary> /// An overridden method for reacting to the event of a document window /// being opened /// </summary> internal void AttachToDocument(string documentName, long docCookie, IVsWindowFrame frame) { // For these cases, this event has nothing to do with this item if (frame == null || LineMarker.IsTracking(docCookie) || string.Compare(documentName, FilePath, StringComparison.OrdinalIgnoreCase) != 0) { return; } AttachToDocumentWorker(frame, docCookie, LineMarker); }
private void FlexChart1_Rendered(object sender, RenderEventArgs e) { if (_lineMarker == null) { _lineMarker = new LineMarker(this.flexChart1) { LineWidth = 2, HorizontalPosition = 0.5, VerticalPosition = 0.5 }; _lineMarker.Paint += _lineMarker_Paint; } }
public CharacterManager Setup(LevelManager _man) { Anims ["walk"].wrapMode = WrapMode.Loop; Anims ["run"].wrapMode = WrapMode.Loop; Anims ["idle"].wrapMode = WrapMode.Loop; Manager = _man; Path = _man.Path; CurrentMarker = Path.LineList[1]; Anims.Play("walk"); Parts = GetComponentInChildren<ParticleSystem>(); return this; }
internal void RemoveMarkers() { LineMarker?.RemoveHighlightMarker(); foreach (AnnotatedCodeLocationModel location in Locations) { location.LineMarker?.RemoveHighlightMarker(); } foreach (AnnotatedCodeLocationModel location in RelatedLocations) { location.LineMarker?.RemoveHighlightMarker(); } foreach (CallTree callTree in CallTrees) { Stack <CallTreeNode> nodesToProcess = new Stack <CallTreeNode>(); foreach (CallTreeNode topLevelNode in callTree.TopLevelNodes) { nodesToProcess.Push(topLevelNode); } while (nodesToProcess.Count > 0) { CallTreeNode current = nodesToProcess.Pop(); try { current.LineMarker?.RemoveHighlightMarker(); } catch (ArgumentException) { // An argument exception is thrown if the node does not have a region. // Since there's no region, there's no document to attach to. // Just move on with processing the child nodes. } foreach (CallTreeNode childNode in current.Children) { nodesToProcess.Push(childNode); } } } foreach (StackCollection stackCollection in Stacks) { foreach (StackFrameModel stackFrame in stackCollection) { stackFrame.LineMarker?.RemoveHighlightMarker(); } } }
private void FlexChart1_Rendering(object sender, RenderEventArgs e) { if (_lineMarker == null) { _lineMarker = new LineMarker(this.flexChart1) { LineWidth = 2, DragThreshold = 10, Content = "High : {High:c}\nLow : {Low:c}", HorizontalPosition = 0.5, VerticalPosition = 0.5, }; _cbInteraction.SelectedItem = _lineMarker.Interaction; _cbLine.SelectedItem = _lineMarker.Lines; } }
void flexChart1_Rendered(object sender, RenderEventArgs e) { if (lineMarker == null) { lineMarker = new LineMarker(flexChart1); lineMarker.LineWidth = 2; lineMarker.DragThreshold = 10; lineMarker.Content = "Output={Output}\nInput={Input}"; lineMarker.VerticalPosition = 0.5; lineMarker.HorizontalPosition = 0.5; cbLines.SelectedIndex = 3; cbInteraction.SelectedIndex = 1; cbAlignment.SelectedIndex = 0; } }
internal bool HandleBreakPoint(DebugHookType type, string funcName, int line) { LineMarker breakPoint; if (type == DebugHookType.Line && m_BreakPointMarkers.TryGetValue(line, out breakPoint)) { Dispatcher.BeginInvoke((System.Threading.ThreadStart) delegate { if (m_ExecutingLineMarker == null) { var arrow = new Polygon() { Fill = Brushes.Yellow, Stroke = Brushes.DimGray, StrokeThickness = 0.9, }; var points = new PointCollection(); points.Add(new Point(3, 5.5)); points.Add(new Point(9, 5.5)); points.Add(new Point(9, 2)); points.Add(new Point(14, 8)); points.Add(new Point(9, 14)); points.Add(new Point(9, 10.5)); points.Add(new Point(3, 10.5)); arrow.Points = points; m_ExecutingLineMarker = new LineMarker() { UIElement = arrow }; m_BreakPointViewer.Children.Add(m_ExecutingLineMarker.UIElement); Canvas.SetZIndex(m_ExecutingLineMarker.UIElement, 10000); } double lineY = m_TextEdit.TextArea.TextView.GetVisualPosition(new TextViewPosition(line, 1), VisualYPosition.LineTop).Y; m_ExecutingLineMarker.UIElement.Visibility = System.Windows.Visibility.Visible; m_ExecutingLineMarker.UIElement.RenderTransform = new TranslateTransform(0, lineY); }, System.Windows.Threading.DispatcherPriority.Send); return(true); } return(false); }
public override void UpdateMarkerCanvas(Location location, Canvas imageCanvas, Vector imageOffsetPixel, Vector imageSizePixel) { // brute force way - todo: move exiting elements (identifing by name), delete obsolte ones and create new ones imageCanvas.Children.Clear(); // arrows for (int markerIdx = 0; markerIdx < _markerList.Count; ++markerIdx) { LineMarker marker = (LineMarker)_markerList[markerIdx]; var arrow = new Tomers.WPF.Shapes.ArrowShape(); arrow.HeadHeight = MarkerSet.MARKER_RENDER_SIZE / 2; arrow.HeadWidth = MarkerSet.MARKER_RENDER_SIZE; arrow.Stretch = Stretch.None; if (markerIdx == _dragedEndPoint || markerIdx == _dragedStartPoint) { arrow.Stroke = new SolidColorBrush(Colors.Red); } else if (markerIdx == _hoveredStartPoint || markerIdx == _hoveredEndPoint) { arrow.Stroke = new SolidColorBrush(Colors.DarkRed); } else { arrow.Stroke = new SolidColorBrush(Colors.Black); } arrow.StrokeThickness = 2; arrow.X1 = marker[location].Start.X * imageSizePixel.X; arrow.X2 = marker[location].End.X * imageSizePixel.X; arrow.Y1 = marker[location].Start.Y * imageSizePixel.Y; arrow.Y2 = marker[location].End.Y * imageSizePixel.Y; Canvas.SetLeft(arrow, imageOffsetPixel.X); Canvas.SetTop(arrow, imageOffsetPixel.Y); imageCanvas.Children.Add(arrow); } // points AddPointsToCanvases(Lines.Select(x => x[location].Start), _dragedStartPoint, _hoveredStartPoint, imageCanvas, imageOffsetPixel, imageSizePixel); AddPointsToCanvases(Lines.Select(x => x[location].End), _dragedEndPoint, _hoveredEndPoint, imageCanvas, imageOffsetPixel, imageSizePixel); }
public void RansacLineConstructorTest2() { Bitmap image = Properties.Resources.noise_line; ImageBox.Show(image); var detector = new SusanCornersDetector(); List <IntPoint> cloud = detector.ProcessImage(image); Bitmap marks = new PointsMarker(cloud, Color.Pink).Apply(image); ImageBox.Show(marks); RansacLine ransac = new RansacLine(5, 1e-10); Line line = ransac.Estimate(cloud); Bitmap result = new LineMarker(line).Apply(image); ImageBox.Show(result); Assert.Fail(); }
void lineMarker_PositionChanged(object sender, PositionChangedEventArgs e) { //Check sender LineMarker senderLineMarker = (LineMarker)sender; if (senderLineMarker == null) { return; } var newContent = String.Empty; var _hitTestInfo = flexChart1.HitTest(new Point(e.X, e.Y), C1.Chart.MeasureOption.X, -1); //set first line as X value newContent += _hitTestInfo.Format("{x}\r\n"); double total = 0; //add FlexChart series to Content foreach (Series serie in flexChart1.Series) { //get inputSerie values array var values = serie.GetValues(0); // check if array index exists if (_hitTestInfo.PointIndex > 0 && _hitTestInfo.PointIndex < values.Length) { newContent += String.Format("{0} - {1} \r\n", serie.Name, values[_hitTestInfo.PointIndex]); total += values[_hitTestInfo.PointIndex]; } } newContent += "Total: " + total; senderLineMarker.Content = newContent; }
/// <summary> /// A method for handling the event when this object is selected /// </summary> public void ApplySelectionSourceFileHighlighting() { // Remove previous highlighting and replace with hover color LineMarker?.RemoveHighlightMarker(); LineMarker?.AddHighlightMarker(SelectedSourceHighlightColor); }
/// <summary> /// Will seek the next point on line. Beware TODO : check if point is the last >> stop the guy. /// </summary> void seekNextPoint() { CurrentMarker = Path.LineList[Path.LineList.IndexOf(CurrentMarker)+1]; }
internal bool HandleBreakPoint(DebugHookType type, string funcName, int line) { LineMarker breakPoint; if (type == DebugHookType.Line && m_BreakPointMarkers.TryGetValue(line, out breakPoint)) { Dispatcher.BeginInvoke((System.Threading.ThreadStart)delegate { if (m_ExecutingLineMarker == null) { var arrow = new Polygon() { Fill = Brushes.Yellow, Stroke = Brushes.DimGray, StrokeThickness = 0.9, }; var points = new PointCollection(); points.Add(new Point(3, 5.5)); points.Add(new Point(9, 5.5)); points.Add(new Point(9, 2)); points.Add(new Point(14, 8)); points.Add(new Point(9, 14)); points.Add(new Point(9, 10.5)); points.Add(new Point(3, 10.5)); arrow.Points = points; m_ExecutingLineMarker = new LineMarker() { UIElement = arrow }; m_BreakPointViewer.Children.Add(m_ExecutingLineMarker.UIElement); Canvas.SetZIndex(m_ExecutingLineMarker.UIElement, 10000); } double lineY = m_TextEdit.TextArea.TextView.GetVisualPosition(new TextViewPosition(line, 1), VisualYPosition.LineTop).Y; m_ExecutingLineMarker.UIElement.Visibility = System.Windows.Visibility.Visible; m_ExecutingLineMarker.UIElement.RenderTransform = new TranslateTransform(0, lineY); }, System.Windows.Threading.DispatcherPriority.Send); return true; } return false; }
public void NavigateTo(bool usePreviewPane = true) { LineMarker?.NavigateTo(usePreviewPane); }
/// <summary> /// A method for handling the key event when it is selected /// </summary> public void OnSelectKeyEvent() { // Remove previous highlighting and replace with hover color LineMarker.RemoveMarker(); LineMarker.NavigateTo(true, ResultTextMarker.HOVER_SELECTION_COLOR, true); }