Creating a Basic Edit Configuration
Table of Contents
Creating a Default Edit Configuration
A default edit configuration is one that directly interrogates the spatial table associated with an entity (via a mapper) for the information it requires, i.e., the attributes associated with the entity and what spatial geometries, point, line or polygon, the user is allowed to create.
The public.graffiti
table used in this section is defined in Database Objects.
The graffiti
entity and m.graffiti
spatial mapper are defined in Weave Configuration.
The following default.edit
config element shows how to implement a basic edit configuration for our entity.
<?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="default.edit">
<entity>graffiti</entity>
<label>Graffiti (default)</label>
<publish>true</publish>
<description>Report graffiti for removal</description>
</edit:config>
</config>
This default edit configuration allows all attributes attached to the entity’s underlying spatial table to be edited. How the user will be able to edit those attributes will be determined by the underlying column type in the underlying spatial table. The editing is limited to simple types such as text fields for string and numbers, a calendar field for dates.
Setting the edit configuration publish
setting to false
will stop the edit from appearing in the list of edit configurations 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 do not have their edits listed in standard editing clients (see Starting Editing From a URL)
Viewing or Accessing an Edit Configuration
Edit configurations for an entity, such as default.edit
, are accessed (or viewed) in a Weave client through use of the <view id="com.cohga.client.panel.edit">
client component.
This view panel provides the actions required to initiate editing, the tools required to perform the spatial edit operations, and the ability for a user to enter/change the attributes associated with the entity being edited.
This view is added to a client configuration as follows:
<?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">
...
<perspective>
...
<!-- Add TOC View Panel to the client -->
<view id="com.cohga.html.client.map.tocView">
<label>Layers</label>
<location>west</location>
<contextmenu>
<item action="weave.toc.zoomToLayer"/>
<item action="weave.toc.selectLayer"/>
<item action="weave.toc.clearSelection"/>
</contextmenu>
</view>
<!-- Add the Edit panel to the client -->
<view id="com.cohga.client.panel.edit">
<label>Edit</label>
<location>west</location>
</view>
...
</perspective>
...
</client:config>
</config>
The edit panel, displaying the “Graffiti (default)” edit configuration, looks like this.
The following table describes these buttons in detail.
Icon | Tool Tip | Description |
---|---|---|
| Create a new entity | Creates a new entity. |
| Edit the selected entity | Changes the currently selected entity. |
| Delete the selected entity | Removes the currently selected entity. |
| Reset the form fields | Resets the form fields back to their original values. |
| Submit changes. | Completes the edit process and saves the current changes. |
| Cancel changes. | Aborts the edit process and abandons the current changes. |
Modify | Modifies an existing entity geometry.
| |
| Point | Will be disabled if the entity doesn't support a point geometry or if it only supports a single point and there already is a point attached to the entity. |
| Line | Will be disabled if the entity doesn't support a line geometry or if it only supports a single line and there already is a line attached to the entity. |
| Rectangle | In some versions of Weave a rectangle tool may exist. |
| Polygon | Will be disabled if the entity doesn't support a polygon geometry or if it only supports a single polygon and there already is a polygon attached to the entity. |
Remove | 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. | |
Import | The entity must firstly be selected from the other entity/Active Layer. This tool can be used to import an entity’s geometry and/or attributes from another entity. | |
Upload | Will be disabled if editing is not in progress. This tool can be used to load spatial data from a supported spatial file format. | |
Create | Will be disabled if editing is not in progress. This tool can be used to define an entity’s geometry from one or more coordinate pairs in a variety of formats. | |
Update | Is enabled when an Update feature action is in progress. This tool can be used to modify an entity’s geometry by editing the list of coordinate pairs that make up the entity’s point, line or polygon geometry. | |
Snapping | Toggles the snapping function on and off. | |
Snap Settings | Changes the snap settings. |