Convert a feature collection to its dto equivalent.

@param features
@return
@throws IOException
@throws GeomajasException
344679
protected List<Feature> convertFeatures(FeatureCollection<SimpleFeatureType, SimpleFeature> features,
			int maxCoordinates, double startDistance) throws IOException, GeomajasException {
		FeatureIterator<SimpleFeature> iterator = features.features();
		List<Feature> dtoFeatures = new ArrayList<Feature>();
		FeatureConverter converter = new FeatureConverter();
		while (iterator.hasNext()) {
			try {
				SimpleFeature feature = iterator.next();
				dtoFeatures.add(converter.toDto(feature, maxCoordinates));
			} catch (Exception e) {
				continue;
			}
		}
		iterator.close();
		return dtoFeatures;
	}
82045
@SuppressWarnings("unchecked")
    @Override
    public Collection<FeatureAsset> getFeatures(String productId, String productVersion, String productInstallType, String productLicenseType, String productEdition) {
        return (Collection<FeatureAsset>) getEsaAsset(productId, productVersion, productInstallType, productLicenseType, productEdition,
                                                      Visibility.PUBLIC);
    }
68978
private void saveFeatures(List<Feature> features, FeatureCollector collector) {
        features.forEach(f -> {
            f.setCollectorId(collector.getId());
            Feature existing = featureRepository.findByCollectorIdAndSIdAndSTeamID(collector.getId(), f.getsId(), f.getsTeamID());
            if (existing != null) {
                f.setId(existing.getId());
            }
            featureRepository.save(f);
        });
    }
1359220
@SuppressWarnings("unchecked")
    @Override
    public Collection<FeatureCollectionAsset> getFeatureCollections(String productId, String productVersion, String productInstallType, String productLicenseType,
                                                                    String productEdition) {
        return (Collection<FeatureCollectionAsset>) getEsaAsset(productId, productVersion, productInstallType, productLicenseType, productEdition,
                                                                Visibility.INSTALL);
    }
306910
@Nullable
  static LineOptions fromFeature(@NonNull Feature feature) {
    if (feature.geometry() == null) {
      throw new RuntimeException("geometry field is required");
    }
    if (!(feature.geometry() instanceof LineString)) {
      return null;
    }

    LineOptions options = new LineOptions();
    options.geometry = (LineString) feature.geometry();
    if (feature.hasProperty(PROPERTY_LINE_JOIN)) {
      options.lineJoin = feature.getProperty(PROPERTY_LINE_JOIN).getAsString();
    }
    if (feature.hasProperty(PROPERTY_LINE_OPACITY)) {
      options.lineOpacity = feature.getProperty(PROPERTY_LINE_OPACITY).getAsFloat();
    }
    if (feature.hasProperty(PROPERTY_LINE_COLOR)) {
      options.lineColor = feature.getProperty(PROPERTY_LINE_COLOR).getAsString();
    }
    if (feature.hasProperty(PROPERTY_LINE_WIDTH)) {
      options.lineWidth = feature.getProperty(PROPERTY_LINE_WIDTH).getAsFloat();
    }
    if (feature.hasProperty(PROPERTY_LINE_GAP_WIDTH)) {
      options.lineGapWidth = feature.getProperty(PROPERTY_LINE_GAP_WIDTH).getAsFloat();
    }
    if (feature.hasProperty(PROPERTY_LINE_OFFSET)) {
      options.lineOffset = feature.getProperty(PROPERTY_LINE_OFFSET).getAsFloat();
    }
    if (feature.hasProperty(PROPERTY_LINE_BLUR)) {
      options.lineBlur = feature.getProperty(PROPERTY_LINE_BLUR).getAsFloat();
    }
    if (feature.hasProperty(PROPERTY_LINE_PATTERN)) {
      options.linePattern = feature.getProperty(PROPERTY_LINE_PATTERN).getAsString();
    }
    if (feature.hasProperty(PROPERTY_IS_DRAGGABLE)) {
      options.isDraggable = feature.getProperty(PROPERTY_IS_DRAGGABLE).getAsBoolean();
    }
    return options;
  }
787872
public int getFeaturePosition(AbstractFeature feature) {
        AbstractFeature result = feature;
        if (!featurePositions.containsKey(feature)) {
            if (feature instanceof FeatureGroup) {
                FeatureGroup featureGroup = (FeatureGroup) feature;
                List<Feature> features = featureGroup.getConcreteFeatures();
                if (!features.isEmpty()) {
                    Collections.sort(features, new Comparator<Feature>() {
                        @Override
                        public int compare(Feature feat1, Feature feat2) {
                            return getFeaturePosition(feat1) - getFeaturePosition(feat2);
                        }
                    });
                    result = features.get(0);
                }
            }
        }
        return featurePositions.getOrDefault(result, 0);
    }
1358066
public static FeatureVector toFeatures(Block map)
    {
        Map<Integer, Double> features = new HashMap<>();

        if (map != null) {
            for (int position = 0; position < map.getPositionCount(); position += 2) {
                features.put((int) BIGINT.getLong(map, position), DOUBLE.getDouble(map, position + 1));
            }
        }
        return new FeatureVector(features);
    }
398165
public static EsriFeature FeatureFromJson(InputStream jsonInputStream) throws JsonParseException, IOException{
		JsonParser parser = jsonFactory.createJsonParser(jsonInputStream);
		return FeatureFromJson(parser);
	}
434081
@Nullable
  static FillOptions fromFeature(@NonNull Feature feature) {
    if (feature.geometry() == null) {
      throw new RuntimeException("geometry field is required");
    }
    if (!(feature.geometry() instanceof Polygon)) {      return null;
    }

    FillOptions options = new FillOptions();
    options.geometry = (Polygon) feature.geometry();
    if (feature.hasProperty(PROPERTY_FILL_OPACITY)) {
      options.fillOpacity = feature.getProperty(PROPERTY_FILL_OPACITY).getAsFloat();
    }
    if (feature.hasProperty(PROPERTY_FILL_COLOR)) {
      options.fillColor = feature.getProperty(PROPERTY_FILL_COLOR).getAsString();
    }
    if (feature.hasProperty(PROPERTY_FILL_OUTLINE_COLOR)) {
      options.fillOutlineColor = feature.getProperty(PROPERTY_FILL_OUTLINE_COLOR).getAsString();
    }
    if (feature.hasProperty(PROPERTY_FILL_PATTERN)) {
      options.fillPattern = feature.getProperty(PROPERTY_FILL_PATTERN).getAsString();
    }
    if (feature.hasProperty(PROPERTY_IS_DRAGGABLE)) {
      options.isDraggable = feature.getProperty(PROPERTY_IS_DRAGGABLE).getAsBoolean();
    }
    return options;
  }
461230
@VisibleForTesting
  public FeatureSet with(Set<Feature> newFeatures) {
    return new FeatureSet(union(features, newFeatures));
  }
1108780
public static STRtree featureCollectionToSTRtree( SimpleFeatureCollection collection ) {
        STRtree tree = new STRtree();
        SimpleFeatureIterator featureIterator = collection.features();
        while( featureIterator.hasNext() ) {
            SimpleFeature feature = featureIterator.next();
            Geometry geometry = (Geometry) feature.getDefaultGeometry();
            tree.insert(geometry.getEnvelopeInternal(), feature);
        }
        featureIterator.close();
        return tree;
    }
804796
@Override
	public void setFeature(Feature feature) {
		for (HasFeature action : actions) {
			action.setFeature(feature);
		}
		presenter.setFeature(feature);
	}
661093
@Api
	public void panToFeatures(List<Feature> features) {
		PanToFeaturesLazyLoadCallback callback = new PanToFeaturesLazyLoadCallback(features.size());
		for (Feature feature : features) {
			// no need to fetch if we already have the geometry !
			if (feature.isGeometryLoaded()) {
				callback.execute(Arrays.asList(feature));
			} else {
				feature.getLayer().getFeatureStore()
						.getFeature(feature.getId(), GeomajasConstant.FEATURE_INCLUDE_GEOMETRY, callback);			
			}
		}
	}
803769
public String toJSON(List<JTSFeature> list) {
		Object fcJSON = this.startFeatureCollection();
		for (JTSFeature feature : list) {
			Object f = this.startFeature();
			Object p = this.startPoint();
			try {
				this.addXToPoint(feature.getGeometry().getGeometry()
						.getCentroid().getX(), p);
				this.addYToPoint(feature.getGeometry().getGeometry()
						.getCentroid().getY(), p);
			} catch (BaseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

			Iterator it = feature.getAttributes().keySet().iterator();
			while (it.hasNext()) {
				String key = it.next().toString();
				this.addElementToFeature(feature.getAttribute(key).value, key,
						f);
			}

			p = this.endPoint(p, null, null);
			this.addPointToFeature(f, p);
			this.endFeature(f);
			this.addFeatureToCollection(fcJSON, f);
		}

		fcJSON = this.endFeatureCollection(fcJSON);

		return this.featureCollectionAsJSON((org.json.JSONObject) fcJSON);
	}
51147
public <T> Governator setFeature(GovernatorFeature<T> feature, T value) {
        this.featureOverrides.put(feature, value);
        return this;
    }
142096
public static <T> C.List<T> toList(Collection<? extends T> col) {
        if (col.size() == 0) {
            return Nil.list();
        }
        if (col instanceof C.List) {
            C.List<T> list = $.cast(col);
            if (list.is(C.Feature.IMMUTABLE)) {
                return list;
            }
        }
        return new ListBuilder<T>(col).toList();
    }
142300
public JSONReader withFeatures(int features)
    {
        if (_features == features) {
            return this;
        }
        return _with(features, _readerLocator, _treeCodec, _collectionBuilder, _mapBuilder);
    }