Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9844234

Browse files
author
Alexander Korotkov
committed
Code cleanup by Dmitry Ivanov.
2 parents0d396cf +5424153 commit9844234

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4581
-4883
lines changed

‎box.c‎

Lines changed: 54 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,17 @@ PG_FUNCTION_INFO_V1(spherebox_cont_box_com_neg);
7373
PG_FUNCTION_INFO_V1(spherebox_overlap_box);
7474
PG_FUNCTION_INFO_V1(spherebox_overlap_box_neg);
7575

76-
/*
77-
* Checks the box: if latitude of south-west corner is larger than north-east
78-
* corner, swap both positions.
79-
*/
76+
/*
77+
* Checks the box: ifthelatitude ofasouth-west corner is larger
78+
* than that of a north-east corner, swap both positions.
79+
*/
8080
staticvoid
8181
sbox_check(SBOX*box)
8282
{
8383
if (FPgt(box->sw.lat,box->ne.lat))
8484
{
8585
/* swap */
86-
SPointsp;
86+
SPointsp;
8787

8888
memcpy((void*)&sp, (void*)&box->sw,sizeof(SPoint));
8989
memcpy((void*)&box->sw, (void*)&box->ne,sizeof(SPoint));
@@ -96,9 +96,9 @@ sbox_check(SBOX *box)
9696
}
9797
}
9898

99-
/*
100-
* Puts"center" of box"b" into point"c" and returns it.
101-
*/
99+
/*
100+
* Putsthe 'center' ofaboxb' intoapoint'c' and returns it.
101+
*/
102102
staticvoid
103103
sbox_center(SPoint*c,constSBOX*b)
104104
{
@@ -108,10 +108,9 @@ sbox_center(SPoint *c, const SBOX *b)
108108
c->lng+=PI;
109109
}
110110

111-
112-
/*
113-
* Relationship between circle and box as PGS_BOX_CIRCLE_REL int8 value.
114-
*/
111+
/*
112+
* Relationship between a circle and a box as PGS_BOX_CIRCLE_REL int8 value.
113+
*/
115114
staticint8
116115
sbox_circle_pos(constSCIRCLE*sc,constSBOX*sb)
117116
{
@@ -129,11 +128,11 @@ sbox_circle_pos(const SCIRCLE *sc, const SBOX *sb)
129128
constSPointtmpn= {0.0,PIH};
130129
constSPointtmps= {0.0,-PIH};
131130

132-
if (spoint_eq(&sb->ne,&tmpn)
133-
&&FPge(sc->center.lat-sc->radius,sb->sw.lat))
131+
if (spoint_eq(&sb->ne,&tmpn)&&
132+
FPge(sc->center.lat-sc->radius,sb->sw.lat))
134133
{
135-
if (spoint_eq(&sc->center,&tmpn)
136-
&&FPeq(sc->radius, (PIH-sb->sw.lat)))
134+
if (spoint_eq(&sc->center,&tmpn)&&
135+
FPeq(sc->radius, (PIH-sb->sw.lat)))
137136
{
138137
returnPGS_BOX_CIRCLE_EQUAL;
139138
}
@@ -142,11 +141,11 @@ sbox_circle_pos(const SCIRCLE *sc, const SBOX *sb)
142141
returnPGS_BOX_CONT_CIRCLE;
143142
}
144143
}
145-
elseif (spoint_eq(&sb->sw,&tmps)
146-
&&FPle(sc->center.lat+sc->radius,sb->ne.lat))
144+
elseif (spoint_eq(&sb->sw,&tmps)&&
145+
FPle(sc->center.lat+sc->radius,sb->ne.lat))
147146
{
148-
if (spoint_eq(&sc->center,&tmps)
149-
&&FPeq(sc->radius, (PIH+sb->ne.lat)))
147+
if (spoint_eq(&sc->center,&tmps)&&
148+
FPeq(sc->radius, (PIH+sb->ne.lat)))
150149
{
151150
returnPGS_BOX_CIRCLE_EQUAL;
152151
}
@@ -218,8 +217,8 @@ sbox_circle_pos(const SCIRCLE *sc, const SBOX *sb)
218217
}
219218
if (bcc&&lat_b_cont_c)
220219
{
221-
booltouw= false,
222-
toue= false;
220+
booltouw= false,
221+
toue= false;
223222

224223
if (pw==PGS_CIRCLE_LINE_OVER)
225224
{
@@ -250,14 +249,14 @@ sbox_circle_pos(const SCIRCLE *sc, const SBOX *sb)
250249
}
251250

252251
/*
253-
* Relationship between line and boxAS PGS_BOX_LINE_REL int8 value.
252+
* Relationship betweenaline andaboxas PGS_BOX_LINE_REL int8 value.
254253
*/
255254
staticint8
256255
sbox_line_pos(constSLine*sl,constSBOX*sb)
257256
{
258257
SPointp1,p2,pbg,ped;
259258
SPointlc[4];
260-
int8pw,pe,lcn,lcs;
259+
int8pw,pe,lcn,lcs;
261260
SLinebw,be;
262261
float8minlat,maxlat;
263262

@@ -307,8 +306,8 @@ sbox_line_pos(const SLine *sl, const SBOX *sb)
307306

308307

309308
/* special case: east/west boundaries are connected */
310-
if ((FPeq(sb->ne.lat,PIH)||FPeq(sb->sw.lat,-PIH))
311-
&&FPeq(fabs(sb->sw.lng-sb->ne.lng),PI))
309+
if ((FPeq(sb->ne.lat,PIH)||FPeq(sb->sw.lat,-PIH))&&
310+
FPeq(fabs(sb->sw.lng-sb->ne.lng),PI))
312311
{
313312
if (FPeq(sb->ne.lat,PIH))
314313
{
@@ -377,8 +376,8 @@ sbox_line_pos(const SLine *sl, const SBOX *sb)
377376

378377
if (pw&&pe)
379378
{
380-
SPointsp;
381-
inti;
379+
SPointsp;
380+
inti;
382381

383382
for (i=0;i<lcn;i++)
384383
{
@@ -403,7 +402,7 @@ sbox_line_pos(const SLine *sl, const SBOX *sb)
403402
}
404403
elseif (!pw&& !pe)
405404
{
406-
inti;
405+
inti;
407406

408407
for (i=0;i<lcn;i++)
409408
{
@@ -417,10 +416,10 @@ sbox_line_pos(const SLine *sl, const SBOX *sb)
417416
returnPGS_BOX_LINE_OVER;
418417
}
419418

420-
/*
421-
* Returns the relationship between box and path as PGS_BOX_PATH_REL int8
422-
* value.
423-
*/
419+
/*
420+
* Returns the relationship betweenabox andapath as
421+
* PGS_BOX_PATH_REL int8 value.
422+
*/
424423
staticint8
425424
sbox_path_pos(constSPATH*path,constSBOX*box)
426425
{
@@ -475,8 +474,8 @@ sbox_path_pos(const SPATH *path, const SBOX *box)
475474
}
476475

477476
/*
478-
* Returns the relationship between polygon and box as PGS_BOX_POLY_REL int8
479-
* value.
477+
* Returns the relationship betweenapolygon andabox as
478+
*PGS_BOX_POLY_REL int8value.
480479
*/
481480
staticint8
482481
sbox_poly_pos(constSPOLY*poly,constSBOX*box)
@@ -535,13 +534,13 @@ sbox_poly_pos(const SPOLY *poly, const SBOX *box)
535534
returnPGS_BOX_POLY_AVOID;
536535
}
537536
}
538-
/* box and polygonare overlapping */
537+
/* box and polygonoverlap */
539538
returnPGS_BOX_POLY_OVER;
540539
}
541540

542541

543542
/*
544-
* Relationship between ellipse and box as PGS_BOX_ELLIPSE_REL int8 value.
543+
* Relationship betweenanellipse and a box as PGS_BOX_ELLIPSE_REL int8 value.
545544
*/
546545
staticint8
547546
sbox_ellipse_pos(constSELLIPSE*ell,constSBOX*box)
@@ -558,7 +557,7 @@ sbox_ellipse_pos(const SELLIPSE *ell, const SBOX *box)
558557

559558
if (spoint_eq(&box->sw,&box->ne))
560559
{
561-
boolscp=sellipse_cont_point(ell,&box->sw);
560+
boolscp=sellipse_cont_point(ell,&box->sw);
562561

563562
if (scp)
564563
{
@@ -622,8 +621,8 @@ sbox_ellipse_pos(const SELLIPSE *ell, const SBOX *box)
622621
{
623622
/* full latitude range */
624623
if ((po==PGS_CIRCLE_CONT_ELLIPSE
625-
||po==PGS_ELLIPSE_CIRCLE_EQUAL)
626-
&&pi==PGS_ELLIPSE_CIRCLE_AVOID)
624+
||po==PGS_ELLIPSE_CIRCLE_EQUAL)&&
625+
pi==PGS_ELLIPSE_CIRCLE_AVOID)
627626
{
628627
returnPGS_BOX_CONT_ELLIPSE;
629628
}
@@ -643,8 +642,8 @@ sbox_ellipse_pos(const SELLIPSE *ell, const SBOX *box)
643642
if (FPzero(box->sw.lng)&&FPeq(box->ne.lng,PID))
644643
{
645644
/* full latitude range */
646-
if (po==PGS_ELLIPSE_CIRCLE_AVOID
647-
&&pi==PGS_ELLIPSE_CIRCLE_AVOID)
645+
if (po==PGS_ELLIPSE_CIRCLE_AVOID&&
646+
pi==PGS_ELLIPSE_CIRCLE_AVOID)
648647
{
649648
returnPGS_BOX_CONT_ELLIPSE;
650649
}
@@ -673,9 +672,9 @@ sbox_ellipse_pos(const SELLIPSE *ell, const SBOX *box)
673672
pe==PGS_ELLIPSE_LINE_AVOID)
674673
{
675674
/* center is between west and east meridians */
676-
if ((FPgt(box->sw.lng,box->ne.lng)
677-
&&(FPle(ec.lng,box->ne.lng)||FPgt(ec.lng,box->sw.lng)))
678-
||(FPle(box->sw.lng,box->ne.lng)&&
675+
if ((FPgt(box->sw.lng,box->ne.lng)&&
676+
(FPle(ec.lng,box->ne.lng)||FPgt(ec.lng,box->sw.lng)))||
677+
(FPle(box->sw.lng,box->ne.lng)&&
679678
(FPge(ec.lng,box->sw.lng)&&FPle(ec.lng,box->ne.lng))))
680679
{
681680
if (FPeq(sco.center.lat,sci.center.lat))
@@ -694,8 +693,8 @@ sbox_ellipse_pos(const SELLIPSE *ell, const SBOX *box)
694693
else
695694
{
696695
/* equator modus */
697-
if (po==PGS_ELLIPSE_CIRCLE_AVOID
698-
&&pi==PGS_ELLIPSE_CIRCLE_AVOID)
696+
if (po==PGS_ELLIPSE_CIRCLE_AVOID&&
697+
pi==PGS_ELLIPSE_CIRCLE_AVOID)
699698
{
700699
returnPGS_BOX_CONT_ELLIPSE;
701700
}
@@ -726,8 +725,9 @@ sbox_ellipse_pos(const SELLIPSE *ell, const SBOX *box)
726725
sbox_center(&ec,box);
727726

728727
/* ellipse contains box */
729-
if (pw==PGS_ELLIPSE_CONT_LINE&&pe==PGS_ELLIPSE_CONT_LINE
730-
&&sellipse_cont_point(ell,&ec))
728+
if (pw==PGS_ELLIPSE_CONT_LINE&&
729+
pe==PGS_ELLIPSE_CONT_LINE&&
730+
sellipse_cont_point(ell,&ec))
731731
{
732732
returnPGS_ELLIPSE_CONT_BOX;
733733
}
@@ -737,9 +737,9 @@ sbox_ellipse_pos(const SELLIPSE *ell, const SBOX *box)
737737

738738
}
739739

740-
/*
741-
* Relationship betweenbox and box as PGS_BOX_REL int8 value.
742-
*/
740+
/*
741+
* Relationship betweentwo boxes as PGS_BOX_REL int8 value.
742+
*/
743743
staticint8
744744
sbox_box_pos(constSBOX*b1,constSBOX*b2,boolrecheck)
745745
{
@@ -822,8 +822,8 @@ sbox_eq(SBOX *b1, SBOX *b2)
822822
bool
823823
sbox_cont_point(constSBOX*b,constSPoint*p)
824824
{
825-
if ((FPeq(p->lat,b->ne.lat)&&FPeq(p->lat,PIH))
826-
||(FPeq(p->lat,b->sw.lat)&&FPeq(p->lat,-PIH)))
825+
if ((FPeq(p->lat,b->ne.lat)&&FPeq(p->lat,PIH))||
826+
(FPeq(p->lat,b->sw.lat)&&FPeq(p->lat,-PIH)))
827827
{
828828
return true;
829829
}
@@ -845,7 +845,6 @@ sbox_cont_point(const SBOX *b, const SPoint *p)
845845
return true;
846846
}
847847

848-
849848
Datum
850849
spherebox_in(PG_FUNCTION_ARGS)
851850
{
@@ -873,7 +872,6 @@ spherebox_in(PG_FUNCTION_ARGS)
873872
PG_RETURN_POINTER(box);
874873
}
875874

876-
877875
Datum
878876
spherebox_in_from_points(PG_FUNCTION_ARGS)
879877
{
@@ -1496,7 +1494,6 @@ spherebox_overlap_ellipse_com_neg(PG_FUNCTION_ARGS)
14961494
PG_RETURN_BOOL(!(sbox_ellipse_pos(e,b)>PGS_BOX_ELLIPSE_AVOID));
14971495
}
14981496

1499-
15001497
Datum
15011498
spherebox_cont_box(PG_FUNCTION_ARGS)
15021499
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp