Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Update to ol 7 and ol-ext 4 #96

Merged
merged 6 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion @types/ol-ext/control/WMSCapabilities.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import TileLayer from 'ol/layer/Tile';
import Button from './Button';
import { Options as ControlOptions } from 'ol/control/Control';
import Dialog from './Dialog';
import Layer from '../filter/Base';
import { Extent } from 'ol/extent';
import TileSource from 'ol/source/Tile';

Expand Down
6 changes: 3 additions & 3 deletions @types/ol-ext/featureanimation/FeatureAnimation.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Style } from 'ol/style'
import { FeatureLike } from 'ol/Feature';
import { Geometry } from 'ol/geom';
import GeometryType from 'ol/geom/GeometryType';
import { Extent } from 'ol/extent';
import { Coordinate } from 'ol/coordinate';
import { FrameState } from 'ol/PluggableMap';
import VectorContext from 'ol/render/VectorContext';
import { StyleLike } from 'ol/style/Style';
import { Object as _OL_OBJECT } from 'ol';
import { Type } from 'ol/geom/Geometry';
import { FrameState } from 'ol/Map';

export interface FeatureAnimationEvent {
vectorContext: VectorContext,
Expand All @@ -19,7 +19,7 @@ export interface FeatureAnimationEvent {
// Feature information
feature: FeatureLike,
geom: Geometry
typeGeom: typeof GeometryType,
typeGeom: Type,
bbox: Extent
coord: Coordinate
style: StyleLike
Expand Down
6 changes: 3 additions & 3 deletions @types/ol-ext/interaction/DrawTouch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { Map as _ol_Map_ } from 'ol';
import { Coordinate } from 'ol/coordinate';
import { Vector as VectorSource } from 'ol/source';
import { Style } from 'ol/style';
import GeometryType from 'ol/geom/GeometryType';
import CenterTouch from './CenterTouch';
import { Type } from 'ol/geom/Geometry';

export interface Options {
source?: VectorSource;
type: typeof GeometryType.POINT | typeof GeometryType.LINE_STRING | typeof GeometryType.POLYGON;
type: 'Point'| 'LineString' | 'Polygon'
tap?: boolean;
style?: Style | Style[];
sketchStyle?: Style | Style[];
Expand Down Expand Up @@ -48,7 +48,7 @@ export interface Options {
/** Get geometry type
* @return {GeometryType}
*/
getGeometryType(): typeof GeometryType;
getGeometryType(): Type;
/** Start drawing and add the sketch feature to the target layer.
* The interaction.Draw.EventType.DRAWEND event is dispatched before inserting the feature.
*/
Expand Down
12 changes: 6 additions & 6 deletions @types/ol-ext/interaction/GeolocationDraw.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Map as _ol_Map_ } from 'ol';
import { Vector as VectorSource } from 'ol/source';
import { StyleLike } from 'ol/style/Style';
import GeometryType from 'ol/geom/GeometryType';
import { Interaction } from 'ol/interaction';
import { Coordinate } from 'ol/coordinate';
import { Geolocation as _ol_Geolocation } from 'ol';
import { Geometry, LineString, Polygon } from 'ol/geom';
import { Type } from 'ol/geom/Geometry';
import BaseEvent from 'ol/events/Event';
import Feature from 'ol/Feature';
import { EventsKey } from 'ol/events';
Expand All @@ -14,10 +14,10 @@ import { CombinedOnSignature, EventTypes, OnSignature } from 'ol/Observable';
import { Types } from 'ol/ObjectEventType';

type GeolocationDrawOnSignature<Return> = OnSignature<EventTypes, Event, Return> &
OnSignature<Types | 'change' | 'change:active' | 'error' | 'propertychange', ObjectEvent, Return> &
OnSignature<Types | 'drawing' | 'tracking', GeolocationDrawEvent, Return> &
OnSignature<Types | 'following', FollowingEvent, Return> &
CombinedOnSignature<Types | EventTypes | 'change' | 'change:active' | 'error' | 'propertychange' | 'drawing' | 'tracking' | 'following', Return>;
OnSignature<Types | 'change' | 'change:active' | 'error' | 'propertychange', ObjectEvent, Return> &
OnSignature<Types | 'drawing' | 'tracking', GeolocationDrawEvent, Return> &
OnSignature<Types | 'following', FollowingEvent, Return> &
CombinedOnSignature<Types | EventTypes | 'change' | 'change:active' | 'error' | 'propertychange' | 'drawing' | 'tracking' | 'following', Return>;

export enum GeolocationDrawEventType {
DRAWING = 'drawing',
Expand All @@ -34,7 +34,7 @@ export interface Attributes {

export interface GeolocationDrawOptions {
source?: VectorSource;
type?: typeof GeometryType.POINT | typeof GeometryType.LINE_STRING | typeof GeometryType.POLYGON;
type?: 'Point' | 'LineString' | 'Polygon';
minAccuracy?: number;
condition?: ((loc: _ol_Geolocation) => boolean);
attributes?: Attributes;
Expand Down
1 change: 0 additions & 1 deletion @types/ol-ext/interaction/Hover.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Event from 'ol/events/Event';
import Feature from 'ol/Feature';
import { Layer } from 'ol/layer';
import BaseEvent from 'ol/events/Event';
import Collection from 'ol/Collection';
import { Pixel } from 'ol/pixel';
import { Coordinate } from 'ol/coordinate';
import { Geometry } from 'ol/geom';
Expand Down
22 changes: 11 additions & 11 deletions @types/ol-ext/interaction/ModifyFeature.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@ import Collection from 'ol/Collection';
import { Coordinate } from 'ol/coordinate';
import Feature from 'ol/Feature';
import { Style } from 'ol/style';
import GeometryType from 'ol/geom/GeometryType';
import { Pointer } from 'ol/interaction';
import MapBrowserEvent from 'ol/MapBrowserEvent';
import { Condition as EventsConditionType } from 'ol/events/condition';
import { Vector as VectorSource } from 'ol/source';
import { EventsKey } from 'ol/events';
import BaseEvent from 'ol/events/Event';
import { ObjectEvent } from 'ol/Object';
import Geometry from 'ol/geom/Geometry';
import Geometry, { Type } from 'ol/geom/Geometry';
import { CombinedOnSignature, EventTypes, OnSignature } from 'ol/Observable';
import { Types } from 'ol/ObjectEventType';

type ModifyFeatureOnSignature<Return> = OnSignature<EventTypes, Event, Return> &
OnSignature<Types | 'change' | 'change:active' | 'error' | 'propertychange', ObjectEvent, Return> &
OnSignature<Types | 'modifyend' | 'modifystart' | 'modifying', ModifyEvent, Return> &
CombinedOnSignature<Types | EventTypes | 'change' | 'change:active' | 'error' | 'propertychange' | 'modifyend' | 'modifystart' | 'modifying', Return>;
OnSignature<Types | 'change' | 'change:active' | 'error' | 'propertychange', ObjectEvent, Return> &
OnSignature<Types | 'modifyend' | 'modifystart' | 'modifying', ModifyEvent, Return> &
CombinedOnSignature<Types | EventTypes | 'change' | 'change:active' | 'error' | 'propertychange' | 'modifyend' | 'modifystart' | 'modifying', Return>;

export enum ModifyingEventType {
MODIFYING = 'modifying'
Expand Down Expand Up @@ -84,21 +83,22 @@ export default class ModifyFeature extends Pointer {
setFilter(filter?: (f: Feature) => boolean): void

/** Get nearest coordinate in a list
* @param {Coordinate} pt the point to find nearest
* @param {geom} coords list of coordinates
* @return {*} the nearest point with a coord (projected point), dist (distance to the geom), ring (if Polygon)
*/
getNearestCoord(pt: Coordinate, coords: typeof GeometryType): {
* @param {ol.coordinate} pt the point to find nearest
* @param {ol.geom} geom Geometry
* @return {*} the nearest point with a coord (projected point), dist (distance to the geom), ring (if Polygon)
*/
getNearestCoord(pt: Coordinate, geom: Type): {
coord: Coordinate,
dist: number,
ring?: number
pt?: Coordinate,
} | false;

/** Get arcs concerned by a modification
* @param {geom} geom the geometry concerned
* @param {Coordinate} coord pointed coordinates
*/
getArcs(geom: typeof GeometryType, coord: Coordinate): void;
getArcs(geom: Type, coord: Coordinate): void;
/**
* @param {MapBrowserEvent<UIEvent>} evt Map browser event.
* @return {boolean} `true` to start the drag sequence.
Expand Down
4 changes: 2 additions & 2 deletions @types/ol-ext/interaction/ModifyTouch.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Map as _ol_Map_ } from 'ol';
import { Modify } from 'ol/interaction';
import OverlayPositioning from 'ol/OverlayPositioning';
import BaseEvent from 'ol/events/Event';
import Feature from 'ol/Feature';
import { Coordinate } from 'ol/coordinate';
Expand All @@ -9,6 +8,7 @@ import { ObjectEvent } from 'ol/Object';
import { ModifyEvent } from 'ol/interaction/Modify';
import { CombinedOnSignature, EventTypes, OnSignature } from 'ol/Observable';
import { Types } from 'ol/ObjectEventType';
import Positioning from 'ol/Overlay';

type ModifyTouchOnSignature<Return> = OnSignature<EventTypes, Event, Return> &
OnSignature<Types | 'change' | 'change:active' | 'error' | 'propertychange', ObjectEvent, Return> &
Expand All @@ -23,7 +23,7 @@ export enum PopupEventType {
export interface Options {
title?: string;
className?: string;
positioning?: typeof OverlayPositioning;
positioning?: Positioning;
offsetBox?: number | number[];
usePopup?: boolean;
}
Expand Down
2 changes: 1 addition & 1 deletion @types/ol-ext/interaction/Offset.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Map as _ol_Map_ } from 'ol';
import Collection from 'ol/Collection';
import Feature from 'ol/Feature';
import { Vector } from 'ol/layer';
import { Layer, Vector } from 'ol/layer';
import { Vector as VectorSource } from 'ol/source';
import { Pointer } from 'ol/interaction';
import { StyleLike } from 'ol/style/Style';
Expand Down
1 change: 0 additions & 1 deletion @types/ol-ext/interaction/Ripple.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Pointer } from 'ol/interaction';
import MapBrowserEvent from 'ol/MapBrowserEvent';
import { Color } from 'ol/color';
import { Pixel } from 'ol/pixel';
import { Layer } from 'ol/layer';

Expand Down
4 changes: 2 additions & 2 deletions @types/ol-ext/interaction/TouchCursorDraw.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import { TouchCursor } from "./TouchCursor";
import { Coordinate } from 'ol/coordinate';
import { InteractionOptions } from "ol/interaction/Interaction";
import Button from "../control/Button";
import GeometryType from 'ol/geom/GeometryType';
import VectorSource from 'ol/source/Vector';
import Collection from 'ol/Collection';
import { Feature, Map as _ol_Map_ } from 'ol';
import { StyleLike } from 'ol/style/Style';
import { Type } from "ol/geom/Geometry";

export interface Options extends InteractionOptions {
className?: string;
coordinate?: Coordinate;
buttons?: Button[];
maxButtons?: number;
type?: typeof GeometryType;
type?: Type;
types?: string[];
source?: VectorSource;
features?: Collection<Feature>;
Expand Down
4 changes: 2 additions & 2 deletions @types/ol-ext/overlay/FixedPopup.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Map as _ol_Map_, Overlay } from 'ol';

import { Pixel } from 'ol/pixel';
import { Style } from 'ol/style';
import OverlayPositioning from 'ol/OverlayPositioning';
import Positioning from 'ol/Overlay';
import { Options as OverlayOptions } from 'ol/Overlay';
import Popup from './Popup';
export interface Options extends OverlayOptions {
Expand All @@ -14,7 +14,7 @@ export interface Options extends OverlayOptions {
onClose?: () => void;
onShow?: () => void;
offsetBox?: number | number[];
positioning?: typeof OverlayPositioning | any | undefined; // workaround with any for 'auto'
positioning?: typeof Positioning | any | undefined; // workaround with any for 'auto'
}

/**
Expand Down
13 changes: 5 additions & 8 deletions @types/ol-ext/overlay/Popup.d.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
import { Overlay as Overlay } from 'ol';
import { Overlay } from 'ol';
import { Coordinate } from 'ol/coordinate';
import { Options as OverlayOptions } from 'ol/Overlay';
import OverlayPositioning from 'ol/OverlayPositioning';
import { Options as OverlayOptions, Positioning } from 'ol/Overlay';


/** Openlayers Overlay.
* An element to be displayed over the map and attached to a single map location.
* @namespace Overlay
* @see {@link http://openlayers.org/en/latest/apidoc/module-ol_Overlay.html}
*/


export interface Options extends OverlayOptions {
popupClass?: string;
anim?: boolean;
closeBox?: boolean;
onclose?: () => void;
onshow?: () => void;
offsetBox?: number | number[];
positioning?: typeof OverlayPositioning | any | undefined; // workaround with any for 'auto'
positioning?: Positioning | any | undefined; // workaround with any for 'auto'
minibar?: boolean;
}



/**
* @classdesc
* A popup element to be displayed over the map and attached to a single map
Expand Down Expand Up @@ -82,7 +79,7 @@ export default class Popup extends Overlay {
* or 'auto' to var the popup choose the best position
* @api stable
*/
setPositioning(pos?: typeof OverlayPositioning | string): void;
setPositioning(pos?: Positioning | string): void;
/** Check if popup is visible
* @return {boolean}
*/
Expand Down
6 changes: 3 additions & 3 deletions @types/ol-ext/overlay/PopupFeature.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Coordinate } from 'ol/coordinate';
import Feature from 'ol/Feature';
import { Overlay } from 'ol';
import OverlayPositioning from 'ol/OverlayPositioning';
import { Select } from 'ol/interaction';
import { Positioning } from 'ol/Overlay';


/** Template attributes for popup
Expand Down Expand Up @@ -39,7 +39,7 @@ export interface Options {
onclose?: ((...params: any[]) => any);
onshow?: ((...params: any[]) => any);
offsetBox?: number | number[];
positioning?: typeof OverlayPositioning | string;
positioning?: Positioning | string;
template?: Template | ((f: Feature) => Template);
select?: Select;
keepSelection?: boolean;
Expand Down Expand Up @@ -122,7 +122,7 @@ export default class PopupFeature extends Overlay { // we cannot use extends Pop
* or 'auto' to var the popup choose the best position
* @api stable
*/
setPositioning(pos: typeof OverlayPositioning | string | undefined): void;
setPositioning(pos: Positioning | string | undefined): void;
/** Check if popup is visible
* @return {boolean}
*/
Expand Down
6 changes: 3 additions & 3 deletions @types/ol-ext/overlay/Tooltip.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Map as _ol_Map_ } from 'ol';
import { Coordinate } from 'ol/coordinate';
import Feature from 'ol/Feature';
import Event from 'ol/events/Event';
import OverlayPositioning from 'ol/OverlayPositioning';
import Popup from './Popup';
import { Positioning } from 'ol/Overlay';

export interface Options {
popupClass?: string;
Expand All @@ -12,7 +12,7 @@ export interface Options {
formatArea?: (area: number) => string;
getHTML?: (feature: Feature, info: string) => string;
offsetBox?: number | number[];
positionning?: typeof OverlayPositioning | string ;
Positioning?: Positioning | string;
}
/** A tooltip element to be displayed over the map and attached on the cursor position.
* @constructor
Expand Down Expand Up @@ -103,7 +103,7 @@ export default class Tooltip extends Popup {
* or 'auto' to var the popup choose the best position
* @api stable
*/
setPositioning(pos?: typeof OverlayPositioning | string): void;
setPositioning(pos?: Positioning | string): void;
/** Check if popup is visible
* @return {boolean}
*/
Expand Down
2 changes: 1 addition & 1 deletion @types/ol-ext/source/Geoportail.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WMTS} from 'ol/source/WMTS';
import WMTS from 'ol/source/WMTS';
import { Options as SourceOptions } from 'ol/source/TileImage';
import { Coordinate } from 'ol/coordinate';
import { ProjectionLike } from 'ol/proj';
Expand Down
2 changes: 1 addition & 1 deletion @types/ol-ext/style/FillPattern.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default class FillPattern extends Fill {
/** Patterns definitions
* @see pattern generator http://www.imagico.de/map/jsdotpattern.php
*/
patterns: {
static patterns: {
hatch: {
width: number;
height: number;
Expand Down
10 changes: 6 additions & 4 deletions @types/ol-ext/style/FontSymbol.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ export interface Glyph {
search: string
}

export interface FontDefs {
fonts: { [key:string]: Font },
glyphs: { [key:string]: Glyph }
}

/**
* @classdesc
* A marker style to use with font symbols.
Expand Down Expand Up @@ -75,10 +80,7 @@ export default class FontSymbol extends RegularShape {
/**
* Font defs
*/
defs: {
fonts: any;
glyphs: any;
};
static defs: FontDefs;
/** Static function : add new font defs
* @param {String|Object} font the font desciption
* @param {} glyphs a key / value list of glyph definitions.
Expand Down
4 changes: 2 additions & 2 deletions @types/ol-ext/util/TextStreamReader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export default class TextStreamReader {
* @param {function} getLine a function that gets the current line as argument. Return false to stop reading
* @param {function} [progress] a function that gets the progress on each chunk (beetween 0,1) and a boolean set to true on end
*/
readLines(getLine: (line: string) => void, progress?: (number, boolean) => void): void;
readLines(getLine: (line: string) => void, progress?: (arg0: number, arg1: boolean) => void): void;
/** Read a set of line chunk from the stream
* @param {function} getLines a function that gets lines read as an Array<String>.
* @param {function} [progress] a function that gets the progress (beetween 0,1) and a boolean set to true on end of file
*/
readChunk(getLines: (lines: string[]) => void, progress?: (number, boolean) => void): void
readChunk(getLines: (lines: string[]) => void, progress?: (arg0: number, arg1: boolean) => void): void

}
4 changes: 2 additions & 2 deletions @types/ol-ext/util/View.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export interface viewTourDestinations {
/**
* Optional anchor to remain fixed during a rotation or resolution animation.
*/
anchor?: anchor;
};
anchor?: Coordinate;
}

export type Destination = {
x: number,
Expand Down
Loading