@@ -43,7 +43,7 @@ impl VertexBuffer {
4343}
4444
4545struct Shapefile {
46- entries : Vec < AreaRings > ,
46+ entries : Vec < 細分区域Rings > ,
4747}
4848
4949impl Shapefile {
@@ -71,26 +71,26 @@ Please follow:
7171 let entries = reader
7272 . iter_shapes_and_records ( )
7373 . flatten ( )
74- . flat_map ( |shape_record| AreaRings :: try_new ( shape_record. 0 , shape_record. 1 ) )
74+ . flat_map ( |shape_record| 細分区域Rings :: try_new ( shape_record. 0 , shape_record. 1 ) )
7575 . collect ( ) ;
7676
7777 Self { entries }
7878 }
7979}
8080
81- struct AreaRings {
82- 地震情報細分区域 : codes:: 地震情報細分区域 ,
81+ struct 細分区域Rings {
82+ 細分区域 : codes:: 地震情報細分区域 ,
8383 bounding_box : BoundingBox < GeoDegree > ,
8484 rings : Vec < Ring > ,
8585}
8686
87- impl AreaRings {
87+ impl 細分区域Rings {
8888 fn try_new ( shape : Shape , record : Record ) -> Option < Self > {
8989 let Shape :: Polygon ( polygon) = shape else {
9090 return None ;
9191 } ;
9292
93- let 地震情報細分区域 : codes:: 地震情報細分区域 = match record. get ( "code" ) . unwrap ( ) {
93+ let 細分区域 : codes:: 地震情報細分区域 = match record. get ( "code" ) . unwrap ( ) {
9494 FieldValue :: Character ( Some ( c) ) => match c. parse ( ) {
9595 Ok ( c) => codes:: 地震情報細分区域 ( c) ,
9696 Err ( _) => panic ! ( "コワッ…コワれたshapefileきた!" ) ,
@@ -108,7 +108,7 @@ impl AreaRings {
108108 . collect ( ) ;
109109
110110 Some ( Self {
111- 地震情報細分区域 ,
111+ 細分区域 ,
112112 bounding_box,
113113 rings,
114114 } )
@@ -122,20 +122,20 @@ pub(crate) struct PointReferences<'a> {
122122impl < ' a > PointReferences < ' a > {
123123 fn tally_of (
124124 shapefile : & ' a Shapefile ,
125- area_to_pref : & ' a HashMap < codes:: 地震情報細分区域 , codes:: 地震情報都道府県等 > ,
125+ 細分区域_to_都道府県等 : & ' a HashMap < codes:: 地震情報細分区域 , codes:: 地震情報都道府県等 > ,
126126 ) -> Self {
127127 let mut map: HashMap < Point , PointReference > = HashMap :: new ( ) ;
128128
129- shapefile. entries . iter ( ) . for_each ( |area_rings | {
130- let 地震情報細分区域 = area_rings . 地震情報細分区域 ;
129+ shapefile. entries . iter ( ) . for_each ( |rings | {
130+ let 細分区域 = rings . 細分区域 ;
131131
132- area_rings . rings . iter ( ) . for_each ( |ring| {
132+ rings . rings . iter ( ) . for_each ( |ring| {
133133 ring. iter_adjacent_points ( ) . for_each ( |point_set| {
134134 let reference = map
135135 . entry ( point_set. current )
136- . or_insert ( PointReference :: new ( area_to_pref ) ) ;
136+ . or_insert ( PointReference :: new ( 細分区域_to_都道府県等 ) ) ;
137137
138- reference. mark_area ( 地震情報細分区域 ) ;
138+ reference. mark_細分区域 ( 細分区域 ) ;
139139 reference. mark_point ( point_set. previous ) ;
140140 reference. mark_point ( point_set. next ) ;
141141 } ) ;
@@ -153,62 +153,63 @@ impl<'a> PointReferences<'a> {
153153 . collect ( )
154154 }
155155
156- fn pref_reference_count ( & self , line : & Line ) -> usize {
156+ fn 都道府県等_reference_count ( & self , line : & Line ) -> usize {
157157 let first = self . map . get ( line. vertices . first ( ) . unwrap ( ) ) . unwrap ( ) ;
158158 let last = self . map . get ( line. vertices . last ( ) . unwrap ( ) ) . unwrap ( ) ;
159159
160160 first
161- . pref_references ( )
162- . intersection ( & last. pref_references ( ) )
161+ . 都道府県等_references ( )
162+ . intersection ( & last. 都道府県等_references ( ) )
163163 . count ( )
164164 }
165165}
166166
167167pub ( crate ) struct PointReference < ' a > {
168- area_to_pref : & ' a HashMap < codes:: 地震情報細分区域 , codes:: 地震情報都道府県等 > ,
169- areas : HashSet < codes:: 地震情報細分区域 > ,
168+ 細分区域_to_都道府県等 : & ' a HashMap < codes:: 地震情報細分区域 , codes:: 地震情報都道府県等 > ,
169+ 細分区域s : HashSet < codes:: 地震情報細分区域 > ,
170170 adjacent_points : HashSet < Point > ,
171171}
172172
173173impl < ' a > PointReference < ' a > {
174174 fn new (
175- area_to_pref : & ' a HashMap < codes:: 地震情報細分区域 , codes:: 地震情報都道府県等 >
175+ 細分区域_to_都道府県等 : & ' a HashMap < codes:: 地震情報細分区域 , codes:: 地震情報都道府県等 >
176176 ) -> Self {
177177 Self {
178- area_to_pref ,
179- areas : HashSet :: new ( ) ,
178+ 細分区域_to_都道府県等 ,
179+ 細分区域s : HashSet :: new ( ) ,
180180 adjacent_points : HashSet :: new ( ) ,
181181 }
182182 }
183183
184- fn mark_area ( & mut self , area : codes:: 地震情報細分区域 ) {
185- self . areas . insert ( area ) ;
184+ fn mark_細分区域 ( & mut self , 細分区域 : codes:: 地震情報細分区域 ) {
185+ self . 細分区域s . insert ( 細分区域 ) ;
186186 }
187187
188188 fn mark_point ( & mut self , point : Point ) {
189189 self . adjacent_points . insert ( point) ;
190190 }
191191
192- fn area_references ( & self ) -> & HashSet < codes:: 地震情報細分区域 > {
193- & self . areas
192+ fn 細分区域_references ( & self ) -> & HashSet < codes:: 地震情報細分区域 > {
193+ & self . 細分区域s
194194 }
195195
196- pub ( crate ) fn pref_references ( & self ) -> HashSet < codes:: 地震情報都道府県等 > {
197- let areas = self
198- . area_references ( )
196+ pub ( crate ) fn 都道府県等_references ( & self ) -> HashSet < codes:: 地震情報都道府県等 > {
197+ let 都道府県等s = self
198+ . 細分区域_references ( )
199199 . iter ( )
200200 . filter ( |a| * * a != codes:: 地震情報細分区域:: UNNUMBERED )
201- . map ( |a| * self . area_to_pref . get ( a) . unwrap ( ) ) ;
201+ . map ( |a| * self . 細分区域_to_都道府県等 . get ( a) . unwrap ( ) ) ;
202202
203- HashSet :: from_iter ( areas )
203+ HashSet :: from_iter ( 都道府県等s )
204204 }
205205
206206 fn adjacent_points_count ( & self ) -> usize {
207207 self . adjacent_points . len ( )
208208 }
209209}
210+
210211pub fn read (
211- #[ allow( non_snake_case) ] area_code__pref_code : & HashMap <
212+ #[ allow( non_snake_case) ] 細分区域_to_都道府県等 : & HashMap <
212213 codes:: 地震情報細分区域 ,
213214 codes:: 地震情報都道府県等 ,
214215 > ,
@@ -229,16 +230,16 @@ pub fn read(
229230
230231 // @Siro_256 にゃ~っ…! (ΦωΦ)
231232
232- let 地震情報細分区域_centers = calculate_地震情報細分区域_centers ( & shapefile) ;
233+ let 細分区域_centers = calculate_細分区域_centers ( & shapefile) ;
233234
234- let 地震情報細分区域_bounding_box : HashMap < codes:: 地震情報細分区域 , BoundingBox < GeoDegree > > =
235+ let 細分区域_bounding_box : HashMap < codes:: 地震情報細分区域 , BoundingBox < GeoDegree > > =
235236 shapefile
236237 . entries
237238 . iter ( )
238239 . filter ( |rings| {
239- rings. 地震情報細分区域 != codes:: 地震情報細分区域:: UNNUMBERED
240+ rings. 細分区域 != codes:: 地震情報細分区域:: UNNUMBERED
240241 } )
241- . map ( |rings| ( rings. 地震情報細分区域 , rings. bounding_box ) )
242+ . map ( |rings| ( rings. 細分区域 , rings. bounding_box ) )
242243 . collect ( ) ;
243244
244245 let map_indices = shapefile
@@ -249,7 +250,7 @@ pub fn read(
249250 . map ( |point| vertex_buffer. insert ( point. into ( ) ) as u32 )
250251 . collect ( ) ;
251252
252- let references = PointReferences :: tally_of ( & shapefile, area_code__pref_code ) ;
253+ let references = PointReferences :: tally_of ( & shapefile, 細分区域_to_都道府県等 ) ;
253254
254255 let rings = shapefile
255256 . entries
@@ -267,14 +268,14 @@ pub fn read(
267268 . filter_map ( |( l, c) | if c > 1 { Some ( l) } else { None } )
268269 . collect ( ) ;
269270
270- let area_lines = lines
271+ let 細分区域_lines = lines
271272 . iter ( )
272- . filter ( |l| references. pref_reference_count ( l) == 1 )
273+ . filter ( |l| references. 都道府県等_reference_count ( l) == 1 )
273274 . collect_vec ( ) ;
274275
275- let pref_lines = lines
276+ let 都道府県等_lines = lines
276277 . iter ( )
277- . filter ( |l| references. pref_reference_count ( l) >= 2 )
278+ . filter ( |l| references. 都道府県等_reference_count ( l) >= 2 )
278279 . collect_vec ( ) ;
279280
280281 let lod_details = [
@@ -320,8 +321,8 @@ pub fn read(
320321 ( 100.0_f32 . powf ( 0.24 ) , 0.117 ) ,
321322 ] ;
322323
323- let area_lines = gen_lod ( & mut vertex_buffer, & lod_details, & area_lines ) ;
324- let pref_lines = gen_lod ( & mut vertex_buffer, & lod_details, & pref_lines ) ;
324+ let 細分区域_lines = gen_lod ( & mut vertex_buffer, & lod_details, & 細分区域_lines ) ;
325+ let 都道府県等_lines = gen_lod ( & mut vertex_buffer, & lod_details, & 都道府県等_lines ) ;
325326
326327 let scale_level_map = lod_details
327328 . into_iter ( )
@@ -334,12 +335,12 @@ pub fn read(
334335 // (ΦωΦ) < Meow !
335336 {
336337 (
337- 地震情報細分区域_bounding_box ,
338- 地震情報細分区域_centers ,
338+ 細分区域_bounding_box ,
339+ 細分区域_centers ,
339340 vertex_buffer. into_buffer ( ) ,
340341 map_indices,
341- area_lines ,
342- pref_lines ,
342+ 細分区域_lines ,
343+ 都道府県等_lines ,
343344 scale_level_map,
344345 )
345346 }
@@ -412,7 +413,7 @@ fn gen_lod(
412413 . collect ( )
413414}
414415
415- fn calculate_地震情報細分区域_centers (
416+ fn calculate_細分区域_centers (
416417 shapefile : & Shapefile ,
417418) -> HashMap < codes:: 地震情報細分区域 , Vertex < GeoDegree > > {
418419 use geo:: {
@@ -423,7 +424,7 @@ fn calculate_地震情報細分区域_centers(
423424 let weighted_vectors: HashMap < codes:: 地震情報細分区域 , Vec < ( f64 , geo:: Point ) > > = shapefile
424425 . entries
425426 . iter ( )
426- . filter ( |rings| rings. 地震情報細分区域 != codes:: 地震情報細分区域:: UNNUMBERED )
427+ . filter ( |rings| rings. 細分区域 != codes:: 地震情報細分区域:: UNNUMBERED )
427428 . map ( |rings| {
428429 let polygons: Vec < ( f64 , geo:: Point ) > = rings
429430 . rings
@@ -433,13 +434,13 @@ fn calculate_地震情報細分区域_centers(
433434 . map ( |geo_polygon| ( geo_polygon. unsigned_area ( ) , geo_polygon. centroid ( ) . unwrap ( ) ) )
434435 . collect ( ) ;
435436
436- ( rings. 地震情報細分区域 , polygons)
437+ ( rings. 細分区域 , polygons)
437438 } )
438439 . collect ( ) ;
439440
440441 let centers: HashMap < codes:: 地震情報細分区域 , Point > = weighted_vectors
441442 . into_iter ( )
442- . map ( |( 地震情報細分区域 , weighted_vectors) | {
443+ . map ( |( 細分区域 , weighted_vectors) | {
443444 let weight: f64 = weighted_vectors
444445 . iter ( )
445446 . map ( |( weight, _vector) | weight)
@@ -453,7 +454,7 @@ fn calculate_地震情報細分区域_centers(
453454 } )
454455 . fold ( Point :: new ( 0.0 . into ( ) , 0.0 . into ( ) ) , |a, b| a + b) ;
455456
456- ( 地震情報細分区域 , vector. divide_by ( weight as f32 ) )
457+ ( 細分区域 , vector. divide_by ( weight as f32 ) )
457458 } )
458459 . collect ( ) ;
459460
0 commit comments