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

Commit9c91983

Browse files
df7cbmsdemlei
authored andcommitted
Rename smoc_area to area and make it return steradians
1 parentb7eb98e commit9c91983

File tree

5 files changed

+42
-18
lines changed

5 files changed

+42
-18
lines changed

‎doc/functions.sgm‎

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
The <function>area</function> function returns the area of a
1616
spherical object in square radians. Supported data types are:
1717
<type>scircle</type>, <type>spolygon</type> (if the polygon
18-
is convex), and <type>sbox</type>.
18+
is convex),<type>sbox</type>,and <type>smoc</type>.
1919
</para>
2020
<example>
2121
<title>Area of a spherical circle as a multiple of &pgr;</title>
@@ -24,6 +24,11 @@
2424
<![CDATA[ area]]>
2525
<![CDATA[------]]>
2626
<![CDATA[ 1]]>
27+
<![CDATA[(1 row)]]>
28+
<![CDATA[sql> SELECT area(smoc '0/1-3');]]>
29+
<![CDATA[ area]]>
30+
<![CDATA[-------------------]]>
31+
<![CDATA[ 3.141592653589793]]>
2732
<![CDATA[(1 row)]]>
2833
</programlisting>
2934
</example>
@@ -592,16 +597,6 @@
592597
</programlisting>
593598
</example>
594599

595-
<funcsynopsis>
596-
<funcprototype>
597-
<funcdef><function>smoc_area</function></funcdef>
598-
<paramdef>smoc</paramdef>
599-
</funcprototype>
600-
</funcsynopsis>
601-
<para>
602-
Returns the size of an smoc in order 29 pixels.
603-
</para>
604-
605600
<funcsynopsis>
606601
<funcprototype>
607602
<funcdef><function>smoc_degrade</function></funcdef>
@@ -631,7 +626,7 @@
631626
</funcsynopsis>
632627
<para>
633628
<type>smoc</type> union and intersection are available as aggregate functions
634-
that compute the aggretatedarea over a given column.
629+
that compute the aggretatedcoverage over a given column.
635630
</para>
636631
<example>
637632
<title>Computing the overall coverage of a catalog</title>

‎expected/moc.out‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SET client_min_messages = 'notice';
2-
--SETclient_min_messages ='warning';
2+
SETextra_float_digits =0; -- make results compatible with 9.6 .. 11
33
SELECT smoc(''); -- expected: '0/'
44
smoc
55
------
@@ -42,6 +42,30 @@ SELECT smoc_info('0/1-2'::smoc);
4242
version: 0, order: 0, depth: 1, first: 288230376151711744, last: 864691128455135232, area: 576460752303423488, tree_begin: 48, data_begin: 72
4343
(1 row)
4444

45+
SELECT area('0/'::smoc);
46+
area
47+
------
48+
0
49+
(1 row)
50+
51+
SELECT area('29/1'::smoc);
52+
area
53+
----------------------
54+
3.63319635209232e-18
55+
(1 row)
56+
57+
SELECT area('0/1-3'::smoc);
58+
area
59+
------------------
60+
3.14159265358979
61+
(1 row)
62+
63+
SELECT area('0/0-11'::smoc);
64+
area
65+
------------------
66+
12.5663706143592
67+
(1 row)
68+
4569
SELECT '(0.78, 0.81)'::spoint <@ '7/123-456,10000-20000'::smoc;
4670
?column?
4771
----------

‎moc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ smoc_area(PG_FUNCTION_ARGS)
418418
/* get just the MOC header: */
419419
Smoc*moc= (Smoc*)PG_DETOAST_DATUM_SLICE(PG_GETARG_DATUM(0),0,
420420
MOC_HEADER_VARSIZE);
421-
PG_RETURN_INT64(moc->area);
421+
PG_RETURN_FLOAT8(moc->area*4.0*M_PI /MOC_AREA_ALL_SKY);
422422
}
423423

424424
Datum

‎pgs_moc_ops.sql.in‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ CREATE FUNCTION smoc_info (smoc)
88
IMMUTABLE
99
STRICT;
1010

11-
CREATE FUNCTIONsmoc_area (smoc)
12-
RETURNSbigint
13-
AS 'MODULE_PATHNAME'
11+
CREATE FUNCTIONarea (smoc)
12+
RETURNSdouble precision
13+
AS 'MODULE_PATHNAME', 'smoc_area'
1414
LANGUAGE C
1515
PARALLEL SAFE
1616
IMMUTABLE

‎sql/moc.sql‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
SET client_min_messages='notice';
2-
--SETclient_min_messages ='warning';
2+
SETextra_float_digits=0;-- make results compatible with 9.6 .. 11
33

44
SELECT smoc('');-- expected: '0/'
55
SELECT'0/'::smoc;-- expected: '0/'
@@ -10,6 +10,11 @@ SELECT '0/0,1,2,3,7'::smoc; -- expected: '0/0-3,7'
1010
SELECT smoc_info('0/'::smoc);
1111
SELECT smoc_info('0/1-2'::smoc);
1212

13+
SELECT area('0/'::smoc);
14+
SELECT area('29/1'::smoc);
15+
SELECT area('0/1-3'::smoc);
16+
SELECT area('0/0-11'::smoc);
17+
1318
SELECT'(0.78, 0.81)'::spoint<@'7/123-456,10000-20000'::smoc;
1419
SELECT'(0.78, 0.81)'::spoint<@'7/123-456,1000-2000'::smoc;
1520

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp