Calculate the soil cumulation map along the paths.

@param pathCoordinates the coordinates of the path to be cumulated.
@param isBetweenSlopesCondition conditions defining in which points the path does
contribute mass.
323668
private void cumulateSoil( List<Coordinate> pathCoordinates, List<Boolean> isBetweenSlopesCondition ) {
        // pm.beginTask("Cumulate Soil...", pathCoordinates.size());

        java.awt.Point point = new java.awt.Point();
        GridGeometry2D gridGeometry = inSoil.getGridGeometry();

        /*
         * check if the trigger is too far to reach the network.
         */
        double distance = 0.0;
        Coordinate previousCoordinate = null;
        for( int i = 0; i < pathCoordinates.size(); i++ ) {
            Coordinate coordinate = pathCoordinates.get(i);
            CoverageUtilities.colRowFromCoordinate(coordinate, gridGeometry, point);
            double net = netIter.getSampleDouble(point.x, point.y, 0);

            if (previousCoordinate != null) {
                distance = distance + coordinate.distance(previousCoordinate);
            }
            previousCoordinate = coordinate;

            if (distance > pDistance) {
                // if distance is too large, the path can be discarded
                return;
            }

            if (!isNovalue(net)) {
                // if path gets into the network, it has to be considered
                break;
            }
        }

        /*
         * do the actual cumulation map
         */
        double previousCumulated = 0.0;
        for( int i = 0; i < pathCoordinates.size(); i++ ) {
            Coordinate coordinate = pathCoordinates.get(i);
            CoverageUtilities.colRowFromCoordinate(coordinate, gridGeometry, point);

            boolean isBetweenSlopes = isBetweenSlopesCondition.get(i);

            double soil = soilIter.getSampleDouble(point.x, point.y, 0);
            if (isNovalue(soil)) {
                throw new ModelsIllegalargumentException("The soil map needs to cover the whole paths.", this, pm);
            }
            double net = netIter.getSampleDouble(point.x, point.y, 0);
            if (!isNovalue(net)) {
                isBetweenSlopes = true;
            }

            double cumulated = outSoilIter.getSampleDouble(point.x, point.y, 0);

            if (isBetweenSlopes) {
                if (isNovalue(cumulated)) {
                    outSoilIter.setSample(point.x, point.y, 0, previousCumulated);
                } else {
                    double newCumulated = cumulated + previousCumulated;
                    outSoilIter.setSample(point.x, point.y, 0, newCumulated);
                }
            } else {
                if (isNovalue(cumulated)) {
                    double newCumulated = soil + previousCumulated;
                    outSoilIter.setSample(point.x, point.y, 0, newCumulated);
                    previousCumulated = newCumulated;
                } else {
                    double newCumulated = cumulated + previousCumulated;
                    outSoilIter.setSample(point.x, point.y, 0, newCumulated);
                }
            }

        }

        if (doWholenet) {
            Coordinate lastCoordinate = pathCoordinates.get(pathCoordinates.size() - 1);
            CoverageUtilities.colRowFromCoordinate(lastCoordinate, gridGeometry, point);

            int[] flowDirColRow = new int[]{point.x, point.y};

            double net = netIter.getSampleDouble(flowDirColRow[0], flowDirColRow[1], 0);
            double tmpFlowValue = flowIter.getSampleDouble(flowDirColRow[0], flowDirColRow[1], 0);

            // handle the last point of the path only if it was inside the net...
            if (!isNovalue(net)) {
                // first move to the next point
                if (!ModelsEngine.go_downstream(flowDirColRow, tmpFlowValue))
                    throw new ModelsIllegalargumentException(
                            "Unable to go downstream [col/row]: " + flowDirColRow[0] + "/" + flowDirColRow[1], this, pm);
                tmpFlowValue = flowIter.getSampleDouble(flowDirColRow[0], flowDirColRow[1], 0);
                while( !isNovalue(tmpFlowValue) && tmpFlowValue != 10 ) {
                    double cumulated = outSoilIter.getSampleDouble(flowDirColRow[0], flowDirColRow[1], 0);
                    if (isNovalue(cumulated)) {
                        cumulated = 0.0;
                    }
                    double newCumulated = cumulated + previousCumulated;
                    outSoilIter.setSample(flowDirColRow[0], flowDirColRow[1], 0, newCumulated);

                    if (!ModelsEngine.go_downstream(flowDirColRow, tmpFlowValue))
                        throw new ModelsIllegalargumentException(
                                "Unable to go downstream [col/row]: " + flowDirColRow[0] + "/" + flowDirColRow[1], this, pm);
                    tmpFlowValue = flowIter.getSampleDouble(flowDirColRow[0], flowDirColRow[1], 0);
                }

            }

        }

    }
360376
@Pure
	public static GeodesicPosition L3_WSG84(double x, double y) {
		final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
				LAMBERT_3_N,
				LAMBERT_3_C,
				LAMBERT_3_XS,
				LAMBERT_3_YS);
		return NTFLambdaPhi_WSG84(ntfLambdaPhi.getX(), ntfLambdaPhi.getY());
	}
888421
public boolean hasVertex(float x, float y) {    	
    	if (points.length == 0) {
    		return false;
    	}
    	
    	checkPoints();
    	
    	for (int i=0;i<points.length;i+=2) {
    		if ((points[i] == x) && (points[i+1] == y)) {
    			return true;
    		}
    	}
    	
    	return false;
    }
417450
def _cumulate(exact = false, force = false)
      unless force
        factor = if @last_cumulate == 0
                   Float::INFINITY
                 else
                   (@n.to_f / @last_cumulate)
                 end
        return if @n == @last_cumulate || (!exact && @cx && @cx > factor)
      end

      cumn = 0
      @centroids.each do |_, c|
        c.mean_cumn = cumn + c.n / 2.0
        cumn = c.cumn = cumn + c.n
      end
      @n = @last_cumulate = cumn
      nil
    end
91801
public boolean shouldBeExcluded(final Field field, final RandomizerContext context) {
        if (isStatic(field)) {
            return true;
        }
        Set<Predicate<Field>> fieldExclusionPredicates = context.getParameters().getFieldExclusionPredicates();
        for (Predicate<Field> fieldExclusionPredicate : fieldExclusionPredicates) {
            if (fieldExclusionPredicate.test(field)) {
                return true;
            }
        }
        return false;
    }
1302262
void sortVerticesSimpleByY_(AttributeStreamOfInt32 points, int begin_,
			int end_) {
		if (m_bucket_sort == null)
			m_bucket_sort = new BucketSort();
		m_bucket_sort.sort(points, begin_, end_, new EditShapeBucketSortHelper(
				this));
	}
218093
@Override
    public boolean doesCoordinateOverlapWithCommittedCoordinate(Coordinate coordinate) {
        return fixedRows.get(coordinate.row) || fixedVertices.contains(coordinate.match.vertex);
    }
219532
protected boolean verifyCondition1(IContextMapping<INode> mapping, INode source, INode target) {
        return findRelation(mapping, IMappingElement.LESS_GENERAL, source.getAncestorsList(), target) ||
                findRelation(mapping, IMappingElement.LESS_GENERAL, source, target.getDescendantsList()) ||
                findRelation(mapping, IMappingElement.LESS_GENERAL, source.getAncestorsList(), target.getDescendantsList()) ||

                findRelation(mapping, IMappingElement.EQUIVALENCE, source.getAncestorsList(), target) ||
                findRelation(mapping, IMappingElement.EQUIVALENCE, source, target.getDescendantsList()) ||
                findRelation(mapping, IMappingElement.EQUIVALENCE, source.getAncestorsList(), target.getDescendantsList());
    }
43062
@Override
	public void setSecondAxis(double x, double y, double z) {
		setSecondAxis(x, y, z, getSecondAxisExtent());
	}
352691
protected void bicoCFUpdate(ClusteringTreeNode x) {
		// Starts with the global root node as the current root node
		ClusteringTreeNode r = this.root;
		int i = 1;
		while (true) {
			ClusteringTreeNode y = r.nearestChild(x.getCenter());
			// Checks if the node can not be merged to the current level
			if (r.hasNoChildren()
					|| y == null
					|| Metric.distanceSquared(x.getCenter(), y.getCenter()) > calcRSquared(i)) {
				// Adds the node to the current root node
				x.setThreshold(calcR(i));
				r.addChild(x);
				this.rootCount++;
				break;
			} else {
				// Checks if the node can be merged to the nearest node without
				// exceeding the global threshold
				if (y.getClusteringFeature().calcKMeansCosts(y.getCenter(),
						x.getClusteringFeature()) <= this.T) {
					// Merges the ClusteringFeature of the node to the
					// ClusteringFeature of the nearest node
					y.getClusteringFeature().merge(x.getClusteringFeature());
					break;
				} else {
					// Navigates one level down in the tree
					r = y;
					i++;
				}
			}
		}
	}
185156
protected boolean checkPreconditions(List<SquareNode> cluster) {
		for( int i = 0; i < cluster.size(); i++ ) {
			SquareNode n = cluster.get(i);
			for (int j = 0; j < n.square.size(); j++) {
				SquareEdge e0 = n.edges[j];
				if( e0 == null)
					continue;
				for (int k = j+1; k < n.square.size(); k++) {
					SquareEdge e1 = n.edges[k];
					if( e1 == null)
						continue;
					if( e0.destination(n) == e1.destination(n) ) {
						return false;
					}
				}
			}
		}
		return true;
	}
1341540
private static boolean findPropsFromNodeBean(final NodeBean nodeBean,
      final String[] pathList, final int idx, final List<Props> propsList) {
    if (idx < pathList.length && nodeBean.getName().equals(pathList[idx])) {
      if (idx == pathList.length - 1) {
        propsList.add(nodeBean.getProps());
        return true;
      }
      for (final NodeBean bean : nodeBean.getNodes()) {
        if (findPropsFromNodeBean(bean, pathList, idx + 1, propsList)) {
          return true;
        }
      }
    }
    return false;
  }
754125
public static Boolean areCoordinatesWithinThreshold(Tuple2<Double, Double> point1, Tuple2<Double, Double> point2) {
        return getDistanceBetweenCoordinates(point1, point2) < COORDINATE_THRESHOLD;
    }
1037117
@Override
	public void setSecondAxis(double x, double y, double z, double extent) {
		setSecondAxis(x, y, z, extent, CoordinateSystem3D.getDefaultCoordinateSystem());
	}
582910
public Point3d getGridPointFrom3dCoordinates(Point3d coord) throws Exception {
        Point3d gridPoint = new Point3d();

        if (coord.x >= minx & coord.x <= maxx) {
            gridPoint.x = (int) Math.round(Math.abs(minx - coord.x) / latticeConstant);
        } else {
            throw new Exception("CDKGridError: Given coordinates are not in grid");
        }
        if (coord.y >= miny & coord.y <= maxy) {
            gridPoint.y = (int) Math.round(Math.abs(miny - coord.y) / latticeConstant);
        } else {
            throw new Exception("CDKGridError: Given coordinates are not in grid");
        }
        if (coord.z >= minz & coord.z <= maxz) {
            gridPoint.z = (int) Math.round(Math.abs(minz - coord.z) / latticeConstant);
        } else {
            throw new Exception("CDKGridError: Given coordinates are not in grid");
        }

        return gridPoint;
    }
488501
public Map<String, List<PathDetail>> calcDetails(List<String> requestedPathDetails, PathDetailsBuilderFactory pathBuilderFactory, int previousIndex) {
        if (!isFound() || requestedPathDetails.isEmpty())
            return Collections.emptyMap();
        List<PathDetailsBuilder> pathBuilders = pathBuilderFactory.createPathDetailsBuilders(requestedPathDetails, encoder, weighting);
        if (pathBuilders.isEmpty())
            return Collections.emptyMap();

        forEveryEdge(new PathDetailsFromEdges(pathBuilders, previousIndex));

        Map<String, List<PathDetail>> pathDetails = new HashMap<>(pathBuilders.size());
        for (PathDetailsBuilder builder : pathBuilders) {
            Map.Entry<String, List<PathDetail>> entry = builder.build();
            List<PathDetail> existing = pathDetails.put(entry.getKey(), entry.getValue());
            if (existing != null)
                throw new IllegalStateException("Some PathDetailsBuilders use duplicate key: " + entry.getKey());
        }

        return pathDetails;
    }
498151
protected void addCoordinateToGeometry(Coordinate newCoordinate) {
		int length = geometry.getCoordinates().length;
		Coordinate[] oldCoords = geometry.getCoordinates();
		Coordinate[] newCoords = new Coordinate[length + 1];
		System.arraycopy(oldCoords, 0, newCoords, 0, length);

		// put new coordinate in right position
		newCoords[length] = newCoordinate;

		// create new geometry
		geometry = factory.createLineString(newCoords);

		// update drawing
		updateTempLineAfterClick();
	}