Main Page   Class Hierarchy   Compound List   File List   Compound Members  

BuildingArray.h

00001 //
00002 // BuildingArray.h
00003 //
00004 // Copyright (c) 2001 Virtual Terrain Project
00005 // Free for all uses, see license.txt for details.
00006 //
00007 
00008 #ifndef BUILDINGARRAYH
00009 #define BUILDINGARRAYH
00010 
00011 #include "MathTypes.h"
00012 #include "Projections.h"
00013 #include "Building.h"
00014 #include <stdio.h>
00015 
00016 #define BCFVERSION_CURRENT      1.2f
00017 #define BCFVERSION_SUPPORTED    1.1f
00018 
00019 // BCF file format version history
00020 //
00021 // 1.0 first version, just a list of xy floats
00022 // 1.1 first numbered version, real structure with flexible number of fields
00023 // 1.2 added utm_zone field at top of file
00024 
00025 /*****
00026  *
00027  * Name: vtBuildingArray
00028  * Parent: Array<vtBuildingPtr>
00029  *
00030  * Description:
00031  *  Array of Buildings
00032  *
00033  *****/
00034 class vtBuildingArray : public Array<vtBuildingPtr> 
00035 {
00036 public:
00037     ~vtBuildingArray() { Empty(); }
00038     virtual void DestructItems(int first, int last);    // override
00039 
00040     void AddBuilding(vtBuildingPtr bld) { Append(bld); }
00041     void Remove(int index, DPoint2 &thepoint)   // remove a specific coordinate 
00042     {
00043         // grab the point out of the array
00044         thepoint = GetAt(index)->GetLocation();
00045         RemoveAt(index, 1);
00046     }
00047     void DeleteSelected();
00048 
00049     bool ReadSHP(const char* pathname);
00050     bool ReadBCF(const char* pathname);         // read a .bcf file
00051     bool WriteSHP(const char* pathname);
00052     bool WriteBCF(const char* pathname);        // write to a .bcf file
00053     bool ReadBCF_Old(FILE *fp);
00054 
00055     int IsBuildingThere(DPoint2 point, double error);//checks to see if a coordinate (within
00056                                                     //the given spatial error) is in the array
00057     bool FindClosestCorner(DPoint2 point, double error,
00058                            int &building, int &corner, double &distance);
00059     bool FindClosestCenter(DPoint2 point, double error,
00060                            int &building, double &distance);
00061 
00062     bool IsEmpty() { return (GetSize() == 0); }
00063     void GetExtents(DRECT &ext);
00064 
00065     // selection
00066     int NumSelected();
00067     void DeselectAll();
00068 
00069     // override this so that the BuildingArray base methods can be capable
00070     // of handling subclasses of vtBuilding
00071     virtual vtBuilding *NewBuilding() { return new vtBuilding; }
00072 //  vtBuilding *GetBuilding(int i) { return GetAt(i); }
00073 
00074     vtProjection m_proj;
00075 protected:
00076 };
00077 
00078 #endif

Generated at Fri Aug 17 14:40:42 2001 for vtdata library by doxygen1.2.4 written by Dimitri van Heesch, © 1997-2000