当前位置: 首页>>代码示例>>C#>>正文


C# SnapshotSpan.IntersectsWith方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:17,代码来源:PromptMarginVisualManager.cs

示例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;
        }
开发者ID:vestild,项目名称:nemerle,代码行数:19,代码来源:UsageClassifier.cs

示例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;
    }
开发者ID:rsdn,项目名称:nitra,代码行数:34,代码来源:NitraEditorClassifier.cs

示例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;
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:25,代码来源:UvssClassifier.cs


注:本文中的SnapshotSpan.IntersectsWith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。