Linked ports

Use the linked port classes shown in Figure 239 to concatenate information to the graphic state in another drawing port.

TLinkedGrafPort has a Get function that returns the graphic state information described under the heading "Graphic state" on page 360.


The linked port classes make a semantic copy of the parent port. You make changes to the copy through the constructor of the linked port you are using. For example, the TLinkedModelMatrixPort class is used when a graphic has a transformation matrix to be concatenated with the transformation matrix of the parent graphic.

Example

The following code concatenates an instance of TLinkedModelMatrixPort to the drawing port so that the TMyPolygon instance draws with a new coordinate system. The constructor for TLinkedModelMatrixPort takes a reference to parentPort and concatenates the matrix parameter fMatrix to the matrix in the parentPort. When the p.Draw function is called, the polygon is drawn using the concatenated matrices. If fMatrix is a reflection matrix, the drawing takes places as though the 2-D y-axis is reversed with positive y going up instead of down.

      TMyPolygon::Draw( parentPort )
      {
          TLinkedModelMatrixPort childPort( &parentPort, fMatrix );
          childPort.Draw ( fMyPolygon );
      }

Linked port class descriptions

TLinkedBundlePort: This class takes a TGrafBundle instance in its constructor to establish a linked hierarchy of 2D attribute bundles.

TLinkedBundle3DPort: This class takes a TGrafBundle3D instance in its constructor to establish a hierarchy of 3D attribute bundles.

TLinkedClipPort: This class takes a TGArea in its constructor to establish a linked hierarchy of clipping areas by concatenating the clipping area of the parent port.

TLinkedScenePort: This class takes a TLinkableClippingSceneState instance in its constructor to polymorphically establish a linked hierarchy of TSceneBundle instances, for example.

TLinkedAttributePort: This class takes a TLinkableAttributeState instance in its constructor to polymorphically establish a linked hierarchy of attribute states.

TLinkedAttribute3DPort: This class takes a TLinkableAttribute3DState instance in its constructor to polymorphically establish a linked hierarchy of 3D attribute states.

TLinkedViewMatrixPort: This class takes a TGrafMatrix instance in its constructor to establish a linked hierarchy of 2D view matrices. A view matrix transforms a graphic and its pen. That is, if you scale a polygon with a thick pen, the polygon and the thick pen scale as a unit.

TLinkedModelMatrixPort: This class takes a TGrafMatrix3D instance in its constructor to establish a linked hierarchy of 2D mode matrices. A model matrix transforms a graphic, but not its pen. That is, if you scale a polygon with a thick pen, the polygon scales, but the pen retains its same thickness.

TLinkedModelMatrix3DPort: This class takes a TGrafMatrix3D instance in its constructor to establish a linked hierarchy of 3D model matrices.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker