File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
main/java/org/geoscript/js/feature
test/resources/org/geoscript/js/tests/geoscript/feature Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -323,8 +323,8 @@ public SimpleFeature next() throws NoSuchElementException {
323
323
if (hasNext ()) {
324
324
++current ;
325
325
Object obj = array .get (current , array );
326
- if (obj instanceof SimpleFeature ) {
327
- feature = (SimpleFeature ) obj ;
326
+ if (obj instanceof Feature ) {
327
+ feature = (SimpleFeature ) (( Feature ) obj ). unwrap () ;
328
328
} else if (obj instanceof NativeObject ) {
329
329
NativeObject config = (NativeObject ) obj ;
330
330
feature = (SimpleFeature ) new Feature (config .getParentScope (), config ).unwrap ();
Original file line number Diff line number Diff line change @@ -199,6 +199,26 @@ exports["test: close (custom)"] = function() {
199
199
200
200
}
201
201
202
+ exports [ "test: constructor (array)" ] = function ( ) {
203
+ var Point = GEOM . Point ;
204
+
205
+ var features = [
206
+ new Feature ( { properties : { loc : new Point ( [ 1 , 2 ] ) } } ) ,
207
+ new Feature ( { properties : { loc : new Point ( [ 3 , 4 ] ) } } )
208
+ ] ;
209
+ var collection = new FeatureCollection ( { features : features } ) ;
210
+ ASSERT . strictEqual ( collection . size , 2 ) ;
211
+
212
+ var got = [ ] ;
213
+ for ( var feature in collection ) {
214
+ got . push ( feature ) ;
215
+ }
216
+ ASSERT . strictEqual ( got . length , 2 ) ;
217
+ ASSERT . ok ( got [ 0 ] . geometry . equals ( new Point ( [ 1 , 2 ] ) ) ) ;
218
+ ASSERT . deepEqual ( got [ 1 ] . get ( "loc" ) . coordinates , [ 3 , 4 ] ) ;
219
+
220
+ } ;
221
+
202
222
203
223
if ( require . main == module . id ) {
204
224
system . exit ( require ( "test" ) . run ( exports ) ) ;
You can’t perform that action at this time.
0 commit comments