diff --git a/src/Lib/Geometry/line.cxx b/src/Lib/Geometry/line.cxx index 1989953f..33ec091f 100644 --- a/src/Lib/Geometry/line.cxx +++ b/src/Lib/Geometry/line.cxx @@ -7,6 +7,8 @@ #include "line.hxx" +namespace tg { + Line::Line () { } @@ -73,4 +75,6 @@ Line::getBounds () const return bounds; } +}; + // end of line.cxx diff --git a/src/Lib/Geometry/line.hxx b/src/Lib/Geometry/line.hxx index 24e778ac..94f7b6fe 100644 --- a/src/Lib/Geometry/line.hxx +++ b/src/Lib/Geometry/line.hxx @@ -19,6 +19,7 @@ SG_USING_STD(vector); #include "rectangle.hxx" +namespace tg { /** * A simple multi-segment line class. @@ -87,4 +88,6 @@ private: vector<Point3D> _points; }; +}; + #endif // __LINE_HXX diff --git a/src/Lib/Geometry/rectangle.cxx b/src/Lib/Geometry/rectangle.cxx index 5622d3a9..86215516 100644 --- a/src/Lib/Geometry/rectangle.cxx +++ b/src/Lib/Geometry/rectangle.cxx @@ -6,6 +6,8 @@ #include "rectangle.hxx" +namespace tg { + Rectangle::Rectangle () { } @@ -81,4 +83,6 @@ Rectangle::toPoly () const return poly; } +}; + // end of rectangle.cxx diff --git a/src/Lib/Geometry/rectangle.hxx b/src/Lib/Geometry/rectangle.hxx index 3c7ead73..9dab7df7 100644 --- a/src/Lib/Geometry/rectangle.hxx +++ b/src/Lib/Geometry/rectangle.hxx @@ -16,6 +16,7 @@ #include <Polygon/polygon.hxx> +namespace tg { /** * A simple rectangle class for bounding rectanglees. @@ -132,4 +133,6 @@ private: Point3D _max; }; +}; + #endif // __RECTANGLE_HXX diff --git a/src/Lib/Geometry/util.cxx b/src/Lib/Geometry/util.cxx index c959655d..369dcf06 100644 --- a/src/Lib/Geometry/util.cxx +++ b/src/Lib/Geometry/util.cxx @@ -12,6 +12,8 @@ #include <Polygon/polygon.hxx> +namespace tg { + bool getIntersection (const Point3D &p0, const Point3D &p1, @@ -205,4 +207,6 @@ parseChunk (const string &s) return bounds; } +}; + // end of util.cxx diff --git a/src/Lib/Geometry/util.hxx b/src/Lib/Geometry/util.hxx index cb3815fa..fe105204 100644 --- a/src/Lib/Geometry/util.hxx +++ b/src/Lib/Geometry/util.hxx @@ -21,6 +21,8 @@ SG_USING_STD(string); #include "line.hxx" +namespace tg { + /** * Inline function to clamp an angle between 0 and 360 degrees. @@ -104,5 +106,6 @@ Rectangle makeBounds (const FGPolygon &polygon); */ Rectangle parseChunk (const string &s); +}; #endif // __UTIL_HXX diff --git a/src/Prep/E00Lines/main.cxx b/src/Prep/E00Lines/main.cxx index eca4e4af..d84be878 100644 --- a/src/Prep/E00Lines/main.cxx +++ b/src/Prep/E00Lines/main.cxx @@ -65,7 +65,7 @@ SG_USING_STD(vector); /** * Make a bounding box for a single ARC. */ -static const Rectangle +static const tg::Rectangle makeBounds (const E00::ARC &arc) { Point3D min, max; @@ -81,17 +81,17 @@ makeBounds (const E00::ARC &arc) if (y > max.y()) max.sety(y); } } - return Rectangle(min, max); + return tg::Rectangle(min, max); } /** * Make a bounding box for a polygon. */ -static const Rectangle +static const tg::Rectangle makeBounds (const E00::PAL &pal) { - return Rectangle(Point3D(pal.min.x, pal.min.y, 0), - Point3D(pal.max.x, pal.max.y, 0)); + return tg::Rectangle(Point3D(pal.min.x, pal.min.y, 0), + Point3D(pal.max.x, pal.max.y, 0)); } @@ -163,7 +163,7 @@ checkAttribute (const E00 &data, int index, const Attribute &att) * uses the WGS80 functions, rather than simple Pythagorean stuff. */ static void -processPoints (const E00 &data, const Rectangle &bounds, +processPoints (const E00 &data, const tg::Rectangle &bounds, AreaType areaType, const string &workDir, int width) { double x, y, az; @@ -180,7 +180,7 @@ processPoints (const E00 &data, const Rectangle &bounds, continue; } - makePolygon(p, width, shape); + tg::makePolygon(p, width, shape); split_polygon(workDir, areaType, shape); } } @@ -196,7 +196,7 @@ processPoints (const E00 &data, const Rectangle &bounds, * uses the WGS80 functions, rather than simple Pythagorean stuff. */ static void -processLines (const E00 &data, const Rectangle &bounds, +processLines (const E00 &data, const tg::Rectangle &bounds, AreaType areaType, const string &workDir, int width, const vector<Attribute> &aat_list) { @@ -205,7 +205,7 @@ processLines (const E00 &data, const Rectangle &bounds, for (int i = 1; i <= nLines; i++) { FGPolygon shape; const E00::ARC &arc = data.getARC(i); - Rectangle arcBounds = makeBounds(arc); + tg::Rectangle arcBounds = makeBounds(arc); if (!bounds.isOverlapping(arcBounds)) { cout << "Arc " << i << " outside of area; skipping" << endl; continue; @@ -228,7 +228,7 @@ processLines (const E00 &data, const Rectangle &bounds, } } - Line line; + tg::Line line; int j; for (j = 0; j < arc.numberOfCoordinates; j++) { line.addPoint(Point3D(arc.coordinates[j].x, @@ -236,7 +236,7 @@ processLines (const E00 &data, const Rectangle &bounds, 0)); } - makePolygon(line, width, shape); + tg::makePolygon(line, width, shape); // Split into tiles cout << "Splitting polygon..." << endl; @@ -254,7 +254,7 @@ processLines (const E00 &data, const Rectangle &bounds, * Import all polygons. */ static void -processPolygons (const E00 &data, const Rectangle &bounds, +processPolygons (const E00 &data, const tg::Rectangle &bounds, AreaType areaType, const string &workDir, const vector<Attribute> pat_list) { @@ -283,7 +283,7 @@ processPolygons (const E00 &data, const Rectangle &bounds, int contour = 0; const E00::PAL &pal = data.getPAL(i); - Rectangle palBounds = makeBounds(pal); + tg::Rectangle palBounds = makeBounds(pal); if (!bounds.isOverlapping(palBounds)) { cout << "Polygon " << i << " outside of area, skipping" << endl; continue; @@ -381,7 +381,7 @@ main (int argc, const char **argv) // Default values - Rectangle bounds(Point3D(-180.0, -90.0, 0), + tg::Rectangle bounds(Point3D(-180.0, -90.0, 0), Point3D(180.0, 90.0, 0)); AreaType areaType = DefaultArea; int pointWidth = 500; diff --git a/src/Prep/TGVPF/tgvpf.cxx b/src/Prep/TGVPF/tgvpf.cxx index 17f41941..b81e94d3 100644 --- a/src/Prep/TGVPF/tgvpf.cxx +++ b/src/Prep/TGVPF/tgvpf.cxx @@ -83,10 +83,10 @@ vpf2tg (const VpfPoint &p) /** * Convert a VPF line to a regular TerraGear line. */ -static const Line +static const tg::Line vpf2tg (const VpfLine &l) { - Line result; + tg::Line result; int nPoints = l.getPointCount(); for (int i = 0; i < nPoints; i++) result.addPoint(vpf2tg(l.getPoint(i))); @@ -97,10 +97,10 @@ vpf2tg (const VpfLine &l) /** * Convert a VPF rectangle to a TerraGear rectangle. */ -static inline const Rectangle +static inline const tg::Rectangle vpf2tg (const VpfRectangle &rect) { - return Rectangle(Point3D(rect.minX, rect.minY, 0), + return tg::Rectangle(Point3D(rect.minX, rect.minY, 0), Point3D(rect.maxX, rect.maxY, 0)); } @@ -188,7 +188,7 @@ checkAttribute (const VpfFeature &feature, int index, const Attribute &att) static double getArea (const FGPolygon &polygon) { - Rectangle bounds = makeBounds(polygon); + tg::Rectangle bounds = tg::makeBounds(polygon); Point3D min = sgGeodToCart(Point3D(bounds.getMin().x() * SGD_DEGREES_TO_RADIANS, bounds.getMin().y() * SGD_DEGREES_TO_RADIANS, @@ -281,7 +281,7 @@ main (int argc, const char **argv) // Default values - Rectangle bounds(Point3D(-180, -90, 0), Point3D(180, 90, 0)); + tg::Rectangle bounds(Point3D(-180, -90, 0), Point3D(180, 90, 0)); bool invert = false; AreaType material_type = DefaultArea; int width = -1; // use default @@ -298,7 +298,7 @@ main (int argc, const char **argv) string arg = argv[argPos]; if (arg.find("--chunk=") == 0) { - bounds = parseChunk(arg.substr(8)); + bounds = tg::parseChunk(arg.substr(8)); argPos++; } @@ -478,11 +478,11 @@ main (int argc, const char **argv) const Point3D p = vpf2tg(feature.getPoint(i)); if (!bounds.isInside(p)) continue; - makePolygon(p, (width == -1 ? 500 : width), shape); + tg::makePolygon(p, (width == -1 ? 500 : width), shape); break; } case VpfFeature::LINE: { - const Line line = vpf2tg(feature.getLine(i)); + const tg::Line line = vpf2tg(feature.getLine(i)); if (!bounds.isOverlapping(line.getBounds())) continue; makePolygon(line, (width == -1 ? 50 : width), shape); @@ -507,7 +507,7 @@ main (int argc, const char **argv) const Point3D p = vpf2tg(feature.getLabel(i).getPoint()); if (!bounds.isInside(p)) continue; - makePolygon(p, (width == -1 ? 500 : width), shape); + tg::makePolygon(p, (width == -1 ? 500 : width), shape); break; } default: diff --git a/src/Prep/UserDef/tguserdef.cxx b/src/Prep/UserDef/tguserdef.cxx index 9ec7d23d..99f64f6d 100644 --- a/src/Prep/UserDef/tguserdef.cxx +++ b/src/Prep/UserDef/tguserdef.cxx @@ -21,7 +21,7 @@ SG_USING_STD(vector); static string prog_name; static string work_dir = "."; -static Rectangle bounds(Point3D(-180, -90, 0), Point3D(180, 90, 0)); +static tg::Rectangle bounds(Point3D(-180, -90, 0), Point3D(180, 90, 0)); static FGPolygon bounds_poly; @@ -63,7 +63,7 @@ add_point (SGPropertyNode_ptr node) if (s != 0) SG_LOG(SG_TERRAIN, SG_WARN, "More than one vertex supplied for point"); FGPolygon poly; - makePolygon(p, node->getIntValue("width", 500), poly); + tg::makePolygon(p, node->getIntValue("width", 500), poly); poly = polygon_int(poly, bounds_poly); split_polygon(".", material, poly); } @@ -76,7 +76,7 @@ add_line (SGPropertyNode_ptr node) const char * s = node->getStringValue("v"); Point3D p; - Line line; + tg::Line line; s = parse_point(s, p); while (s != 0) { line.addPoint(p); @@ -135,7 +135,7 @@ main (int ac, char ** av) string arg = av[argPos]; if (arg.find("--chunk=") == 0) { - bounds = parseChunk(arg.substr(8)); + bounds = tg::parseChunk(arg.substr(8)); argPos++; }