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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663
|
/******************************************************************************
* $Id: ogr_xplane_apt_reader.h
*
* Project: X-Plane apt.dat file reader headers
* Purpose: Definition of classes for X-Plane apt.dat file reader
* Author: Even Rouault, even dot rouault at mines dash paris dot org
*
******************************************************************************
* Copyright (c) 2008, Even Rouault
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
****************************************************************************/
#ifndef _OGR_XPLANE_APT_READER_H_INCLUDED
#define _OGR_XPLANE_APT_READER_H_INCLUDED
#include "ogr_xplane.h"
#include "ogr_xplane_reader.h"
/************************************************************************/
/* OGRXPlaneAPTLayer */
/************************************************************************/
class OGRXPlaneAPTLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneAPTLayer();
/* If the airport has a tower, its coordinates are the tower coordinates */
/* If it has no tower, then we pick up the coordinates of the threshold of its first found runway */
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszAptName,
int nAPTType,
double dfElevation,
int bHasCoordinates = FALSE,
double dfLat = 0,
double dfLon = 0,
int bHasTower = FALSE,
double dfHeightTower = 0,
const char* pszTowerName = NULL);
};
/************************************************************************/
/* OGRXPlaneRunwayThresholdLayer */
/************************************************************************/
static const sEnumerationElement runwaySurfaceType[] =
{
{ 1, "Asphalt" },
{ 2, "Concrete" },
{ 3, "Turf/grass" },
{ 4, "Dirt" },
{ 5, "Gravel" },
{ 6, "Asphalt" /* helipad V810 */},
{ 7, "Concrete" /* helipad V810 */},
{ 8, "Turf/grass" /* helipad V810 */},
{ 9, "Dirt" /* helipad V810 */},
{ 10, "Asphalt" /* taxiway V810 */ },
{ 11, "Concrete" /* taxiway V810 */ },
{ 12, "Dry lakebed" },
{ 13, "Water" },
{ 14, "Snow/ice" /* V850 */ },
{ 15, "Transparent" /* V850 */ }
};
static const sEnumerationElement runwayShoulderType[] =
{
{ 0, "None" },
{ 1, "Asphalt" },
{ 2, "Concrete" }
};
static const sEnumerationElement runwayMarkingType[] =
{
{ 0, "None" },
{ 1, "Visual" },
{ 2, "Non-precision approach" },
{ 3, "Precision approach" },
{ 4, "UK-style non-precision" },
{ 5, "UK-style precision" }
};
static const sEnumerationElement approachLightingType[] =
{
{ 0, "None" },
{ 1, "ALSF-I" },
{ 2, "ALSF-II" },
{ 3, "Calvert" },
{ 4, "Calvert ISL Cat II and III" },
{ 5, "SSALR" },
{ 6, "SSALF" },
{ 7, "SALS" },
{ 8, "MALSR" },
{ 9, "MALSF" },
{ 10, "MALS" },
{ 11, "ODALS" },
{ 12, "RAIL" }
};
static const sEnumerationElement approachLightingTypeV810[] =
{
{ 1, "None" },
{ 2, "SSALS" },
{ 3, "SALSF" },
{ 4, "ALSF-I" },
{ 5, "ALSF-II" },
{ 6, "ODALS" },
{ 7, "Calvert" },
{ 8, "Calvert ISL Cat II and III" },
};
static const sEnumerationElement runwayEdgeLigthingType[] =
{
{ 0, "None" },
{ 1, "LIRL" }, /* proposed for V90x */
{ 2, "MIRL" },
{ 3, "HIRL" } /* proposed for V90x */
};
static const sEnumerationElement runwayREILType[] =
{
{ 0, "None" },
{ 1, "Omni-directional" },
{ 2, "Unidirectional" }
};
static const sEnumerationElement runwayVisualApproachPathIndicatorTypeV810[] =
{
{ 1, "None" },
{ 2, "VASI" },
{ 3, "PAPI Right" },
{ 4, "Space Shuttle PAPI" }
};
DEFINE_XPLANE_ENUMERATION(RunwaySurfaceEnumeration, runwaySurfaceType);
DEFINE_XPLANE_ENUMERATION(RunwayShoulderEnumeration, runwayShoulderType);
DEFINE_XPLANE_ENUMERATION(RunwayMarkingEnumeration, runwayMarkingType);
DEFINE_XPLANE_ENUMERATION(RunwayApproachLightingEnumeration, approachLightingType);
DEFINE_XPLANE_ENUMERATION(RunwayApproachLightingEnumerationV810, approachLightingTypeV810);
DEFINE_XPLANE_ENUMERATION(RunwayEdgeLightingEnumeration, runwayEdgeLigthingType);
DEFINE_XPLANE_ENUMERATION(RunwayREILEnumeration, runwayREILType);
DEFINE_XPLANE_ENUMERATION(RunwayVisualApproachPathIndicatorEnumerationV810, runwayVisualApproachPathIndicatorTypeV810);
class OGRXPlaneRunwayThresholdLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneRunwayThresholdLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszRwyNum,
double dfLat,
double dfLon,
double dfWidth,
const char* pszSurfaceType,
const char* pszShoulderType,
double dfSmoothness,
int bHasCenterLineLights,
const char* pszEdgeLighting,
int bHasDistanceRemainingSigns,
double dfDisplacedThresholdLength,
double dfStopwayLength,
const char* pszMarkings,
const char* pszApproachLightingCode,
int bHasTouchdownLights,
const char* pszREIL);
/* Set a few computed values */
void SetRunwayLengthAndHeading(OGRFeature* poFeature,
double dfLength,
double dfHeading);
OGRFeature* AddFeatureFromNonDisplacedThreshold(OGRFeature* poNonDisplacedThresholdFeature);
};
/************************************************************************/
/* OGRXPlaneRunwayLayer */
/************************************************************************/
class OGRXPlaneRunwayLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneRunwayLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszRwyNum1,
const char* pszRwyNum2,
double dfLat1,
double dfLon1,
double dfLat2,
double dfLon2,
double dfWidth,
const char* pszSurfaceType,
const char* pszShoulderType,
double dfSmoothness,
int bHasCenterLineLights,
const char* pszEdgeLighting,
int bHasDistanceRemainingSigns);
};
/************************************************************************/
/* OGRXPlaneStopwayLayer */
/************************************************************************/
class OGRXPlaneStopwayLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneStopwayLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszRwyNum,
double dfLatThreshold,
double dfLonThreshold,
double dfRunwayHeading,
double dfWidth,
double dfStopwayLength);
};
/************************************************************************/
/* OGRXPlaneWaterRunwayThresholdLayer */
/************************************************************************/
class OGRXPlaneWaterRunwayThresholdLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneWaterRunwayThresholdLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszRwyNum,
double dfLat,
double dfLon,
double dfWidth,
int bBuoys);
/* Set a few computed values */
void SetRunwayLengthAndHeading(OGRFeature* poFeature,
double dfLength,
double dfHeading);
};
/************************************************************************/
/* OGRXPlaneWaterRunwayLayer */
/************************************************************************/
/* Polygonal object */
class OGRXPlaneWaterRunwayLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneWaterRunwayLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszRwyNum1,
const char* pszRwyNum2,
double dfLat1,
double dfLon1,
double dfLat2,
double dfLon2,
double dfWidth,
int bBuoys);
};
/************************************************************************/
/* OGRXPlaneHelipadLayer */
/************************************************************************/
static const sEnumerationElement helipadEdgeLigthingType[] =
{
{ 0, "None" },
{ 1, "Yellow" },
{ 2, "White" }, /* proposed for V90x */
{ 3, "Red" } /* proposed for V90x */
};
DEFINE_XPLANE_ENUMERATION(HelipadEdgeLightingEnumeration, helipadEdgeLigthingType);
class OGRXPlaneHelipadLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneHelipadLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszHelipadNum,
double dfLat,
double dfLon,
double dfTrueHeading,
double dfLength,
double dfWidth,
const char* pszSurfaceType,
const char* pszMarkings,
const char* pszShoulderType,
double dfSmoothness,
const char* pszEdgeLighing);
};
/************************************************************************/
/* OGRXPlaneHelipadPolygonLayer */
/************************************************************************/
class OGRXPlaneHelipadPolygonLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneHelipadPolygonLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszHelipadNum,
double dfLat,
double dfLon,
double dfTrueHeading,
double dfLength,
double dfWidth,
const char* pszSurfaceType,
const char* pszMarkings,
const char* pszShoulderType,
double dfSmoothness,
const char* pszEdgeLighing);
};
/************************************************************************/
/* OGRXPlaneTaxiwayRectangleLayer */
/************************************************************************/
class OGRXPlaneTaxiwayRectangleLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneTaxiwayRectangleLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
double dfLat,
double dfLon,
double dfTrueHeading,
double dfLength,
double dfWidth,
const char* pszSurfaceType,
double dfSmoothness,
int bBlueEdgeLights);
};
/************************************************************************/
/* OGRXPlanePavementLayer */
/************************************************************************/
class OGRXPlanePavementLayer : public OGRXPlaneLayer
{
public:
OGRXPlanePavementLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszPavementName,
const char* pszSurfaceType,
double dfSmoothness,
double dfTextureHeading,
OGRPolygon* poPolygon);
};
/************************************************************************/
/* OGRXPlaneAPTBoundaryLayer */
/************************************************************************/
class OGRXPlaneAPTBoundaryLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneAPTBoundaryLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszBoundaryName,
OGRPolygon* poPolygon);
};
/************************************************************************/
/* OGRXPlaneAPTLinearFeatureLayer */
/************************************************************************/
class OGRXPlaneAPTLinearFeatureLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneAPTLinearFeatureLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszLinearFeatureName,
OGRMultiLineString* poMultilineString);
};
/************************************************************************/
/* OGRXPlaneATCFreqLayer */
/************************************************************************/
class OGRXPlaneATCFreqLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneATCFreqLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszATCType,
const char* pszATCFreqName,
double dfFrequency);
};
/************************************************************************/
/* OGRXPlaneStartupLocationLayer */
/************************************************************************/
class OGRXPlaneStartupLocationLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneStartupLocationLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszName,
double dfLat,
double dfLon,
double dfTrueHeading);
};
/************************************************************************/
/* OGRXPlaneAPTLightBeaconLayer */
/************************************************************************/
static const sEnumerationElement APTLightBeaconColorType[] =
{
{ 0, "None" },
{ 1, "White-green" }, /* land airport */
{ 2, "White-yellow" }, /* seaplane base */
{ 3, "Green-yellow-white" }, /* heliports */
{ 4, "White-white-green" } /* military field */
};
DEFINE_XPLANE_ENUMERATION(APTLightBeaconColorEnumeration, APTLightBeaconColorType);
class OGRXPlaneAPTLightBeaconLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneAPTLightBeaconLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszName,
double dfLat,
double dfLon,
const char* pszColor);
};
/************************************************************************/
/* OGRXPlaneAPTWindsockLayer */
/************************************************************************/
class OGRXPlaneAPTWindsockLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneAPTWindsockLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszName,
double dfLat,
double dfLon,
int bIsIllumnited);
};
/************************************************************************/
/* OGRXPlaneTaxiwaySignLayer */
/************************************************************************/
class OGRXPlaneTaxiwaySignLayer : public OGRXPlaneLayer
{
public:
OGRXPlaneTaxiwaySignLayer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszText,
double dfLat,
double dfLon,
double dfHeading,
int nSize);
};
/************************************************************************/
/* OGRXPlane_VASI_PAPI_WIGWAG_Layer */
/************************************************************************/
static const sEnumerationElement VASI_PAPI_WIGWAG_Type[] =
{
{ 1, "VASI" },
{ 2, "PAPI Left" },
{ 3, "PAPI Right" },
{ 4, "Space Shuttle PAPI" },
{ 5, "Tri-colour VASI" },
{ 6, "Wig-Wag lights" }
};
DEFINE_XPLANE_ENUMERATION(VASI_PAPI_WIGWAG_Enumeration, VASI_PAPI_WIGWAG_Type);
class OGRXPlane_VASI_PAPI_WIGWAG_Layer : public OGRXPlaneLayer
{
public:
OGRXPlane_VASI_PAPI_WIGWAG_Layer();
OGRFeature* AddFeature(const char* pszAptICAO,
const char* pszRwyNum,
const char* pszObjectType,
double dfLat,
double dfLon,
double dfHeading,
double dfVisualGlidePathAngle);
};
enum
{
APT_AIRPORT_HEADER = 1,
APT_RUNWAY_TAXIWAY_V_810 = 10,
APT_TOWER = 14,
APT_STARTUP_LOCATION = 15,
APT_SEAPLANE_HEADER = 16,
APT_HELIPORT_HEADER = 17,
APT_LIGHT_BEACONS = 18,
APT_WINDSOCKS = 19,
APT_TAXIWAY_SIGNS = 20,
APT_VASI_PAPI_WIGWAG = 21,
APT_ATC_AWOS_ASOS_ATIS = 50,
APT_ATC_CTAF = 51,
APT_ATC_CLD = 52,
APT_ATC_GND = 53,
APT_ATC_TWR = 54,
APT_ATC_APP = 55,
APT_ATC_DEP = 56,
APT_RUNWAY = 100,
APT_WATER_RUNWAY = 101,
APT_HELIPAD = 102,
APT_PAVEMENT_HEADER = 110,
APT_NODE = 111,
APT_NODE_WITH_BEZIER = 112,
APT_NODE_CLOSE = 113,
APT_NODE_CLOSE_WITH_BEZIER = 114,
APT_NODE_END = 115,
APT_NODE_END_WITH_BEZIER = 116,
APT_LINEAR_HEADER = 120,
APT_BOUNDARY_HEADER = 130,
};
/************************************************************************/
/* OGRXPlaneAptReader */
/************************************************************************/
class OGRXPlaneAptReader : public OGRXPlaneReader
{
private:
OGRXPlaneAPTLayer* poAPTLayer;
OGRXPlaneRunwayLayer* poRunwayLayer;
OGRXPlaneStopwayLayer* poStopwayLayer;
OGRXPlaneRunwayThresholdLayer* poRunwayThresholdLayer;
OGRXPlaneWaterRunwayLayer* poWaterRunwayLayer;
OGRXPlaneWaterRunwayThresholdLayer* poWaterRunwayThresholdLayer;
OGRXPlaneHelipadLayer* poHelipadLayer;
OGRXPlaneHelipadPolygonLayer* poHelipadPolygonLayer;
OGRXPlaneTaxiwayRectangleLayer* poTaxiwayRectangleLayer;
OGRXPlanePavementLayer* poPavementLayer;
OGRXPlaneAPTBoundaryLayer* poAPTBoundaryLayer;
OGRXPlaneAPTLinearFeatureLayer* poAPTLinearFeatureLayer;
OGRXPlaneATCFreqLayer* poATCFreqLayer;
OGRXPlaneStartupLocationLayer* poStartupLocationLayer;
OGRXPlaneAPTLightBeaconLayer* poAPTLightBeaconLayer;
OGRXPlaneAPTWindsockLayer* poAPTWindsockLayer;
OGRXPlaneTaxiwaySignLayer* poTaxiwaySignLayer;
OGRXPlane_VASI_PAPI_WIGWAG_Layer* poVASI_PAPI_WIGWAG_Layer;
int bAptHeaderFound;
double dfElevation;
int bControlTower;
CPLString osAptICAO;
CPLString osAptName;
int nAPTType;
int bTowerFound;
double dfLatTower, dfLonTower;
double dfHeightTower;
CPLString osTowerName;
int bRunwayFound;
double dfLatFirstRwy , dfLonFirstRwy;
int bResumeLine;
private:
OGRXPlaneAptReader();
void ParseAptHeaderRecord();
void ParsePavement();
void ParseAPTBoundary();
void ParseAPTLinearFeature();
void ParseRunwayTaxiwayV810Record();
void ParseRunwayRecord();
void ParseWaterRunwayRecord();
void ParseHelipadRecord();
void ParseTowerRecord();
void ParseATCRecord(int nType);
void ParseStartupLocationRecord();
void ParseLightBeaconRecord();
void ParseWindsockRecord();
void ParseTaxiwaySignRecord();
void ParseVasiPapiWigWagRecord();
OGRGeometry* FixPolygonTopology(OGRPolygon& polygon);
int ParsePolygonalGeometry(OGRGeometry** ppoGeom);
int ParseLinearGeometry(OGRMultiLineString& multilinestring, int* pbIsValid);
static void AddBezierCurve (OGRLineString& lineString,
double dfLatA, double dfLonA,
double dfCtrPtLatA, double dfCtrPtLonA,
double dfSymCtrlPtLatB, double dfSymCtrlPtLonB,
double dfLatB, double dfLonB);
static void AddBezierCurve (OGRLineString& lineString,
double dfLatA, double dfLonA,
double dfCtrPtLat, double dfCtrPtLon,
double dfLatB, double dfLonB);
protected:
virtual void Read();
public:
OGRXPlaneAptReader( OGRXPlaneDataSource* poDataSource );
virtual OGRXPlaneReader* CloneForLayer(OGRXPlaneLayer* poLayer);
virtual int IsRecognizedVersion( const char* pszVersionString);
virtual void Rewind();
};
#endif
|