Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 15 Next »



This page is a work in progress for an as yet unreleased editing extension

The spatial editing extension for Weave provides a means to edit geometry and attributes for an entity.

Features:

  • Simple to setup for basic operation
  • Customisable for advanced operation
  • Supports transparent editing on an entity with multiple spatial layers
  • Can be initiated from URL parameters

Limitations:

  • Spatial mapper for entity must have <dynamic> set to true and <cache> set to false
  • But this is generally the case for any entity that can have it's underlying data altered on the fly

Installation

Currently the Weave editing sub-system is provided as a single bundle, com.cohga.spatial.edit, but this may change before release.

This bundle must be copied to the weave\platform\plugins directory and the server restarted for it to be available.

Configuration

Client Edit Plugin

Part of the client side editing sub-system is implemented as a 'plugin' for the map view, so the first thing that needs to be done when enabling the editing sub-system is to register the edit plugin with the map view in the client configuration.

Adding edit plugin to client
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns="urn:com.cohga.server.config#1.0" xmlns:client="urn:com.cohga.html.client#1.0">

  <client:config id="edit">
    <!-- more config items here -->

    <view id="com.cohga.html.client.map.mapView">
      <label>Map</label>
      <location>center</location>

      <plugin id="weave.edit"/> <!-- Register the edit plugin with the map view -->

      <!-- map config items here -->
    </view>

    <!-- more config items here -->
  </client:config>

</config>

The provides the edit sub-system with a hook into the map view so that it can provide access to the editing layer.

Client Edit View

When performing an edit a view panel is required to enter/change the attributes associated with the entity being edited. This view is provided by the com.cohga.client.panel.edit view and so also needs to be added to the client configuration.

Adding edit view to client
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns="urn:com.cohga.server.config#1.0" xmlns:client="urn:com.cohga.html.client#1.0">

  <client:config id="edit">
    <!-- more config items here -->

    <view id="com.cohga.client.panel.edit"> <!-- Add the Edit panel to the client -->
      <label>Edit</label>
      <location>west</location>
    </view>

    <view id="com.cohga.html.client.map.mapView">
      <label>Map</label>
      <location>center</location>

      <plugin id="weave.edit"/> <!-- Register the edit plugin with the map view -->

      <!-- more config items here -->
    </view>

    <!-- more config items here -->
  </client:config>

</config>

This view also provides the actions required to initiate editing and the tools required to perform the spatial edit operations.

Client panel buttons

name

description

Create

Insert a new entity.
Will be disabled if editing is in progress.

Update

Change the currently selected entity.
Will be disabled if no entity is selected or if there is more than one entity selected or editing is in progress.

Delete

Remove the currently selected entity.
Will be disabled if no entity is selected or if there is more than one entity selected or editing is in progress.

Reset

Reset the form fields back to their original values.
Will be disabled if editing is not in progress.

Submit

Complete the edit process and save the current changes.
Will be disabled when editing isn't in process or if the current state isn't value, for example if a polygon geometry is required but hasn't been added yet.

Cancel

Abort the edit process and abandon the current changes.
Will be disabled when editing isn't in process.

Modify

Modify an existing geometry.
Will be disabled if there is no geometry attached to the entity.

Point

Create a new point.
Will be disabled if the entity doesn't support point geometry or if it only supports a single point and there already is a point attached to the entity.

Line

Create a new line.
Will be disabled if the entity doesn't support line geometry or if it only supports a single point and there already is a line attached to the entity.

Polygon

Create a new polygon.
Will be disabled if the entity doesn't support polygon geometry or if it only supports a single polygon and there already is a polygon attached to the entity.

Remove

Remove the currently selected geometry.
Will be disabled if there is no geometry enabled or if the entity requires some geometry and this is the last piece of geometry related to the entity.

Snap

Toggle the snapping function on and off.

Settings

Changes the snapping settings.

Customising the client edit view

There are a number of customisation options available to alter the display of the edit view

name

type

default

description

enableCreate

boolean

true

Should the 'Create' button be displayed

enableUpdate

boolean

true

Should the 'Update' button be displayed

enableDelete

boolean

true

Should the 'Delete' button be displayed

enableModify

boolean

true

Should the 'Modify' button be displayed

enablePoint

boolean

true

Should the 'Point' button be displayed

enableLine

boolean

true

Should the 'Line' button be displayed

enablePolygon

boolean

true

Should the 'Polygon' button be displayed

enableRemove

boolean

true

Should the 'Remove' button be displayed

enableSnap

boolean

true

Should the 'Snapping' button be displayed

enableSettings

boolean

true

Should the 'Settings' button be displayed

showText

boolean

true

Should the text labels appear in the buttons

showIcons

boolean

true

Should the icons appear in the buttons

embedButtons

boolean

false

Should the 'Submit' and 'Cancel' buttons be embedded in the form (or remain in the toolbar)

Edit View with embedButtons set to true and showText set to false

Server Edit Configuration

Before an entity can be edited it must have at least one edit configuration associated with it. The edit configuration enables editing for the particular entity and also allows for overriding the details about the way the user can edit the entity, for example what attributes the user can edit, how the attributes are presented to the user, etc.

You can have multiple edits associated with each entity, the user will be able to choose which edit to perform by selecting from a list.

Basic Server Edit Configuration

The most basic edit configuration interrogates the underlying spatial tables for the information it requires, for example to determine what attributes the entity has associated with it or what spatial geometries (point, line or polygon) the user is allowed to create.

Simple edit configuration example
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns="urn:com.cohga.server.config#1.0" xmlns:edit="urn:com.cohga.spatial.edit#1.0">

  <edit:config id="simple.edit">
    <entity>graffiti</entity>
    <label>Graffiti</label>
    <description>Report graffiti for removal</description>
  </edit:config>

</config>

This provides a simple way to setup editing for an entity, allowing the user to directly edit the attributes attached to the entity in the underlying spatial table.

The edit configuration has a publish setting, which when set to false will stop the edit from appearing in the list of edits available for an entity. The edit will still be available but can only be initiated via code or a URL parameter, this provides for the creation of custom editing clients that don't have their edits listed in standard editing clients.

Default editing attributes

The basic edit configuration offers no options to customise what attributes are available for editing, they all are, or how the user will be able to edit those values, which will be determined by the underlying column type in the spatial table and be limited to simple field types (text fields for string and numbers, calendar field for dates, etc).

Default geometry requirements

What types of geometry the user will be able to create/edit will also be determined by the underlying spatial table, if the spatial table contains polygons then the user will only be able to create polygons, they will not be able to create points or lines. If however the entity is linked to two spatial tables, one containing polygons and the other containing points then the user will be able to edit points and polygons.

Further there is differentiation between spatial layers that contain single instance geometry and those that contain multi-instance geometry, that is if the spatial table contains multipolygons, as opposed to just polygons, then the user will be allowed to create more than one polygon shape when editing the entity, when the spatial table contains polygons the user will be limited to a single polygon object. The same applies to points/multipoints and line/multilines.

Creating polygons with holes is currently not supported.

Finally the requirement for the user to actually create geometry is also determined by the underlying spatial table, if the spatial table allows nil geometry then the user will not be forced to create a geometry when creating a new entity, if the spatial table doesn't allow nil geometries then the user will be required to create a geometry before they'll be able to complete the edit.

Customising Server Edit Configuration

If you need more control over the attributes and geometry for an edit then you need to override the values that the simple form is generating.

The things that you can override are the supported geometry types, the required geometry types and the parameters that the user can edit.

Basic custom edit configuration example
<?xml version="1.0" encoding="UTF-8"?>

<config xmlns="urn:com.cohga.server.config#1.0" xmlns:edit="urn:com.cohga.spatial.edit#1.0">

  <edit:config id="custom.edit">
    <entity>graffiti</entity>
    <label>Grafitti</label>
    <description>Report graffiti for removal</description>
    <supportedGeometry>point</supportedGeometry>
    <requiredGeometry>point</requiredGeometry>
    <parameter id="description">
      <promptText>Description</promptText>
      <controlType>text-area</controlType>
      <column>DESCRIPTION</column>
    </parameter>
  </edit:config>

</config>

Custom geometry requirements

Unless explicitly set the types of geometry that a user can create for an entity, and also if the user can create an entity with no geometry, is defined by the underlying spatial tables, if you wish to override this then you do so with the supportedGeometry and requiredGeometry settings.

Both supportedGeometry and requiredGeometry can be listed multiple times if more that one geometry type is supported/required, and the possible values for both of these are:

  • point
  • multipoint
  • linestring
  • multilinestring
  • polygon
  • multipolygon

Specifying the single part and multi part options of the same geometry type is treated the same as just specifying the multi part option. That is <requireGeometry>polygon</requireGeometry> and <requireGeometry>multipolygon</requireGeometry> is the same as just <requireGeometry>multipolygon</requireGeometry>

Some examples of why you would want to set these values are (these assume that you can't change the underlying spatial table):

  • Spatial table allows nil geometry but you wish to enforce geometry creation
    • Add <requireGeometry>geometryType</requireGeometry> where geometryType matches the underlying spatial table
  • Spatial table allows multi part geometry but you wish to enforce creation of single part geometry
    • Add <supportGeometry>geometryType</supportGeometry> where geometryType matches the underlying spatial table
  • The spatial engine supports multiple geometry types in a single table, for example Oracle Spatial, and you wish to limit the geometry
    • Add <supportedGeometry>geometryType</supportedGeometry> to limit the available geometry types, otherwise options all will be available
Custom attributes

If the default attribute editing setup isn't suitable you can directly specify the attributes that the user can edit and how they appear to the user, by doing this you'll completely replace the attributes that the Weave automatically generated from the underlying spatial tables.

This is done by adding one or more parameter items to the edit configuration, where each parameter specified one input parameter. The format of the parameter items in an edit config are an extension of those available for search parameters.

  • No labels