コード例 #1
0
 public void Setup()
 {
     polygons  = TestUtil.ReadCsvFile <HarbourPolygon, HarbourCsvClassMap>("./Resources/harbours_polygons.csv");
     index     = new GeohashSpatialIndex <int>(new DefaultGeohasher(), new DefaultTrieMap <int>(), 9);
     relations = new SpatialRelations <int>(index);
     foreach (var polygon in polygons)
     {
         index.Insert(polygon.Geom, polygon.HarbourId);
     }
 }
コード例 #2
0
        public void Setup()
        {
            polygons        = TestUtil.ReadCsvFile <HarbourPolygon, HarbourCsvClassMap>("./Resources/harbours_polygons.csv");
            vesselPositions = TestUtil.ReadCsvFile <VesselPosition, VesselPositionCsvClassMap>("./Resources/vessel_points.csv")
                              .Where(position => !(position.Geom.Coordinate.Y > 90 || position.Geom.Coordinate.Y < -90 ||
                                                   position.Geom.Coordinate.X > 180 || position.Geom.Coordinate.X < -180 ||
                                                   position.Sog > 100 || position.Cog == 360)).ToList();
            polygonIndex     = new GeohashSpatialIndex <int>(new DefaultGeohasher(), new DefaultTrieMap <int>(), 9);
            pointIndex       = new GeohashSpatialIndex <int>(new DefaultGeohasher(), new DefaultTrieMap <int>(), 8);
            polygonRelations = new SpatialRelations <int>(polygonIndex);
            pointRelations   = new SpatialRelations <int>(pointIndex);
            foreach (var polygon in polygons)
            {
                polygonIndex.InsertOrUpdate(polygon.Geom, polygon.HarbourId);
            }

            foreach (var position in vesselPositions.ToList())
            {
                pointIndex.InsertOrUpdate(position.Geom, position.Mmsi);
            }
        }