00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef BUILDINGH
00011 #define BUILDINGH
00012
00013 #include "MathTypes.h"
00014 #include "Selectable.h"
00015
00016 enum WallType
00017 {
00018 WALL_FLAT, WALL_SIDING, WALL_GLASS
00019 };
00020 enum RoofType
00021 {
00022 ROOF_FLAT, ROOF_SHED, ROOF_GABLE, ROOF_HIP, NUM_ROOFTYPES
00023 };
00024
00025 enum BldShape
00026 {
00027 SHAPE_RECTANGLE,
00028 SHAPE_CIRCLE,
00029 SHAPE_POLY,
00030 NUM_BLDSHAPES
00031 };
00032
00033 enum BldColor
00034 {
00035 BLD_BASIC,
00036 BLD_ROOF,
00037 BLD_MOULDING
00038 };
00039
00040 class vtWall
00041 {
00042 public:
00043 void Set(int iDoors, int iWindows, WallType m_Type);
00044
00045 int m_iDoors;
00046 int m_iWindows;
00047 WallType m_Type;
00048 };
00049
00050 #define MAX_WALLS 24 // the largest number of walls
00051
00052
00053 class vtStory
00054 {
00055 public:
00056 vtStory();
00057 vtStory(const vtStory &from) { *this = from; }
00058 ~vtStory();
00059
00060
00061 vtStory &operator=(const vtStory &v);
00062
00063 void DeleteWalls();
00064 void SetWalls(int n);
00065
00066 Array<vtWall *> m_Wall;
00067
00068 };
00069
00070 class vtBuilding : public Selectable
00071 {
00072 public:
00073 vtBuilding();
00074 ~vtBuilding();
00075
00076
00077 vtBuilding &operator=(const vtBuilding &v);
00078
00079
00080 void SetLocation(double x, double y);
00081 void SetLocation(const DPoint2 &p) { m_EarthPos = p; }
00082 DPoint2 GetLocation() const { return m_EarthPos; }
00083
00084
00085 void SetRectangle(float fWidth, float fDepth);
00086 void GetRectangle(float &fWidth, float &fDepth) const
00087 {
00088 fWidth = m_fWidth;
00089 fDepth = m_fDepth;
00090 }
00091 void SetRadius(float fRad) { m_fRadius = fRad; }
00092 float GetRadius() const { return m_fRadius; }
00093
00094 void SetFootprint(DLine2 &dl);
00095 DLine2 &GetFootprint() { return m_Footprint; }
00096
00097 void SetColor(BldColor which, RGBi col);
00098 RGBi GetColor(BldColor which);
00099
00100 void SetRotation(float fRadians);
00101 void GetRotation(float &fRadians) const { fRadians = m_fRotation; }
00102
00103 void SetShape(BldShape s) { m_BldShape = s; }
00104 BldShape GetShape() { return m_BldShape; }
00105
00106 void SetStories(int i);
00107 int GetStories() const { return m_Story.GetSize(); }
00108
00109 DRECT GetExtents();
00110 void SetCenterFromPoly();
00111 void Offset(DPoint2 &p);
00112 void RectToPoly();
00113
00114 RoofType m_RoofType;
00115 bool m_bMoulding;
00116 bool m_bElevated;
00117
00118 protected:
00119
00120 RGBi m_Color;
00121 RGBi m_RoofColor;
00122 RGBi m_MouldingColor;
00123
00124
00125 Array<vtStory *> m_Story;
00126
00127
00128 DPoint2 m_EarthPos;
00129 float m_fRotation;
00130
00131
00132 BldShape m_BldShape;
00133
00134
00135 float m_fWidth, m_fDepth;
00136
00137
00138 float m_fRadius;
00139
00140
00141 DLine2 m_Footprint;
00142
00143 private:
00144 void DeleteStories();
00145 void RebuildWalls();
00146 };
00147
00148 typedef vtBuilding *vtBuildingPtr;
00149
00150 #endif