private IElement CreateArrowMarker(IPoint point, double angle) { //IMarkerSymbol arrowSymbol = new ArrowMarkerSymbolClass(); var arrowSymbol = (IMarkerSymbol)_objectFactory.Create("esriDisplay.ArrowMarkerSymbol"); arrowSymbol.Angle = angle; arrowSymbol.Color = Defaults.CurrentGpsPointColor.ToEsri(_objectFactory); arrowSymbol.Size = Defaults.CurrentGpsPointSize; //IElement marker = new MarkerElementClass(); var marker = (IElement)_objectFactory.Create("esriCarto.MarkerElement"); ((IMarkerElement)marker).Symbol = arrowSymbol; marker.Geometry = point; _elementId++; ((IElementProperties)marker).CustomProperty = _elementId; Graphics.AddElement(marker, 0); return(marker); }
private IElement AddLineGraphic(IPoint point1, IPoint point2) { //ISimpleLineSymbol lineSymbol = new SimpleLineSymbolClass(); var lineSymbol = (ISimpleLineSymbol)_objectFactory.Create("esriDisplay.SimpleLineSymbol"); lineSymbol.Color = Defaults.GpsTrackColor.ToEsri(_objectFactory); lineSymbol.Width = Defaults.GpsTrackWidth; //lineSymbol.Style = esriSimpleLineStyle.esriSLSSolid; //IElement line = new LineElementClass(); var line = (IElement)_objectFactory.Create("esriCarto.LineElement"); ((ILineElement)line).Symbol = lineSymbol; //IPolyline lineGeometry = new PolylineClass(); var lineGeometry = (IPolyline)_objectFactory.Create("esriGeometry.Polyline"); lineGeometry.FromPoint = point1; lineGeometry.ToPoint = point2; line.Geometry = lineGeometry; _elementId++; ((IElementProperties)line).CustomProperty = _elementId; Graphics.AddElement(line, 0); return(line); }
private int AddCepGraphic(IPoint point, IList <double> circleRadii) { //IMarkerSymbol symbol = new SimpleMarkerSymbolClass(); var symbol = (IMarkerSymbol)_objectFactory.Create("esriDisplay.SimpleMarkerSymbol"); symbol.Color = Defaults.CepCenterPointColor.ToEsri(_objectFactory); symbol.Size = Defaults.CepCenterPointSize; //IElement centerPoint = new MarkerElementClass(); var centerPoint = (IElement)_objectFactory.Create("esriCarto.MarkerElement"); ((IMarkerElement)centerPoint).Symbol = symbol; centerPoint.Geometry = point; //Create a graphic group and add the center point graphic //IGroupElement group = new GroupElementClass(); var group = (IGroupElement)_objectFactory.Create("esriCarto.GroupElement"); group.AddElement(centerPoint); if (circleRadii != null) { //Add the circles to the group for (int i = 0; i < circleRadii.Count; i++) { //IConstructCircularArc arc = new CircularArcClass(); var arc = (IConstructCircularArc)_objectFactory.Create("esriGeometry.CircularArc"); arc.ConstructCircle(point, circleRadii[i], false); //IGeometry polygon = new PolygonClass(); var polygon = (IGeometry)_objectFactory.Create("esriGeometry.Polygon"); ((ISegmentCollection)polygon).AddSegment((ISegment)arc); //IElement circle = new CircleElementClass(); var circle = (IElement)_objectFactory.Create("esriCarto.CircleElement"); circle.Geometry = polygon; var circleColor = Color.Black; if (Defaults.CepCircleOutlineColors != null) { var circleCount = Defaults.CepCircleOutlineColors.Length; if (circleCount > 0) { circleColor = Defaults.CepCircleOutlineColors[circleCount - 1]; if (circleCount > i) { circleColor = Defaults.CepCircleOutlineColors[i]; } } } var circleWidth = 1.0; if (Defaults.CepCircleOutlineWidths != null) { var circleCount = Defaults.CepCircleOutlineWidths.Length; if (circleCount > 0) { circleWidth = Defaults.CepCircleOutlineWidths[circleCount - 1]; if (circleCount > i) { circleWidth = Defaults.CepCircleOutlineWidths[i]; } } } ((IFillShapeElement)circle).Symbol = GetCepCircleSymbol(circleColor, circleWidth); group.AddElement(circle); } } //Give it the group an id number and add it to the graphics layer _elementId++; ((IElementProperties)group).CustomProperty = _elementId; Graphics.AddElement((IElement)group, 0); return(_elementId); }