gws.plugin.dimension

Dimension tool.

Client tool for drawing dimension lines on the map. While drawing, the pointer snaps to the vertices of the features of the layers given by layerUids, within pixelTolerance screen pixels. Dimensions are listed in a sidebar, where they can be labeled and deleted, and are printed with the map. If a storage is configured, they can be saved on the server and loaded again.

This module contains the dimension action. It passes the snapping settings and the storage settings to the client and implements the API command dimensionStorage, which reads and writes saved dimensions. The client part (Sidebar.Dimension, Toolbar.Dimension) is in js.

Example:

actions+ {
    type "dimension"
    layerUids ["my_wfs_layer"]
    pixelTolerance 10
    storage {
        permissions {
            read "allow all"
            write "allow all"
            create "allow all"
        }
    }
}

client.addElements+ { tag "Sidebar.Dimension" }
client.addElements+ { tag "Toolbar.Dimension" }

Source code: gws.plugin.dimension

Package Contents

class gws.plugin.dimension.Config

Bases: gws.base.action.Config

Tool for drawing dimensions on the map.

layerUids: list[str] | None

UIDs of layers to snap to.

pixelTolerance: int = 10

Snapping distance in screen pixels.

storage: gws.base.storage.Config | None

Storage for saved dimensions.

class gws.plugin.dimension.Object

Bases: gws.base.action.Object

Dimension action.

storage: gws.base.storage.Object | None

Storage for saved dimensions, or None if not configured.

configure()
handle_storage(req: gws.WebRequester, p: gws.base.storage.Request) → gws.base.storage.Response

Read or write saved dimensions.

props(user)
class gws.plugin.dimension.Props

Bases: gws.base.action.Props

layerUids: list[str] | None
pixelTolerance: int
storage: gws.base.storage.Props