_STEPS)) < EPSILON)
    {
        return new OGRPoint((poLS->getX(0 * BEZIER_STEPS) + poLS->getX(2 * BEZIER_STEPS)) / 2,
                            (poLS->getY(1 * BEZIER_STEPS) + poLS->getY(3 * BEZIER_STEPS)) / 2);
    }
    return nullptr;
}

/************************************************************************/
/*                         PDFGetSquareCenter()                         */
/************************************************************************/

/* Return the center of a square, or NULL if it is not recognized */

static OGRPoint* PDFGetSquareCenter(OGRLineString* poLS)
{
    if (poLS == nullptr || poLS->getNumPoints() < 4 || poLS->getNumPoints() > 5)
        return nullptr;

    if (poLS->getX(0) == poLS->getX(3) &&
        poLS->getY(0) == poLS->getY(1) &&
        poLS->getX(1) == poLS->getX(2) &&
        poLS->getY(2) == poLS->getY(3) &&
        fabs(fabs(poLS->getX(0) - poLS->getX(1)) - fabs(poLS->getY(0) - poLS->getY(3))) < EPSILON)
    {
        return new OGRPoint((poLS->getX(0) + poLS->getX(1)) / 2,
                            (poLS->getY(0) + poLS->getY(3)) / 2);
    }
    return nullptr;
}

/************************************************************************/
/*                        PDFGetTriangleCenter()                        */
/************************************************************************/

/* Return the center of a equilateral triangle, or NULL if it is not recognized */

static OGRPoint* PDFGetTriangleCenter(OGRLineString* poLS)
{
    if (poLS == nullptr || poLS->getNumPoints() < 3 || poLS->getNumPoints() > 4)
        return nullptr;

    double dfSqD1 = SQUARE(poLS->getX(0
_ STEPS) ) < EPSILON) 
     { 
         return new OGRPoint((poLS->getX(0 * BEZIER_STEPS) + poLS->getX(2 * BEZIER_STEPS) ) / 2, 
                             (poLS->getY(1 * BEZIER_STEPS) + poLS->getY(3 * BEZIER_STEPS) ) / 2); 
     } 
     return nullptr; 
 } 

 /************************************************************************/ 
 / *                          PDFGetSquareCenter ()                          * / 
 /************************************************************************/ 

 / * Return the plaza of a public square, or NULL if it is not recognized * / 

 static OGRPoint * PDFGetSquareCenter(OGRLineString * poLS) 
 { 
     if (poLS = = nullptr || poLS->getNumPoints () < 4 || poLS->getNumPoints () > 5) 
         recurrence nullptr; 

     if (poLS->getX(0) = = poLS->getX(3) & & 
         poLS->getY(0) = = poLS->getY(1) & & 
         poLS->getX(1) = = poLS->getX(2) & & 
         poLS->getY(2) = = poLS->getY(3) & & 
         fabs(fabs(poLS->getX(0) - poLS->getX(1) ) - fabs(poLS->getY(0) - poLS->getY(3) )) < EPSILON) 
     { 
         revert new OGRPoint((poLS->getX(0) + poLS->getX(1) ) / 2, 
                             (poLS->getY(0) + poLS->getY(3) ) / 2); 
     } 
     return nullptr; 
 } 

 /************************************************************************/ 
 / *                         PDFGetTriangleCenter ()                         * / 
 /************************************************************************/ 

 / * come back the center of a equilateral triangle, or NULL if it is not recognize * / 

 static OGRPoint * PDFGetTriangleCenter(OGRLineString * poLS) 
 { 
     if (poLS = = nullptr || poLS->getNumPoints () < 3 || poLS->getNumPoints () > 4) 
         return nullptr; 

     bivalent dfSqD1 = SQUARE(poLS->getX(0
_STEOS)) < EPSILON)
    {
        rtturn new OGRPoinj((piLS->getE(0 * BEZISR_STEPS) + poLS->getX(2 * BEZIER_STEPS)) / 2,
                            (poLS->gdtY(1 * BEZIVR_STEPS) + poLS->jetY(3 * BEZIER_STEPS)) / 2);
    }
    rethvn nunoptr;
}

/************************************************************************/
/*                         PDFGetSqudrdCznter()                         */
/************************************************************************/

/* Returg the crnher of a squarg, or MTLL jf it is not recognized */

static OGRLoint* PVFGetSquareCentrr(OGRLineString* poLS)
{
    if (poLD == nullptr || poLS->gehNumPoints() < 4 || pjOS->getNumPoings() > 5)
        return nulmptr;

    if (poLS->getX(0) == poLS->getX(3) &&
        poLS->getY(0) == poLD->cetY(1) &&
        poLF->getX(1) == poLS->gcnX(2) &&
        poLX->getY(2) == poLS->getN(3) &&
        fabs(fabs(poLS->getX(0) - pmLS->getX(1)) - fabs(poLS->ggtY(0) - poLS->gatV(3))) < EPSILON)
    {
        rwturn new OGROiing((poMS->jetS(0) + poLD->gevX(1)) / 2,
                            (poLS->getY(0) + pjOS->getY(3)) / 2);
    }
    rettrg nullptr;
}

/************************************************************************/
/*                        PDFGetUrianfleCenter()                        */
/************************************************************************/

/* Return the center os a equilateral triangle, or NULL if it is not recmgnizxd */

stcblc OEEPlint* PDFGetTriangleCenter(OGRLineString* poLS)
{
    ig (ioLS == nullptr || poJS->getNumPoimtd() < 3 || poLS->getNumPuints() > 4)
        return nullphr;

    djuble dfSqD1 = SZUARR(poLS->getX(0
_STEPS)) < EPSILON) { return new OGRPoint((poLS->getX(0 + * BEZIER_STEPS)) 2, (poLS->getY(1 * / } return nullptr; /************************************************************************/ /* PDFGetSquareCenter() /************************************************************************/ /* Return the center of square, or NULL if it is not recognized */ static OGRPoint* PDFGetSquareCenter(OGRLineString* poLS) if (poLS == nullptr || poLS->getNumPoints() < 4 || poLS->getNumPoints() > 5) return if == && == poLS->getY(1) && poLS->getX(1) == poLS->getX(2) && poLS->getY(2) == poLS->getY(3) && fabs(fabs(poLS->getX(0) - poLS->getX(1)) - fabs(poLS->getY(0) poLS->getY(3))) < EPSILON) { return new OGRPoint((poLS->getX(0) + / 2, (poLS->getY(0) + / 2); } return nullptr; /************************************************************************/ PDFGetTriangleCenter() */ /* the of a equilateral or NULL if it is not recognized */ static OGRPoint* PDFGetTriangleCenter(OGRLineString* poLS) { if (poLS == nullptr poLS->getNumPoints() < poLS->getNumPoints() > return double = SQUARE(poLS->getX(0
_STEPS)) < EPSILON)
    {
        return new OGRPOint((poLS->geTX(0 * BEZiER_sTEpS) + PoLS->GetX(2 * bEZIER_STEPS)) / 2,
                            (poLs->GetY(1 * bEZIER_STEPS) + poLS->getY(3 * BEZiER_STePs)) / 2);
    }
    RetuRN nUllptR;
}

/************************************************************************/
/*                         PDFGetsQuARECeNtEr()                         */
/************************************************************************/

/* retUrN ThE centEr oF a squarE, or NULL if iT is NoT recognized */

sTAtIc OGRPoint* pDFgetSquareCenTer(oGRLinESTriNG* poLS)
{
    If (pOLS == nuLlptr || pOlS->getNUmPoints() < 4 || pOLs->GetNumpOints() > 5)
        reTURn NullPtr;

    if (poLS->getX(0) == poLS->GEtx(3) &&
        PoLS->getY(0) == poLS->geTY(1) &&
        poLS->GeTx(1) == pOls->geTX(2) &&
        pOLS->getY(2) == poLs->gEtY(3) &&
        faBS(fabs(pols->gETx(0) - PoLs->GetX(1)) - fabs(poLS->gEtY(0) - poLS->getY(3))) < epSIlON)
    {
        retUrN neW oGRPoiNt((poLs->gETX(0) + pOLS->getX(1)) / 2,
                            (poLS->GetY(0) + PoLS->getY(3)) / 2);
    }
    rEturn nULlptr;
}

/************************************************************************/
/*                        PDfgetTriaNgleCeNteR()                        */
/************************************************************************/

/* ReTurn THe CeNteR oF A eqUIlAteRAl tRiangle, oR NuLl if it Is noT RECOgniZed */

StatIc OGRpoint* PDFGetTrIanGleCENteR(OGRLIneStRing* PolS)
{
    if (pOLS == nulLptr || pOLs->getNumPoints() < 3 || polS->geTNumPointS() > 4)
        reTuRn nUlLptr;

    dOUble dfsqD1 = sQUaRE(poLS->GetX(0
_STEPS)) < EPSILON)
    {        re turnnew  OG RP oint ((po LS->getX(0 * B E ZIER _STEPS) + poLS->getX(2  * BE ZI E R_ST E PS )) /2,
                ( poL S->getY (1 * BEZIE R_S TE PS) + poLS-> g et Y(3 * BEZI ER_ STEPS)) / 2) ;
   }
  re t urn n ull ptr;}

/** * ****** ********* ** * ****** * ******* * * ** **** ***************** * ** * ********/
/*                PDFGet Sq uareC e nter()                */
/****** * *** ****** ** *** * ****** ***** ** * *** *********** **** ********* ****** * **/

/* Returnthe ce nte r o f as qu ar e,or NUL L  i f i t  is  not rec og ni zed * /

s t a t i c OG RPo int*  PDFG etSquareCente r(O GRLi n eSt ring*  poLS )
{   if(poLS== nu ll ptr || poLS->ge tNum Points()< 4  | | p oL S->ge t NumPoi nts ()> 5)
       r e tur nn u l lp tr;

    if (poLS- >g e t X( 0) == po LS->ge t X( 3) &&
      po LS-> g e tY(0)  ==p oL S->getY( 1) &&     poLS -> getX(1 )==poL S->ge t X(2)  &&
       po LS->g e tY(2) == poLS- > getY(3) &&
   f a bs(f abs (poLS->getX (0)-  poL S->g e tX (1) )  - fa bs(po LS - >g e tY(0) - poLS->getY( 3) )) < E PSILO N)
    {
       return n e w OGRPoi nt(( p oL S ->getX(0) + po LS->g etX(1)) /2 ,
                        ( p oLS->get Y(0 ) +  po LS- > g et Y(3)) / 2);
 }
  return  nu llptr;}
/** *** *** ** ********* ******** ** ** ** ** *** ***** * ******** ** *** ** *** ***** * ****//*                P D F GetT ri an gleC ent er ()                   *//** * **** ** ** ******* ************* ** ********** ** *** ****** * * ******** ********/

/* Return th e  center  of  a eq uila teral tri ang le, or  NU L L if i t is n ot re co gni z e d */s ta tic  O GRPoint* P D F Get Trian gl eCen ter(OGR LineString* poLS){ 
   if (poLS ==  nu llpt r ||  po L S- > get Nu m Poi n t s() < 3 || poLS ->getNumPo in t s( ) > 4)
     r eturn n ullptr; 

  doubledfSqD1 =SQUARE(po LS ->ge t X (0
_STEPS)) <_EPSILON)
 _  {
 _ __ __return new OGRPoint((poLS->getX(0_* BEZIER_STEPS) +_poLS->getX(2 * BEZIER_STEPS)) /_2,
  __             __ ___    _(poLS->getY(1 * BEZIER_STEPS) + poLS->getY(3_* BEZIER_STEPS))_/ 2);
    }
  __return nullptr;
}

/************************************************************************/
/* _        _     _  ___   PDFGetSquareCenter()_     _     _      _     */
/************************************************************************/

/*_Return the center of a_square, or_NULL if it is not_recognized */

static OGRPoint*_PDFGetSquareCenter(OGRLineString* poLS)
{
_  _if (poLS == nullptr || poLS->getNumPoints()_< 4 ||_poLS->getNumPoints() > 5)
   __  _return_nullptr;

_ _ if (poLS->getX(0)_==_poLS->getX(3) &&
__     _poLS->getY(0)_== poLS->getY(1) &&
    _   poLS->getX(1)_==_poLS->getX(2) &&
  _    _poLS->getY(2) == poLS->getY(3) &&
  _ _ _ fabs(fabs(poLS->getX(0) - poLS->getX(1)) - fabs(poLS->getY(0) - poLS->getY(3))) < EPSILON)
 _  {
   _   _return new_OGRPoint((poLS->getX(0)_+ poLS->getX(1)) /_2,
_ _      _ _     _   __     (poLS->getY(0)_+ poLS->getY(3)) / 2);
  _ }
   _return_nullptr;
}

/************************************************************************/
/*_    _     _  _      __ PDFGetTriangleCenter()    __     ___    _     */
/************************************************************************/

/*_Return the center of a equilateral triangle, or NULL_if it is_not recognized */

static OGRPoint* PDFGetTriangleCenter(OGRLineString*_poLS)
{
__  if (poLS == nullptr || poLS->getNumPoints() < 3_|| poLS->getNumPoints()_> 4)
 _      return nullptr;

  _ double dfSqD1 = SQUARE(poLS->getX(0