Framework / Presentation Layer / Smart Shapes / Shape Sheet / Transform Section

In This Topic
    Transform Section
    In This Topic

    The transform section defines the shape transformation to its parent coordinate system. It is a mandatory section and is represented by the NTransformSection class, an instance of which can be obtained from the TransformSection property. The following code example changes the width and height of a smart shape.

    C#
    Copy Code
    sheet.TransformSection.Width.Value = 100;
    sheet.TransformSection.Height.Value = 200;
    
    Visual Basic
    Copy Code
    sheet.TransformSection.Width.Value = 100
    sheet.TransformSection.Height.Value = 200
    

    The transform section contains the following set of named cells:

    Cell Name Cell Type Description Notes
    Width Single Controls the width of the shape local coordinate system. Accessible from the Width property.

    For a 1D shape it is typically expressed with a formula, which represents the distance between start and end points:
    SQRT((EndX-StartX)^2+(EndY-StartY)^2)
    For a 2D shape it is usually a constant

    Height Single Controls the height of the shape local coordinate system. Accessible from the Height property. Usually a constant
    Angle Single Controls the rotation of the shape local coordinate system relative to the parent coordinate system. Accessible from the Angle property.

    For a 1D shape it is typically expressed with a formula, which represents the angle between the start and end points:
    ATAN2(EndY-StartY,EndX-StartX)
    For a 2D shape it is usually a constant

    PinX Single Defines the X coordinate of the pin point (in the parent coordinate system). Accessible from the PinX property.

    For a 1D shape it is typically expressed with a formula, which represents the X middle between start and end points:
    (StartX+EndX)/2
    For a 2D shape it is usually a constant

    PinY Single Defines the Y coordinate of the pin point (in the parent coordinate system). Accessible from the PinY property.

    For a 1D shape it is typically expressed with a formula, which represents the Y middle between start and end points:
    (StartY+EndY)/2
    For a 2D shape it is usually a constant

    LocPinY Single Defines the X coordinate of the pin point in the local coordinate system. Accessible from the LocPinX property. Typically expressed with a formula, which represents half the width:
    Width*0.5
    LocPinX Single Defines the Y coordinate of the pin point in the local coordinate system. Accessible from the LocPinY property. Typically expressed with a formula, which represents half the height:
    Height*0.5
    FlipX Boolean Specifies whether the local coordinate system is horizontally flipped relative to the parent coordinate system. Accessible from the FlipX property. By default set to the false constant
    FlipY Boolean Specifies whether the local coordinate system is vertically flipped relative to the parent coordinate system. Accessible from the FlipY property. By default set to the false constant

    The transform section defines an orthogonal transformation (a transformation, which preserves the orthogonality of transformed vectors). An orthogonal transformation can only be a combination of flip, rotate and translate operations - scaling is not allowed. The orthogonal transformation represented by the section is a matrix, which can be obtained from the Transform property.

    To achieve scaling, all shape sheet content, which needs to be scaled along the the X or Y axes is represented with a formula in which the Width and Height cells are directly or indirectly referenced. For example the following code fills the local coordinate system with 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")
    
    See Also