1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
/***********************************************/
/**
* @file border.cpp
*
* @brief Borders of an area on sphere/ellipsoid.
*
* @author Torsten Mayer-Guerr
* @date 2004-10-28
*
*/
/***********************************************/
#define DOCSTRING_Border
#include "base/import.h"
#include "config/configRegister.h"
#include "borderRectangle.h"
#include "borderCap.h"
#include "borderPolygon.h"
#include "borderGlobal.h"
#include "border.h"
/***********************************************/
GROOPS_REGISTER_CLASS(Border, "borderType",
BorderRectangle,
BorderCap,
BorderPolygon)
GROOPS_READCONFIG_UNBOUNDED_CLASS(Border, "borderType")
/***********************************************/
Border::Border(Config &config, const std::string &name)
{
try
{
std::string type;
while(readConfigChoice(config, name, type, Config::OPTIONAL, "", "borders of geographical areas"))
{
if(readConfigChoiceElement(config, "rectangle", type, "along lines of geographical coordinates"))
border.push_back(new BorderRectangle(config));
if(readConfigChoiceElement(config, "cap", type, "spherical cap"))
border.push_back(new BorderCap(config));
if(readConfigChoiceElement(config, "polygon", type, "polygon from file"))
border.push_back(new BorderPolygon(config));
endChoice(config);
if(isCreateSchema(config))
return;
};
if(border.empty())
border.push_back(new BorderGlobal());
}
catch(std::exception &e)
{
GROOPS_RETHROW(e)
}
}
/***********************************************/
Border::~Border()
{
for(UInt i=0; i<border.size(); i++)
delete border.at(i);
}
/***********************************************/
Bool Border::isInnerPoint(Angle lambda, Angle phi) const
{
Bool inner = border.at(0)->isExclude();
for(UInt i=0; i<border.size(); i++)
if(border.at(i)->isInnerPoint(lambda,phi))
inner = !border.at(i)->isExclude();
return inner;
}
/***********************************************/
Bool Border::isInnerPoint(const Vector3d &point, const Ellipsoid &ellipsoid) const
{
Angle L,B;
Double h;
ellipsoid(point, L, B, h);
return isInnerPoint(L, B);
}
/***********************************************/
|