Esempio n. 1
0
        public static bool FromId(int id, Markup markup, ObjectsMap map, out MarkupPoint point)
        {
            point = null;

            var enterId = GetEnter(id);
            var num     = GetNum(id);
            var type    = GetType(id);

            if (map.TryGetValue(new ObjectId()
            {
                Segment = enterId
            }, out ObjectId targetSegment))
            {
                enterId = targetSegment.Segment;
            }
            if (map.TryGetValue(new ObjectId()
            {
                Point = GetId(enterId, num, type)
            }, out ObjectId targetPoint))
            {
                num = GetNum(targetPoint.Point);
            }

            return(markup.TryGetEnter(enterId, out Enter enter) && enter.TryGetPoint(num, type, out point));
        }
Esempio n. 2
0
        public static bool FromId(int id, Markup markup, Dictionary <ObjectId, ObjectId> map, out MarkupPoint point)
        {
            point = null;

            var enterId = GetEnter(id);
            var num     = GetNum(id);

            if (map != null)
            {
                if (map.TryGetValue(new ObjectId()
                {
                    Segment = enterId
                }, out ObjectId targetSegment))
                {
                    enterId = targetSegment.Segment;
                }
                if (map.TryGetValue(new ObjectId()
                {
                    Point = GetId(enterId, num)
                }, out ObjectId targetPoint))
                {
                    num = GetNum(targetPoint.Point);
                }
            }

            return(markup.TryGetEnter(enterId, out Enter enter) && enter.TryGetPoint(num, out point));
        }
Esempio n. 3
0
        public static bool FromId(int id, Markup markup, ObjectsMap map, out MarkupPoint point)
        {
            point = null;

            var enterId = GetEnter(id);
            var num     = GetNum(id);
            var type    = GetType(id);

            switch (markup.Type)
            {
            case MarkupType.Node when map.TryGetValue(new ObjectId()
                {
                    Segment = enterId
                }, out ObjectId targetSegment):
                enterId = targetSegment.Segment;

                break;

            case MarkupType.Segment when map.TryGetValue(new ObjectId()
                {
                    Node = enterId
                }, out ObjectId targetNode):
                enterId = targetNode.Node;

                break;
            }

            if (map.TryGetValue(new ObjectId()
            {
                Point = GetId(enterId, num, type)
            }, out ObjectId targetPoint))
            {
                num = GetNum(targetPoint.Point);
            }

            return(markup.TryGetEnter(enterId, out Enter enter) && enter.TryGetPoint(num, type, out point));
        }