void ON_CurveProxy::SetProxyCurve( const ON_Curve* real_curve, ON_Interval real_curve_subdomain) { if ( real_curve != this ) { // setting m_real_curve=0 prevents crashes if user has deleted // the "real" curve before calling SetProxyCurve(). m_real_curve = 0; DestroyCurveTree(); m_real_curve_domain.Destroy(); m_this_domain.Destroy(); m_bReversed = false; } else { // If you are debugging and end up here, there is a 99% chance // that you passed the wrong pointer to SetProxyCurve(). // However, I will assume you really meant to use a fancy self // reference to adjust domains. if ( IsValid() && m_this_domain.Includes(real_curve_subdomain) ) { real_curve = m_real_curve; // because input real_curve_subdomain was with respect to "this". double r0 = RealCurveParameter(real_curve_subdomain[0]); double r1 = RealCurveParameter(real_curve_subdomain[1]); real_curve_subdomain.Set(r0,r1); } else { real_curve = 0; } // setting m_real_curve=0 prevents crashes if user has deleted // the "real" curve before calling SetProxyCurve(). m_real_curve = 0; DestroyCurveTree(); } m_real_curve = real_curve; if ( m_real_curve ) { SetProxyCurveDomain( real_curve_subdomain ); } else { m_real_curve_domain = real_curve_subdomain; } m_this_domain = m_real_curve_domain; }
BOOL ON_BrepTrim::Read( ON_BinaryArchive& file ) { ON_3dPoint P[2]; int i; BOOL rc = file.ReadInt( &m_trim_index ); if ( rc ) rc = file.ReadInt( &m_c2i ); if ( rc ) { ON_Interval d; rc = file.ReadInterval( d ); if (rc) { SetProxyCurveDomain(d); SetDomain(d); } } if ( rc ) rc = file.ReadInt( &m_ei ); if ( rc ) rc = file.ReadInt( 2, m_vi ); if ( rc ) { i = m_bRev3d; rc = file.ReadInt( &i ); if (rc) m_bRev3d = (i!=0); } i = unknown; if ( rc ) rc = file.ReadInt( &i ); switch (i) { case unknown: m_type = unknown; break; case boundary: m_type = boundary; break; case mated: m_type = mated; break; case seam: m_type = seam; break; case singular: m_type = singular; break; } i = ON_Surface::not_iso; if ( rc ) rc = file.ReadInt( &i ); switch(i) { case ON_Surface::not_iso: m_iso = ON_Surface::not_iso; break; case ON_Surface::x_iso: m_iso = ON_Surface::x_iso; break; case ON_Surface::y_iso: m_iso = ON_Surface::y_iso; break; case ON_Surface::W_iso: m_iso = ON_Surface::W_iso; break; case ON_Surface::S_iso: m_iso = ON_Surface::S_iso; break; case ON_Surface::E_iso: m_iso = ON_Surface::E_iso; break; case ON_Surface::N_iso: m_iso = ON_Surface::N_iso; break; } if ( rc ) rc = file.ReadInt( &m_li ); if ( rc ) rc = file.ReadDouble( 2, m_tolerance ); if ( file.Archive3dmVersion() >= 3 && file.ArchiveOpenNURBSVersion() >= 200206180 ) { // read trim proxy curve information added in version 200206180 ON_Interval d = ProxyCurveDomain(); if (rc ) { rc = file.ReadInterval( d ); if ( !rc ) d = ProxyCurveDomain(); } unsigned char b[24]; memset(b,0,sizeof(b)); bool bProxyCurveIsReversed = false; if (rc) { rc = file.ReadChar(8,b); if (rc && b[0] == 1 ) bProxyCurveIsReversed = true; } if (rc) rc = file.ReadChar(24,b); if ( bProxyCurveIsReversed ) ON_CurveProxy::Reverse(); SetDomain(d); } else { if ( rc ) rc = file.ReadPoint( P[0] ); //m_P[0] ); if ( rc ) rc = file.ReadPoint( P[1] ); //m_P[1] ); } if ( rc ) rc = file.ReadDouble( &m__legacy_2d_tol ); if ( rc ) rc = file.ReadDouble( &m__legacy_3d_tol ); return rc; }