// function: getPoints
// purpose:
//=======================================================================
-CurveCreator::Coordinates CurveCreator_Curve::getPoints( const int theISection ) const
+CurveCreator::Coordinates CurveCreator_Curve::getCoords( int theISection ) const
{
- //DEBTRACE("getPoints");
CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
return aSection ? aSection->myPoints : CurveCreator::Coordinates();
}
+Handle(TColgp_HArray1OfPnt) CurveCreator_Curve::GetDifferentPoints( int theISection ) const
+{
+ //DEBTRACE("getPoints");
+ CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
+ return aSection ? aSection->GetDifferentPoints( (int)myDimension ) : Handle(TColgp_HArray1OfPnt)();
+}
+
void CurveCreator_Curve::constructAISObject()
{
//DEBTRACE("constructAISObject");
/**
* Get points of a section (the total points in Curve if theISection is equal to -1)..
*/
- virtual CurveCreator::Coordinates getPoints( const int theISection = -1 ) const;
+ virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theISection = -1 ) const;
+
+ CurveCreator::Coordinates getCoords( int theISection = -1 ) const;
/**
aSectionId = anIt->first;
aPointId = anIt->second;
const CurveCreator::Coordinates &aPoints =
- theCurve->getPoints(aSectionId);
+ theCurve->getCoords(aSectionId);
CurveCreator::Coordinates::const_iterator anIterBegin =
aPoints.begin() + (aDim*aPointId);
CurveCreator::Coordinates::const_iterator anIterEnd =
CurveCreator_Operation &theOperation) const
{
const std::string aName = theCurve->getSectionName(theIndex);
- const CurveCreator::Coordinates &aPnts = theCurve->getPoints(theIndex);
+ const CurveCreator::Coordinates &aPnts = theCurve->getCoords(theIndex);
const CurveCreator::SectionType aType = theCurve->getSectionType(theIndex);
const bool isClosed = theCurve->isClosed(theIndex);
virtual ~CurveCreator_ISection() {}
//! Calculates the different points of the section.
- virtual void GetDifferentPoints(
- const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const = 0;
+ virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theDimension ) const = 0;
};
/**
/**
* Get points of a section (the total points in Curve if theISection is equal to -1)..
*/
- virtual CurveCreator::Coordinates getPoints( const int theISection = -1 ) const = 0;
+ virtual Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theISection = -1 ) const = 0;
/**
* Get number of points in specified section or (the total number of points
// function: GetDifferentPoints
// purpose:
//=======================================================================
-void CurveCreator_Section::GetDifferentPoints(
- const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const
+Handle(TColgp_HArray1OfPnt) CurveCreator_Section::GetDifferentPoints( int theDimension ) const
{
+ Handle(TColgp_HArray1OfPnt) points;
+
std::vector<gp_Pnt> aTmpPoints;
CurveCreator::Coordinates::const_iterator aPIt = myPoints.begin();
CurveCreator::Coordinates::const_iterator aPItLast = myPoints.end();
}
}
- thePoints = new TColgp_HArray1OfPnt(1, aPointCount);
+ points = new TColgp_HArray1OfPnt(1, aPointCount);
for (int aPI = 0; aPI < aPointCount; ++aPI)
{
- thePoints->SetValue(aPI + 1, aTmpPoints[aPI]);
+ points->SetValue(aPI + 1, aTmpPoints[aPI]);
}
+
+ return points;
}
CurveCreator_Section() : myName("Section"),myType(CurveCreator::Polyline), myIsClosed(false)
{ }
- std::string myName; //!< section name
+ std::string myName; //!< section name
CurveCreator::Coordinates myPoints; //!< points coordinates
CurveCreator::SectionType myType; //!< type of the section
bool myIsClosed; //!< closed or not
//! A virtual method.
- void GetDifferentPoints(const int theDimension, Handle(TColgp_HArray1OfPnt)& thePoints) const;
+ Handle(TColgp_HArray1OfPnt) GetDifferentPoints( int theDimension ) const;
};
#endif
}
// Get the different points.
- const CurveCreator_ISection* aSection = theCurve->getSection(aSectionI);
- Handle(TColgp_HArray1OfPnt) aPoints;
- aSection->GetDifferentPoints(theCurve->getDimension(), aPoints);
+ Handle(TColgp_HArray1OfPnt) aPoints = theCurve->GetDifferentPoints( aSectionI );
const int aPointCount = aPoints->Length();
const bool isClosed = theCurve->isClosed(aSectionI);
theContext->SetAutomaticHilight( Standard_False );
Handle(SelectMgr_Selection) aSelection = anAISShape->Selection( AIS_Shape::SelectionMode( TopAbs_VERTEX ) );
- for( aSelection->Init(); aSelection->More(); aSelection->Next() )
- {
+
+ CurveCreator_ICurve::SectionToPointList::const_iterator anIt = thePoints.begin(),
+ aLast = thePoints.end();
+ bool isFound = false;
+ for( int i=0; i<aSize; i++ )
+ {
+ for( aSelection->Init(); aSelection->More(); aSelection->Next() )
+ {
#if OCC_VERSION_LARGE > 0x06080100
- const Handle(SelectMgr_SensitiveEntity) aHSenEntity = aSelection->Sensitive();
- if( aHSenEntity.IsNull() )
- continue;
- Handle(SelectBasics_SensitiveEntity) aSenEntity = aHSenEntity->BaseSensitive();
+ const Handle(SelectMgr_SensitiveEntity) aHSenEntity = aSelection->Sensitive();
+ if( aHSenEntity.IsNull() )
+ continue;
+ Handle(SelectBasics_SensitiveEntity) aSenEntity = aHSenEntity->BaseSensitive();
#else
- Handle(SelectBasics_SensitiveEntity) aSenEntity = aSelection->Sensitive();
+ Handle(SelectBasics_SensitiveEntity) aSenEntity = aSelection->Sensitive();
#endif
- Handle(Select3D_SensitivePoint) aSenPnt = Handle(Select3D_SensitivePoint)::DownCast( aSenEntity );
-
- gp_Pnt anOwnerPnt = aSenPnt->Point();
- Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast( aSenPnt->OwnerId() );
+ Handle(Select3D_SensitivePoint) aSenPnt = Handle(Select3D_SensitivePoint)::DownCast( aSenEntity );
+
+ gp_Pnt anOwnerPnt = aSenPnt->Point();
+ Handle(SelectMgr_EntityOwner) anOwner = Handle(SelectMgr_EntityOwner)::DownCast( aSenPnt->OwnerId() );
-
- CurveCreator_ICurve::SectionToPointList::const_iterator anIt = thePoints.begin(),
- aLast = thePoints.end();
- bool isFound = false;
- for( int i=0; i<aSize; i++ )
- {
bool isIntersect = fabs( aPntsToSelect[i].X() - anOwnerPnt.X() ) < LOCAL_SELECTION_TOLERANCE &&
fabs( aPntsToSelect[i].Y() - anOwnerPnt.Y() ) < LOCAL_SELECTION_TOLERANCE;
if( isIntersect )
for (i = 0; i < aNbSec; ++i) {
// Set coordinates
- CurveCreator::Coordinates aCoords = myCurve->getPoints(i);
+ CurveCreator::Coordinates aCoords = myCurve->getCoords(i);
const int aNbPoints = aCoords.size();
theCoords[i].length(aNbPoints);