vtdata library
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
vtBuilding Class Reference
Inheritance diagram for vtBuilding:
Inheritance graph
[legend]

Public Member Functions

vtBuildingoperator= (const vtBuilding &v)
 
void SetFootprint (int i, const DLine2 &dl)
 
void SetFootprint (int i, const DPolygon2 &poly)
 
const DPolygon2GetFootprint (int i) const
 
const DLine2GetOuterFootprint (int i) const
 
bool GetBaseLevelCenter (DPoint2 &p) const
 
void SetRectangle (const DPoint2 &center, float fWidth, float fDepth, float fRotation=0.0f)
 
void SetCircle (const DPoint2 &center, float fRad)
 
void FlipFootprintDirection ()
 
float CalculateBaseElevation (vtHeightField *pHeightField)
 
void TransformCoords (OCTransform *trans)
 
void SetRoofType (RoofType rt, int iSlope=-1, int iLev=-1)
 
RoofType GetRoofType () const
 
RGBi GuessRoofColor () const
 
void SetRoofColor (const RGBi &rgb)
 
void SetColor (BldColor which, const RGBi &color)
 
RGBi GetColor (BldColor which) const
 
void SetNumStories (int i)
 
int NumStories () const
 
float GetTotalHeight () const
 
uint NumLevels () const
 
vtLevelGetLevel (int i)
 
const vtLevelGetLevel (int i) const
 
vtLevelCreateLevel (const DPolygon2 &footprint)
 
vtLevelCreateLevel ()
 
void InsertLevel (int iLev, vtLevel *pLev)
 
void DeleteLevel (int iLev)
 
bool GetExtents (DRECT &rect) const
 
void Offset (const DPoint2 &delta)
 
double GetDistanceToInterior (const DPoint2 &point) const
 
void WriteXML (GZOutput &out, bool bDegrees) const
 
void AddDefaultDetails ()
 
void DetermineLocalFootprints ()
 
const FPolygon3GetLocalFootprint (int i) const
 
bool IsContainedBy (const DRECT &rect) const
 
void SwapLevels (int lev1, int lev2)
 
void SetEaves (float fLength)
 
void SetEavesSimple (float fLength)
 
void SetEavesFelkel (float fLength)
 
void CopyStyleFrom (const vtBuilding *const pSource, bool bDoHeight)
 
void SetCRS (vtCRS *proj)
 
- Public Member Functions inherited from vtStructure
void CopyFrom (const vtStructure &v)
 
void SetType (vtStructureType t)
 
vtStructureType GetType () const
 
void SetElevationOffset (float fOffset)
 
float GetElevationOffset () const
 
void SetAbsolute (bool b)
 
bool GetAbsolute () const
 
vtBuildingGetBuilding ()
 
vtFenceGetFence ()
 
vtStructInstanceGetInstance ()
 
void WriteTags (GZOutput &out) const
 
- Public Member Functions inherited from vtTagArray
void AddTag (const vtTag &pTag)
 
void AddTag (const char *name, const char *value)
 
vtTagFindTag (const char *szTagName)
 
const vtTagFindTag (const char *szTagName) const
 
vtTagGetTag (int index)
 
const vtTagGetTag (int index) const
 
uint NumTags () const
 
void RemoveTag (int index)
 
void RemoveTag (const char *szTagName)
 
void Clear ()
 
void SetValueString (const char *szTagName, const vtString &string, bool bCreating=false)
 
void SetValueBool (const char *szTagName, bool value, bool bCreating=false)
 
void SetValueInt (const char *szTagName, int value, bool bCreating=false)
 
void SetValueFloat (const char *szTagName, float value, bool bCreating=false)
 
void SetValueDouble (const char *szTagName, double value, bool bCreating=false)
 
void SetValueRGBi (const char *szTagName, const RGBi &value, bool bCreating=false)
 
const char * GetValueString (const char *szTagName, bool bSuppressWarning=false) const
 
bool GetValueBool (const char *szTagName) const
 
int GetValueInt (const char *szTagName) const
 
float GetValueFloat (const char *szTagName) const
 
double GetValueDouble (const char *szTagName) const
 
RGBi GetValueRGBi (const char *szTagName) const
 
bool GetValueString (const char *szTagName, vtString &string) const
 
bool GetValueBool (const char *szTagName, bool &bValue) const
 
bool GetValueInt (const char *szTagName, int &iValue) const
 
bool GetValueFloat (const char *szTagName, float &fValue) const
 
bool GetValueDouble (const char *szTagName, double &dValue) const
 
bool GetValueRGBi (const char *szTagName, RGBi &color) const
 
vtTagArrayoperator= (const vtTagArray &v)
 
bool operator== (const vtTagArray &v) const
 
bool operator!= (const vtTagArray &v) const
 
void CopyTagsFrom (const vtTagArray &v)
 
bool WriteToXML (const char *fname, const char *title) const
 
void WriteToXMLBody (FILE *fp, int iIndent) const
 
bool LoadFromXML (const char *fname)
 
virtual bool OverrideValue (const char *szTagName, const vtString &string)
 
virtual void WriteOverridesToXML (FILE *fp) const
 
void LogTags () const
 

Static Public Member Functions

static const char * GetEdgeFeatureString (int edgetype)
 
static int GetEdgeFeatureValue (const char *value)
 
- Static Public Member Functions inherited from vtTagArray
static void SetVerbose (bool value)
 

Protected Attributes

vtArray< vtLevel * > m_Levels
 
vtCRSm_pCRS
 
- Protected Attributes inherited from vtStructure
vtStructureType m_type
 
float m_fElevationOffset
 
bool m_bAbsolute
 
- Protected Attributes inherited from vtTagArray
std::vector< vtTagm_tags
 

Additional Inherited Members

- Static Protected Attributes inherited from vtTagArray
static bool s_bVerbose = false
 

Detailed Description

This class contains a parametric representation of a building.

The geometry is described by a series of levels (vtLevel), each of which contains a set of edges (vtEdge), which in turn are composed of edge features (vtEdgeFeature). These components can vary in color, material, size, and number, which gives a high-level representation of a building, which can be used to construct a reasonable (visually similar) model of the building.

Member Function Documentation

float vtBuilding::CalculateBaseElevation ( vtHeightField pHeightField)

Calculate the elevation at which this building should be placed on a given heightfield.

void vtBuilding::FlipFootprintDirection ( )

Flips the direction of the footprint, which is either clockwise or counterclockwise when viewed from above. This affects the footprints of all levels.

RGBi vtBuilding::GetColor ( BldColor  which) const

Get the color of the building. In the case of multi-colored buildings, note that this method returns only the first color encountered.

Parameters
whichCan be either BLD_BASIC (color of the building) or BLD_ROOF (color of the roof).
double vtBuilding::GetDistanceToInterior ( const DPoint2 point) const

Find the closest distance from a given point to the interior of a building's lowest footprint. If the point is inside the footprint, the value 0.0 is returned.

int vtBuilding::NumStories ( ) const

Get the total number of stories of this building. The top level is assumed to be a roof and does not count toward the total.

vtBuilding & vtBuilding::operator= ( const vtBuilding v)

Asignment operator, which makes an explicit copy the entire building including each level.

void vtBuilding::SetCircle ( const DPoint2 center,
float  fRad 
)

Sets the base footprint of the building to be a circle. A circle is represented by a 20-sided polygonal footprint.

Parameters
centerThe location of the building's center.
fRadThe radius of the building.
void vtBuilding::SetColor ( BldColor  which,
const RGBi color 
)

Set the colors of the building.

Parameters
whichCan be either BLD_BASIC (the overall color of the building) or BLD_ROOF (the overall color of the roof).
colorThe color to set.
void vtBuilding::SetFootprint ( int  lev,
const DLine2 foot 
)

Set the footprint of the given level of the building.

Parameters
levThe level, from 0 for the base level and up.
footThe footprint.
void vtBuilding::SetFootprint ( int  lev,
const DPolygon2 poly 
)

Set the footprintf of the given level of the building.

Parameters
levThe level, from 0 for the base level and up.
polyThe footprint.
void vtBuilding::SetNumStories ( int  iStories)

Set the height of the building in stories. If the building has no levels, two will be created: for the walls and the roof. If the number of stories is greater than before, the additional stories are added to the top-most non-roof level. If lesser, stories and levels are removed from the top down until the desired number is met.

Parameters
iStoriesNumber of stories to set.
void vtBuilding::SetRoofType ( RoofType  rt,
int  iSlope = -1,
int  iLev = -1 
)

Set the type of roof for this building. In cases of ambiguity, such as setting a gable roof, the method will try to make intelligent guesses about where to put the roof angles based the length of the roof edges.

Parameters
rtRoof type, one of:
  • ROOF_FLAT
  • ROOF_SHED
  • ROOF_GABLE
  • ROOF_HIP
iSlopeFor a non-flat roof, this is the slope in degrees of the sloped edges. This varies from 0 (horizontal) to 90 (vertical).
iLev(optional) The number of the level to assume is the roof. If omitted, the top level is assumed to be the roof.
void vtBuilding::TransformCoords ( OCTransform *  trans)

Transform the coodinates of this building (the footprints of each level) by the given coordinate transformation.