#include <AIS_Shape.hxx>
#include <AIS_InteractiveObject.hxx>
#include <Geom_CartesianPoint.hxx>
+#include <TopoDS_Iterator.hxx>
#include <gp_Pnt.hxx>
#include <gp_Lin.hxx>
#include <TopoDS_Edge.hxx>
CurveCreator_Section* aSection = (CurveCreator_Section*)getSection( theISection );
return aSection ? aSection->GetDifferentPoints( (int)myDimension ) : Handle(TColgp_HArray1OfPnt)();
}
-
void CurveCreator_Curve::constructAISObject()
{
//DEBTRACE("constructAISObject");
TopoDS_Shape aShape;
- mySect2Wire.Clear();
- CurveCreator_Utils::constructShape( this, aShape, &mySect2Wire );
+ mySect2Shape.Clear();
+ CurveCreator_Utils::constructShape( this, aShape, &mySect2Shape );
myAISShape = new AIS_ColoredShape( aShape );
AIS_ColoredShape* AISColoredShape = dynamic_cast<AIS_ColoredShape*>(myAISShape);
std::map<int, TopoDS_Shape>::iterator it;
- //for ( it = mySect2Wire.begin(); it != mySect2Wire.end(); it++ )
- for (int i = 1; i <= mySect2Wire.Extent(); i++ )
+ //for ( it = mySect2Shape.begin(); it != mySect2Shape.end(); it++ )
+ for (int i = 1; i <= mySect2Shape.Extent(); i++ )
{
- CurveCreator_Section* aSect = (CurveCreator_Section*)getSection(mySect2Wire.FindKey(i));
+ CurveCreator_Section* aSect = (CurveCreator_Section*)getSection(mySect2Shape.FindKey(i));
Quantity_Color aColor = aSect->myColor;
- const TopoDS_Shape& aWire = mySect2Wire.FindFromIndex(i);
- AISColoredShape->SetCustomColor(aWire, aColor);
+ const TopoDS_Shape& aShape = mySect2Shape.FindFromIndex(i); //should contain: one wire + vertices
+ TopoDS_Iterator it(aShape);
+ for (;it.More();it.Next())
+ {
+ if (it.Value().ShapeType() == TopAbs_WIRE)
+ AISColoredShape->SetCustomColor(it.Value(), aColor);
+ }
}
// myAISShape->SetColor( myCurveColor );
Quantity_Color myPointAspectColor;
//Quantity_Color myCurveColor;
double myLineWidth;
- NCollection_IndexedDataMap<int, TopoDS_Shape> mySect2Wire;
+ NCollection_IndexedDataMap<int, TopoDS_Shape> mySect2Shape;
std::vector<int> myCurSectInd;
private:
//=======================================================================
void CurveCreator_Utils::constructShape(
const CurveCreator_ICurve* theCurve, TopoDS_Shape& theShape,
- NCollection_IndexedDataMap<int, TopoDS_Shape>* theSect2Wire )
+ NCollection_IndexedDataMap<int, TopoDS_Shape>* theSect2Shape )
{
BRep_Builder aBuilder;
TopoDS_Compound aShape;
aBuilder.MakeCompound(aShape);
+
const int aSectionCount = theCurve->getNbSections();
for (int aSectionI = 0; aSectionI < aSectionCount; ++aSectionI)
{
const int aPointCount = aPoints->Length();
const bool isClosed = theCurve->isClosed(aSectionI);
+ TopoDS_Compound ShapeWireWithV;
+ if (theSect2Shape)
+ aBuilder.MakeCompound(ShapeWireWithV);
+
// Add the vertices to the shape.
for (Standard_Integer aPN = 1; aPN <= aPointCount; ++aPN)
{
- aBuilder.Add(aShape, BRepBuilderAPI_MakeVertex(aPoints->Value(aPN)));
+ TopoDS_Vertex V;
+ aBuilder.MakeVertex(V,aPoints->Value(aPN),Precision::Confusion());
+ aBuilder.Add(aShape, V);
+ if (theSect2Shape)
+ aBuilder.Add(ShapeWireWithV, V);
}
// Add the wire to the shape.
if (!aWire.IsNull())
{
aBuilder.Add(aShape, aWire);
- if (theSect2Wire)
+ if (theSect2Shape)
{
- //CurveCreator_Section* aSection = (CurveCreator_Section*)theCurve->getSection(aSectionI);
- (*theSect2Wire).Add(aSectionI, aWire);
+ aBuilder.Add(ShapeWireWithV, aWire);
+ (*theSect2Shape).Add(aSectionI, ShapeWireWithV);
}
}
}
* Generates shape on the curve
* \param theCurve a curve object, that contains data
* \param theShape a generated shape
- * \param Sect2Wire optional out map: section to constructed wire
+ * \param Sect2Shape optional out map: section to constructed shape (wire+vertices)
*/
CURVECREATOR_EXPORT static void constructShape( const CurveCreator_ICurve* theCurve,
TopoDS_Shape& theShape,
- NCollection_IndexedDataMap<int, TopoDS_Shape>* Sect2Wire = NULL);
+ NCollection_IndexedDataMap<int, TopoDS_Shape>* Sect2Shape = NULL);
/**
* Generates a curve from a shape.
for (int i=0; i<Curve->myCurSectInd.size(); i++)
{
int sectInd = Curve->myCurSectInd[i];
- const TopoDS_Shape& W = Curve->mySect2Wire(sectInd+1);
+ const TopoDS_Shape& W = Curve->mySect2Shape(sectInd+1);
TopExp_Explorer exp(W, TopAbs_VERTEX);
for (;exp.More();exp.Next())
filter->AddShape(exp.Current());