    import { Feature, FeatureSet } from '../index'
    import { Log } from '../../../util'

    /**
     * 从FeatureSet中获取要素数组
     * @param {FeatureSet} featureSet 要素集合对象
     * @return {Array<Feature>} 要素数组对象
     * */
    function getFeaturesFromFeatureSet(featureSet) {
      let features = []
      if (featureSet instanceof FeatureSet) {
        features = featureSet.features
      } else if (
        Array.isArray(featureSet) &&
        featureSet.every((feature) => feature instanceof Feature)
      ) {
        features = featureSet
      } else {
        Log.info('传入要素集错误')
      }

      const _features = []
      for (let i = 0; i < features.length; i++) {
        _features[i] = Feature.fromJSON(features[i].toJSON())
      }

      return _features
    }

    export { getFeaturesFromFeatureSet }