Chapter II, Interests
The class of information management is mainly used in various objects in the problem space. In the space analysis problem, there are main types, straight lines, arccles, and descriptions of doors and windows, rooms, apartment, etc., all kinds. Class is mainly described by the attributes and member functions. The following is a presentation.
1, click CMYPOINT
Point class is used to describe the points in AutoCAD, mainly used to record the starting and end points of the lines, also used to nodes in the graphical topology. Below is the definition of the category
Class CMYPOINT
{
PUBLIC:
CMYPOINT (); // Constructor
Bool Operator == (CMYPOINT & APOINT); // operator overload, used to determine whether the coordinates of the two points are equal
CMYPOINT * MIDPOINT (CMYPOINT * P); // Calculate the midpoint between the point and another point
CMYPOINT * NextPOINT; // Point Linometer Pointer
Virtual ~ cmypoint (); // Destructor
PUBLIC:
Double X, Y, Z; // point coordinates
CMyPoint (Double THEX, DOUBLE, DOUBLE THEZ): X (THEX), YY, Z (THEZ) // Constructor
{
NextPoint = NULL;
}
Double Distopoint (CMYPOINT & APOINT) Calculates the current point and another distance
Double Directangleto (CMYPOINT & P) calculates the direction of the current point to another.
Bool Aboutequal (CMYPOINT & P); / / Judging whether a electricity is nearby, used to return to graphics
Bool Samepoint (CMYPOINT & P); // Judge whether the two points are the same
}
2, straight line
Linear class is used to describe the straight lines in AutoCAD, and in our analysis, the wall is described in the center line, and the door holes on the wall are also described in line. Below is the definition of linear class:
Class Cline
{
PUBLIC:
//Attributes
// the start and the direction angle and it's length defining a line
CMYPOINT * SHES, * theE; // Starting point and endpoint of straight line
Double Dangle, DLENGTH; / / Directional angle and length of the straight line, the angle unit is curved, the length unit is mime
ACDBOBJECTID LINEID; / / The ID number of the straight line CAD number
INT WINS; / / The straight segment on the linear section - that is, the number of doors and windows on the line
Cline * Winline [MAXWIN]; // Door and Window Route Array MaxWin is set to 15 for the door and window lines
Double thickness;
// member function
Cline (); // Constructor
CLINE (CMYPOINT * S, CMYPOINT * E); // Constructor
CLINE (Acgepoint3D & Start, Acgepoint3D & End, ACGEPOINT3D & End); // Configuration function, define the straight line in the click class in AutoCAD
Void Exchangeends (); // The two endpoints of the interactive line change the direction of the straight line.
CMYPOINT * getend (); // Return to the end of the line
Bool Onit (Cline & Aline); Judging whether another straight line is on the line, when it is used to initially scan the graphics, it is determined whether another straight line is a repeated excess object, which is used to determine if another line is again scanned. It is the door hole on the wall that is expressed in the line, thereby performing the door hole record.
INT OnTextend (Cline & Aline); if the other is on the extended line of the line, it is judged whether or not the two straight lines form a complete wall when the wall information is used to use extremely small integrity. Bool Parallelto (Cline & Aline); Decades whether the two straight lines are parallel
// DEAL with the seg_overlapped
Bool Pointonit (CMYPOINT * POINT); Judging whether a point is on the line
Bool seglapped (cline * aline); Judging whether the two straight lines are partially coincident, mainly used to determine whether or not the drawing error occurs in the first time, thereby combining two straight lines into a straight line.
Void Combine (CLINE * ALINE); combines two lines into a straight line
Void setStart (CMYPOINT * POINT); change the starting point of the straight line
Void setnd (CMYPOINT * POINT); change the end of the line
Bool Sameline (CLINE * PL); // This function has been discarded, and since the program has been modified, some functions have been abandoned, and only abandoned it has been discarded.
Double distttopara (cline * aline); calculate the distance between two flat lines
Bool ExtendLine (CLINE * ALINE, INT TYPE, DOUBLE THICK; extending two straight lines in some way, mainly used to segment and extend the centerline of the expression wall, with minimal integrity Straight line to describe the wall.
Void ExchangeWin (INT I, INT J);
Bool Samewall (Cline * PL, Double Thick); During the two straight lines, whether the two straight lines are expressed inside and outside the wall
CLINE * Makemid (Cline * PL); Generates the center line of two flat lines
Void Sortwin ();
CMYPOINT * HALFTHICKPOINT (int endpoint, int flag, int this);
Cline * Leftadis (int Flag, Double Thick);
INT crossto (CLINE * PLINE, DOUBLE Thickness, CMYPOINT ** PPP); calculates the intersection of the current straight line and the other line, returns the type of intersect, and records the focus in the PPP
CMYPOINT * OUTCROSSTO (CLINE * ALINE, DOUBLE DIS; calculates whether the current straight line and the other line are extended, return to the intersection point
BOOL THROUGHPOINT (CMYPOINT * P); Judging whether the straight line passes another
Double AnticLockTo (CLINE * PL); calculate the current straight line and the counterclockwise rotation of the counterclockwise
Bool Selfsymmetry (Double Value, INT TYPE);
Bool Symmetryto (Double Value, Cline & Aline, INT TYPE);
Virtual ~ cline (); quieter functions
}
3, linear linked table CLINESET
Mainly used to link latter organizations in line. In this class, the state of the line is supplemented, which is used to describe whether the straight line representing the wall is complete. Some member functions that are sorted separately in the definition of this class, which are sorted by some member functions that are sorted by a comprehensive approach, these member functions have been discarded. Here is its definition description.
Class Clineset
{
PUBLIC:
Cline * theline; // straight line pointer
Clineset * pnext; // linear linked list pointer
ClineSet * Pup; // Linear Link Pointer, pointing to a node
Bool selected; / / Whether the room has been selected when
Bool arc; // if the lineset is convered from arc it is true else false
Clineset (); constructor
Clineset (CLINE * ALINE); Constructor Clineset (Myarc * AARC); constructor, the function is described by a circular arc object as a parameter, converting the arc into a straight line represented by two endpoints, mainly for describing graphics Topology.
Void AddLine (Cline * Aline); Add a straight line in the list
Void AddLine (Myarc * AARC); add arcs in the linked list
Void addtailline (cline * aline); add a straight line at the end of the list
Void Delline (INT I); Delete the i-I object in the list
INT Findline (Cline * Aline, Bool (* Pfun) (CLINE & A));
Void freeset (); release linear linked list
Void Clineset :: Roomlined (Cline * Pl, Clinset ** PLINESET);
Room * Findroom (ClineSet * PS);
INT LINETHROUGH (Clineset * ps); // Get The Line thRouth The Given Line's Start
BOOL CAN_DELE_POINT (CMYPOINT * P); // Abandoned
Void DellinethoughPoint (CMYPOINT * P); // Abandoned
Virtual ~ clineset (); quaterial function
Double Areatopoint (CMYPOINT * P); calculated triangular area determined by this straight line and another point
BOOL NORMALCORNER (ClineSet * PS); / / Determines if the angle between the two straight lines is a normal right angle, which is mainly used to determine whether the ground can be divided into a rule when blocking the floor ground.
// seg the Triangle
Bool Crossto (ClineSet * PS); Judging whether there is a intersection between the two straight lines
Bt_block * Trianlgetoblock (Double & Area); blocking the triangle between the current straight line and its next straight line
Int OnsymmetryExtend (Clineset & Lineset, Double X, Double Y, INT TYPE); // Abandoned
INT VERTICALTO (Clineset * PS, Double WallThick); / / Judging whether the two straight lines are vertical
INT VERTICALTYPE; / / Property, used to identify wall integrity
BOOL POINTONEXTEND (CMYPOINT * P); whether the judgment point is in the extended line of the straight line
Void Exchangeends (); switching two ends
Bool Equalline (ClineSet * aline) Judging whether it is the same line
}
4, arc "Myarc
Circular Class is used to describe arc objects in AutoCAD
Class myarc
{
PUBLIC:
Double Starta, Enda; // Starting angle and termination angle of arc
Double Radio; // The Radio of the Arc Arc radius
CMYPOINT * CENTRE; arc center point
ACDBOBJECTID ARCID; // CAD ARC ID Arc Object AutoCAD Representation Number
Myarc * Winarc [Maxwin]; arcuate an arc number
INT WINS; Number of door, used to record the size of the array
Bool Truearc; // the falgiff10 ARC is a true arc
Myarc (); constructor
// Myarc (Acgepoint3D & Cen, Double S, Double E, Double R, ACDBObjectID ID); Constructor
Myarc (Acgepoint3D & Cen, Double Sangle, Double Eangle, Double Radius, ACDBOBJECTID THEID); Constructor
Bool Samecentre (Myarc * aarc); // Judging whether the two arcs are concentricless (myarc * aarc); // Judging whether the two arcs are parallel
CLINE * SINGLINED (); // Converts the straight line described with two endpoints of arc
Clineset * MultiLined (); // has been discarded
BOOL Onit (Myarc * Parc); / / Judgment whether another arc is on the arc
BOOL SAMECIRCLE (Myarc * Parc); // Judgment is the same arc
Myarc * middlearc (myarc * parc); // Generate the central arc of two arcs
Bool seglapped (myarc * parc); // Judging whether the two arcs are part of
Void Combinelapped (Myarc * Parc); // Combine the two arc into a arc
INT WallSegged (Myarc * Parc, Double Thickness); // Judging whether there is a wall center line and the arc intersect in the middle part
Bool Crosstoline (CLINE * PL); // if a line cross a arc, judging if there is a straight line and arc intersection
CMYPOINT * CROSSLINEPOINT (CLINE * PL, Double Thickness); // Calculate the intersection of arcs and straight lines
Virtual ~ myarc (); quieter functions
}
5, circular arc chain table Myarcset
Give classes for recording and organizing arc objects.
Class myarcset
{
PUBLIC:
Myarc * thearc; // Circular object, data of the node
Myarcset * pnextarc; linked list pointer
Myarcset (); constructor
Myarcset (Myarc * Parc); Constructor
Void Addarc (Myarc * Parc); add arc objects in the list
Void Addtailarc (Myarc * Parc); add arc objects at the end of the linked list
Virtual ~ myarcset (); quaterial function
Void sort (); // For the concentric circular chain table, arrange the arc object in counterclockwise direction
}
6, wall class
Class Wall
{
PUBLIC:
Double area; // wall area, unit square meter
Cline * baseline; // wall baseline
Winordoor * PWins; // Door and Windows List
Double Height; // Wall Height
Bool Havecover;
Bool Outer; // Inside and outside wall sign 1 - exterior wall, 0- is the interior wall
Wall * nextw; // wall linked list pointer
Room * nextTo; // Adjacent Space Pointer
CSTRING MATERIAL; // Wall material or Layer attribute name
Wall (); constructor
Wall (ClineSet * Base, Double H); Constructor
Virtual ~ Wall (); Qualified Function
}
7, room class
Class Room
{
PUBLIC:
Clineset * Bases; // Room wall baseline
Room * nextr; // Next space
Double Height; // Room Space Height
Double Darea; // Room Flat Area
Wall * pwall; // wall linked list // Start pointer is head pointer, no clear data
// There is a door window chain on Wall
CSTRING ROOMTYPE; / / The type of room, such as bedroom ...
CSTRING NAME; room name
Zone * PZONE; Type of Room
Bool areaed;
Bt_block * pblock; subsequent table
Bool BasenticlockWise; During the judge, whether the floor lines of the room are rotated counterclockwise
Room (); constructor
Void AddBaseline (Cline * PLINE, BOOL ARC); add a bordery line on the ground
Void Addroom (Room * Pr); // Add a room Additive Space
Bool baseclosed (); // Judging whether the floor line is closed Room (ClineSet * Base, Double H): Bases (Base), Height (h) constructor
Void set_block (); / / block the ground
Void make_whole_room (); setting all room wall properties in the room linked list, such as whether there is adjacent wall between the rooms. Make a wall only belong to a room
Void setroom Height (intloy); set the height of the room all day, which is called after the building layer is high, and the height is set to all rooms.
Virtual ~ Room (); quieter functions
Double getBaseArea (); Calculate the floor area of the room
Room * Findsameroom (Room * Proom); Search in the room linked list, check if there is the same room as the specified room
CMYPOINT * SSON; // Zhong Qin Add, add some properties to the program Zhong Zhongqin, after the back is simple to indicate the wagon add
CMYPOINT * ESON; // Zhongqin Add
CMYPOINT * TREEROOTPOINT; / / Zhong Qin Add
CTreePointSet * RoompointSet; // Zhong Qin Add
8, suitcase
This is used to describe a suite, and the data expressing the socket has such a room, as well as suite usage and equipment.
Class Apartment
{
PUBLIC:
ROOM * PROOM [MAX_APART_AMOUNT]; // Room Pointer
INT Rooms; // The total number of rooms in the room
CString ApartType; // Suites
CSTRING CONTROL; Space Control
CSTRING AIR;
CSTRING Equipment; Suites
CSTRING Heat_Resource; Heat Source
CSTRING COOLING_SCHEDULE; Refrigeration Time
Cstring heating_schedule; heating time
Float Cooling_eir; refrigeration factor
Float heating_eir; heating factor
Apartment (); constructor
Virtual ~ apartment (); quaterial function
}
9, block
This class is used to describe the blocking case of the room, for an irregular floor, approximate the ground with multiple rectangular blocks.
Class bt_block
{
PUBLIC:
Double Width, Height, Area; Width, Height, and Area
Double Angle;
BT_BLOCK * NextB; Links Pointer
CMYPOINT * BPOINT; // block base point
Bt_block (); constructor
BT_Block (double Ang, Double WD, Double He, CMYPOINT * POINT) constructor
Virtual ~ bt_block (); quieter functions
}
10, Typedef Struct ZonePE
{
CSTRING HeatTempsch;
CString CooltempsCH;
Cstring designheatt;
CString DesignCoolt;
CSTRING ZONECTRL;
} zone;
This structure should be added to the clock, which is used to set a zone type in the socket.