To use a GrafEdit command, you need to construct it and call special setter functions as described in the following sections. Everything else is done by the GrafEdit framework.
TScaleCanvasGraphicCmd has a SetScaleFactor function that allows the scale factor to be set incrementally (for example, by a slider) and undone in a single step. SetScaleFactor sets the scale factor for each increment. The center of scale can be set only once in the constructor.
TRotateCanvasGraphicCmd has a SetAngle function that allows the angle to be set incrementally (for example, by a slider) and undone in a single step. SetAngle sets the angle for each increment. The center of rotation can be set only once in the constructor.
Adopt command
The constructor for this command adopts the specified canvas graphic into the canvas representation associated with the selection. TAdoptCanvasGraphicCmd( MCanvasGraphic* adoptGraphic, Boolean adoptAtFront = TRUE);
Delete command
This command deletes all canvas graphics in the selection from the associated canvas representation. Undo adopts deleted graphics into the representation in their original locations and order from front to back with respect to other graphics. TDeleteCanvasGraphicCmd();
Fill color command
The constructor for this command sets the fill color of all canvas graphics in the selection. When no color is specified, the command has no effect. This class has a SetColor function that allows the fill color to be set incrementally (for example, by a slider) and undone in a single step. SetColor sets the color for each increment. TSetCanvasGraphicFillColorCmd( const TColor& );
virtual void SetColor( const TColor& );
Frame color command
The constructor for this command sets the frame color of all graphics in the selection. If a color is not specified, the command has no effect. This class has a SetColor function that allows the frame color to be set incrementally (for example, by a slider) and undone in a single step. SetColor sets the color for each increment. TSetCanvasGraphicFrameColorCmd( const TColor& );
virtual void SetColor( const TColor& );
Line width command
The constructor for this command sets the line width for all graphics in the selection. The default width is 1.0 in world coordinate units. This class has a SetWidth function that allows the line width to be set incrementally (for example, by a slider) and undone in a single step. SetWidth sets the line width for each increment. TSetCanvasGraphicLineWidthCmd( GCoordinate width );
virtual void SetWidth( GCoordinate width );
Scale command
This command scales all canvas graphics in the current selection by the specified scale factor around the specified center of scale. These values are set in the constructor. The scale factor is a TGPoint where fX is a horizontal scale factor and fY is the vertical scale factor. A scale factor of (2,2) multiplies the graphics by 2 vertically and horizontally. The default scale factor is (1,1) and the default center of scale is (0,0). TScaleCanvasGraphicCmd( const TGPoint& centerOfScale );
TScaleCanvasGraphicCmd( const TGPoint& scaleFactor, const TGPoint& centerOfScale );
virtual void SetScaleFactor( const TGPoint& centerOfScale );
Rotate command
This command rotates all graphics in the current selection by a specified number of degrees around a specified center of rotation. These values are set in the constructor. The default angle is (0.0) and the default center is (0,0). TRotateCanvasGraphicCmd( const TGPoint& centerOfRotation );
TRotateCanvasGraphicCmd( const TGPoint& angle, const TGPoint& centerOfRotation );
virtual void SetAngle( const TGPoint& centerOfRotation );
Translate command
This command translates (moves) all graphics in the current selection by a specified value. The value is a TGPoint where fX is the horizontal offset and fY is the vertical offset. Offsets are relative to the origin and the default offset is (0,0). This class has a SetOffset function that allows the offset to be set incrementally for interactive direct manipulation such as when the user moves a graphic with the mouse. TTranslateCanvasGraphicCmd( const TGPoint& offset );
virtual void SetOffset( const TGPoint& offset );
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Generated with WebMaker