mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0031326: Foundation Classes - Init from Json for base OCCT classes
InitFromJson method implementation for some simple classes. OCCT_INIT_* defines introduction to do automatic parsing of the stream into values. Inspector is extended to visualize objects created on the dump stream if it might be created.
This commit is contained in:
@@ -79,12 +79,13 @@ void View_DisplayPreview::SetContext (const Handle(AIS_InteractiveContext)& theC
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void View_DisplayPreview::UpdatePreview (const View_DisplayActionType,
|
||||
const NCollection_List<Handle(Standard_Transient)>& thePresentations,
|
||||
int theDisplayMode)
|
||||
const NCollection_List<Handle(Standard_Transient)>& thePresentations)
|
||||
{
|
||||
if (myContext.IsNull())
|
||||
return;
|
||||
|
||||
int aPreviewDisplayMode = AIS_Shaded;
|
||||
|
||||
// clear previous previews
|
||||
for (NCollection_List<Handle(AIS_InteractiveObject)>::Iterator anIterator (myPreviewReadyPresentations); anIterator.More(); anIterator.Next())
|
||||
{
|
||||
@@ -115,7 +116,7 @@ void View_DisplayPreview::UpdatePreview (const View_DisplayActionType,
|
||||
Handle(AIS_InteractiveObject) aPrs = Handle(AIS_InteractiveObject)::DownCast (anIterator.Value());
|
||||
if (!aPrs.IsNull() && aPrs->GetContext().IsNull()/*is not displayed in another context*/)
|
||||
{
|
||||
myContext->Display (aPrs, theDisplayMode, -1/*does not participate in selection*/, Standard_True);
|
||||
myContext->Display (aPrs, aPreviewDisplayMode, -1/*does not participate in selection*/, Standard_True);
|
||||
enableGlobalClipping(aPrs, false);
|
||||
myPreviewReadyPresentations.Append (aPrs);
|
||||
}
|
||||
@@ -128,7 +129,7 @@ void View_DisplayPreview::UpdatePreview (const View_DisplayActionType,
|
||||
myPreviewPresentation->Attributes()->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_O_PLUS, aColor, 3.0));
|
||||
myPreviewPresentation->SetAttributes (myPreviewParameters->GetDrawer());
|
||||
|
||||
myContext->Display (myPreviewPresentation, theDisplayMode, -1/*does not participate in selection*/, Standard_True);
|
||||
myContext->Display (myPreviewPresentation, aPreviewDisplayMode, -1/*does not participate in selection*/, Standard_True);
|
||||
enableGlobalClipping(myPreviewPresentation, false);
|
||||
}
|
||||
else
|
||||
@@ -140,28 +141,3 @@ void View_DisplayPreview::UpdatePreview (const View_DisplayActionType,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetDisplayMode
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void View_DisplayPreview::SetDisplayMode (const int theDisplayMode, const bool theToUpdateViewer)
|
||||
{
|
||||
if (myContext.IsNull())
|
||||
return;
|
||||
|
||||
if (!myPreviewPresentation.IsNull())
|
||||
{
|
||||
if (myContext == myPreviewPresentation->GetContext())
|
||||
myContext->SetDisplayMode (myPreviewPresentation, theDisplayMode, Standard_False);
|
||||
}
|
||||
|
||||
for (NCollection_List<Handle(AIS_InteractiveObject)>::Iterator aPreviewIt (myPreviewReadyPresentations); aPreviewIt.More(); aPreviewIt.Next())
|
||||
{
|
||||
if (myContext == aPreviewIt.Value()->GetContext())
|
||||
myContext->SetDisplayMode (aPreviewIt.Value(), theDisplayMode, Standard_False);
|
||||
}
|
||||
|
||||
if (theToUpdateViewer)
|
||||
myContext->UpdateCurrentViewer();
|
||||
}
|
||||
|
@@ -53,12 +53,7 @@ public:
|
||||
|
||||
//! Updates visibility of the presentations for the display type
|
||||
Standard_EXPORT void UpdatePreview (const View_DisplayActionType theType,
|
||||
const NCollection_List<Handle(Standard_Transient)>& thePresentations,
|
||||
int theDisplayMode);
|
||||
|
||||
//! Sets display mode for all displayed presentations
|
||||
Standard_EXPORT void SetDisplayMode (const int theDisplayMode,
|
||||
const bool theToUpdateViewer = true);
|
||||
const NCollection_List<Handle(Standard_Transient)>& thePresentations);
|
||||
|
||||
//! Returns true if preview presentation is shown
|
||||
Standard_Boolean HasPreview() const { return !myPreviewPresentation.IsNull(); }
|
||||
|
@@ -34,7 +34,7 @@
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
View_Displayer::View_Displayer()
|
||||
: myIsKeepPresentations (false), myFitAllActive (false), myDisplayMode (-1)
|
||||
: myIsKeepPresentations (false), myFitAllActive (false), myDisplayMode (0)
|
||||
{
|
||||
myDisplayPreview = new View_DisplayPreview();
|
||||
}
|
||||
@@ -79,8 +79,6 @@ void View_Displayer::SetDisplayMode (const int theDisplayMode,
|
||||
for (AIS_ListIteratorOfListOfInteractive aDisplayedIt (aDisplayed); aDisplayedIt.More(); aDisplayedIt.Next())
|
||||
GetContext()->SetDisplayMode (aDisplayedIt.Value(), theDisplayMode, Standard_False);
|
||||
|
||||
myDisplayPreview->SetDisplayMode (theDisplayMode, Standard_False);
|
||||
|
||||
if (theToUpdateViewer)
|
||||
UpdateViewer();
|
||||
}
|
||||
@@ -270,7 +268,7 @@ bool View_Displayer::IsVisible (const TopoDS_Shape& theShape, const View_Present
|
||||
void View_Displayer::UpdatePreview (const View_DisplayActionType theType,
|
||||
const NCollection_List<Handle(Standard_Transient)>& thePresentations)
|
||||
{
|
||||
myDisplayPreview->UpdatePreview (theType, thePresentations, myDisplayMode);
|
||||
myDisplayPreview->UpdatePreview (theType, thePresentations);
|
||||
if (!myIsKeepPresentations || myFitAllActive)
|
||||
fitAllView();
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ View_PreviewParameters::View_PreviewParameters()
|
||||
myDrawer = new Prs3d_Drawer();
|
||||
|
||||
Quantity_Color aColor(Quantity_NOC_TOMATO);
|
||||
Standard_ShortReal aTransparency = 0.8f;
|
||||
|
||||
// point parameters
|
||||
myDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_O_PLUS, aColor, 3.0));
|
||||
@@ -41,6 +42,10 @@ View_PreviewParameters::View_PreviewParameters()
|
||||
myDrawer->ShadingAspect()->SetColor (aColor);
|
||||
myDrawer->ShadingAspect()->SetMaterial (aShadingMaterial);
|
||||
|
||||
myDrawer->ShadingAspect()->Aspect()->ChangeFrontMaterial().SetTransparency (aTransparency);
|
||||
myDrawer->ShadingAspect()->Aspect()->ChangeBackMaterial() .SetTransparency (aTransparency);
|
||||
myDrawer->SetTransparency (aTransparency);
|
||||
|
||||
// common parameters
|
||||
myDrawer->SetZLayer (Graphic3d_ZLayerId_Topmost);
|
||||
}
|
||||
|
Reference in New Issue
Block a user