Select to view content in your preferred language

Lablels(Graphics) of segments(Polyline/Polygon)

569
1
01-10-2013 09:14 PM
ChandraSubbaraju
Emerging Contributor
Hi,

  How add lables (graphics) dynamically on polygon or Polyline on the Map.
  For example If I draw Polyline or Polygon on the map, length of segments (polyline/polygon) shoule be show as on top of the segment as a label (graphic).

Thanks
Subbaraju
0 Kudos
1 Reply
KellyCline
New Contributor
After creating the Polyline graphic, you can create another graphic where the Geometry is a MapPoint and the Symbol is a TextSymbol.  The new graphic will be "on top" of the other.  We have done something like this where the MapPoint is relevant to the Polyline graphic:

            
            MapPoint pt = new MapPoint(X, Y);

            ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic();
            TextSymbol sym = new TextSymbol();
            sym.Text = "Text goes here";
            sym.FontSize = 9;
            sym.Foreground = new SolidColorBrush { Color = Colors.Black }; 
            
            sym.OffsetX = 2;  // experiment with offsets to help horizontally  
            sym.OffsetY = 2;  // and vertically  
            
            graphic.Geometry = pt;
            graphic.Symbol = sym;
0 Kudos