Beispiel #1
0
        public Rail FindOrCreateRail(Point s, Point t)
        {
            var p0 = s;
            var p1 = t;

            var  t1 = new SymmetricSegment(p0, p1);
            Rail rail;

            if (RailDictionary.TryGetValue(t1, out rail))
            {
                return(rail);
            }
            var t2 = new SymmetricSegment(p1, p0);

            if (RailDictionary.TryGetValue(t2, out rail))
            {
                return(rail);
            }

            // no rail exists // roman: please check that this code really can be commented out and does need to be fixed instead

            /*
             * var q0 = VisGraph.GetPointOfVisGraphVertex(s);
             * var q1 = VisGraph.GetPointOfVisGraphVertex(t);
             * if (q0 == null || q1 == null)
             * {
             *  //no visgraph vertex found
             * }
             * else
             * {
             *  var edge = VisGraph.FindEdge(q0.Point, q1.Point);
             * }*/
            return(CreateRail(p0, p1));
        }
Beispiel #2
0
        public Rail FindRail(Point s, Point t)
        {
            var  p0 = s;
            var  p1 = t;
            var  ss = new SymmetricSegment(p1, p0);
            Rail rail;

            RailDictionary.TryGetValue(ss, out rail);
            return(rail);
        }
Beispiel #3
0
        public Rail CreateRail(Point ep0, Point ep1)
        {
            var  st = new SymmetricSegment(ep0, ep1);
            Rail rail;

            if (RailDictionary.TryGetValue(st, out rail))
            {
                return(rail);
            }
            var ls = new LineSegment(ep0, ep1);

            rail = new Rail(ls, ZoomLevel);
            RailTree.Add(rail.BoundingBox, rail);
            RailDictionary.Add(st, rail);
            return(rail);
        }
Beispiel #4
0
        public Rail FindOrCreateRail(Point s, Point t)
        {
            var p0 = s;
            var p1 = t;

            var  t1 = new SymmetricSegment(p0, p1);
            Rail rail;

            if (RailDictionary.TryGetValue(t1, out rail))
            {
                return(rail);
            }
            var t2 = new SymmetricSegment(p1, p0);

            if (RailDictionary.TryGetValue(t2, out rail))
            {
                return(rail);
            }
            return(CreateRail(p0, p1));
        }