/*******************************************************************************
 * Copyright 2014, 2017 gwt-ol3
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package ol.source;

import jsinterop.annotations.JsPackage;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;

import ol.Collection;
import ol.Feature;
import ol.gwt.TypedObject;

/**
 * Vector source options.
 *
 * @author sbaumhekel
 */
@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object")
public class VectorOptions extends SourceOptions {

    /**
     * Set the features. If provided as {@link ol.Collection}, the features in
     * the source and the collection will stay in sync.
     *
     * @param features features
     */
    @JsProperty
    public native void setFeatures(TypedObject<Feature[], Collection<Feature>> features);

    /**
     *
     * By default, an RTree is used as spatial index. When features are removed
     * and added frequently, and the total number of features is low, setting
     * this to false may improve performance. Note that
     * ol.source.Vector#getFeaturesInExtent,
     * ol.source.Vector#getClosestFeatureToCoordinate and
     * ol.source.Vector#getExtent cannot be used when useSpatialIndex is set to
     * false, and ol.source.Vector#forEachFeatureInExtent will loop through all
     * features. When set to false, the features will be maintained in an
     * ol.Collection, which can be retrieved through
     * ol.source.Vector#getFeaturesCollection. The default is true.
     *
     * @param useSpatialIndex use spatial index?
     */
    @JsProperty
    public native void setUseSpatialIndex(boolean useSpatialIndex);

    /**
     * Wrap the world horizontally. Default is true. For vector editing across
     * the -180° and 180° meridians to work properly, this should be set to
     * false. The resulting geometry coordinates will then exceed the world
     * bounds.
     * 
     * @param wrapX wrap?
     */
    @JsProperty
    public native void setWrapX(boolean wrapX);

}

@@ -761,24 +761,64 @@
 ol.source;%0A%0A
+import jsinterop.annotations.JsOverlay;%0A
 import jsint
@@ -845,16 +845,16 @@
 ackage;%0A
-
 import j
@@ -965,16 +965,37 @@
 eature;%0A
+import ol.OLFactory;%0A
 import o
@@ -1493,16 +1493,355 @@
 tures);%0A
+    %0A  %09@JsOverlay%0A    public final void  setFeatures(Collection%3CFeature%3E features)%7B%0A  %09%09setFeatures(OLFactory.%3CFeature%5B%5D, Collection%3CFeature%3E%3E createObject2(features));%0A  %09%7D%0A%0A  %09@JsOverlay%0A    public final void  setFeatures(Feature%5B%5D features)%7B%0A  %09%09setFeatures(OLFactory.%3CFeature%5B%5D, Collection%3CFeature%3E%3E createObject1(features));%0A  %09%7D%0A  %09
 %0A    /**

Add setFeatures overlay to VectorOptions