#include <prm.h>
Inheritance diagram for Prm:
See class definition in hearder file "prm.h". For specification see class notes of course CIV-2802 "Sistemas Graficos para Engenharia", period 2011.1. Revisions:
| |
| Prm () | |
| This function creates a new primitive, puts it at the beginning of the list of primitives. | |
| Prm (int back) | |
| This function creates a new primitive, puts it at the end of the list of primitives if the "back" argument is true (1). | |
| virtual | ~Prm () |
| This function removes a primitive from the current list of primitives and releases memory that is used by it. | |
| Prm * | Next (void) |
| This function returns a pointer to the next primitive in relation to the current primitive. | |
| Prm * | Previous (void) |
| This function returns a pointer to the previous primitive in relation to the given current primitive. | |
| void | MoveFront (void) |
| This function moves the current primitive to the first position in the list of primitives. | |
| void | MoveBack (void) |
| This function moves the current primitive to the last position in the list of primitives. | |
| Prm::Type | GetType (void) |
| This function returns (as its value) a code indicating the type of the current primitive. | |
| void | Select (void) |
| This function selects the current primitive, i.e. | |
| void | Unselect (void) |
| This function unselects the given current primitive, i.e. | |
| int | CheckSelected (void) |
| This function returns the selection status (false = 0; true = 1) of the current primitive. | |
| void | SetColor (long int color) |
| This function sets the color of the current primitive. | |
| long int | GetColor (void) |
| This function returns the color of the current primitive. | |
| void | SetHeight (double height) |
| This function sets the height of the current primitive. | |
| double | GetHeight (void) |
| This function returns the height of the given primitive. | |
| static bool | ChkEmptyModel (void) |
| This function returns a status indicating whether the current the model is empty. | |
| static void | DeleteList (void) |
| This function realeases the memory that is used by the current list of primitives and resets the list. | |
| static Prm * | First (void) |
| This function returns a pointer to the first primitive of the current list. | |
| static Prm * | Last (void) |
| This function returns a pointer to the last primitive of the current list. | |
| static void | SelectAll (void) |
| This function selects all the primitives in the current list of primitives, i.e. | |
| static void | UnselectAll (void) |
| This function unselects all the primitives in the current list of primitives, i.e. | |
| static int | GetGlobalBox (double *xmin, double *xmax, double *ymin, double *ymax) |
| This function returns the limiting rectangle that involves all the primitives in the current list. | |
| void | Reset (void) |
| This function sets a null value for the next and previous pointers, sets an undefined primitive type, and sets a null color, selection flag, and height values. | |
| void | InsertFront (void) |
| This function inserts the current primitive at the beginning of the list of primitives. | |
| void | InsertBack (void) |
| This function inserts the current primitive at the end of the list of primitives. | |
| void | RemoveFromList (void) |
| This function removes the current primitive from the list. | |
| static Prm * | prm_head = 0L |
| Head of doubly-linked list of primitives. | |
Public Types | |
| enum | Type { PRM_UNDEF, PRM_QUAD, PRM_CIRC, NumPrmTypes } |
| Primitive types. More... | |
Public Member Functions | |
| virtual void | Read (FILE *fd)=0 |
| This function reads geometry data of a primitive from a file (given by its pointer) and loads the data into the primitive attributes. | |
| virtual void | Write (FILE *fd)=0 |
| This function writes the geometry attribute data of a primitive to a file (given by its pointer). | |
| virtual int | GetNPts (void)=0 |
| This function returns (as its value) the number of vertices of the current primitive. | |
| virtual void | SetCoords (int id, double x, double y)=0 |
| This function replaces the x and y coordinates of a vertex of the current primitive by the given pair of coordinates. | |
| virtual void | GetCoords (int id, double *x, double *y)=0 |
| This function returns the x and y coordinates of a vertex of the current primitive. | |
| virtual void | Set1stPt (double x, double y)=0 |
| This function is used during interactive construction of a primitive. | |
| virtual void | Set2ndPt (double x, double y)=0 |
| This function is used during interactive construction of a primitive. | |
| virtual int | PickArea (double x, double y)=0 |
| This function checks whether a given point is in the interior of a primitive. | |
| virtual int | PickVertex (double x, double y, double tol, int *id)=0 |
| This function selects a vertex on the boundary of a primitive based on the given point position. | |
| virtual int | PickSide (double x, double y, double tol, int *id)=0 |
| This function selects a side on the boundary of a primitive based on the given point position. | |
| virtual void | Translate (double dx, double dy)=0 |
| This function translates the current primitive All the vertices of the primitive are translated by the given translation factors. | |
| virtual void | TranslateVertex (int id, double dx, double dy)=0 |
| This function translates a vertex of a primitive using the given translation factors. | |
| virtual void | TranslateSide (int id, double dx, double dy)=0 |
| This function translates the two vertices of a side of a primitive using the given translation factors. | |
| virtual void | GetBox (double *xmin, double *xmax, double *ymin, double *ymax)=0 |
| This function returns the limiting rectangle that involves the current primitive. | |
| virtual void | DisplayBoundary (cdCanvas *canvas)=0 |
| This function displays the boundary of the current primitive. | |
| virtual void | DisplayInterior (cdCanvas *canvas)=0 |
| This function displays the interior of the current primitive The interior area is filled with the currently specified background color. | |
Protected Attributes | |
| Type | type |
| Primitive type. | |
Private Attributes | |
| Prm * | next |
| Next primitive in linked list. | |
| Prm * | prev |
| Previous primitive in linked list. | |
| int | sel |
| Flag for selected primitive. | |
| long int | color |
| Coded RGB color. | |
| double | height |
| Height of primitive (only used in 3D). | |
Classes | |
| struct | Coord |
| Primitive vertex coordinate structure. More... | |
|
|
Primitive types.
|
|
|
This function creates a new primitive, puts it at the beginning of the list of primitives. The head pointer to the list is modified accordingly. The special case of a current empty list is also treated. Definition at line 53 of file prm.cpp. References InsertFront(), and Reset(). |
|
|
This function creates a new primitive, puts it at the end of the list of primitives if the "back" argument is true (1). If the "back" is false (0), the primitive is put at the beginning of the list of primitives. The head pointer to the list is modified accordingly. The special case of a current empty list is also treated.
Definition at line 61 of file prm.cpp. References InsertBack(), InsertFront(), and Reset(). |
|
|
This function removes a primitive from the current list of primitives and releases memory that is used by it. The head pointer to the list of primitives may be modified accordingly. The special case of a resulting empty list is also treated. Definition at line 72 of file prm.cpp. References RemoveFromList(). |
|
|
This function returns the selection status (false = 0; true = 1) of the current primitive.
Definition at line 343 of file prm.cpp. References sel. Referenced by Model::Display(). |
|
|
This function returns a status indicating whether the current the model is empty. The returned status is true if the model is empty. Otherwise the returned status is false. Definition at line 84 of file prm.cpp. References First(). Referenced by Model::ChkEmptyModel(), PrmEd::DeleteSelPrm(), PrmEd::FinishDragPrm(), PrmEd::GetHeightFac(), PrmEd::MoveSelPrmToBack(), PrmEd::MoveSelPrmToFront(), Model::Save(), PrmEd::SelectDragPrm(), PrmEd::SetColor(), PrmEd::SetHeightFac(), and PrmEd::UpdateDragPrm(). |
|
|
This function realeases the memory that is used by the current list of primitives and resets the list. The function sets a null value for its head pointer. Definition at line 91 of file prm.cpp. References prm_head. Referenced by Model::Open(), Model::Reset(), and Model::~Model(). |
|
|
This function displays the boundary of the current primitive. The function only deals with the geometric attributes of the primitive. This means that other attributes such as foreground color, line style, or mark type are specified outside this function.
Implemented in Circ, and Quad. Referenced by Model::Display(), and PrmEd::DspTmpPrmLines(). |
|
|
This function displays the interior of the current primitive The interior area is filled with the currently specified background color. The function only deals with the geometric attributes of the primitive. This means that other attributes such as background color or interior style are specified outside this function.
Implemented in Circ, and Quad. Referenced by Model::Display(). |
|
|
This function returns a pointer to the first primitive of the current list.
Definition at line 101 of file prm.cpp. References prm_head. Referenced by ChkEmptyModel(), GetGlobalBox(), SelectAll(), PrmEd::SelectDragPrm(), UnselectAll(), and PrmIO::WriteList(). |
|
||||||||||||||||||||
|
This function returns the limiting rectangle that involves the current primitive. This rectangle is the primitive bounding box, which is parallel to the x and y axes, with the minimum and maximum x and y coordinates of the primitive's vertices.
Implemented in Circ, and Quad. Referenced by GetGlobalBox(). |
|
|
This function returns the color of the current primitive. The color is returned in a long integer with a coded RGB color (adopted in the CD graphics system).
Definition at line 357 of file prm.cpp. References color. Referenced by Model::Display(), and PrmIO::WriteList(). |
|
||||||||||||||||
|
This function returns the x and y coordinates of a vertex of the current primitive. The vertex is indicated by an index to the local array of vertices of the primitive. Nothing will happen if the given index is outside the range of valid indices of vertices.
|
|
||||||||||||||||||||
|
This function returns the limiting rectangle that involves all the primitives in the current list. This rectangle is the bounding box of the current set of primitives, which is parallel to the x and y axes, with the minimum and maximum x and y coordinates of all primitive's vertices.
Definition at line 142 of file prm.cpp. References First(), GetBox(), Next(), next, and prm_head. Referenced by Model::GetGlobalBox(), and Model::Open(). |
|
|
This function returns the height of the given primitive. The height is used only in 3D applications.
Definition at line 371 of file prm.cpp. References height. Referenced by PrmEd::GetHeightFac(), and PrmIO::WriteList(). |
|
|
This function returns (as its value) the number of vertices of the current primitive.
|
|
|
This function returns (as its value) a code indicating the type of the current primitive.
Definition at line 322 of file prm.cpp. References type. Referenced by PrmIO::WriteList(). |
|
|
This function inserts the current primitive at the end of the list of primitives. It handles the case of an empty list (this is indicated by a null head pointer). In this case, it sets the previous and next pointers of the current primitive pointing to itself. Otherwise, it sets the next pointer of the current primitive to point to the first primitive, sets the previous pointer of the current primitive to point to the last primitive, sets the previous pointer of the first primitive to point to the current primitive, and sets the next pointer of the last primitive to point to the current primitive. If the list is not empty, the list head pointer is not changed. Definition at line 210 of file prm.cpp. References next, prev, and prm_head. Referenced by MoveBack(), and Prm(). |
|
|
This function inserts the current primitive at the beginning of the list of primitives. It handles the case of an empty list (this is indicated by a null head pointer). In this case, it sets the previous and next pointers of the current primitive pointing to itself. Otherwise, it sets the next pointer of the current primitive to point to the first primitive, sets the previous pointer of the current primitive to point to the last primitive, sets the previous pointer of the first primitive to point to the current primitive, and sets the next pointer of the last primitive to point to the current primitive. In any case, the list head pointer will point to the current primitive. Definition at line 189 of file prm.cpp. References next, prev, and prm_head. Referenced by MoveFront(), and Prm(). |
|
|
This function returns a pointer to the last primitive of the current list.
Definition at line 108 of file prm.cpp. References prev, and prm_head. Referenced by Model::Display(). |
|
|
This function moves the current primitive to the last position in the list of primitives. Nothing will happen if the given primitive is already the last of the list. Definition at line 301 of file prm.cpp. References InsertBack(), prev, prm_head, and RemoveFromList(). Referenced by PrmIO::Interpret(), and PrmEd::MoveSelPrmToBack(). |
|
|
This function moves the current primitive to the first position in the list of primitives. The head pointer to the list is modified accordingly. Nothing will happen if the given primitive is already the first of the list. Definition at line 280 of file prm.cpp. References InsertFront(), prm_head, and RemoveFromList(). Referenced by PrmIO::Interpret(), and PrmEd::MoveSelPrmToFront(). |
|
|
This function returns a pointer to the next primitive in relation to the current primitive.
Definition at line 260 of file prm.cpp. References next, prev, and prm_head. Referenced by GetGlobalBox(), SelectAll(), PrmEd::SelectDragPrm(), UnselectAll(), and PrmIO::WriteList(). |
|
||||||||||||
|
This function checks whether a given point is in the interior of a primitive.
Implemented in Circ, and Quad. Referenced by PrmEd::SelectDragPrm(). |
|
||||||||||||||||||||
|
This function selects a side on the boundary of a primitive based on the given point position.
Implemented in Circ, and Quad. Referenced by PrmEd::SelectDragPrm(). |
|
||||||||||||||||||||
|
This function selects a vertex on the boundary of a primitive based on the given point position.
Implemented in Circ, and Quad. Referenced by PrmEd::SelectDragPrm(). |
|
|
This function returns a pointer to the previous primitive in relation to the given current primitive.
Definition at line 270 of file prm.cpp. References prev, and prm_head. Referenced by Model::Display(). |
|
|
This function reads geometry data of a primitive from a file (given by its pointer) and loads the data into the primitive attributes.
Implemented in Circ, and Quad. Referenced by PrmIO::Interpret(). |
|
|
This function removes the current primitive from the list. The primitive removal from list modifies the next pointer of the previous primitive in the list and modifies the previous pointer of the next primitive in the list. This function also treates the situation of a single primitive list, in which case the list head pointer is reset to a null value. Otherwise, the list head pointer will be affected only in the case in which the primitive being removed is at the beginning of the list: the new list head pointer will point to the primitive next to the primitive being removed. Definition at line 231 of file prm.cpp. References next, prev, and prm_head. Referenced by MoveBack(), MoveFront(), and ~Prm(). |
|
|
This function sets a null value for the next and previous pointers, sets an undefined primitive type, and sets a null color, selection flag, and height values.
Definition at line 175 of file prm.cpp. References color, height, next, prev, PRM_UNDEF, sel, and type. Referenced by Prm(). |
|
|
This function selects the current primitive, i.e. , it sets the selection flag of the primitive. Definition at line 329 of file prm.cpp. References sel. Referenced by PrmEd::InsertPrm1stPt(), and PrmEd::SelectDragPrm(). |
|
|
This function selects all the primitives in the current list of primitives, i.e. , it sets the selection flag of all the primitives. |
|
||||||||||||
|
This function is used during interactive construction of a primitive. It sets the x and y coordinates of the first construction point of the current primitive by the given pair of coordinates.
Implemented in Circ, and Quad. Referenced by PrmEd::InsertPrm1stPt(). |
|
||||||||||||
|
This function is used during interactive construction of a primitive. It sets the x and y coordinates of the second construction point of the current primitive by the given pair of coordinates.
Implemented in Circ, and Quad. Referenced by PrmEd::EchoPrm2ndPt(), and PrmEd::InsertPrm2ndPt(). |
|
|
This function sets the color of the current primitive. The color is given by a long integer with a coded RGB color (adopted in the CD graphics system).
Definition at line 350 of file prm.cpp. Referenced by PrmEd::InsertPrm1stPt(), PrmIO::Interpret(), and PrmEd::SetColor(). |
|
||||||||||||||||
|
This function replaces the x and y coordinates of a vertex of the current primitive by the given pair of coordinates. The vertex is indicated by an index to the local array of vertices of the primitive. Nothing will happen if the given index is outside the range of valid indices of vertices.
|
|
|
This function sets the height of the current primitive. The height is used only in 3D applications.
Definition at line 364 of file prm.cpp. Referenced by PrmIO::Interpret(), and PrmEd::SetHeightFac(). |
|
||||||||||||
|
This function translates the current primitive All the vertices of the primitive are translated by the given translation factors.
Implemented in Circ, and Quad. Referenced by PrmEd::FinishDragPrm(), PrmIO::Interpret(), and PrmEd::UpdateDragPrm(). |
|
||||||||||||||||
|
This function translates the two vertices of a side of a primitive using the given translation factors. The target side is indicated by an index, which should have a value between 0 and the number of primitive vertices minus one. Nothing will happen if the given index is outside this range. The index of a side corresponds to the index of its first vertex.
Implemented in Circ, and Quad. Referenced by PrmEd::FinishDragPrm(), PrmIO::Interpret(), and PrmEd::UpdateDragPrm(). |
|
||||||||||||||||
|
This function translates a vertex of a primitive using the given translation factors. The target vertex is indicated by its index to the primitive coordinate vector, which should have a value between 0 and the number of vertices minus one. Nothing will happen if the given index is outside this range.
Implemented in Circ, and Quad. Referenced by PrmEd::FinishDragPrm(), PrmIO::Interpret(), and PrmEd::UpdateDragPrm(). |
|
|
This function unselects the given current primitive, i.e. , it resets (sets to null) the selection flag of the primitive. Definition at line 336 of file prm.cpp. References sel. |
|
|
This function unselects all the primitives in the current list of primitives, i.e. , it resets (sets to null) the selection flag of all the primitives. Definition at line 130 of file prm.cpp. References First(), Next(), and sel. Referenced by PrmEd::SelectDragPrm(), and PrmEd::UnselectAllPrm(). |
|
|
This function writes the geometry attribute data of a primitive to a file (given by its pointer).
Implemented in Circ, and Quad. Referenced by PrmIO::WriteList(). |
|
|
Coded RGB color.
Definition at line 116 of file prm.h. Referenced by GetColor(), and Reset(). |
|
|
Height of primitive (only used in 3D).
Definition at line 119 of file prm.h. Referenced by GetHeight(), and Reset(). |
|
|
Next primitive in linked list.
Definition at line 107 of file prm.h. Referenced by GetGlobalBox(), InsertBack(), InsertFront(), Next(), RemoveFromList(), and Reset(). |
|
|
Previous primitive in linked list.
Definition at line 110 of file prm.h. Referenced by InsertBack(), InsertFront(), Last(), MoveBack(), Next(), Previous(), RemoveFromList(), and Reset(). |
|
|
Head of doubly-linked list of primitives.
Definition at line 44 of file prm.cpp. Referenced by DeleteList(), First(), GetGlobalBox(), InsertBack(), InsertFront(), Last(), MoveBack(), MoveFront(), Next(), Previous(), and RemoveFromList(). |
|
|
Flag for selected primitive.
Definition at line 113 of file prm.h. Referenced by CheckSelected(), Reset(), Select(), SelectAll(), Unselect(), and UnselectAll(). |
|
|
Primitive type.
Definition at line 127 of file prm.h. Referenced by Circ::Circ(), GetType(), Quad::Quad(), and Reset(). |
1.4.2-20050421