TextSymbol rendering in 10.2.6

2492
1
10-16-2015 08:02 AM
ChrisSmith10
New Contributor II

While investigating version 10.2.6 I have noticed a regression in the rendering of a TextSymbol in my code. I am seeing three issues, enumerated below. Related code at the bottom of the post. Any ideas on why these issues are occurring? Are they known issues? I could not find anything in the release notes.

1. Placement of the TextSymbol is different in 10.2.6 than it was in 10.2.4. In 10.2.4 it was right justified. In 10.2.6 it is now centered. See screenshots. The HorizontalTextAlignment property does not have an affect.

2. There is leftover TextSymbol when clearing the TextSymbol and creating a new one. See screenshots

3. The TextSymbol is sometimes cut off (half of it will be missing).

10.2.4

textsymbol 10.2.4.png

10.2.6

textsymbol 10.2.6.png

 private async void MeasureLocationAsync(object sender, RoutedEventArgs e)
    {
      while (true)
      {
        // get or create graphics layer to display user measurement objects
        var measureLayer = (GraphicsLayer) MyMapView.Map.Layers[MeasureLayerID];
        if (measureLayer == null)
        {
          measureLayer = new GraphicsLayer {ID = MeasureLayerID};
          measureLayer.RenderingMode = GraphicsRenderingMode.Static;
          MyMapView.Map.Layers.Add(measureLayer);
        }

        var taskLoadLayer = MyMapView.LayersLoadedAsync(new List<Layer> {measureLayer});
        var taskDrawShape = MyMapView.Editor.RequestPointAsync();
        try
        {
          await Task.WhenAll(taskLoadLayer, taskDrawShape);
        }
        catch (TaskCanceledException)
        {
          // editor operation was cancelled. break out of this
          return;
        }

        var point = taskDrawShape.Result;
        var wgs84Location = (MapPoint)GeometryEngine.Project(point, SpatialReferences.Wgs84);

        // clear existing items from measurement layer
        measureLayer.Graphics.Clear();

        // create symbol
        var markerSymbol = new SimpleMarkerSymbol
        {
          Color = Colors.Orange,
          Size = 16,
          Outline = new SimpleLineSymbol()
          {
            Color = Colors.Black,
            Width = 3
          }
        };
        var symbolGraphic = new Graphic(point, markerSymbol);

        // create text label
        var textSymbol = new TextSymbol
        {
          Color = Colors.Orange,
          BackgroundColor = Colors.Black, // this doesn't work when rendering mode is static, bug in esri?
          XOffset = 10,
          YOffset = 10,
          HorizontalTextAlignment = HorizontalTextAlignment.Right,
          Font = new SymbolFont(MeasurePostionButton.FontFamily.Source, 24, SymbolFontStyle.Normal, SymbolTextDecoration.None, SymbolFontWeight.Bold),
          Text = $"{wgs84Location.X}, {wgs84Location.Y}"
        };
        var textGraphic = new Graphic(point, textSymbol);

        measureLayer.Graphics.Add(symbolGraphic);
        measureLayer.Graphics.Add(textGraphic);
      }
    }
1 Reply
RenzoBortolamedi
New Contributor

We have noticed the same problem with the alignment of TextSymbol in combination with FeatureLayers. HorizontalTextAlignment and VerticalTextAlignment have no effect on the rendering of the symbol. Are there any news on this issue?

0 Kudos