Ejemplo n.º 1
0
        public MarkupEnterLine(Markup markup, MarkupPoint first, MarkupPoint second, Alignment firstAlignment = Alignment.Centre, Alignment secondAlignment = Alignment.Centre) : base(markup, MarkupPointPair.FromPoints(first, second, out bool invert), false)
        {
            StartAlignment = !invert ? firstAlignment : secondAlignment;
            EndAlignment   = !invert ? secondAlignment : firstAlignment;

            Update(true);
        }
Ejemplo n.º 2
0
        public static ObjectsMap Befor1_9(Markup markup, ObjectsMap map)
        {
            if (map == null)
            {
                map = new ObjectsMap();
            }

            foreach (var enter in markup.Enters)
            {
                ref var segment = ref enter.GetSegment();
                if (segment.Info.m_vehicleTypes.IsFlagSet(VehicleInfo.VehicleType.Plane))
                {
                    var sourceId = MarkupPoint.GetId(enter.Id, 2, MarkupPoint.PointType.Enter);
                    var targetId = MarkupPoint.GetId(enter.Id, 3, MarkupPoint.PointType.Enter);
                    map.AddPoint(sourceId, targetId);

                    sourceId = MarkupPoint.GetId(enter.Id, 2, MarkupPoint.PointType.Crosswalk);
                    targetId = MarkupPoint.GetId(enter.Id, 3, MarkupPoint.PointType.Crosswalk);
                    map.AddPoint(sourceId, targetId);

                    sourceId = MarkupPoint.GetId(enter.Id, 2, MarkupPoint.PointType.Normal);
                    targetId = MarkupPoint.GetId(enter.Id, 3, MarkupPoint.PointType.Normal);
                    map.AddPoint(sourceId, targetId);
                }
            }
Ejemplo n.º 3
0
 public void AddPoint(ushort enter, byte source, byte target)
 {
     foreach (var pointType in Enum.GetValues(typeof(MarkupPoint.PointType)).OfType <MarkupPoint.PointType>())
     {
         AddPoint(MarkupPoint.GetId(enter, source, pointType), MarkupPoint.GetId(enter, target, pointType));
     }
 }
Ejemplo n.º 4
0
        protected override IEnumerable <MarkupPoint> GetTarget(Enter enter, MarkupPoint ignore)
        {
            var allow = enter.Points.Select(i => 1).ToArray();

            if (ignore != null && ignore.Enter == enter)
            {
                if ((Markup.SupportLines & MarkupLine.LineType.Stop) == 0)
                {
                    yield break;
                }

                var ignoreIdx = ignore.Num - 1;
                var leftIdx   = ignoreIdx;
                var rightIdx  = ignoreIdx;

                foreach (var line in enter.Markup.Lines.Where(l => l.Type == MarkupLine.LineType.Stop && l.Start.Enter == enter))
                {
                    var from = Math.Min(line.Start.Num, line.End.Num) - 1;
                    var to   = Math.Max(line.Start.Num, line.End.Num) - 1;
                    if (from < ignore.Num - 1 && ignore.Num - 1 < to)
                    {
                        yield break;
                    }

                    allow[from] = 2;
                    allow[to]   = 2;

                    for (var i = from + 1; i <= to - 1; i += 1)
                    {
                        allow[i] = 0;
                    }

                    if (line.ContainsPoint(ignore))
                    {
                        var otherIdx = line.PointPair.GetOther(ignore).Num - 1;
                        if (otherIdx < ignoreIdx)
                        {
                            leftIdx = otherIdx;
                        }
                        else if (otherIdx > ignoreIdx)
                        {
                            rightIdx = otherIdx;
                        }
                    }
                }

                SetNotAllow(allow, leftIdx == ignoreIdx ? Find(allow, ignoreIdx, -1) : leftIdx, -1);
                SetNotAllow(allow, rightIdx == ignoreIdx ? Find(allow, ignoreIdx, 1) : rightIdx, 1);
                allow[ignoreIdx] = 0;
            }

            foreach (var point in enter.Points)
            {
                if (allow[point.Num - 1] != 0)
                {
                    yield return(point);
                }
            }
        }
Ejemplo n.º 5
0
        private void OnPointDrag(MarkupPoint point)
        {
            var normal = point.Enter.CornerDir.Turn90(true);

            Line2.Intersect(point.Position.XZ(), (point.Position + point.Enter.CornerDir).XZ(), MouseWorldPosition.XZ(), (MouseWorldPosition + normal).XZ(), out float offsetChange, out _);

            point.Offset = (point.Offset + offsetChange * Mathf.Sin(point.Enter.CornerAndNormalAngle)).RoundToNearest(0.01f);
        }
Ejemplo n.º 6
0
 protected void SetTarget(MarkupPoint ignore = null)
 {
     TargetPoints.Clear();
     foreach (var enter in Tool.Markup.Enters)
     {
         TargetPoints.AddRange(GetTarget(enter, ignore));
     }
 }
Ejemplo n.º 7
0
        private void SetEnterTarget(Enter enter, MarkupPoint ignore)
        {
            if (ignore == null || ignore.Enter != enter)
            {
                TargetPoints.AddRange(enter.Points.Cast <MarkupPoint>());
                return;
            }

            var allow     = enter.Points.Select(i => 1).ToArray();
            var ignoreIdx = ignore.Num - 1;
            var leftIdx   = ignoreIdx;
            var rightIdx  = ignoreIdx;

            foreach (var line in enter.Markup.Lines.Where(l => l.Type == MarkupLine.LineType.Stop && l.Start.Enter == enter))
            {
                var from = Math.Min(line.Start.Num, line.End.Num) - 1;
                var to   = Math.Max(line.Start.Num, line.End.Num) - 1;
                if (from < ignore.Num - 1 && ignore.Num - 1 < to)
                {
                    return;
                }
                allow[from] = 2;
                allow[to]   = 2;

                for (var i = from + 1; i <= to - 1; i += 1)
                {
                    allow[i] = 0;
                }

                if (line.ContainsPoint(ignore))
                {
                    var otherIdx = line.PointPair.GetOther(ignore).Num - 1;
                    if (otherIdx < ignoreIdx)
                    {
                        leftIdx = otherIdx;
                    }
                    else if (otherIdx > ignoreIdx)
                    {
                        rightIdx = otherIdx;
                    }
                }
            }

            SetNotAllow(allow, leftIdx == ignoreIdx ? Find(allow, ignoreIdx, -1) : leftIdx, -1);
            SetNotAllow(allow, rightIdx == ignoreIdx ? Find(allow, ignoreIdx, 1) : rightIdx, 1);
            allow[ignoreIdx] = 0;

            foreach (var point in enter.Points)
            {
                if (allow[point.Num - 1] != 0)
                {
                    TargetPoints.Add(point);
                }
            }
        }
Ejemplo n.º 8
0
        private void OnPointDrag(MarkupPoint point)
        {
            RaycastInput input = new RaycastInput(MouseRay, MouseRayLength);

            RayCast(input, out RaycastOutput output);

            var normal = point.Enter.CornerDir.Turn90(true);

            Line2.Intersect(VectorUtils.XZ(point.Position), VectorUtils.XZ(point.Position + point.Enter.CornerDir), VectorUtils.XZ(output.m_hitPos), VectorUtils.XZ(output.m_hitPos + normal), out float offsetChange, out _);

            point.Offset = (point.Offset + offsetChange).RoundToNearest(0.01f);
        }
Ejemplo n.º 9
0
 public static void RenderPointOverlay(RenderManager.CameraInfo cameraInfo, MarkupPoint point, Color color, float width)
 {
     if (point.Type == MarkupPoint.PointType.Crosswalk)
     {
         var dir    = point.Enter.CornerDir.Turn90(true) * MarkupCrosswalkPoint.Shift;
         var bezier = new Line3(point.Position - dir, point.Position + dir).GetBezier();
         RenderBezier(cameraInfo, color, bezier, width);
     }
     else
     {
         RenderCircle(cameraInfo, color, point.Position, width);
     }
 }
Ejemplo n.º 10
0
 public override void OnSecondaryMouseClicked()
 {
     if (IsSelectPoint)
     {
         SelectPoint = null;
         SetTarget();
     }
     else
     {
         Tool.SetMarkup(null);
         Tool.SetMode(ToolModeType.Select);
     }
 }
Ejemplo n.º 11
0
 public override bool OnEscape()
 {
     if (IsSelectPoint)
     {
         SelectPoint = null;
         SetTarget();
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 12
0
        private FloatPropertyPanel AddPointProperty(MarkupPoint point)
        {
            var pointProperty = ComponentPool.Get <FloatPropertyPanel>(PropertiesPanel);

            pointProperty.Text      = $"Point #{point.Num} offset" /*NodeMarkup.Localize.PointEditor_Offset*/;
            pointProperty.UseWheel  = true;
            pointProperty.WheelStep = 0.1f;
            pointProperty.WheelTip  = WheelTip;
            pointProperty.Init();
            pointProperty.Value           = point.Offset;
            pointProperty.OnValueChanged += OffsetChanged;
            //pointProperty.OnHover += Hover;
            //pointProperty.OnLeave += Leave;
            return(pointProperty);

            void OffsetChanged(float value) => point.Offset = value;
            void Hover() => HoverPoint = point;
        }
Ejemplo n.º 13
0
        private void SetCrosswalkTarget(Enter enter, MarkupPoint ignore)
        {
            if (ignore != null && ignore.Enter != enter)
            {
                return;
            }

            var allow  = enter.Crosswalks.Select(i => 1).ToArray();
            var bridge = new Dictionary <MarkupPoint, int>();

            foreach (var crosswalk in enter.Crosswalks)
            {
                bridge.Add(crosswalk, bridge.Count);
            }

            var isIgnore  = ignore?.Enter == enter;
            var ignoreIdx = isIgnore ? bridge[ignore] : 0;

            var leftIdx  = ignoreIdx;
            var rightIdx = ignoreIdx;

            foreach (var line in enter.Markup.Lines.Where(l => l.Type == MarkupLine.LineType.Crosswalk && l.Start.Enter == enter))
            {
                var from = Math.Min(bridge[line.Start], bridge[line.End]);
                var to   = Math.Max(bridge[line.Start], bridge[line.End]);
                allow[from] = 2;
                allow[to]   = 2;
                for (var i = from + 1; i <= to - 1; i += 1)
                {
                    allow[i] = 0;
                }

                if (isIgnore && line.ContainsPoint(ignore))
                {
                    var otherIdx = bridge[line.PointPair.GetOther(ignore)];
                    if (otherIdx < ignoreIdx)
                    {
                        leftIdx = otherIdx;
                    }
                    else if (otherIdx > ignoreIdx)
                    {
                        rightIdx = otherIdx;
                    }
                }
            }

            if (isIgnore)
            {
                SetNotAllow(allow, leftIdx == ignoreIdx ? Find(allow, ignoreIdx, -1) : leftIdx, -1);
                SetNotAllow(allow, rightIdx == ignoreIdx ? Find(allow, ignoreIdx, 1) : rightIdx, 1);
                allow[ignoreIdx] = 0;
            }

            foreach (var point in bridge)
            {
                if (allow[point.Value] != 0)
                {
                    TargetPoints.Add(point.Key);
                }
            }
        }
Ejemplo n.º 14
0
 public override void OnPrimaryMouseClicked(Event e)
 {
     SelectPoint = HoverPoint;
     SetTarget(SelectPoint);
 }
Ejemplo n.º 15
0
 protected override void Reset(IToolMode prevMode)
 {
     HoverPoint  = null;
     SelectPoint = null;
     SetTarget();
 }
Ejemplo n.º 16
0
 protected abstract IEnumerable <MarkupPoint> GetTarget(Enter enter, MarkupPoint ignore);
Ejemplo n.º 17
0
 protected MarkupEnterLine(Markup markup, MarkupPoint first, MarkupPoint second, Style style, Alignment firstAlignment, Alignment secondAlignment) : this(markup, MarkupPointPair.FromPoints(first, second, out bool invert), style, !invert ? firstAlignment : secondAlignment, !invert ? secondAlignment : firstAlignment)
 {
 }
Ejemplo n.º 18
0
 public MarkupEnterLine(Markup markup, MarkupPoint first, MarkupPoint second) : base(markup, first, second, RegularLineStyle.RegularLineType.Dashed)
 {
 }
Ejemplo n.º 19
0
 public MarkupFillerTempLine(Markup markup, MarkupPoint first, MarkupPoint second, Alignment alignment) : base(markup, first, second, null, alignment)
 {
 }
Ejemplo n.º 20
0
 private void RenderPointOverlay(RenderManager.CameraInfo cameraInfo, MarkupPoint point)
 {
     RenderManager.OverlayEffect.DrawCircle(cameraInfo, point.Color, point.Position, 1f, -1f, 1280f, false, true);
 }
Ejemplo n.º 21
0
 public static void RenderPointOverlay(RenderManager.CameraInfo cameraInfo, MarkupPoint point) => RenderPointOverlay(cameraInfo, point, point.Color, 1f);
Ejemplo n.º 22
0
        private void SetTarget(MarkupPoint.PointType pointType = MarkupPoint.PointType.Enter, MarkupPoint ignore = null)
        {
            TargetPoints.Clear();
            foreach (var enter in EditMarkup.Enters)
            {
                if ((pointType & MarkupPoint.PointType.Enter) == MarkupPoint.PointType.Enter)
                {
                    SetEnterTarget(enter, ignore);
                }

                if ((pointType & MarkupPoint.PointType.Crosswalk) == MarkupPoint.PointType.Crosswalk)
                {
                    SetCrosswalkTarget(enter, ignore);
                }
            }
        }
Ejemplo n.º 23
0
 private void RenderNodeEnterPointsOverlay(RenderManager.CameraInfo cameraInfo, MarkupPoint ignore = null)
 {
     foreach (var enter in EditMarkup.Enters)
     {
         foreach (var point in enter.Points.Where(p => p != ignore))
         {
             RenderPointOverlay(cameraInfo, point);
         }
     }
 }
Ejemplo n.º 24
0
 public void EditPoint(MarkupPoint point) => Edit <PointsEditor, MarkupPoint>(point);
Ejemplo n.º 25
0
        public void EditPoint(MarkupPoint point)
        {
            var editor = SelectEditor <PointsEditor>();

            editor?.UpdateEditor(point);
        }
Ejemplo n.º 26
0
 protected override void Reset(BaseToolMode prevMode)
 {
     DragPoint = prevMode is MakeLineToolMode makeLineMode ? makeLineMode.HoverPoint : null;
 }
        private static IMarkup DoGraphicToIMarkup(IGraphic graphic)
        {
            if (graphic == null || graphic.ParentPresentationImage == null)
                return null;

            IMarkup markup = null;
            var roiGraphic = graphic as RoiGraphic;
            if (roiGraphic != null)
            {
                if (roiGraphic.Roi is EllipticalRoi)
                {
                    var ellipse = roiGraphic.Roi as EllipticalRoi;

                    markup = new MarkupEllipse
                    {
                        TopLeft = new PointF(ellipse.BoundingBox.Left, ellipse.BoundingBox.Top),
                        BottomRight = new PointF(ellipse.BoundingBox.Right, ellipse.BoundingBox.Bottom),
                        Name = graphic.Name,
                        GraphicHashcode = graphic.GetHashCode(),
                        CalloutLocation = roiGraphic.Callout.TextLocation
                    };
                }

                else if (roiGraphic.Roi is PolygonalRoi)
                {
                    var polygon = roiGraphic.Roi as PolygonalRoi;

                    markup = new MarkupPolygonal
                    {
                        Name = graphic.Name,
                        Vertices = polygon.Polygon.Vertices == null ? null : new List<PointF>(polygon.Polygon.Vertices),
                        GraphicHashcode = graphic.GetHashCode(),
                        CalloutLocation = roiGraphic.Callout.TextLocation
                    };
                }

                else if (roiGraphic.Roi is RectangularRoi)
                {
                    var rectangularRoi = roiGraphic.Roi as RectangularRoi;

                    markup = new MarkupRectangle
                    {
                        TopLeft = new PointF(rectangularRoi.BoundingBox.Left, rectangularRoi.BoundingBox.Top),
                        BottomRight = new PointF(rectangularRoi.BoundingBox.Right, rectangularRoi.BoundingBox.Bottom),
                        Name = graphic.Name,
                        GraphicHashcode = graphic.GetHashCode(),
                        CalloutLocation = roiGraphic.Callout.TextLocation
                    };
                }

                else if (roiGraphic.Roi is ProtractorRoi)
                {
                    var protractorRoi = roiGraphic.Roi as ProtractorRoi;

                    markup = new MarkupProtractor
                    {
                        TopLeft = new PointF(protractorRoi.BoundingBox.Left, protractorRoi.BoundingBox.Top),
                        BottomRight = new PointF(protractorRoi.BoundingBox.Right, protractorRoi.BoundingBox.Bottom),
                        Name = graphic.Name,
                        Points = protractorRoi.Points == null ? null : new List<PointF>(protractorRoi.Points),
                        GraphicHashcode = graphic.GetHashCode(),
                        CalloutLocation = roiGraphic.Callout.TextLocation
                    };
                }
                else if (roiGraphic.Roi is LinearRoi)
                {
                    var linearRoi = roiGraphic.Roi as LinearRoi;

                    markup = new MarkupLinear
                    {
                        Vertices = linearRoi.Points == null ? null : new List<PointF>(linearRoi.Points),
                        Name = graphic.Name,
                        GraphicHashcode = graphic.GetHashCode(),
                        CalloutLocation = roiGraphic.Callout.TextLocation
                    };
                }

                if (markup != null)
                    markup.CaptionText = roiGraphic.Roi.GetType().Name + Environment.NewLine + roiGraphic.Callout.Text;
            }
            else if (graphic is UserCalloutGraphic)
            {
                var userCalloutGraphic = graphic as UserCalloutGraphic;
                markup = new MarkupPoint
                {
                    Name = graphic.Name,
                    CaptionText = userCalloutGraphic.Text,
                    CalloutText = userCalloutGraphic.Text,
                    CalloutLocation = userCalloutGraphic.TextLocation,
                    Point = userCalloutGraphic.AnchorPoint,
                    GraphicHashcode = graphic.GetHashCode()
                };
            }
            else if (graphic is CrosshairCalloutGraphic)
            {
                var userCalloutGraphic = graphic as CrosshairCalloutGraphic;
                markup = new MarkupPoint
                {
                    Name = graphic.Name,
                    CaptionText = userCalloutGraphic.Text,
                    CalloutText = userCalloutGraphic.Text,
                    CalloutLocation = userCalloutGraphic.TextLocation,
                    Point = userCalloutGraphic.AnchorPoint,
                    UseCrosshair = true,
                    GraphicHashcode = graphic.GetHashCode()
                };
            }
            else if (graphic is InvariantTextPrimitive)
            {
                var textGraphic = (InvariantTextPrimitive)graphic;
                markup = new MarkupPoint
                {
                    Name = graphic.Name,
                    CaptionText = textGraphic.Text,
                    CalloutText = textGraphic.Text,
                    CalloutLocation = textGraphic.Location,
                    Point = textGraphic.Location,
                    UseCrosshair = false,
                    GraphicHashcode = graphic.GetHashCode()
                };
            }
            else if (graphic is ContextMenuControlGraphic)
            {
                markup = DoGraphicToIMarkup(((ContextMenuControlGraphic)graphic).Subject);
            }
            else if (graphic is AimGraphic)
            {
                markup = DoGraphicToIMarkup(((AimGraphic)graphic).Graphic);
                // Fix name - not all composite graphics may have the Name set correctly
                if (markup != null)
                    markup.Name = ((AimGraphic)graphic).Graphic.Name;
            }
            else if (graphic is StandardStatefulGraphic)
            {
                markup = DoGraphicToIMarkup(((StandardStatefulGraphic)graphic).Subject);
            }
            else if (graphic is SegFrameImageGraphic)
            {
                // NO-OP
                // TODO: implement IMarkup for this type of graphic if we ever need to have segmentation graphic in the TemplateTree
            }
            else
                System.Diagnostics.Debug.Assert(false, "Could not create Markup from " + graphic.GetType().Name);

            return markup;
        }
Ejemplo n.º 28
0
        private static IMarkup DoGraphicToIMarkup(IGraphic graphic)
        {
            if (graphic == null || graphic.ParentPresentationImage == null)
            {
                return(null);
            }

            IMarkup markup     = null;
            var     roiGraphic = graphic as RoiGraphic;

            if (roiGraphic != null)
            {
                if (roiGraphic.Roi is EllipticalRoi)
                {
                    var ellipse = roiGraphic.Roi as EllipticalRoi;

                    markup = new MarkupEllipse
                    {
                        TopLeft         = new PointF(ellipse.BoundingBox.Left, ellipse.BoundingBox.Top),
                        BottomRight     = new PointF(ellipse.BoundingBox.Right, ellipse.BoundingBox.Bottom),
                        Name            = graphic.Name,
                        GraphicHashcode = graphic.GetHashCode(),
                        CalloutLocation = roiGraphic.Callout.TextLocation
                    };
                }

                else if (roiGraphic.Roi is PolygonalRoi)
                {
                    var polygon = roiGraphic.Roi as PolygonalRoi;

                    markup = new MarkupPolygonal
                    {
                        Name            = graphic.Name,
                        Vertices        = polygon.Polygon.Vertices == null ? null : new List <PointF>(polygon.Polygon.Vertices),
                        GraphicHashcode = graphic.GetHashCode(),
                        CalloutLocation = roiGraphic.Callout.TextLocation
                    };
                }

                else if (roiGraphic.Roi is RectangularRoi)
                {
                    var rectangularRoi = roiGraphic.Roi as RectangularRoi;

                    markup = new MarkupRectangle
                    {
                        TopLeft         = new PointF(rectangularRoi.BoundingBox.Left, rectangularRoi.BoundingBox.Top),
                        BottomRight     = new PointF(rectangularRoi.BoundingBox.Right, rectangularRoi.BoundingBox.Bottom),
                        Name            = graphic.Name,
                        GraphicHashcode = graphic.GetHashCode(),
                        CalloutLocation = roiGraphic.Callout.TextLocation
                    };
                }

                else if (roiGraphic.Roi is ProtractorRoi)
                {
                    var protractorRoi = roiGraphic.Roi as ProtractorRoi;

                    markup = new MarkupProtractor
                    {
                        TopLeft         = new PointF(protractorRoi.BoundingBox.Left, protractorRoi.BoundingBox.Top),
                        BottomRight     = new PointF(protractorRoi.BoundingBox.Right, protractorRoi.BoundingBox.Bottom),
                        Name            = graphic.Name,
                        Points          = protractorRoi.Points == null ? null : new List <PointF>(protractorRoi.Points),
                        GraphicHashcode = graphic.GetHashCode(),
                        CalloutLocation = roiGraphic.Callout.TextLocation
                    };
                }
                else if (roiGraphic.Roi is LinearRoi)
                {
                    var linearRoi = roiGraphic.Roi as LinearRoi;

                    markup = new MarkupLinear
                    {
                        Vertices        = linearRoi.Points == null ? null : new List <PointF>(linearRoi.Points),
                        Name            = graphic.Name,
                        GraphicHashcode = graphic.GetHashCode(),
                        CalloutLocation = roiGraphic.Callout.TextLocation
                    };
                }

                if (markup != null)
                {
                    markup.CaptionText = roiGraphic.Roi.GetType().Name + Environment.NewLine + roiGraphic.Callout.Text;
                }
            }
            else if (graphic is UserCalloutGraphic)
            {
                var userCalloutGraphic = graphic as UserCalloutGraphic;
                markup = new MarkupPoint
                {
                    Name            = graphic.Name,
                    CaptionText     = userCalloutGraphic.Text,
                    CalloutText     = userCalloutGraphic.Text,
                    CalloutLocation = userCalloutGraphic.TextLocation,
                    Point           = userCalloutGraphic.AnchorPoint,
                    GraphicHashcode = graphic.GetHashCode()
                };
            }
            else if (graphic is CrosshairCalloutGraphic)
            {
                var userCalloutGraphic = graphic as CrosshairCalloutGraphic;
                markup = new MarkupPoint
                {
                    Name            = graphic.Name,
                    CaptionText     = userCalloutGraphic.Text,
                    CalloutText     = userCalloutGraphic.Text,
                    CalloutLocation = userCalloutGraphic.TextLocation,
                    Point           = userCalloutGraphic.AnchorPoint,
                    UseCrosshair    = true,
                    GraphicHashcode = graphic.GetHashCode()
                };
            }
            else if (graphic is InvariantTextPrimitive)
            {
                var textGraphic = (InvariantTextPrimitive)graphic;
                markup = new MarkupPoint
                {
                    Name            = graphic.Name,
                    CaptionText     = textGraphic.Text,
                    CalloutText     = textGraphic.Text,
                    CalloutLocation = textGraphic.Location,
                    Point           = textGraphic.Location,
                    UseCrosshair    = false,
                    GraphicHashcode = graphic.GetHashCode()
                };
            }
            else if (graphic is ContextMenuControlGraphic)
            {
                markup = DoGraphicToIMarkup(((ContextMenuControlGraphic)graphic).Subject);
            }
            else if (graphic is AimGraphic)
            {
                markup = DoGraphicToIMarkup(((AimGraphic)graphic).Graphic);
                // Fix name - not all composite graphics may have the Name set correctly
                if (markup != null)
                {
                    markup.Name = ((AimGraphic)graphic).Graphic.Name;
                }
            }
            else if (graphic is StandardStatefulGraphic)
            {
                markup = DoGraphicToIMarkup(((StandardStatefulGraphic)graphic).Subject);
            }
            else if (graphic is SegFrameImageGraphic)
            {
                // NO-OP
                // TODO: implement IMarkup for this type of graphic if we ever need to have segmentation graphic in the TemplateTree
            }
            else
            {
                System.Diagnostics.Debug.Assert(false, "Could not create Markup from " + graphic.GetType().Name);
            }

            return(markup);
        }