mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0023705: Isoline in the AIS viewer is not trimmed
This commit is contained in:
parent
4e57c75ee1
commit
1c88cbaf14
@ -142,6 +142,7 @@ void StdPrs_WFDeflectionRestrictedFace::Add
|
|||||||
gp_Pnt dummypnt;
|
gp_Pnt dummypnt;
|
||||||
Standard_Real ddefle= Max(UMax-UMin, VMax-VMin) * aDrawer->DeviationCoefficient();
|
Standard_Real ddefle= Max(UMax-UMin, VMax-VMin) * aDrawer->DeviationCoefficient();
|
||||||
TColgp_SequenceOfPnt2d tabP;
|
TColgp_SequenceOfPnt2d tabP;
|
||||||
|
Standard_Real aHatchingTol = 1.e100;
|
||||||
|
|
||||||
UMin = VMin = 1.e100;
|
UMin = VMin = 1.e100;
|
||||||
UMax = VMax = -1.e100;
|
UMax = VMax = -1.e100;
|
||||||
@ -169,6 +170,7 @@ void StdPrs_WFDeflectionRestrictedFace::Add
|
|||||||
UMax = Max(P2.X(), UMax);
|
UMax = Max(P2.X(), UMax);
|
||||||
VMin = Min(P2.Y(), VMin);
|
VMin = Min(P2.Y(), VMin);
|
||||||
VMax = Max(P2.Y(), VMax);
|
VMax = Max(P2.Y(), VMax);
|
||||||
|
aHatchingTol = Min(P1.SquareDistance(P2), aHatchingTol);
|
||||||
|
|
||||||
if(Orient == TopAbs_FORWARD ) {
|
if(Orient == TopAbs_FORWARD ) {
|
||||||
//isobuild.Trim(P1,P2);
|
//isobuild.Trim(P1,P2);
|
||||||
@ -215,6 +217,8 @@ void StdPrs_WFDeflectionRestrictedFace::Add
|
|||||||
UMax = Max(P2.X(), UMax);
|
UMax = Max(P2.X(), UMax);
|
||||||
VMin = Min(P2.Y(), VMin);
|
VMin = Min(P2.Y(), VMin);
|
||||||
VMax = Max(P2.Y(), VMax);
|
VMax = Max(P2.Y(), VMax);
|
||||||
|
aHatchingTol = Min(P1.SquareDistance(P2), aHatchingTol);
|
||||||
|
|
||||||
if(Orient == TopAbs_FORWARD ) {
|
if(Orient == TopAbs_FORWARD ) {
|
||||||
// isobuild.Trim(P1,P2);
|
// isobuild.Trim(P1,P2);
|
||||||
tabP.Append(P1);
|
tabP.Append(P1);
|
||||||
@ -236,8 +240,13 @@ void StdPrs_WFDeflectionRestrictedFace::Add
|
|||||||
FFaceTimer2.Start();
|
FFaceTimer2.Start();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Compute the hatching tolerance.
|
||||||
|
aHatchingTol *= 0.1;
|
||||||
|
aHatchingTol = Max(Precision::Confusion(), aHatchingTol);
|
||||||
|
aHatchingTol = Min(1.e-5, aHatchingTol);
|
||||||
|
|
||||||
// load the isos
|
// load the isos
|
||||||
Hatch_Hatcher isobuild(1.e-5,ToolRst.IsOriented());
|
Hatch_Hatcher isobuild(aHatchingTol, ToolRst.IsOriented());
|
||||||
Standard_Boolean UClosed = aFace->IsUClosed();
|
Standard_Boolean UClosed = aFace->IsUClosed();
|
||||||
Standard_Boolean VClosed = aFace->IsVClosed();
|
Standard_Boolean VClosed = aFace->IsVClosed();
|
||||||
|
|
||||||
|
@ -55,8 +55,10 @@
|
|||||||
#include <Aspect_InteriorStyle.hxx>
|
#include <Aspect_InteriorStyle.hxx>
|
||||||
#include <Graphic3d_AspectFillArea3d.hxx>
|
#include <Graphic3d_AspectFillArea3d.hxx>
|
||||||
#include <Graphic3d_TextureRoot.hxx>
|
#include <Graphic3d_TextureRoot.hxx>
|
||||||
|
#include <Graphic3d_AspectLine3d.hxx>
|
||||||
#include <Image_AlienPixMap.hxx>
|
#include <Image_AlienPixMap.hxx>
|
||||||
#include <Prs3d_ShadingAspect.hxx>
|
#include <Prs3d_ShadingAspect.hxx>
|
||||||
|
#include <Prs3d_IsoAspect.hxx>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include <config.h>
|
# include <config.h>
|
||||||
@ -90,6 +92,7 @@ extern int ViewerMainLoop(Standard_Integer argc, const char** argv);
|
|||||||
#define DEFAULT_COLOR Quantity_NOC_GOLDENROD
|
#define DEFAULT_COLOR Quantity_NOC_GOLDENROD
|
||||||
#define DEFAULT_MATERIAL Graphic3d_NOM_BRASS
|
#define DEFAULT_MATERIAL Graphic3d_NOM_BRASS
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : GetColorFromName
|
//function : GetColorFromName
|
||||||
//purpose : get the Quantity_NameOfColor from a string
|
//purpose : get the Quantity_NameOfColor from a string
|
||||||
@ -578,6 +581,122 @@ void ViewerTest::StandardModeActivation(const Standard_Integer mode )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
//function : CopyIsoAspect
|
||||||
|
//purpose : Returns copy Prs3d_IsoAspect with new number of isolines.
|
||||||
|
//==============================================================================
|
||||||
|
static Handle(Prs3d_IsoAspect) CopyIsoAspect
|
||||||
|
(const Handle(Prs3d_IsoAspect) &theIsoAspect,
|
||||||
|
const Standard_Integer theNbIsos)
|
||||||
|
{
|
||||||
|
Quantity_Color aColor;
|
||||||
|
Aspect_TypeOfLine aType;
|
||||||
|
Standard_Real aWidth;
|
||||||
|
|
||||||
|
theIsoAspect->Aspect()->Values(aColor, aType, aWidth);
|
||||||
|
|
||||||
|
Handle(Prs3d_IsoAspect) aResult =
|
||||||
|
new Prs3d_IsoAspect(aColor, aType, aWidth, theNbIsos);
|
||||||
|
|
||||||
|
return aResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
//function : visos
|
||||||
|
//purpose : Returns or sets the number of U- and V- isos and isIsoOnPlane flag
|
||||||
|
//Draw arg : [name1 ...] [nbUIsos nbVIsos IsoOnPlane(0|1)]
|
||||||
|
//==============================================================================
|
||||||
|
static int visos (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
|
||||||
|
{
|
||||||
|
if (TheAISContext().IsNull()) {
|
||||||
|
di << argv[0] << " Call 'vinit' before!\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc <= 1) {
|
||||||
|
di << "Current number of isos : " <<
|
||||||
|
TheAISContext()->IsoNumber(AIS_TOI_IsoU) << " " <<
|
||||||
|
TheAISContext()->IsoNumber(AIS_TOI_IsoV) << "\n";
|
||||||
|
di << "IsoOnPlane mode is " <<
|
||||||
|
(TheAISContext()->IsoOnPlane() ? "ON" : "OFF") << "\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer aLastInd = argc - 1;
|
||||||
|
Standard_Boolean isChanged = Standard_False;
|
||||||
|
Standard_Integer aNbUIsos;
|
||||||
|
Standard_Integer aNbVIsos;
|
||||||
|
|
||||||
|
if (aLastInd >= 3) {
|
||||||
|
Standard_Boolean isIsoOnPlane = Standard_False;
|
||||||
|
|
||||||
|
if (strcmp(argv[aLastInd], "1") == 0) {
|
||||||
|
isIsoOnPlane = Standard_True;
|
||||||
|
isChanged = Standard_True;
|
||||||
|
} else if (strcmp(argv[aLastInd], "0") == 0) {
|
||||||
|
isIsoOnPlane = Standard_False;
|
||||||
|
isChanged = Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isChanged) {
|
||||||
|
aNbVIsos = Draw::Atoi(argv[aLastInd - 1]);
|
||||||
|
aNbUIsos = Draw::Atoi(argv[aLastInd - 2]);
|
||||||
|
aLastInd -= 3;
|
||||||
|
|
||||||
|
di << "New number of isos : " << aNbUIsos << " " << aNbVIsos << "\n";
|
||||||
|
di << "New IsoOnPlane mode is " << (isIsoOnPlane ? "ON" : "OFF") << "\n";
|
||||||
|
|
||||||
|
TheAISContext()->IsoOnPlane(isIsoOnPlane);
|
||||||
|
|
||||||
|
if (aLastInd == 0) {
|
||||||
|
// If there are no shapes provided set the default numbers.
|
||||||
|
TheAISContext()->SetIsoNumber(aNbUIsos, AIS_TOI_IsoU);
|
||||||
|
TheAISContext()->SetIsoNumber(aNbVIsos, AIS_TOI_IsoV);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer i;
|
||||||
|
|
||||||
|
for (i = 1; i <= aLastInd; i++) {
|
||||||
|
TCollection_AsciiString name(argv[i]);
|
||||||
|
Standard_Boolean IsBound = GetMapOfAIS().IsBound2(name);
|
||||||
|
|
||||||
|
if (IsBound) {
|
||||||
|
const Handle(Standard_Transient) anObj = GetMapOfAIS().Find2(name);
|
||||||
|
if (anObj->IsKind(STANDARD_TYPE(AIS_InteractiveObject))) {
|
||||||
|
const Handle(AIS_InteractiveObject) aShape =
|
||||||
|
Handle(AIS_InteractiveObject)::DownCast (anObj);
|
||||||
|
Handle(AIS_Drawer) CurDrawer = aShape->Attributes();
|
||||||
|
Handle(Prs3d_IsoAspect) aUIso = CurDrawer->UIsoAspect();
|
||||||
|
Handle(Prs3d_IsoAspect) aVIso = CurDrawer->VIsoAspect();
|
||||||
|
|
||||||
|
if (isChanged) {
|
||||||
|
CurDrawer->SetUIsoAspect(CopyIsoAspect(aUIso, aNbUIsos));
|
||||||
|
CurDrawer->SetVIsoAspect(CopyIsoAspect(aVIso, aNbVIsos));
|
||||||
|
TheAISContext()->SetLocalAttributes
|
||||||
|
(aShape, CurDrawer, Standard_False);
|
||||||
|
TheAISContext()->Redisplay(aShape);
|
||||||
|
} else {
|
||||||
|
di << "Number of isos for " << argv[i] << " : "
|
||||||
|
<< aUIso->Number() << " " << aVIso->Number() << "\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
di << argv[i] << ": Not an AIS interactive object!\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
di << argv[i] << ": Use 'vdisplay' before\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isChanged) {
|
||||||
|
TheAISContext()->UpdateCurrentViewer();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
//function : VDispAreas,VDispSensitive,...
|
//function : VDispAreas,VDispSensitive,...
|
||||||
//purpose : Redraw the view
|
//purpose : Redraw the view
|
||||||
@ -3373,6 +3492,10 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
|
|||||||
const char *group = "AIS_Display";
|
const char *group = "AIS_Display";
|
||||||
|
|
||||||
// display
|
// display
|
||||||
|
theCommands.Add("visos",
|
||||||
|
"visos [name1 ...] [nbUIsos nbVIsos IsoOnPlane(0|1)]\n"
|
||||||
|
"\tIf last 3 optional parameters are not set prints numbers of U-, V- isolines and IsoOnPlane.\n",
|
||||||
|
__FILE__, visos, group);
|
||||||
|
|
||||||
theCommands.Add("vdisplay",
|
theCommands.Add("vdisplay",
|
||||||
"vdisplay : vdisplay2 name1 [name2] ... [name n] ",
|
"vdisplay : vdisplay2 name1 [name2] ... [name n] ",
|
||||||
|
22
tests/bugs/vis/bug23705
Executable file
22
tests/bugs/vis/bug23705
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "CR23705"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
###############################################################
|
||||||
|
## Isoline in the AIS viewer is not trimmed
|
||||||
|
###############################################################
|
||||||
|
|
||||||
|
restore [locate_data_file bug23705_plancher20igs_face.brep] result
|
||||||
|
|
||||||
|
vinit
|
||||||
|
visos 10 10 1
|
||||||
|
|
||||||
|
vdisplay result
|
||||||
|
vfit
|
||||||
|
|
||||||
|
set x 326
|
||||||
|
set y 295
|
||||||
|
|
||||||
|
checkcolor $x $y 0 0 0
|
||||||
|
|
||||||
|
set only_screen 1
|
Loading…
x
Reference in New Issue
Block a user