mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Compare commits
1 Commits
MET-740
...
CR0-Intera
Author | SHA1 | Date | |
---|---|---|---|
|
961713db52 |
@@ -69,7 +69,6 @@ AIS_ViewController::AIS_ViewController()
|
||||
myMousePressed (Aspect_VKeyMouse_NONE),
|
||||
myMouseModifiers (Aspect_VKeyFlags_NONE),
|
||||
myMouseSingleButton (-1),
|
||||
myMouseStopDragOnUnclick (false),
|
||||
//
|
||||
myTouchToleranceScale (1.0f),
|
||||
myTouchRotationThresholdPx (6.0f),
|
||||
@@ -612,7 +611,6 @@ bool AIS_ViewController::UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
|
||||
{
|
||||
myMouseClickTimer.Stop();
|
||||
myMouseClickCounter = 0;
|
||||
myMouseStopDragOnUnclick = false;
|
||||
myUI.Dragging.ToStop = true;
|
||||
toUpdateView = true;
|
||||
}
|
||||
@@ -621,12 +619,6 @@ bool AIS_ViewController::UpdateMouseButtons (const Graphic3d_Vec2i& thePoint,
|
||||
else if (theButtons == Aspect_VKeyMouse_NONE)
|
||||
{
|
||||
myMouseSingleButton = -1;
|
||||
if (myMouseStopDragOnUnclick)
|
||||
{
|
||||
myMouseStopDragOnUnclick = false;
|
||||
myUI.Dragging.ToStop = true;
|
||||
toUpdateView = true;
|
||||
}
|
||||
}
|
||||
else if (myMouseSingleButton == -1)
|
||||
{
|
||||
@@ -777,7 +769,6 @@ bool AIS_ViewController::UpdateMousePosition (const Graphic3d_Vec2i& thePoint,
|
||||
myMouseClickTimer.Stop();
|
||||
myMouseClickCounter = 0;
|
||||
myMouseSingleButton = -1;
|
||||
myMouseStopDragOnUnclick = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -647,7 +647,6 @@ protected: //! @name mouse input variables
|
||||
Aspect_VKeyMouse myMousePressed; //!< active mouse buttons
|
||||
Aspect_VKeyFlags myMouseModifiers; //!< active key modifiers passed with last mouse event
|
||||
Standard_Integer myMouseSingleButton; //!< index of mouse button pressed alone (>0)
|
||||
Standard_Boolean myMouseStopDragOnUnclick; //!< queue stop dragging even with at next mouse unclick
|
||||
|
||||
protected: //! @name multi-touch input variables
|
||||
|
||||
|
@@ -97,9 +97,25 @@ namespace
|
||||
return aPoly;
|
||||
}
|
||||
|
||||
//! Add new solid
|
||||
virtual void AddSolid() Standard_OVERRIDE
|
||||
{
|
||||
Handle(Poly_Triangulation) aCurrentTri = GetTriangulation();
|
||||
myTriangulationList.Append(aCurrentTri);
|
||||
myNodes.Clear();
|
||||
myTriangles.Clear();
|
||||
}
|
||||
|
||||
NCollection_Sequence<Handle(Poly_Triangulation)> GetTriangulationList()
|
||||
{
|
||||
return myTriangulationList;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
NCollection_Vector<gp_XYZ> myNodes;
|
||||
NCollection_Vector<Poly_Triangle> myTriangles;
|
||||
NCollection_Sequence<Handle(Poly_Triangulation)> myTriangulationList;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -118,6 +134,17 @@ Handle(Poly_Triangulation) RWStl::ReadFile (const Standard_CString theFile,
|
||||
return aReader.GetTriangulation();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : ReadFile
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void RWStl::ReadFile(const Standard_CString theFile, NCollection_Sequence<Handle(Poly_Triangulation)>& theTriangList)
|
||||
{
|
||||
Reader aReader;
|
||||
aReader.Read(theFile, Handle(Message_ProgressIndicator)(), true);
|
||||
theTriangList = aReader.GetTriangulationList();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : ReadFile
|
||||
//purpose :
|
||||
|
@@ -50,6 +50,8 @@ public:
|
||||
Standard_EXPORT static Handle(Poly_Triangulation) ReadFile (const Standard_CString theFile,
|
||||
const Handle(Message_ProgressIndicator)& aProgInd = Handle(Message_ProgressIndicator)());
|
||||
|
||||
Standard_EXPORT static void ReadFile(const Standard_CString theFile, NCollection_Sequence<Handle(Poly_Triangulation)>& theTriangList);
|
||||
|
||||
//! Read triangulation from a binary STL file
|
||||
//! In case of error, returns Null handle.
|
||||
Standard_EXPORT static Handle(Poly_Triangulation) ReadBinary (const OSD_Path& thePath,
|
||||
|
@@ -126,7 +126,8 @@ namespace
|
||||
//==============================================================================
|
||||
|
||||
Standard_Boolean RWStl_Reader::Read (const char* theFile,
|
||||
const Handle(Message_ProgressIndicator)& theProgress)
|
||||
const Handle(Message_ProgressIndicator)& theProgress,
|
||||
bool IsMultiSolid)
|
||||
{
|
||||
std::filebuf aBuf;
|
||||
OSD_OpenStream (aBuf, theFile, std::ios::in | std::ios::binary);
|
||||
@@ -165,6 +166,8 @@ Standard_Boolean RWStl_Reader::Read (const char* theFile,
|
||||
}
|
||||
}
|
||||
aStream >> std::ws; // skip any white spaces
|
||||
if (IsMultiSolid)
|
||||
AddSolid();
|
||||
}
|
||||
return ! aStream.fail();
|
||||
}
|
||||
|
@@ -39,7 +39,8 @@ public:
|
||||
//! Format is recognized automatically by analysis of the file header.
|
||||
//! Returns true if success, false on error or user break.
|
||||
Standard_EXPORT Standard_Boolean Read (const char* theFile,
|
||||
const Handle(Message_ProgressIndicator)& theProgress);
|
||||
const Handle(Message_ProgressIndicator)& theProgress,
|
||||
bool IsMultiSolid = false);
|
||||
|
||||
//! Guess whether the stream is an Ascii STL file, by analysis of the first bytes (~200).
|
||||
//! The function attempts to put back the read symbols to the stream which thus must support ungetc().
|
||||
@@ -74,6 +75,8 @@ public:
|
||||
//! Should create new triangle built on specified nodes in the target model.
|
||||
virtual void AddTriangle (Standard_Integer theN1, Standard_Integer theN2, Standard_Integer theN3) = 0;
|
||||
|
||||
virtual void AddSolid() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -411,6 +411,22 @@ static Standard_Integer ReadObj (Draw_Interpretor& theDI,
|
||||
{
|
||||
aFilePath = theArgVec[anArgIter];
|
||||
}
|
||||
else if (theArgc == 4 && strcmp("multi", theArgv[3]) == 0)
|
||||
{
|
||||
NCollection_Sequence<Handle(Poly_Triangulation)> theTriangList;
|
||||
RWStl::ReadFile(theArgv[2], theTriangList);
|
||||
BRep_Builder aB;
|
||||
TopoDS_Compound aCmp;
|
||||
aB.MakeCompound(aCmp);
|
||||
for (int i = 1; i <= theTriangList.Length(); i++)
|
||||
{
|
||||
TopoDS_Face aFace;
|
||||
aB.MakeFace(aFace);
|
||||
aB.UpdateFace(aFace, theTriangList(i));
|
||||
aB.Add(aCmp, aFace);
|
||||
}
|
||||
DBRep::Set(theArgv[1], aCmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
|
||||
|
Reference in New Issue
Block a user