예제 #1
0
        private static List <RdfAddr> GetNldRdfAddrData(List <int> roadLinkIds)
        {
            var result = new List <RdfAddr>();

            foreach (var id in roadLinkIds)
            {
                // Get Data from RdfAddr
                RdfAddr newItem = GetRdfAddr(id);

                newItem.SwappedHno = false;

                if (newItem.LeftHnoStart != null && newItem.LeftHnoEnd != null &&
                    newItem.LeftHnoStart > newItem.LeftHnoEnd)
                {
                    Utils.Swap(ref newItem.LeftHnoStart, ref newItem.LeftHnoEnd);
                    newItem.SwappedHno = true;
                }

                if (newItem.RightHnoStart != null && newItem.RightHnoEnd != null &&
                    newItem.RightHnoStart > newItem.RightHnoEnd)
                {
                    Utils.Swap(ref newItem.RightHnoStart, ref newItem.RightHnoEnd);
                    newItem.SwappedHno = true;
                }

                result.Add(newItem);
            }

            return(result);
        }
예제 #2
0
        private static Segment GetSegmentsForAddr(RdfAddr addr)
        {
            var segment = GetRdfSeg(addr.RoadLinkId);

            // TODO: Enable this again?
            // if (addr.SwappedHno)
            //  segment.Coordinates.Reverse();

            return(segment);
        }
예제 #3
0
        public static int Compare(RdfAddr a1, RdfAddr a2)
        {
            var a1Min = a1.GetMinHno();
            var a2Min = a2.GetMinHno();

            if (a1Min == null)
            {
                return(1);
            }
            else if (a2Min == null)
            {
                return(-1);
            }
            else
            {
                return(a1Min.Value - a2Min.Value);
            }
        }
예제 #4
0
        private static RdfAddr GetRdfAddr(int roadLinkID)
        {
            var reader = DatabaseHelper.ExecuteReader(GlobalLibraryState.ConnectionString,
                                                      "SELECT LEFT_HNO_START, LEFT_HNO_END, RIGHT_HNO_START, RIGHT_HNO_END " +
                                                      $"FROM {GlobalLibraryState.RdfAddrTable} addr " +
                                                      "WHERE ROAD_LINK_ID = @1;", roadLinkID);

            var newItem = new RdfAddr();

            using (reader)
            {
                reader.Read();
                newItem.RoadLinkId    = roadLinkID;
                newItem.LeftHnoStart  = Utils.ParseIntHandleEmpty(reader.GetString("LEFT_HNO_START"));
                newItem.LeftHnoEnd    = Utils.ParseIntHandleEmpty(reader.GetString("LEFT_HNO_END"));
                newItem.RightHnoStart = Utils.ParseIntHandleEmpty(reader.GetString("RIGHT_HNO_START"));
                newItem.RightHnoEnd   = Utils.ParseIntHandleEmpty(reader.GetString("RIGHT_HNO_END"));
            }
            return(newItem);
        }