Boundary.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A class that stores a 2D geometrical boundary
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef Boundary_h
00020 #define Boundary_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <iostream>
00033 #include <utility>
00034 #include "AbstractPoly.h"
00035 #include "Position2D.h"
00036 
00037 
00038 // ===========================================================================
00039 // class definitions
00040 // ===========================================================================
00045 class Boundary
00046             : public AbstractPoly {
00047 public:
00049     Boundary();
00050 
00052     Boundary(SUMOReal x1, SUMOReal y1, SUMOReal x2, SUMOReal y2);
00053 
00055     ~Boundary();
00056 
00058     void reset();
00059 
00061     void add(SUMOReal x, SUMOReal y);
00062 
00064     void add(const Position2D &p);
00065 
00067     void add(const Boundary &p);
00068 
00070     Position2D getCenter() const;
00071 
00073     SUMOReal xmin() const;
00074 
00076     SUMOReal xmax() const;
00077 
00079     SUMOReal ymin() const;
00080 
00082     SUMOReal ymax() const;
00083 
00085     SUMOReal getWidth() const;
00086 
00088     SUMOReal getHeight() const;
00089 
00091     bool around(const Position2D &p, SUMOReal offset=0) const;
00092 
00094     bool overlapsWith(const AbstractPoly &poly, SUMOReal offset=0) const;
00095 
00097     bool partialWithin(const AbstractPoly &poly, SUMOReal offset=0) const;
00098 
00100     bool crosses(const Position2D &p1, const Position2D &p2) const;
00101 
00102 
00106     Boundary &grow(SUMOReal by);
00107 
00109     void flipY();
00110 
00112     void set(SUMOReal xmin, SUMOReal ymin, SUMOReal xmax, SUMOReal ymax);
00113 
00115     void moveby(SUMOReal x, SUMOReal y);
00116 
00118     friend std::ostream &operator<<(std::ostream &os, const Boundary &b);
00119 
00120 private:
00122     SUMOReal myXmin,myXmax, myYmin, myYmax;
00123 
00125     bool myWasInitialised;
00126 
00127 };
00128 
00129 
00130 #endif
00131 
00132 /****************************************************************************/
00133 

Generated on Wed May 5 00:06:28 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6