import { Style } from 'geostyler-style'; import OlGeomPoint from 'ol/geom/Point'; import OlLineString from 'ol/geom/LineString'; import OlMultiLineString from 'ol/geom/MultiLineString'; import OlPolygon from 'ol/geom/Polygon'; import OlMultiPolygon from 'ol/geom/MultiPolygon'; import { Coordinate } from 'ol/coordinate'; import { Geometry } from 'ol/geom'; /** * Offers some utility functions to work with OpenLayers Graphic Strokes. */ declare class OlGraphicStrokeUtil { /** * Check if the given style contains a graphic stroke in any of its rules. * @param style The style to check. * @returns True if the style contains a graphic stroke, false otherwise. */ static containsGraphicStroke(style: Style): boolean; /** * Get the rotation in degrees for a line segment defined by its start and * end coordinates. * @param start The start coordinate of the line segment. * @param end The end coordinate of the line segment. * @returns The rotation in degrees. */ static getSegmentRotation(start: Coordinate, end: Coordinate): number; /** * Get the rotations in degrees for each segment of a LineString geometry. * @param geom The LineString geometry * @returns An array of rotations in degrees for each segment */ static getSegmentRotations(geom: OlLineString): number[]; /** * Get the total size of a dash pattern in map units. * @param dashArray The dash array in pixels. * @param resolution The map resolution. * @returns The total size of the dash pattern in map units. */ static getPatternSize(dashArray: number[], resolution: number): number; /** * Get the normalized fractions along the line where each segment ends. * @param geom The LineString geometry * @returns An array of normalized fractions */ static getSegmentFractions(geom: OlLineString): number[]; /** * Get the dash array as fractions of the total line length. * @param dashArray The dash array in pixels. * @param resolution The map resolution. * @param lineLength The total length of the line in map units. * @returns An array of fractions representing the dash lengths relative * to the line length. */ static getDashAsFractions(dashArray: number[], resolution: number, lineLength: number): number[]; /** * Get the fractions along the line where ticks should be placed, considering * the symbol size, resolution, and optional dash pattern. * @param geom The LineString geometry * @param symbolSize The size of the symbol in pixels * @param resolution The map resolution * @param dashArray Optional dash array * @param dashOffset Optional dash offset * @returns An array of fractions along the line where ticks should be placed */ static getTickFractions(geom: OlLineString, symbolSize: number, resolution: number, dashArray?: number[], dashOffset?: number): number[]; /** * Helper method to add a tick at the given fraction if it's within valid bounds. * @param ticks Array to add the tick to * @param currentFraction The fraction to potentially add * @returns True if the tick was added and we should continue, false if we've exceeded bounds */ static tryAddTick(ticks: number[], currentFraction: number, leftEdge: number, rightEdge: number): boolean; /** * Get tick fractions for a line without a dash pattern. * @param symbolSizeFraction The symbol size as a fraction of the line length * @param offsetFraction The offset as a fraction of the line length * @returns An array of fractions along the line where ticks should be placed */ static getTickFractionsWithoutDash(symbolSizeFraction: number): number[]; /** * Get tick fractions for a line with a dash pattern. * @param dashArray The dash array in pixels * @param resolution The map resolution * @param lineLength The total length of the line in map units * @param symbolSizeFraction The symbol size as a fraction of the line length * @param offsetFraction The offset as a fraction of the line length * @returns An array of fractions along the line where ticks should be placed */ static getTickFractionsWithDash(dashArray: number[], resolution: number, lineLength: number, symbolSizeFraction: number, offsetFraction: number): number[]; /** * Process a single LineString geometry to generate graphic stroke styles. * * @param geom The LineString geometry to process * @param symbolSize The size of the symbol in pixels * @param resolution The map resolution * @param dashArray Optional dash array for dashed patterns * @param evaluatedDashOffset Evaluated dash offset value * @param evaluatedSymbolRotation Evaluated symbol rotation in degrees * @param graphicStroke The graphic stroke point symbolizer * @param symbolizerGenerator Function to generate OL styles from a modified graphic stroke * @param PointConstructor Constructor for creating OL Point geometries * @returns Array of OL styles for the graphic stroke */ static processLineStringGraphicStroke(geom: OlLineString, symbolSize: number, resolution: number, dashArray: number[] | undefined, evaluatedDashOffset: number, evaluatedSymbolRotation: number, graphicStroke: any, symbolizerGenerator: (modifiedGraphicStroke: any) => any, PointConstructor: typeof OlGeomPoint): any[]; static getLineStringsFromGeometry(geom: Geometry | undefined, constructors: { LineString: typeof OlLineString; MultiLineString: typeof OlMultiLineString; Polygon: typeof OlPolygon; MultiPolygon: typeof OlMultiPolygon; }): OlLineString[]; } export default OlGraphicStrokeUtil;