return theIPnt * myDimension;
}
-//#define USE_COMPOUND
std::vector<Handle_AIS_InteractiveObject> CurveCreator_Curve::constructSection( int theISection ) const
{
std::vector<Handle_AIS_InteractiveObject> aSectionRepresentation;
- CurveCreator::SectionType aSectType = getSectionType( theISection );
- bool isShapeConstruct = false;
-#ifdef USE_COMPOUND
- isShapeConstruct = true;
-#else
- isShapeConstruct = aSectType == CurveCreator::Spline;
-#endif
+ TopoDS_Shape aShape;
+ CurveCreator_Utils::constructShape( this, theISection, aShape, aSectionRepresentation );
- if ( isShapeConstruct ) {
- TopoDS_Shape aShape;
- CurveCreator_Utils::constructShape( this, theISection, aShape );
- AIS_Shape* anAISShape = new AIS_Shape( aShape );
- //aShape->SetSelectionMode( AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)TopAbs_VERTEX ) );
- aSectionRepresentation.push_back( anAISShape );
- if ( aSectType != CurveCreator::Spline )
- return aSectionRepresentation;
- }
+ AIS_Shape* anAISShape = new AIS_Shape( aShape );
+ //aShape->SetSelectionMode( AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)TopAbs_VERTEX ) );
+ aSectionRepresentation.push_back( anAISShape );
- int aPointSize = getNbPoints( theISection );
- bool aSectIsClosed = isClosed( theISection );
- if( aSectType == CurveCreator::Polyline )
- {
- int iPoint = 0;
- for( ; iPoint < ( aPointSize - 1 ) ; iPoint++ ){
- Handle_AIS_Point anAISPnt = getAISPoint(theISection, iPoint);
- aSectionRepresentation.push_back( anAISPnt );
- Handle_AIS_Line aLine = getAISLine( theISection, iPoint, iPoint+1 );
- aSectionRepresentation.push_back( aLine );
- }
- if( aPointSize != 0 ){
- Handle_AIS_Point anAISPnt = getAISPoint(theISection, iPoint);
- aSectionRepresentation.push_back( anAISPnt );
- if( isClosed(theISection) && ( aPointSize > 1 ) ){
- Handle_AIS_Line aLine = getAISLine( theISection, iPoint, 0 );
- aSectionRepresentation.push_back( aLine );
- }
- }
- }
- else if( aSectType == CurveCreator::Spline )
- {
- std::vector<double> aPoints;
- for( int iPoint = 0; iPoint < aPointSize; iPoint++ )
- {
- Handle_AIS_Point anAISPnt = getAISPoint( theISection, iPoint );
- aSectionRepresentation.push_back( anAISPnt );
- }
- }
return aSectionRepresentation;
}
}
}
+//#define USE_COMPOUND
void CurveCreator_Curve::redisplayCurve()
{
if( myDisplayer ) {
*/
virtual bool addEmptyDiff();
+public: // TODO: remove public
Handle_AIS_Point getAISPoint( int theISection, int theIPoint ) const;
Handle_AIS_Line getAISLine( int theISection, int theIPoint1, int theIPoint2 ) const;
-public: // TODO: remove public
void getCoordinates( int theISection, int theIPoint, double& theX, double& theY, double& theZ ) const;
protected: // TODO: remove public
void redisplayCurve();
//#define USE_COMPOUND
+#include "CurveCreator_Curve.hxx" // TODO - remove
void CurveCreator_Utils::constructShape( const CurveCreator_ICurve* theCurve,
- const int theISection, TopoDS_Shape& theShape )
+ const int theISection, TopoDS_Shape& theShape,
+ std::vector<Handle_AIS_InteractiveObject>& aSectionRepresentation )
{
CurveCreator::SectionType aSectType = theCurve->getSectionType( theISection );
bool aSectIsClosed = theCurve->isClosed( theISection );
if( aSectType == CurveCreator::Polyline )
{
-//#ifdef USE_COMPOUND
+#ifdef USE_COMPOUND
BRep_Builder aBuilder;
TopoDS_Compound aComp;
aBuilder.MakeCompound(aComp);
aBuilder.Add( aComp, aPointEdge );
aPrevPoint = aPoint;
}
- if( theCurve->isClosed( theISection ) && ( aPointSize > 2 ) ) {
+ if( aSectIsClosed && ( aPointSize > 2 ) ) {
CurveCreator_UtilsICurve::getPoint( theCurve, theISection, 0, aPoint );
aVertex = BRepBuilderAPI_MakeVertex( aPoint ).Vertex();
aBuilder.Add( aComp, aVertex );
}
theShape = aComp;
}
-//#endif
+#endif
}
else if( aSectType == CurveCreator::Spline )
{
#ifdef USE_COMPOUND
-
#else
std::vector<double> aPoints;
for( int iPoint = 0; iPoint < aPointSize; iPoint++ )
}
#endif
}
+
+#ifndef USE_COMPOUND
+ const CurveCreator_Curve* aCurve = dynamic_cast<const CurveCreator_Curve*>( theCurve );
+ if ( !aCurve )
+ return;
+
+ if( aSectType == CurveCreator::Polyline )
+ {
+ int iPoint = 0;
+ for( ; iPoint < ( aPointSize - 1 ) ; iPoint++ ){
+ Handle_AIS_Point anAISPnt = aCurve->getAISPoint(theISection, iPoint);
+ aSectionRepresentation.push_back( anAISPnt );
+ Handle_AIS_Line aLine = aCurve->getAISLine( theISection, iPoint, iPoint+1 );
+ aSectionRepresentation.push_back( aLine );
+ }
+ if( aPointSize != 0 ){
+ Handle_AIS_Point anAISPnt = aCurve->getAISPoint(theISection, iPoint);
+ aSectionRepresentation.push_back( anAISPnt );
+ if( aSectIsClosed && ( aPointSize > 1 ) ){
+ Handle_AIS_Line aLine = aCurve->getAISLine( theISection, iPoint, 0 );
+ aSectionRepresentation.push_back( aLine );
+ }
+ }
+ }
+ else if( aSectType == CurveCreator::Spline )
+ {
+ std::vector<double> aPoints;
+ for( int iPoint = 0; iPoint < aPointSize; iPoint++ )
+ {
+ Handle_AIS_Point anAISPnt = aCurve->getAISPoint( theISection, iPoint );
+ aSectionRepresentation.push_back( anAISPnt );
+ }
+ }
+#endif
}
std::list<float> CurveCreator_Utils::getSelectedPoints( Handle(AIS_InteractiveContext) theContext )
#include "CurveCreator_Macro.hxx"
#include <AIS_InteractiveContext.hxx>
+#include <AIS_InteractiveObject.hxx> // TODO: remove
#include <V3d_View.hxx>
#include <gp_Pnt.hxx>
#include <Geom_Curve.hxx>
#include <TopoDS_Shape.hxx>
#include <list>
+#include <vector> // TODO: remove
class CurveCreator_ICurve;
*/
CURVECREATOR_EXPORT static void constructShape( const CurveCreator_ICurve* theCurve,
const int theISection,
- TopoDS_Shape& theShape );
+ TopoDS_Shape& theShape,
+ std::vector<Handle_AIS_InteractiveObject>& theAdditional );
/**
* Find selected points in the context