geopf-extensions-openlayers
    Preparing search index...

    Class Drawing

    Hierarchy (View Summary)

    Index
    • Parameters

      • options: {
            collapsed?: boolean;
            draggable?: boolean;
            id?: number;
            labels?: string;
            layer?: any;
            layerDescription?: { description?: string; title?: string };
            popup?: { display?: boolean; function?: Function };
            tools: {
                display?: boolean;
                edit?: boolean;
                export?: boolean;
                holes?: boolean;
                lines?: boolean;
                measure?: boolean;
                points?: boolean;
                polygons?: boolean;
                remove?: boolean;
                text?: boolean;
                tooltip?: boolean;
            };
        }

        options for function call.

        • Optionalcollapsed?: boolean

          Specify if Drawing control should be collapsed at startup. Default is true.

        • Optionaldraggable?: boolean

          Specify if widget is draggable

        • Optionalid?: number

          Ability to add an identifier on the widget (advanced option)

        • Optionallabels?: string

          Labels for Control

        • Optionallayer?: any

          Openlayers layer that will hosts created features. If none, an empty vector layer will be created.

        • OptionallayerDescription?: { description?: string; title?: string }

          Layer informations to be displayed in LayerSwitcher widget (only if a LayerSwitcher is also added to the map)

          • Optionaldescription?: string

            Layer description to be displayed in LayerSwitcher

          • Optionaltitle?: string

            Layer title to be displayed in LayerSwitcher

        • Optionalpopup?: { display?: boolean; function?: Function }

          Popup informations

          • Optionaldisplay?: boolean

            Specify if popup is displayed when create a drawing

          • Optionalfunction?: Function

            Function to display popup informations if you want to cutomise it. You may also provide your own function with params : {geomType / feature / saveFunc(message) / closeFunc()}. This function must return the DOM object of the popup content.

        • tools: {
              display?: boolean;
              edit?: boolean;
              export?: boolean;
              holes?: boolean;
              lines?: boolean;
              measure?: boolean;
              points?: boolean;
              polygons?: boolean;
              remove?: boolean;
              text?: boolean;
              tooltip?: boolean;
          }

          Tools to display in the drawing toolbox. All by default.

          • Optionaldisplay?: boolean

            Display style editing tool

          • Optionaledit?: boolean

            Display editing tool

          • Optionalexport?: boolean

            Display exporting tool

          • Optionalholes?: boolean

            Display polygons with holes drawing tool

          • Optionallines?: boolean

            Display lines drawing tool

          • Optionalmeasure?: boolean

            Display measure drawing into popup info

          • Optionalpoints?: boolean

            Display points drawing tool

          • Optionalpolygons?: boolean

            Display polygons drawing tool

          • Optionalremove?: boolean

            Display feature removing tool

          • Optionaltext?: boolean

            Display text drawing tool

          • Optionaltooltip?: boolean

            Display text editing tool

      Returns Drawing

      drawing:add:before - event triggered before an layer is added

      drawing:add:after - event triggered after an layer is added

      var drawing = new ol.control.Drawing({
      collapsed : false,
      draggable : true,
      layerswitcher : {
      title : "Dessins",
      description : "Mes dessins..."
      },
      markersList : [{
      src : "http://api.ign.fr/api/images/api/markers/marker_01.png",
      anchor : [0.5, 1]
      }],
      defaultStyles : {},
      cursorStyle : {},
      tools : {
      points : true,
      lines : true,
      polygons :true,
      holes : true,
      text : false,
      remove : true,
      display : true,
      tooltip : true,
      export : true,
      measure : true
      },
      popup : {
      display : true,
      function : function (params) {
      var container = document.createElement("div");
      // - params.geomType;
      // - params.feature;
      // Les 2 fonctions ferment la popup avec ou sans sauvegarde des informations
      // dans les properties de la feature (key : description)
      // - params.saveFunc(message);
      // - params.closeFunc();
      return container;
      }
      });
    _container: HTMLElement
    _drawingPanel: any
    _drawingPanelHeader: any
    _showDrawingButton: any
    collapsed: boolean | undefined
    description: any
    disposed: boolean

    The object has already been disposed.

    draggable: boolean | undefined
    element: HTMLElement
    eventKey: EventsKey | undefined
    labelOvl: Overlay | undefined
    layer: any
    listable: boolean
    listenerKeys: EventsKey[]
    on: ObjectOnSignature<EventsKey>
    once: ObjectOnSignature<EventsKey>
    options: any
    un: ObjectOnSignature<void>
    • Parameters

      • key: string

        Key name.

      • listener: Listener

        Listener.

      Returns void

    • Parameters

      • type: string

        Type.

      • listener: Listener

        Listener.

      Returns void

    • Protected

      Apply any properties from another object without triggering events.

      Parameters

      • source: BaseObject

        The source object.

      Returns void

    • Increases the revision counter and dispatches a 'change' event.

      Returns void

    • Dispatches an event and calls all listeners listening for events of this type. The event parameter can either be a string or an Object with a type property.

      Parameters

      • event: string | BaseEvent

        Event object.

      Returns boolean | undefined

      false if anyone called preventDefault on the event object or if any of the listeners returned false.

    • Clean up.

      Returns void

    • Protected

      Extension point for disposable objects.

      Returns void

    • Export features of current drawing layer (KML by default).

      Returns string

      a representation of drawn features (KML, GPX or GeoJSON) or null if not possible.

    • Gets a value.

      Parameters

      • key: string

        Key name.

      Returns any

      Value.

    • Get a list of object property names.

      Returns string[]

      List of property names.

    • Get the listeners for a specified event type. Listeners are returned in the order that they will be called in.

      Parameters

      • type: string

        Type.

      Returns Listener[] | undefined

      Listeners.

    • Get the map associated with this control.

      Returns Map | null

      Map.

    • Get an object of all property names and values.

      Returns NoInfer<{ [x: string]: any }>

      Object.

    • Get an object of all property names and values.

      Returns Partial<NoInfer<{ [x: string]: any }>> | null

      Object.

    • Get the version number for this object. Each time the object is modified, its version number will be incremented.

      Returns number

      Revision.

    • Parameters

      • Optionaltype: string

        Type. If not provided, true will be returned if this event target has any listeners.

      Returns boolean

      Has listeners.

    • Returns boolean

      The object has properties.

    • Parameters

      • key: string

        Key name.

      • oldValue: any

        Old value.

      Returns void

    • Protected

      Parameters

      • type: string | string[]

        Type.

      • listener: (arg0: Event | BaseEvent) => unknown

        Listener.

      Returns EventsKey | EventsKey[]

      Event key.

    • Protected

      Parameters

      • type: string | string[]

        Type.

      • listener: (arg0: Event | BaseEvent) => unknown

        Listener.

      Returns EventsKey | EventsKey[]

      Event key.

    • Parameters

      • key: string

        Key name.

      • listener: Listener

        Listener.

      Returns void

    • Parameters

      • type: string

        Type.

      • listener: Listener

        Listener.

      Returns void

    • Renders the control.

      Parameters

      • mapEvent: MapEvent

        Map event.

      Returns void

    • Sets a value.

      Parameters

      • key: string

        Key name.

      • value: any

        Value.

      • Optionalsilent: boolean

        Update without triggering an event.

      Returns void

    • Collapse or display control main container

      Parameters

      • collapsed: boolean

        True to collapse control, False to display it

      Returns void

    • Sets vector layer to hosts feature.

      Parameters

      • vlayer: VectorLayer<VectorSource<any>, any>

        vector layer

      Returns void

    • Sets a collection of key-value pairs. Note that this changes any existing properties and adds new ones (it does not remove any existing properties).

      Parameters

      • values: Partial<NoInfer<Properties>>

        Values.

      • Optionalsilent: boolean

        Update without triggering an event.

      Returns void

    • This function is used to set a target element for the control. It has no effect if it is called after the control has been added to the map (i.e. after setMap is called on the control). If no target is set in the options passed to the control constructor and if setTarget is not called then the control is added to the map's overlay container.

      Parameters

      • target: string | HTMLElement

        Target.

      Returns void

    • Protected

      Unlisten for a certain type of event.

      Parameters

      • type: string | string[]

        Type.

      • listener: (arg0: Event | BaseEvent) => unknown

        Listener.

      Returns void

    • Unsets a property.

      Parameters

      • key: string

        Key name.

      • Optionalsilent: boolean

        Unset without triggering an event.

      Returns void

    ADD_AFTER_DRAWING_LAYER_EVENT: string | undefined

    event triggered after an layer is added

    drawing:add:after

    "drawing:add:after"
    
    Drawing.on("drawing:add:after", function (e) {
    console.log(e.layer);
    })
    ADD_BEFORE_DRAWING_LAYER_EVENT: string | undefined

    event triggered before an layer is added

    drawing:add:before

    "drawing:add:before"
    
    Drawing.on("drawing:add:before", function (e) {
    console.log(e.layer);
    })