// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
-//GER61351 //GG_171199 Enable to set an object RGB color instead a restricted object NameOfColor.
+#include <AIS_Line.hxx>
-#include <AIS_Line.ixx>
+#include <AIS_GraphicTool.hxx>
#include <Aspect_TypeOfLine.hxx>
-#include <Prs3d_Drawer.hxx>
-#include <Precision.hxx>
-#include <Prs3d_LineAspect.hxx>
+#include <GC_MakeSegment.hxx>
+#include <Geom_Line.hxx>
+#include <Geom_Point.hxx>
+#include <Geom_Transformation.hxx>
+#include <GeomAdaptor_Curve.hxx>
#include <Graphic3d_AspectLine3d.hxx>
#include <Graphic3d_Structure.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <SelectMgr_EntityOwner.hxx>
+#include <Precision.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Projector.hxx>
+#include <Quantity_Color.hxx>
#include <Select3D_SensitiveSegment.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+#include <SelectMgr_Selection.hxx>
+#include <Standard_Type.hxx>
#include <StdPrs_Curve.hxx>
-#include <Geom_Line.hxx>
-#include <GeomAdaptor_Curve.hxx>
-#include <AIS_Drawer.hxx>
-#include <GC_MakeSegment.hxx>
-#include <Geom_Line.hxx>
-#include <Quantity_Color.hxx>
-#include <AIS_GraphicTool.hxx>
+#include <TColgp_Array1OfPnt.hxx>
#include <UnitsAPI.hxx>
+IMPLEMENT_STANDARD_RTTIEXT(AIS_Line,AIS_InteractiveObject)
+
//==================================================================
// function: FindLimits
// purpose:
//==================================================================
//unused
-/*#ifdef DEB
+/*#ifdef OCCT_DEBUG
static void FindLimits(const Adaptor3d_Curve& aCurve,
const Standard_Real aLimit,
gp_Pnt& P1,
Standard_Real Last = aCurve.LastParameter();
Standard_Boolean firstInf = Precision::IsNegativeInfinite(First);
Standard_Boolean lastInf = Precision::IsPositiveInfinite(Last);
-
-
if (firstInf || lastInf) {
Standard_Real delta = 1;
if (firstInf && lastInf) {
}
#endif
*/
-
//=======================================================================
//function : AIS_Line
//purpose :
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer)
{
- aPresentation->Clear();
-
aPresentation->SetDisplayPriority(5);
if (!myLineIsSegment) ComputeInfiniteLine(aPresentation);
void AIS_Line::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTransformation, const Handle(Prs3d_Presentation)& aPresentation)
{
-// Standard_NotImplemented::Raise("AIS_Line::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
+// throw Standard_NotImplemented("AIS_Line::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation) ;
}
//purpose :
//=======================================================================
-void AIS_Line::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
- const Standard_Integer)
+void AIS_Line::ComputeSelection(const Handle(SelectMgr_Selection)& theSelection,
+ const Standard_Integer theMode)
{
+ // Do not support selection modes different from 0 currently
+ if (theMode)
+ return;
- if (!myLineIsSegment) ComputeInfiniteLineSelection(aSelection);
- else ComputeSegmentLineSelection(aSelection);
-
+ if (!myLineIsSegment)
+ {
+ ComputeInfiniteLineSelection(theSelection);
+ }
+ else
+ {
+ ComputeSegmentLineSelection(theSelection);
+ }
}
-
//=======================================================================
//function : SetColor
-//purpose :
+//purpose :
//=======================================================================
-
-void AIS_Line::SetColor(const Quantity_NameOfColor aCol)
-{
- SetColor(Quantity_Color(aCol));
-}
-
void AIS_Line::SetColor(const Quantity_Color &aCol)
{
hasOwnColor=Standard_True;
- myOwnColor=aCol;
+ myDrawer->SetColor (aCol);
Standard_Real WW = HasWidth()? myOwnWidth:
- AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line);
+ myDrawer->HasLink() ?
+ AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) : 1.;
- if (!myDrawer->HasLineAspect ())
+ if (!myDrawer->HasOwnLineAspect ())
myDrawer->SetLineAspect (new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
else
myDrawer->LineAspect()->SetColor(aCol);
if (!HasWidth()) myDrawer->SetLineAspect(NullAsp);
else{
- Quantity_Color CC;
- if( HasColor() ) CC = myOwnColor;
- else AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
+ Quantity_Color CC = Quantity_NOC_YELLOW;
+ if( HasColor() ) CC = myDrawer->Color();
+ else if (myDrawer->HasLink()) AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, CC);
myDrawer->LineAspect()->SetColor(CC);
- myOwnColor = CC;
+ myDrawer->SetColor (CC);
}
}
{
myOwnWidth=aValue;
- if (!myDrawer->HasLineAspect ()) {
- Quantity_Color CC;
- if( HasColor() ) CC = myOwnColor;
- else AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
- myDrawer->SetLineAspect (new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,aValue));
+ if (!myDrawer->HasOwnLineAspect ()) {
+ Quantity_Color CC = Quantity_NOC_YELLOW;
+ if( HasColor() ) CC = myDrawer->Color();
+ else if(myDrawer->HasLink()) AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line, CC);
+ myDrawer->SetLineAspect (new Prs3d_LineAspect (CC, Aspect_TOL_SOLID, aValue));
} else
myDrawer->LineAspect()->SetWidth(aValue);
}
if (!HasColor()) myDrawer->SetLineAspect(NullAsp);
else{
- Standard_Real WW = AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line);
+ Standard_Real WW = myDrawer->HasLink() ?
+ AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line) : 1.;
myDrawer->LineAspect()->SetWidth(WW);
myOwnWidth = WW;
}