1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

Compare commits

..

14 Commits

Author SHA1 Message Date
ichesnok
48b9b87388 0033451: Saving texture to buffer
New field was added in XCAFDoc_VisMaterialTool class for store texture
in buffer or use file reading. User can change this parameter with
XSetUseTextureBuffer command.
2023-09-01 12:27:21 +01:00
ichesnok
351f09c8bb 0033183: Data Exchange - Lose texture after saving XBF file
Texture reading and writing changed in VisMaterial drivers
2023-08-31 15:56:33 +01:00
akaftasev
0e97c80e6a 0033446: Modeling Alghorithms - Creating offset with one of the degenerated edge leads to crash
Added condition to prevent out of range error
2023-08-24 15:11:57 +01:00
akaftasev
73914537d1 0033445: Coding - Changing binary XOR in boolean expression
Changed binary XOR to the ternary operator.
2023-08-10 20:33:23 +01:00
akaftasev
ae1683705e 0033420: Modeling Algorithm - Missing inner part after offset operation
Added condition to not remove face image, consisting only of invalid edges for artifactically invalid face.
This face image should be connected with other image faces minimum through the edge.
2023-08-07 11:32:08 +01:00
oan
f3a66dd7c0 0033436: Data Exchange, DE_Wrapper - DEXCAFCascade_ConfigurationNode::BuildProvider() not initialize provider
Pass pointer to DEXCAFCascade_ConfigurationNode to DEXCAFCascade_Provider;
Remove forcible manual reset of Provider's node in DE_Wrapper::FindProvider() to verify that all specializations of configuration node work properly without necessity of workarounds.
2023-08-07 11:30:06 +01:00
akaftasev
eb2be8bb46 0033421: Modeling Algorithms - ShapeUpgrade_UnifySameDomain throws exception
In method ShapeUpgrade_UnifySameDomain::IntUnifyFaces() the searched edge is finally checked that it is not empty before accessing it.
2023-08-07 11:26:07 +01:00
akaftasev
b32425859a 0031217: Modeling Algorithms - Exception is raised in GeomFill_SectionPlacement when parallel path and SectionAxis
Added protection from crashes when IsParallel
2023-08-07 11:23:54 +01:00
akaftasev
96d1fe2b05 0033398: Modeling Algorithms - ShapeUpgrade_UnifySameDomain throws exception on specific STEP model
Added additional checking in static method FindCoordBounds to avoid processing null pcurves
2023-08-07 11:21:47 +01:00
akaftasev
5e53920228 0026578: Modeling Algorithm - Exceptions in offset operation with intersection
Added test cases
2023-08-07 11:19:24 +01:00
ichesnok
2a0420be1d 0032681: Data Exchange - Missed dimension after STEP export
Changed level of detalisation (TopAbs_EDGE -> TopAbs_VERTEX by default)
2023-08-02 10:24:47 +01:00
sshutina
3421323164 0032879: Visualization, AIS_ViewController - define separate gesture mappings for dragging
Fixed problem of usage of objects dragging during zoom and pan
Added new draw command to change gesture for muse buttons
Added test
2023-07-18 16:20:12 +01:00
dkulikov
1dad584450 0033419: Tests - Updating test case data
Filenames in bug33414 are updated.
2023-07-05 13:01:49 +01:00
btokarev
a958a3377e 33343: Documentation, Overview - Incorrect doxygen syntax
Removed inclusions of empathized *text* from the titles
Text empathizers re-implemented
Reverted to no empathize style
2023-07-05 12:58:03 +01:00
46 changed files with 1054 additions and 255 deletions

View File

@@ -725,7 +725,7 @@ Another possible problem is the order of initialization of global variables defi
Avoid explicit usage of basic types (*int*, *float*, *double*, etc.), use Open CASCADE Technology types from package *Standard: Standard_Integer, Standard_Real, Standard_ShortReal, Standard_Boolean, Standard_CString* and others or a specific *typedef* instead.
### Use *sizeof()* to calculate sizes [MANDATORY]
### Use sizeof() to calculate sizes [MANDATORY]
Do not assume sizes of types. Use *sizeof()* instead to calculate sizes.
@@ -738,7 +738,7 @@ It is recommended to follow this rule for any plain text files for consistency a
The rules listed in this chapter are important for stability of the programs that use Open CASCADE Technology libraries.
### Use *OSD::SetSignal()* to catch exceptions
### Use OSD::SetSignal() to catch exceptions
When using Open CASCADE Technology in an application, call *OSD::SetSignal()* function when the application is initialized.
@@ -787,7 +787,7 @@ See the following example:
In C++ use *new* and *delete* operators instead of *malloc()* and *free()*. Try not to mix different memory allocation techniques.
### Match *new* and *delete* [MANDATORY]
### Match new and delete [MANDATORY]
Use the same form of new and delete.
@@ -812,7 +812,7 @@ Standard_Integer aTmpVar2 = 0; // OK
Uninitialized variables might be kept only within performance-sensitive code blocks and only when their initialization is guaranteed by subsequent code.
### Do not hide global *new*
### Do not hide global new
Avoid hiding the global *new* operator.

View File

@@ -780,7 +780,7 @@ restore theBox
@subsubsection occt_draw_3_3_1 set
#### In *DrawTrSurf* package:
#### In DrawTrSurf package:
~~~~{.php}
void Set(Standard_CString& Name,const gp_Pnt& G) ;
@@ -797,7 +797,7 @@ void Set(Standard_CString& Name,
const Handle(Poly_Polygon2D)& P) ;
~~~~
#### In *DBRep* package:
#### In DBRep package:
~~~~{.php}
void Set(const Standard_CString Name,
@@ -822,13 +822,13 @@ DBRep::Set(char*,B);
@subsubsection occt_draw_3_3_2 get
#### In *DrawTrSurf* package:
#### In DrawTrSurf package:
~~~~{.php}
Handle_Geom_Geometry Get(Standard_CString& Name) ;
~~~~
#### In *DBRep* package:
#### In DBRep package:
~~~~{.php}
TopoDS_Shape Get(Standard_CString& Name,

View File

@@ -1047,11 +1047,13 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
: 0.0;
if (double (Abs (aDelta.x())) > aZoomTol)
{
if (UpdateZoom (Aspect_ScrollDelta (aDelta.x())))
{
toUpdateView = true;
}
UpdateZoom (Aspect_ScrollDelta (aDelta.x()));
myUI.Dragging.ToMove = true;
myUI.Dragging.PointTo = thePoint;
myMouseProgressPoint = thePoint;
toUpdateView = true;
}
break;
}
@@ -1075,7 +1077,6 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
}
aDelta.y() = -aDelta.y();
myMouseProgressPoint = thePoint;
if (myUI.Panning.ToPan)
{
myUI.Panning.Delta += aDelta;
@@ -1085,6 +1086,12 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
myUI.Panning.ToPan = true;
myUI.Panning.Delta = aDelta;
}
myUI.Dragging.ToMove = true;
myUI.Dragging.PointTo = thePoint;
myMouseProgressPoint = thePoint;
toUpdateView = true;
}
break;
@@ -3053,6 +3060,8 @@ void AIS_ViewController::handleDynamicHighlight (const Handle(AIS_InteractiveCon
OnObjectDragged (theCtx, theView, AIS_DragAction_Update);
myGL.OrbitRotation.ToRotate = false;
myGL.ViewRotation .ToRotate = false;
myGL.Panning .ToPan = false;
myGL.ZoomActions.Clear();
}
}
}

View File

@@ -1177,6 +1177,45 @@ void BRepOffset_BuildOffsetFaces::IntersectTrimmedEdges (const Message_ProgressR
UpdateIntersectedEdges (aLA, aGFE);
}
namespace
{
//=======================================================================
//function : CheckConnectionsOfFace
//purpose : Checks number of connections for theFace with theLF
// Returns true if number of connections more than 1
//=======================================================================
static Standard_Boolean checkConnectionsOfFace(const TopoDS_Shape& theFace,
const TopTools_ListOfShape& theLF)
{
TopTools_IndexedMapOfShape aShapeVert;
for (TopTools_ListOfShape::Iterator aFImIterator(theLF); aFImIterator.More(); aFImIterator.Next())
{
const TopoDS_Shape& aShape = aFImIterator.Value();
if (aShape.IsSame(theFace))
{
continue;
}
TopExp::MapShapes(aShape, TopAbs_VERTEX, aShapeVert);
}
Standard_Integer aNbConnections = 0;
TopTools_IndexedMapOfShape aFaceVertices;
TopExp::MapShapes(theFace, TopAbs_VERTEX, aFaceVertices);
for (TopTools_IndexedMapOfShape::Iterator aVertIter(aFaceVertices); aVertIter.More(); aVertIter.Next())
{
const TopoDS_Shape& aVert = aVertIter.Value();
if (aShapeVert.Contains(aVert))
{
++aNbConnections;
}
if (aNbConnections > 1)
{
return Standard_True;
}
}
return Standard_False;
}
}
//=======================================================================
//function : BuildSplitsOfFaces
//purpose : Building the splits of offset faces and
@@ -1268,6 +1307,10 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
for (TopTools_ListIteratorOfListOfShape aItLFIm (aLFImages1); aItLFIm.More();)
{
Standard_Boolean bAllInv = Standard_True;
// Additional check for artificial case
// if current image face consist only of edges from aMapEInv and aMENInv
// then recheck current face for the futher processing
Standard_Boolean aToReCheckFace = bArtificialCase;
const TopoDS_Shape& aFIm = aItLFIm.Value();
TopExp_Explorer aExpE (aFIm, TopAbs_EDGE);
for (; aExpE.More(); aExpE.Next())
@@ -1278,12 +1321,19 @@ void BRepOffset_BuildOffsetFaces::BuildSplitsOfFaces (const Message_ProgressRang
bAllInv = Standard_False;
if (!aMENInv.Contains (aE))
{
aToReCheckFace = Standard_False;
break;
}
}
}
//
if (!aExpE.More())
// if current image face is to recheck then check number of connections for this face
// with other image faces for current face
if (!aExpE.More() && aToReCheckFace)
{
aToReCheckFace = checkConnectionsOfFace(aFIm, aLFImages1);
}
// do not delete image face from futher processing if aToReCheckFace is true
if (!aExpE.More() && !aToReCheckFace)
{
if (bAllInv)
{

View File

@@ -1292,6 +1292,10 @@ BRepOffsetAPI_ThruSections::Generated(const TopoDS_Shape& S)
for (; itl.More(); itl.Next())
{
Standard_Integer IndOfFace = itl.Value();
if (AllFaces.Size() < IndOfFace)
{
continue;
}
myGenerated.Append(AllFaces(IndOfFace));
}
@@ -1302,6 +1306,10 @@ BRepOffsetAPI_ThruSections::Generated(const TopoDS_Shape& S)
{
Standard_Integer IndOfFace = itl.Value();
IndOfFace += (i-1)*myNbEdgesInSection;
if (AllFaces.Size() < IndOfFace)
{
continue;
}
myGenerated.Append(AllFaces(IndOfFace));
}
}

View File

@@ -126,23 +126,68 @@ static void readColor (const BinObjMgt_Persistent& theSource,
static void writeTexture (BinObjMgt_Persistent& theTarget,
const Handle(Image_Texture)& theImage)
{
theTarget.PutAsciiString (!theImage.IsNull()
&& !theImage->FilePath().IsEmpty()
&& theImage->FileOffset() == -1
? theImage->FilePath()
: "");
if (theImage.IsNull())
{
theTarget.PutAsciiString("");
return;
}
if (theImage->DataBuffer().IsNull())
{
theTarget.PutAsciiString(theImage->FilePath());
theTarget.PutBoolean(false);
if (theImage->FileOffset() == -1 || theImage->FileLength() == -1)
{
theTarget.PutBoolean(true);
return;
}
theTarget.PutBoolean(false);
theTarget.PutInteger(static_cast<int>(theImage->FileOffset()));
theTarget.PutInteger(static_cast<int>(theImage->FileLength()));
return;
}
theTarget.PutAsciiString(theImage->TextureId());
theTarget.PutBoolean(true);
theTarget.PutInteger(static_cast<int>(theImage->DataBuffer()->Size()));
theTarget.PutByteArray((Standard_Byte*)theImage->DataBuffer()->Data(),
static_cast<int>(theImage->DataBuffer()->Size()));
}
//! Decode texture path.
static void readTexture (const BinObjMgt_Persistent& theSource,
Handle(Image_Texture)& theTexture)
{
TCollection_AsciiString aPath;
theSource.GetAsciiString (aPath);
if (!aPath.IsEmpty())
TCollection_AsciiString aStr;
theSource.GetAsciiString(aStr);
if (aStr.IsEmpty())
{
theTexture = new Image_Texture (aPath);
return;
}
Standard_Boolean anUseBuffer;
if (!theSource.GetBoolean(anUseBuffer).IsOK())
{
theTexture = new Image_Texture(aStr);
return;
}
Standard_Integer anOffset = -1, aLength = -1;
if (!anUseBuffer)
{
Standard_Boolean isOnlyFilePath;
theSource.GetBoolean(isOnlyFilePath);
if (isOnlyFilePath)
{
theTexture = new Image_Texture(aStr);
return;
}
theSource.GetInteger(anOffset);
theSource.GetInteger(aLength);
theTexture = new Image_Texture(aStr, anOffset, aLength);
return;
}
theSource.GetInteger(aLength);
Handle(NCollection_Buffer) aBuff =
new NCollection_Buffer(NCollection_BaseAllocator::CommonBaseAllocator(), aLength);
theSource.GetByteArray(aBuff->ChangeData(), aLength);
theTexture = new Image_Texture(aBuff, aStr);
}
//=======================================================================

View File

@@ -597,7 +597,7 @@ TopoDS_Edge ChFi2d_FilletAlgo::Result(const gp_Pnt& thePoint, TopoDS_Edge& theEd
gp_Vec aCircleDir;
aCircle->D1(aParam1, aPoint1, aCircleDir);
if ((aCircleDir.Angle(aDir) > M_PI / 2.0) ^ aIsOut)
if ((aCircleDir.Angle(aDir) > M_PI / 2.0) ? !aIsOut : aIsOut)
aStart = aNearest->getParam();
else
anEnd = aNearest->getParam();
@@ -619,7 +619,7 @@ TopoDS_Edge ChFi2d_FilletAlgo::Result(const gp_Pnt& thePoint, TopoDS_Edge& theEd
aCircle->D1(aParam2, aPoint2, aCircleDir);
if ((aCircleDir.Angle(aDir) > M_PI / 2.0) ^ (!aIsOut))
if ((aCircleDir.Angle(aDir) > M_PI / 2.0) ? aIsOut : !aIsOut)
aStart = aNearest->getParam2();
else
anEnd = aNearest->getParam2();

View File

@@ -538,7 +538,6 @@ Standard_Boolean DE_Wrapper::FindProvider(const TCollection_AsciiString& thePath
{
theProvider = aNode->BuildProvider();
aNode->GlobalParameters = GlobalParameters;
theProvider->SetNode(aNode);
return Standard_True;
}
}

View File

@@ -125,7 +125,7 @@ Handle(DE_ConfigurationNode) DEXCAFCascade_ConfigurationNode::Copy() const
//=======================================================================
Handle(DE_Provider) DEXCAFCascade_ConfigurationNode::BuildProvider()
{
return new DEXCAFCascade_Provider();
return new DEXCAFCascade_Provider (this);
}
//=======================================================================

View File

@@ -609,7 +609,7 @@ void GeomFill_SectionPlacement::Perform(const Handle(Adaptor3d_Curve)& Path,
myAdpSection.LastParameter(),
Path->Resolution(Tol/100),
myAdpSection.Resolution(Tol/100));
if (Ext.IsDone()) {
if (Ext.IsDone() && !Ext.IsParallel()) {
Extrema_POnCurv P1, P2;
for (ii=1; ii<=Ext.NbExt(); ii++) {
distaux = sqrt (Ext.SquareDistance(ii));

View File

@@ -73,7 +73,7 @@ Handle(Transfer_Binder) IGESControl_ActorWrite::Transfer
shape = XSAlgo::AlgoContainer()->ProcessShape( shape, Tol, maxTol,
"write.iges.resource.name",
"write.iges.sequence", info,
theProgress );
theProgress, false, TopAbs_EDGE);
// modified by NIZHNY-EAP Tue Aug 29 11:17:01 2000 ___END___
BRepToIGES_BREntity BR0; BR0.SetModel(modl); BR0.SetTransferProcess(FP);

View File

@@ -92,7 +92,7 @@ Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape,
TopoDS_Shape Shape = XSAlgo::AlgoContainer()->ProcessShape( theShape, Tol, maxTol,
"write.iges.resource.name",
"write.iges.sequence", info,
aPS.Next());
aPS.Next(), false, TopAbs_EDGE);
if (!aPS.More())
return Standard_False;

View File

@@ -198,7 +198,7 @@ Handle(Transfer_Binder) IGESToBRep_Actor::Transfer
"read.iges.resource.name",
"read.iges.sequence",
info, mymodel->ReShape(),
aPS.Next());
aPS.Next(), false, TopAbs_EDGE);
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
}

View File

@@ -226,269 +226,303 @@ TopoDS_Shape IGESToBRep_CurveAndSurface::TransferCurveAndSurface
//function : TransferGeometry
//purpose :
//=======================================================================
TopoDS_Shape IGESToBRep_CurveAndSurface::TransferGeometry
(const Handle(IGESData_IGESEntity)& theStart,
(const Handle(IGESData_IGESEntity)& start,
const Message_ProgressRange& theProgress)
{
// Declaration of messages//
// DCE 22/12/98
//Message_Msg aMsg1005("IGES_1001"); // The type of the Start is not recognized
//Message_Msg aMsg1005("IGES_1005"); // Software error : the Start IsNull.
//Message_Msg aMsg1015("IGES_1015"); // invalid type or exception raising (software error).
//Message_Msg aMsg1010("IGES_1010"); // Not sameparameter.
//Message_Msg aMsg1015("IGES_1020"); // Associated entity IsNull
//Message_Msg aMsg1015("IGES_1025"); // No shape is found for the associated entity for the type 308
//Message_Msg aMsg1015("IGES_1030"); // No shape is found for the associated entity for the type 402
//Message_Msg aMsg1015("IGES_1035"); // The conversion of a Location is not possible
//Message_Msg aMsg210 ("XSTEP_210"); // No associated entities for the type 308
//Message_Msg aMsg202 ("XSTEP_202"); // No associated entities for the type 402
//Message_Msg msg1005("IGES_1005"); // Software error : start IsNull.
//Message_Msg msg1015("IGES_1015"); // invalid type or exception raising (software error).
//Message_Msg msg1010("IGES_1010"); // Not sameparameter.
// Message_Msg msg1015("IGES_1015");
//Message_Msg msg210 ("XSTEP_210");
//Message_Msg msg202 ("XSTEP_202");
////////////////////////////
TopoDS_Shape res;
gp_Trsf T408;
if (theStart.IsNull())
{
if (start.IsNull()) {
Message_Msg msg1005("IGES_1005"); // Software error : start IsNull.
SendFail(theStart, msg1005);
SendFail(start, msg1005);
return res;
}
// Read of the DE number and the type number of the entity
Handle(TCollection_HAsciiString) label = GetModel()->StringLabel(start);
//Standard_Integer typeNumber = start->TypeNumber();
// sln 13.06.2002 OCC448: Avoid transferring invisible sub entities which
// logically depend on the one
const Standard_Integer anOnlyvisible = Interface_Static::IVal("read.iges.onlyvisible");
if (IGESToBRep::IsCurveAndSurface(theStart))
{
if(anOnlyvisible && theStart->BlankStatus() == 1)
Standard_Integer onlyvisible = Interface_Static::IVal("read.iges.onlyvisible");
if (IGESToBRep::IsCurveAndSurface(start)) {
if(onlyvisible && start->BlankStatus() == 1)
return res;
try
{
try {
OCC_CATCH_SIGNALS
res = TransferCurveAndSurface(theStart, theProgress);
res = TransferCurveAndSurface(start, theProgress);
}
catch(Standard_Failure const&)
{
catch(Standard_Failure const&) {
Message_Msg msg1015("IGES_1015");
SendFail(theStart, msg1015);
SendFail(start, msg1015);
}
return res;
}
//408 : SingularSubfigure
if (theStart->IsKind(STANDARD_TYPE(IGESBasic_SingularSubfigure)))
if (start->IsKind(STANDARD_TYPE(IGESBasic_SingularSubfigure)))
{
if(anOnlyvisible && theStart->BlankStatus() == 1)
if(onlyvisible && start->BlankStatus() == 1)
return res;
DeclareAndCast(IGESBasic_SingularSubfigure, st408, theStart);
DeclareAndCast(IGESBasic_SingularSubfigure, st408, start);
Handle (IGESBasic_SubfigureDef) stsub = st408->Subfigure();
const gp_XYZ trans = st408->Translation();
gp_XYZ trans = st408->Translation();
gp_Vec vectr(trans);
const Standard_Real scunit = GetUnitFactor();
Standard_Real scunit = GetUnitFactor();
vectr.Multiply(scunit);
T408.SetTranslation(vectr);
if (st408->HasScaleFactor())
{
const Standard_Real scalef = st408->ScaleFactor();
T408.SetScaleFactor(scalef);
if (st408->HasScaleFactor()) {
Standard_Real scalef = st408->ScaleFactor();
T408.SetScaleFactor(scalef);
}
if (HasShapeResult(stsub)) {
res = GetShapeResult(stsub);
}
if (HasShapeResult(stsub))
{
res = GetShapeResult(stsub);
}
else
{
try
{
OCC_CATCH_SIGNALS
res = TransferGeometry(stsub, theProgress);
}
catch(Standard_Failure const&)
{
res.Nullify();
const Message_Msg msg1015("IGES_1015");
SendFail(st408, msg1015);
}
if (!res.IsNull())
{
SetShapeResult(stsub, res);
}
else {
try {
OCC_CATCH_SIGNALS
res = TransferGeometry(stsub, theProgress);
}
catch(Standard_Failure const&) {
res.Nullify();
Message_Msg msg1015("IGES_1015");
SendFail( st408, msg1015);
}
if (!res.IsNull()) {
SetShapeResult(stsub,res);
}
}
}
// 308 : SubfigureDefinition
else if (theStart->IsKind(STANDARD_TYPE(IGESBasic_SubfigureDef)))
{
DeclareAndCast(IGESBasic_SubfigureDef, st308, theStart);
TopoDS_Compound aGroup;
BRep_Builder aBuilder;
aBuilder.MakeCompound (aGroup);
if (st308->NbEntities() < 1)
{
const Message_Msg msg210 ("XSTEP_210");
SendFail(st308, msg210);
else if (start->IsKind(STANDARD_TYPE(IGESBasic_SubfigureDef))) {
DeclareAndCast(IGESBasic_SubfigureDef, st308, start);
TopoDS_Compound group;
BRep_Builder B;
B.MakeCompound (group);
if (st308->NbEntities() < 1) {
Message_Msg msg210 ("XSTEP_210");
SendFail( st308, msg210);
return res;
}
Message_ProgressScope aPS (theProgress, "Subfigure item", st308->NbEntities());
for (Standard_Integer anIndx =1; anIndx <= st308->NbEntities() && aPS.More(); anIndx++)
Message_ProgressScope PS (theProgress, "Subfigure item", st308->NbEntities());
for (Standard_Integer i=1; i <= st308->NbEntities() && PS.More(); i++)
{
Message_ProgressRange aRange = aPS.Next();
TopoDS_Shape anItem;
if (st308->AssociatedEntity(anIndx).IsNull())
{
Message_Msg msg1020("IGES_1020");
msg1020.Arg(anIndx);
SendWarning(st308, msg1020);
continue;
Message_ProgressRange aRange = PS.Next();
TopoDS_Shape item;
if (st308->AssociatedEntity(i).IsNull()) {
Message_Msg msg1020("IGES_1020");
msg1020.Arg(i);
SendWarning( st308, msg1020);
continue;
}
if(anOnlyvisible && st308->AssociatedEntity(anIndx)->BlankStatus() == 1)
continue;
if (HasShapeResult(st308->AssociatedEntity(anIndx)))
{
anItem = GetShapeResult(st308->AssociatedEntity(anIndx));
if(onlyvisible && st308->AssociatedEntity(i)->BlankStatus() == 1 )
continue;
if (HasShapeResult(st308->AssociatedEntity(i)))
{
item = GetShapeResult(st308->AssociatedEntity(i));
}
else {
try {
OCC_CATCH_SIGNALS
item = TransferGeometry (st308->AssociatedEntity(i), aRange);
}
catch(Standard_Failure const&) {
item.Nullify();
Message_Msg msg1015("IGES_1015");
SendFail( st308->AssociatedEntity(i), msg1015);
}
}
else
{
try
{
OCC_CATCH_SIGNALS
anItem = TransferGeometry (st308->AssociatedEntity(anIndx), aRange);
}
catch(Standard_Failure const&)
{
anItem.Nullify();
const Message_Msg msg1015("IGES_1015");
SendFail(st308->AssociatedEntity(anIndx), msg1015);
}
if (item.IsNull()) {
Message_Msg msg1025("IGES_1025");
msg1025.Arg(i);
SendWarning (start,msg1025);
}
if (anItem.IsNull())
{
Message_Msg msg1025("IGES_1025");
msg1025.Arg(anIndx);
SendWarning (theStart, msg1025);
}
else
{
aBuilder.Add(aGroup, anItem);
SetShapeResult (st308->AssociatedEntity(anIndx), anItem);
else {
B.Add(group, item);
SetShapeResult (st308->AssociatedEntity(i),item);
}
}
res = aGroup;
res = group;
}
// 402 : Group Associativity
else if (theStart->IsKind(STANDARD_TYPE(IGESBasic_Group)))
{
if(anOnlyvisible && theStart->BlankStatus() == 1)
return res;
DeclareAndCast(IGESBasic_Group, st402f1, theStart);
TopoDS_Compound aGroup;
BRep_Builder aBuilder;
aBuilder.MakeCompound (aGroup);
const Standard_Integer aNbEnt = st402f1->NbEntities();
if (aNbEnt < 1)
{
else if (start->IsKind(STANDARD_TYPE(IGESBasic_Group))) {
if(onlyvisible && start->BlankStatus() == 1)
return res;
DeclareAndCast(IGESBasic_Group, st402f1, start);
TopoDS_Compound group;
BRep_Builder B;
B.MakeCompound (group);
if (st402f1->NbEntities() < 1) {
Message_Msg msg202 ("XSTEP_202");
msg202.Arg(st402f1->FormNumber());
SendFail(st402f1, msg202);
return res;
}
Message_ProgressScope aPS (theProgress, "Group item", aNbEnt);
Message_ProgressScope PS (theProgress, "Group item", st402f1->NbEntities());
Standard_Boolean ProblemInGroup = Standard_False;
for (Standard_Integer anIndx=1; anIndx <= aNbEnt && aPS.More(); anIndx++)
for (Standard_Integer i=1; i <= st402f1->NbEntities() && PS.More(); i++)
{
Message_ProgressRange aRange = aPS.Next();
TopoDS_Shape anItem;
if (st402f1->Entity(anIndx).IsNull())
{
Message_Msg msg1020("IGES_1020");
msg1020.Arg(anIndx);
SendFail(st402f1, msg1020);
continue;
Message_ProgressRange aRange = PS.Next();
TopoDS_Shape item;
if (st402f1->Entity(i).IsNull()) {
Message_Msg msg1020("IGES_1020");
msg1020.Arg(i);
SendFail( st402f1, msg1020);
continue;
}
if(anOnlyvisible && st402f1->Entity(anIndx)->BlankStatus() == 1)
continue;
if (HasShapeResult(st402f1->Entity(anIndx)))
{
anItem = GetShapeResult(st402f1->Entity(anIndx));
if(onlyvisible && st402f1->Entity(i)->BlankStatus() == 1)
continue;
if (HasShapeResult(st402f1->Entity(i))) {
item = GetShapeResult(st402f1->Entity(i));
}
else
{
try
{
OCC_CATCH_SIGNALS
anItem = TransferGeometry (st402f1->Entity(anIndx), aRange);
}
catch(Standard_Failure const&)
{
anItem.Nullify();
Message_Msg msg1015("IGES_1015");
SendFail(st402f1->Entity(anIndx), msg1015);
}
else {
try {
OCC_CATCH_SIGNALS
item = TransferGeometry (st402f1->Entity(i), aRange);
}
catch(Standard_Failure const&) {
item.Nullify();
Message_Msg msg1015("IGES_1015");
SendFail(st402f1->Entity(i),msg1015);
}
}
if (anItem.IsNull())
{
if (item.IsNull()) {
//Message_Msg msg1030("IGES_1030");
//msg1030.Arg(st402f1->FormNumber());
//msg1030.Arg(i);
//SendWarning (st402f1,msg1030);
ProblemInGroup = Standard_True;
}
else
{
aBuilder.Add(aGroup, anItem);
SetShapeResult (st402f1->Entity(anIndx), anItem);
else {
B.Add(group, item);
SetShapeResult (st402f1->Entity(i),item);
}
}
res = aGroup;
if(ProblemInGroup)
{
res = group;
if(ProblemInGroup) {
Message_Msg msg1030("IGES_1030");
msg1030.Arg(st402f1->FormNumber());
SendWarning (st402f1, msg1030);
SendWarning (st402f1,msg1030);
}
}
else
{
else if (start->IsKind(STANDARD_TYPE(IGESBasic_GroupWithoutBackP))) {
if(onlyvisible && start->BlankStatus() == 1)
return res;
DeclareAndCast(IGESBasic_GroupWithoutBackP, st402f7, start);
TopoDS_Compound group;
//unused Handle(TCollection_HAsciiString) label = GetModel()->StringLabel(st402f7);
BRep_Builder B;
B.MakeCompound (group);
if (st402f7->NbEntities() < 1) {
Message_Msg msg202 ("XSTEP_202");
msg202.Arg(st402f7->FormNumber());
SendFail(st402f7, msg202);
return res;
}
Message_ProgressScope PS (theProgress, "Group item", st402f7->NbEntities());
Standard_Boolean ProblemInGroup = Standard_False;
for (Standard_Integer i=1; i <= st402f7->NbEntities() && PS.More(); i++)
{
Message_ProgressRange aRange = PS.Next();
TopoDS_Shape item;
if (st402f7->Entity(i).IsNull()) {
Message_Msg msg1020("IGES_1020");
msg1020.Arg(i);
SendFail( st402f7, msg1020);
continue;
}
if(onlyvisible && st402f7->Entity(i)->BlankStatus() == 1 )
continue;
if (HasShapeResult(st402f7->Entity(i))) {
item = GetShapeResult(st402f7->Entity(i));
}
else {
try {
OCC_CATCH_SIGNALS
item = TransferGeometry (st402f7->Entity(i), aRange);
}
catch(Standard_Failure const&) {
item.Nullify();
Message_Msg msg1015("IGES_1015");
SendFail(st402f7->Entity(i),msg1015);
}
}
if (item.IsNull()) {
//Message_Msg msg1030("IGES_1030");
//msg1030.Arg(st402f7->FormNumber());
//msg1030.Arg(i);
//SendWarning (st402f7,msg1030);
ProblemInGroup = Standard_True;
}
else {
B.Add(group, item);
SetShapeResult (st402f7->Entity(i),item);
}
}
res = group;
if(ProblemInGroup) {
Message_Msg msg1030("IGES_1030");
msg1030.Arg(st402f7->FormNumber());
SendWarning (st402f7,msg1030);
}
}
else {
Message_Msg msg1001("IGES_1001");
msg1001.Arg(theStart->FormNumber());
SendFail (theStart, msg1001);
msg1001.Arg(start->FormNumber());
SendFail (start,msg1001);
return res;
}
if (theStart->HasTransf())
{
if (start->HasTransf()) {
gp_Trsf T;
SetEpsilon(1.E-04);
if (IGESData_ToolLocation::ConvertLocation(GetEpsilon(), theStart->CompoundLocation(),
T, GetUnitFactor()))
{
if (theStart->IsKind(STANDARD_TYPE(IGESBasic_SingularSubfigure)))
{
gp_XYZ tra = T.TranslationPart();
const gp_XYZ trans = T408.TranslationPart();
tra.Add(trans);
T.SetTranslationPart(tra);
Standard_Real sc = T.ScaleFactor();
const Standard_Real scalef = T408.ScaleFactor();
sc = sc*scalef;
T.SetScaleFactor(sc);
}
if (IGESData_ToolLocation::ConvertLocation(GetEpsilon(),start->CompoundLocation(),
T,GetUnitFactor())) {
if (start->IsKind(STANDARD_TYPE(IGESBasic_SingularSubfigure)))
{
gp_XYZ tra = T.TranslationPart();
gp_XYZ trans = T408.TranslationPart();
tra.Add(trans);
T.SetTranslationPart(tra);
Standard_Real sc = T.ScaleFactor();
Standard_Real scalef = T408.ScaleFactor();
sc = sc*scalef;
T.SetScaleFactor(sc);
}
TopLoc_Location L(T);
res.Move(L, Standard_False);
}
else
{
else {
Message_Msg msg1035("IGES_1035");
SendWarning (theStart, msg1035);
SendWarning (start,msg1035);
}
}
else
{
if (theStart->IsKind(STANDARD_TYPE(IGESBasic_SingularSubfigure)))
{
else {
if (start->IsKind(STANDARD_TYPE(IGESBasic_SingularSubfigure))) {
TopLoc_Location L(T408);
res.Move(L);
res.Move(L);
}
}
}
return res;
}

View File

@@ -552,7 +552,7 @@ Standard_Boolean IGESToBRep_Reader::Transfer(const Standard_Integer num,
shape = XSAlgo::AlgoContainer()->ProcessShape( shape, eps*CAS.GetUnitFactor(), CAS.GetMaxTol(),
"read.iges.resource.name",
"read.iges.sequence", info,
aPS.Next() );
aPS.Next(), false, TopAbs_EDGE);
if (aPS.UserBreak())
return Standard_False;

View File

@@ -420,3 +420,38 @@ void Image_Texture::DumpJson (Standard_OStream& theOStream, Standard_Integer the
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myOffset)
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLength)
}
// ================================================================
// Function : WriteToBuffer
// Purpose :
// ================================================================
void Image_Texture::WriteToBuffer()
{
if (this == nullptr || myImagePath.IsEmpty())
{
return;
}
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
std::shared_ptr<std::istream> aFileIn = aFileSystem->OpenIStream(myImagePath, std::ios::in | std::ios::binary);
if (aFileIn.get() == nullptr)
{
Message::SendFail(TCollection_AsciiString("Error: Unable to open file ") + myImagePath + "!");
return;
}
int64_t aLength = myLength;
if (myOffset == -1 && myLength == -1)
{
aFileIn->seekg(0, std::ios::end);
aLength = aFileIn->tellg();
aFileIn->seekg(0, std::ios::beg);
}
else
{
aFileIn->seekg(myOffset);
}
myBuffer = new NCollection_Buffer(NCollection_BaseAllocator::CommonBaseAllocator(), aLength);
aFileIn->read((char*)myBuffer->ChangeData(), aLength);
myImagePath.Clear();
}

View File

@@ -103,6 +103,10 @@ public: //! @name hasher interface
//! Dumps the content of me into the stream
Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
//! Write texture to buffer, if file path, offset and length are known
//! This function is use only when user has turn on parameter by XSetUseTextureBuffer function
Standard_EXPORT void WriteToBuffer();
protected:
//! Read image from normal image file.

View File

@@ -340,16 +340,22 @@ static Standard_Real ComputeMinEdgeSize(const TopTools_SequenceOfShape& theEdges
return MinSize;
}
static void FindCoordBounds(const TopTools_SequenceOfShape& theFaces,
const TopoDS_Face& theRefFace,
const TopTools_IndexedDataMapOfShapeListOfShape& theMapEF,
const TopTools_MapOfShape& theEdgesMap,
const Standard_Integer theIndCoord,
const Standard_Real thePeriod,
Standard_Real& theMinCoord,
Standard_Real& theMaxCoord,
Standard_Integer& theNumberOfIntervals,
Standard_Integer& theIndFaceMax)
//=======================================================================
//function : FindCoordBounds
//purpose : Searching for origin of U in 2d space
// Returns Standard_False if could not find curve on surface
// Returns Standard_True if succeed
//=======================================================================
static Standard_Boolean FindCoordBounds(const TopTools_SequenceOfShape& theFaces,
const TopoDS_Face& theRefFace,
const TopTools_IndexedDataMapOfShapeListOfShape& theMapEF,
const TopTools_MapOfShape& theEdgesMap,
const Standard_Integer theIndCoord,
const Standard_Real thePeriod,
Standard_Real& theMinCoord,
Standard_Real& theMaxCoord,
Standard_Integer& theNumberOfIntervals,
Standard_Integer& theIndFaceMax)
{
NCollection_Sequence<std::pair<Standard_Real, Standard_Real>> aPairSeq;
@@ -372,6 +378,10 @@ static void FindCoordBounds(const TopTools_SequenceOfShape& theFaces,
continue;
Standard_Real fpar, lpar;
Handle(Geom2d_Curve) aPCurve = BRep_Tool::CurveOnSurface(anEdge, theRefFace, fpar, lpar);
if (aPCurve.IsNull())
{
return Standard_False;
}
UpdateBoundaries (aPCurve, fpar, lpar, theIndCoord, aMinCoord, aMaxCoord);
}
@@ -436,6 +446,7 @@ static void FindCoordBounds(const TopTools_SequenceOfShape& theFaces,
theMinCoord = aPairSeq(1).first;
theMaxCoord = aPairSeq(1).second;
return Standard_True;
}
static void RelocatePCurvesToNewUorigin(const TopTools_SequenceOfShape& theEdges,
@@ -3297,8 +3308,11 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
//so that all the faces are in [origin, origin + Uperiod]
Standard_Real aMinCoord, aMaxCoord; //Umin, Umax;
Standard_Integer aNumberOfIntervals, i_face_max;
FindCoordBounds (faces, F_RefFace, aMapEF, edgesMap, ii+1, aPeriods[ii],
aMinCoord, aMaxCoord, aNumberOfIntervals, i_face_max);
if (!FindCoordBounds(faces, F_RefFace, aMapEF, edgesMap, ii + 1, aPeriods[ii],
aMinCoord, aMaxCoord, aNumberOfIntervals, i_face_max))
{
break;
}
if (aMaxCoord - aMinCoord > aPeriods[ii] - 1.e-5)
anIsSeamFound[ii] = Standard_True;
@@ -3603,6 +3617,10 @@ void ShapeUpgrade_UnifySameDomain::IntUnifyFaces(const TopoDS_Shape& theInpShape
ReconstructMissedSeam (RemovedEdges, F_RefFace, CurEdge, CurVertex, CurPoint,
Uperiod, Vperiod, NextEdge, NextPoint);
if (NextEdge.IsNull())
{
return;
}
}
else
return;

View File

@@ -13910,6 +13910,73 @@ static int VSelBvhBuild (Draw_Interpretor& /*theDI*/, Standard_Integer theNbArgs
return 0;
}
//=======================================================================
//function : VChangeMouseGesture
//purpose :
//=======================================================================
static int VChangeMouseGesture (Draw_Interpretor&,
Standard_Integer theArgsNb,
const char** theArgVec)
{
Handle(V3d_View) aView = ViewerTest::CurrentView();
if (aView.IsNull())
{
Message::SendFail ("Error: no active viewer");
return 1;
}
NCollection_DoubleMap<TCollection_AsciiString, AIS_MouseGesture> aGestureMap;
{
aGestureMap.Bind ("none", AIS_MouseGesture_NONE);
aGestureMap.Bind ("selectrectangle", AIS_MouseGesture_SelectRectangle);
aGestureMap.Bind ("selectlasso", AIS_MouseGesture_SelectLasso);
aGestureMap.Bind ("zoom", AIS_MouseGesture_Zoom);
aGestureMap.Bind ("zoomwindow", AIS_MouseGesture_ZoomWindow);
aGestureMap.Bind ("pan", AIS_MouseGesture_Pan);
aGestureMap.Bind ("rotateorbit", AIS_MouseGesture_RotateOrbit);
aGestureMap.Bind ("rotateview", AIS_MouseGesture_RotateView);
aGestureMap.Bind ("drag", AIS_MouseGesture_Drag);
}
NCollection_DoubleMap<TCollection_AsciiString, Standard_UInteger> aMouseButtonMap;
{
aMouseButtonMap.Bind ("none", (Standard_UInteger )Aspect_VKeyMouse_NONE);
aMouseButtonMap.Bind ("left", (Standard_UInteger )Aspect_VKeyMouse_LeftButton);
aMouseButtonMap.Bind ("middle", (Standard_UInteger )Aspect_VKeyMouse_MiddleButton);
aMouseButtonMap.Bind ("right", (Standard_UInteger )Aspect_VKeyMouse_RightButton);
}
Standard_UInteger aButton = (Standard_UInteger )Aspect_VKeyMouse_LeftButton;
AIS_MouseGesture aGesture = AIS_MouseGesture_RotateOrbit;
for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter)
{
Standard_CString anArg = theArgVec[anArgIter];
TCollection_AsciiString anArgCase (anArg);
anArgCase.LowerCase();
if (anArgCase == "-button")
{
TCollection_AsciiString aButtonStr = theArgVec[++anArgIter];
aButtonStr.LowerCase();
aButton = aMouseButtonMap.Find1 (aButtonStr);
}
else if (anArgCase == "-gesture")
{
TCollection_AsciiString aGestureStr = theArgVec[++anArgIter];
aGestureStr.LowerCase();
aGesture = aGestureMap.Find1 (aGestureStr);
}
else
{
Message::SendFail() << "Error: unknown argument '" << anArg << "'";
return 1;
}
}
Handle(ViewerTest_EventManager) aViewMgr = ViewerTest::CurrentEventManager();
aViewMgr->ChangeMouseGestureMap().Bind (aButton, aGesture);
return 0;
}
//=======================================================================
//function : ViewerTest_ExitProc
//purpose :
@@ -14927,4 +14994,12 @@ Turns on/off prebuilding of BVH within background thread(s).
-nbThreads number of threads, 1 by default; if < 1 then used (NbLogicalProcessors - 1);
-wait waits for building all of BVH.
)" /* [vselbvhbuild] */);
addCmd ("vchangemousegesture", VChangeMouseGesture, /* [vchangemousegesture] */ R"(
vchangemousegesture -button {none|left|middle|right}=left
-gesture {none|selectRectangle|selectLasso|zoom|zoomWindow|pan|rotateOrbit|rotateView|drag}=rotateOrbit
Changes the gesture for the mouse button.
-button the mouse button;
-gesture the new gesture for the button.
)" /* [vchangemousegesture] */);
}

View File

@@ -59,7 +59,7 @@ Handle(XCAFDoc_VisMaterialTool) XCAFDoc_VisMaterialTool::Set (const TDF_Label& t
//=======================================================================
XCAFDoc_VisMaterialTool::XCAFDoc_VisMaterialTool()
{
//
myUseTextureBuffer = false;
}
//=======================================================================
@@ -95,6 +95,8 @@ TDF_Label XCAFDoc_VisMaterialTool::AddMaterial (const Handle(XCAFDoc_VisMaterial
{
TDF_TagSource aTag;
TDF_Label aLab = aTag.NewChild (Label());
if (myUseTextureBuffer)
changeVisMaterial(theMat);
aLab.AddAttribute (theMat);
if (!theName.IsEmpty())
{
@@ -283,3 +285,23 @@ Handle(XCAFDoc_VisMaterial) XCAFDoc_VisMaterialTool::GetShapeMaterial (const Top
? GetMaterial (aMatLabel)
: Handle(XCAFDoc_VisMaterial)();
}
//=======================================================================
//function : changeVisMaterial
//purpose :
//=======================================================================
void XCAFDoc_VisMaterialTool::changeVisMaterial(const Handle(XCAFDoc_VisMaterial)& theMat) const
{
if (theMat->HasCommonMaterial())
{
theMat->CommonMaterial().DiffuseTexture->WriteToBuffer();
}
if (theMat->HasPbrMaterial())
{
theMat->PbrMaterial().BaseColorTexture->WriteToBuffer();
theMat->PbrMaterial().MetallicRoughnessTexture->WriteToBuffer();
theMat->PbrMaterial().EmissiveTexture->WriteToBuffer();
theMat->PbrMaterial().OcclusionTexture->WriteToBuffer();
theMat->PbrMaterial().NormalTexture->WriteToBuffer();
}
}

View File

@@ -113,6 +113,12 @@ public:
//! Returns material assigned to shape or NULL if not assigned.
Standard_EXPORT Handle(XCAFDoc_VisMaterial) GetShapeMaterial (const TopoDS_Shape& theShape);
//! Return parameter for use texture buffer
const Standard_Boolean GetUseTextureBuffer() { return myUseTextureBuffer; }
//! Set parameter for use texture buffer
void SetUseTextureBuffer(const Standard_Boolean theUseBuffer) { myUseTextureBuffer = theUseBuffer; }
public:
//! Returns GUID of this attribute type.
@@ -128,8 +134,14 @@ public:
virtual void Paste (const Handle(TDF_Attribute)& ,
const Handle(TDF_RelocationTable)& ) const Standard_OVERRIDE {}
protected:
//! Reading a texture from file and save it to buffer
void changeVisMaterial(const Handle(XCAFDoc_VisMaterial)& theMat) const;
private:
Standard_Boolean myUseTextureBuffer;
Handle(XCAFDoc_ShapeTool) myShapeTool;
};

View File

@@ -98,6 +98,7 @@
#include <XCAFDoc_LayerTool.hxx>
#include <XCAFDoc_Material.hxx>
#include <XCAFDoc_ShapeTool.hxx>
#include <XCAFDoc_VisMaterialTool.hxx>
#include <XCAFDoc_Volume.hxx>
#include <XCAFPrs.hxx>
#include <XCAFPrs_AISObject.hxx>
@@ -1721,6 +1722,69 @@ static Standard_Integer testDoc (Draw_Interpretor&,
return 0;
}
//=======================================================================
// function: XGetUseTextureBuffer
// purpose: return current value of parameter
//=======================================================================
static Standard_Integer XGetUseTextureBuffer(Draw_Interpretor& di,
Standard_Integer argc,
const char** argv)
{
if (argc < 2)
{
return 1;
}
Handle(TDocStd_Document) aDoc;
if (!DDocStd::GetDocument(argv[1], aDoc))
{
return 1;
}
Handle(XCAFDoc_VisMaterialTool) aVisMatTool = XCAFDoc_DocumentTool::VisMaterialTool(aDoc->Main());
if (aVisMatTool.IsNull())
{
return 1;
}
const char* aStr = aVisMatTool->GetUseTextureBuffer() ? "on" : "off";
di << "Current value is \"" << aStr << "\"" << "\n";
return 0;
}
//=======================================================================
// function: XSetUseTextureBuffer
// purpose: change parameter for store texture (on/off),
// file path is use by default in case "off"
//=======================================================================
static Standard_Integer XSetUseTextureBuffer(Draw_Interpretor& di,
Standard_Integer argc,
const char** argv)
{
if (argc < 3)
{
return 1;
}
Handle(TDocStd_Document) aDoc;
if (!DDocStd::GetDocument(argv[1], aDoc))
{
return 1;
}
bool aBuffOn = false;
if (!Draw::ParseOnOff(argv[2], aBuffOn))
{
return 1;
}
Handle(XCAFDoc_VisMaterialTool) aVisMatTool = XCAFDoc_DocumentTool::VisMaterialTool(aDoc->Main());
if (aVisMatTool.IsNull())
{
return 1;
}
aVisMatTool->SetUseTextureBuffer(aBuffOn);
(void)di;
return 0;
}
//=======================================================================
//function : Init
@@ -1838,6 +1902,14 @@ void XDEDRAW::Init(Draw_Interpretor& di)
di.Add("XRescaleGeometry",
"Doc factor [-root label] [-force]: Applies geometrical scale to assembly",
__FILE__, XRescaleGeometry, g);
di.Add("XGetUseTextureBuffer",
"Doc : return value of parameter for texture buffer usage",
__FILE__, XGetUseTextureBuffer, g);
di.Add("XSetUseTextureBuffer",
"Doc {on|off} : turns on/off texture buffer usage; \"off\" is use by default,\n"
"it means texture will store length, offset and will be read from file;\n"
"in case \"on\" texture data will be store in buffer",
__FILE__, XSetUseTextureBuffer, g);
// Specialized commands
XDEDRAW_Shapes::InitCommands ( di );

View File

@@ -92,7 +92,8 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape(const TopoDS_Shape& theShape,
Handle(Standard_Transient)& theInfo,
const Handle(ShapeBuild_ReShape)& theReShape,
const Message_ProgressRange& theProgress,
const Standard_Boolean theNonManifold) const
const Standard_Boolean theNonManifold,
const TopAbs_ShapeEnum theDetalisationLevel) const
{
if (theShape.IsNull())
{
@@ -114,7 +115,7 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape(const TopoDS_Shape& theShape,
aRscfile = thePrscfile;
aContext = new ShapeProcess_ShapeContext(theShape, aRscfile);
}
aContext->SetDetalisation(TopAbs_EDGE);
aContext->SetDetalisation(theDetalisationLevel);
}
aContext->SetNonManifold(theNonManifold);
theInfo = aContext;
@@ -199,12 +200,13 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape(const TopoDS_Shape& theShape,
const Standard_CString thePseq,
Handle(Standard_Transient)& theInfo,
const Message_ProgressRange& theProgress,
const Standard_Boolean theNonManifold) const
const Standard_Boolean theNonManifold,
const TopAbs_ShapeEnum theDetalisationLevel) const
{
Handle(ShapeBuild_ReShape) aReShape = new ShapeBuild_ReShape();
return ProcessShape(theShape, thePrec, theMaxTol, thePrscfile,
thePseq, theInfo, aReShape, theProgress,
theNonManifold);
theNonManifold, theDetalisationLevel);
}
//=======================================================================

View File

@@ -19,9 +19,10 @@
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Integer.hxx>
#include <Message_ProgressRange.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Transient.hxx>
#include <TopAbs_ShapeEnum.hxx>
class ShapeBuild_ReShape;
class XSAlgo_ToolContainer;
@@ -71,7 +72,8 @@ public:
const Standard_CString thePseq,
Handle(Standard_Transient)& theInfo,
const Message_ProgressRange& theProgress = Message_ProgressRange(),
const Standard_Boolean theNonManifold = Standard_False) const;
const Standard_Boolean theNonManifold = Standard_False,
const TopAbs_ShapeEnum theDetalisationLevel = TopAbs_VERTEX) const;
//! Does shape processing with specified tolerances
//! @param[in] theShape shape to process
@@ -92,7 +94,8 @@ public:
Handle(Standard_Transient)& theInfo,
const Handle(ShapeBuild_ReShape)& theReShape,
const Message_ProgressRange& theProgress = Message_ProgressRange(),
const Standard_Boolean theNonManifold = Standard_False) const;
const Standard_Boolean theNonManifold = Standard_False,
const TopAbs_ShapeEnum theDetalisationLevel = TopAbs_VERTEX) const;
//! Checks quality of pcurve of the edge on the given face,
//! and corrects it if necessary.

View File

@@ -13,9 +13,11 @@
#include <XmlMXCAFDoc_VisMaterialDriver.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
#include <XCAFDoc_VisMaterial.hxx>
#include <XmlObjMgt.hxx>
#include <XmlObjMgt_Document.hxx>
#include <XmlObjMgt_Persistent.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XmlMXCAFDoc_VisMaterialDriver, XmlMDF_ADriver)
@@ -42,6 +44,10 @@ IMPLEMENT_DOMSTRING(EmissiveColor, "emissive_color")
IMPLEMENT_DOMSTRING(Shininess, "shininess")
IMPLEMENT_DOMSTRING(Transparency, "transparency")
IMPLEMENT_DOMSTRING(DiffuseTexture, "diffuse_texture")
IMPLEMENT_DOMSTRING(FilePath, "file_path")
IMPLEMENT_DOMSTRING(TextureId, "texture_id")
IMPLEMENT_DOMSTRING(Offset, "offset")
IMPLEMENT_DOMSTRING(Length, "length")
//! Encode alpha mode into character.
static const char* alphaModeToString (Graphic3d_AlphaMode theMode)
@@ -202,11 +208,26 @@ static void writeTexture (XmlObjMgt_Persistent& theTarget,
const XmlObjMgt_DOMString& theName,
const Handle(Image_Texture)& theImage)
{
if (!theImage.IsNull()
&& !theImage->FilePath().IsEmpty()
&& theImage->FileOffset() == -1)
if (theImage.IsNull())
{
theTarget.Element().setAttribute (theName, theImage->FilePath().ToCString());
return;
}
XmlObjMgt_Document aDoc(theTarget.Element().getOwnerDocument());
XmlObjMgt_Element aCurTarget = aDoc.createElement(theName);
theTarget.Element().appendChild(aCurTarget);
if (theImage->DataBuffer().IsNull())
{
aCurTarget.setAttribute(::FilePath(), theImage->FilePath().ToCString());
if (theImage->FileOffset() == -1 || theImage->FileLength() == -1)
{
return;
}
aCurTarget.setAttribute(::Offset(), static_cast<int>(theImage->FileOffset()));
aCurTarget.setAttribute(::Length(), static_cast<int>(theImage->FileLength()));
}
else
{
Message::SendWarning(TCollection_AsciiString("Can't write a texture to buffer."));
}
}
@@ -215,10 +236,34 @@ static void readTexture (const XmlObjMgt_Element& theElement,
const XmlObjMgt_DOMString& theName,
Handle(Image_Texture)& theImage)
{
TCollection_AsciiString aPath (theElement.getAttribute (theName).GetString());
if (!aPath.IsEmpty())
TCollection_AsciiString aStr(theElement.getAttribute(theName).GetString());
if (!aStr.IsEmpty())
{
theImage = new Image_Texture (aPath);
theImage = new Image_Texture(aStr);
return;
}
LDOM_Element anElement = theElement.GetChildByTagName(theName);
if (anElement.isNull())
{
return;
}
TCollection_AsciiString aFilePath(anElement.getAttribute(::FilePath()).GetString());
TCollection_AsciiString anId(anElement.getAttribute(::TextureId()).GetString());
Standard_Integer anOffset = -1, aLength = -1;
if (!aFilePath.IsEmpty())
{
anElement.getAttribute(::Offset()).GetInteger(anOffset);
anElement.getAttribute(::Length()).GetInteger(aLength);
if (anOffset == -1 || aLength == -1)
{
theImage = new Image_Texture(aFilePath);
return;
}
theImage = new Image_Texture(aFilePath, anOffset, aLength);
}
else if (!anId.IsEmpty())
{
Message::SendWarning(TCollection_AsciiString("Can't read a texture from buffer."));
}
}

10
tests/bugs/heal/bug33398 Normal file
View File

@@ -0,0 +1,10 @@
puts "========================================="
puts "0033398: Modeling Algorithms - ShapeUpgrade_UnifySameDomain fails on specific STEP model"
puts "========================================="
puts ""
testreadstep [locate_data_file bug33398.step] s
unifysamedom result s
checknbshapes result -vertex 506 -edge 908 -wire 394 -face 382 -shell 4 -solid 4
checkview -display result -2d -path ${imagedir}/${test_image}.png

19
tests/bugs/heal/bug33421 Normal file
View File

@@ -0,0 +1,19 @@
puts "TODO CR33439 ALL: Error : is WRONG because number of EDGE entities in shape"
puts "TODO CR33439 ALL: Error : is WRONG because number of WIRE entities in shape"
puts "TODO CR33439 ALL: Error : is WRONG because number of FACE entities in shape"
puts "========================================="
puts "0033421: Modeling Algorithms - ShapeUpgrade_UnifySameDomain fails"
puts "========================================="
puts ""
pcylinder c1 10 10
copy c1 c2
tmirror c2 0 0 10 0 0 1
bop c1 c2
bopfuse c3
unifysamedom result c3
checknbshapes result -t -solid 1 -shell 1 -face 3 -wire 3 -edge 3 -vertex 3
checkview -display result -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,14 @@
puts "================================"
puts "0026578: Modeling Algorithm - Exceptions in offset operation with intersection"
puts "================================"
puts ""
restore [locate_data_file bug26578_plate1.brep] s
offsetparameter 1e-7 p i
offsetload s 100
offsetperform r
checkshape r
checknbshapes r -vertex 22 -edge 32 -wire 11 -face 11
checkview -display r -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,12 @@
puts "REQUIRED ALL: ERROR. Can not trim edges."
puts "================================"
puts "0026578: Modeling Algorithm - Exceptions in offset operation with intersection"
puts "================================"
puts ""
restore [locate_data_file bug26578_plate2.brep] s
offsetparameter 1e-7 p i
offsetload s -30
offsetperform r

View File

@@ -0,0 +1,14 @@
puts "================================"
puts "0026578: Modeling Algorithm - Exceptions in offset operation with intersection"
puts "================================"
puts ""
restore [locate_data_file bug26578_plate3.brep] s
offsetparameter 1e-7 p i
offsetload s 4
offsetperform r
checkshape r
checknbshapes r -vertex 25 -edge 36 -wire 12 -face 12
checkview -display r -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,14 @@
puts "================================"
puts "0026578: Modeling Algorithm - Exceptions in offset operation with intersection"
puts "================================"
puts ""
restore [locate_data_file bug26578_plate4.brep] s
offsetparameter 1e-7 p i
offsetload s 2
offsetperform r
checkshape r
checknbshapes r -vertex 22 -edge 31 -wire 10 -face 10
checkview -display r -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,14 @@
puts "================================"
puts "0026578: Modeling Algorithm - Exceptions in offset operation with intersection"
puts "================================"
puts ""
restore [locate_data_file bug26578_plate5.brep] s
offsetparameter 1e-7 p i
offsetload s 2
offsetperform r
checkshape r
checknbshapes r -vertex 39 -edge 57 -wire 19 -face 19
checkview -display r -2d -path ${imagedir}/${test_image}.png

View File

@@ -0,0 +1,14 @@
puts "================================"
puts "0026578: Modeling Algorithm - Exceptions in offset operation with intersection"
puts "================================"
puts ""
restore [locate_data_file bug26578_plate7.brep] s
offsetparameter 1e-7 p i
offsetload s 60
offsetperform r
checkshape r
checknbshapes r -vertex 15 -edge 21 -wire 7 -face 7
checkview -display r -2d -path ${imagedir}/${test_image}.png

View File

@@ -2,8 +2,8 @@ puts "========================"
puts "0033414: Modeling Algorithms - Access violation during executing BRepAlgoAPI_Section::Build()"
puts "========================"
set filepath1 [locate_data_file "CR33414_1.brep"]
set filepath2 [locate_data_file "CR33414_2.brep"]
set filepath1 [locate_data_file "bug33414_1.brep"]
set filepath2 [locate_data_file "bug33414_2.brep"]
restore ${filepath1} shape1
restore ${filepath2} shape2
bsection res shape1 shape2

27
tests/bugs/step/bug32681 Normal file
View File

@@ -0,0 +1,27 @@
puts "=================================="
puts "0032681: Data Exchange - Missed dimension after STEP export"
puts "Check adding of dimension"
puts "=================================="
pload DCAF
ReadStep D [locate_data_file bug32681.stp]
XGetOneShape s D
explode s V
XAddSubShape D s_1 0:1:1:1
XAddSubShape D s_84 0:1:1:1
XAddDimension D 0:1:1:1:57 0:1:1:1:58
param write.step.schema 5
param write.surfacecurve.mode 0
set tmpFile ${imagedir}/tmpFile.stp
WriteStep D $tmpFile
Close D
ReadStep D1 $tmpFile
set str [XDumpDGTs D1 all]
if {[string first "0:1:1:1:57" $str] == -1 || [string first "0:1:1:1:58" $str] == -1} {
puts "Error: don't find subshape"
}
Close D1
file delete $tmpFile
param write.step.schema 4
param write.surfacecurve.mode 1

View File

@@ -1,3 +1,3 @@
pload XDE
pload XDE OCAF VISUALISATION
set subgroup xde

21
tests/bugs/xde/bug33183_1 Normal file
View File

@@ -0,0 +1,21 @@
puts "========"
puts "0033183: Data Exchange - Lose texture after saving XBF file"
puts "Checking saving of textures for the previous version"
puts "========"
Close D -silent
XOpen [locate_data_file bug33183_ship_boat.xbf] D
set data [XGetVisMaterial D 0:1:10:3]
if {[string first "Common.DiffuseTexture" $data] == -1} {
puts "Error: Texture is not found"
}
vinit View1
XDisplay -dispMode 1 D
vfit
if { [vreadpixel 130 300 rgb name] != "ROSYBROWN" } { puts "Error: color not match" }
if { [vreadpixel 150 250 rgb name] != "ORANGE2" } { puts "Error: color not match" }
if { [vreadpixel 250 250 rgb name] != "GRAY43" } { puts "Error: color not match" }
Close D

21
tests/bugs/xde/bug33183_2 Normal file
View File

@@ -0,0 +1,21 @@
puts "========"
puts "0033183: Data Exchange - Lose texture after saving XBF file"
puts "Checking saving of textures for the previous version"
puts "========"
Close D -silent
XOpen [locate_data_file bug33183_ship_boat.xml] D
set data [XGetVisMaterial D 0:1:10:3]
if {[string first "Common.DiffuseTexture" $data] == -1} {
puts "Error: Texture is not found"
}
vinit View1
XDisplay -dispMode 1 D
vfit
if { [vreadpixel 130 300 rgb name] != "ROSYBROWN" } { puts "Error: color not match" }
if { [vreadpixel 150 250 rgb name] != "ORANGE2" } { puts "Error: color not match" }
if { [vreadpixel 250 250 rgb name] != "GRAY43" } { puts "Error: color not match" }
Close D

37
tests/bugs/xde/bug33451_1 Normal file
View File

@@ -0,0 +1,37 @@
puts "========"
puts "0033451: Saving texture to buffer"
puts "Checks store texture in .xbf file"
puts "========"
Close D -silent
XNewDoc D
XSetUseTextureBuffer D on
ReadGltf D [locate_data_file bug31706_launchvehicle.glb] -noCreateDoc
set aTmpFile ${imagedir}/result.xbf
XSave D $aTmpFile
Close D
Open $aTmpFile D
set data1 [XGetVisMaterial D 0:1:10:1]
set data2 [XGetVisMaterial D 0:1:10:5]
if {[string first "PBR.BaseColorTexture" $data1] == -1
|| [string first "PBR.EmissiveTexture" $data1] == -1} {
puts "Error: Texture is not found"
}
if {[string first "PBR.BaseColorTexture" $data2] == -1
|| [string first "PBR.MetallicRoughnessTexture" $data2] == -1
|| [string first "PBR.OcclusionTexture" $data2] == -1
|| [string first "PBR.NormalTexture" $data2] == -1} {
puts "Error: Texture is not found"
}
vinit View1
XDisplay -dispMode 1 D
vfit
if { [vreadpixel 50 300 rgb name] != "WHITE" || [vreadpixel 120 250 rgb name] != "LEMONCHIFFON1" } {
puts "Error: color not match"
}
Close D
file delete -force $aTmpFile

38
tests/bugs/xde/bug33451_2 Normal file
View File

@@ -0,0 +1,38 @@
puts "========"
puts "0033451: Saving texture to buffer"
puts "Checks store texture in .xml file"
puts "========"
Close D -silent
XNewDoc D
#XSetUseTextureBuffer D on
ReadGltf D [locate_data_file bug31706_launchvehicle.glb] -noCreateDoc
set aTmpFile ${imagedir}/res.xml
Format D XmlXCAF
XSave D $aTmpFile
Close D
XOpen $aTmpFile D
set data1 [XGetVisMaterial D 0:1:10:1]
set data2 [XGetVisMaterial D 0:1:10:5]
if {[string first "PBR.BaseColorTexture" $data1] == -1
|| [string first "PBR.EmissiveTexture" $data1] == -1} {
puts "Error: Texture is not found"
}
if {[string first "PBR.BaseColorTexture" $data2] == -1
|| [string first "PBR.MetallicRoughnessTexture" $data2] == -1
|| [string first "PBR.OcclusionTexture" $data2] == -1
|| [string first "PBR.NormalTexture" $data2] == -1} {
puts "Error: Texture is not found"
}
vinit View1
XDisplay -dispMode 1 D
vfit
if { [vreadpixel 50 300 rgb name] != "WHITE" || [vreadpixel 120 250 rgb name] != "LEMONCHIFFON1" } {
puts "Error: color not match"
}
Close D
file delete -force $aTmpFile

29
tests/bugs/xde/bug33451_3 Normal file
View File

@@ -0,0 +1,29 @@
puts "========"
puts "0033451: Saving texture to buffer"
puts "Checks store texture in .xbf file"
puts "========"
Close D -silent
XNewDoc D
XSetUseTextureBuffer D on
ReadObj D [locate_data_file ship_boat.obj] -noCreateDoc
set aTmpFile ${imagedir}/result.xbf
XSave D $aTmpFile
Close D
Open $aTmpFile D
set data [XGetVisMaterial D 0:1:10:3]
if {[string first "Common.DiffuseTexture" $data] == -1} {
puts "Error: Texture is not found"
}
vinit View1
XDisplay -dispMode 1 D
vfit
if { [vreadpixel 130 300 rgb name] != "ROSYBROWN" } { puts "Error: color not match" }
if { [vreadpixel 150 250 rgb name] != "ORANGE2" } { puts "Error: color not match" }
if { [vreadpixel 250 250 rgb name] != "GRAY43" } { puts "Error: color not match" }
Close D
file delete -force $aTmpFile

30
tests/bugs/xde/bug33451_4 Normal file
View File

@@ -0,0 +1,30 @@
puts "========"
puts "0033451: Saving texture to buffer"
puts "Checks store texture in .xbf file"
puts "========"
Close D -silent
XNewDoc D
#XSetUseTextureBuffer D on
ReadObj D [locate_data_file ship_boat.obj] -noCreateDoc
set aTmpFile ${imagedir}/result.xml
Format D XmlXCAF
XSave D $aTmpFile
Close D
XOpen $aTmpFile D
set data [XGetVisMaterial D 0:1:10:3]
if {[string first "Common.DiffuseTexture" $data] == -1} {
puts "Error: Texture is not found"
}
vinit View1
XDisplay -dispMode 1 D
vfit
if { [vreadpixel 130 300 rgb name] != "ROSYBROWN" } { puts "Error: color not match" }
if { [vreadpixel 150 250 rgb name] != "ORANGE2" } { puts "Error: color not match" }
if { [vreadpixel 250 250 rgb name] != "GRAY43" } { puts "Error: color not match" }
Close D
file delete -force $aTmpFile

View File

@@ -0,0 +1,7 @@
restore [locate_data_file bug33420.brep] s
OFFSETSHAPE 35 {} $calcul $type
checkprops result -v 4.04602e+07
checknbshapes result -face 43 -shell 1

View File

@@ -1,3 +1,5 @@
puts "TODO OCC27414 ALL: Error : The area of result shape is"
restore [locate_data_file bug26917_M2_trim33.brep] s
OFFSETSHAPE 8 {} $calcul $type

View File

@@ -7,4 +7,4 @@ offsetperform result
checkprops result -s 6.21471e+06 -v 8.95633e+08
unifysamedom result_unif result
checknbshapes result_unif -wire 140 -face 138 -shell 1 -solid 1
checknbshapes result_unif -wire 142 -face 140 -shell 1 -solid 1

View File

@@ -0,0 +1,43 @@
puts "=============================================="
puts "0032879: Visualization - Separate pan/zoom and move the object behavior in AIS_ViewController"
puts "=============================================="
puts ""
pload MODELING VISUALIZATION
vinit View1
pcylinder c1 5 10
vdisplay c1
vsetdispmode 1
vmanipulator m -attach c1 -adjustPosition 1 -adjustSize 0 -enableModes 1 -size 40
vfit
# note: mouse events cannot be emulated here, so the original bug cannot be reproduced by this test case
# pan for the left mouse button
vchangemousegesture -button left -gesture pan
set mouse_pick {204 194}
set mouse_drag {369 35}
vmoveto {*}$mouse_pick
vselect {*}$mouse_pick
vmanipulator m -startTransform {*}$mouse_pick
vmanipulator m -transform {*}$mouse_drag
vmanipulator m -stopTransform
vselect 0 0
vdump $imagedir/${casename}_pan.png
# zoom for the left mouse button
vchangemousegesture -button left -gesture zoom
set mouse_pick {206 32}
set mouse_drag {365 330}
vmoveto {*}$mouse_pick
vselect {*}$mouse_pick
vmanipulator m -startTransform {*}$mouse_pick
vmanipulator m -transform {*}$mouse_drag
vmanipulator m -stopTransform
vselect 0 0
vdump $imagedir/${casename}_zoom.png