mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Compare commits
1 Commits
CR0_ALC
...
CR0-Intera
Author | SHA1 | Date | |
---|---|---|---|
|
961713db52 |
@@ -41,7 +41,6 @@ AIS_TextLabel::AIS_TextLabel()
|
|||||||
myFont ("Courier"),
|
myFont ("Courier"),
|
||||||
myFontAspect (Font_FA_Regular),
|
myFontAspect (Font_FA_Regular),
|
||||||
myHasOrientation3D (Standard_False),
|
myHasOrientation3D (Standard_False),
|
||||||
myHasOwnAnchorPoint (Standard_True),
|
|
||||||
myHasFlipping (Standard_False)
|
myHasFlipping (Standard_False)
|
||||||
{
|
{
|
||||||
myDrawer->SetTextAspect (new Prs3d_TextAspect());
|
myDrawer->SetTextAspect (new Prs3d_TextAspect());
|
||||||
@@ -309,12 +308,7 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
|
|||||||
|
|
||||||
gp_Ax2 anOrientation = myOrientation3D;
|
gp_Ax2 anOrientation = myOrientation3D;
|
||||||
anOrientation.SetLocation (aPosition);
|
anOrientation.SetLocation (aPosition);
|
||||||
|
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (thePrs), anAsp, myText, myOrientation3D, !myHasFlipping);
|
||||||
Standard_Boolean aHasOwnAnchor = HasOwnAnchorPoint();
|
|
||||||
if (myHasFlipping)
|
|
||||||
aHasOwnAnchor = Standard_False; // always not using own anchor if flipping
|
|
||||||
|
|
||||||
Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (thePrs), anAsp, myText, myOrientation3D, aHasOwnAnchor);
|
|
||||||
if (myHasFlipping && isInit)
|
if (myHasFlipping && isInit)
|
||||||
{
|
{
|
||||||
Prs3d_Root::CurrentGroup (thePrs)->SetFlippingOptions (Standard_False, gp_Ax2());
|
Prs3d_Root::CurrentGroup (thePrs)->SetFlippingOptions (Standard_False, gp_Ax2());
|
||||||
|
@@ -90,12 +90,6 @@ public:
|
|||||||
|
|
||||||
Standard_EXPORT Standard_Boolean HasFlipping() const;
|
Standard_EXPORT Standard_Boolean HasFlipping() const;
|
||||||
|
|
||||||
//! Returns flag if text uses position as point of attach
|
|
||||||
Standard_Boolean HasOwnAnchorPoint() const { return myHasOwnAnchorPoint; }
|
|
||||||
|
|
||||||
//! Set flag if text uses position as point of attach
|
|
||||||
void SetOwnAnchorPoint (const Standard_Boolean theOwnAnchorPoint) { myHasOwnAnchorPoint = theOwnAnchorPoint; }
|
|
||||||
|
|
||||||
//! Define the display type of the text.
|
//! Define the display type of the text.
|
||||||
//!
|
//!
|
||||||
//! TODT_NORMAL Default display. Text only.
|
//! TODT_NORMAL Default display. Text only.
|
||||||
@@ -127,7 +121,6 @@ protected:
|
|||||||
Font_FontAspect myFontAspect;
|
Font_FontAspect myFontAspect;
|
||||||
gp_Ax2 myOrientation3D;
|
gp_Ax2 myOrientation3D;
|
||||||
Standard_Boolean myHasOrientation3D;
|
Standard_Boolean myHasOrientation3D;
|
||||||
Standard_Boolean myHasOwnAnchorPoint;
|
|
||||||
Standard_Boolean myHasFlipping;
|
Standard_Boolean myHasFlipping;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@@ -426,12 +426,6 @@ void OpenGl_Text::setupMatrix (const Handle(OpenGl_Context)& theCtx,
|
|||||||
{
|
{
|
||||||
OpenGl_Mat4d aCurrentWorldViewMat;
|
OpenGl_Mat4d aCurrentWorldViewMat;
|
||||||
aCurrentWorldViewMat.Convert (theCtx->WorldViewState.Current());
|
aCurrentWorldViewMat.Convert (theCtx->WorldViewState.Current());
|
||||||
|
|
||||||
// apply local transformation
|
|
||||||
OpenGl_Mat4d aModelWorld;
|
|
||||||
aModelWorld.Convert (theCtx->ModelWorldState.Current());
|
|
||||||
aCurrentWorldViewMat = aCurrentWorldViewMat * aModelWorld;
|
|
||||||
|
|
||||||
theCtx->WorldViewState.SetCurrent<Standard_Real> (aCurrentWorldViewMat * aModViewMat);
|
theCtx->WorldViewState.SetCurrent<Standard_Real> (aCurrentWorldViewMat * aModViewMat);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -97,9 +97,25 @@ namespace
|
|||||||
return aPoly;
|
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:
|
private:
|
||||||
NCollection_Vector<gp_XYZ> myNodes;
|
NCollection_Vector<gp_XYZ> myNodes;
|
||||||
NCollection_Vector<Poly_Triangle> myTriangles;
|
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();
|
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
|
//function : ReadFile
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@@ -50,6 +50,8 @@ public:
|
|||||||
Standard_EXPORT static Handle(Poly_Triangulation) ReadFile (const Standard_CString theFile,
|
Standard_EXPORT static Handle(Poly_Triangulation) ReadFile (const Standard_CString theFile,
|
||||||
const Handle(Message_ProgressIndicator)& aProgInd = Handle(Message_ProgressIndicator)());
|
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
|
//! Read triangulation from a binary STL file
|
||||||
//! In case of error, returns Null handle.
|
//! In case of error, returns Null handle.
|
||||||
Standard_EXPORT static Handle(Poly_Triangulation) ReadBinary (const OSD_Path& thePath,
|
Standard_EXPORT static Handle(Poly_Triangulation) ReadBinary (const OSD_Path& thePath,
|
||||||
|
@@ -126,7 +126,8 @@ namespace
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
Standard_Boolean RWStl_Reader::Read (const char* theFile,
|
Standard_Boolean RWStl_Reader::Read (const char* theFile,
|
||||||
const Handle(Message_ProgressIndicator)& theProgress)
|
const Handle(Message_ProgressIndicator)& theProgress,
|
||||||
|
bool IsMultiSolid)
|
||||||
{
|
{
|
||||||
std::filebuf aBuf;
|
std::filebuf aBuf;
|
||||||
OSD_OpenStream (aBuf, theFile, std::ios::in | std::ios::binary);
|
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
|
aStream >> std::ws; // skip any white spaces
|
||||||
|
if (IsMultiSolid)
|
||||||
|
AddSolid();
|
||||||
}
|
}
|
||||||
return ! aStream.fail();
|
return ! aStream.fail();
|
||||||
}
|
}
|
||||||
|
@@ -39,7 +39,8 @@ public:
|
|||||||
//! Format is recognized automatically by analysis of the file header.
|
//! Format is recognized automatically by analysis of the file header.
|
||||||
//! Returns true if success, false on error or user break.
|
//! Returns true if success, false on error or user break.
|
||||||
Standard_EXPORT Standard_Boolean Read (const char* theFile,
|
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).
|
//! 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().
|
//! 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.
|
//! 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 AddTriangle (Standard_Integer theN1, Standard_Integer theN2, Standard_Integer theN3) = 0;
|
||||||
|
|
||||||
|
virtual void AddSolid() = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -184,14 +184,11 @@ void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObje
|
|||||||
//==================================================
|
//==================================================
|
||||||
void SelectMgr_SelectionManager::Deactivate (const Handle(SelectMgr_SelectableObject)& theObject,
|
void SelectMgr_SelectionManager::Deactivate (const Handle(SelectMgr_SelectableObject)& theObject,
|
||||||
const Standard_Integer theMode)
|
const Standard_Integer theMode)
|
||||||
{
|
|
||||||
if (theObject->ToPropagateVisualState())
|
|
||||||
{
|
{
|
||||||
for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next())
|
for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next())
|
||||||
{
|
{
|
||||||
Deactivate (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode);
|
Deactivate (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!theObject->HasOwnPresentations())
|
if (!theObject->HasOwnPresentations())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@@ -2542,15 +2542,6 @@ static int VDrawText (Draw_Interpretor& theDI,
|
|||||||
{
|
{
|
||||||
aTextPrs->SetFlipping (Standard_True);
|
aTextPrs->SetFlipping (Standard_True);
|
||||||
}
|
}
|
||||||
else if (aParam == "-ownanchor")
|
|
||||||
{
|
|
||||||
if (++anArgIt >= theArgsNb)
|
|
||||||
{
|
|
||||||
std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
aTextPrs->SetOwnAnchorPoint (Draw::Atoi (theArgVec[anArgIt]) == 1);
|
|
||||||
}
|
|
||||||
else if (aParam == "-disptype"
|
else if (aParam == "-disptype"
|
||||||
|| aParam == "-displaytype")
|
|| aParam == "-displaytype")
|
||||||
{
|
{
|
||||||
@@ -6468,7 +6459,6 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands)
|
|||||||
"\n\t\t: [-noupdate]"
|
"\n\t\t: [-noupdate]"
|
||||||
"\n\t\t: [-plane NormX NormY NormZ DirX DirY DirZ]"
|
"\n\t\t: [-plane NormX NormY NormZ DirX DirY DirZ]"
|
||||||
"\n\t\t: [-flipping]"
|
"\n\t\t: [-flipping]"
|
||||||
"\n\t\t: [-ownanchor {0|1}=1]"
|
|
||||||
"\n\t\t: Display text label at specified position.",
|
"\n\t\t: Display text label at specified position.",
|
||||||
__FILE__, VDrawText, group);
|
__FILE__, VDrawText, group);
|
||||||
|
|
||||||
|
@@ -411,6 +411,22 @@ static Standard_Integer ReadObj (Draw_Interpretor& theDI,
|
|||||||
{
|
{
|
||||||
aFilePath = theArgVec[anArgIter];
|
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
|
else
|
||||||
{
|
{
|
||||||
std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
|
std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
|
||||||
|
Reference in New Issue
Block a user