Diagram for .NET / User's Guide / Document Object Model / Models / Shapes / Primitive Shapes

In This Topic
    Primitive Shapes
    In This Topic

    Primitive shapes are shapes, which aggregate a single primitive model. All types of primitive shapes derive from the base NPrimitiveShape abstract class. The major purpose of primitive shapes is to expose a single primitive model as a shape, so that it can be interactively edited, connected with other shapes etc.

     Class Hierarchy

    Primitive shapes use the following class hierarchy:

    As you can see the hierarchy of the primitive shapes closely follows the hierarchy of the implemented primitive models.

    As there currently are two major types of primitive models - paths and texts - natively there are also two major types of primitive shapes - primitive path shapes and primitive text shapes.

    Primitive shapes share the following set of common features:

     Single Aggregated Primitive

    All primitive shapes aggregate a single primitive model, which can be obtained from the Primitive property of the NPrimitiveShape class.

    The aggregate primitive influences much of the primitive shape behavior. The following model aspects of a shape are actually inherited from the aggregate primitive model:

    • Logical Line - the entire set of methods and properties related to the logical line of a primitive shape delegate to the primitive model implementation.
    • Contour - the contour of a primitive shape is the contour of the primitive model, which it aggregates.
    • Start and End points - if the primitive shape aggregates a 1D primitive model (such primitive, which has locally modifiable start and end points), the shape will delegate the implementation to it.
     Form Preservation
    In case that the primitive shape aggregates a 1D primitive, you can specify whether the set implementation of the start and end points properties must use the base model implementation (which scales and rotates the model), or delegate the implementation to the primitive. This is specified by the PreserveForm property.

    For example: Suppose that you have a bezier shape and you modify it's start and end points. In case the PreserveForm property is set to false, the second control point and third control point will remain the same - e.g. you will change the form of the bezier curve, because you will actually change the start point of the bezier curve model definition. In case the PreserveForm property is set to true, the bezier shape will get scaled and rotated (e.g transformed). This will not alter the model definition of the bezier curve shape - e.g. the form of the shape will be preserved.
     Text Shapes
    Text shapes are represented by instances of the NTextShape class. Text shapes aggregate a single NTextPrimitive instance. Text shapes help you display wrapped and stretched text. The text display mode is controlled by the Mode property, which naturally delegates the implementation to the contained NTextPrimitive.

    NTextShape
    is the only shape in the DOM, which does not create a default label. This is done because the NTextShape can already display text via it's primitive. The Text property of the NTextShape is hence modifying the text of the contained text primitive, not the default label.

    See Texts for more information.
     Path shapes

    The base class for all primitive shapes, which aggregate a single path primitive is the NPathShape abstract class. The NPathShape class implements the INPoints interface and by default delegate the implementation to the contained path primitive (note that all path primitives implement the INPoints interface).

    The base class for all path shapes, which aggregate a single polypath primitive is the NPolyPathShape abstract class. The NPolyPathShape class implements the INPolyPoints and INSegments interfaces and by default delegate the implementation to the contained poly path primitive (note that all poly path primitives implement these interfaces).

    The following table summarizes the currently available instancable path shapes:

    Path shape class Description Shape type Bridgeable Routable Reflexive
    Simple primitive shapes
    NLineShape Represents a shape, which aggregates a single line path. 1D yes no no
    NBezierCurveShape Represents a shape, which aggregates a single bezier curve path. It has two control points, which modifies the control points of the contained bezier path. 1D no no yes
    NRectanglePath Represents a shape, which aggregates a single rectangle path (actually a quadrangle) 2D no no no
    NEllipsePath Represents a shape, which aggregates a single ellipse path 2D no no no
    NCircularArcShape Represents a shape, which aggregates a single circular arc path. It has one control point, which modifies the control point of the contained circular arc. 1D no no no
    NEllipticalArcShape Represents a shape, which aggregates a single elliptical arc path.It has one control point, which modifies the control point of the contained elliptical arc. 1D no no no
    NArrowShape Represents a shape, which aggregates a single arrow path. 1D no no no
    NCurveShape Represents a shape, which aggregates a single curve path. 1D no no yes
    NPolylineShape Represents a shape, which aggregates a single polyline path. 1D yes no yes
    NClosedCurveShape Represents a shape, which aggregates a single closed curve path. 2D no no no
    NPolygonShape Represents a shape, which aggregates a single polygon path. 2D no no no
    More sophisticated shapes
    NStep2Connector Represents a connector, which connects its start and end points in two orthogonal steps (L-shaped connector). The first step can either be vertical or horizontal, that is why it is often called HV or VH connector. Aggregates a single NHVPolylinePath primitive. 1D yes no no
    NStep3Connector Represents a connector, which connects its start and end points in three orthogonal steps. The first step can either be vertical or horizontal, that is why it is often called HVH or VHV connector. Aggregates a single NHVPolylinePath primitive. It has one control point, which modifies the middle segment position. 1D yes no no
    NRoutableConnector Represents a connector, which can automatically avoid obstacles in its path. It can mutate (change the type of the aggregated path). The type of the aggregated path determines the type of routing the connector uses - Mesh or Grid. 1D yes yes yes
     Related Examples
    Windows Forms: Document Object Model - Shapes - Primitive 2D Shapes
    Windows Forms: Document Object Model - Shapes - Primitive 1D Shapes
    Windows Forms: Document Object Model - Shapes - Text Shape
    Windows Forms: Document Object Model - Shapes - Step and Arrow Connectors
    See Also