EgtGeomKernel 1.5g1 :
- alle curve aggiunto il metodo CopyParamRange (per curve chiuse ammatte range che passano dal punto di chiusura) - trasformato il metodo Copy di tutti gli oggetti geometrici in CopyFrom - a TSC aggiunte funzioni CopyCurveByParamRange e SplitCurveByClass - migliorata gestione intersezioni sovrapposte - aggiunta classificazione parti di curva (IN,OUT,ONP,ONM) da intersezioni con altra curva chiusa.
This commit is contained in:
+41
-4
@@ -14,12 +14,14 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "CurveArc.h"
|
||||
#include "CurveComposite.h"
|
||||
#include "DistPointArc.h"
|
||||
#include "GeoConst.h"
|
||||
#include "GeoObjFactory.h"
|
||||
#include "NgeWriter.h"
|
||||
#include "NgeReader.h"
|
||||
#include "/EgtDev/Include/EGkStringUtils3d.h"
|
||||
#include "/EgtDev/Include/EgtPointerOwner.h"
|
||||
#include <new>
|
||||
|
||||
using namespace std ;
|
||||
@@ -416,7 +418,7 @@ CurveArc::Clone( void) const
|
||||
// alloco oggetto
|
||||
CurveArc* pCrv = new(nothrow) CurveArc ;
|
||||
if ( pCrv != nullptr) {
|
||||
if ( ! pCrv->Copy( *this)) {
|
||||
if ( ! pCrv->CopyFrom( *this)) {
|
||||
delete pCrv ;
|
||||
return nullptr ;
|
||||
}
|
||||
@@ -427,17 +429,17 @@ CurveArc::Clone( void) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveArc::Copy( const IGeoObj* pGObjSrc)
|
||||
CurveArc::CopyFrom( const IGeoObj* pGObjSrc)
|
||||
{
|
||||
const CurveArc* pCA = dynamic_cast<const CurveArc*>( pGObjSrc) ;
|
||||
if ( pCA == nullptr)
|
||||
return false ;
|
||||
return Copy( *pCA) ;
|
||||
return CopyFrom( *pCA) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveArc::Copy( const CurveArc& caSrc)
|
||||
CurveArc::CopyFrom( const CurveArc& caSrc)
|
||||
{
|
||||
if ( &caSrc == this)
|
||||
return true ;
|
||||
@@ -845,6 +847,37 @@ CurveArc::ApproxWithLines( double dLinTol, double dAngTolDeg, PolyLine& PL) cons
|
||||
return true ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
ICurve*
|
||||
CurveArc::CopyParamRange( double dUStart, double dUEnd) const
|
||||
{
|
||||
// i parametri start ed end devono essere compresi nel dominio parametrico della curva
|
||||
if ( dUStart < - EPS_PARAM || dUStart > 1 + EPS_PARAM ||
|
||||
dUEnd < - EPS_PARAM || dUEnd > 1 + EPS_PARAM)
|
||||
return nullptr ;
|
||||
// se il parametro start supera quello di end
|
||||
if ( dUStart > dUEnd - EPS_PARAM) {
|
||||
// se curva aperta, il trim la cancella completamente quindi non resta alcunchè
|
||||
if ( ! IsClosed())
|
||||
return nullptr ;
|
||||
// se curva chiusa, il trim si avvolge attorno al punto di giunzione
|
||||
else {
|
||||
// eseguo la copia sulla curva composita equivalente
|
||||
CurveComposite cCompo ;
|
||||
cCompo.CopyFrom( this) ;
|
||||
return cCompo.CopyParamRange( dUStart, dUEnd) ;
|
||||
}
|
||||
}
|
||||
// creo l'arco copia
|
||||
PtrOwner<CurveArc> pCopy( Clone()) ;
|
||||
if ( ! ::IsValid( pCopy))
|
||||
return nullptr ;
|
||||
// eseguo il trim
|
||||
if ( ! pCopy->TrimStartEndAtParam( dUStart, dUEnd))
|
||||
return nullptr ;
|
||||
return ( ::Release( pCopy)) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
CurveArc::Invert( void)
|
||||
@@ -944,6 +977,10 @@ CurveArc::TrimEndAtParam( double dUTrim)
|
||||
bool
|
||||
CurveArc::TrimStartEndAtParam( double dUStartTrim, double dUEndTrim)
|
||||
{
|
||||
// i parametri start ed end devono essere compresi nel dominio parametrico della curva
|
||||
if ( dUStartTrim < - EPS_PARAM || dUStartTrim > 1 + EPS_PARAM ||
|
||||
dUEndTrim < - EPS_PARAM || dUEndTrim > 1 + EPS_PARAM)
|
||||
return false ;
|
||||
// verifico che i trim non cancellino interamente la curva
|
||||
if ( dUStartTrim > dUEndTrim - EPS_PARAM)
|
||||
return false ;
|
||||
|
||||
Reference in New Issue
Block a user