docs: private DefaultFeatureCollection sharedCreateFeatures(
              final LabelPositionCollector labels,
              final SimpleFeatureBuilder featureBuilder,
              final GridParam layerData,
              final MapfishMapContext mapContext,
              final double xSpace, final double ySpace,
              final double minX, final double minY) {
          // CSON: ParameterNumber
          GeometryFactory geometryFactory = new GeometryFactory();
  
          ReferencedEnvelope bounds = mapContext.toReferencedEnvelope();
  
          CoordinateReferenceSystem mapCrs = bounds.getCoordinateReferenceSystem();
          String unit = layerData.calculateLabelUnit(mapCrs);
          MathTransform labelTransform = layerData.calculateLabelTransform(mapCrs);
  
          final AxisDirection direction =
                  bounds.getCoordinateReferenceSystem().getCoordinateSystem().getAxis(0).getDirection();
          int numDimensions = bounds.getCoordinateReferenceSystem().getCoordinateSystem().getDimension();
          Polygon rotatedBounds = GridUtils.calculateBounds(mapContext);
          AffineTransform worldToScreenTransform = GridUtils.getWorldToScreenTransform(mapContext);
  
          DefaultFeatureCollection features = new DefaultFeatureCollection();
  
          double pointSpacing = bounds.getSpan(1) / layerData.pointsInLine;
          int i = 0;
          for (double x = minX; x < bounds.getMaxX(); x += xSpace) {
              i++;
              final SimpleFeature feature = createFeature(featureBuilder, geometryFactory, layerData,
                                                          direction, numDimensions, pointSpacing, x,
                                                          bounds.getMinimum(1), i, 1);
              features.add(feature);
              GridUtils.topBorderLabel(labels, geometryFactory, rotatedBounds, unit, x,
                                       worldToScreenTransform, labelTransform, layerData.getGridLabelFormat());
              GridUtils.bottomBorderLabel(labels, geometryFactory, rotatedBounds, unit, x,
                                          worldToScreenTransform, labelTransform,
                                          layerData.getGridLabelFormat());
          }
  
          pointSpacing = bounds.getSpan(0) / layerData.pointsInLine;
          int j = 0;
          for (double y = minY; y < bounds.getMaxY(); y += ySpace) {
              j++;
              final SimpleFeature feature = createFeature(featureBuilder, geometryFactory, layerData,
                                                          direction, numDimensions, pointSpacing,
                                                          bounds.getMinimum(0), y, j, 0);
              features.add(feature);
              GridUtils.rightBorderLabel(labels, geometryFactory, rotatedBounds, unit, y,
                                         worldToScreenTransform, labelTransform,
                                         layerData.getGridLabelFormat());
              GridUtils.leftBorderLabel(labels, geometryFactory, rotatedBounds, unit, y,
                                        worldToScreenTransform, labelTransform, layerData.getGridLabelFormat());
  
          }
  
          return features;
      }