@@ -61,10 +61,17 @@ function _geometry2Scoord3d(geometry, pyramid) {
6161 } ) ;
6262 return new Polyline ( coordinates ) ;
6363 } else if ( type === 'Circle' ) {
64- let center = _geometryCoordinates2scoord3dCoordinates ( geometry . getCenter ( ) , pyramid ) ;
65- // FIXME: radius also needs to be rescaled
66- let radius = geometry . getRadius ( ) ;
67- return new Circle ( center , radius ) ;
64+ // chunking the Flat Coordinates into two arrays within 3 elements each
65+ let coordinates = geometry . getFlatCoordinates ( ) . reduce ( ( all , one , i ) => {
66+ const ch = Math . floor ( i / 2 )
67+ all [ ch ] = [ ] . concat ( ( all [ ch ] || [ ] ) , one )
68+ return all
69+ } , [ ] )
70+ coordinates = coordinates . map ( c => {
71+ c . push ( 0 )
72+ return _geometryCoordinates2scoord3dCoordinates ( c , pyramid )
73+ } )
74+ return new Circle ( coordinates ) ;
6875 } else {
6976 // TODO: Combine multiple points into MULTIPOINT.
7077 console . error ( `unknown geometry type "${ type } "` )
@@ -88,9 +95,15 @@ function _scoord3d2Geometry(scoord3d, pyramid) {
8895 } ) ;
8996 return new PolygonGeometry ( [ coordinates ] ) ;
9097 } else if ( type === 'CIRCLE' ) {
91- let center = _scoord3dCoordinates2geometryCoordinates ( data [ 0 ] , pyramid ) ;
92- let radius = data [ 1 ] ;
93- return new CircleGeometry ( center , radius ) ;
98+ let coordinates = data . map ( d => {
99+ return _scoord3dCoordinates2geometryCoordinates ( d , pyramid ) ;
100+ } )
101+ // to flat coordinates
102+ coordinates = [ ...coordinates [ 0 ] . slice ( 0 , 2 ) , ...coordinates [ 1 ] . slice ( 0 , 2 ) ]
103+
104+ // flat coordinates in combination with opt_layout and no opt_radius are also accepted
105+ // and internaly it calculates the Radius
106+ return new CircleGeometry ( coordinates , null , "XY" ) ;
94107 } else {
95108 console . error ( `unsupported graphic type "${ type } "` )
96109 }
0 commit comments