canvas::edit::quadrilateral(3tk) | Variations on a canvas | canvas::edit::quadrilateral(3tk) |
canvas::edit::quadrilateral - Editing a quadrilateral on a canvas
package require Tcl 8.5
package require Tk 8.5
package require canvas::edit::points ?0.1?
package require canvas::edit::quadrilateral ?0.1?
::canvas::edit quadrilateral objectName canvas options...
objectName destroy
objectName enable
objectName disable
objectName active
objectName add x y
objectName clear
createCmd canvas x y
highlightCmd on canvas item
highlightCmd off canvas state
dataCmd editorObj coordinates
This package provides a class whose instances handle the editing of a quadrilateral on a canvas. Instances can be configured with regard to the visual appearance (regular, and highlighted) of vertex markers. Note that instances do not store the edited quadrilateral themselves, but delegate this to a configurable object.
The result of the command is the fully qualified name of the instance command.
The options accepted here, and their values, are explained in the section Options.
Instances of the quadrilateral editors provide the following API:
Note that this operation does not destroy the items the editor managed on the attached canvas, nor the canvas itself.
The result of the method is an empty string.
The result of the method is an empty string.
The complementary method is disable. The interogatory method for the current state is active.
The result of the method is an empty string.
The complementary method is enable. The interogatory method for the current state is active.
The result of the method is a boolean value, true if the editor is active, and false otherwise, i.e. disabled.
The methods to change the state are enable and disable.
The result of the method is an empty string.
Note that this method goes through the whole set of callbacks invoked when the user interactively creates a vertex, i.e. -create-cmd, and, more importantly, -data-cmd.
This is the method through which to load the vertices of a pre-existing quadrilateral into an editor instance.
Note that at most 4 vertices can be specified, and at least 4 must be specified for the quadrilateral to be complete.
The result of the method is an empty string.
Note that this method goes through the same callback invoked when the user interactively removes a vertex, i.e. -data-cmd.
The class command accepts the following options
This option can only be set at construction time.
If not specified it defaults to false, i.e. acceptance of any quadrilateral.
This option can only be set at construction time.
If not specified it defaults to QUADRILATERAL
This option can only be set at construction time.
If not specified it defaults to a command which will create a black-bordered blue circle of radius 3 centered on the location of the new point.
The signature of this command prefix is
This option can only be set at construction time.
If not specified it defaults to a command which will re-color the item to highlight in red (and restores the color for unhighlighting).
The two signatures of this command prefix are
This method of the command prefix has to perform whatever is needed to highlight the vertex the item is a part of (remember the note above about quadrilateral allowed to be constructed from multiple canvas items).
The result of the command can be anything and will be passed as is as argument state to the off method.
This method is invoked to unhighlight a vertex described by the state, which is the unchanged result of the on method of the command prefix. The result of this method is ignored.
Note any interaction between dragging and highlighting of quadrilateral is handled within the editor, and that the callback bears no responsibility for doing such.
This option can only be set at construction time.
If not specified it defaults to an empty string and is ignored by the editor, i.e. not invoked.
The signatures of this command prefix are
The editorObj identifies the instance invoking the callback, whereas coordinates is a list of vertex locations, with each location a pair of x- and y-coordinates.
The result of this method is ignored.
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category canvas of the Tklib Trackers [http://core.tcl.tk/tklib/reportlist]. Please also report any ideas for enhancements you may have for either package and/or documentation.
canvas, concave, convex, editing, non-convex, quadrilateral
0.1 | canvas |