00001
00011 #ifndef SPATIALSIMOBJECTPOPULATION_H
00012 #define SPATIALSIMOBJECTPOPULATION_H
00013
00014 #include "SimNetwork.h"
00015 #include "Point3DSet.h"
00016 #include "SimObjectPopulation.h"
00017 #include "SubSpaceConstraint.h"
00018
00020 class SpatialSimObjectPopulation : public SimObjectPopulation {
00021
00022 protected:
00023
00025 SpatialSimObjectPopulation( ) : SimObjectPopulation() { }
00026 ;
00027
00029 SpatialSimObjectPopulation( SimNetwork &net ) : SimObjectPopulation(net) { }
00030 ;
00031
00033 SpatialSimObjectPopulation( SimNetwork &net, shared_ptr<Point3DSet> locs ) : SimObjectPopulation(net), locations(locs) { }
00034 ;
00035
00036 public:
00037
00038 SpatialSimObjectPopulation( SimNetwork &net, SimObjectFactory &objFactory, shared_ptr<Point3DSet> locs )
00039 : SimObjectPopulation( net, objFactory, locs->size() ), locations(locs) {
00040
00041 };
00042
00043 SpatialSimObjectPopulation( SimNetwork &net, SimObjectFactory &objFactory, size_t n )
00044 : SimObjectPopulation(net,objFactory,n), locations( new Point3DSet( n ) ) {
00045
00046 };
00047
00048 SpatialSimObjectPopulation( SimNetwork &net, const SimObject::ID::Vector v )
00049 : SimObjectPopulation(net, v), locations( new Point3DSet( v->size() ) ) {
00050
00051 };
00052
00053 SpatialSimObjectPopulation( SimNetwork &net, vector< SimObject::ID::Packed > const& v )
00054 : SimObjectPopulation( net, v ), locations( new Point3DSet( v.size() ) ) {
00055
00056 }
00057
00058 SpatialSimObjectPopulation( SimNetwork &net, vector< SimObject::ID::Packed > const& v, shared_ptr<Point3DSet> locs )
00059 : SimObjectPopulation( net, v ), locations( new Point3DSet( v.size() ) ) {
00060
00061 }
00062
00063 ~SpatialSimObjectPopulation();
00064
00066 SimObject::ID getIdAt( Point3D<double> const &p );
00067
00069 SimObject::ID getIdAt( double const& x, double const& y, double const& z );
00070
00072 SimObject* objectAt( Point3D<double> const& p );
00073
00075 SimObject* objectAt( double const& x, double const& y, double const& z );
00076
00078 virtual Point3D<double> getLocation( size_t index ) const;
00079
00081
00085 virtual shared_ptr<SpatialSimObjectPopulation> subPopulation( SubSpaceConstraint const& cnstr );
00086
00087 protected:
00088
00090 shared_ptr<Point3DSet> locations;
00091
00093 virtual SpatialSimObjectPopulation* new_subset( vector< size_t > const& indices ) const;
00094
00095
00096 };
00097
00098 #endif