-
Notifications
You must be signed in to change notification settings - Fork 976
Expand file tree
/
Copy pathModel.cs
More file actions
80 lines (71 loc) · 2.7 KB
/
Copy pathModel.cs
File metadata and controls
80 lines (71 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Model.cs" company="OxyPlot">
// Copyright (c) 2014 OxyPlot contributors
// </copyright>
// <summary>
// Provides an abstract base class for graphics models.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace OxyPlot
{
using System.Collections.Generic;
/// <summary>
/// Provides an abstract base class for graphics models.
/// </summary>
public abstract partial class Model
{
/// <summary>
/// The default selection color.
/// </summary>
internal static readonly OxyColor DefaultSelectionColor = OxyColors.Yellow;
/// <summary>
/// The synchronization root object.
/// </summary>
private readonly object syncRoot = new object();
/// <summary>
/// Initializes a new instance of the <see cref="Model"/> class.
/// </summary>
protected Model()
{
this.SelectionColor = OxyColors.Yellow;
}
/// <summary>
/// Gets an object that can be used to synchronize access to the <see cref="Model" />.
/// </summary>
/// <value>A synchronization object.</value>
/// <remarks>This property can be used when modifying the <see cref="Model" /> on a separate thread (not the thread updating or rendering the model).</remarks>
public object SyncRoot
{
get { return this.syncRoot; }
}
/// <summary>
/// Gets or sets the color of the selection.
/// </summary>
/// <value>The color of the selection.</value>
public OxyColor SelectionColor { get; set; }
/// <summary>
/// Returns the elements that are hit at the specified position.
/// </summary>
/// <param name="args">The hit test arguments.</param>
/// <returns>
/// A sequence of hit results.
/// </returns>
public IEnumerable<HitTestResult> HitTest(HitTestArguments args)
{
var hitTestElements = this.GetHitTestElements();
foreach (var element in hitTestElements)
{
var result = element.HitTest(args);
if (result != null)
{
yield return result;
}
}
}
/// <summary>
/// Gets all elements of the model, top-level elements first.
/// </summary>
/// <returns>An enumerator of the elements.</returns>
protected abstract IEnumerable<PlotElement> GetHitTestElements();
}
}