<< Click to Display Table of Contents >> NShape Concepts
|
Each shape has a set of control points, which are used to manipulate the shape. In most cases the user drags a control point with the mouse to modify the size or the form of the shape. These control points are called resize points. Other control points, the rotation points, can be used to rotate the shape around them. Some control points are glue points, which means they can be glued to a connection point of another shape. Of course, the connection point of the other shape is also a control point.
Every control point has an id, which is a number above zero. The id of a given control point never changes and as a consequence thereof, it is not guaranteed, that the sequence of control point ids is continuous. A line without intermediate points has a start point with id 1 and an end point with id 2. When an intermediate bending point is added, it receives the id 3, the next one the id 4 etc. When the first bending point from a line with four control points is remove, the remaining control points have the ids 1, 2 and 4. The ids must not change because other shapes may refer to them and these other shapes might even not be loaded and only live in the repository (the database).
You can determine the capabilities of a control point through the HasPointAttribute method. The attribute has flags for resize, rotate, connect and glue, which can be set or cleared independently. These attributes are defined on the template level and be modified with the shape template editor.
On the display, control points are marked with small circles around them when the shape is selected. When the user is dragging a glue point near the shape, the connection points are drawn in red to visualize their capability to connect with the glue point.
Sometimes we also talk about the reference point of a shape. The reference point is defined by the x and y coordinate of the shape and is not a control point in the proper meaning of the term. It is e.g. not enumerated by the GetControlPointIds method and is not marked with a circle. Nevertheless it has its own special control point id, which is defined by the ControlPointId.Reference constant.
With this special id you can call many of the control point id related functions for the reference point. When it is used in the MoveTo or MoveBy functions, the whole shape is moved and when used in the Connect or ConnectTo function, the whole shape is connected (see Connections).
Linear shapes have two special control points: The first and the last vertex. Each line consists of at least these two points. all other points can be added (until ILinearShape.MaxVertexCount is reached) or removed. The first vertex of a linear shape is addressed with ControlPointId.FirstVertex and the last vertex is addressed with ControlPointId.LastVertex.