首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Mapsui显示线串和跟踪点

使用Mapsui显示线串和跟踪点
EN

Stack Overflow用户
提问于 2020-11-27 15:41:54
回答 1查看 250关注 0票数 2

我的意图是在地图上显示gps轨迹和与Mapsui (wpf)相对应的跟踪点。我尝试了以下代码。结果是显示了蓝色的线条(ok)和红色的跟踪点(ok),但由于某种原因,您会看到非常大的白色跟踪点,我不希望它们出现在地图上,我也不知道这些白点来自哪里。你知道我做错了什么吗?

代码语言:javascript
复制
protected ILayer CreateLineStringLayer(String name, List<GeoWaypoint> geoWaypoints)
 {
     var lineString = new LineString();

     List<Feature> featureList = new List<Feature>();

     IStyle pointStyle = new SymbolStyle()
     {
         SymbolScale = 0.30,            
         Fill = new Brush(Mapsui.Styles.Color.FromString("Red"))
     };

     foreach (var wp in geoWaypoints)
     {
         var point = SphericalMercator.FromLonLat(wp.Longitude, wp.Latitude);
         lineString.Vertices.Add(point);

         var p2 = SphericalMercator.FromLonLat(wp.Longitude, wp.Latitude);
         var pointFeature = new Feature();
         pointFeature.Geometry = p2;
         pointFeature.Styles.Add(pointStyle);
         featureList.Add(pointFeature);
      }
        

     IStyle linestringStyle =  new VectorStyle()
     {
        Fill = null,
        Outline = null,
        Line = { Color = Mapsui.Styles.Color.FromString("Blue"), Width = 4 }
     };

    Feature lineStringFeature = new Feature()
    {
       Geometry = lineString
    };
    lineStringFeature.Styles.Add(linestringStyle);

    featureList.Add(lineStringFeature);
    
    MemoryProvider memoryProvider = new MemoryProvider(featureList);

    return new MemoryLayer
    {
       DataSource = memoryProvider,
       Name = name
    };
}

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-11-27 18:34:50

所以对于每个对答案感兴趣的人来说

代码语言:javascript
复制
return new MemoryLayer
{
   DataSource = memoryProvider,
   Name = name ,
   Style = null
};

您需要将Memorylayer的Style值设置为null

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65033623

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档