Get the river info as produced by the {@link OmsRiverSectionsExtractor}.

@param riverPointsFeatures the river points.
@param sectionFeatures the extracted sections.
@param sectionPointsFeatures the section points.
@return the {@link RiverInfo}.
974255
public static RiverInfo getRiverInfo( List<SimpleFeature> riverPointsFeatures, List<SimpleFeature> sectionFeatures,
            List<SimpleFeature> sectionPointsFeatures ) {
        RiverInfo riverInfo = new RiverInfo();

        for( SimpleFeature riverPointFeature : riverPointsFeatures ) {
            int sectionId = ((Number) riverPointFeature.getAttribute(ARiverSectionsExtractor.FIELD_SECTION_ID)).intValue();
            riverInfo.orderedRiverPoints.put(sectionId, riverPointFeature);
        }
        int count = 0;
        riverInfo.riverCoords = new Coordinate[riverInfo.orderedRiverPoints.size()];
        for( Entry<Integer, SimpleFeature> riverEntry : riverInfo.orderedRiverPoints.entrySet() ) {
            SimpleFeature riverPoint = riverEntry.getValue();
            Coordinate coordinate = ((Geometry) riverPoint.getDefaultGeometry()).getCoordinate();
            double elev = ((Number) riverPoint.getAttribute(ARiverSectionsExtractor.FIELD_ELEVATION)).doubleValue();
            riverInfo.riverCoords[count++] = new Coordinate(coordinate.x, coordinate.y, elev);
        }
        GeometryFactory gf = new GeometryFactory();
        LineString riverGeometry = gf.createLineString(riverInfo.riverCoords);

        for( SimpleFeature sectionFeature : sectionFeatures ) {
            int sectionId = ((Number) sectionFeature.getAttribute(ARiverSectionsExtractor.FIELD_SECTION_ID)).intValue();
            riverInfo.orderedSections.put(sectionId, sectionFeature);
        }

        HashMap<Integer, TreeMap<Integer, SimpleFeature>> sectionId2PointId2PointMap = new HashMap<>();
        for( SimpleFeature pointFeature : sectionPointsFeatures ) {
            int sectionId = ((Number) pointFeature.getAttribute(ARiverSectionsExtractor.FIELD_SECTION_ID)).intValue();
            TreeMap<Integer, SimpleFeature> pointId2PointMap = sectionId2PointId2PointMap.get(sectionId);
            if (pointId2PointMap == null) {
                pointId2PointMap = new TreeMap<>();
                sectionId2PointId2PointMap.put(sectionId, pointId2PointMap);
            }
            int pointId = ((Number) pointFeature.getAttribute(ARiverSectionsExtractor.FIELD_SECTIONPOINT_INDEX)).intValue();
            pointId2PointMap.put(pointId, pointFeature);
        }

        for( Entry<Integer, SimpleFeature> sectionEntry : riverInfo.orderedSections.entrySet() ) {
            Integer sectionId = sectionEntry.getKey();
            SimpleFeature sectionFeature = sectionEntry.getValue();
            double progressive = ((Number) sectionFeature.getAttribute(ARiverSectionsExtractor.FIELD_PROGRESSIVE)).doubleValue();
            Object attribute = sectionFeature.getAttribute(LWFields.GAUKLER);
            if (attribute == null) {
                throw new ModelsRuntimeException("The input section data do not have the value of KS.",
                        "ARiverSectionsExtractor");
            }
            double ks = ((Number) attribute).doubleValue();

            Geometry sectionLine = (Geometry) sectionFeature.getDefaultGeometry();

            Geometry intersectionPoint = riverGeometry.intersection(sectionLine);
            if (intersectionPoint == null) {
                throw new ModelsRuntimeException("All sections have to intersect the river line.",
                        "ARiverSectionsExtractor#getRiverInfo");
            }

            TreeMap<Integer, SimpleFeature> sectionPoints = sectionId2PointId2PointMap.get(sectionId);
            Coordinate[] sectionCoords = new Coordinate[sectionPoints.size()];
            count = 0;
            for( Entry<Integer, SimpleFeature> pointEntry : sectionPoints.entrySet() ) {
                SimpleFeature sectionPoint = pointEntry.getValue();
                sectionCoords[count++] = ((Geometry) sectionPoint.getDefaultGeometry()).getCoordinate();
            }
            LineString sectionLineWithPoints = gf.createLineString(sectionCoords);
            RiverPoint rp = new RiverPoint(intersectionPoint.getCoordinate(), progressive, sectionLineWithPoints, ks);
            rp.setSectionId(sectionId);
            riverInfo.orderedNetworkPoints.add(rp);
        }
        riverInfo.extractedSectionsCount = riverInfo.orderedNetworkPoints.size();

        for( Entry<Integer, SimpleFeature> riverEntry : riverInfo.orderedRiverPoints.entrySet() ) {
            SimpleFeature riverPoint = riverEntry.getValue();
            Coordinate coordinate = ((Geometry) riverPoint.getDefaultGeometry()).getCoordinate();
            double progressive = ((Number) riverPoint.getAttribute(ARiverSectionsExtractor.FIELD_PROGRESSIVE)).doubleValue();
            RiverPoint rp = new RiverPoint(coordinate, progressive, null, null);
            rp.setSectionId(riverEntry.getKey());
            riverInfo.orderedNetworkPoints.add(rp);
        }

        Collections.sort(riverInfo.orderedNetworkPoints);
        return riverInfo;
    }
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);
    }
766446
def section_meander_angles(section):
    ''''''
    p = section.points
    return [mm.angle_3points(p[i - 1], p[i - 2], p[i])
            for i in range(2, len(p))]
761010
public void setPipelines(java.util.Collection<PipelineSummary> pipelines) {
        if (pipelines == null) {
            this.pipelines = null;
            return;
        }

        this.pipelines = new java.util.ArrayList<PipelineSummary>(pipelines);
    }
528808
public static double getMeanSlope( List<ProfilePoint> points ) {
        double meanSlope = 0;

        int num = 0;
        for( int i = 0; i < points.size() - 1; i++ ) {
            ProfilePoint p1 = points.get(i);
            ProfilePoint p2 = points.get(i + 1);

            double dx = p2.progressive - p1.progressive;
            double dy = p2.elevation - p1.elevation;
            double tmpSlope = dy / dx;
            meanSlope = meanSlope + tmpSlope;
            num++;
        }
        meanSlope = meanSlope / num;
        return meanSlope;
    }
1299912
@PostConstruct
	protected void initFeatures() throws LayerException {
		crs = geoService.getCrs2(layerInfo.getCrs());
		try {
			setFeatureSourceName(layerInfo.getFeatureInfo().getDataSourceName());
			featureModel = new ShapeInMemFeatureModel(getDataStore(), layerInfo.getFeatureInfo().getDataSourceName(),
					geoService.getSridFromCrs(layerInfo.getCrs()), converterService);
			featureModel.setLayerInfo(layerInfo);
			FeatureCollection<SimpleFeatureType, SimpleFeature> col = getFeatureSource().getFeatures();
			FeatureIterator<SimpleFeature> iterator = col.features();
			int lastIndex = 0;
			while (iterator.hasNext()) {
				SimpleFeature feature = iterator.next();
				String id = featureModel.getId(feature);
				features.put(id, feature);
				int intId = Integer.parseInt(id.substring(id.lastIndexOf('.') + 1));
				if (intId > lastIndex) {
					lastIndex = intId;
				}
			}
			iterator.close();
			((ShapeInMemFeatureModel) featureModel).setNextId(++lastIndex);
		} catch (NumberFormatException nfe) {
			throw new LayerException(nfe, ExceptionCode.FEATURE_MODEL_PROBLEM, url);
		} catch (MalformedURLException e) {
			throw new LayerException(e, ExceptionCode.INVALID_SHAPE_FILE_URL, url);
		} catch (IOException ioe) {
			throw new LayerException(ioe, ExceptionCode.CANNOT_CREATE_LAYER_MODEL, url);
		} catch (GeomajasException ge) {
			throw new LayerException(ge, ExceptionCode.CANNOT_CREATE_LAYER_MODEL, url);
		}
	}
248920
@SafeVarargs
    private static <T extends Snippet> Stream<T> nonEmptyStream(Supplier<Stream<T>> supplier,
            SnippetPredicate<T>... filters) {
        for (SnippetPredicate<T> filt : filters) {
            Iterator<T> iterator = supplier.get().filter(filt).iterator();
            if (iterator.hasNext()) {
                return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, 0), false);
            }
        }
        return null;
    }
913712
public void addSection(final Section SECTION) {
        if (null == SECTION) return;
        sections.add(SECTION);
        Collections.sort(sections, new SectionComparator());
        fireUpdateEvent(SECTION_EVENT);
    }
280067
public void setSamplingStatisticSummaries(java.util.Collection<SamplingStatisticSummary> samplingStatisticSummaries) {
        if (samplingStatisticSummaries == null) {
            this.samplingStatisticSummaries = null;
            return;
        }

        this.samplingStatisticSummaries = new java.util.ArrayList<SamplingStatisticSummary>(samplingStatisticSummaries);
    }
1167223
public void setLinkSpecifiers(java.util.Collection<TypedLinkSpecifier> linkSpecifiers) {
        if (linkSpecifiers == null) {
            this.linkSpecifiers = null;
            return;
        }

        this.linkSpecifiers = new java.util.ArrayList<TypedLinkSpecifier>(linkSpecifiers);
    }
955147
private static void section2(List<ConnectionNotation> connections, Map<String, String> mapIds) throws NotationException {

    for (ConnectionNotation connection : connections) {
      HELMEntity first = connection.getSourceId();
      String idFirst = first.getId();

      HELMEntity second = connection.getTargetId();
      String idSecond = second.getId();

      if (mapIds.containsKey(idFirst)) {
        first = new ConnectionNotation(mapIds.get(idFirst)).getSourceId();
      }

      if (mapIds.containsKey(idSecond)) {
        second = new ConnectionNotation(mapIds.get(idSecond)).getSourceId();
      }

      ConnectionNotation newConnection = new ConnectionNotation(first, second, connection.getSourceUnit(), connection.getrGroupSource(), connection.getTargetUnit(), connection.getrGroupTarget(),
          connection.getAnnotation());

      helm2notation.addConnection(newConnection);
    }

  }
977030
public void setSections(final List<Section> SECTIONS) {
        getSections().setAll(SECTIONS);
        getSections().sort(new SectionComparator());
        fireTileEvent(SECTION_EVENT);
    }
624094
@XmlElementWrapper(name = "sections")
    @XmlElement(name = "s", type = S.class)
    public List<S> getSections() {
        return sections;
    }
479538
@Override
  public Set<DataSegment> announceHistoricalSegments(final Set<DataSegment> segments) throws IOException
  {
    final SegmentPublishResult result = announceHistoricalSegments(segments, null, null);

    // Metadata transaction cannot fail because we are not trying to do one.
    if (!result.isSuccess()) {
      throw new ISE("WTF?! announceHistoricalSegments failed with null metadata, should not happen.");
    }

    return result.getSegments();
  }
984787
Stream<SegmentWithState> getSegmentWithStates(Collection<String> sequenceNames)
  {
    synchronized (segments) {
      return sequenceNames
          .stream()
          .map(segments::get)
          .filter(Objects::nonNull)
          .flatMap(segmentsForSequence -> segmentsForSequence.intervalToSegmentStates.values().stream())
          .flatMap(segmentsOfInterval -> segmentsOfInterval.getAllSegments().stream());
    }
  }
373156
public List<Vec> getRawBasisVecs()
    {
        List<Vec> vecs = new ArrayList<Vec>(getBasisSize());
        vecs.addAll(this.points.get(0).vecs);
        return vecs;
    }
1208854
public void setSections(final List<TimeSection> SECTIONS) {
        sections.setAll(SECTIONS);
        Collections.sort(sections, new TimeSectionComparator());
        fireUpdateEvent(SECTION_EVENT);
    }