From ecbfc64b14418639c0c578abee934d73470ddaa3 Mon Sep 17 00:00:00 2001 From: PSadrozinski Date: Wed, 28 Sep 2011 20:25:00 -0400 Subject: [PATCH] Added per linear feature width capability, so double lines are twice as wide, etc... --- src/Airports/GenAirports850/airport.cxx | 4 + src/Airports/GenAirports850/closedpoly.cxx | 6 +- src/Airports/GenAirports850/linearfeature.cxx | 150 +++++++++++------- src/Airports/GenAirports850/linearfeature.hxx | 6 +- src/Airports/GenAirports850/parser.cxx | 4 +- 5 files changed, 102 insertions(+), 68 deletions(-) diff --git a/src/Airports/GenAirports850/airport.cxx b/src/Airports/GenAirports850/airport.cxx index ab33dd5b..e26d45d5 100644 --- a/src/Airports/GenAirports850/airport.cxx +++ b/src/Airports/GenAirports850/airport.cxx @@ -244,6 +244,10 @@ static TGPolygon linear_feature_tex_coords( const TGPolygon& in_poly, const TGTe tmp = x / width; tx = tmp * (maxu - minu) + minu; + + if ( tx < -1.0 ) { tx = -1.0; } + if ( tx > 1.0 ) { tx = 1.0; } + SG_LOG(SG_GENERAL, SG_DEBUG, " (" << tx << ")"); /* diff --git a/src/Airports/GenAirports850/closedpoly.cxx b/src/Airports/GenAirports850/closedpoly.cxx index b8a17d00..75563c50 100644 --- a/src/Airports/GenAirports850/closedpoly.cxx +++ b/src/Airports/GenAirports850/closedpoly.cxx @@ -65,7 +65,7 @@ void ClosedPoly::AddNode( BezNode* node ) } SG_LOG(SG_GENERAL, SG_DEBUG, " Adding node (" << node->GetLoc().x() << "," << node->GetLoc().y() << ") to current linear feature " << cur_marking); - cur_marking = new LinearFeature(marking_desc, 1.5f, 0.6f ); + cur_marking = new LinearFeature(marking_desc, 1.0f ); } cur_marking->AddNode( node ); } @@ -622,12 +622,12 @@ int ClosedPoly::BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list sp.erase(); sp.set_poly( split ); sp.set_material( material ); - sp.set_flag("taxi"); + //sp.set_flag("taxi"); rwy_polys->push_back( sp ); SG_LOG(SG_GENERAL, SG_DEBUG, "clipped = " << clipped.contours()); *accum = tgPolygonUnion( pre_tess, *accum ); - tp = TGTexParams( pre_tess.get_pt(0,0), 20.0 /* TODO poly width */, 20.0 /* TODO poly length */, texture_heading ); + tp = TGTexParams( pre_tess.get_pt(0,0), 1.0 /* TODO poly width */, 1.0 /* TODO poly length */, texture_heading ); texparams->push_back( tp ); ExpandContour( hull, base, 20.0 ); diff --git a/src/Airports/GenAirports850/linearfeature.cxx b/src/Airports/GenAirports850/linearfeature.cxx index e7c4f354..90543fee 100644 --- a/src/Airports/GenAirports850/linearfeature.cxx +++ b/src/Airports/GenAirports850/linearfeature.cxx @@ -356,6 +356,7 @@ int LinearFeature::Finish() double dist; double az2; double last_end_v; + double width; int i, j; string material; int mat_idx = 0; @@ -379,45 +380,121 @@ int LinearFeature::Finish() break; case LF_SOLID_YELLOW: - //material = "lf_sng_solid_yellow"; - //break; + material = "lf_sng_solid_yellow"; + width = 0.25f; + break; case LF_BROKEN_YELLOW: + material = "lf_sng_broken_yellow"; + width = 0.25f; + break; + case LF_SOLID_DBL_YELLOW: + material = "lf_dbl_solid_yellow"; + width = 0.5f; + break; + case LF_RUNWAY_HOLD: + material = "lf_runway_hold"; + width = 1.0f; + break; + case LF_OTHER_HOLD: + material = "lf_other_hold"; + width = 0.5f; + break; + case LF_ILS_HOLD: + material = "lf_ils_hold"; + width = 1.0f; + break; + case LF_SAFETYZONE_CENTERLINE: + material = "lf_safetyzone_centerline"; + width = 0.75f; + break; + case LF_SINGLE_LANE_QUEUE: + material = "lf_sng_lane_queue"; + width = 0.25f; + break; + case LF_DOUBLE_LANE_QUEUE: + material = "lf_dbl_lane_queue"; + width = 0.5f; + break; case LF_B_SOLID_YELLOW: + material = "lf_dbl_solid_yellow"; + width = 0.25f; + break; + case LF_B_BROKEN_YELLOW: + material = "lf_sng_broken_yellow_border"; + width = 0.25f; + break; + case LF_B_SOLID_DBL_YELLOW: + material = "lf_dbl_solid_yellow_border"; + width = 0.5f; + break; + case LF_B_RUNWAY_HOLD: + material = "lf_runway_hold_border"; + width = 1.0f; + break; + case LF_B_OTHER_HOLD: + material = "lf_other_hold_border"; + width = 0.5f; + break; + case LF_B_ILS_HOLD: + material = "lf_ils_hold_border"; + width = 1.0f; + break; + case LF_B_SAFETYZONE_CENTERLINE: + material = "lf_safetyzone_centerline_border"; + width = 0.75f; + break; + case LF_B_SINGLE_LANE_QUEUE: + material = "lf_sng_lane_queue_border"; + width = 0.25f; + break; + case LF_B_DOUBLE_LANE_QUEUE: + material = "lf_dbl_lane_queue_border"; + width = 0.5f; + break; case LF_SOLID_WHITE: - case LF_CHECKERBOARD_WHITE: - case LF_BROKEN_WHITE: + material = "lf_sng_solid_white"; + width = 0.25f; + break; - case LF_BIDIR_GREEN: - case LF_OMNIDIR_BLUE: - case LF_UNIDIR_CLOSE_AMBER: - case LF_UNIDIR_CLOSE_AMBER_PULSE: - case LF_BIDIR_GREEN_AMBER: - case LF_OMNIDIR_RED: - //material = "gloff_lf_b_solid_yellow"; - // material = "pa_lftest"; - // material = "pa_tstlin"; + case LF_CHECKERBOARD_WHITE: + material = "lf_checkerboard_white"; + width = 0.5f; + break; + + case LF_BROKEN_WHITE: + material = "lf_broken_white"; + width = 0.25f; + break; + + case 101: + case 102: + case 103: + case 104: + case 105: + case 106: + // don't generate lights yet... break; default: - SG_LOG(SG_GENERAL, SG_DEBUG, "ClosedPoly::BuildBtg: unknown material " << marks[i]->type ); + SG_LOG(SG_GENERAL, SG_ALERT, "ClosedPoly::BuildBtg: unknown material " << marks[i]->type ); exit(1); } @@ -425,51 +502,6 @@ int LinearFeature::Finish() for (j = marks[i]->start_idx; j <= marks[i]->end_idx; j++) { SG_LOG(SG_GENERAL, SG_DEBUG, "LinearFeature::Finish: calculating offsets for mark " << i << " whose start idx is " << marks[i]->start_idx << " and end idx is " << marks[i]->end_idx << " cur idx is " << j ); - - switch (mat_idx%10) - { - case 0: - material = "pa_tstlin0"; - break; - - case 1: - material = "pa_tstlin1"; - break; - - case 2: - material = "pa_tstlin2"; - break; - - case 3: - material = "pa_tstlin3"; - break; - - case 4: - material = "pa_tstlin4"; - break; - - case 5: - material = "pa_tstlin5"; - break; - - case 6: - material = "pa_tstlin6"; - break; - - case 7: - material = "pa_tstlin7"; - break; - - case 8: - material = "pa_tstlin8"; - break; - - case 9: - material = "pa_tstlin9"; - break; - } - mat_idx++; - // for each point on the PointsList, generate a quad from // start to next, offset by 2 distnaces from the edge diff --git a/src/Airports/GenAirports850/linearfeature.hxx b/src/Airports/GenAirports850/linearfeature.hxx index 72c7f523..fa989bd4 100644 --- a/src/Airports/GenAirports850/linearfeature.hxx +++ b/src/Airports/GenAirports850/linearfeature.hxx @@ -57,7 +57,7 @@ typedef std::vector MarkingList; class LinearFeature { public: - LinearFeature( char* desc, double o, double w ) + LinearFeature( char* desc, double o ) { if ( desc ) { @@ -68,14 +68,12 @@ public: description = "none"; } offset = o; - width = w; } - LinearFeature( string desc, double o, double w ) + LinearFeature( string desc, double o ) { description = desc; offset = o; - width = w; } inline string GetDescription() { return description; } diff --git a/src/Airports/GenAirports850/parser.cxx b/src/Airports/GenAirports850/parser.cxx index 1a1b5065..b7ab8efe 100644 --- a/src/Airports/GenAirports850/parser.cxx +++ b/src/Airports/GenAirports850/parser.cxx @@ -162,11 +162,11 @@ LinearFeature* Parser::ParseFeature( char* line ) if (strlen( line )) { - feature = new LinearFeature(line, 0.0f, 1.0f); + feature = new LinearFeature(line, 0.0f); } else { - feature = new LinearFeature(NULL, 0.0f, 1.0f); + feature = new LinearFeature(NULL, 0.0f); } SG_LOG(SG_GENERAL, SG_ALERT, "Creating Linear Feature with desription \"" << line << "\"");