本文整理汇总了C#中SnapshotSpan.IntersectsWith方法的典型用法代码示例。如果您正苦于以下问题:C# SnapshotSpan.IntersectsWith方法的具体用法?C# SnapshotSpan.IntersectsWith怎么用?C# SnapshotSpan.IntersectsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SnapshotSpan
的用法示例。
在下文中一共展示了SnapshotSpan.IntersectsWith方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveGlyphsByVisualSpan
public void RemoveGlyphsByVisualSpan(SnapshotSpan span) {
List<UIElement> glyphsInSpan = new List<UIElement>();
foreach (var glyph in _glyphs) {
GlyphData data = glyph.Value;
if (data.VisualSpan.HasValue) {
if (span.IntersectsWith(data.VisualSpan.Value)) {
glyphsInSpan.Add(glyph.Key);
_canvas.Children.Remove(data.Element);
}
}
}
foreach (UIElement element in glyphsInSpan) {
_glyphs.Remove(element);
}
}
示例2: GetClassificationSpans
public IList<ClassificationSpan> GetClassificationSpans(SnapshotSpan span)
{
if (_classificationSpans.Length == 0)
return ClassifierUtils.EmptyClassifications;
List<ClassificationSpan> spans = null;
foreach (var s in _classificationSpans)
{
if (span.End < s.Span.Start)
break;
if (span.IntersectsWith(s.Span))
{
if (spans == null)
spans = new List<ClassificationSpan>();
spans.Add(s);
}
}
return spans ?? ClassifierUtils.EmptyClassifications;
}
示例3: GetClassificationSpans
#pragma warning restore 67
public IList<ClassificationSpan> GetClassificationSpans(SnapshotSpan processedSpan)
{
var currentSnapshot = processedSpan.Snapshot;
var result = new List<ClassificationSpan>();
for (int i = 0; i < _spanInfos.Length; i++)
{
var snapshot = _snapshots[i];
var spanInfos = _spanInfos[i];
var translatesSnapshot = processedSpan.TranslateTo(snapshot, SpanTrackingMode.EdgeExclusive);
var processedSpanInfo = new SpanInfo(new NSpan(translatesSnapshot.Span.Start, translatesSnapshot.Span.End), -1);
var index = spanInfos.BinarySearch(processedSpanInfo, SpanInfo.Comparer);
if (index < 0)
index = ~index;
for (int k = index; k < spanInfos.Length; k++)
{
var spanInfo = spanInfos[k];
var span = spanInfo.Span;
var newSpan = new SnapshotSpan(snapshot, new Span(span.StartPos, span.Length))
.TranslateTo(currentSnapshot, SpanTrackingMode.EdgeExclusive);
if (!newSpan.IntersectsWith(processedSpan))
break;
var classificationType = ClassificationMap[spanInfo.SpanClassId];
result.Add(new ClassificationSpan(newSpan, classificationType));
}
}
return result;
}
示例4: VisitDocument
/// <summary>
/// Visits the specified UVSS document and returns a list of classification spans that
/// intersect with the specified span.
/// </summary>
/// <param name="document">The document to visit.</param>
/// <param name="span">The span for which to retrieve classification spans.</param>
/// <returns>The classification spans that intersect with the specified span.</returns>
public IList<ClassificationSpan> VisitDocument(UvssTextParserResult result, SnapshotSpan span)
{
if (result.Document == null)
return null;
span = span.TranslateTo(result.Snapshot, SpanTrackingMode.EdgeExclusive);
var results = new List<ClassificationSpan>();
var visitor = new UvssClassifierVisitor(registry, (start, width, type, kind) =>
{
var nodeSpan = new SnapshotSpan(span.Snapshot, start, width);
if (nodeSpan.IntersectsWith(span))
results.Add(new ClassificationSpan(nodeSpan, type));
});
visitor.Visit(result.Document);
return results;
}