Cisco Packet Tracer Extensions API 8.1.0
API for communication between Cisco Packet Tracer application and its extension applications and modules.
Public Member Functions | List of all members
ComponentItem Class Reference

ComponentItem handles and manipulates component items, such as devices, on the workspace. More...

Public Member Functions

QString getName ()
 Returns the name of this component item. More...
 
void setVisible (bool)
 Shows or hides the component item. More...
 
int type ()
 Returns the type of the component item. More...
 
void moveBy (double, double)
 Moves the component item by the specified x and y values. More...
 
void moveTo (double, double)
 Moves the component item to the specified coordinates. More...
 
Device device ()
 Returns the device. More...
 
int getXCoordinate ()
 Returns the x-coordinate of the component item. More...
 
int getXCoordinateCenter ()
 Returns the center x-coordinate of the component item. More...
 
int getYCoordinate ()
 Returns the y-coordinate of the component item. More...
 
int getYCoordinateCenter ()
 Returns the center y-coordinate of the component item. More...
 
void setX (double)
 Sets the x-coordinate of the component item. More...
 
void setXCenter (int)
 Sets the center x-coordinate of the component item. More...
 
void setY (double)
 Sets the y-coordinate of the component item. More...
 
void setYCenter (int)
 Sets the center y-coordinate of the component item. More...
 
int getWidth ()
 
int getHeight ()
 
void setXVelocity (double)
 Sets the x-axis velocity of the component item. More...
 
void setYVelocity (double)
 Sets the y-axis velocity of the component item. More...
 
void setVelocity (double, double)
 Sets the x-axis and y-axis velocity of the component item. More...
 
double xVelocity ()
 Returns the x-axis velocity of the component item. More...
 
double yVelocity ()
 Returns the y-axis velocity of the component item. More...
 
void setSelected (bool)
 Selects or deselects the component item. More...
 
string getClusterID ()
 Returns the cluster ID of the component item. More...
 
QString getThisClusterID ()
 
ComponentItem getParent ()
 Returns the parent cluster that contains this component item. More...
 
bool moveOutOfCurrentCluster ()
 Moves the component item out of the current cluster and returns whether it was successful. More...
 
bool moveIntoCluster (QString)
 Moves the component item into a cluster in the same level with the specified name and returns whether it was successful. More...
 
bool loadAccessoryImage (int, QString)
 Loads an image for an accessory. More...
 
void removeAccessory (int)
 Removes an accessory. More...
 

Detailed Description

ComponentItem handles and manipulates component items, such as devices, on the workspace.

Member Function Documentation

◆ device()

Device ComponentItem::device ( )

Returns the device.

Returns
Device, the device object.

◆ getClusterID()

string ComponentItem::getClusterID ( )

Returns the cluster ID of the component item.

Returns
string, the cluster ID of the component item.

◆ getHeight()

int ComponentItem::getHeight ( )

◆ getName()

QString ComponentItem::getName ( )

Returns the name of this component item.

Returns
QString, name of the component item.

◆ getParent()

ComponentItem ComponentItem::getParent ( )

Returns the parent cluster that contains this component item.

Returns
ComponentItem, the parent cluster that contains this component item.

◆ getThisClusterID()

QString ComponentItem::getThisClusterID ( )

◆ getWidth()

int ComponentItem::getWidth ( )

◆ getXCoordinate()

int ComponentItem::getXCoordinate ( )

Returns the x-coordinate of the component item.

Returns
int, the x-coordinate of the component item.

◆ getXCoordinateCenter()

int ComponentItem::getXCoordinateCenter ( )

Returns the center x-coordinate of the component item.

Returns
int, the center x-coordinate of the component item.

◆ getYCoordinate()

int ComponentItem::getYCoordinate ( )

Returns the y-coordinate of the component item.

Returns
int, the y-coordinate of the component item.

◆ getYCoordinateCenter()

int ComponentItem::getYCoordinateCenter ( )

Returns the center y-coordinate of the component item.

Returns
int, the center y-coordinate of the component item.

◆ loadAccessoryImage()

bool ComponentItem::loadAccessoryImage ( int  ,
QString   
)

Loads an image for an accessory.

Parameters
slotNum,accessoryslot index.
imagePath,pathto the image to use for the accessory.
Returns
bool, true if successful, false if not.

◆ moveBy()

void ComponentItem::moveBy ( double  ,
double   
)

Moves the component item by the specified x and y values.

Parameters
x,thevalue to move the component item by on the x-axis.
y,thevalue to move the component item by on the y-axis.

◆ moveIntoCluster()

bool ComponentItem::moveIntoCluster ( QString  )

Moves the component item into a cluster in the same level with the specified name and returns whether it was successful.

Parameters
name,thename of the cluster in the same level
Returns
boolean, whether the move was successful.

◆ moveOutOfCurrentCluster()

bool ComponentItem::moveOutOfCurrentCluster ( )

Moves the component item out of the current cluster and returns whether it was successful.

Returns
boolean, whether the move was successful.

◆ moveTo()

void ComponentItem::moveTo ( double  ,
double   
)

Moves the component item to the specified coordinates.

Parameters
x,thevalue to move the component item to on the x-axis.
y,thevalue to move the component item to on the y-axis.

◆ removeAccessory()

void ComponentItem::removeAccessory ( int  )

Removes an accessory.

Parameters
slotNum,indexof the accessory to remove.

◆ setSelected()

void ComponentItem::setSelected ( bool  )

Selects or deselects the component item.

Parameters
bSelected,trueto select the item, false to deselect it.

◆ setVelocity()

void ComponentItem::setVelocity ( double  ,
double   
)

Sets the x-axis and y-axis velocity of the component item.

Parameters
xv,thex-axis velocity of the component item.
yv,they-axis velocity of the component item.

◆ setVisible()

void ComponentItem::setVisible ( bool  )

Shows or hides the component item.

Parameters
bVisible,trueto show the component item, false to hide it.

◆ setX()

void ComponentItem::setX ( double  )

Sets the x-coordinate of the component item.

Parameters
x,thex-coordinate of the component item.

◆ setXCenter()

void ComponentItem::setXCenter ( int  )

Sets the center x-coordinate of the component item.

Parameters
x,thecenter x-coordinate of the component item.

◆ setXVelocity()

void ComponentItem::setXVelocity ( double  )

Sets the x-axis velocity of the component item.

Parameters
xv,thex-axis velocity of the component item.

◆ setY()

void ComponentItem::setY ( double  )

Sets the y-coordinate of the component item.

Parameters
y,they-coordinate of the component item.

◆ setYCenter()

void ComponentItem::setYCenter ( int  )

Sets the center y-coordinate of the component item.

Parameters
y,they-coordinate of the component item.

◆ setYVelocity()

void ComponentItem::setYVelocity ( double  )

Sets the y-axis velocity of the component item.

Parameters
yv,they-axis velocity of the component item.

◆ type()

int ComponentItem::type ( )

Returns the type of the component item.

Returns
int, the type of component. Types: COMPONENT = 1100, CONNECTION = 1101, NOTE = 1102, PACKET = 1103, CLUSTER = 1104, RECTANGLE = 1105, LINE = 1106, ELLIPSE = 1107, MULTIUSERITEM = 1108, QOSPACKET = 1109, RESIZEINDICATOR = 1110, ACCESSORYITEM = 1111, POLYGON = 1112, TEXTPOPUP = 1113

◆ xVelocity()

double ComponentItem::xVelocity ( )

Returns the x-axis velocity of the component item.

Returns
double, the x-axis velocity of the component item.

◆ yVelocity()

double ComponentItem::yVelocity ( )

Returns the y-axis velocity of the component item.

Returns
double, the y-axis velocity of the component item.

The documentation for this class was generated from the following file: