HSLayers.Popup (class)

HSLayers.Popup

class HSLayers.Popup(options)

Modified Popup, with several custom buttons (links)

param Object options:
 configuration object for this popup,
param String options.id:
 
param OpenLayers.LonLat options.lonlat:
 OpenLayers.LonLat coordinates
param OpenLayers.Size options.contentSize:
 
param String|Function options.contentHTML:
 if contentHTML is a function, it will get feature (see options.feature) as parameter
param Object options.anchor:
 object to which we’ll anchor the popup. Must expose a ‘size’ (OpenLayers.Size) and ‘offset’ (OpenLayers.Pixel) (Note that this is generally an OpenLayers.Icon).
param Boolean options.closeBox:
 
param Function options.closeBoxCallback:
 Function to be called on closeBox click.
param [Object] options.menu:
 menu configuration, see Popup.menu
param Object options.moreInfo:
 URL with more informations
param String options.title:
 title of the popup
param OpenLayers.Feature options.feature:
 OpenLayers.Feature for the popup

Example usage:

var popup = new HSLayers.Popup({
        lonlat: new OpenLayers.LonLat(15,50),
        size: new OpenLayers.Size(230,150),
        feature: feature, // vector feature
        title: "My popup title",
        moreInfo: function(feature){
          return "http://foo/bar?feature="+feature.id
        },
        contentHTML: "the looong string",
        anchor: null,
        closeBox: true
    });

    map.addPopup(popup);

Properties

OpenLayers.Strategy.Cluster

or as a function returning a string. This is used to store it, if the string is used.

Finally, create “More info...” link.

together with titleDiv and menuDiv. Created by createInnerContentDiv() and filled in setContentHTML() with contentHTML.

  • HSLayers.Popup.menu - Menu, array of objects with following parameters:
  • {String} title item title
  • {String} className custom class name
  • {Function} callback function which is called on click event
  • HSLayers.Popup.menuDiv - Menu div, placed in the contentDiv.

It bears the menu including the “More info...” link

Created by createTitleDiv(), filled in with title.

HSLayers.Popup.clusterIdx

HSLayers.Popup

clusterIdx index of the cluster, used by OpenLayers.Strategy.Cluster

HSLayers.Popup.contentDisplayClass

HSLayers.Popup

content display class

HSLayers.Popup.contentHTMLData

HSLayers.Popup

options.contentHTML can be given either as a string or as a function returning a string. This is used to store it, if the string is used.

HSLayers.Popup.createMenuDiv

HSLayers.Popup

Create menu div, place it in the content div and create the menu. Finally, create “More info...” link.

HSLayers.Popup.innerContentDiv

HSLayers.Popup

Inner content div, placed in the contentDiv together with titleDiv and menuDiv. Created by createInnerContentDiv() and filled in setContentHTML() with contentHTML.

HSLayers.Popup.menu

HSLayers.Popup

Menu, array of objects with following parameters:

  • {String} title item title * {String} className custom class name * {Function} callback function which is called on click event

Example usage:

menu : [{title: "foo",callback:function(){}}, {title:"bar",...}]
HSLayers.Popup.menuDiv

HSLayers.Popup

Menu div, placed in the contentDiv. It bears the menu including the “More info...” link

HSLayers.Popup.menuHeight

HSLayers.Popup

Height of the menuDiv

HSLayers.Popup.minimizeBox

HSLayers.Popup

minimizeBox

HSLayers.Popup.moreInfo

HSLayers.Popup

“More info...” link

HSLayers.Popup.size

HSLayers.Popup

Size

HSLayers.Popup.sizes
Type :[{OpenLayers.Size}] (static)

HSLayers.Popup

Sizes

HSLayers.Popup.target

HSLayers.Popup

Target for More info

HSLayers.Popup.title

HSLayers.Popup

Title

HSLayers.Popup.titleDiv

HSLayers.Popup

Title div, placed in the content div. Created by createTitleDiv(), filled in with title.

HSLayers.Popup.titleHeight

HSLayers.Popup

Height of the titleDiv

Methods

titleDiv, innerContentDiv and menuDiv are created, filled in and placed into the contentDiv.

If title is not set, no action is taken.

The content can be given either as a string or as a function returning the string. If the function is given, we call it. Then the contentHTML is set and setContentHTML() is called to update the innerContentDiv.

In HS Popup we put several divs in the contentDiv (title, inner content and menu), so by default this sets the innerHTML of the innerContentDiv. To overwrite the content of the whole contentDiv, set overwriteWholeContent to true.

HSLayers.Popup.draw()

Call this.redraw() and then draw() method of the ancestor.

HSLayers.Popup.redraw()
Clean and fill the contentDiv.

titleDiv, innerContentDiv and menuDiv are created, filled in and placed into the contentDiv.

HSLayers.Popup.createTitleDiv()
Create and fill in the titleDiv and place it in the content div.

If title is not set, no action is taken.

HSLayers.Popup.createInnerContentDiv(feature)

Create and fill the innerContentDiv and place it in the contentDiv.

Arguments:
  • feature (OpenLayers.Feature.Vector) –
HSLayers.Popup.makeContent(feature)
Make content and update the innerContentDiv.

The content can be given either as a string or as a function returning the string. If the function is given, we call it. Then the contentHTML is set and setContentHTML() is called to update the innerContentDiv.

param OpenLayers.Feature.Vector feature:
 
HSLayers.Popup.setContentHTML(contentHTML, overwriteWholeContent)
Set contentHTML (if provided) and fill innerContentDiv or contentDiv.

In HS Popup we put several divs in the contentDiv (title, inner content and menu), so by default this sets the innerHTML of the innerContentDiv. To overwrite the content of the whole contentDiv, set overwriteWholeContent to true.

param String contentHTML:
 
param Boolean overwriteWholeContent:
 
HSLayers.Popup.createMenuItems(feature, {Object}, menuList)

Create ordinary menu items

param OpenLayers.Feature.Vector feature:
 
param {Object}:
 items list of menu items which will be displayed in the

bottom menu

Optional
param HTMLDom menuList:
 
HSLayers.Popup.createInfoDiv(feature, menuList)

Create “More info...” link

Arguments:
  • feature (OpenLayers.Feature.Vector) –
  • menuList (HTMLDom) –

Main Menu


Table Of Contents

Previous topic

HSLayers.Permalink (class)

Next topic

HSLayers.Popup.initialize (class)

This Page