returns mutable Circle from AIS;
---Purpose: Initializes this algorithm for constructing AIS circle
-- datums initializes the circle aCircle
- Create(aCircle : Circle from Geom;
- aUStart : Real from Standard;
- aUEnd : Real from Standard;
- aSens : Boolean from Standard = Standard_True)
+ Create(theCircle : Circle from Geom;
+ theUStart : Real from Standard;
+ theUEnd : Real from Standard;
+ theIsFilledCircleSens : Boolean from Standard = Standard_False)
returns mutable Circle from AIS;
- ---Purpose: Initializes this algorithm for constructing AIS circle datums.
- -- Initializes the circle aCircle, the arc
- -- starting point UStart, the arc ending point UEnd,
- -- and the direction aSens.
+ ---Purpose: Initializes this algorithm for constructing AIS circle datums.
+ -- Initializes the circle theCircle, the arc
+ -- starting point theUStart, the arc ending point theUEnd,
+ -- and the type of sensitivity theIsFilledCircleSens.
Compute(me : mutable;
aPresentationManager: PresentationManager3d from PrsMgr;
is redefined static;
---Purpose: Removes width settings from the solid line boundary of the circle datum.
+ IsFilledCircleSens (me) returns Boolean from Standard;
+ ---C++: inline
+ ---Purpose: Returns the type of sensitivity for the circle;
+
+ SetFilledCircleSens (me: mutable;
+ theIsFilledCircleSens : Boolean from Standard);
+ ---C++: inline
+ ---Purpose: Sets the type of sensitivity for the circle. If theIsFilledCircleSens set to Standard_True
+ -- then the whole circle will be detectable, otherwise only the boundary of the circle.
ComputeCircle(me: mutable;
aPresentation : mutable Presentation from Prs3d)
myUStart : Real from Standard;
myUEnd : Real from Standard;
myCircleIsArc : Boolean from Standard;
- mySens : Boolean from Standard;
+ myIsFilledCircleSens : Boolean from Standard;
end Circle ;
myComponent(aComponent),
myUStart(0.),
myUEnd(2*M_PI),
-myCircleIsArc(Standard_False)
+myCircleIsArc(Standard_False),
+myIsFilledCircleSens (Standard_False)
{
}
//function : AIS_Circle
//purpose :
//=======================================================================
-AIS_Circle::AIS_Circle(const Handle(Geom_Circle)& aComponent,
- const Standard_Real aUStart,
- const Standard_Real aUEnd,
- const Standard_Boolean aSens):
- AIS_InteractiveObject(PrsMgr_TOP_AllView)
+AIS_Circle::AIS_Circle(const Handle(Geom_Circle)& theComponent,
+ const Standard_Real theUStart,
+ const Standard_Real theUEnd,
+ const Standard_Boolean theIsFilledCircleSens)
+: AIS_InteractiveObject(PrsMgr_TOP_AllView),
+ myComponent (theComponent),
+ myUStart (theUStart),
+ myUEnd (theUEnd),
+ myCircleIsArc (Standard_True),
+ myIsFilledCircleSens (theIsFilledCircleSens)
{
- myComponent = aComponent;
- myUStart = aUStart;
- myUEnd = aUEnd;
- mySens = aSens;
- myCircleIsArc = Standard_True;
}
//=======================================================================
void AIS_Circle::ComputeCircleSelection(const Handle(SelectMgr_Selection)& aSelection)
{
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this);
- Handle(Select3D_SensitiveCircle) seg = new Select3D_SensitiveCircle(eown,
- myComponent);
+ Handle(Select3D_SensitiveCircle) seg = new Select3D_SensitiveCircle (eown,
+ myComponent,
+ myIsFilledCircleSens);
aSelection->Add(seg);
}
//=======================================================================
Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this);
- Handle(Select3D_SensitiveCircle) seg = new Select3D_SensitiveCircle(eown,
- myComponent,myUStart,myUEnd);
+ Handle(Select3D_SensitiveCircle) seg = new Select3D_SensitiveCircle (eown,
+ myComponent,
+ myUStart, myUEnd,
+ myIsFilledCircleSens);
aSelection->Add(seg);
}
{myUStart=U;myCircleIsArc = Standard_True;}
inline void AIS_Circle::SetLastParam(const Standard_Real U)
{myUEnd=U; myCircleIsArc = Standard_True;}
+
+inline Standard_Boolean AIS_Circle::IsFilledCircleSens() const
+{
+ return myIsFilledCircleSens;
+}
+
+inline void AIS_Circle::SetFilledCircleSens (const Standard_Boolean theIsFilledCircleSens)
+{
+ myIsFilledCircleSens = theIsFilledCircleSens;
+}
NameOfColor from Quantity,
Color from Quantity,
Selection from SelectMgr,
+ TypeOfSensitivity from Select3D,
Pnt from gp,
Projector from Prs3d,
Transformation from Geom,
SetContext(me:mutable; aCtx : InteractiveContext from AIS) is redefined;
---Purpose: connection to <aCtx> default drawer implies a recomputation of Frame values.
+ TypeOfSensitivity (me) returns TypeOfSensitivity from Select3D;
+ ---C++: inline
+ ---Purpose: Returns the type of sensitivity for the plane;
+
+ SetTypeOfSensitivity (me: mutable;
+ theTypeOfSensitivity: TypeOfSensitivity from Select3D);
+ ---C++: inline
+ ---Purpose: Sets the type of sensitivity for the plane.
+
-- Methods from PresentableObject
Compute(me : mutable;
myTypeOfPlane : TypeOfPlane from AIS;
myIsXYZPlane : Boolean from Standard;
myHasOwnSize : Boolean from Standard;
+ myTypeOfSensitivity: TypeOfSensitivity from Select3D;
end Plane;
myCurrentMode(aCurrentMode),
myAutomaticPosition(Standard_True),
myTypeOfPlane(AIS_TOPL_Unknown),
-myIsXYZPlane(Standard_False)
+myIsXYZPlane(Standard_False),
+myTypeOfSensitivity (Select3D_TOS_BOUNDARY)
{
InitDrawerAttributes();
}
myCurrentMode(aCurrentMode),
myAutomaticPosition(Standard_True),
myTypeOfPlane(AIS_TOPL_Unknown),
-myIsXYZPlane(Standard_False)
+myIsXYZPlane(Standard_False),
+myTypeOfSensitivity (Select3D_TOS_BOUNDARY)
{
InitDrawerAttributes();
}
myCurrentMode(aCurrentMode),
myAutomaticPosition(Standard_False),
myTypeOfPlane(AIS_TOPL_Unknown),
-myIsXYZPlane(Standard_False)
+myIsXYZPlane(Standard_False),
+myTypeOfSensitivity (Select3D_TOS_BOUNDARY)
{
InitDrawerAttributes();
SetHilightMode(0);
myCurrentMode(aCurrentMode),
myAutomaticPosition(Standard_True),
myTypeOfPlane(aPlaneType),
-myIsXYZPlane(Standard_True)
+myIsXYZPlane(Standard_True),
+myTypeOfSensitivity (Select3D_TOS_BOUNDARY)
{
InitDrawerAttributes();
ComputeFields();
thegoodpl->D0(-lx,-ly,arr(3));
thegoodpl->D0(-lx,ly,arr(4));
arr(5) = arr(1);
- sfac = new Select3D_SensitiveFace(eown,harr,Select3D_TOS_BOUNDARY);
+ sfac = new Select3D_SensitiveFace(eown,harr,myTypeOfSensitivity);
}
else {
arr1(2) = myPmin;
arr1(3) = myPmax;
arr1(4) = myCenter;
- sfac = new Select3D_SensitiveFace(eown,harr1,Select3D_TOS_BOUNDARY);
+ sfac = new Select3D_SensitiveFace(eown,harr1,myTypeOfSensitivity);
}
aSelection->Add(sfac);
{
myCenter = aCenter;
}
+
+inline Select3D_TypeOfSensitivity AIS_Plane::TypeOfSensitivity() const
+{
+ return myTypeOfSensitivity;
+}
+
+inline void AIS_Plane::SetTypeOfSensitivity (const Select3D_TypeOfSensitivity theTypeOfSensitivity)
+{
+ myTypeOfSensitivity = theTypeOfSensitivity;
+}
---Category: sensitive entities
- enumeration TypeOfSensitivity is TOS_INTERIOR,TOS_BOUNDARY,TOS_EXTERIOR
+ enumeration TypeOfSensitivity is TOS_INTERIOR,TOS_BOUNDARY
end TypeOfSensitivity;
---Purpose: Provides values for type of sensitivity in 3D.
-- These are used to specify whether it is the interior,
//==============================================================================
//function : VPlaneBuilder
//purpose : Build an AIS_Plane from selected entities or Named AIS components
-//Draw arg : vplane PlaneName [AxisName] [PointName]
-// [PointName] [PointName] [PointName]
-// [PlaneName] [PointName]
+//Draw arg : vplane PlaneName [AxisName] [PointName] [TypeOfSensitivity]
+// [PointName] [PointName] [PointName] [TypeOfSensitivity]
+// [PlaneName] [PointName] [TypeOfSensitivity]
//==============================================================================
static Standard_Integer VPlaneBuilder (Draw_Interpretor& /*di*/,
Standard_Integer aCurrentIndex;
// Verification
- if (argc<2 || argc>5 )
+ if (argc<2 || argc>6 )
{
std::cout<<" Syntax error\n";
return 1;
}
- if (argc==5 || argc==4)
+ if (argc == 6 || argc==5 || argc==4)
hasArg=Standard_True;
else
hasArg=Standard_False;
Handle(Geom_Plane) aGeomPlane = MkPlane.Value();
Handle(AIS_Plane) anAISPlane = new AIS_Plane(aGeomPlane );
GetMapOfAIS().Bind (anAISPlane,aName );
+ if (argc == 6)
+ {
+ Standard_Integer aType = Draw::Atoi (argv[5]);
+ if (aType != 0 && aType != 1)
+ {
+ std::cout << "vplane error: wrong type of sensitivity!\n"
+ << "Should be one of the following values:\n"
+ << "0 - Interior\n"
+ << "1 - Boundary"
+ << std::endl;
+ return 1;
+ }
+ else
+ {
+ anAISPlane->SetTypeOfSensitivity (Select3D_TypeOfSensitivity (aType));
+ }
+ }
TheAISContext()->Display(anAISPlane);
}
Handle(Geom_Plane) aGeomPlane = new Geom_Plane(B,D);
Handle(AIS_Plane) anAISPlane = new AIS_Plane(aGeomPlane,B );
GetMapOfAIS().Bind (anAISPlane,aName );
+ if (argc == 5)
+ {
+ Standard_Integer aType = Draw::Atoi (argv[4]);
+ if (aType != 0 && aType != 1)
+ {
+ std::cout << "vplane error: wrong type of sensitivity!\n"
+ << "Should be one of the following values:\n"
+ << "0 - Interior\n"
+ << "1 - Boundary"
+ << std::endl;
+ return 1;
+ }
+ else
+ {
+ anAISPlane->SetTypeOfSensitivity (Select3D_TypeOfSensitivity (aType));
+ }
+ }
TheAISContext()->Display(anAISPlane);
}
// Construction of an AIS_Plane
Handle(AIS_Plane) anAISPlane = new AIS_Plane(aNewGeomPlane, B);
GetMapOfAIS().Bind (anAISPlane, aName);
+ if (argc == 5)
+ {
+ Standard_Integer aType = Draw::Atoi (argv[4]);
+ if (aType != 0 && aType != 1)
+ {
+ std::cout << "vplane error: wrong type of sensitivity!\n"
+ << "Should be one of the following values:\n"
+ << "0 - Interior\n"
+ << "1 - Boundary"
+ << std::endl;
+ return 1;
+ }
+ else
+ {
+ anAISPlane->SetTypeOfSensitivity (Select3D_TypeOfSensitivity (aType));
+ }
+ }
TheAISContext()->Display(anAISPlane);
}
// Error
else
{
aCircle = new AIS_Circle(theGeomCircle);
+ Handle(AIS_Circle)::DownCast (aCircle)->SetFilledCircleSens (Standard_False);
}
// Check if there is an object with given name
__FILE__,VPointBuilder,group);
theCommands.Add("vplane",
- "vplane PlaneName [AxisName/PlaneName/PointName] [PointName/PointName/PointName] [Nothing/Nothing/PointName] ",
+ "vplane PlaneName [AxisName/PlaneName/PointName] [PointName/PointName/PointName] [Nothing/Nothing/PointName] [TypeOfSensitivity]",
__FILE__,VPlaneBuilder,group);
theCommands.Add("vplanepara",
--- /dev/null
+puts "============"
+puts "CR24420"
+puts "============"
+puts ""
+
+#######################################################################
+# Test for type of sensitivity of AIS_Plane
+#######################################################################
+
+set aV "Driver1/Viewer1/View1"
+vinit name=$aV l=32 t=32 w=400 h=400
+vactivate $aV
+vclear
+
+vpoint p1 0 0 0
+vpoint p2 1 0 0
+vpoint p3 0 1 0
+
+puts "Testing Select3D_TOS_INTERIOR type of sensitivity:"
+vplane pl1 p1 p2 p3 0
+vfit
+
+vmoveto 200 200
+checkcolor 395 200 0 1 1
+
+if { $stat != 1 } {
+ puts "Error : Select3D_SensitiveFace does not work properly with type of sensitivity Select3D_TOS_INTERIOR!"
+}
+
+verase pl1
+
+puts "Testing Select3D_TOS_BOUNDARY type of sensitivity:"
+
+vplane pl2 p1 p2 p3 1
+vfit
+
+vmoveto 200 200
+checkcolor 395 200 0.5 0.8 0.9
+
+if { $stat != 1 } {
+ puts "Error : Select3D_SensitiveFace does not work properly with type of sensitivity Select3D_TOS_BOUNDARY!"
+}
+
+vmoveto 395 200
+checkcolor 395 200 0 1 1
+
+if { $stat != 1 } {
+ puts "Error : Select3D_SensitiveFace does not work properly with type of sensitivity Select3D_TOS_BOUNDARY!"
+}