11using  System ; 
22using  System . Linq ; 
3- using  Sandwych . MapMatchingKit . Topology ; 
4- using  System . Collections . Generic ; 
53using  System . Text ; 
4+ using  System . Collections . Generic ; 
5+ using  Sandwych . MapMatchingKit . Topology ; 
66using  Sandwych . MapMatchingKit . Spatial ; 
7- using  NetTopologySuite . Geometries ; 
8- using  GeoAPI . Geometries ; 
97using  Sandwych . MapMatchingKit . Spatial . Geometries ; 
108using  Sandwych . MapMatchingKit . Spatial . Index ; 
119
1210namespace  Sandwych . MapMatchingKit . Roads 
1311{ 
14-     public  class  RoadMap  :  AbstractGraph < Road > 
12+     /// Implementation of a road map with (directed) roads, i.e. {@link Road} objects. It provides a road 
13+     /// network for routing that is derived from {@link Graph} and spatial search of roads with a 
14+     /// {@link SpatialIndex}. 
15+     /// <para> 
16+     /// <b>Note:</b> Since {@link Road} objects are directed representations of {@link BaseRoad} objects, 
17+     /// identifiers have a special mapping, see {@link Road}. 
18+     /// </para> 
19+     public  sealed  class  RoadMap  :  AbstractGraph < Road > 
1520    { 
1621        public  ISpatialIndex < RoadInfo >  Index  {  get ;  } 
1722        private  readonly  ISpatialOperation  _spatial ; 
@@ -26,26 +31,25 @@ public RoadMap(IEnumerable<Road> roads) : this(roads, GeographySpatialOperation.
2631        { 
2732        } 
2833
29-         private  IEnumerable < RoadPoint >  Split ( IEnumerable < ( RoadInfo  road ,  double  distance ) >  points ) 
34+         private  IEnumerable < RoadPoint >  Split ( IEnumerable < ( RoadInfo  road ,  double  fraction ) >  points ) 
3035        { 
3136            /* 
3237             * This uses the road 
3338             */ 
3439            foreach  ( var  point  in  points ) 
3540            { 
36-                 yield  return  new  RoadPoint ( this . Edges [ point . road . Id  *  2 ] ,  point . Item2 ,  _spatial ) ; 
41+                 yield  return  new  RoadPoint ( this . Edges [ point . road . Id  *  2 ] ,  point . fraction ,  _spatial ) ; 
3742
3843                var  backwardRoadId  =  point . road . Id  *  2  +  1 ; 
3944                if  ( this . Edges . TryGetValue ( backwardRoadId ,  out  var  road ) ) 
4045                { 
41-                     yield  return  new  RoadPoint ( road ,  1.0  -  point . Item2 ,  _spatial ) ; 
46+                     yield  return  new  RoadPoint ( road ,  1.0  -  point . fraction ,  _spatial ) ; 
4247                } 
4348            } 
4449        } 
4550
46-         public  IEnumerable < RoadPoint >  Radius ( Coordinate2D  c ,  double  r )  => 
51+         public  IEnumerable < RoadPoint >  Radius ( in   Coordinate2D  c ,  double  r )  => 
4752            this . Split ( this . Index . Radius ( c ,  r ) ) ; 
4853
49- 
5054    } 
5155} 
0 commit comments