1
0
Fork 0

moving texparams header from genapt to poly library. Need it for new construct.

This commit is contained in:
PSadrozinski 2011-12-14 21:12:11 -05:00 committed by Christian Schmitt
parent 18b2c8a51a
commit 9add3fdaae
29 changed files with 77 additions and 244 deletions

View file

@ -17,7 +17,6 @@ add_executable(genapts
rwy_simple.cxx rwy_simple.hxx
rwy_visual.cxx rwy_visual.hxx
taxiway.cxx taxiway.hxx
texparams.hxx
)
target_link_libraries(genapts

View file

@ -54,6 +54,7 @@
#include <Polygon/index.hxx>
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Polygon/texparams.hxx>
#include <Triangulate/trieles.hxx>
#include "apt_surface.hxx"
@ -69,7 +70,6 @@
#include "rwy_simple.hxx"
#include "rwy_visual.hxx"
#include "taxiway.hxx"
#include "texparams.hxx"
#include "build.hxx"

View file

@ -28,9 +28,9 @@
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Polygon/texparams.hxx>
#include "runway.hxx"
#include "texparams.hxx"
// generate runway lighting

View file

@ -28,9 +28,9 @@
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Polygon/texparams.hxx>
#include "runway.hxx"
#include "texparams.hxx"
void gen_number_block( const TGRunway& rwy_info,

View file

@ -28,9 +28,9 @@
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Polygon/texparams.hxx>
#include "runway.hxx"
#include "texparams.hxx"
// generate a non-precision approach runway. The routine modifies

View file

@ -28,9 +28,9 @@
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Polygon/texparams.hxx>
#include "runway.hxx"
#include "texparams.hxx"
// generate a precision approach runway. The routine modifies

View file

@ -28,7 +28,6 @@
#include "poly_extra.hxx"
#include "rwy_common.hxx"
#include "texparams.hxx"
#include "rwy_nonprec.hxx"
using std::string;

View file

@ -28,9 +28,9 @@
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Polygon/texparams.hxx>
#include "runway.hxx"
#include "texparams.hxx"
// generate a simple runway. The routine modifies rwy_polys,

View file

@ -28,9 +28,9 @@
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Polygon/texparams.hxx>
#include "runway.hxx"
#include "texparams.hxx"
// generate a visual approach runway. The routine modifies rwy_polys,

View file

@ -28,7 +28,6 @@
#include "poly_extra.hxx"
#include "rwy_common.hxx"
#include "texparams.hxx"
#include "taxiway.hxx"
using std::string;

View file

@ -28,9 +28,9 @@
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Polygon/texparams.hxx>
#include "runway.hxx"
#include "texparams.hxx"
// generate a taxiway. The routine modifies rwy_polys, texparams, and

View file

@ -15,12 +15,10 @@ add_executable(genapts850
object.hxx object.cxx
parser.hxx parser.cxx
point2d.cxx point2d.hxx
poly_extra.cxx poly_extra.hxx
runway.cxx runway.hxx
rwy_simple.cxx
rwy_gen.cxx
rwy_common.cxx
texparams.hxx
)
target_link_libraries(genapts850

View file

@ -17,14 +17,17 @@
#include <simgear/misc/texcoord.hxx>
#include <Polygon/polygon.hxx>
#include <Polygon/texparams.hxx>
#include <Polygon/superpoly.hxx>
#include <Polygon/texparams.hxx>
#include <Polygon/chop.hxx>
#include <Geometry/poly_support.hxx>
#include <Geometry/poly_extra.hxx>
#include <Output/output.hxx>
#include "elevations.hxx"
#include "poly_extra.hxx"
Airport::Airport( int c, char* def)
{
@ -461,8 +464,8 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
TGPolygon filled_base = tgPolygonStripHoles( apt_base );
TGPolygon divided_base = tgPolygonSplitLongEdges( filled_base, 200.0 );
TGPolygon base_poly = tgPolygonDiff( filled_base, accum );
//TGPolygon base_poly = tgPolygonDiff( divided_base, accum );
//TGPolygon base_poly = tgPolygonDiff( filled_base, accum );
TGPolygon base_poly = tgPolygonDiff( divided_base, accum );
gettimeofday(&build_end, NULL);
timersub(&build_end, &build_start, &build_time);

View file

@ -22,8 +22,6 @@
#include "apt_math.hxx"
#include "global.hxx"
#include "poly_extra.hxx"
#include <stdlib.h>

View file

@ -6,8 +6,8 @@
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Polygon/texparams.hxx>
#include <Geometry/point3d.hxx>
#include "texparams.hxx"
using std::string;

View file

@ -6,9 +6,9 @@
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Geometry/point3d.hxx>
#include <Polygon/texparams.hxx>
#include "texparams.hxx"
#include <Geometry/point3d.hxx>
using std::string;

View file

@ -21,8 +21,7 @@
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include "texparams.hxx"
#include <Polygon/texparams.hxx>
class Helipad
{

View file

@ -3,9 +3,9 @@
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Geometry/point3d.hxx>
#include <Polygon/texparams.hxx>
#include "texparams.hxx"
#include <Geometry/point3d.hxx>
using std::string;

View file

@ -6,9 +6,9 @@
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Geometry/point3d.hxx>
#include <Polygon/texparams.hxx>
#include "texparams.hxx"
#include <Geometry/point3d.hxx>
using std::string;

View file

@ -16,7 +16,6 @@ void LightingObj::BuildBtg( int alt_m, superpoly_list* lights )
Point3D ref;
double lon2 = 0, lat2 = 0, r;
double left_hdg = heading - 90.0;
if ( left_hdg < 0 ) { left_hdg += 360.0; }

View file

@ -6,10 +6,9 @@
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Polygon/texparams.hxx>
#include <Geometry/point3d.hxx>
#include "texparams.hxx"
using std::string;
class LightingObj
@ -29,4 +28,4 @@ void BuildBtg( int alt_m, superpoly_list* lights );
};
typedef std::vector <LightingObj *> LightingObjList;
#endif
#endif

View file

@ -1,117 +0,0 @@
// poly_extra.cxx -- Extra polygon manipulation routines
//
// Written by Curtis Olson, started February 2002.
//
// Copyright (C) 2002 Curtis L. Olson - http://www.flightgear.org/~curt
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id: poly_extra.cxx,v 1.9 2004-11-19 22:25:49 curt Exp $
//
#include <stdio.h>
#include <simgear/compiler.h>
#include <simgear/debug/logstream.hxx>
#include <Geometry/poly_support.hxx>
#include "poly_extra.hxx"
// Divide segment if there are other existing points on it, return the
// new polygon
void add_intermediate_nodes( int contour, const Point3D& start,
const Point3D& end, const TGTriNodes& tmp_nodes,
TGPolygon *result )
{
point_list nodes = tmp_nodes.get_node_list();
// SG_LOG(SG_GENERAL, SG_DEBUG, " add_intermediate_nodes()");
char buf[200];
snprintf(buf, 199, " %.7f %.7f %.7f <=> %.7f %.7f %.7f\n",
start.x(), start.y(), start.z(), end.x(), end.y(), end.z() );
SG_LOG(SG_GENERAL, SG_BULK, buf);
Point3D new_pt;
bool found_extra = find_intermediate_node( start, end, nodes, &new_pt );
if ( found_extra ) {
// recurse with two sub segments
// SG_LOG(SG_GENERAL, SG_DEBUG, "dividing " << p0 << " " << nodes[extra_index]
// << " " << p1);
add_intermediate_nodes( contour, start, new_pt, tmp_nodes,
result );
result->add_node( contour, new_pt );
SG_LOG(SG_GENERAL, SG_BULK, " adding = " << new_pt);
add_intermediate_nodes( contour, new_pt, end, tmp_nodes,
result );
} else {
// this segment does not need to be divided
}
}
// Search each segment for additional vertex points that may have been
// created elsewhere that lie on the segment and split it there to
// avoid "T" intersections.
TGPolygon add_nodes_to_poly( const TGPolygon& poly,
const TGTriNodes& tmp_nodes ) {
int i, j;
TGPolygon result; result.erase();
Point3D p0, p1;
// SG_LOG(SG_GENERAL, SG_DEBUG, "add_nodes_to_poly");
for ( i = 0; i < poly.contours(); ++i ) {
// SG_LOG(SG_GENERAL, SG_DEBUG, "contour = " << i);
for ( j = 0; j < poly.contour_size(i) - 1; ++j ) {
p0 = poly.get_pt( i, j );
p1 = poly.get_pt( i, j + 1 );
// add start of segment
result.add_node( i, p0 );
// add intermediate points
add_intermediate_nodes( i, p0, p1, tmp_nodes, &result );
// end of segment is beginning of next segment
}
p0 = poly.get_pt( i, poly.contour_size(i) - 1 );
p1 = poly.get_pt( i, 0 );
// add start of segment
result.add_node( i, p0 );
// add intermediate points
add_intermediate_nodes( i, p0, p1, tmp_nodes, &result );
// end of segment is beginning of next segment
// 5/9/2000 CLO - this results in duplicating the last point
// of a contour so I have removed this line.
// result.add_node( i, p1 );
// maintain original hole flag setting
result.set_hole_flag( i, poly.get_hole_flag( i ) );
}
return result;
}

View file

@ -1,50 +0,0 @@
// poly_extra.hxx -- Extra polygon manipulation routines
//
// Written by Curtis Olson, started February 2002.
//
// Copyright (C) 2002 Curtis L. Olson - http://www.flightgear.org/~curt
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// $Id: poly_extra.hxx,v 1.5 2004-11-19 22:25:49 curt Exp $
//
#ifndef _POLY_EXTRA_HXX
#define _POLY_EXTRA_HXX
#include <Geometry/point3d.hxx>
#include <Geometry/trinodes.hxx>
#include <Polygon/polygon.hxx>
// Divide segment if there are other existing points on it, return the
// new polygon
void add_intermediate_nodes( int contour, const Point3D& start,
const Point3D& end, const TGTriNodes& tmp_nodes,
TGPolygon *result );
// Search each segment for additional vertex points that may have been
// created elsewhere that lie on the segment and split it there to
// avoid "T" intersections.
TGPolygon add_nodes_to_poly( const TGPolygon& poly,
const TGTriNodes& tmp_nodes );
#endif // _POLY_EXTRA_HXX

View file

@ -6,10 +6,10 @@
#include <Polygon/polygon.hxx>
#include <Polygon/superpoly.hxx>
#include <Polygon/texparams.hxx>
#include <Geometry/point3d.hxx>
#include "apt_math.hxx"
#include "texparams.hxx"
using std::string;

View file

@ -27,7 +27,6 @@
#include "apt_math.hxx"
#include "global.hxx"
#include "poly_extra.hxx"
#include "runway.hxx"
#include <stdlib.h>

View file

@ -112,7 +112,7 @@ void Runway::gen_rw_marking( const TGPolygon& runway,
//Now create the sections of the runway type
double length = rwy.length / 2.0;
for ( int i=0; i < rw_marking_list.size(); ++i) {
for ( unsigned int i=0; i < rw_marking_list.size(); ++i) {
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway section texture = " << rw_marking_list[i].tex << " lenght: " << rw_marking_list[i].size);
if ( end1_pct < 1.0 ) {
@ -340,7 +340,8 @@ void Runway::BuildShoulder( float alt_m,
ClipPolyType *accum )
{
string shoulder_surface = "";
double shoulder_width;
double shoulder_width = 0.0f;
if (rwy.shoulder > 0){ // Add a shoulder to the runway
shoulder_width = rwy.width * 0.15;
if (shoulder_width > 8.0){
@ -363,48 +364,54 @@ void Runway::BuildShoulder( float alt_m,
SG_LOG(SG_GENERAL, SG_DEBUG, "Shoulder width = " << shoulder_width );
SG_LOG(SG_GENERAL, SG_DEBUG, "Shoulder surface is: " << shoulder_surface );
double lat, lon,r;
// Create both shoulder sides
for (int i=0; i<2; ++i){
double step;
double lat, lon,r;
if (shoulder_width > 0.0f) {
// Create both shoulder sides
for (int i=0; i<2; ++i){
double step;
double lat = 0.0f, lon = 0.0f, r;
if (i == 0){
step= (rwy.width + shoulder_width)*0.5;
} else if (i == 1) {
step= -(rwy.width + shoulder_width)*0.5;
/* nudge the shoulders so the really long lines overlap the runway a bit */
/* If the are 'equal' there's a good chance roundoff error can create a */
/* REALY thin long polygon, which causes a segfault */
if (i == 0){
step= (rwy.width + shoulder_width)*0.5 - 0.00001;
} else if (i == 1) {
step= -(rwy.width + shoulder_width)*0.5 + 0.00001;
}
double left_hdg = rwy.heading - 90.0;
if ( left_hdg < 0 ) { left_hdg += 360.0; }
geo_direct_wgs_84 ( alt_m, rwy.lat[0], rwy.lon[0], left_hdg,
step, &lat, &lon, &r );
Point3D shoulder1 = Point3D( lon, lat, 0.0f );
geo_direct_wgs_84 ( alt_m, rwy.lat[1], rwy.lon[1], left_hdg,
step, &lat, &lon, &r );
Point3D shoulder2 = Point3D( lon, lat, 0.0f );
TGPolygon shoulder = gen_wgs84_area( shoulder1, shoulder2, 0.0, 0.0, 0.0, shoulder_width, rwy.heading, alt_m, false);
TGSuperPoly sp;
TGTexParams tp;
TGPolygon clipped = tgPolygonDiff( shoulder, *accum );
TGPolygon split = tgPolygonSplitLongEdges( clipped, 400.0 );
sp.erase();
sp.set_poly( split );
sp.set_material( shoulder_surface );
rwy_polys->push_back( sp );
*accum = tgPolygonUnion( shoulder, *accum );
tp = TGTexParams( shoulder.get_pt(0,0), shoulder_width , rwy.length + 2, rwy.heading );
if (i == 1){
tp.set_maxu(0);
tp.set_minu(1);
}
texparams->push_back( tp );
}
double left_hdg = rwy.heading - 90.0;
if ( left_hdg < 0 ) { left_hdg += 360.0; }
geo_direct_wgs_84 ( alt_m, rwy.lat[0], rwy.lon[0], left_hdg,
step, &lat, &lon, &r );
Point3D shoulder1 = Point3D( lon, lat, 0.0f );
geo_direct_wgs_84 ( alt_m, rwy.lat[1], rwy.lon[1], left_hdg,
step, &lat, &lon, &r );
Point3D shoulder2 = Point3D( lon, lat, 0.0f );
TGPolygon shoulder = gen_wgs84_area( shoulder1, shoulder2, 0.0, 0.0, 0.0, shoulder_width, rwy.heading, alt_m, false);
TGSuperPoly sp;
TGTexParams tp;
TGPolygon clipped = tgPolygonDiff( shoulder, *accum );
TGPolygon split = tgPolygonSplitLongEdges( clipped, 400.0 );
sp.erase();
sp.set_poly( split );
sp.set_material( shoulder_surface );
rwy_polys->push_back( sp );
*accum = tgPolygonUnion( shoulder, *accum );
tp = TGTexParams( shoulder.get_pt(0,0), shoulder_width , rwy.length + 2, rwy.heading );
if (i == 1){
tp.set_maxu(0);
tp.set_minu(1);
}
texparams->push_back( tp );
}
}

View file

@ -25,7 +25,6 @@
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
#include <Polygon/superpoly.hxx>
#include "texparams.hxx"
#include "runway.hxx"
using std::string;

View file

@ -843,6 +843,8 @@ TGPolygon tgPolygonSplitLongEdges( const TGPolygon &poly, double max_len ) {
result.set_hole_flag( i, poly.get_hole_flag( i ) );
}
SG_LOG(SG_GENERAL, SG_DEBUG, "split_long_edges() complete");
return result;
}