/// <summary> /// Finds hits on a marker, given a picking rectangle</summary> /// <param name="marker">Marker</param> /// <param name="bounds">Bounding rectangle, computed during layout phase</param> /// <param name="pickRect">Picking rectangle</param> /// <param name="c">Drawing context</param> /// <returns>Type of hit</returns> protected override HitType Pick(IMarker marker, RectangleF bounds, RectangleF pickRect, Context c) { RectangleF handleRect = new RectangleF(bounds.X, bounds.Y, bounds.Width, bounds.Width); return(handleRect.IntersectsWith(pickRect) ? HitType.Marker : HitType.None); }
public bool TryParse(string inputData, out IMarker marker) { try { Uri uri = new Uri(inputData); Dictionary <string, string> queryArgs = GetQueryArgs(uri); var key = m_MarkerController.ProjectLinkSource.Key; if (queryArgs.TryGetValue(key, out string value)) { var markerSuccess = m_MarkerController.MarkerStorage.Get(value); if (markerSuccess != null) { marker = markerSuccess.Value; return(true); } } } catch (Exception e) { Debug.LogError(e); } marker = null; return(false); }
public override void DrawOverlay(IMarker marker, MarkerUIStates uiState, MarkerOverlayRegion region) { var snapPoint = (QlistMarker)marker; // DrawSnapLine(snapPoint, uiState, region); DrawLabel(snapPoint, uiState, region); }
private static void DrawByMarker(IRtc rtc, ILaser laser, IMarker marker) { #region load from sirius file var dlg = new OpenFileDialog(); dlg.Filter = "sirius data files (*.sirius)|*.sirius|dxf cad files (*.dxf)|*.dxf|All Files (*.*)|*.*"; dlg.Title = "Open to data file"; DialogResult result = dlg.ShowDialog(); if (result != DialogResult.OK) { return; } string ext = Path.GetExtension(dlg.FileName); IDocument doc = null; if (0 == string.Compare(ext, ".dxf", true)) { doc = DocumentSerializer.OpenDxf(dlg.FileName); } else if (0 == string.Compare(ext, ".sirius", true)) { doc = DocumentSerializer.OpenSirius(dlg.FileName); } #endregion Debug.Assert(null != doc); marker.Ready(doc, rtc, laser); marker.Offsets.Clear(); marker.Offsets.Add((0, 0, 0)); marker.Start(); }
public void ParseTrack() { foreach (PlayableBinding pb in director.playableAsset.outputs) { if (pb.sourceObject is AnimationTrack) { AnimationTrack track = pb.sourceObject as AnimationTrack; int cnt = track.GetMarkerCount(); var tfTracks = new List <AnchorSignalEmitter>(); var marks = track.GetMarkers().GetEnumerator(); while (marks.MoveNext()) { IMarker mark = marks.Current; if (mark is AnchorSignalEmitter) { tfTracks.Add(mark as AnchorSignalEmitter); } } marks.Dispose(); for (int i = 0; i < tfTracks.Count; i++) { AnchorSignalEmitter sign = tfTracks[i]; Debug.Log(sign.time + " " + sign.position); } } } }
/// <summary> /// /// </summary> /// <param name="size"></param> /// <param name="coordinate"></param> /// <param name="zoom"></param> /// <param name="type"></param> /// <param name="markers"></param> /// <returns></returns> public static string MakeUrlRequest(Vector2 size, Vector2 coordinate, int zoom, GSMapType type, IMarker[] markers, string key = "") { string ret = GoogleStaticMapUrlBase // request base string adress + "center=" + coordinate[1].ToString() + "," + coordinate[0].ToString() // + position + "&zoom=" + zoom.ToString() // + zoom + "&size=" + size[0].ToString() + "x" + size[1].ToString()// + size + "&maptype=" + type.ToString().ToLower(); // + maptype // + "&markers=size:mid%7Ccolor:0xff0000%7Clabel:1%7C" + coo[0].ToString() + "," + coo[1].ToString() // + marker example // + "&markers=size:mid%7Ccolor:0xff0000%7Clabel:1%7C" + coo[1].ToString() + "," + coo[1].ToString();// + marker example foreach (IMarker marker in markers) { ret += "&markers=%7Clabel:1%7C" + marker.latitude.ToString() + "," + marker.longitude.ToString(); } /* google static map api key */ if(key.Length > 0) { ret += "&key=" + key; } return ret; }
/// <summary> /// Gets the item's name in the context, or null if none</summary> /// <param name="item">Item</param> /// <returns>Item's name in the context, or null if none</returns> string INamingContext.GetName(object item) { IEvent e = item.As <IEvent>(); if (e != null) { return(e.Name); } IMarker marker = item.As <IMarker>(); if (marker != null) { return(marker.Name); } IGroup group = item.As <IGroup>(); if (group != null) { return(group.Name); } ITrack track = item.As <ITrack>(); if (track != null) { return(track.Name); } return(null); }
public void Create_Valid_ControllerRendering() { //Arrange string providedDataSource = "thisDataSource"; Mock <IGetDataSourceQuery> mockGetDataSourceQuery = new Mock <IGetDataSourceQuery>(); mockGetDataSourceQuery.Setup(i => i.GetDataSourceItemPath(It.IsAny <Guid>())).Returns(providedDataSource); IGetDataSourceQuery providedGetDataSourceQuery = mockGetDataSourceQuery.Object; RenderingMarkerFactory providedRenderingMarkerFactory = new RenderingMarkerFactory(providedGetDataSourceQuery); Rendering providedRendering = new Rendering(); providedRendering.DataSource = providedDataSource; ControllerRenderer providedRenderer = new ControllerRenderer(); providedRenderer.ControllerName = "thisController"; providedRenderer.ActionName = "thisAction"; providedRendering.Renderer = providedRenderer; Type expectedType = typeof(AnnotatableRenderingXMLElementMarker); string expectedRenderingName = $"Controller: {providedRenderer.ControllerName}. Action: {providedRenderer.ActionName}"; string expectedStartString = $"<rendering data-rendering-name=\"{expectedRenderingName}\" data-data-source=\"{providedRendering.DataSource}\">"; //Act IMarker actualRenderingMarker = providedRenderingMarkerFactory.Create(providedRendering); //Assert Assert.AreEqual(expectedType, actualRenderingMarker.GetType()); Assert.AreEqual(expectedStartString, actualRenderingMarker.GetStart()); }
private void UpdateMarkers() { double x1 = Line.Start.X; double y1 = Line.Start.Y; double x2 = Line.End.X; double y2 = Line.End.Y; if (Style.Stroke.StartArrow.ArrowType != ArrowType.None) { double a1 = Math.Atan2(y1 - y2, x1 - x2); StartMarker = CreateArrowMarker(x1, y1, a1, Style, Style.Stroke.StartArrow); StartMarker.UpdateStyle(); P0 = (StartMarker as MarkerBase).Point; } else { StartMarker = null; P0 = new SKPoint((float)x1, (float)y1); } if (Style.Stroke.EndArrow.ArrowType != ArrowType.None) { double a2 = Math.Atan2(y2 - y1, x2 - x1); EndMarker = CreateArrowMarker(x2, y2, a2, Style, Style.Stroke.EndArrow); EndMarker.UpdateStyle(); P1 = (EndMarker as MarkerBase).Point; } else { EndMarker = null; P1 = new SKPoint((float)x2, (float)y2); } }
public static IMarker CloneMarkerToParent(IMarker marker, TrackAsset parent) { var markerObject = marker as ScriptableObject; if (markerObject == null) { return(null); } var newMarkerObject = Object.Instantiate(markerObject); AddMarkerToParent(newMarkerObject, parent); newMarkerObject.name = markerObject.name; try { CustomTimelineEditorCache.GetMarkerEditor((IMarker)newMarkerObject).OnCreate((IMarker)newMarkerObject, marker); } catch (Exception e) { Debug.LogException(e); } return((IMarker)newMarkerObject); }
private void OutputTrackinfo() { if (signals == null) { signals = new List <AnchorSignalEmitter>(); } else { signals.Clear(); } var marks = GetMarkers().GetEnumerator(); while (marks.MoveNext()) { IMarker mark = marks.Current; if (mark is AnchorSignalEmitter) { AnchorSignalEmitter anchor = mark as AnchorSignalEmitter; signals.Add(anchor); } } marks.Dispose(); CreateClips(); }
public Quaternion RotationFor(int trackID) { IMarker m = tracker[trackID]; return(Quaternion.LookRotation(new Vector3((float)m.Rotationmatrix[1][0], (float)m.Rotationmatrix[1][2], (float)m.Rotationmatrix[1][1]), new Vector3((float)m.Rotationmatrix[2][0], (float)m.Rotationmatrix[2][2], (float)m.Rotationmatrix[2][1]))); }
public static void Add(IMarker marker) { var markerAsObject = marker as Object; if (markerAsObject != null) { if (!Selection.Contains(markerAsObject)) { currentInlineEditorCurve = null; WindowState state = null; if (TimelineWindow.instance != null) { state = TimelineWindow.instance.state; } if (!Selection.instanceIDs.Any() && state != null && state.editSequence.director != null) { Selection.SetActiveObjectWithContext(markerAsObject, TimelineWindow.instance.state.editSequence.director); } else { Selection.Add(markerAsObject); } } } }
public string Generate(IMarker marker, UnityProject project) { RawMarkerBarcodeData data = new RawMarkerBarcodeData(); data.marker = (Marker)marker; return(data.Serialize()); }
// Start is called before the first frame update void Start() { if (_markerStorage.Markers.Count == 0) { Debug.Log("Creating default marker"); _markerStorage.Create(_defaultMarker); } else { Debug.Log($"Markers are already available: {_markerStorage.Markers.Count} total"); } // For testing purposes, just use first marker. _foundMarker = _markerStorage.Markers[0]; _currentMarkerPose = new Pose(_defaultPoseLocation.position, _defaultPoseLocation.rotation); _imageTracker.OnTrackedFound += HandleTrackableFound; _imageTracker.OnTrackedPositionUpdate += HandleTrackableUpdate; _updateMarkerButton.onClick.AddListener(HandleUpdateMarker); _imageTracker.Run(); _scanUI.Open(); // Currently no cancel action. _scanUI.HideCancel(); _scanUI.UpdateInstructions("Center on Marker", "Fit marker image within the center of the screen."); _scanUI.OnAccept = ActivateMarker; _scanUI.ShowAccept(); }
private bool TryParse(byte[] buffer, ref int pos) { IMarker marker; if (Marker.TryCreateMarker(buffer, ref pos, out marker) && Marker.IsSpecificMarker(marker, Marker.NewAttach)) { NewAttachMarker = marker; } else return false; IPropValue attachCount = StreamUtil.ParsePropValue(buffer, ref pos); AttachNumber = attachCount as FixPropType_PropInfo_FixedSizeValue; if (AttachNumber == null) throw new ArgumentException("Attach number parse error."); if (AttachNumber.PropIdWithType != 0x0E210003) throw new ArgumentException("Attach number parse error."); AttachmentContent.TryParse(buffer, ref pos, out AttachContent); if (Marker.TryCreateMarker(buffer, ref pos, out marker) && Marker.IsSpecificMarker(marker, Marker.EndAttach)) { EndAttachMarker = marker; } else throw new ArgumentException("Attach end parse error."); return true; }
/// <summary> /// Sets the item's name</summary> /// <param name="item">Item to name</param> /// <param name="name">New item name</param> void INamingContext.SetName(object item, string name) { IEvent e = item.As <IEvent>(); if (e != null) { e.Name = name; return; } IMarker marker = item.As <IMarker>(); if (marker != null) { marker.Name = name; return; } IGroup group = item.As <IGroup>(); if (group != null) { group.Name = name; return; } ITrack track = item.As <ITrack>(); if (track != null) { track.Name = name; return; } }
public void Create_Valid_Rendering_With_Guid_Datasource() { //Arrange string providedDataSource = Guid.NewGuid().ToString(); string expectedDataSource = "Not a Guid"; Mock <IGetDataSourceQuery> mockGetDataSourceQuery = new Mock <IGetDataSourceQuery>(); mockGetDataSourceQuery.Setup(i => i.GetDataSourceItemPath(It.IsAny <Guid>())).Returns(expectedDataSource); IGetDataSourceQuery providedGetDataSourceQuery = mockGetDataSourceQuery.Object; RenderingMarkerFactory providedRenderingMarkerFactory = new RenderingMarkerFactory(providedGetDataSourceQuery); Rendering providedRendering = new Rendering(); providedRendering.DataSource = providedDataSource; ViewRenderer providedRenderer = new ViewRenderer(); providedRenderer.ViewPath = "this.cshtml"; providedRendering.Renderer = providedRenderer; Type expectedType = typeof(AnnotatableRenderingXMLElementMarker); string expectedRenderingName = $"View: {providedRenderer.ViewPath}"; string expectedStartString = $"<rendering data-rendering-name=\"{expectedRenderingName}\" data-data-source=\"{expectedDataSource}\">"; //Act IMarker actualRenderingMarker = providedRenderingMarkerFactory.Create(providedRendering); //Assert Assert.AreEqual(expectedType, actualRenderingMarker.GetType()); Assert.AreEqual(expectedStartString, actualRenderingMarker.GetStart()); }
private static Constant.GameState CheckColumns(CellManager cm, IMarker m, Constant.GameState currentGameState) { Constant.GameState result = currentGameState; if (result == Constant.GameState.Win) { return(result); } for (int column = 0; column < Constant.GridSize; column++) { int cnt = 0; for (int row = 0; row < Constant.GridSize; row++) { if (cm.Grid[row, column].Marker != null && cm.Grid[row, column].Marker.Equals(m)) { cnt++; } } if (cnt == Constant.GridSize) { return(Constant.GameState.Win); } } return(result); }
public bool TryParse(string inputData, out IMarker marker) { // Try to find the marker in the loaded project var markerTry = GetProjectMarker(inputData); if (markerTry != null) { marker = markerTry.Value; return(true); } // Test for a valid URI bool validUri = false; try { Uri uri = new Uri(inputData); validUri = true; } catch (Exception e) { Debug.Log(e); } // Pass the URI to the deep link handler if (validUri) { StartCoroutine(HandleDeepLink(inputData)); } marker = null; return(validUri); }
/// <summary> /// Updates the RelativePosition and RelativeRotation values to a new World-space Pose /// </summary> /// <param name="transform">Marker relative transform</param> /// <param name="worldPose"></param> public static void SetWorldPosition(IMarker marker, Transform transform, Pose worldPose) { Pose localPose = InverseTransformPose(transform, worldPose); marker.RelativePosition = localPose.position; marker.RelativeRotationEuler = localPose.rotation.eulerAngles; }
public double Cal_Trans_Angle(IMarker point1, IMarker point2) { double rate = (Convert.ToDouble(point1.LATITUDE) - Convert.ToDouble(point2.LATITUDE)) / (Convert.ToDouble(point1.LONGITUDE) - Convert.ToDouble(point2.LONGITUDE)); double rad_angle = Math.Atan(Math.Abs(rate)); return(rad_angle * 180 / Math.PI); }
public IMarker Update(IMarker marker) { marker.Name = Name; marker.RelativePosition = new Vector3(X, Y, Z); marker.RelativeRotationEuler = new Vector3(XAxis, YAxis, ZAxis); return(marker); }
public bool Remove(IMarker item) { if (!(item is ScriptableObject)) { throw new InvalidOperationException("Supplied type must be a ScriptableObject"); } return(Remove((ScriptableObject)item, item.parent.timelineAsset, item.parent)); }
public IInfoWindow ShowInfoWindow(string contentString, IMarker marker, InfoWindowOptions infoWindowOptions, bool hideOthers = false) { string jsonInfoWindowOptions = JsonConvert.SerializeObject(infoWindowOptions); int infoWindowId = (int)_browser.InvokeScript("showInfoWindow", contentString, null, marker.MarkerId, jsonInfoWindowOptions, hideOthers, false); _infoWindows[infoWindowId] = new InfoWindow(_browser, infoWindowId); return(_infoWindows[infoWindowId]); }
/// <summary> /// Implement this method to override the default options for drawing a marker. /// </summary> /// <param name="marker">The marker to draw.</param> /// <returns></returns> public virtual MarkerDrawOptions GetMarkerOptions(IMarker marker) { return(new MarkerDrawOptions() { tooltip = string.Empty, errorText = string.Empty, }); }
public string Generate(IMarker marker, UnityProject project) { ProjectMarkerBarcodeData data = new ProjectMarkerBarcodeData(); data.MarkerID = marker.Id.ToString(); data.ProjectID = project.ProjectId; return(data.Serialize()); }
public static MarkerEditor GetMarkerEditor(IMarker marker) { if (marker == null) { throw new ArgumentNullException(nameof(marker)); } return(GetEditorForType <MarkerEditor, IMarker>(marker.GetType())); }
public static void Remove(IMarker marker) { var o = marker as Object; if (o != null) { Remove(o); } }
public static Xdr.ToMarker GetToMarker(this IMarker marker) { return(new Xdr.ToMarker { ColumnId = new ColumnId(marker.ColumnId), RowId = new RowId(marker.RowId), ColumnOffset = new ColumnOffset(marker.ColumnOffset), RowOffset = new RowOffset(marker.RowOffset), }); }
public void PlaceMarker(IMarker marker, Position position) { if (marker.Equals(previousMarker)) { throw new InvalidOperationException(); } previousMarker = marker; }
public string[] Cal_Center_Point(IMarker point1, IMarker point2) { string center_lon = Longitude.Parse(((Convert.ToDouble(point1.LONGITUDE) + Convert.ToDouble(point2.LONGITUDE)) / 2).ToString()); string center_lat = Latitude.Parse(((Convert.ToDouble(point1.LATITUDE) + Convert.ToDouble(point2.LATITUDE)) / 2).ToString()); return(new string[2] { center_lon, center_lat }); }
public void ParseMarker(byte[] buffer, ref int pos) { IMarker marker; if (Marker.TryCreateMarker(buffer, ref pos, out marker) && Marker.IsSpecificMarker(marker, Marker.EndToRecip)) { EndRecip = marker; _isEnd = true; } else throw new ArgumentException("Parse recipient error."); }
internal void SetCellAtIndex(int index, IMarker marker) { if (GetCellAtIndex(index).Marker != null) throw new ArgumentException("This cell is occupied!"); else { int row = index / Constant.GridSize; int column = index % Constant.GridSize; Grid[row, column] = new Cell(marker); AllocCount++; } }
internal static Constant.GameState CheckGridForWinner(CellManager cm, IMarker m, Constant.GameState currentGameState) { Constant.GameState result = currentGameState; // Check winning conditions for the newly created move if (cm.AllocCount == Constant.MaxOptions) result = Constant.GameState.Tie; else { // We only need to check the grid for the marker that has // just been placed down. result = CheckRows(cm, m, result); result = CheckColumns(cm, m, result); result = CheckDiagonals(cm, m, result); } return result; }
private bool TryParse(byte[] buffer,ref int pos) { IMarker marker; if (Marker.TryCreateMarker(buffer, ref pos, out marker) && Marker.IsSpecificMarker(marker, Marker.StartRecip)) { StartRecip = marker; } else return false; while (pos < buffer.Length) { ElementTypeProcessBase.ParseByElementType(buffer, ref pos, this); if (_isEnd) break; } return true; }
private bool TryParse(byte[] buffer, ref int pos) { IMarker marker; if (Marker.TryCreateMarker(buffer, ref pos, out marker) && Marker.IsSpecificMarker(marker, Marker.StartEmbed)) { StartEmbed = marker; } else return false; MsgContent = MessageContent.CreateMessageContent(buffer, ref pos); if (Marker.TryCreateMarker(buffer, ref pos, out marker) && Marker.IsSpecificMarker(marker, Marker.EndEmbed)) { EndEmbed = marker; } else throw new ArgumentException("Embeddedmessage end parse error."); return true; }
private static Constant.GameState CheckDiagonals(CellManager cm, IMarker m, Constant.GameState currentGameState) { Constant.GameState result = currentGameState; if (result == Constant.GameState.Win) return result; int cnt = 0; // Check leading diagonal. for (int i = 0; i < Constant.GridSize; i++) { if (cm.Grid[i, i].Marker != null && cm.Grid[i, i].Marker.Equals(m)) cnt++; } if (cnt == Constant.GridSize) return Constant.GameState.Win; else { // Reset the counter, check antidiagonal. cnt = 0; for (int i = 0; i < Constant.GridSize; i++) { if (cm.Grid[i, Constant.GridSize - 1 - i].Marker != null && cm.Grid[i, Constant.GridSize - 1 - i].Marker.Equals(m)) cnt++; } if (cnt == Constant.GridSize) return Constant.GameState.Win; } // No result was found on the diagonals. return result; }
private static Constant.GameState CheckColumns(CellManager cm, IMarker m, Constant.GameState currentGameState) { Constant.GameState result = currentGameState; if (result == Constant.GameState.Win) return result; for (int column = 0; column < Constant.GridSize; column++) { int cnt = 0; for (int row = 0; row < Constant.GridSize; row++) { if (cm.Grid[row, column].Marker != null && cm.Grid[row, column].Marker.Equals(m)) cnt++; } if (cnt == Constant.GridSize) return Constant.GameState.Win; } return result; }
/// <summary> /// Draws a marker</summary> /// <param name="marker">Marker</param> /// <param name="bounds">Bounding rectangle, computed during layout phase</param> /// <param name="drawMode">Drawing mode</param> /// <param name="c">Drawing context</param> protected override void Draw(IMarker marker, RectangleF bounds, DrawMode drawMode, Context c) { float middle = bounds.X + bounds.Width / 2; Color color = marker.Color; switch (drawMode & DrawMode.States) { case DrawMode.Normal: using (Pen pen = new Pen(color)) { c.Graphics.DrawLine(pen, middle, bounds.Top, middle, bounds.Bottom); } bool selected = (drawMode & DrawMode.Selected) != 0; Color handleColor = selected ? Color.Tomato : color; using (Brush brush = new SolidBrush(handleColor)) { RectangleF handleRect = new RectangleF(bounds.X, bounds.Y, bounds.Width, bounds.Width); c.Graphics.FillRectangle(brush, handleRect); } break; case DrawMode.Collapsed: c.Graphics.FillRectangle(m_collapsedBrush, middle, bounds.Y, 1, bounds.Height); break; case DrawMode.Ghost: using (Pen pen = new Pen(Color.FromArgb(128, color))) { c.Graphics.DrawLine(pen, middle, bounds.Top, middle, bounds.Bottom); c.Graphics.DrawString(GetXPositionString(middle, c), c.Font, SystemBrushes.WindowText, bounds.Right + 16, bounds.Y); } break; case DrawMode.Invalid: c.Graphics.DrawRectangle(Pens.DimGray, bounds.X, bounds.Y, bounds.Width, bounds.Height); break; } }
public static bool IsSpecificMarker(IMarker marker, UInt32 markerValue) { return ((PTypInteger32)marker).Value == markerValue; }
/// <summary> /// Gets the bounding rectangle for a marker, in timeline coordinates</summary> /// <param name="marker">Marker</param> /// <param name="transform">Transform, taking timeline coordinates to display</param> /// <param name="clientRectangle">Bounds of displayed area of timeline, in screen space</param> /// <returns>Bounding rectangle for the marker, in timeline coordinates</returns> public RectangleF GetBounds(IMarker marker, Matrix transform, RectangleF clientRectangle) { var c = new Context(this, transform, clientRectangle, m_graphics); return GetBounds(marker, c); }
private void UpdateMarkerList() { _SelectedMarker = null; lstMarkers.Items.Clear(); foreach (IMarker marker in CodeRush.Markers) { lstMarkers.Items.Add(marker); } }
public Player(string name, IMarker marker) { this.Name = name; this.Marker = marker; }
public static bool TryCreateMarker(byte[] buffer, ref int pos, out IMarker marker) { return PTypInteger32.JudgeIsMarker(buffer, ref pos, out marker); }
/// <summary> /// Gets the bounding rectangle for a marker, in timeline coordinates</summary> /// <param name="marker">Marker</param> /// <param name="c">Drawing context</param> /// <returns>Bounding rectangle for the marker, in timeline coordinates</returns> protected override RectangleF GetBounds(IMarker marker, Context c) { const float DefaultMarkerHandleSize = 10; float handleSize = c.PixelSize.Width * DefaultMarkerHandleSize; return new RectangleF( marker.Start - handleSize / 2, c.Bounds.Top, handleSize, c.Bounds.Height); }
/// <summary> /// Finds hits on a marker, given a picking rectangle</summary> /// <param name="marker">Marker</param> /// <param name="bounds">Bounding rectangle, computed during layout phase</param> /// <param name="pickRect">Picking rectangle</param> /// <param name="c">Drawing context</param> /// <returns>Type of hit</returns> protected override HitType Pick(IMarker marker, RectangleF bounds, RectangleF pickRect, Context c) { RectangleF handleRect = new RectangleF(bounds.X, bounds.Y, bounds.Width, bounds.Width); return handleRect.IntersectsWith(pickRect) ? HitType.Marker : HitType.None; }
/// <summary> /// Draws a marker</summary> /// <param name="marker">Marker</param> /// <param name="bounds">Bounding rectangle, computed during layout phase</param> /// <param name="drawMode">Drawing mode</param> /// <param name="c">Drawing context</param> protected override void Draw(IMarker marker, RectangleF bounds, DrawMode drawMode, Context c) { float middle = bounds.X + bounds.Width / 2; Color color = marker.Color; switch (drawMode & DrawMode.States) { case DrawMode.Normal: c.Graphics.DrawLine(middle, bounds.Top, middle, bounds.Bottom, color, 1.0f, null); bool selected = (drawMode & DrawMode.Selected) != 0; Color handleColor = selected ? Color.Tomato : color; RectangleF handleRect = new RectangleF(bounds.X, bounds.Y, bounds.Width, bounds.Width); c.Graphics.FillRectangle(handleRect, handleColor); break; case DrawMode.Collapsed: c.Graphics.FillRectangle( new RectangleF(middle, bounds.Y, 1, bounds.Height), CollapsedBrush); break; case DrawMode.Ghost: c.Graphics.DrawLine(middle, bounds.Top, middle, bounds.Bottom, Color.FromArgb(128, color), 1.0f, null); c.Graphics.DrawText( GetXPositionString(middle, c), c.TextFormat, new PointF(bounds.Right + 16, bounds.Y), TextBrush); break; case DrawMode.Invalid: c.Graphics.DrawRectangle(bounds, Color.DimGray, 1.0f, null); break; } }
//------------------------------------------------------------------- // Name: SendMarkerEvent // Description: Saned a marker event. // // pMarker: Pointer to our custom IMarker interface, which holds // the marker information. //------------------------------------------------------------------- void SendMarkerEvent(IMarker pMarker, FlushState fs) { int hrStatus = 0; // Status code for marker event. if (fs == FlushState.DropSamples) { hrStatus = E_Abort; } PropVariant var = new PropVariant(); // Get the context data. pMarker.GetContext(var); QueueEvent(MediaEventType.MEStreamSinkMarker, Guid.Empty, hrStatus, var); var.Clear(); }
internal static void SetActiveMarker(DependencyObject obj, IMarker value) { obj.SetValue(ActiveMarkerProperty, value); }
public EditorRenderingWrapper(TextWriter writer, IMarker marker) : base(writer, marker) { }
/// <summary> /// Draws a marker</summary> /// <param name="marker">Marker</param> /// <param name="bounds">Bounding rectangle, in screen space</param> /// <param name="drawMode">Drawing mode</param> /// <param name="c">Drawing context</param> protected abstract void Draw(IMarker marker, RectangleF bounds, DrawMode drawMode, Context c);
private void lstMarkers_SelectedIndexChanged(object sender, EventArgs e) { _SelectedMarker = null; if (lstMarkers.SelectedIndex < 0 || lstMarkers.SelectedIndex >= lstMarkers.Items.Count) return; IMarker marker = lstMarkers.Items[lstMarkers.SelectedIndex] as IMarker; if (marker == null) return; _SelectedMarker = marker; if (_SelectedMarker == null) return; TextDocument activeTextDocument = _SelectedMarker.TextDocument; if (activeTextDocument == null) return; int linesToShow = codePreview.Height / codePreview.LineHeight; _StartLine = _SelectedMarker.Line - linesToShow / 2; if (_StartLine < 1) _StartLine = 1; int endLine = _StartLine + linesToShow; if (endLine > activeTextDocument.LineCount) endLine = activeTextDocument.LineCount; string code = activeTextDocument.GetText(_StartLine, endLine); codePreview.ShowCode(code, activeTextDocument.Language); }
/// <summary> /// Finds hits on a marker, given a picking rectangle</summary> /// <param name="marker">Marker</param> /// <param name="bounds">Bounding rectangle, computed during layout phase</param> /// <param name="pickRect">Picking rectangle</param> /// <param name="c">Drawing context</param> /// <returns>Type of hit</returns> protected virtual HitType Pick(IMarker marker, RectangleF bounds, RectangleF pickRect, Context c) { return bounds.IntersectsWith(pickRect) ? HitType.Marker : HitType.None; }
/// <summary> /// Gets the bounding rectangle for a marker, in timeline coordinates</summary> /// <param name="marker">Marker</param> /// <param name="c">Drawing context</param> /// <returns>Bounding rectangle for the marker, in timeline coordinates</returns> protected abstract RectangleF GetBounds(IMarker marker, Context c);
public Cell(IMarker marker) { this.Marker = marker; }
private void ShineLocatorBeacon(IMarker marker) { if ( marker == null || marker.TextDocument == null || marker.TextDocument.ActiveView == null ) return; if ( _settings.ShowBeacon ) { bool wasBeaconAnimated = false; var selectionMarker = marker as ISelectionMarker; if ( selectionMarker != null && selectionMarker.HasSelection ) { if ( _cornerBeacon == null ) _cornerBeacon = new DevExpress.CodeRush.PlugInCore.CornerBeacon(); if ( _cornerBeacon.AccomplishedPercent > 0f ) _cornerBeacon.Stop(); _cornerBeacon.Color = DxDwg.Color.ConvertFrom(_settings.BeaconColor); _cornerBeacon.Duration = _settings.BeaconDuration; var range = new SourceRange(selectionMarker.AnchorLine, selectionMarker.AnchorColumn, selectionMarker.Line, selectionMarker.Column); _cornerBeacon.Start(marker.TextDocument.ActiveView, range.Top, range.Bottom, 0x1a); wasBeaconAnimated = true; } if ( !wasBeaconAnimated ) { if ( _locatorBeacon == null ) _locatorBeacon = new DevExpress.CodeRush.PlugInCore.LocatorBeacon(); if ( _locatorBeacon.AccomplishedPercent > 0f ) _locatorBeacon.Stop(); _locatorBeacon.Color = DxDwg.Color.ConvertFrom(_settings.BeaconColor); _locatorBeacon.Duration = _settings.BeaconDuration; _locatorBeacon.Start(marker.TextDocument.ActiveView, marker.Line, marker.Column); } } }
private void ShineLocatorBeacon( IMarker marker ) { if ( marker == null || marker.TextDocument == null || marker.TextDocument.ActiveView == null ) return; if ( _settings.ShowBeacon ) { locatorBeacon.Color = _settings.BeaconColor; locatorBeacon.Duration = _settings.BeaconDuration; locatorBeacon.Start( marker.TextDocument.ActiveView, marker.Line, marker.Column ); } }