Nevron .NET Vision
Framework / Presentation Layer / Smart Shapes / Shape Sheet / Geometry Section

In This Topic
    Geometry Section
    In This Topic

    The geometry section is used for the definition of a single graphics path in the shape local coordinate system. It is represented by an instance of the NGeometrySection class. There can be multiple instance of this type of section in the sheet, hence smart shapes can be used to display several graphics paths.

    The current set of geometry sections is obtained from the GeometrySections property of the NShapeSheet class. You create new geometry sections by adding new instances of the NGeometrySection class to the Sections collection of the shape sheet. The following example adds a new geometry section, which draws a rectangle:

    C#
    Copy Code
    // create a new geometry, which draws a rectangle
    NGeometrySection geometry1 = new NGeometrySection("Geometry1", "Geometry1");
    sheet.Sections.Add(geometry1);
    geometry1.AddMoveTo("Width*0", "Height*0");
    geometry1.AddLineTo("Width*1", "Height*0");
    geometry1.AddLineTo("Width*1", "Height*1");
    geometry1.AddLineTo("Width*0", "Height*1");
    geometry1.AddLineTo("Width*0", "Height*0");
    
    Visual Basic
    Copy Code
    ' create a new geometry, which draws a rectangle
    Dim geometry1 As New NGeometrySection("Geometry1", "Geometry1")
    sheet.Sections.Add(geometry1)
    geometry1.AddMoveTo("Width*0", "Height*0")
    geometry1.AddLineTo("Width*1", "Height*0")
    geometry1.AddLineTo("Width*1", "Height*1")
    geometry1.AddLineTo("Width*0", "Height*1")
    geometry1.AddLineTo("Width*0", "Height*0")
    
     Named Cells

    The geometry section contains the following set of named cells:

    Cell Name Cell Type Description Notes
    Visible Boolean Controls the visibility of the graphics path defined by the section. Accessible from the Visible property.

    By default set to true

    CloseFigures Boolean Specifies whether the figures defined by the geometry section must be closed. Accessible from the CloseFigures property.

    By default set to true

     Path Command Rows

    The Rows collection of the geometry section is used to store path command rows. All types of path commands rows derive from the base NPathCommandRow abstract class. You define the geometry by chaining path commands of different type (e.g. MoveTo, LineTo, BezierCurveTo etc.).

    Common for all path commands is that they define a single vertex. The location of this vertex (its X and Y coordinates) are defined by the first two cells in each path command row. These cells are accessible from the X and Y properties of the NPathCommandRow class.

    Each path command draws a primitive from the previous path command vertex to the vertex defined by itself. The only exception is the MoveTo command, which should be the first command in each geometry section. It marks the beginning of a new figure.

    More complex path commands require additional parameters (for example: the bezier curve requires two control points, the circular arc needs a single control point etc.). Currently path commands do not require more than 4 additional parameters. In the geometry section their column names are A, B, C and D.

    The following table describes the currently provided set of path command rows:

    Path Command Description Cells
    X Y A B C D
    NMoveToRow Starts a new figure X coordinate of this vertex. Accessible from the X property. Y coordinate of this vertex. Accessible from the Y property.
    NLineToRow Draws a line from prev vertex to this vertex X coordinate of this vertex. Accessible from the X property. Y coordinate of this vertex. Accessible from the Y property.
    NBezierCurveToRow Draws a bezier curve, defined by 4 points. (prev vertex, 2 control points, this vertex) X coordinate of this vertex. Accessible from the X property. Y coordinate of this vertex. Accessible from the Y property. X coordinate of the first control point. Accessible from the FirstControlX property. Y coordinate of the first control point. Accessible from the FirstControlY property. X coordinate of the second control point. Accessible from the SecondControlX property. Y coordinate of the second control point. Accessible from the SecondControlY property. 
    NArcToRow Draws a bowed arc from prev vertex to this vertex. The bow is the distance from the arc's midpoint to the midpoint of its chord. X coordinate of this vertex. Accessible from the X property. Y coordinate of this vertex. Accessible from the Y property. Distance from the arc's midpoint to the midpoint of its chord. Accessible from the Bow property.
    NCircularArcToRow Draws a circular arc, defined by 3 points. (prev vertex, control point, this vertex)  X coordinate of this vertex. Accessible from the X property. Y coordinate of this vertex. Accessible from the Y property. X coordinate of the control point. Accessible from the ControlX property. Y coordinate of the control point. Accessible from the ControlY property.
    NEllipticalArcToRow Draws an elliptical arc defined by 3 points, angle of the ellipse major axis and ratio between the major and minor ellipse axes. X coordinate of this vertex. Accessible from the X property. Y coordinate of this vertex. Accessible from the Y property. X coordinate of the control point. Accessible from the ControlX property. Y coordinate of the control point. Accessible from the ControlY property. Angle between the major ellipse axis and the X axis. Accessible from the Angle property. Ration between the major and minor ellipse axes. Accessible from the Ratio property.

    The NGeometrySection class provides helper methods, which let you easily add an instance of the respective path command in Rows collection. For example: AddMoveTo, AddLineTo, AddBezierCurveTo etc.

    See Also