package.interaction.DragAndDrop.d.ts Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ol Show documentation
Show all versions of ol Show documentation
OpenLayers mapping library
The newest version!
/**
* @classdesc
* Events emitted by {@link module:ol/interaction/DragAndDrop~DragAndDrop} instances are instances
* of this type.
*/
export class DragAndDropEvent extends Event {
/**
* @param {DragAndDropEventType} type Type.
* @param {File} file File.
* @param {Array} [features] Features.
* @param {import("../proj/Projection.js").default} [projection] Projection.
*/
constructor(type: DragAndDropEventType, file: File, features?: import("../Feature.js").default[] | undefined, projection?: import("../proj.js").Projection | undefined);
/**
* The features parsed from dropped data.
* @type {Array|undefined}
* @api
*/
features: Array | undefined;
/**
* The dropped file.
* @type {File}
* @api
*/
file: File;
/**
* The feature projection.
* @type {import("../proj/Projection.js").default|undefined}
* @api
*/
projection: import("../proj/Projection.js").default | undefined;
}
export default DragAndDrop;
export type Options = {
/**
* Format constructors
* (and/or formats pre-constructed with options).
*/
formatConstructors?: (typeof import("../format/Feature.js").default | import("../format/Feature.js").default>)[] | undefined;
/**
* Optional vector source where features will be added. If a source is provided
* all existing features will be removed and new features will be added when
* they are dropped on the target. If you want to add features to a vector
* source without removing the existing features (append only), instead of
* providing the source option listen for the "addfeatures" event.
*/
source?: import("../source/Vector.js").default> | undefined;
/**
* Target projection. By default, the map's view's projection is used.
*/
projection?: import("../proj.js").ProjectionLike;
/**
* The element that is used as the drop target, default is the viewport element.
*/
target?: HTMLElement | undefined;
};
/**
* *
*/
export type DragAndDropOnSignature = import("../Observable").OnSignature & import("../Observable").OnSignature & import("../Observable").OnSignature<"addfeatures", DragAndDropEvent, Return> & import("../Observable").CombinedOnSignature;
import Event from '../events/Event.js';
type DragAndDropEventType = string;
declare namespace DragAndDropEventType {
let ADD_FEATURES: string;
}
/***
* @template Return
* @typedef {import("../Observable").OnSignature &
* import("../Observable").OnSignature &
* import("../Observable").OnSignature<'addfeatures', DragAndDropEvent, Return> &
* import("../Observable").CombinedOnSignature} DragAndDropOnSignature
*/
/**
* @classdesc
* Handles input of vector data by drag and drop.
*
* @api
*
* @fires DragAndDropEvent
*/
declare class DragAndDrop extends Interaction {
/**
* @param {Options} [options] Options.
*/
constructor(options?: Options | undefined);
/***
* @type {DragAndDropOnSignature}
*/
on: DragAndDropOnSignature;
/***
* @type {DragAndDropOnSignature}
*/
once: DragAndDropOnSignature;
/***
* @type {DragAndDropOnSignature}
*/
un: DragAndDropOnSignature;
/**
* @private
* @type {boolean}
*/
private readAsBuffer_;
/**
* @private
* @type {Array}
*/
private formats_;
/**
* @private
* @type {import("../proj/Projection.js").default}
*/
private projection_;
/**
* @private
* @type {?Array}
*/
private dropListenKeys_;
/**
* @private
* @type {import("../source/Vector.js").default}
*/
private source_;
/**
* @private
* @type {HTMLElement|null}
*/
private target;
/**
* @param {File} file File.
* @param {Event} event Load event.
* @private
*/
private handleResult_;
/**
* @private
*/
private registerListeners_;
/**
* Remove the interaction from its current map and attach it to the new map.
* Subclasses may set up event handlers to get notified about changes to
* the map here.
* @param {import("../Map.js").default} map Map.
* @override
*/
override setMap(map: import("../Map.js").default): void;
/**
* @param {import("../format/Feature.js").default} format Format.
* @param {string} text Text.
* @param {import("../format/Feature.js").ReadOptions} options Read options.
* @private
* @return {Array} Features.
*/
private tryReadFeatures_;
/**
* @private
*/
private unregisterListeners_;
/**
* @param {DragEvent} event Event.
*/
handleDrop(event: DragEvent): void;
/**
* @param {DragEvent} event Event.
*/
handleStop(event: DragEvent): void;
}
import Interaction from './Interaction.js';
//# sourceMappingURL=DragAndDrop.d.ts.map