Hi ,
I am stuck with a simple issue and am struggling to get that to work for a few hours now . I am just trying to add a label to a circle that I drew on my map , the circle is drawn based on a centre point and its links to other points. Everything is working fine but adding a label on the circle doesn’t work using the same code…
layer is InMemoryFeatureLayer – I have other methods that return the layer and other variables like PointID , key etc… not declared below . . . this code is working perfectly
layer.Columns.Add(new FeatureSourceColumn("Range"));
PointShape DPoint = new PointShape(X,Y);
double maxLenth = 0.0;
double minLenth = 0.0;
int count = 0;
ValueStyle valueStyle = new ValueStyle();
valueStyle.ColumnName = "Range";
Random r = new Random();
Feature centerPoint = new Feature(Latitude,Longitude, PointId);
centerPoint.Tag = PointId;
centerPoint.ColumnValues.Add("Range", key + "point");
valueStyle.ValueItems.Add(new ValueItem(key + "point", PointStyles.CreateSimpleStarStyle(GeoColor.SimpleColors.Black, 10)));
layer.InternalFeatures.Add(key + (count++).ToString(), centerPoint);
for (int i = 0; i < Connections.Count(); i++)
{
var item = Connections[i];
PointShape RPoint = new PointShape(item.Latitude,item.Longitude);
Feature point = new Feature(Convert.ToDouble(item.Latitude), Convert.ToDouble(item.Longitude), item.CustomerId);
point.ColumnValues.Add("Range", key + "point" + i.ToString());
point.Tag =PointId;
valueStyle.ValueItems.Add(new ValueItem(key + "point" + i.ToString(), PointStyles.CreateSimpleTriangleStyle(GeoColor.SimpleColors.Black, 10)));
layer.InternalFeatures.Add(key + (count++).ToString(), point);
LineShape lshape = new LineShape();
lshape.Vertices.Add(new Vertex(DPoint));
lshape.Vertices.Add(new Vertex(RPoint));
double rlenth = DPoint.GetDistanceTo(RPoint, GeographyUnit.Feet, DistanceUnit.Mile);
if (rlenth == 0)
continue;
if (maxLenth < rlenth)
maxLenth = rlenth;
if (minLenth != 0 && minLenth > rlenth)
minLenth = rlenth;
GeoColor rdbrandomColor = getColor(item);
Feature lineShape = new Feature(lshape);
lineShape.ColumnValues.Add("Range", key + i.ToString());
valueStyle.ValueItems.Add(new ValueItem(key + i.ToString(), LineStyles.CreateSimpleLineStyle(rdbrandomColor, 2, true)));
lineShape.Tag = PointId;
layer.InternalFeatures.Add(key + (count++).ToString(), lineShape);
}
EllipseShape centerShape = new EllipseShape(DPoint, maxLenth, GeographyUnit.Feet, DistanceUnit.Mile);
wagonWheelInformation.areaCovered = centerShape.GetArea(GeographyUnit.Feet,AreaUnit.Acres);
wagonWheelInformation.maxdistance = maxLenth;
wagonWheelInformation.mindistance = minLenth;
var centerCircle = new Feature(centerShape);
centerCircle.ColumnValues.Add("Range", key + "Circle");
valueStyle.ValueItems.Add(new ValueItem(key + "Circle", new AreaStyle(new GeoPen(GeoColor.SimpleColors.DarkBlue), new GeoSolidBrush(new GeoColor(50, GeoColor.GeographicColors.Ice)))));
centerCircle.Tag = wagon.Center.CustomerId;
layer.InternalFeatures.Add(key + (count++).ToString(), centerCircle);
layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle);
//On top of the Circle(attached to it outside) I want a label with a custom-style , text in a box…
I do not want to create another layer ; I tried using one of the solutions provided in the discussions but somehow it didnt work ; it was on creating a label on the circle’s perimeter.
Need a simple solution that can be added to this code above.
Thanks in advance.
Kreez .