NShape Concepts
Shapes

<< Click to Display Table of Contents >>

Navigation:  Concepts >

NShape Concepts
Shapes

Previous pageReturn to chapter overviewNext page

NShape is all about shapes. Diagrams consist of shapes, the user creates and manipulates shapes etc. The basic responsibilities of shapes are:

Shapes have a position and can draw themselves into a graphics context.

Shapes have control points that allow the client application to manipulate them (see Control Points).

Shapes can connect to other shapes via glue points and connection points (see Connections).

Shapes have a shape type that defines their conceptual data model and provides the factory methods (see below).

Shapes refer to a shape template that determines their default appearance and behavior (see Templates).

Shapes are able to save themselves to and load themselves from a repository (see Persistency).

The programming interface for shapes is IShape. It provides all the necessary functions to work with the above functionality.

NShape differs between two kinds of shapes, lines and area shapes. Lines are one-dimensional and have a varying number of defining points, because bending points can be added or removed dynamically. Area shapes in contrast are two-dimensional and can be rotated. All shapes in NShape must implement the ILinearShape or the IPlanarShape interface.

Shape Types

Each shape must have an attached shape type. The shape type is a separate object of class ShapeType. It defines a type name for the shape and provides methods to create shapes of that type. Shape objects of the same class must not necessarily all have the same shape type. The class is an internal aspect, while the shape type can be seen by the user. In an UML application for example, the shapes for classes and the shapes for interfaces might have the same internal shape class. However, they can be presented as different types in the user interface.

The shape type also publishes meta information about its properties in the conceptual data model. This is required for some repository implementations (e.g. the XML repository) to create correct physical stores.

Implementing a Shape Class

When implementing a shape class, developers can but need not derive from the Shape base class. "Developing a New Shape Class" explains this aspect in detail.

See Also

Class Reference: Shape Class

Class Reference: ShapeBase Class

Class Reference: ILinearShape Interface

Class Reference: IPlanarShape Interface

Class Reference: ICaptionedShape Interface