mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0031827: Samples - Qt OCCT Overview sample is not compiled with VS 2010
* Menu storage changed from json to XML (because Qt 4 does not support json) * C++11 for(object : container) construction changed to OCCT iterators / Qt foreach * enum type::name changed to type_name * non used class members removed * Qt connect functions changed to macros version * warning 4127 disabled for Q_INIT_RESOURCE in VS2010 / Qt 4 case * widgets parent problem on Qt 4 fixed * QRegularExpression changed to QRegExp
This commit is contained in:
parent
1877dc98c9
commit
8833fd4dc5
@ -1,51 +0,0 @@
|
|||||||
{
|
|
||||||
"Data Exchange": {
|
|
||||||
"Export": [{
|
|
||||||
"text": "BREP",
|
|
||||||
"function": "BrepExportSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "STEP",
|
|
||||||
"function": "StepExportSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "IGES",
|
|
||||||
"function": "IgesExportSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "STL",
|
|
||||||
"function": "StlExportSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "VRML",
|
|
||||||
"function": "VrmlExportSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Image",
|
|
||||||
"function": "ImageExportSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Import": [{
|
|
||||||
"text": "BREP",
|
|
||||||
"function": "BrepImportSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "STEP",
|
|
||||||
"function": "StepImportSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "IGES",
|
|
||||||
"function": "IgesImportSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
17
samples/OCCTOverview/code/DataExchange.xml
Normal file
17
samples/OCCTOverview/code/DataExchange.xml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<Menu>
|
||||||
|
<MenuItem name="Data Exchange">
|
||||||
|
<MenuItem name="Export">
|
||||||
|
<Sample name="BREP" function="BrepExportSample"/>
|
||||||
|
<Sample name="STEP" function="StepExportSample"/>
|
||||||
|
<Sample name="IGES" function="IgesExportSample"/>
|
||||||
|
<Sample name="STL" function="StlExportSample"/>
|
||||||
|
<Sample name="VRML" function="VrmlExportSample"/>
|
||||||
|
<Sample name="Image" function="ImageExportSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Import">
|
||||||
|
<Sample name="BREP" function="BrepImportSample"/>
|
||||||
|
<Sample name="STEP" function="StepImportSample"/>
|
||||||
|
<Sample name="IGES" function="IgesImportSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
@ -128,8 +128,10 @@ void DataExchangeSamples::ExecuteSample (const TCollection_AsciiString& theSampl
|
|||||||
void DataExchangeSamples::BrepExportSample()
|
void DataExchangeSamples::BrepExportSample()
|
||||||
{
|
{
|
||||||
Standard_Boolean anIsShapeExist = Standard_False;
|
Standard_Boolean anIsShapeExist = Standard_False;
|
||||||
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
|
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
|
||||||
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
||||||
{
|
{
|
||||||
anIsShapeExist = Standard_True;
|
anIsShapeExist = Standard_True;
|
||||||
@ -167,8 +169,10 @@ void DataExchangeSamples::StepExportSample()
|
|||||||
}
|
}
|
||||||
|
|
||||||
STEPControl_Writer aStepWriter;
|
STEPControl_Writer aStepWriter;
|
||||||
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
|
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
|
||||||
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
||||||
{
|
{
|
||||||
aStatus = aStepWriter.Transfer(aShape->Shape(), myStepType);
|
aStatus = aStepWriter.Transfer(aShape->Shape(), myStepType);
|
||||||
@ -207,8 +211,10 @@ void DataExchangeSamples::IgesExportSample()
|
|||||||
Interface_Static::IVal("XSTEP.iges.writebrep.mode"));
|
Interface_Static::IVal("XSTEP.iges.writebrep.mode"));
|
||||||
|
|
||||||
Standard_Boolean anIsShapeExist = Standard_False;
|
Standard_Boolean anIsShapeExist = Standard_False;
|
||||||
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
|
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
|
||||||
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
||||||
{
|
{
|
||||||
anIsShapeExist = Standard_True;
|
anIsShapeExist = Standard_True;
|
||||||
@ -240,8 +246,10 @@ void DataExchangeSamples::StlExportSample()
|
|||||||
aBuilder.MakeCompound(aTopoCompound);
|
aBuilder.MakeCompound(aTopoCompound);
|
||||||
|
|
||||||
Standard_Boolean anIsShapeExist = Standard_False;
|
Standard_Boolean anIsShapeExist = Standard_False;
|
||||||
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
|
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
|
||||||
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
||||||
{
|
{
|
||||||
anIsShapeExist = Standard_True;
|
anIsShapeExist = Standard_True;
|
||||||
@ -273,8 +281,10 @@ void DataExchangeSamples::VrmlExportSample()
|
|||||||
aBrepBuilder.MakeCompound(aTopoCompound);
|
aBrepBuilder.MakeCompound(aTopoCompound);
|
||||||
|
|
||||||
Standard_Boolean anIsShapeExist = Standard_False;
|
Standard_Boolean anIsShapeExist = Standard_False;
|
||||||
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
|
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(myObject3d);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
|
||||||
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
||||||
{
|
{
|
||||||
anIsShapeExist = Standard_True;
|
anIsShapeExist = Standard_True;
|
||||||
@ -382,8 +392,10 @@ void DataExchangeSamples::IgesImportSample()
|
|||||||
Standard_Boolean DataExchangeSamples::CheckFacetedBrep()
|
Standard_Boolean DataExchangeSamples::CheckFacetedBrep()
|
||||||
{
|
{
|
||||||
Standard_Boolean anError = Standard_False;
|
Standard_Boolean anError = Standard_False;
|
||||||
for (Handle(AIS_InteractiveObject) anObject : myObject3d)
|
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter (myObject3d);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
|
||||||
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
if (Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(anObject))
|
||||||
{
|
{
|
||||||
const TopoDS_Shape aTopoShape = aShape->Shape();
|
const TopoDS_Shape aTopoShape = aShape->Shape();
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
const Handle(V3d_View)& theView,
|
const Handle(V3d_View)& theView,
|
||||||
const Handle(AIS_InteractiveContext)& theContext)
|
const Handle(AIS_InteractiveContext)& theContext)
|
||||||
: BaseSample (theSampleSourcePath, theContext),
|
: BaseSample (theSampleSourcePath, theContext),
|
||||||
myStepType (STEPControl_StepModelType::STEPControl_AsIs),
|
myStepType (STEPControl_AsIs),
|
||||||
myView (theView)
|
myView (theView)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
@ -8,15 +8,15 @@ AdaptorVec_AIS.cxx
|
|||||||
AdaptorVec_AIS.h
|
AdaptorVec_AIS.h
|
||||||
BaseSample.cxx
|
BaseSample.cxx
|
||||||
BaseSample.h
|
BaseSample.h
|
||||||
DataExchange.json
|
DataExchange.xml
|
||||||
DataExchangeSamples.cxx
|
DataExchangeSamples.cxx
|
||||||
DataExchangeSamples.h
|
DataExchangeSamples.h
|
||||||
Geometry.json
|
Geometry.xml
|
||||||
GeometrySamples.cxx
|
GeometrySamples.cxx
|
||||||
GeometrySamples.h
|
GeometrySamples.h
|
||||||
MakeBottle.cxx
|
MakeBottle.cxx
|
||||||
MakeBottle.h
|
MakeBottle.h
|
||||||
Ocaf.json
|
Ocaf.xml
|
||||||
OcafSamples.cxx
|
OcafSamples.cxx
|
||||||
OcafSamples.h
|
OcafSamples.h
|
||||||
Sample2D_Face.cxx
|
Sample2D_Face.cxx
|
||||||
@ -34,15 +34,15 @@ TOcafFunction_CylDriver.cxx
|
|||||||
TOcafFunction_CylDriver.h
|
TOcafFunction_CylDriver.h
|
||||||
TOcaf_Application.cxx
|
TOcaf_Application.cxx
|
||||||
TOcaf_Application.h
|
TOcaf_Application.h
|
||||||
Topology.json
|
Topology.xml
|
||||||
TopologySamples.cxx
|
TopologySamples.cxx
|
||||||
TopologySamples.h
|
TopologySamples.h
|
||||||
Triangulation.json
|
Triangulation.xml
|
||||||
TriangulationSamples.cxx
|
TriangulationSamples.cxx
|
||||||
TriangulationSamples.h
|
TriangulationSamples.h
|
||||||
Viewer2d.json
|
Viewer2d.xml
|
||||||
Viewer2dSamples.cxx
|
Viewer2dSamples.cxx
|
||||||
Viewer2dSamples.h
|
Viewer2dSamples.h
|
||||||
Viewer3d.json
|
Viewer3d.xml
|
||||||
Viewer3dSamples.cxx
|
Viewer3dSamples.cxx
|
||||||
Viewer3dSamples.h
|
Viewer3dSamples.h
|
||||||
|
@ -1,287 +0,0 @@
|
|||||||
{
|
|
||||||
"Non Parametric": {
|
|
||||||
"Free creating": {
|
|
||||||
"3D": [{
|
|
||||||
"text": "Zero Dimension objects",
|
|
||||||
"function": "ZeroDimensionObjects3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Vectors",
|
|
||||||
"function": "Vectors3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Infinity lines",
|
|
||||||
"function": "InfinityLines3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Second order curves",
|
|
||||||
"function": "SecondOrderCurves3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Plane surfaces",
|
|
||||||
"function": "PlaneSurfaces3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Second order surfaces",
|
|
||||||
"function": "SecondOrderSurfaces3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"2D": [{
|
|
||||||
"text": "Zero Dimension objects",
|
|
||||||
"function": "ZeroDimensionObjects2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Vectors",
|
|
||||||
"function": "Vectors2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Infinity lines",
|
|
||||||
"function": "InfinityLines2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Second order curves",
|
|
||||||
"function": "SecondOrderCurves2dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
,
|
|
||||||
"Creating based on criteria": {
|
|
||||||
"3D": [{
|
|
||||||
"text": "Barycenter point",
|
|
||||||
"function": "BarycenterPoint3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Rotated vector",
|
|
||||||
"function": "RotatedVector3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Mirrored line",
|
|
||||||
"function": "MirroredLine3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Scaled Ellipse",
|
|
||||||
"function": "ScaledEllipse3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Transformed cylinder",
|
|
||||||
"function": "TransformedCylinder3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Translated torus",
|
|
||||||
"function": "TranslatedTorus3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Conjugate objects ",
|
|
||||||
"function": "ConjugateObjects3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Projection of point",
|
|
||||||
"function": "ProjectionOfPoint3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Minimal distance",
|
|
||||||
"function": "MinimalDistance3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Intersection",
|
|
||||||
"function": "Intersection3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"2D": [{
|
|
||||||
"text": "Translated point",
|
|
||||||
"function": "TranslatedPoint2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Rotated direction",
|
|
||||||
"function": "RotatedDirection2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Mirrored axis",
|
|
||||||
"function": "MirroredAxis2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Transformed ellipse",
|
|
||||||
"function": "TransformedEllipse2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Conjugate objects",
|
|
||||||
"function": "ConjugateObjects2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Tangent to 2 cilcles",
|
|
||||||
"function": "Tangent2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Projection of point",
|
|
||||||
"function": "ProjectionOfPoint2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Minimal distance",
|
|
||||||
"function": "MinimalDistance2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Intersection",
|
|
||||||
"function": "Intersection2dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Data extraction": {
|
|
||||||
"3D": [{
|
|
||||||
"text": "Point info",
|
|
||||||
"function": "PointInfo3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Ellipse info",
|
|
||||||
"function": "EllipseInfo3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"2D": [{
|
|
||||||
"text": "Point info",
|
|
||||||
"function": "PointInfo2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Circle info",
|
|
||||||
"function": "CircleInfo2dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
|
||||||
"Parametric": {
|
|
||||||
"Free creating": {
|
|
||||||
"3D": [{
|
|
||||||
"text": "Free style curves",
|
|
||||||
"function": "FreeStyleCurves3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Analytical surfaces",
|
|
||||||
"function": "AnalyticalSurfaces3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Free style surfaces",
|
|
||||||
"function": "FreeStyleSurfaces3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"2D": [{
|
|
||||||
"text": "Free style curves",
|
|
||||||
"function": "FreeStyleCurves2dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Creating based on geometry": {
|
|
||||||
"3D": [{
|
|
||||||
"text": "Trimmed curve",
|
|
||||||
"function": "TrimmedCurve3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Offset curve",
|
|
||||||
"function": "OffsetCurve3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "BSpline from circle",
|
|
||||||
"function": "BSplineFromCircle3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Trimmed surface",
|
|
||||||
"function": "TrimmedSurface3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Offset surface",
|
|
||||||
"function": "OffsetSurface3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Extrusion surface",
|
|
||||||
"function": "ExtrusionSurface3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Revolution surface",
|
|
||||||
"function": "RevolutionSurface3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"2D": [{
|
|
||||||
"text": "Trimmed curve",
|
|
||||||
"function": "TrimmedCurve2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Offset curve",
|
|
||||||
"function": "OffsetCurve2dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Extract geometry": [{
|
|
||||||
"text": "Bounding box of surface (3D)",
|
|
||||||
"function": "BoundingBoxOfSurface3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Bounding box of curves (3D)",
|
|
||||||
"function": "BoundingBoxOfCurves3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Bounding box of curves (2D)",
|
|
||||||
"function": "BoundingBoxOfCurves2dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Data extraction": [{
|
|
||||||
"text": "Dump circle info",
|
|
||||||
"function": "DumpCircleInfoSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Dump BSpline curve info",
|
|
||||||
"function": "DumpBSplineCurveInfoSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
92
samples/OCCTOverview/code/Geometry.xml
Normal file
92
samples/OCCTOverview/code/Geometry.xml
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
<Menu>
|
||||||
|
<MenuItem name="Non Parametric">
|
||||||
|
<MenuItem name="Free creating">
|
||||||
|
<MenuItem name="3D">
|
||||||
|
<Sample name="Zero Dimension objects" function="ZeroDimensionObjects3dSample"/>
|
||||||
|
<Sample name="Vectors" function="Vectors3dSample"/>
|
||||||
|
<Sample name="Infinity lines" function="InfinityLines3dSample"/>
|
||||||
|
<Sample name="Second order curves" function="SecondOrderCurves3dSample"/>
|
||||||
|
<Sample name="Plane surfaces" function="PlaneSurfaces3dSample"/>
|
||||||
|
<Sample name="Second order surfaces" function="SecondOrderSurfaces3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="2D">
|
||||||
|
<Sample name="Zero Dimension objects" function="ZeroDimensionObjects2dSample"/>
|
||||||
|
<Sample name="Vectors" function="Vectors2dSample"/>
|
||||||
|
<Sample name="Infinity lines" function="InfinityLines2dSample"/>
|
||||||
|
<Sample name="Second order curves" function="SecondOrderCurves2dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Creating based on criteria">
|
||||||
|
<MenuItem name="3D">
|
||||||
|
<Sample name="Barycenter point" function="BarycenterPoint3dSample"/>
|
||||||
|
<Sample name="Rotated vector" function="RotatedVector3dSample"/>
|
||||||
|
<Sample name="Mirrored line" function="MirroredLine3dSample"/>
|
||||||
|
<Sample name="Scaled Ellipse" function="ScaledEllipse3dSample"/>
|
||||||
|
<Sample name="Transformed cylinder" function="TransformedCylinder3dSample"/>
|
||||||
|
<Sample name="Translated torus" function="TranslatedTorus3dSample"/>
|
||||||
|
<Sample name="Conjugate objects" function="ConjugateObjects3dSample"/>
|
||||||
|
<Sample name="Projection of point" function="ProjectionOfPoint3dSample"/>
|
||||||
|
<Sample name="Minimal distance" function="MinimalDistance3dSample"/>
|
||||||
|
<Sample name="Intersection" function="Intersection3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="2D">
|
||||||
|
<Sample name="Translated point" function="TranslatedPoint2dSample"/>
|
||||||
|
<Sample name="Rotated direction" function="RotatedDirection2dSample"/>
|
||||||
|
<Sample name="Mirrored axis" function="MirroredAxis2dSample"/>
|
||||||
|
<Sample name="Transformed ellipse" function="TransformedEllipse2dSample"/>
|
||||||
|
<Sample name="Conjugate objects" function="ConjugateObjects2dSample"/>
|
||||||
|
<Sample name="Tangent to 2 cilcles" function="Tangent2dSample"/>
|
||||||
|
<Sample name="Projection of point" function="ProjectionOfPoint2dSample"/>
|
||||||
|
<Sample name="Minimal distance" function="MinimalDistance2dSample"/>
|
||||||
|
<Sample name="Intersection" function="Intersection2dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Data extraction">
|
||||||
|
<MenuItem name="3D">
|
||||||
|
<Sample name="Point info" function="PointInfo3dSample"/>
|
||||||
|
<Sample name="Ellipse info" function="EllipseInfo3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="2D">
|
||||||
|
<Sample name="Point info" function="PointInfo2dSample"/>
|
||||||
|
<Sample name="Circle info" function="CircleInfo2dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Parametric">
|
||||||
|
<MenuItem name="Free creating">
|
||||||
|
<MenuItem name="3D">
|
||||||
|
<Sample name="Free style curves" function="FreeStyleCurves3dSample"/>
|
||||||
|
<Sample name="Analytical surfaces" function="AnalyticalSurfaces3dSample"/>
|
||||||
|
<Sample name="Free style surfaces" function="FreeStyleSurfaces3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="2D">
|
||||||
|
<Sample name="Free style curves" function="FreeStyleCurves2dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Creating based on geometry">
|
||||||
|
<MenuItem name="3D">
|
||||||
|
<Sample name="Trimmed curve" function="TrimmedCurve3dSample"/>
|
||||||
|
<Sample name="Offset curve" function="OffsetCurve3dSample"/>
|
||||||
|
<Sample name="BSpline from circle" function="BSplineFromCircle3dSample"/>
|
||||||
|
<Sample name="Trimmed surface" function="TrimmedSurface3dSample"/>
|
||||||
|
<Sample name="Offset surface" function="OffsetSurface3dSample"/>
|
||||||
|
<Sample name="Extrusion surface" function="ExtrusionSurface3dSample"/>
|
||||||
|
<Sample name="Revolution surface" function="RevolutionSurface3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="2D">
|
||||||
|
<Sample name="Trimmed curve" function="TrimmedCurve2dSample"/>
|
||||||
|
<Sample name="Offset curve" function="OffsetCurve2dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Extract geometry">
|
||||||
|
<Sample name="Bounding box of surface (3D)" function="BoundingBoxOfSurface3dSample"/>
|
||||||
|
<Sample name="Bounding box of curves (3D)" function="BoundingBoxOfCurves3dSample"/>
|
||||||
|
<Sample name="Bounding box of curves (2D)" function="BoundingBoxOfCurves2dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Data extraction">
|
||||||
|
<Sample name="Dump circle info" function="DumpCircleInfoSample"/>
|
||||||
|
<Sample name="Dump BSpline curve info" function="DumpBSplineCurveInfoSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
@ -1,53 +0,0 @@
|
|||||||
{
|
|
||||||
"OCAF": {
|
|
||||||
"1 Create": [{
|
|
||||||
"text": "Create Box",
|
|
||||||
"function": "CreateBoxOcafSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Create Cylinder",
|
|
||||||
"function": "CreateCylinderOcafSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"2 Modify": [{
|
|
||||||
"text": "Modify Box",
|
|
||||||
"function": "ModifyBoxOcafSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Modify Cylinder",
|
|
||||||
"function": "ModifyCylinderOcafSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"3 Action": [{
|
|
||||||
"text": "Undo",
|
|
||||||
"function": "UndoOcafSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Redo",
|
|
||||||
"function": "RedoOcafSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"4 Data storage": [{
|
|
||||||
"text": "Open OCAF",
|
|
||||||
"function": "DialogOpenOcafSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Save binary OCAF",
|
|
||||||
"function": "DialogSaveBinOcafSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Save XML OCAF",
|
|
||||||
"function": "DialogSaveXmlOcafSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
21
samples/OCCTOverview/code/Ocaf.xml
Normal file
21
samples/OCCTOverview/code/Ocaf.xml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<Menu>
|
||||||
|
<MenuItem name="OCAF">
|
||||||
|
<MenuItem name="1 Create">
|
||||||
|
<Sample name="Create Box" function="CreateBoxOcafSample"/>
|
||||||
|
<Sample name="Create Cylinder" function="CreateCylinderOcafSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="2 Modify">
|
||||||
|
<Sample name="Modify Box" function="ModifyBoxOcafSample"/>
|
||||||
|
<Sample name="Modify Cylinder" function="ModifyCylinderOcafSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="3 Action">
|
||||||
|
<Sample name="Undo" function="UndoOcafSample"/>
|
||||||
|
<Sample name="Redo" function="RedoOcafSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="4 Data storage">
|
||||||
|
<Sample name="Open OCAF" function="DialogOpenOcafSample"/>
|
||||||
|
<Sample name="Save binary OCAF" function="DialogSaveBinOcafSample"/>
|
||||||
|
<Sample name="Save XML OCAF" function="DialogSaveXmlOcafSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
@ -298,8 +298,11 @@ void OcafSamples::ModifyBoxOcafSample()
|
|||||||
AIS_ListOfInteractive anAisObjectsList;
|
AIS_ListOfInteractive anAisObjectsList;
|
||||||
myContext->DisplayedObjects(anAisObjectsList);
|
myContext->DisplayedObjects(anAisObjectsList);
|
||||||
Standard_Integer aBoxCount(0);
|
Standard_Integer aBoxCount(0);
|
||||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||||
|
|
||||||
// Get the main label of the selected object
|
// Get the main label of the selected object
|
||||||
Handle(TPrsStd_AISPresentation) anAisPresentation = Handle(TPrsStd_AISPresentation)::DownCast(anAisObject->GetOwner());
|
Handle(TPrsStd_AISPresentation) anAisPresentation = Handle(TPrsStd_AISPresentation)::DownCast(anAisObject->GetOwner());
|
||||||
TDF_Label aLabel = anAisPresentation->Label();
|
TDF_Label aLabel = anAisPresentation->Label();
|
||||||
@ -398,8 +401,10 @@ void OcafSamples::ModifyCylinderOcafSample()
|
|||||||
AIS_ListOfInteractive anAisObjectsList;
|
AIS_ListOfInteractive anAisObjectsList;
|
||||||
myContext->DisplayedObjects(anAisObjectsList);
|
myContext->DisplayedObjects(anAisObjectsList);
|
||||||
Standard_Integer aCylCount(0);
|
Standard_Integer aCylCount(0);
|
||||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||||
// Get the main label of the selected object
|
// Get the main label of the selected object
|
||||||
Handle(TPrsStd_AISPresentation) anAisPresentation = Handle(TPrsStd_AISPresentation)::DownCast(anAisObject->GetOwner());
|
Handle(TPrsStd_AISPresentation) anAisPresentation = Handle(TPrsStd_AISPresentation)::DownCast(anAisObject->GetOwner());
|
||||||
TDF_Label aLabel = anAisPresentation->Label();
|
TDF_Label aLabel = anAisPresentation->Label();
|
||||||
@ -534,7 +539,7 @@ void OcafSamples::DialogOpenOcafSample()
|
|||||||
}
|
}
|
||||||
// Open the document in the current application
|
// Open the document in the current application
|
||||||
PCDM_ReaderStatus aReaderStatus = anOcaf_Application->Open(myFileName, myOcafDoc);
|
PCDM_ReaderStatus aReaderStatus = anOcaf_Application->Open(myFileName, myOcafDoc);
|
||||||
if (aReaderStatus == PCDM_ReaderStatus::PCDM_RS_OK)
|
if (aReaderStatus == PCDM_RS_OK)
|
||||||
{
|
{
|
||||||
// Connect the document CAF (myDoc) with the AISContext (myAISContext)
|
// Connect the document CAF (myDoc) with the AISContext (myAISContext)
|
||||||
TPrsStd_AISViewer::New(myOcafDoc->Main(), myViewer);
|
TPrsStd_AISViewer::New(myOcafDoc->Main(), myViewer);
|
||||||
@ -563,7 +568,7 @@ void OcafSamples::DialogSaveBinOcafSample()
|
|||||||
myOcafDoc->ChangeStorageFormat("BinOcaf");
|
myOcafDoc->ChangeStorageFormat("BinOcaf");
|
||||||
// Saves the document in the current application
|
// Saves the document in the current application
|
||||||
PCDM_StoreStatus aStoreStatus = anOcaf_Application->SaveAs(myOcafDoc, myFileName);
|
PCDM_StoreStatus aStoreStatus = anOcaf_Application->SaveAs(myOcafDoc, myFileName);
|
||||||
if (aStoreStatus == PCDM_StoreStatus::PCDM_SS_OK)
|
if (aStoreStatus == PCDM_SS_OK)
|
||||||
{
|
{
|
||||||
myResult << "The file was saved successfully" << std::endl;
|
myResult << "The file was saved successfully" << std::endl;
|
||||||
}
|
}
|
||||||
@ -580,7 +585,7 @@ void OcafSamples::DialogSaveXmlOcafSample()
|
|||||||
myOcafDoc->ChangeStorageFormat("XmlOcaf");
|
myOcafDoc->ChangeStorageFormat("XmlOcaf");
|
||||||
// Saves the document in the current application
|
// Saves the document in the current application
|
||||||
PCDM_StoreStatus aStoreStatus = anOcaf_Application->SaveAs(myOcafDoc, myFileName);
|
PCDM_StoreStatus aStoreStatus = anOcaf_Application->SaveAs(myOcafDoc, myFileName);
|
||||||
if (aStoreStatus == PCDM_StoreStatus::PCDM_SS_OK)
|
if (aStoreStatus == PCDM_SS_OK)
|
||||||
{
|
{
|
||||||
myResult << "The file was saved successfully" << std::endl;
|
myResult << "The file was saved successfully" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,6 @@ public:
|
|||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ExchangeType { None, Binary, Xml };
|
|
||||||
|
|
||||||
virtual void Process (const TCollection_AsciiString& theSampleName) Standard_OVERRIDE;
|
virtual void Process (const TCollection_AsciiString& theSampleName) Standard_OVERRIDE;
|
||||||
|
|
||||||
void ClearExtra();
|
void ClearExtra();
|
||||||
@ -75,11 +73,9 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
ExchangeType myExchangeType;
|
|
||||||
TCollection_AsciiString myFileName;
|
TCollection_AsciiString myFileName;
|
||||||
Handle(V3d_Viewer) myViewer;
|
Handle(V3d_Viewer) myViewer;
|
||||||
Handle(TDocStd_Document) myOcafDoc;
|
Handle(TDocStd_Document) myOcafDoc;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //OCAFSAMPLES_H
|
#endif //OCAFSAMPLES_H
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/menus">
|
<qresource prefix="/menus">
|
||||||
<file>Geometry.json</file>
|
<file>Geometry.xml</file>
|
||||||
<file>Topology.json</file>
|
<file>Topology.xml</file>
|
||||||
<file>Triangulation.json</file>
|
<file>Triangulation.xml</file>
|
||||||
<file>DataExchange.json</file>
|
<file>DataExchange.xml</file>
|
||||||
<file>Viewer3d.json</file>
|
<file>Viewer3d.xml</file>
|
||||||
<file>Viewer2d.json</file>
|
<file>Viewer2d.xml</file>
|
||||||
<file>Ocaf.json</file>
|
<file>Ocaf.xml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -1,176 +0,0 @@
|
|||||||
{
|
|
||||||
"Topology": {
|
|
||||||
"Topological Shape": [{
|
|
||||||
"text": "Vertex",
|
|
||||||
"function": "Vertex3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Edge",
|
|
||||||
"function": "Edge3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Face",
|
|
||||||
"function": "Face3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Wire",
|
|
||||||
"function": "Wire3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Shell",
|
|
||||||
"function": "Shell3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Solid",
|
|
||||||
"function": "Solid3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Edge (2D)",
|
|
||||||
"function": "Edge2dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"BRep primitive objects": [{
|
|
||||||
"text": "Box",
|
|
||||||
"function": "Box3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Cylinder",
|
|
||||||
"function": "Cylinder3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Revolution",
|
|
||||||
"function": "Revolution3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Topology access": [{
|
|
||||||
"text": "Topology iterator",
|
|
||||||
"function": "TopologyIterator3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Topology explorer",
|
|
||||||
"function": "TopologyExplorer3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Assess to curve",
|
|
||||||
"function": "AssessToCurve3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Assess to composite curve",
|
|
||||||
"function": "AssessToCompositeCurve3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Assess to surface",
|
|
||||||
"function": "AssessToSurface3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Boolean operation": [{
|
|
||||||
"text": "Common",
|
|
||||||
"function": "Common3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Cut",
|
|
||||||
"function": "Cut3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Fuse",
|
|
||||||
"function": "Fuse3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Section",
|
|
||||||
"function": "Section3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Splitter",
|
|
||||||
"function": "Splitter3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Defeaturing",
|
|
||||||
"function": "Defeaturing3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Complex modelling": [{
|
|
||||||
"text": "Fillet",
|
|
||||||
"function": "Fillet3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Chamfer",
|
|
||||||
"function": "Chamfer3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Offset",
|
|
||||||
"function": "Offset3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Evolved",
|
|
||||||
"function": "Evolved3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Modification": [{
|
|
||||||
"text": "Copy",
|
|
||||||
"function": "Copy3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Transform",
|
|
||||||
"function": "Transform3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Convert to NURBS",
|
|
||||||
"function": "ConvertToNurbs3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Sew contiguous faces",
|
|
||||||
"function": "SewContiguousFaces3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Calculation": [{
|
|
||||||
"text": "Check validity",
|
|
||||||
"function": "CheckValidity3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Compute linear properties",
|
|
||||||
"function": "ComputeLinearProperties3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Compute surface properties",
|
|
||||||
"function": "ComputeSurfaceProperties3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Compute volume properties",
|
|
||||||
"function": "ComputeVolumeProperties3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
51
samples/OCCTOverview/code/Topology.xml
Normal file
51
samples/OCCTOverview/code/Topology.xml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<Menu>
|
||||||
|
<MenuItem name="Topology">
|
||||||
|
<MenuItem name="Topological Shape">
|
||||||
|
<Sample name="Vertex" function="Vertex3dSample"/>
|
||||||
|
<Sample name="Edge" function="Edge3dSample"/>
|
||||||
|
<Sample name="Face" function="Face3dSample"/>
|
||||||
|
<Sample name="Wire" function="Wire3dSample"/>
|
||||||
|
<Sample name="Shell" function="Shell3dSample"/>
|
||||||
|
<Sample name="Solid" function="Solid3dSample"/>
|
||||||
|
<Sample name="Edge (2D)" function="Edge2dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="BRep primitive objects">
|
||||||
|
<Sample name="Box" function="Box3dSample"/>
|
||||||
|
<Sample name="Cylinder" function="Cylinder3dSample"/>
|
||||||
|
<Sample name="Revolution" function="Revolution3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Topology access">
|
||||||
|
<Sample name="Topology iterator" function="TopologyIterator3dSample"/>
|
||||||
|
<Sample name="Topology explorer" function="TopologyExplorer3dSample"/>
|
||||||
|
<Sample name="Assess to curve" function="AssessToCurve3dSample"/>
|
||||||
|
<Sample name="Assess to composite curve" function="AssessToCompositeCurve3dSample"/>
|
||||||
|
<Sample name="Assess to surface" function="AssessToSurface3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Boolean operation">
|
||||||
|
<Sample name="Common" function="Common3dSample"/>
|
||||||
|
<Sample name="Cut" function="Cut3dSample"/>
|
||||||
|
<Sample name="Fuse" function="Fuse3dSample"/>
|
||||||
|
<Sample name="Section" function="Section3dSample"/>
|
||||||
|
<Sample name="Splitter" function="Splitter3dSample"/>
|
||||||
|
<Sample name="Defeaturing" function="Defeaturing3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Complex modelling">
|
||||||
|
<Sample name="Fillet" function="Fillet3dSample"/>
|
||||||
|
<Sample name="Chamfer" function="Chamfer3dSample"/>
|
||||||
|
<Sample name="Offset" function="Offset3dSample"/>
|
||||||
|
<Sample name="Evolved" function="Evolved3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Modification">
|
||||||
|
<Sample name="Copy" function="Copy3dSample"/>
|
||||||
|
<Sample name="Transform" function="Transform3dSample"/>
|
||||||
|
<Sample name="Convert to NURBS" function="ConvertToNurbs3dSample"/>
|
||||||
|
<Sample name="Sew contiguous faces" function="SewContiguousFaces3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Calculation">
|
||||||
|
<Sample name="Check validity" function="CheckValidity3dSample"/>
|
||||||
|
<Sample name="Compute linear properties" function="ComputeLinearProperties3dSample"/>
|
||||||
|
<Sample name="Compute surface properties" function="ComputeSurfaceProperties3dSample"/>
|
||||||
|
<Sample name="Compute volume properties" function="ComputeVolumeProperties3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"Triangulation": {
|
|
||||||
|
|
||||||
"Create Triangulation": [{
|
|
||||||
"text": "Triangulation on shape",
|
|
||||||
"function": "Triangulation3dSample",
|
|
||||||
"description": ""
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
|
7
samples/OCCTOverview/code/Triangulation.xml
Normal file
7
samples/OCCTOverview/code/Triangulation.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<Menu>
|
||||||
|
<MenuItem name="Triangulation">
|
||||||
|
<MenuItem name="Create Triangulation">
|
||||||
|
<Sample name="Triangulation on shape" function="Triangulation3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
@ -1,58 +0,0 @@
|
|||||||
{
|
|
||||||
"Viewer 2D": {
|
|
||||||
"Labels": [{
|
|
||||||
"text": "Text",
|
|
||||||
"function": "TextView2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Marker",
|
|
||||||
"function": "MarkerView2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Fill Area",
|
|
||||||
"function": "FillAreaView2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Loop on face",
|
|
||||||
"function": "LoopOnFaceView2dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
"Grids": [{
|
|
||||||
"text": "Rectagular Lines",
|
|
||||||
"function": "RectagularLineGrid2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Rectagular Points",
|
|
||||||
"function": "RectagularPointGrid2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Circular Lines",
|
|
||||||
"function": "CircularLineGrid2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Circular Points",
|
|
||||||
"function": "CircularPointGrid2dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Clear",
|
|
||||||
"function": "ClearGrid2dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
"Image": [{
|
|
||||||
"text": "Backgroung Image",
|
|
||||||
"function": "BackgroungImage2dSample",
|
|
||||||
"description": ""
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
}
|
|
20
samples/OCCTOverview/code/Viewer2d.xml
Normal file
20
samples/OCCTOverview/code/Viewer2d.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<Menu>
|
||||||
|
<MenuItem name="Viewer 2D">
|
||||||
|
<MenuItem name="Labels">
|
||||||
|
<Sample name="Text" function="TextView2dSample"/>
|
||||||
|
<Sample name="Marker" function="MarkerView2dSample"/>
|
||||||
|
<Sample name="Fill Area" function="FillAreaView2dSample"/>
|
||||||
|
<Sample name="Loop on face" function="LoopOnFaceView2dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Grids">
|
||||||
|
<Sample name="Rectagular Lines" function="RectagularLineGrid2dSample"/>
|
||||||
|
<Sample name="Rectagular Points" function="RectagularPointGrid2dSample"/>
|
||||||
|
<Sample name="Circular Lines" function="CircularLineGrid2dSample"/>
|
||||||
|
<Sample name="Circular Points" function="CircularPointGrid2dSample"/>
|
||||||
|
<Sample name="Clear" function="ClearGrid2dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Image">
|
||||||
|
<Sample name="Backgroung Image" function="BackgroungImage2dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
@ -75,7 +75,7 @@ void Viewer2dSamples::ClearExtra()
|
|||||||
|
|
||||||
void Viewer2dSamples::TextView2dSample()
|
void Viewer2dSamples::TextView2dSample()
|
||||||
{
|
{
|
||||||
Standard_Integer aColor = Quantity_NameOfColor::Quantity_NOC_MATRABLUE;
|
Standard_Integer aColor = Quantity_NOC_MATRABLUE;
|
||||||
for (Standard_Integer j = 15; j <= 20; j++)
|
for (Standard_Integer j = 15; j <= 20; j++)
|
||||||
{
|
{
|
||||||
Handle(AIS_TextLabel) aText = new AIS_TextLabel();
|
Handle(AIS_TextLabel) aText = new AIS_TextLabel();
|
||||||
|
@ -1,106 +0,0 @@
|
|||||||
{
|
|
||||||
"Viewer 3D": {
|
|
||||||
"Light source": [{
|
|
||||||
"text": "Spot",
|
|
||||||
"function": "SpotLight3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Positional",
|
|
||||||
"function": "PositionalLight3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Directional",
|
|
||||||
"function": "DirectionalLight3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Ambient",
|
|
||||||
"function": "AmbientLight3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Clear",
|
|
||||||
"function": "ClearLight3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
"Selection mode": [{
|
|
||||||
"text": "Vertices",
|
|
||||||
"function": "VerticesSelect3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Edges",
|
|
||||||
"function": "EdgesSelect3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Faces",
|
|
||||||
"function": "FacesSelect3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Neutral point",
|
|
||||||
"function": "NeutralPointSelect3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
"Shape presentation": [
|
|
||||||
{
|
|
||||||
"text": "WireFrame",
|
|
||||||
"function": "WireFramePresentation3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Shading",
|
|
||||||
"function": "ShadingPresentation3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Set color to red",
|
|
||||||
"function": "RedColorPresentation3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Set color to gray",
|
|
||||||
"function": "GrayColorPresentation3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Set plastic material",
|
|
||||||
"function": "PlasticPresentation3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Set bronze material",
|
|
||||||
"function": "BronzePresentation3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Set opaque",
|
|
||||||
"function": "OpaquePresentation3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Set half transparency",
|
|
||||||
"function": "HalfTransparencyPresentation3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"OpenGL VBO mode": [{
|
|
||||||
"text": "Vertex Buffer Object mode ON",
|
|
||||||
"function": "VboOn3dSample",
|
|
||||||
"description": ""
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "Vertex Buffer Object mode OFF",
|
|
||||||
"function": "VboOff3dSample",
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
31
samples/OCCTOverview/code/Viewer3d.xml
Normal file
31
samples/OCCTOverview/code/Viewer3d.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<Menu>
|
||||||
|
<MenuItem name="Viewer 3D">
|
||||||
|
<MenuItem name="Light source">
|
||||||
|
<Sample name="Spot" function="SpotLight3dSample"/>
|
||||||
|
<Sample name="Positional" function="PositionalLight3dSample"/>
|
||||||
|
<Sample name="Directional" function="DirectionalLight3dSample"/>
|
||||||
|
<Sample name="Ambient" function="AmbientLight3dSample"/>
|
||||||
|
<Sample name="Clear" function="ClearLight3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Selection mode">
|
||||||
|
<Sample name="Vertices" function="VerticesSelect3dSample"/>
|
||||||
|
<Sample name="Edges" function="EdgesSelect3dSample"/>
|
||||||
|
<Sample name="Faces" function="FacesSelect3dSample"/>
|
||||||
|
<Sample name="Neutral point" function="NeutralPointSelect3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="Shape presentation">
|
||||||
|
<Sample name="WireFrame" function="WireFramePresentation3dSample"/>
|
||||||
|
<Sample name="Shading" function="ShadingPresentation3dSample"/>
|
||||||
|
<Sample name="Set color to red" function="RedColorPresentation3dSample"/>
|
||||||
|
<Sample name="Set color to gray" function="GrayColorPresentation3dSample"/>
|
||||||
|
<Sample name="Set plastic material" function="PlasticPresentation3dSample"/>
|
||||||
|
<Sample name="Set bronze material" function="BronzePresentation3dSample"/>
|
||||||
|
<Sample name="Set opaque" function="OpaquePresentation3dSample"/>
|
||||||
|
<Sample name="Set half transparency" function="HalfTransparencyPresentation3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem name="OpenGL VBO mode">
|
||||||
|
<Sample name="Vertex Buffer Object mode ON" function="VboOn3dSample"/>
|
||||||
|
<Sample name="Vertex Buffer Object mode OFF" function="VboOff3dSample"/>
|
||||||
|
</MenuItem>
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
@ -99,12 +99,14 @@ void Viewer3dSamples::ClearExtra()
|
|||||||
ClearLight3dSample();
|
ClearLight3dSample();
|
||||||
// Delete Lights
|
// Delete Lights
|
||||||
V3d_ListOfLight aLights;
|
V3d_ListOfLight aLights;
|
||||||
for (V3d_ListOfLightIterator anIter = myView->Viewer()->DefinedLightIterator(); anIter.More(); anIter.Next())
|
for(V3d_ListOfLightIterator anIter = myView->Viewer()->DefinedLightIterator();
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
aLights.Append(anIter.Value());
|
aLights.Append(anIter.Value());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (V3d_ListOfLightIterator aLightIter (aLights); aLightIter.More(); aLightIter.Next())
|
for(V3d_ListOfLightIterator aLightIter (aLights);
|
||||||
|
aLightIter.More(); aLightIter.Next())
|
||||||
{
|
{
|
||||||
myView->Viewer()->DelLight (aLightIter.Value());
|
myView->Viewer()->DelLight (aLightIter.Value());
|
||||||
}
|
}
|
||||||
@ -117,27 +119,31 @@ void Viewer3dSamples::ClearExtra()
|
|||||||
void Viewer3dSamples::SpotLight3dSample()
|
void Viewer3dSamples::SpotLight3dSample()
|
||||||
{
|
{
|
||||||
// Spot light source creation
|
// Spot light source creation
|
||||||
Handle(V3d_SpotLight) aSpotLight = new V3d_SpotLight(gp_Pnt(100.0, 0.0, 0.0), gp_Dir(-1.0, 0.0, 0.0), Quantity_NOC_RED);
|
Handle(V3d_SpotLight) aSpotLight =
|
||||||
|
new V3d_SpotLight(gp_Pnt(100.0, 0.0, 0.0), gp_Dir(-1.0, 0.0, 0.0), Quantity_NOC_RED);
|
||||||
aSpotLight->SetIntensity(5000);
|
aSpotLight->SetIntensity(5000);
|
||||||
myView->SetLightOn(aSpotLight);
|
myView->SetLightOn(aSpotLight);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer3dSamples::PositionalLight3dSample()
|
void Viewer3dSamples::PositionalLight3dSample()
|
||||||
{
|
{
|
||||||
Handle(V3d_PositionalLight) aPositionalLight = new V3d_PositionalLight(gp_Pnt(0.0, -100.0, 5.0), Quantity_NOC_GREEN);
|
Handle(V3d_PositionalLight) aPositionalLight =
|
||||||
|
new V3d_PositionalLight(gp_Pnt(0.0, -100.0, 5.0), Quantity_NOC_GREEN);
|
||||||
aPositionalLight->SetAttenuation(1, 0);
|
aPositionalLight->SetAttenuation(1, 0);
|
||||||
myView->SetLightOn(aPositionalLight);
|
myView->SetLightOn(aPositionalLight);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer3dSamples::DirectionalLight3dSample()
|
void Viewer3dSamples::DirectionalLight3dSample()
|
||||||
{
|
{
|
||||||
Handle(V3d_DirectionalLight) aDirectionalLight = new V3d_DirectionalLight(gp_Dir(-1.0, 0.0, -1.0), Quantity_NOC_BLUE1);
|
Handle(V3d_DirectionalLight) aDirectionalLight =
|
||||||
|
new V3d_DirectionalLight(gp_Dir(-1.0, 0.0, -1.0), Quantity_NOC_BLUE1);
|
||||||
myView->SetLightOn(aDirectionalLight);
|
myView->SetLightOn(aDirectionalLight);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Viewer3dSamples::AmbientLight3dSample()
|
void Viewer3dSamples::AmbientLight3dSample()
|
||||||
{
|
{
|
||||||
Handle(V3d_AmbientLight) aAmbientLight = new V3d_AmbientLight(Quantity_NOC_MAGENTA1);
|
Handle(V3d_AmbientLight) aAmbientLight =
|
||||||
|
new V3d_AmbientLight(Quantity_NOC_MAGENTA1);
|
||||||
myView->SetLightOn(aAmbientLight);
|
myView->SetLightOn(aAmbientLight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,23 +151,27 @@ void Viewer3dSamples::ClearLight3dSample()
|
|||||||
{
|
{
|
||||||
// Setting Off all viewer active lights
|
// Setting Off all viewer active lights
|
||||||
V3d_ListOfLight aLights;
|
V3d_ListOfLight aLights;
|
||||||
for (V3d_ListOfLightIterator anIter = myView->Viewer()->ActiveLightIterator(); anIter.More(); anIter.Next())
|
for(V3d_ListOfLightIterator anIter = myView->Viewer()->ActiveLightIterator();
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
aLights.Append(anIter.Value());
|
aLights.Append(anIter.Value());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (V3d_ListOfLightIterator aLightIter (aLights); aLightIter.More(); aLightIter.Next())
|
for(V3d_ListOfLightIterator aLightIter(aLights);
|
||||||
|
aLightIter.More(); aLightIter.Next())
|
||||||
{
|
{
|
||||||
myView->Viewer()->SetLightOff (aLightIter.Value());
|
myView->Viewer()->SetLightOff (aLightIter.Value());
|
||||||
}
|
}
|
||||||
// Setting Off all view active lights
|
// Setting Off all view active lights
|
||||||
aLights.Clear();
|
aLights.Clear();
|
||||||
for (V3d_ListOfLightIterator anIter = myView->ActiveLightIterator(); anIter.More(); anIter.Next())
|
for(V3d_ListOfLightIterator anIter = myView->ActiveLightIterator();
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
aLights.Append(anIter.Value());
|
aLights.Append(anIter.Value());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (V3d_ListOfLightIterator aLightIter (aLights); aLightIter.More(); aLightIter.Next())
|
for(V3d_ListOfLightIterator aLightIter (aLights);
|
||||||
|
aLightIter.More(); aLightIter.Next())
|
||||||
{
|
{
|
||||||
myView->SetLightOff (aLightIter.Value());
|
myView->SetLightOff (aLightIter.Value());
|
||||||
}
|
}
|
||||||
@ -197,8 +207,10 @@ void Viewer3dSamples::WireFramePresentation3dSample()
|
|||||||
{
|
{
|
||||||
AIS_ListOfInteractive anAisObjectsList;
|
AIS_ListOfInteractive anAisObjectsList;
|
||||||
myContext->DisplayedObjects(anAisObjectsList);
|
myContext->DisplayedObjects(anAisObjectsList);
|
||||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||||
myContext->SetDisplayMode(anAisObject, 0, false); // set wireframe
|
myContext->SetDisplayMode(anAisObject, 0, false); // set wireframe
|
||||||
}
|
}
|
||||||
myContext->UpdateCurrentViewer();
|
myContext->UpdateCurrentViewer();
|
||||||
@ -208,8 +220,10 @@ void Viewer3dSamples::ShadingPresentation3dSample()
|
|||||||
{
|
{
|
||||||
AIS_ListOfInteractive anAisObjectsList;
|
AIS_ListOfInteractive anAisObjectsList;
|
||||||
myContext->DisplayedObjects(anAisObjectsList);
|
myContext->DisplayedObjects(anAisObjectsList);
|
||||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||||
myContext->SetDisplayMode(anAisObject, 1, false); // set shading
|
myContext->SetDisplayMode(anAisObject, 1, false); // set shading
|
||||||
}
|
}
|
||||||
myContext->UpdateCurrentViewer();
|
myContext->UpdateCurrentViewer();
|
||||||
@ -219,8 +233,10 @@ void Viewer3dSamples::RedColorPresentation3dSample()
|
|||||||
{
|
{
|
||||||
AIS_ListOfInteractive anAisObjectsList;
|
AIS_ListOfInteractive anAisObjectsList;
|
||||||
myContext->DisplayedObjects(anAisObjectsList);
|
myContext->DisplayedObjects(anAisObjectsList);
|
||||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||||
Quantity_Color aShapeColor;
|
Quantity_Color aShapeColor;
|
||||||
myContext->Color(anAisObject, aShapeColor);
|
myContext->Color(anAisObject, aShapeColor);
|
||||||
myResult << "A Current shape color: Red = " << aShapeColor.Red()
|
myResult << "A Current shape color: Red = " << aShapeColor.Red()
|
||||||
@ -236,16 +252,20 @@ void Viewer3dSamples::GrayColorPresentation3dSample()
|
|||||||
{
|
{
|
||||||
AIS_ListOfInteractive anAisObjectsList;
|
AIS_ListOfInteractive anAisObjectsList;
|
||||||
myContext->DisplayedObjects(anAisObjectsList);
|
myContext->DisplayedObjects(anAisObjectsList);
|
||||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||||
Quantity_Color aShapeColor;
|
Quantity_Color aShapeColor;
|
||||||
myContext->Color(anAisObject, aShapeColor);
|
myContext->Color(anAisObject, aShapeColor);
|
||||||
myResult << "A Current shape color: Hue = " << aShapeColor.Hue()
|
myResult << "A Current shape color: Hue = " << aShapeColor.Hue()
|
||||||
<< " Light = " << aShapeColor.Light() << " Saturation = " << aShapeColor.Saturation() << std::endl;
|
<< " Light = " << aShapeColor.Light()
|
||||||
|
<< " Saturation = " << aShapeColor.Saturation() << std::endl;
|
||||||
aShapeColor.SetValues(0.0, 0.3, 0.1, Quantity_TOC_HLS);
|
aShapeColor.SetValues(0.0, 0.3, 0.1, Quantity_TOC_HLS);
|
||||||
myContext->SetColor(anAisObject, aShapeColor, Standard_False);
|
myContext->SetColor(anAisObject, aShapeColor, Standard_False);
|
||||||
myResult << "A New shape color: Hue = " << aShapeColor.Hue()
|
myResult << "A New shape color: Hue = " << aShapeColor.Hue()
|
||||||
<< " Light = " << aShapeColor.Light() << " Saturation = " << aShapeColor.Saturation() << std::endl;
|
<< " Light = " << aShapeColor.Light()
|
||||||
|
<< " Saturation = " << aShapeColor.Saturation() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -254,8 +274,10 @@ void Viewer3dSamples::PlasticPresentation3dSample()
|
|||||||
AIS_ListOfInteractive anAisObjectsList;
|
AIS_ListOfInteractive anAisObjectsList;
|
||||||
myContext->DisplayedObjects(anAisObjectsList);
|
myContext->DisplayedObjects(anAisObjectsList);
|
||||||
Graphic3d_NameOfMaterial aMaterial = Graphic3d_NOM_PLASTIC;
|
Graphic3d_NameOfMaterial aMaterial = Graphic3d_NOM_PLASTIC;
|
||||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||||
myContext->SetMaterial(anAisObject, aMaterial, Standard_False);
|
myContext->SetMaterial(anAisObject, aMaterial, Standard_False);
|
||||||
}
|
}
|
||||||
myContext->UpdateCurrentViewer();
|
myContext->UpdateCurrentViewer();
|
||||||
@ -266,8 +288,10 @@ void Viewer3dSamples::BronzePresentation3dSample()
|
|||||||
AIS_ListOfInteractive anAisObjectsList;
|
AIS_ListOfInteractive anAisObjectsList;
|
||||||
myContext->DisplayedObjects(anAisObjectsList);
|
myContext->DisplayedObjects(anAisObjectsList);
|
||||||
Graphic3d_NameOfMaterial aMaterial = Graphic3d_NOM_BRONZE;
|
Graphic3d_NameOfMaterial aMaterial = Graphic3d_NOM_BRONZE;
|
||||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||||
myContext->SetMaterial(anAisObject, aMaterial, Standard_False);
|
myContext->SetMaterial(anAisObject, aMaterial, Standard_False);
|
||||||
}
|
}
|
||||||
myContext->UpdateCurrentViewer();
|
myContext->UpdateCurrentViewer();
|
||||||
@ -277,8 +301,10 @@ void Viewer3dSamples::OpaquePresentation3dSample()
|
|||||||
{
|
{
|
||||||
AIS_ListOfInteractive anAisObjectsList;
|
AIS_ListOfInteractive anAisObjectsList;
|
||||||
myContext->DisplayedObjects(anAisObjectsList);
|
myContext->DisplayedObjects(anAisObjectsList);
|
||||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||||
myContext->SetTransparency(anAisObject, 0.0, Standard_False);
|
myContext->SetTransparency(anAisObject, 0.0, Standard_False);
|
||||||
}
|
}
|
||||||
myContext->UpdateCurrentViewer();
|
myContext->UpdateCurrentViewer();
|
||||||
@ -288,8 +314,10 @@ void Viewer3dSamples::HalfTransparencyPresentation3dSample()
|
|||||||
{
|
{
|
||||||
AIS_ListOfInteractive anAisObjectsList;
|
AIS_ListOfInteractive anAisObjectsList;
|
||||||
myContext->DisplayedObjects(anAisObjectsList);
|
myContext->DisplayedObjects(anAisObjectsList);
|
||||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
for(AIS_ListOfInteractive::Iterator anIter (anAisObjectsList);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||||
myContext->SetTransparency(anAisObject, 0.5, Standard_False);
|
myContext->SetTransparency(anAisObject, 0.5, Standard_False);
|
||||||
}
|
}
|
||||||
myContext->UpdateCurrentViewer();
|
myContext->UpdateCurrentViewer();
|
||||||
@ -297,7 +325,8 @@ void Viewer3dSamples::HalfTransparencyPresentation3dSample()
|
|||||||
|
|
||||||
void Viewer3dSamples::VboOn3dSample()
|
void Viewer3dSamples::VboOn3dSample()
|
||||||
{
|
{
|
||||||
if (Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(myContext->CurrentViewer()->Driver()))
|
if(Handle(OpenGl_GraphicDriver) aDriver =
|
||||||
|
Handle(OpenGl_GraphicDriver)::DownCast(myContext->CurrentViewer()->Driver()))
|
||||||
{
|
{
|
||||||
aDriver->ChangeOptions().vboDisable = Standard_False;
|
aDriver->ChangeOptions().vboDisable = Standard_False;
|
||||||
}
|
}
|
||||||
@ -305,7 +334,8 @@ void Viewer3dSamples::VboOn3dSample()
|
|||||||
|
|
||||||
void Viewer3dSamples::VboOff3dSample()
|
void Viewer3dSamples::VboOff3dSample()
|
||||||
{
|
{
|
||||||
if (Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(myContext->CurrentViewer()->Driver()))
|
if(Handle(OpenGl_GraphicDriver) aDriver =
|
||||||
|
Handle(OpenGl_GraphicDriver)::DownCast(myContext->CurrentViewer()->Driver()))
|
||||||
{
|
{
|
||||||
aDriver->ChangeOptions().vboDisable = Standard_True;
|
aDriver->ChangeOptions().vboDisable = Standard_True;
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,15 @@ TEMPLATE = app
|
|||||||
CONFIG += debug_and_release qt
|
CONFIG += debug_and_release qt
|
||||||
CONFIG += lrelease
|
CONFIG += lrelease
|
||||||
CONFIG += embed_translations
|
CONFIG += embed_translations
|
||||||
|
QT += xml
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||||
QT += widgets
|
QT += widgets
|
||||||
|
}
|
||||||
|
|
||||||
TARGET = OCCTOverview
|
TARGET = OCCTOverview
|
||||||
|
|
||||||
SAMPLESROOT = $$quote($$(CSF_OCCTSamplesPath)/qt)
|
SAMPLESROOT = $$quote($$(CSF_OCCTSamplesPath)/qt)
|
||||||
|
|
||||||
FREEIMAGE_DIR = $$quote($$(FREEIMAGE_DIR))
|
|
||||||
TBB_DIR = $$quote($$(TBB_DIR))
|
|
||||||
|
|
||||||
HEADERS = ./src/*.h \
|
HEADERS = ./src/*.h \
|
||||||
$${SAMPLESROOT}/../OCCTOverview/code/*.h
|
$${SAMPLESROOT}/../OCCTOverview/code/*.h
|
||||||
|
@ -5,8 +5,8 @@ if exist "%~dp0custom.bat" (
|
|||||||
)
|
)
|
||||||
|
|
||||||
call "%CASROOT%\env.bat" %1 %2 %3
|
call "%CASROOT%\env.bat" %1 %2 %3
|
||||||
|
|
||||||
if /I ["%1"] == ["vc141"] set "VCVER=vc141"
|
if /I ["%1"] == ["vc141"] set "VCVER=vc141"
|
||||||
|
if /I ["%1"] == ["vc142"] set "VCVER=vc142"
|
||||||
set "BIN_DIR=win%ARCH%\%VCVER%\bind"
|
set "BIN_DIR=win%ARCH%\%VCVER%\bind"
|
||||||
set "LIB_DIR=win%ARCH%\%VCVER%\libd"
|
set "LIB_DIR=win%ARCH%\%VCVER%\libd"
|
||||||
|
|
||||||
@ -27,3 +27,5 @@ if not "%QTDIR%" == "" (
|
|||||||
set "PATH=%QTDIR%/bin;%PATH%"
|
set "PATH=%QTDIR%/bin;%PATH%"
|
||||||
set "QT_QPA_PLATFORM_PLUGIN_PATH=%QTDIR%\plugins\platforms"
|
set "QT_QPA_PLATFORM_PLUGIN_PATH=%QTDIR%\plugins\platforms"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set "CSF_OCCTOverviewSampleCodePath=%~dp0..\..\OCCTOverview\code"
|
||||||
|
@ -28,9 +28,6 @@
|
|||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QJsonArray>
|
|
||||||
#include <QJsonDocument>
|
|
||||||
#include <QJsonObject>
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QMdiArea>
|
#include <QMdiArea>
|
||||||
#include <QMdiSubWindow>
|
#include <QMdiSubWindow>
|
||||||
@ -43,6 +40,8 @@
|
|||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QDomDocument>
|
||||||
|
#include <QDomAttr>
|
||||||
#include <Standard_WarningsRestore.hxx>
|
#include <Standard_WarningsRestore.hxx>
|
||||||
|
|
||||||
#include <OpenGl_GraphicDriver.hxx>
|
#include <OpenGl_GraphicDriver.hxx>
|
||||||
@ -53,13 +52,21 @@
|
|||||||
|
|
||||||
ApplicationCommonWindow::ApplicationCommonWindow (ApplicationType theCategory)
|
ApplicationCommonWindow::ApplicationCommonWindow (ApplicationType theCategory)
|
||||||
: QMainWindow (nullptr),
|
: QMainWindow (nullptr),
|
||||||
|
myAppType(theCategory),
|
||||||
myStdToolBar (nullptr),
|
myStdToolBar (nullptr),
|
||||||
myViewBar (nullptr),
|
myViewBar (nullptr),
|
||||||
myCasCadeBar (nullptr),
|
myCasCadeBar (nullptr),
|
||||||
myFilePopup (nullptr),
|
myFilePopup (nullptr),
|
||||||
myCategoryPopup (nullptr)
|
myCategoryPopup (nullptr)
|
||||||
{
|
{
|
||||||
myAppType = theCategory;
|
ALL_CATEGORIES[AppType_Geometry] = "Geometry";
|
||||||
|
ALL_CATEGORIES[AppType_Topology] = "Topology";
|
||||||
|
ALL_CATEGORIES[AppType_Triangulation] = "Triangulation";
|
||||||
|
ALL_CATEGORIES[AppType_DataExchange] = "DataExchange";
|
||||||
|
ALL_CATEGORIES[AppType_Ocaf] = "OCAF";
|
||||||
|
ALL_CATEGORIES[AppType_Viewer3d] = "3D viewer";
|
||||||
|
ALL_CATEGORIES[AppType_Viewer2d] = "2D Viewer";
|
||||||
|
|
||||||
mySampleMapper = new QSignalMapper(this);
|
mySampleMapper = new QSignalMapper(this);
|
||||||
myExchangeMapper = new QSignalMapper(this);
|
myExchangeMapper = new QSignalMapper(this);
|
||||||
myOcafMapper = new QSignalMapper(this);
|
myOcafMapper = new QSignalMapper(this);
|
||||||
@ -68,19 +75,13 @@ ApplicationCommonWindow::ApplicationCommonWindow (ApplicationType theCategory)
|
|||||||
|
|
||||||
myCategoryMapper = new QSignalMapper(this);
|
myCategoryMapper = new QSignalMapper(this);
|
||||||
|
|
||||||
connect(mySampleMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
|
connect(mySampleMapper, SIGNAL(mapped(const QString &)), this, SLOT(onProcessSample(const QString &)));
|
||||||
this, &ApplicationCommonWindow::onProcessSample);
|
connect(myExchangeMapper, SIGNAL(mapped(const QString &)), this, SLOT(onProcessExchange(const QString &)));
|
||||||
connect(myExchangeMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
|
connect(myOcafMapper, SIGNAL(mapped(const QString &)), this, SLOT(onProcessOcaf(const QString &)));
|
||||||
this, &ApplicationCommonWindow::onProcessExchange);
|
connect(myViewer3dMapper, SIGNAL(mapped(const QString &)), this, SLOT(onProcessViewer3d(const QString &)));
|
||||||
connect(myOcafMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
|
connect(myViewer2dMapper, SIGNAL(mapped(const QString &)), this, SLOT(onProcessViewer2d(const QString &)));
|
||||||
this, &ApplicationCommonWindow::onProcessOcaf);
|
|
||||||
connect(myViewer3dMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
|
|
||||||
this, &ApplicationCommonWindow::onProcessViewer3d);
|
|
||||||
connect(myViewer2dMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
|
|
||||||
this, &ApplicationCommonWindow::onProcessViewer2d);
|
|
||||||
|
|
||||||
connect(myCategoryMapper, static_cast<void (QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped),
|
connect(myCategoryMapper, SIGNAL(mapped(const QString &)), this, SLOT(onChangeCategory(const QString &)));
|
||||||
this, &ApplicationCommonWindow::onChangeCategory);
|
|
||||||
|
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
|
|
||||||
@ -121,20 +122,25 @@ ApplicationCommonWindow::ApplicationCommonWindow (ApplicationType theCategory)
|
|||||||
aViewFrame->setLineWidth(3);
|
aViewFrame->setLineWidth(3);
|
||||||
QVBoxLayout* aViewLayout = new QVBoxLayout(aViewFrame);
|
QVBoxLayout* aViewLayout = new QVBoxLayout(aViewFrame);
|
||||||
aViewLayout->setContentsMargins(0, 0, 0, 0);
|
aViewLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
myGeomWidget = new GeomWidget(myDocument3d, myDocument2d, this);
|
myGeomWidget = new GeomWidget(myDocument3d, myDocument2d, aViewFrame);
|
||||||
aViewLayout->addWidget(myGeomWidget);
|
aViewLayout->addWidget(myGeomWidget);
|
||||||
//myGeomWidget->setContentsMargins(0, 0, 0, 0);
|
|
||||||
|
myGeomWidget->setContentsMargins(0, 0, 0, 0);
|
||||||
QSplitter* aGeomTextSplitter = new QSplitter(Qt::Horizontal);
|
QSplitter* aGeomTextSplitter = new QSplitter(Qt::Horizontal);
|
||||||
|
|
||||||
aGeomTextSplitter->addWidget(aViewFrame);
|
aGeomTextSplitter->addWidget(aViewFrame);
|
||||||
aGeomTextSplitter->addWidget(aCodeResultSplitter);
|
aGeomTextSplitter->addWidget(aCodeResultSplitter);
|
||||||
aGeomTextSplitter->setStretchFactor(0, 1);
|
aGeomTextSplitter->setStretchFactor(0, 1);
|
||||||
aGeomTextSplitter->setStretchFactor(1, 1);
|
aGeomTextSplitter->setStretchFactor(1, 1);
|
||||||
QList<int> aSizeList{ 640, 640 };
|
QList<int> aSizeList;
|
||||||
|
aSizeList.append(640);
|
||||||
|
aSizeList.append(640);
|
||||||
aGeomTextSplitter->setSizes(aSizeList);
|
aGeomTextSplitter->setSizes(aSizeList);
|
||||||
setCentralWidget(aGeomTextSplitter);
|
setCentralWidget(aGeomTextSplitter);
|
||||||
|
|
||||||
|
#include <Standard_WarningsDisable.hxx>
|
||||||
Q_INIT_RESOURCE(Samples);
|
Q_INIT_RESOURCE(Samples);
|
||||||
|
#include <Standard_WarningsRestore.hxx>
|
||||||
|
|
||||||
TCollection_AsciiString aSampleSourcePach = getSampleSourceDir();
|
TCollection_AsciiString aSampleSourcePach = getSampleSourceDir();
|
||||||
myGeometrySamples = new GeometrySamples(aSampleSourcePach,
|
myGeometrySamples = new GeometrySamples(aSampleSourcePach,
|
||||||
@ -157,13 +163,14 @@ ApplicationCommonWindow::ApplicationCommonWindow (ApplicationType theCategory)
|
|||||||
myDocument2d->getViewer(),
|
myDocument2d->getViewer(),
|
||||||
myDocument2d->getContext());
|
myDocument2d->getContext());
|
||||||
|
|
||||||
MenuFormJson(":/menus/Geometry.json", mySampleMapper, myGeometryMenus);
|
|
||||||
MenuFormJson(":/menus/Topology.json", mySampleMapper, myTopologyMenus);
|
MenuFormXml(":/menus/Geometry.xml", mySampleMapper, myGeometryMenus);
|
||||||
MenuFormJson(":/menus/Triangulation.json", mySampleMapper, myTriangulationMenus);
|
MenuFormXml(":/menus/Topology.xml", mySampleMapper, myTopologyMenus);
|
||||||
MenuFormJson(":/menus/DataExchange.json", myExchangeMapper, myDataExchangeMenus);
|
MenuFormXml(":/menus/Triangulation.xml", mySampleMapper, myTriangulationMenus);
|
||||||
MenuFormJson(":/menus/Ocaf.json", myOcafMapper, myOcafMenus);
|
MenuFormXml(":/menus/DataExchange.xml", myExchangeMapper, myDataExchangeMenus);
|
||||||
MenuFormJson(":/menus/Viewer3d.json", myViewer3dMapper, myViewer3dMenus);
|
MenuFormXml(":/menus/Ocaf.xml", myOcafMapper, myOcafMenus);
|
||||||
MenuFormJson(":/menus/Viewer2d.json", myViewer2dMapper, myViewer2dMenus);
|
MenuFormXml(":/menus/Viewer3d.xml", myViewer3dMapper, myViewer3dMenus);
|
||||||
|
MenuFormXml(":/menus/Viewer2d.xml", myViewer2dMapper, myViewer2dMenus);
|
||||||
|
|
||||||
onChangeCategory(ALL_CATEGORIES[myAppType]);
|
onChangeCategory(ALL_CATEGORIES[myAppType]);
|
||||||
|
|
||||||
@ -174,29 +181,31 @@ void ApplicationCommonWindow::RebuildMenu()
|
|||||||
{
|
{
|
||||||
menuBar()->clear();
|
menuBar()->clear();
|
||||||
|
|
||||||
myStdActions[FileQuit] = CreateAction(&ApplicationCommonWindow::onCloseAllWindows, "Quit", "CTRL+Q");
|
myStdActions[StdActions_FileQuit] = CreateAction("Quit", "CTRL+Q");
|
||||||
myStdActions[HelpAbout] = CreateAction(&ApplicationCommonWindow::onAbout, "About", "F1", ":/icons/help.png");
|
connect(myStdActions[StdActions_FileQuit], SIGNAL(triggered()), this, SLOT(onCloseAllWindows()));
|
||||||
|
myStdActions[StdActions_HelpAbout] = CreateAction("About", "F1", ":/icons/help.png");
|
||||||
|
connect(myStdActions[StdActions_HelpAbout], SIGNAL(triggered()), this, SLOT(onAbout()));
|
||||||
|
|
||||||
// populate a menu with all actions
|
// populate a menu with all actions
|
||||||
myFilePopup = new QMenu(this);
|
myFilePopup = new QMenu(this);
|
||||||
myFilePopup = menuBar()->addMenu(tr("&File"));
|
myFilePopup = menuBar()->addMenu(tr("&File"));
|
||||||
myFilePopup->addAction(myStdActions[FileQuit]);
|
myFilePopup->addAction(myStdActions[StdActions_FileQuit]);
|
||||||
|
|
||||||
myCategoryPopup = new QMenu(this);
|
myCategoryPopup = new QMenu(this);
|
||||||
myCategoryPopup = menuBar()->addMenu(tr("&Category"));
|
myCategoryPopup = menuBar()->addMenu(tr("&Category"));
|
||||||
|
|
||||||
for (ApplicationType aCategory: ALL_CATEGORIES.keys())
|
foreach (ApplicationType aCategory, ALL_CATEGORIES.keys())
|
||||||
{
|
{
|
||||||
QString aCategoryName = ALL_CATEGORIES.value(aCategory);
|
QString aCategoryName = ALL_CATEGORIES.value(aCategory);
|
||||||
QAction* anAction = myCategoryPopup->addAction(aCategoryName);
|
QAction* anAction = myCategoryPopup->addAction(aCategoryName);
|
||||||
anAction->setText(aCategoryName);
|
anAction->setText(aCategoryName);
|
||||||
myCategoryMapper->setMapping(anAction, aCategoryName);
|
myCategoryMapper->setMapping(anAction, aCategoryName);
|
||||||
connect(anAction, &QAction::triggered, myCategoryMapper, static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
|
connect(anAction, SIGNAL(triggered()), myCategoryMapper, SLOT(map()));
|
||||||
myCategoryPopup->addAction(anAction);
|
myCategoryPopup->addAction(anAction);
|
||||||
myCategoryActions.insert(aCategory, anAction);
|
myCategoryActions.insert(aCategory, anAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QMenu* aSampleMenu : GetCurrentMenus())
|
foreach (QMenu* aSampleMenu, GetCurrentMenus())
|
||||||
{
|
{
|
||||||
menuBar()->addMenu(aSampleMenu);
|
menuBar()->addMenu(aSampleMenu);
|
||||||
}
|
}
|
||||||
@ -205,21 +214,21 @@ void ApplicationCommonWindow::RebuildMenu()
|
|||||||
QMenu* aHelp = new QMenu(this);
|
QMenu* aHelp = new QMenu(this);
|
||||||
menuBar()->addSeparator();
|
menuBar()->addSeparator();
|
||||||
aHelp = menuBar()->addMenu(tr("&Help"));
|
aHelp = menuBar()->addMenu(tr("&Help"));
|
||||||
aHelp->addAction(myStdActions[HelpAbout]);
|
aHelp->addAction(myStdActions[StdActions_HelpAbout]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle(BaseSample) ApplicationCommonWindow::GetCurrentSamples()
|
Handle(BaseSample) ApplicationCommonWindow::GetCurrentSamples()
|
||||||
{
|
{
|
||||||
switch (myAppType)
|
switch (myAppType)
|
||||||
{
|
{
|
||||||
case Geometry: return myGeometrySamples;
|
case AppType_Geometry: return myGeometrySamples;
|
||||||
case Topology: return myTopologySamples;
|
case AppType_Topology: return myTopologySamples;
|
||||||
case Triangulation: return myTriangulationSamples;
|
case AppType_Triangulation: return myTriangulationSamples;
|
||||||
case DataExchange: return myDataExchangeSamples;
|
case AppType_DataExchange: return myDataExchangeSamples;
|
||||||
case Ocaf: return myOcafSamples;
|
case AppType_Ocaf: return myOcafSamples;
|
||||||
case Viewer2d: return myViewer2dSamples;
|
case AppType_Viewer2d: return myViewer2dSamples;
|
||||||
case Viewer3d: return myViewer3dSamples;
|
case AppType_Viewer3d: return myViewer3dSamples;
|
||||||
case Unknown:
|
case AppType_Unknown:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
throw QString("Unknown Application type");
|
throw QString("Unknown Application type");
|
||||||
@ -229,14 +238,14 @@ const QList<QMenu*>& ApplicationCommonWindow::GetCurrentMenus()
|
|||||||
{
|
{
|
||||||
switch (myAppType)
|
switch (myAppType)
|
||||||
{
|
{
|
||||||
case Geometry: return myGeometryMenus;
|
case AppType_Geometry: return myGeometryMenus;
|
||||||
case Topology: return myTopologyMenus;
|
case AppType_Topology: return myTopologyMenus;
|
||||||
case Triangulation: return myTriangulationMenus;
|
case AppType_Triangulation: return myTriangulationMenus;
|
||||||
case DataExchange: return myDataExchangeMenus;
|
case AppType_DataExchange: return myDataExchangeMenus;
|
||||||
case Ocaf: return myOcafMenus;
|
case AppType_Ocaf: return myOcafMenus;
|
||||||
case Viewer2d: return myViewer2dMenus;
|
case AppType_Viewer2d: return myViewer2dMenus;
|
||||||
case Viewer3d: return myViewer3dMenus;
|
case AppType_Viewer3d: return myViewer3dMenus;
|
||||||
case Unknown:
|
case AppType_Unknown:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
throw QString("Unknown Application type");
|
throw QString("Unknown Application type");
|
||||||
@ -270,35 +279,35 @@ void ApplicationCommonWindow::onChangeCategory(const QString& theCategory)
|
|||||||
|
|
||||||
switch (myAppType)
|
switch (myAppType)
|
||||||
{
|
{
|
||||||
case DataExchange:
|
case AppType_DataExchange:
|
||||||
{
|
{
|
||||||
myDataExchangeSamples->AppendBottle();
|
myDataExchangeSamples->AppendBottle();
|
||||||
myDocument3d->SetObjects(GetCurrentSamples()->Get3dObjects());
|
myDocument3d->SetObjects(GetCurrentSamples()->Get3dObjects());
|
||||||
myGeomWidget->Show3d();
|
myGeomWidget->Show3d();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Ocaf:
|
case AppType_Ocaf:
|
||||||
{
|
{
|
||||||
onProcessOcaf("CreateOcafDocument");
|
onProcessOcaf("CreateOcafDocument");
|
||||||
myGeomWidget->Show3d();
|
myGeomWidget->Show3d();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Viewer2d:
|
case AppType_Viewer2d:
|
||||||
{
|
{
|
||||||
myGeomWidget->Show2d();
|
myGeomWidget->Show2d();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Viewer3d:
|
case AppType_Viewer3d:
|
||||||
{
|
{
|
||||||
myViewer3dSamples->AppendBottle();
|
myViewer3dSamples->AppendBottle();
|
||||||
myDocument3d->SetObjects(GetCurrentSamples()->Get3dObjects());
|
myDocument3d->SetObjects(GetCurrentSamples()->Get3dObjects());
|
||||||
myGeomWidget->Show3d();
|
myGeomWidget->Show3d();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Geometry:
|
case AppType_Geometry:
|
||||||
case Topology:
|
case AppType_Topology:
|
||||||
case Triangulation:
|
case AppType_Triangulation:
|
||||||
case Unknown:
|
case AppType_Unknown:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -326,9 +335,7 @@ TCollection_AsciiString ApplicationCommonWindow::getSampleSourceDir()
|
|||||||
return aSampleSourceDir;
|
return aSampleSourceDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename PointerToMemberFunction>
|
QAction* ApplicationCommonWindow::CreateAction (const QString& theActionName,
|
||||||
QAction* ApplicationCommonWindow::CreateAction (PointerToMemberFunction theHandlerMethod,
|
|
||||||
const QString& theActionName,
|
|
||||||
const QString& theShortcut,
|
const QString& theShortcut,
|
||||||
const QString& theIconName)
|
const QString& theIconName)
|
||||||
{
|
{
|
||||||
@ -345,7 +352,7 @@ QAction* ApplicationCommonWindow::CreateAction (PointerToMemberFunction theHandl
|
|||||||
aAction->setToolTip(theActionName);
|
aAction->setToolTip(theActionName);
|
||||||
aAction->setStatusTip(theActionName);
|
aAction->setStatusTip(theActionName);
|
||||||
aAction->setShortcut(theShortcut);
|
aAction->setShortcut(theShortcut);
|
||||||
connect(aAction, &QAction::triggered, this, theHandlerMethod);
|
|
||||||
return aAction;
|
return aAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,9 +360,9 @@ template <typename PointerToMemberFunction>
|
|||||||
QAction* ApplicationCommonWindow::CreateSample (PointerToMemberFunction theHandlerMethod,
|
QAction* ApplicationCommonWindow::CreateSample (PointerToMemberFunction theHandlerMethod,
|
||||||
const char* theActionName)
|
const char* theActionName)
|
||||||
{
|
{
|
||||||
QAction* aAction = new QAction(QObject::tr(theActionName), this);
|
QAction* anAction = new QAction(QObject::tr(theActionName), this);
|
||||||
connect(aAction, &QAction::triggered, this, theHandlerMethod);
|
connect(anAction, SIGNAL(triggered()), this, SLOT(theHandlerMethod()));
|
||||||
return aAction;
|
return anAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationCommonWindow::resizeEvent(QResizeEvent* e)
|
void ApplicationCommonWindow::resizeEvent(QResizeEvent* e)
|
||||||
@ -608,78 +615,78 @@ TranslateDialog* ApplicationCommonWindow::getOcafDialog(const QString& theSample
|
|||||||
return aTranslateDialog;
|
return aTranslateDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu* ApplicationCommonWindow::MenuFromJsonObject (const QJsonValue& theJsonValue,
|
QMenu* ApplicationCommonWindow::MenuFromDomNode(QDomElement& theItemElement,
|
||||||
const QString& theKey,
|
|
||||||
QWidget* theParent,
|
QWidget* theParent,
|
||||||
QSignalMapper* theMapper)
|
QSignalMapper* theMapper)
|
||||||
{
|
{
|
||||||
QMenu* aMenu = new QMenu(theKey, theParent);
|
QString anItemName = theItemElement.attribute("name");
|
||||||
if (theJsonValue.isObject())
|
QMenu* aMenu = new QMenu(anItemName, theParent);
|
||||||
{
|
QDomElement anChildItemElement = theItemElement.firstChildElement("MenuItem");
|
||||||
QJsonObject aBranchObject = theJsonValue.toObject();
|
QDomElement anSampleElement = theItemElement.firstChildElement("Sample");
|
||||||
for (const QString& aBranchKey : aBranchObject.keys())
|
|
||||||
{
|
|
||||||
aMenu->addMenu(MenuFromJsonObject(aBranchObject.value(aBranchKey), aBranchKey, aMenu, theMapper));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (theJsonValue.isArray())
|
|
||||||
{
|
|
||||||
QJsonArray aDataArray = theJsonValue.toArray();
|
|
||||||
for (const QJsonValue& aDataValue : aDataArray)
|
|
||||||
{
|
|
||||||
if (aDataValue.isObject())
|
|
||||||
{
|
|
||||||
QJsonObject aDataObject = aDataValue.toObject();
|
|
||||||
QString aSampleName = aDataObject["function"].toString();
|
|
||||||
QAction* anAction = aMenu->addAction(aSampleName);
|
|
||||||
anAction->setText(aDataObject["text"].toString());
|
|
||||||
|
|
||||||
theMapper->setMapping(anAction, aSampleName);
|
while(anChildItemElement.isElement())
|
||||||
connect(anAction, &QAction::triggered, theMapper,
|
{
|
||||||
static_cast<void (QSignalMapper::*)()>(&QSignalMapper::map));
|
aMenu->addMenu(MenuFromDomNode(anChildItemElement, aMenu, theMapper));
|
||||||
}
|
anChildItemElement = anChildItemElement.nextSibling().toElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while(anSampleElement.isElement())
|
||||||
|
{
|
||||||
|
QString aSampleName = anSampleElement.attribute("name");
|
||||||
|
QString aSampleFunction = anSampleElement.attribute("function");
|
||||||
|
QAction* anAction = aMenu->addAction(aSampleFunction);
|
||||||
|
anAction->setText(aSampleName);
|
||||||
|
theMapper->setMapping(anAction, aSampleFunction);
|
||||||
|
connect(anAction, SIGNAL(triggered()), theMapper, SLOT(map()));
|
||||||
|
anSampleElement = anSampleElement.nextSibling().toElement();
|
||||||
}
|
}
|
||||||
return aMenu;
|
return aMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationCommonWindow::MenuFormJson (const QString& thePath,
|
void ApplicationCommonWindow::MenuFormXml(const QString& thePath,
|
||||||
QSignalMapper* theMapper,
|
QSignalMapper* theMapper,
|
||||||
QList<QMenu*>& theMunusList)
|
QList<QMenu*>& theMunusList)
|
||||||
{
|
{
|
||||||
|
QDomDocument aDomDocument;
|
||||||
theMunusList.clear();
|
theMunusList.clear();
|
||||||
QFile aJsonFile(thePath);
|
QFile aXmlFile(thePath);
|
||||||
QString anErrorMessage;
|
QString anErrorMessage;
|
||||||
if (aJsonFile.error() != QFile::NoError)
|
if (aXmlFile.error() != QFile::NoError)
|
||||||
{
|
{
|
||||||
anErrorMessage = aJsonFile.errorString();
|
anErrorMessage = aXmlFile.errorString();
|
||||||
Message::SendFail() << "QFile creating error: " << anErrorMessage.toUtf8().constData();
|
Message::SendFail() << "QFile creating error: " << anErrorMessage.toUtf8().constData();
|
||||||
|
aXmlFile.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!aJsonFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
if (!aXmlFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
Message::SendFail() << "File " << thePath.toUtf8().constData() << " could not open";
|
Message::SendFail() << "File " << thePath.toUtf8().constData() << " could not open";
|
||||||
if (aJsonFile.error() != QFile::NoError)
|
if (aXmlFile.error() != QFile::NoError)
|
||||||
{
|
{
|
||||||
anErrorMessage = aJsonFile.errorString();
|
anErrorMessage = aXmlFile.errorString();
|
||||||
Message::SendFail() << "QFile opening error: " << anErrorMessage.toUtf8().constData();
|
Message::SendFail() << "QFile opening error: " << anErrorMessage.toUtf8().constData();
|
||||||
}
|
}
|
||||||
|
aXmlFile.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString aJsonString = aJsonFile.readAll();
|
bool aNamespaceProcessing(false);
|
||||||
aJsonFile.close();
|
QString anErrorMsg;
|
||||||
|
int anErrorLine(0);
|
||||||
|
int anErrorColumn(0);
|
||||||
|
if (!aDomDocument.setContent(&aXmlFile, aNamespaceProcessing, &anErrorMsg, &anErrorLine, &anErrorColumn))
|
||||||
|
{
|
||||||
|
Message::SendFail() << "XML file parsing error: " << anErrorMsg.toStdString()
|
||||||
|
<< " at line: " << anErrorLine << " column: " << anErrorColumn;
|
||||||
|
aXmlFile.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
aXmlFile.close();
|
||||||
|
|
||||||
QJsonDocument aJsonDoc = QJsonDocument::fromJson(aJsonString.toUtf8());
|
QDomElement aRootElement = aDomDocument.documentElement();
|
||||||
if (aJsonDoc.isObject())
|
QDomElement anItemElement = aRootElement.firstChildElement("MenuItem");
|
||||||
|
while(!anItemElement.isNull())
|
||||||
{
|
{
|
||||||
QJsonObject aJsonObj = aJsonDoc.object();
|
theMunusList.push_back(MenuFromDomNode(anItemElement, this, theMapper));
|
||||||
for (const QString& aKey : aJsonObj.keys())
|
anItemElement = anItemElement.nextSiblingElement("MenuItem");
|
||||||
{
|
|
||||||
QJsonValue aJsonValue = aJsonObj.value(aKey);
|
|
||||||
if (aJsonValue.isObject())
|
|
||||||
{
|
|
||||||
theMunusList.push_back(MenuFromJsonObject(aJsonValue.toObject(), aKey, this, theMapper));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <Standard_WarningsDisable.hxx>
|
#include <Standard_WarningsDisable.hxx>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QDomNode>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
#include <QMdiArea>
|
#include <QMdiArea>
|
||||||
@ -52,36 +53,22 @@
|
|||||||
|
|
||||||
enum StdActions
|
enum StdActions
|
||||||
{
|
{
|
||||||
FileNew, FilePrefUseVBO, FileClose, FilePreferences, FileQuit, ViewTool, ViewStatus, HelpAbout
|
StdActions_FileQuit,
|
||||||
};
|
StdActions_HelpAbout
|
||||||
|
|
||||||
enum ToolActions
|
|
||||||
{
|
|
||||||
ToolWireframe, ToolShading, ToolColor, ToolMaterial, ToolTransparency, ToolDelete
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ApplicationType
|
enum ApplicationType
|
||||||
{
|
{
|
||||||
Geometry,
|
AppType_Geometry,
|
||||||
Topology,
|
AppType_Topology,
|
||||||
Triangulation,
|
AppType_Triangulation,
|
||||||
DataExchange,
|
AppType_DataExchange,
|
||||||
Ocaf,
|
AppType_Ocaf,
|
||||||
Viewer2d,
|
AppType_Viewer2d,
|
||||||
Viewer3d,
|
AppType_Viewer3d,
|
||||||
Unknown
|
AppType_Unknown
|
||||||
};
|
};
|
||||||
|
|
||||||
const QMap<ApplicationType, QString> ALL_CATEGORIES =
|
|
||||||
{
|
|
||||||
{ ApplicationType::Geometry,"Geometry"},
|
|
||||||
{ ApplicationType::Topology, "Topology"},
|
|
||||||
{ ApplicationType::Triangulation, "Triangulation"},
|
|
||||||
{ ApplicationType::DataExchange, "DataExchange"},
|
|
||||||
{ ApplicationType::Ocaf, "OCAF"},
|
|
||||||
{ ApplicationType::Viewer3d, "3D viewer"},
|
|
||||||
{ ApplicationType::Viewer2d, "2D Viewer"}
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Main application window
|
//! Main application window
|
||||||
class COMMONSAMPLE_EXPORT ApplicationCommonWindow: public QMainWindow
|
class COMMONSAMPLE_EXPORT ApplicationCommonWindow: public QMainWindow
|
||||||
@ -104,9 +91,7 @@ public slots:
|
|||||||
virtual void onChangeCategory(const QString& theCategory);
|
virtual void onChangeCategory(const QString& theCategory);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
template <typename PointerToMemberFunction>
|
QAction* CreateAction(const QString& theActionName,
|
||||||
QAction* CreateAction(PointerToMemberFunction theHandlerMethod,
|
|
||||||
const QString& theActionName,
|
|
||||||
const QString& theShortcut = "",
|
const QString& theShortcut = "",
|
||||||
const QString& theIconName = "");
|
const QString& theIconName = "");
|
||||||
|
|
||||||
@ -118,13 +103,13 @@ protected:
|
|||||||
QMenu* getFilePopup() { return myFilePopup; }
|
QMenu* getFilePopup() { return myFilePopup; }
|
||||||
QToolBar* getCasCadeBar() { return myCasCadeBar; }
|
QToolBar* getCasCadeBar() { return myCasCadeBar; }
|
||||||
|
|
||||||
QMenu* MenuFromJsonObject (const QJsonValue& theJsonValue,
|
void MenuFormXml (const QString& thePath,
|
||||||
const QString& theKey,
|
|
||||||
QWidget* theParent,
|
|
||||||
QSignalMapper* theMapper);
|
|
||||||
void MenuFormJson (const QString& thePath,
|
|
||||||
QSignalMapper* theMapper,
|
QSignalMapper* theMapper,
|
||||||
QList<QMenu*>& theMunusList);
|
QList<QMenu*>& theMunusList);
|
||||||
|
QMenu* MenuFromDomNode(QDomElement& theItemElement,
|
||||||
|
QWidget* theParent,
|
||||||
|
QSignalMapper* theMapper);
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onCloseAllWindows() { qApp->closeAllWindows(); }
|
void onCloseAllWindows() { qApp->closeAllWindows(); }
|
||||||
@ -147,6 +132,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
ApplicationType myAppType;
|
ApplicationType myAppType;
|
||||||
|
QMap<ApplicationType, QString> ALL_CATEGORIES;
|
||||||
|
|
||||||
Handle(GeometrySamples) myGeometrySamples;
|
Handle(GeometrySamples) myGeometrySamples;
|
||||||
Handle(TopologySamples) myTopologySamples;
|
Handle(TopologySamples) myTopologySamples;
|
||||||
@ -158,7 +144,6 @@ private:
|
|||||||
|
|
||||||
QMap<StdActions, QAction*> myStdActions;
|
QMap<StdActions, QAction*> myStdActions;
|
||||||
QMap<ApplicationType, QAction*> myCategoryActions;
|
QMap<ApplicationType, QAction*> myCategoryActions;
|
||||||
QMap<ToolActions, QAction*> myToolActions;
|
|
||||||
QMap<Graphic3d_NameOfMaterial, QAction*> myMaterialActions;
|
QMap<Graphic3d_NameOfMaterial, QAction*> myMaterialActions;
|
||||||
|
|
||||||
QToolBar* myStdToolBar;
|
QToolBar* myStdToolBar;
|
||||||
@ -167,7 +152,6 @@ private:
|
|||||||
QMenu* myFilePopup;
|
QMenu* myFilePopup;
|
||||||
QMenu* myCategoryPopup;
|
QMenu* myCategoryPopup;
|
||||||
|
|
||||||
// QList<QMenu*> mySamplePopups;
|
|
||||||
QList<QMenu*> myGeometryMenus;
|
QList<QMenu*> myGeometryMenus;
|
||||||
QList<QMenu*> myTopologyMenus;
|
QList<QMenu*> myTopologyMenus;
|
||||||
QList<QMenu*> myTriangulationMenus;
|
QList<QMenu*> myTriangulationMenus;
|
||||||
|
@ -87,8 +87,11 @@ void DocumentCommon::SetObjects (const NCollection_Vector<Handle(AIS_Interactive
|
|||||||
{
|
{
|
||||||
myContext->RemoveAll(Standard_False);
|
myContext->RemoveAll(Standard_False);
|
||||||
myContextIsEmpty = theObjects.IsEmpty();
|
myContextIsEmpty = theObjects.IsEmpty();
|
||||||
for (const Handle(AIS_InteractiveObject) anObject : theObjects)
|
|
||||||
|
for(NCollection_Vector<Handle(AIS_InteractiveObject)>::Iterator anIter(theObjects);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anObject = anIter.Value();
|
||||||
if (!theDisplayShaded)
|
if (!theDisplayShaded)
|
||||||
{
|
{
|
||||||
myContext->Display(anObject, Standard_False);
|
myContext->Display(anObject, Standard_False);
|
||||||
|
@ -44,7 +44,7 @@ GeomWidget::GeomWidget (DocumentCommon* theDocument3d,
|
|||||||
QVBoxLayout* a2dLayout = new QVBoxLayout(my2dVidget);
|
QVBoxLayout* a2dLayout = new QVBoxLayout(my2dVidget);
|
||||||
a2dLayout->setContentsMargins(0, 0, 0, 0);
|
a2dLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
a2dLayout->setSpacing(0);
|
a2dLayout->setSpacing(0);
|
||||||
myView2d = new View(myDocument2d->getContext(), false, this);
|
myView2d = new View(myDocument2d->getContext(), false, my2dVidget);
|
||||||
QToolBar* aToolBar2d = new QToolBar;
|
QToolBar* aToolBar2d = new QToolBar;
|
||||||
aToolBar2d->addActions(myView2d->getViewActions());
|
aToolBar2d->addActions(myView2d->getViewActions());
|
||||||
a2dLayout->addWidget(aToolBar2d);
|
a2dLayout->addWidget(aToolBar2d);
|
||||||
@ -54,7 +54,7 @@ GeomWidget::GeomWidget (DocumentCommon* theDocument3d,
|
|||||||
QVBoxLayout* a3dLayout = new QVBoxLayout(my3dVidget);
|
QVBoxLayout* a3dLayout = new QVBoxLayout(my3dVidget);
|
||||||
a3dLayout->setContentsMargins(0, 0, 0, 0);
|
a3dLayout->setContentsMargins(0, 0, 0, 0);
|
||||||
a3dLayout->setSpacing(0);
|
a3dLayout->setSpacing(0);
|
||||||
myView3d = new View(myDocument3d->getContext(), true, this);
|
myView3d = new View(myDocument3d->getContext(), true, my3dVidget);
|
||||||
QToolBar* aToolBar3d = new QToolBar;
|
QToolBar* aToolBar3d = new QToolBar;
|
||||||
aToolBar3d->addActions(myView3d->getViewActions());
|
aToolBar3d->addActions(myView3d->getViewActions());
|
||||||
aToolBar3d->addSeparator();
|
aToolBar3d->addSeparator();
|
||||||
@ -82,10 +82,10 @@ void GeomWidget::Show3d()
|
|||||||
{
|
{
|
||||||
myView3d->axo();
|
myView3d->axo();
|
||||||
myView3d->fitAll();
|
myView3d->fitAll();
|
||||||
QAction* aShadingAction = myView3d->getViewAction(ViewAction::Shading);
|
QAction* aShadingAction = myView3d->getViewAction(ViewAction_Shading);
|
||||||
aShadingAction->trigger();
|
aShadingAction->trigger();
|
||||||
aShadingAction->setChecked(true);
|
aShadingAction->setChecked(true);
|
||||||
QAction* aHlrOffAction = myView3d->getViewAction(ViewAction::HlrOff);
|
QAction* aHlrOffAction = myView3d->getViewAction(ViewAction_HlrOff);
|
||||||
aHlrOffAction->trigger();
|
aHlrOffAction->trigger();
|
||||||
aHlrOffAction->setChecked(true);
|
aHlrOffAction->setChecked(true);
|
||||||
myStackWidget->setCurrentWidget(my3dVidget);
|
myStackWidget->setCurrentWidget(my3dVidget);
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include <Standard_WarningsDisable.hxx>
|
#include <Standard_WarningsDisable.hxx>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCommandLineParser>
|
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
@ -34,10 +33,12 @@
|
|||||||
|
|
||||||
int main ( int argc, char* argv[] )
|
int main ( int argc, char* argv[] )
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE(OCCTOverview);
|
|
||||||
|
|
||||||
QApplication aQApp( argc, argv );
|
QApplication aQApp( argc, argv );
|
||||||
|
|
||||||
|
#include <Standard_WarningsDisable.hxx>
|
||||||
|
Q_INIT_RESOURCE(OCCTOverview);
|
||||||
|
#include <Standard_WarningsRestore.hxx>
|
||||||
|
|
||||||
QSettings settings("OCCTOverview.conf", QSettings::IniFormat);
|
QSettings settings("OCCTOverview.conf", QSettings::IniFormat);
|
||||||
settings.beginGroup("ApplicationSetting");
|
settings.beginGroup("ApplicationSetting");
|
||||||
ApplicationType aCategory = static_cast<ApplicationType>(settings.value("ApplicationType", "").toInt());
|
ApplicationType aCategory = static_cast<ApplicationType>(settings.value("ApplicationType", "").toInt());
|
||||||
|
@ -23,152 +23,121 @@
|
|||||||
|
|
||||||
#include <Standard_WarningsDisable.hxx>
|
#include <Standard_WarningsDisable.hxx>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
|
#include <QStringList>
|
||||||
#include <Standard_WarningsRestore.hxx>
|
#include <Standard_WarningsRestore.hxx>
|
||||||
|
|
||||||
static const QString anOcctPatterns[] =
|
|
||||||
{
|
|
||||||
QStringLiteral("gp_Pnt"), QStringLiteral("gp_XYZ"), QStringLiteral("gp_Vec"),
|
|
||||||
QStringLiteral("gp_Dir"), QStringLiteral("gp_Ax1"), QStringLiteral("gp_Ax2"),
|
|
||||||
QStringLiteral("gp_Ax3"), QStringLiteral("gp_Lin"), QStringLiteral("gp_Circ"),
|
|
||||||
QStringLiteral("gp_Elips"), QStringLiteral("gp_Parab"), QStringLiteral("gp_Hypr"),
|
|
||||||
QStringLiteral("gp_Cylinder"), QStringLiteral("gp_Cone"), QStringLiteral("gp_Sphere"),
|
|
||||||
QStringLiteral("gp_Torus"), QStringLiteral("gp_Pnt2d"), QStringLiteral("gp_XY"),
|
|
||||||
QStringLiteral("gp_Ax2d"), QStringLiteral("gp_Ax22d"), QStringLiteral("gp_Lin2d"),
|
|
||||||
QStringLiteral("gp_Circ2d."), QStringLiteral("gp_Elips2d"), QStringLiteral("gp_Parab2d"),
|
|
||||||
QStringLiteral("gp_Hypr2d"), QStringLiteral("Geom2d_BSplineCurve"), QStringLiteral("Geom2d_BezierCurve"),
|
|
||||||
QStringLiteral("Geom2d_OffsetCurve"), QStringLiteral("ProjLib"), QStringLiteral("ElSLib"),
|
|
||||||
QStringLiteral("Extrema_ExtElCS"), QStringLiteral("Extrema_POnCurv"), QStringLiteral("IntAna_Quadric"),
|
|
||||||
QStringLiteral("IntAna_IntConicQuad"), QStringLiteral("GccAna_Lin2d2Tan"), QStringLiteral("GccEnt_QualifiedCirc"),
|
|
||||||
QStringLiteral("Geom2dAPI_ProjectPointOnCurve"), QStringLiteral("Geom2dAPI_ExtremaCurveCurve"),
|
|
||||||
QStringLiteral("Geom2dAPI_InterCurveCurve"), QStringLiteral("Geom2dAPI_PointsToBSpline"),
|
|
||||||
QStringLiteral("Geom_CartesianPoint"), QStringLiteral("Geom_VectorWithMagnitude"), QStringLiteral("Geom_Axis1Placement"),
|
|
||||||
QStringLiteral("Geom_Axis2Placement"), QStringLiteral("Geom_Line"), QStringLiteral("Geom_Circle"),
|
|
||||||
QStringLiteral("Geom_Ellipse"), QStringLiteral("Geom_Parabola"), QStringLiteral("Geom_Hyperbola"),
|
|
||||||
QStringLiteral("Geom_BSplineCurve"), QStringLiteral("Geom_BezierCurve"), QStringLiteral("Geom_TrimmedCurve"),
|
|
||||||
QStringLiteral("Geom_OffsetCurve"), QStringLiteral("Geom_BSplineSurface"), QStringLiteral("Geom_BezierSurface"),
|
|
||||||
QStringLiteral("Geom_Plane"), QStringLiteral("Geom_CylindricalSurface"), QStringLiteral("Geom_ConicalSurface"),
|
|
||||||
QStringLiteral("Geom_SphericalSurface"), QStringLiteral("Geom_ToroidalSurface"), QStringLiteral("Geom_RectangularTrimmedSurface"),
|
|
||||||
QStringLiteral("Geom_OffsetSurface"), QStringLiteral("Geom_SurfaceOfLinearExtrusion"), QStringLiteral("Geom_SurfaceOfRevolution"),
|
|
||||||
QStringLiteral("BndLib_Add3dCurve"), QStringLiteral("BndLib_AddSurface"), QStringLiteral("GeomAdaptor_Curve"),
|
|
||||||
QStringLiteral("GeomAdaptor_Surface"), QStringLiteral("GeomAPI_PointsToBSpline"), QStringLiteral("GeomAPI_PointsToBSplineSurface"),
|
|
||||||
QStringLiteral("GeomConvert"), QStringLiteral("Geom2d_CartesianPoint"), QStringLiteral("Geom2d_VectorWithMagnitude"),
|
|
||||||
QStringLiteral("Geom2d_Line"), QStringLiteral("Geom2d_Circle"), QStringLiteral("Geom2d_Ellipse"),
|
|
||||||
QStringLiteral("Geom2d_Parabola"), QStringLiteral("Geom2d_Hyperbola"), QStringLiteral("Geom2d_TrimmedCurve"),
|
|
||||||
QStringLiteral("Geom2dAdaptor_Curve"), QStringLiteral("Bnd_Box2d"), QStringLiteral("BndLib_Add2dCurve"),
|
|
||||||
QStringLiteral("Adaptor2d_Curve2d"), QStringLiteral("BRepBuilderAPI_MakeEdge"), QStringLiteral("BRepBuilderAPI_MakeFace"),
|
|
||||||
QStringLiteral("BRepPrimAPI_MakeBox"), QStringLiteral("AIS_Point"), QStringLiteral("AIS_TextLabel"), QStringLiteral("AIS_Axis"),
|
|
||||||
QStringLiteral("AIS_Circle"), QStringLiteral("AIS_Plane"), QStringLiteral("AIS_Shape"), QStringLiteral("AIS_ColoredShape"),
|
|
||||||
QStringLiteral("GProp_PEquation"), QStringLiteral("Extrema_ExtCS"), QStringLiteral("GCPnts_QuasiUniformDeflection"),
|
|
||||||
QStringLiteral("GProp_GProps"), QStringLiteral("GProp_PrincipalProps"), QStringLiteral("TopoDS"),
|
|
||||||
QStringLiteral("TopoDS_Iterator"), QStringLiteral("TopoDS_Compound"), QStringLiteral("TopoDS_Edge"), QStringLiteral("TopoDS_Face"),
|
|
||||||
QStringLiteral("TopoDS_Shell"), QStringLiteral("TopoDS_Solid"), QStringLiteral("TopoDS_Vertex"),
|
|
||||||
QStringLiteral("TopoDS_Wire"), QStringLiteral("TopExp"), QStringLiteral("TopExp_Explorer"),
|
|
||||||
QStringLiteral("TColgp_Array2OfPnt"), QStringLiteral("BRep_Builder"), QStringLiteral("BRepGProp"), QStringLiteral("BRep_Tool"),
|
|
||||||
QStringLiteral("BRepTools"), QStringLiteral("BRepTools_ReShape"), QStringLiteral("BRepAdaptor_Curve"),
|
|
||||||
QStringLiteral("BRepAdaptor_CompCurve"), QStringLiteral("BRepAdaptor_Surface"), QStringLiteral("BRepAlgoAPI_Common"),
|
|
||||||
QStringLiteral("BRepAlgoAPI_Cut"), QStringLiteral("BRepAlgoAPI_Fuse"), QStringLiteral("BRepAlgoAPI_Section"),
|
|
||||||
QStringLiteral("BRepAlgoAPI_Splitter"), QStringLiteral("BRepAlgoAPI_Defeaturing"), QStringLiteral("BRepBuilderAPI_Copy"),
|
|
||||||
QStringLiteral("BRepBuilderAPI_MakeVertex"), QStringLiteral("BRepBuilderAPI_MakeEdge"), QStringLiteral("BRepBuilderAPI_MakeFace"),
|
|
||||||
QStringLiteral("BRepBuilderAPI_MakePolygon"), QStringLiteral("BRepBuilderAPI_MakeShell"), QStringLiteral("BRepBuilderAPI_MakeSolid"),
|
|
||||||
QStringLiteral("BRepBuilderAPI_MakeWire"), QStringLiteral("BRepBuilderAPI_NurbsConvert"), QStringLiteral("BRepBuilderAPI_Sewing"),
|
|
||||||
QStringLiteral("BRepBuilderAPI_Transform"), QStringLiteral("BRepCheck_Analyzer"), QStringLiteral("BRepPrimAPI_MakeBox"),
|
|
||||||
QStringLiteral("BRepPrimAPI_MakeCylinder"), QStringLiteral("BRepPrimAPI_MakeRevol"), QStringLiteral("BRepFilletAPI_MakeChamfer"),
|
|
||||||
QStringLiteral("BRepFilletAPI_MakeFillet"), QStringLiteral("BRepOffsetAPI_MakeOffset"), QStringLiteral("BRepOffsetAPI_MakeEvolved.hxx"),
|
|
||||||
QStringLiteral("Standard_Integer"), QStringLiteral("Standard_Real"), QStringLiteral("Standard_Boolean"), QStringLiteral("Standard_ShortReal"),
|
|
||||||
QStringLiteral("Standard_Character"), QStringLiteral("Standard_Byte"), QStringLiteral("Standard_Address"), QStringLiteral("Standard_Size"),
|
|
||||||
QStringLiteral("Standard_Time"), QStringLiteral("Standard_Utf8Char"), QStringLiteral("Standard_Utf8UChar"),
|
|
||||||
QStringLiteral("Standard_ExtCharacter"), QStringLiteral("Standard_Utf16Char"), QStringLiteral("Standard_Utf32Char"),
|
|
||||||
QStringLiteral("Standard_WideChar"), QStringLiteral("Standard_CString"), QStringLiteral("Standard_ExtString"),
|
|
||||||
QStringLiteral("NCollection_Vector"), QStringLiteral("TCollection_AsciiString"), QStringLiteral("TCollection_BaseSequence"),
|
|
||||||
QStringLiteral("TCollection_BasicMap"), QStringLiteral("TCollection_BasicMapIterator"), QStringLiteral("TCollection_ExtendedString"),
|
|
||||||
QStringLiteral("TCollection_HAsciiString"), QStringLiteral("TCollection_HExtendedString"), QStringLiteral("TCollection_MapNode"),
|
|
||||||
QStringLiteral("TCollection_MapNodePtr"), QStringLiteral("TCollection_SeqNode"), QStringLiteral("TCollection_SeqNodePtr"),
|
|
||||||
QStringLiteral("TCollection_Side"), QStringLiteral("Standard_False"), QStringLiteral("Standard_True"),
|
|
||||||
QStringLiteral("TCollection"), QStringLiteral("NCollection"), QStringLiteral("gp_Trsf"), QStringLiteral("Handle"),
|
|
||||||
QStringLiteral("Aspect_TOL_DASH"), QStringLiteral("Aspect_TOM_O_STAR"), QStringLiteral("Aspect_TOL_SOLID"),
|
|
||||||
QStringLiteral("Aspect_TOM_O_STAR"), QStringLiteral("AIS_InteractiveObject"), QStringLiteral("AIS_ListOfInteractive"),
|
|
||||||
QStringLiteral("Aspect_GDM_Lines"), QStringLiteral("Aspect_GDM_Points"), QStringLiteral("Aspect_TOM_POINT"),
|
|
||||||
QStringLiteral("Aspect_TOM_RING1"), QStringLiteral("Aspect_TOM_O"),QStringLiteral("BinDrivers"),
|
|
||||||
QStringLiteral("DefineFormat"), QStringLiteral("Font_FA_Bold"), QStringLiteral("Font_FA_BoldItalic"),
|
|
||||||
QStringLiteral("Font_FA_Italic"), QStringLiteral("Font_FA_Regular"), QStringLiteral("DownCast"),
|
|
||||||
QStringLiteral("gp_Pln"), QStringLiteral("Graphic3d_AspectMarker3d"), QStringLiteral("Graphic3d_HTA_LEFT"),
|
|
||||||
QStringLiteral("Graphic3d_NameOfMaterial"), QStringLiteral("Graphic3d_NOM_BRONZE"), QStringLiteral("Graphic3d_NOM_PLASTIC"),
|
|
||||||
QStringLiteral("Graphic3d_VTA_BOTTOM"), QStringLiteral("OpenGl_GraphicDriver"), QStringLiteral("PCDM_RS_OK"),
|
|
||||||
QStringLiteral("PCDM_SS_OK"), QStringLiteral("PCDM_ReaderStatus"), QStringLiteral("PCDM_StoreStatus"),
|
|
||||||
QStringLiteral("Prs3d_Drawer"), QStringLiteral("TPrsStd_AISPresentation"), QStringLiteral("Quantity_Color"),
|
|
||||||
QStringLiteral("Quantity_NameOfColor"), QStringLiteral("Quantity_NOC_BLUE1"), QStringLiteral("Quantity_NOC_CADETBLUE"),
|
|
||||||
QStringLiteral("Quantity_NOC_GREEN"), QStringLiteral("Quantity_NOC_MAGENTA1"), QStringLiteral("Quantity_NOC_RED"),
|
|
||||||
QStringLiteral("Quantity_NOC_YELLOW"), QStringLiteral("Quantity_NOC_WHITE"), QStringLiteral("Quantity_NOC_MATRABLUE"),
|
|
||||||
QStringLiteral("Quantity_TOC_RGB"), QStringLiteral("Quantity_TOC_HLS"), QStringLiteral("Standard_GUID"),
|
|
||||||
QStringLiteral("TColStd_ListIteratorOfListOfTransient"), QStringLiteral("TColStd_ListOfTransient"), QStringLiteral("TDataStd_Integer"),
|
|
||||||
QStringLiteral("TDataStd_Name"), QStringLiteral("TDataStd_Real"), QStringLiteral("TFunction_Driver"),
|
|
||||||
QStringLiteral("TFunction_DriverTable"), QStringLiteral("TFunction_Function"), QStringLiteral("TFunction_Logbook"),
|
|
||||||
QStringLiteral("TDF_Label"), QStringLiteral("TDF_TagSource"), QStringLiteral("TNaming_NamedShape"),
|
|
||||||
QStringLiteral("TopAbs_EDGE"), QStringLiteral("TopAbs_FACE"), QStringLiteral("TopAbs_VERTEX"),
|
|
||||||
QStringLiteral("TPrsStd_AISPresentation"), QStringLiteral("TPrsStd_AISViewer"), QStringLiteral("V3d_AmbientLight"),
|
|
||||||
QStringLiteral("V3d_DirectionalLight"), QStringLiteral("V3d_PositionalLight"), QStringLiteral("V3d_SpotLight"),
|
|
||||||
QStringLiteral("XmlDrivers")
|
|
||||||
};
|
|
||||||
|
|
||||||
static const QString aHelperPatterns[] =
|
|
||||||
{
|
|
||||||
QStringLiteral("AdaptorCurve_AIS"), QStringLiteral("AdaptorVec_AIS"), QStringLiteral("AdaptorCurve2d_AIS"),
|
|
||||||
QStringLiteral("AdaptorPnt2d_AIS"), QStringLiteral("Sample2D_Image"), QStringLiteral("Sample2D_Markers"),
|
|
||||||
QStringLiteral("Sample2D_Face"), QStringLiteral("TOcafFunction_BoxDriver"), QStringLiteral("TOcafFunction_CylDriver"),
|
|
||||||
QStringLiteral("DisplayPresentation")
|
|
||||||
};
|
|
||||||
|
|
||||||
static const QString aKeywordPatterns[] =
|
|
||||||
{
|
|
||||||
QStringLiteral("\\balignas\\b"), QStringLiteral("\\balignof\\b"), QStringLiteral("\\band\\b"),
|
|
||||||
QStringLiteral("\\band_eq\\b"), QStringLiteral("\\basm\\b"), QStringLiteral("\\bauto\\b"),
|
|
||||||
QStringLiteral("\\bbitand\\b"), QStringLiteral("\\bbitor\\b"), QStringLiteral("\\bbool\\b"),
|
|
||||||
QStringLiteral("\\bbreak\\b"), QStringLiteral("\\bcase\\b"), QStringLiteral("\\bcatch\\b"),
|
|
||||||
QStringLiteral("\\bchar\\b"), QStringLiteral("\\bchar16_t\\b"), QStringLiteral("\\bchar32_t\\b"),
|
|
||||||
QStringLiteral("\\bclass\\b"), QStringLiteral("\\bcompl\\b"), QStringLiteral("\\bconst\\b"),
|
|
||||||
QStringLiteral("\\bconstexpr\\b"), QStringLiteral("\\bconst_cast\\b"), QStringLiteral("\\bcontinue\\b"),
|
|
||||||
QStringLiteral("\\bdecltype\\b"), QStringLiteral("\\bdefault\\b"), QStringLiteral("\\bdelete\\b"),
|
|
||||||
QStringLiteral("\\bdo\\b"), QStringLiteral("\\bdouble\\b"), QStringLiteral("\\bdynamic_cast\\b"),
|
|
||||||
QStringLiteral("\\belse\\b"), QStringLiteral("\\benum\\b"), QStringLiteral("\\bexplicit\\b"),
|
|
||||||
QStringLiteral("\\bexport\\b"), QStringLiteral("\\bextern\\b"), QStringLiteral("\\bfalse\\b"),
|
|
||||||
QStringLiteral("\\bfloat\\b"), QStringLiteral("\\bfor\\b"), QStringLiteral("\\bfriend\\b"),
|
|
||||||
QStringLiteral("\\bgoto\\b"), QStringLiteral("\\bif\\b"), QStringLiteral("\\binline\\b"),
|
|
||||||
QStringLiteral("\\bint\\b"), QStringLiteral("\\blong\\b"), QStringLiteral("\\bmutable\\b"),
|
|
||||||
QStringLiteral("\\bnamespace\\b"), QStringLiteral("\\bnew\\b"), QStringLiteral("\\bnoexcept\\b"),
|
|
||||||
QStringLiteral("\\bnot\\b"), QStringLiteral("\\bnot_eq\\b"), QStringLiteral("\\bnullptr\\b"),
|
|
||||||
QStringLiteral("\\boperator\\b"), QStringLiteral("\\bor\\b"), QStringLiteral("\\bor_eq\\b"),
|
|
||||||
QStringLiteral("\\bprivate\\b"), QStringLiteral("\\bprotected\\b"), QStringLiteral("\\bpublic\\b"),
|
|
||||||
QStringLiteral("\\bregister\\b"), QStringLiteral("\\breinterpret_cast\\b"), QStringLiteral("\\breturn\\b"),
|
|
||||||
QStringLiteral("\\bshort\\b"), QStringLiteral("\\bsigned\\b"), QStringLiteral("\\bsizeof\\b"),
|
|
||||||
QStringLiteral("\\bstatic\\b"), QStringLiteral("\\bstatic_assert\\b"), QStringLiteral("\\bstatic_cast\\b"),
|
|
||||||
QStringLiteral("\\bstruct\\b"),QStringLiteral("\\bswitch\\b"), QStringLiteral("\\btemplate\\b"),
|
|
||||||
QStringLiteral("\\bthis\\b"), QStringLiteral("\\bthread_local\\b"), QStringLiteral("\\bthrow\\b"),
|
|
||||||
QStringLiteral("\\btrue\\b"), QStringLiteral("\\btry\\b"), QStringLiteral("\\btypedef\\b"),
|
|
||||||
QStringLiteral("\\btypeid\\b"), QStringLiteral("\\btypename\\b"),QStringLiteral("\\bunion\\b"),
|
|
||||||
QStringLiteral("\\bunsigned\\b"), QStringLiteral("\\busing\\b"), QStringLiteral("\\bvirtual\\b"),
|
|
||||||
QStringLiteral("\\bvoid\\b"), QStringLiteral("\\bvolatile\\b"), QStringLiteral("\\bwchar_t\\b"),
|
|
||||||
QStringLiteral("\\bwhile\\b"), QStringLiteral("\\bxor\\b"), QStringLiteral("\\bxor_eq\\b"),
|
|
||||||
QStringLiteral("\\boverride\\b"), QStringLiteral("\\bfinal\\b")
|
|
||||||
};
|
|
||||||
|
|
||||||
OcctHighlighter::OcctHighlighter(QTextDocument* theParent)
|
OcctHighlighter::OcctHighlighter(QTextDocument* theParent)
|
||||||
: QSyntaxHighlighter (theParent)
|
: QSyntaxHighlighter (theParent)
|
||||||
{
|
{
|
||||||
|
QStringList aKeywordPatterns;
|
||||||
|
aKeywordPatterns
|
||||||
|
<< "\\balignas\\b" << "\\balignof\\b" << "\\band\\b" << "\\band_eq\\b" << "\\basm\\b"
|
||||||
|
<< "\\bauto\\b" << "\\bbitand\\b" << "\\bbitor\\b" << "\\bbool\\b" << "\\bbreak\\b"
|
||||||
|
<< "\\bcase\\b" << "\\bcatch\\b" << "\\bchar\\b" << "\\bchar16_t\\b" << "\\bchar32_t\\b"
|
||||||
|
<< "\\bclass\\b" << "\\bcompl\\b" << "\\bconst\\b" << "\\bconstexpr\\b" << "\\bconst_cast\\b"
|
||||||
|
<< "\\bcontinue\\b" << "\\bdecltype\\b" << "\\bdefault\\b" << "\\bdelete\\b" << "\\bdo\\b"
|
||||||
|
<< "\\bdouble\\b" << "\\bdynamic_cast\\b" << "\\belse\\b" << "\\benum\\b" << "\\bexplicit\\b"
|
||||||
|
<< "\\bexport\\b" << "\\bextern\\b" << "\\bfalse\\b" << "\\bfloat\\b" << "\\bfor\\b"
|
||||||
|
<< "\\bfriend\\b" << "\\bgoto\\b" << "\\bif\\b" << "\\binline\\b" << "\\bint\\b" << "\\blong\\b"
|
||||||
|
<< "\\bmutable\\b" << "\\bnamespace\\b" << "\\bnew\\b" << "\\bnoexcept\\b" << "\\bnot\\b"
|
||||||
|
<< "\\bnot_eq\\b" << "\\bnullptr\\b" << "\\boperator\\b" << "\\bor\\b" << "\\bor_eq\\b"
|
||||||
|
<< "\\bprivate\\b" << "\\bprotected\\b" << "\\bpublic\\b" << "\\bregister\\b"
|
||||||
|
<< "\\breinterpret_cast\\b" << "\\breturn\\b" << "\\bshort\\b" << "\\bsigned\\b" << "\\bsizeof\\b"
|
||||||
|
<< "\\bstatic\\b" << "\\bstatic_assert\\b" << "\\bstatic_cast\\b" << "\\bstruct\\b"
|
||||||
|
<< "\\bswitch\\b" << "\\btemplate\\b" << "\\bthis\\b" << "\\bthread_local\\b" << "\\bthrow\\b"
|
||||||
|
<< "\\btrue\\b" << "\\btry\\b" << "\\btypedef\\b" << "\\btypeid\\b" << "\\btypename\\b"
|
||||||
|
<< "\\bunion\\b" << "\\bunsigned\\b" << "\\busing\\b" << "\\bvirtual\\b" << "\\bvoid\\b"
|
||||||
|
<< "\\bvolatile\\b" << "\\bwchar_t\\b" << "\\bwhile\\b" << "\\bxor\\b" << "\\bxor_eq\\b"
|
||||||
|
<< "\\boverride\\b" << "\\bfinal\\b";
|
||||||
|
|
||||||
|
QStringList anOcctPatterns;
|
||||||
|
anOcctPatterns
|
||||||
|
<< "gp_Pnt" << "gp_XYZ" << "gp_Vec" << "gp_Dir" << "gp_Ax1" << "gp_Ax2" << "gp_Ax3" << "gp_Lin"
|
||||||
|
<< "gp_Circ" << "gp_Elips" << "gp_Parab" << "gp_Hypr" << "gp_Cylinder" << "gp_Cone" << "gp_Sphere"
|
||||||
|
<< "gp_Torus" << "gp_Pnt2d" << "gp_XY" << "gp_Ax2d" << "gp_Ax22d" << "gp_Lin2d" << "gp_Circ2d"
|
||||||
|
<< "gp_Elips2d" << "gp_Parab2d" << "gp_Hypr2d" << "Geom2d_BSplineCurve" << "Geom2d_BezierCurve"
|
||||||
|
<< "Geom2d_OffsetCurve" << "ProjLib" << "ElSLib" << "IntAna_IntConicQuad" << "GccAna_Lin2d2Tan"
|
||||||
|
<< "GccEnt_QualifiedCirc" << "Geom2dAPI_ProjectPointOnCurve" << "Geom2dAPI_ExtremaCurveCurve"
|
||||||
|
<< "Geom2dAPI_InterCurveCurve" << "Geom2dAPI_PointsToBSpline" << "Geom_CartesianPoint"
|
||||||
|
<< "Geom_VectorWithMagnitude" << "Geom_Axis1Placement" << "Geom_Axis2Placement" << "Geom_Line"
|
||||||
|
<< "Geom_Circle" << "Geom_Ellipse" << "Geom_Parabola" << "Geom_Hyperbola" << "Geom_BSplineCurve"
|
||||||
|
<< "Geom_BezierCurve" << "Geom_TrimmedCurve" << "Geom_OffsetCurve" << "Geom_BSplineSurface"
|
||||||
|
<< "Geom_BezierSurface" << "Geom_Plane" << "Geom_CylindricalSurface" << "Geom_ConicalSurface"
|
||||||
|
<< "Geom_SphericalSurface" << "Geom_ToroidalSurface" << "Geom_RectangularTrimmedSurface"
|
||||||
|
<< "Geom_OffsetSurface" << "Geom_SurfaceOfLinearExtrusion" << "Geom_SurfaceOfRevolution"
|
||||||
|
<< "BndLib_Add3dCurve" << "BndLib_AddSurface" << "GeomAdaptor_Curve" << "GeomAdaptor_Surface"
|
||||||
|
<< "GeomAPI_PointsToBSpline" << "GeomAPI_PointsToBSplineSurface" << "GeomConvert"
|
||||||
|
<< "Geom2d_CartesianPoint" << "Geom2d_VectorWithMagnitude" << "Geom2d_Line" << "Geom2d_Circle"
|
||||||
|
<< "Geom2d_Ellipse" << "Geom2d_Parabola" << "Geom2d_Hyperbola" << "Geom2d_TrimmedCurve"
|
||||||
|
<< "Geom2dAdaptor_Curve" << "Bnd_Box2d" << "BndLib_Add2dCurve" << "Adaptor2d_Curve2d"
|
||||||
|
<< "BRepBuilderAPI_MakeEdge" << "BRepBuilderAPI_MakeFace" << "BRepPrimAPI_MakeBox" << "AIS_Point"
|
||||||
|
<< "AIS_TextLabel" << "AIS_Axis" << "AIS_Circle" << "AIS_Plane" << "AIS_Shape"
|
||||||
|
<< "AIS_ColoredShape" << "GProp_PEquation" << "Extrema_ExtCS" << "GCPnts_QuasiUniformDeflection"
|
||||||
|
<< "GProp_GProps" << "GProp_PrincipalProps" << "TopoDS" << "TopoDS_Iterator" << "TopoDS_Compound"
|
||||||
|
<< "TopoDS_Edge" << "TopoDS_Face" << "TopoDS_Shell" << "TopoDS_Solid" << "TopoDS_Vertex"
|
||||||
|
<< "TopoDS_Wire" << "TopExp" << "TopExp_Explorer" << "TColgp_Array2OfPnt" << "BRep_Builder"
|
||||||
|
<< "BRepGProp" << "BRep_Tool" << "BRepTools" << "BRepTools_ReShape" << "BRepAdaptor_Curve"
|
||||||
|
<< "BRepAdaptor_CompCurve" << "BRepAdaptor_Surface" << "BRepAlgoAPI_Common" << "BRepAlgoAPI_Cut"
|
||||||
|
<< "BRepAlgoAPI_Fuse" << "BRepAlgoAPI_Section" << "BRepAlgoAPI_Splitter" << "BRepAlgoAPI_Defeaturing"
|
||||||
|
<< "BRepBuilderAPI_Copy" << "BRepBuilderAPI_MakeVertex" << "BRepBuilderAPI_MakeEdge"
|
||||||
|
<< "BRepBuilderAPI_MakeFace" << "BRepBuilderAPI_MakePolygon" << "BRepBuilderAPI_MakeShell"
|
||||||
|
<< "BRepBuilderAPI_MakeSolid" << "BRepBuilderAPI_MakeWire" << "BRepBuilderAPI_NurbsConvert"
|
||||||
|
<< "BRepBuilderAPI_Sewing" << "BRepBuilderAPI_Transform" << "BRepCheck_Analyzer"
|
||||||
|
<< "BRepPrimAPI_MakeBox" << "BRepPrimAPI_MakeCylinder" << "BRepPrimAPI_MakeRevol"
|
||||||
|
<< "BRepFilletAPI_MakeChamfer" << "BRepFilletAPI_MakeFillet" << "BRepOffsetAPI_MakeOffset"
|
||||||
|
<< "BRepOffsetAPI_MakeEvolved.hxx" << "Standard_Integer" << "Standard_Real" << "Standard_Boolean"
|
||||||
|
<< "Standard_ShortReal" << "Standard_Character" << "Standard_Byte" << "Standard_Address"
|
||||||
|
<< "Standard_Size" << "Standard_Time" << "Standard_Utf8Char" << "Standard_Utf8UChar"
|
||||||
|
<< "Standard_ExtCharacter" << "Standard_Utf16Char" << "Standard_Utf32Char" << "Standard_WideChar"
|
||||||
|
<< "Standard_CString" << "Standard_ExtString" << "NCollection_Vector" << "TCollection_AsciiString"
|
||||||
|
<< "TCollection_BaseSequence"<< "TCollection_BasicMap" << "TCollection_BasicMapIterator"
|
||||||
|
<< "TCollection_ExtendedString" << "TCollection_HAsciiString" << "TCollection_HExtendedString"
|
||||||
|
<< "TCollection_MapNode" << "TCollection_MapNodePtr" << "TCollection_SeqNode"
|
||||||
|
<< "TCollection_SeqNodePtr" << "TCollection_Side" << "Standard_False" << "Standard_True"
|
||||||
|
<< "TCollection" << "NCollection" << "gp_Trsf" << "Handle" << "Aspect_TOL_DASH"
|
||||||
|
<< "Aspect_TOM_O_STAR" << "Aspect_TOL_SOLID" << "Aspect_TOM_O_STAR" << "AIS_InteractiveObject"
|
||||||
|
<< "AIS_ListOfInteractive" << "Aspect_GDM_Lines" << "Aspect_GDM_Points" << "Aspect_TOM_POINT"
|
||||||
|
<< "Aspect_TOM_RING1" << "Aspect_TOM_O" << "BinDrivers" << "DefineFormat" << "Font_FA_Bold"
|
||||||
|
<< "Font_FA_BoldItalic" << "Font_FA_Italic" << "Font_FA_Regular" << "DownCast" << "gp_Pln"
|
||||||
|
<< "Graphic3d_AspectMarker3d" << "Graphic3d_HTA_LEFT" << "Graphic3d_NameOfMaterial"
|
||||||
|
<< "Graphic3d_NOM_BRONZE" << "Graphic3d_NOM_PLASTIC" << "Graphic3d_VTA_BOTTOM"
|
||||||
|
<< "OpenGl_GraphicDriver" << "PCDM_RS_OK" << "PCDM_SS_OK" << "PCDM_ReaderStatus"
|
||||||
|
<< "PCDM_StoreStatus" << "Prs3d_Drawer" << "TPrsStd_AISPresentation" << "Quantity_Color"
|
||||||
|
<< "Quantity_NameOfColor" << "Quantity_NOC_BLUE1" << "Quantity_NOC_CADETBLUE"
|
||||||
|
<< "Quantity_NOC_GREEN" << "Quantity_NOC_MAGENTA1" << "Quantity_NOC_RED" << "Quantity_NOC_YELLOW"
|
||||||
|
<< "Quantity_NOC_WHITE" << "Quantity_NOC_MATRABLUE" << "Quantity_TOC_RGB" << "Quantity_TOC_HLS"
|
||||||
|
<< "Standard_GUID" << "TColStd_ListIteratorOfListOfTransient" << "TColStd_ListOfTransient"
|
||||||
|
<< "TDataStd_Integer" << "TDataStd_Name" << "TDataStd_Real" << "TFunction_Driver"
|
||||||
|
<< "TFunction_DriverTable" << "TFunction_Function" << "TFunction_Logbook" << "TDF_Label"
|
||||||
|
<< "TDF_TagSource" << "TNaming_NamedShape" << "TopAbs_EDGE" << "TopAbs_FACE" << "TopAbs_VERTEX"
|
||||||
|
<< "TPrsStd_AISPresentation" << "TPrsStd_AISViewer" << "V3d_AmbientLight"
|
||||||
|
<< "V3d_DirectionalLight" << "V3d_PositionalLight" << "V3d_SpotLight" << "XmlDrivers";
|
||||||
|
|
||||||
|
QStringList aHelperPatterns;
|
||||||
|
aHelperPatterns
|
||||||
|
<< "AdaptorCurve_AIS" << "AdaptorVec_AIS" << "AdaptorCurve2d_AIS" << "AdaptorPnt2d_AIS"
|
||||||
|
<< "Sample2D_Image" << "Sample2D_Markers" << "Sample2D_Face" << "TOcafFunction_BoxDriver"
|
||||||
|
<< "TOcafFunction_CylDriver" << "DisplayPresentation";
|
||||||
|
|
||||||
HighlightingRule aRule;
|
HighlightingRule aRule;
|
||||||
|
|
||||||
myOcctFormat.setForeground(Qt::darkCyan);
|
myOcctFormat.setForeground(Qt::darkCyan);
|
||||||
|
|
||||||
for (const QString& aPattern : anOcctPatterns)
|
foreach (const QString& aPattern, anOcctPatterns)
|
||||||
{
|
{
|
||||||
aRule.myPattern = QRegularExpression(aPattern);
|
aRule.myPattern = QRegExp(aPattern);
|
||||||
aRule.myFormat = myOcctFormat;
|
aRule.myFormat = myOcctFormat;
|
||||||
myHighlightingRules.append(aRule);
|
myHighlightingRules.append(aRule);
|
||||||
}
|
}
|
||||||
|
|
||||||
myHelperFormat.setForeground(Qt::red);
|
myHelperFormat.setForeground(Qt::red);
|
||||||
for (const QString& aPattern : aHelperPatterns)
|
foreach (const QString& aPattern, aHelperPatterns)
|
||||||
{
|
{
|
||||||
aRule.myPattern = QRegularExpression(aPattern);
|
aRule.myPattern = QRegExp(aPattern);
|
||||||
aRule.myFormat = myHelperFormat;
|
aRule.myFormat = myHelperFormat;
|
||||||
myHighlightingRules.append(aRule);
|
myHighlightingRules.append(aRule);
|
||||||
}
|
}
|
||||||
@ -176,54 +145,56 @@ OcctHighlighter::OcctHighlighter(QTextDocument* theParent)
|
|||||||
|
|
||||||
myKeywordFormat.setForeground(Qt::darkBlue);
|
myKeywordFormat.setForeground(Qt::darkBlue);
|
||||||
myKeywordFormat.setFontWeight(QFont::Bold);
|
myKeywordFormat.setFontWeight(QFont::Bold);
|
||||||
for (const QString& aPattern : aKeywordPatterns)
|
foreach (const QString& aPattern, aKeywordPatterns)
|
||||||
{
|
{
|
||||||
aRule.myPattern = QRegularExpression(aPattern);
|
aRule.myPattern = QRegExp(aPattern);
|
||||||
aRule.myFormat = myKeywordFormat;
|
aRule.myFormat = myKeywordFormat;
|
||||||
myHighlightingRules.append(aRule);
|
myHighlightingRules.append(aRule);
|
||||||
}
|
}
|
||||||
|
|
||||||
myMemberFormat.setFontWeight(QFont::Bold);
|
myMemberFormat.setFontWeight(QFont::Bold);
|
||||||
aRule.myPattern = QRegularExpression(QStringLiteral("\\bmy[0-9A-Za-z]+\\b"));
|
aRule.myPattern = QRegExp(QLatin1String("\\bmy[0-9A-Za-z]+\\b"));
|
||||||
aRule.myFormat = myMemberFormat;
|
aRule.myFormat = myMemberFormat;
|
||||||
myHighlightingRules.append(aRule);
|
myHighlightingRules.append(aRule);
|
||||||
|
|
||||||
myLocalFormat.setForeground(Qt::darkMagenta);
|
myLocalFormat.setForeground(Qt::darkMagenta);
|
||||||
aRule.myPattern = QRegularExpression(QStringLiteral("\\ba[0-9A-Za-z]+\\b"));
|
aRule.myPattern = QRegExp(QLatin1String("\\ba[0-9A-Za-z]+\\b"));
|
||||||
aRule.myFormat = myLocalFormat;
|
aRule.myFormat = myLocalFormat;
|
||||||
myHighlightingRules.append(aRule);
|
myHighlightingRules.append(aRule);
|
||||||
|
|
||||||
myQuotationFormat.setForeground(Qt::darkRed);
|
myQuotationFormat.setForeground(Qt::darkRed);
|
||||||
aRule.myPattern = QRegularExpression(QStringLiteral("\".*\""));
|
aRule.myPattern = QRegExp(QLatin1String("\".*\""));
|
||||||
aRule.myFormat = myQuotationFormat;
|
aRule.myFormat = myQuotationFormat;
|
||||||
myHighlightingRules.append(aRule);
|
myHighlightingRules.append(aRule);
|
||||||
|
|
||||||
myFunctionFormat.setFontItalic(true);
|
myFunctionFormat.setFontItalic(true);
|
||||||
myFunctionFormat.setForeground(Qt::blue);
|
myFunctionFormat.setForeground(Qt::blue);
|
||||||
aRule.myPattern = QRegularExpression(QStringLiteral("\\b[A-Za-z0-9_]+(?=\\()"));
|
aRule.myPattern = QRegExp(QLatin1String("\\b[A-Za-z0-9_]+(?=\\()"));
|
||||||
aRule.myFormat = myFunctionFormat;
|
aRule.myFormat = myFunctionFormat;
|
||||||
myHighlightingRules.append(aRule);
|
myHighlightingRules.append(aRule);
|
||||||
|
|
||||||
mySingleLineCommentFormat.setForeground(Qt::darkGreen);
|
mySingleLineCommentFormat.setForeground(Qt::darkGreen);
|
||||||
aRule.myPattern = QRegularExpression(QStringLiteral("//[^\n]*"));
|
aRule.myPattern = QRegExp(QLatin1String("//[^\n]*"));
|
||||||
aRule.myFormat = mySingleLineCommentFormat;
|
aRule.myFormat = mySingleLineCommentFormat;
|
||||||
myHighlightingRules.append(aRule);
|
myHighlightingRules.append(aRule);
|
||||||
|
|
||||||
myMultiLineCommentFormat.setForeground(Qt::darkGreen);
|
myMultiLineCommentFormat.setForeground(Qt::darkGreen);
|
||||||
|
|
||||||
myCommentStartExpression = QRegularExpression(QStringLiteral("/\\*"));
|
myCommentStartExpression = QRegExp(QLatin1String("/\\*"));
|
||||||
myCommentEndExpression = QRegularExpression(QStringLiteral("\\*/"));
|
myCommentEndExpression = QRegExp(QLatin1String("\\*/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OcctHighlighter::highlightBlock (const QString& theText)
|
void OcctHighlighter::highlightBlock (const QString& theText)
|
||||||
{
|
{
|
||||||
for (const HighlightingRule& rule : qAsConst(myHighlightingRules))
|
foreach (const HighlightingRule &rule, myHighlightingRules)
|
||||||
{
|
{
|
||||||
QRegularExpressionMatchIterator matchIterator = rule.myPattern.globalMatch(theText);
|
QRegExp expression(rule.myPattern);
|
||||||
while (matchIterator.hasNext())
|
int index = expression.indexIn(theText);
|
||||||
|
while (index >= 0)
|
||||||
{
|
{
|
||||||
QRegularExpressionMatch match = matchIterator.next();
|
int length = expression.matchedLength();
|
||||||
setFormat(match.capturedStart(), match.capturedLength(), rule.myFormat);
|
setFormat(index, length, rule.myFormat);
|
||||||
|
index = expression.indexIn(theText, index + length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,9 +206,8 @@ void OcctHighlighter::highlightBlock (const QString& theText)
|
|||||||
|
|
||||||
while (startIndex >= 0)
|
while (startIndex >= 0)
|
||||||
{
|
{
|
||||||
QRegularExpressionMatch match = myCommentEndExpression.match(theText, startIndex);
|
int endIndex = myCommentEndExpression.indexIn(theText, startIndex);
|
||||||
int endIndex = match.capturedStart();
|
int commentLength;
|
||||||
int commentLength = 0;
|
|
||||||
if (endIndex == -1)
|
if (endIndex == -1)
|
||||||
{
|
{
|
||||||
setCurrentBlockState(1);
|
setCurrentBlockState(1);
|
||||||
@ -246,9 +216,9 @@ void OcctHighlighter::highlightBlock (const QString& theText)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
commentLength = endIndex - startIndex
|
commentLength = endIndex - startIndex
|
||||||
+ match.capturedLength();
|
+ myCommentEndExpression.matchedLength();
|
||||||
}
|
}
|
||||||
setFormat(startIndex, commentLength, myMultiLineCommentFormat);
|
setFormat(startIndex, commentLength, myMultiLineCommentFormat);
|
||||||
startIndex = theText.indexOf(myCommentStartExpression, startIndex + commentLength);
|
startIndex = myCommentEndExpression.indexIn(theText, startIndex + commentLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include <Standard_Macro.hxx>
|
#include <Standard_Macro.hxx>
|
||||||
|
|
||||||
#include <Standard_WarningsDisable.hxx>
|
#include <Standard_WarningsDisable.hxx>
|
||||||
#include <QRegularExpression>
|
#include <QRegExp>
|
||||||
#include <QSyntaxHighlighter>
|
#include <QSyntaxHighlighter>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
@ -51,15 +51,17 @@ protected:
|
|||||||
private:
|
private:
|
||||||
struct HighlightingRule
|
struct HighlightingRule
|
||||||
{
|
{
|
||||||
QRegularExpression myPattern;
|
QRegExp myPattern;
|
||||||
QTextCharFormat myFormat;
|
QTextCharFormat myFormat;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<HighlightingRule> myHighlightingRules;
|
QVector<HighlightingRule> myHighlightingRules;
|
||||||
|
// QRegExp (Qt4+) introduced by the patch as alternative to QRegularExpression
|
||||||
QRegularExpression myCommentStartExpression;
|
// (Qt5+) for compatibility reasons. QRegExp will be moved in future Qt6 to
|
||||||
QRegularExpression myCommentEndExpression;
|
// a qt5compat module: QRegExp -> Qt5::QRegExp
|
||||||
|
QRegExp myCommentStartExpression;
|
||||||
|
QRegExp myCommentEndExpression;
|
||||||
|
|
||||||
QTextCharFormat myKeywordFormat;
|
QTextCharFormat myKeywordFormat;
|
||||||
QTextCharFormat mySingleLineCommentFormat;
|
QTextCharFormat mySingleLineCommentFormat;
|
||||||
|
@ -135,10 +135,10 @@ Aspect_TypeOfResize OcctWindow::DoResize()
|
|||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
*((Standard_Integer*)&myXLeft) = myWidget->rect().left();
|
myXLeft = myWidget->rect().left();
|
||||||
*((Standard_Integer*)&myXRight) = myWidget->rect().right();
|
myXRight = myWidget->rect().right();
|
||||||
*((Standard_Integer*)&myYTop) = myWidget->rect().top();
|
myYTop = myWidget->rect().top();
|
||||||
*((Standard_Integer*)&myYBottom) = myWidget->rect().bottom();
|
myYBottom = myWidget->rect().bottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
return aMode;
|
return aMode;
|
||||||
|
@ -118,7 +118,7 @@ View::View (const Handle(AIS_InteractiveContext)& theContext, bool theIs3dView,
|
|||||||
setAttribute(Qt::WA_NoSystemBackground);
|
setAttribute(Qt::WA_NoSystemBackground);
|
||||||
|
|
||||||
myDefaultGestures = myMouseGestureMap;
|
myDefaultGestures = myMouseGestureMap;
|
||||||
myCurrentMode = CurrentAction3d::Nothing;
|
myCurrentMode = CurrentAction3d_Nothing;
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
|
||||||
initViewActions();
|
initViewActions();
|
||||||
@ -148,10 +148,12 @@ void View::init()
|
|||||||
|
|
||||||
if (myIs3dView)
|
if (myIs3dView)
|
||||||
{
|
{
|
||||||
|
SetAllowRotation(Standard_True);
|
||||||
myV3dView->SetBackgroundColor(Quantity_Color(0.0, 0.0, 0.3, Quantity_TOC_RGB));
|
myV3dView->SetBackgroundColor(Quantity_Color(0.0, 0.0, 0.3, Quantity_TOC_RGB));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
SetAllowRotation(Standard_False);
|
||||||
myV3dView->SetBackgroundColor(Quantity_Color(0.0, 0.2, 0.0, Quantity_TOC_RGB));
|
myV3dView->SetBackgroundColor(Quantity_Color(0.0, 0.2, 0.0, Quantity_TOC_RGB));
|
||||||
myV3dView->SetProj(V3d_Zpos);
|
myV3dView->SetProj(V3d_Zpos);
|
||||||
}
|
}
|
||||||
@ -205,9 +207,9 @@ void View::hlrOff()
|
|||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
myV3dView->SetComputedMode(Standard_False);
|
myV3dView->SetComputedMode(Standard_False);
|
||||||
myV3dView->Redraw();
|
myV3dView->Redraw();
|
||||||
QAction* aShadingAction = getViewAction(ViewAction::Shading);
|
QAction* aShadingAction = getViewAction(ViewAction_Shading);
|
||||||
aShadingAction->setEnabled(true);
|
aShadingAction->setEnabled(true);
|
||||||
QAction* aWireframeAction = getViewAction(ViewAction::Wireframe);
|
QAction* aWireframeAction = getViewAction(ViewAction_Wireframe);
|
||||||
aWireframeAction->setEnabled(true);
|
aWireframeAction->setEnabled(true);
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
@ -217,9 +219,9 @@ void View::hlrOn()
|
|||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
myV3dView->SetComputedMode(Standard_True);
|
myV3dView->SetComputedMode(Standard_True);
|
||||||
myV3dView->Redraw();
|
myV3dView->Redraw();
|
||||||
QAction* aShadingAction = getViewAction(ViewAction::Shading);
|
QAction* aShadingAction = getViewAction(ViewAction_Shading);
|
||||||
aShadingAction->setEnabled(false);
|
aShadingAction->setEnabled(false);
|
||||||
QAction* aWireframeAction = getViewAction(ViewAction::Wireframe);
|
QAction* aWireframeAction = getViewAction(ViewAction_Wireframe);
|
||||||
aWireframeAction->setEnabled(false);
|
aWireframeAction->setEnabled(false);
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
@ -252,9 +254,9 @@ void View::onRaytraceAction()
|
|||||||
{
|
{
|
||||||
QAction* aSentBy = (QAction*)sender();
|
QAction* aSentBy = (QAction*)sender();
|
||||||
|
|
||||||
if (aSentBy == myRaytraceActions.value(RaytraceAction::ToolRaytracing))
|
if (aSentBy == myRaytraceActions.value(RaytraceAction_Raytracing))
|
||||||
{
|
{
|
||||||
bool aState = myRaytraceActions.value(RaytraceAction::ToolRaytracing)->isChecked();
|
bool aState = myRaytraceActions.value(RaytraceAction_Raytracing)->isChecked();
|
||||||
|
|
||||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
if (aState)
|
if (aState)
|
||||||
@ -264,21 +266,21 @@ void View::onRaytraceAction()
|
|||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aSentBy == myRaytraceActions.value(RaytraceAction::ToolShadows))
|
if (aSentBy == myRaytraceActions.value(RaytraceAction_Shadows))
|
||||||
{
|
{
|
||||||
bool aState = myRaytraceActions.value(RaytraceAction::ToolShadows)->isChecked();
|
bool aState = myRaytraceActions.value(RaytraceAction_Shadows)->isChecked();
|
||||||
SetRaytracedShadows(aState);
|
SetRaytracedShadows(aState);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aSentBy == myRaytraceActions.value(RaytraceAction::ToolReflections))
|
if (aSentBy == myRaytraceActions.value(RaytraceAction_Reflections))
|
||||||
{
|
{
|
||||||
bool aState = myRaytraceActions.value(RaytraceAction::ToolReflections)->isChecked();
|
bool aState = myRaytraceActions.value(RaytraceAction_Reflections)->isChecked();
|
||||||
SetRaytracedReflections(aState);
|
SetRaytracedReflections(aState);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aSentBy == myRaytraceActions.value(RaytraceAction::ToolAntialiasing))
|
if (aSentBy == myRaytraceActions.value(RaytraceAction_Antialiasing))
|
||||||
{
|
{
|
||||||
bool aState = myRaytraceActions.value(RaytraceAction::ToolAntialiasing)->isChecked();
|
bool aState = myRaytraceActions.value(RaytraceAction_Antialiasing)->isChecked();
|
||||||
SetRaytracedAntialiasing(aState);
|
SetRaytracedAntialiasing(aState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -318,7 +320,7 @@ void View::updateToggled(bool isOn)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QAction* anAction : myViewActions)
|
foreach (QAction* anAction, myViewActions)
|
||||||
{
|
{
|
||||||
if (anAction && (anAction != sentBy))
|
if (anAction && (anAction != sentBy))
|
||||||
{
|
{
|
||||||
@ -327,15 +329,15 @@ void View::updateToggled(bool isOn)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (sentBy == myViewActions.value(ViewAction::FitArea))
|
if (sentBy == myViewActions.value(ViewAction_FitArea))
|
||||||
setCursor(*handCursor);
|
setCursor(*handCursor);
|
||||||
else if (sentBy == myViewActions.value(ViewAction::Zoom))
|
else if (sentBy == myViewActions.value(ViewAction_Zoom))
|
||||||
setCursor(*zoomCursor);
|
setCursor(*zoomCursor);
|
||||||
else if (sentBy == myViewActions.value(ViewAction::Pan))
|
else if (sentBy == myViewActions.value(ViewAction_Pan))
|
||||||
setCursor(*panCursor);
|
setCursor(*panCursor);
|
||||||
else if (sentBy == myViewActions.value(ViewAction::GlobalPan))
|
else if (sentBy == myViewActions.value(ViewAction_GlobalPan))
|
||||||
setCursor(*globPanCursor);
|
setCursor(*globPanCursor);
|
||||||
else if (sentBy == myViewActions.value(ViewAction::Rotation))
|
else if (sentBy == myViewActions.value(ViewAction_Rotation))
|
||||||
setCursor(*rotCursor);
|
setCursor(*rotCursor);
|
||||||
else
|
else
|
||||||
setCursor(*defCursor);
|
setCursor(*defCursor);
|
||||||
@ -391,12 +393,11 @@ QPaintEngine* View::paintEngine() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QAction* View::RegisterAction(QString theIconPath, QString thePromt, void (View::*theSlot)(void))
|
QAction* View::RegisterAction(QString theIconPath, QString thePromt)
|
||||||
{
|
{
|
||||||
QAction* anAction = new QAction(QPixmap(theIconPath), thePromt, this);
|
QAction* anAction = new QAction(QPixmap(theIconPath), thePromt, this);
|
||||||
anAction->setToolTip(thePromt);
|
anAction->setToolTip(thePromt);
|
||||||
anAction->setStatusTip(thePromt);
|
anAction->setStatusTip(thePromt);
|
||||||
connect(anAction, &QAction::triggered, this, theSlot);
|
|
||||||
return anAction;
|
return anAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,34 +405,40 @@ void View::initViewActions()
|
|||||||
{
|
{
|
||||||
if (!myViewActions.empty())
|
if (!myViewActions.empty())
|
||||||
return;
|
return;
|
||||||
myViewActions[ViewAction::FitAll] = RegisterAction(":/icons/view_fitall.png", tr("Fit all"), &View::fitAll);
|
myViewActions[ViewAction_FitAll] = RegisterAction(":/icons/view_fitall.png", tr("Fit all"));
|
||||||
|
connect(myViewActions[ViewAction_FitAll], SIGNAL(triggered()), this, SLOT(fitAll()));
|
||||||
if (myIs3dView)
|
if (myIs3dView)
|
||||||
{
|
{
|
||||||
myViewActions[ViewAction::Axo] = RegisterAction(":/icons/view_axo.png", tr("Isometric"), &View::axo);
|
myViewActions[ViewAction_Axo] = RegisterAction(":/icons/view_axo.png", tr("Isometric"));
|
||||||
|
connect(myViewActions[ViewAction_Axo], SIGNAL(triggered()), this, SLOT(axo()));
|
||||||
|
|
||||||
QActionGroup* aShadingActionGroup = new QActionGroup(this);
|
QActionGroup* aShadingActionGroup = new QActionGroup(this);
|
||||||
QAction* aShadingAction = RegisterAction(":/icons/tool_shading.png", tr("Shading"), &View::shading);
|
QAction* aShadingAction = RegisterAction(":/icons/tool_shading.png", tr("Shading"));
|
||||||
|
connect(aShadingAction, SIGNAL(triggered()), this, SLOT(shading()));
|
||||||
aShadingAction->setCheckable(true);
|
aShadingAction->setCheckable(true);
|
||||||
aShadingActionGroup->addAction(aShadingAction);
|
aShadingActionGroup->addAction(aShadingAction);
|
||||||
myViewActions[ViewAction::Shading] = aShadingAction;
|
myViewActions[ViewAction_Shading] = aShadingAction;
|
||||||
|
|
||||||
QAction* aWireframeAction = RegisterAction(":/icons/tool_wireframe.png", tr("Wireframe"), &View::wireframe);
|
QAction* aWireframeAction = RegisterAction(":/icons/tool_wireframe.png", tr("Wireframe"));
|
||||||
|
connect(aWireframeAction, SIGNAL(triggered()), this, SLOT(wireframe()));
|
||||||
aWireframeAction->setCheckable(true);
|
aWireframeAction->setCheckable(true);
|
||||||
aShadingActionGroup->addAction(aWireframeAction);
|
aShadingActionGroup->addAction(aWireframeAction);
|
||||||
myViewActions[ViewAction::Wireframe] = aWireframeAction;
|
myViewActions[ViewAction_Wireframe] = aWireframeAction;
|
||||||
|
|
||||||
QActionGroup* aHlrActionGroup = new QActionGroup(this);
|
QActionGroup* aHlrActionGroup = new QActionGroup(this);
|
||||||
QAction* aHlrOffAction = RegisterAction(":/icons/view_comp_off.png", tr("HLR off"), &View::hlrOff);
|
QAction* aHlrOffAction = RegisterAction(":/icons/view_comp_off.png", tr("HLR off"));
|
||||||
|
connect(aHlrOffAction, SIGNAL(triggered()), this, SLOT(hlrOff()));
|
||||||
aHlrOffAction->setCheckable(true);
|
aHlrOffAction->setCheckable(true);
|
||||||
aHlrActionGroup->addAction(aHlrOffAction);
|
aHlrActionGroup->addAction(aHlrOffAction);
|
||||||
myViewActions[ViewAction::HlrOff] = aHlrOffAction;
|
myViewActions[ViewAction_HlrOff] = aHlrOffAction;
|
||||||
|
|
||||||
QAction* aHlrOnAction = RegisterAction(":/icons/view_comp_on.png", tr("HLR on"), &View::hlrOn);
|
QAction* aHlrOnAction = RegisterAction(":/icons/view_comp_on.png", tr("HLR on"));
|
||||||
|
connect(aHlrOnAction, SIGNAL(triggered()), this, SLOT(hlrOn()));
|
||||||
aHlrOnAction->setCheckable(true);
|
aHlrOnAction->setCheckable(true);
|
||||||
aHlrActionGroup->addAction(aHlrOnAction);
|
aHlrActionGroup->addAction(aHlrOnAction);
|
||||||
myViewActions[ViewAction::HlrOn] = aHlrOnAction;
|
myViewActions[ViewAction_HlrOn] = aHlrOnAction;
|
||||||
|
|
||||||
myViewActions[ViewAction::Transparency] = RegisterAction(":/icons/tool_transparency.png", tr("Transparency"), &View::onTransparency);
|
myViewActions[ViewAction_Transparency] = RegisterAction(":/icons/tool_transparency.png", tr("Transparency"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,23 +449,27 @@ void View::initRaytraceActions()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QAction* aRayTraceAction = RegisterAction(":/icons/raytracing.png", tr("Ray-tracing"), &View::onRaytraceAction);
|
QAction* aRayTraceAction = RegisterAction(":/icons/raytracing.png", tr("Ray-tracing"));
|
||||||
myRaytraceActions[RaytraceAction::ToolRaytracing] = aRayTraceAction;
|
connect(aRayTraceAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
|
||||||
|
myRaytraceActions[RaytraceAction_Raytracing] = aRayTraceAction;
|
||||||
aRayTraceAction->setCheckable(true);
|
aRayTraceAction->setCheckable(true);
|
||||||
aRayTraceAction->setChecked(false);
|
aRayTraceAction->setChecked(false);
|
||||||
|
|
||||||
QAction* aShadowAction = RegisterAction(":/icons/shadows.png", tr("Shadows"), &View::onRaytraceAction);
|
QAction* aShadowAction = RegisterAction(":/icons/shadows.png", tr("Shadows"));
|
||||||
myRaytraceActions[RaytraceAction::ToolShadows] = aShadowAction;
|
connect(aShadowAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
|
||||||
|
myRaytraceActions[RaytraceAction_Shadows] = aShadowAction;
|
||||||
aShadowAction->setCheckable(true);
|
aShadowAction->setCheckable(true);
|
||||||
aShadowAction->setChecked(true);
|
aShadowAction->setChecked(true);
|
||||||
|
|
||||||
QAction* aReflectAction = RegisterAction(":/icons/reflections.png", tr("Reflections"), &View::onRaytraceAction);
|
QAction* aReflectAction = RegisterAction(":/icons/reflections.png", tr("Reflections"));
|
||||||
myRaytraceActions[RaytraceAction::ToolReflections] = aReflectAction;
|
connect(aReflectAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
|
||||||
|
myRaytraceActions[RaytraceAction_Reflections] = aReflectAction;
|
||||||
aReflectAction->setCheckable(true);
|
aReflectAction->setCheckable(true);
|
||||||
aReflectAction->setChecked(false);
|
aReflectAction->setChecked(false);
|
||||||
|
|
||||||
QAction* anAntiAliasingAction = RegisterAction(":/icons/antialiasing.png", tr("Anti-aliasing"), &View::onRaytraceAction);
|
QAction* anAntiAliasingAction = RegisterAction(":/icons/antialiasing.png", tr("Anti-aliasing"));
|
||||||
myRaytraceActions[RaytraceAction::ToolAntialiasing] = anAntiAliasingAction;
|
connect(anAntiAliasingAction, SIGNAL(triggered()), this, SLOT(onRaytraceAction()));
|
||||||
|
myRaytraceActions[RaytraceAction_Antialiasing] = anAntiAliasingAction;
|
||||||
anAntiAliasingAction->setCheckable(true);
|
anAntiAliasingAction->setCheckable(true);
|
||||||
anAntiAliasingAction->setChecked(false);
|
anAntiAliasingAction->setChecked(false);
|
||||||
}
|
}
|
||||||
@ -468,12 +479,12 @@ void View::activateCursor(const CurrentAction3d theMode)
|
|||||||
QCursor* aCursor = defCursor;
|
QCursor* aCursor = defCursor;
|
||||||
switch (theMode)
|
switch (theMode)
|
||||||
{
|
{
|
||||||
case CurrentAction3d::DynamicPanning: aCursor = panCursor; break;
|
case CurrentAction3d_DynamicPanning: aCursor = panCursor; break;
|
||||||
case CurrentAction3d::DynamicZooming: aCursor = zoomCursor; break;
|
case CurrentAction3d_DynamicZooming: aCursor = zoomCursor; break;
|
||||||
case CurrentAction3d::DynamicRotation: aCursor = rotCursor; break;
|
case CurrentAction3d_DynamicRotation: aCursor = rotCursor; break;
|
||||||
case CurrentAction3d::GlobalPanning: aCursor = globPanCursor; break;
|
case CurrentAction3d_GlobalPanning: aCursor = globPanCursor; break;
|
||||||
case CurrentAction3d::WindowZooming: aCursor = handCursor; break;
|
case CurrentAction3d_WindowZooming: aCursor = handCursor; break;
|
||||||
case CurrentAction3d::Nothing: aCursor = defCursor; break;
|
case CurrentAction3d_Nothing: aCursor = defCursor; break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -483,10 +494,6 @@ void View::activateCursor(const CurrentAction3d theMode)
|
|||||||
void View::mousePressEvent(QMouseEvent* theEvent)
|
void View::mousePressEvent(QMouseEvent* theEvent)
|
||||||
{
|
{
|
||||||
Qt::MouseButtons aMouseButtons = theEvent->buttons();
|
Qt::MouseButtons aMouseButtons = theEvent->buttons();
|
||||||
if (!myIs3dView)
|
|
||||||
{
|
|
||||||
aMouseButtons.setFlag(Qt::LeftButton, false);
|
|
||||||
}
|
|
||||||
const Graphic3d_Vec2i aPnt(theEvent->pos().x(), theEvent->pos().y());
|
const Graphic3d_Vec2i aPnt(theEvent->pos().x(), theEvent->pos().y());
|
||||||
const Aspect_VKeyFlags aFlags = qtMouseModifiers2VKeys(theEvent->modifiers());
|
const Aspect_VKeyFlags aFlags = qtMouseModifiers2VKeys(theEvent->modifiers());
|
||||||
if (!myV3dView.IsNull()
|
if (!myV3dView.IsNull()
|
||||||
@ -500,10 +507,6 @@ void View::mousePressEvent(QMouseEvent* theEvent)
|
|||||||
void View::mouseReleaseEvent(QMouseEvent* theEvent)
|
void View::mouseReleaseEvent(QMouseEvent* theEvent)
|
||||||
{
|
{
|
||||||
Qt::MouseButtons aMouseButtons = theEvent->buttons();
|
Qt::MouseButtons aMouseButtons = theEvent->buttons();
|
||||||
if (!myIs3dView)
|
|
||||||
{
|
|
||||||
aMouseButtons.setFlag(Qt::LeftButton, false);
|
|
||||||
}
|
|
||||||
const Graphic3d_Vec2i aPnt(theEvent->pos().x(), theEvent->pos().y());
|
const Graphic3d_Vec2i aPnt(theEvent->pos().x(), theEvent->pos().y());
|
||||||
const Aspect_VKeyFlags aFlags = qtMouseModifiers2VKeys(theEvent->modifiers());
|
const Aspect_VKeyFlags aFlags = qtMouseModifiers2VKeys(theEvent->modifiers());
|
||||||
if (!myV3dView.IsNull()
|
if (!myV3dView.IsNull()
|
||||||
@ -512,23 +515,19 @@ void View::mouseReleaseEvent(QMouseEvent* theEvent)
|
|||||||
updateView();
|
updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myCurrentMode == CurrentAction3d::GlobalPanning)
|
if (myCurrentMode == CurrentAction3d_GlobalPanning)
|
||||||
{
|
{
|
||||||
myV3dView->Place(aPnt.x(), aPnt.y(), myCurZoom);
|
myV3dView->Place(aPnt.x(), aPnt.y(), myCurZoom);
|
||||||
}
|
}
|
||||||
if (myCurrentMode != CurrentAction3d::Nothing)
|
if (myCurrentMode != CurrentAction3d_Nothing)
|
||||||
{
|
{
|
||||||
setCurrentAction(CurrentAction3d::Nothing);
|
setCurrentAction(CurrentAction3d_Nothing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::mouseMoveEvent(QMouseEvent* theEvent)
|
void View::mouseMoveEvent(QMouseEvent* theEvent)
|
||||||
{
|
{
|
||||||
Qt::MouseButtons aMouseButtons = theEvent->buttons();
|
Qt::MouseButtons aMouseButtons = theEvent->buttons();
|
||||||
if (!myIs3dView)
|
|
||||||
{
|
|
||||||
aMouseButtons.setFlag(Qt::LeftButton, false);
|
|
||||||
}
|
|
||||||
const Graphic3d_Vec2i aNewPos(theEvent->pos().x(), theEvent->pos().y());
|
const Graphic3d_Vec2i aNewPos(theEvent->pos().x(), theEvent->pos().y());
|
||||||
if (!myV3dView.IsNull()
|
if (!myV3dView.IsNull()
|
||||||
&& UpdateMousePosition(aNewPos, qtMouseButtons2VKeys(aMouseButtons), qtMouseModifiers2VKeys(theEvent->modifiers()), false))
|
&& UpdateMousePosition(aNewPos, qtMouseButtons2VKeys(aMouseButtons), qtMouseModifiers2VKeys(theEvent->modifiers()), false))
|
||||||
@ -567,31 +566,31 @@ void View::defineMouseGestures()
|
|||||||
activateCursor(myCurrentMode);
|
activateCursor(myCurrentMode);
|
||||||
switch (myCurrentMode)
|
switch (myCurrentMode)
|
||||||
{
|
{
|
||||||
case CurrentAction3d::Nothing:
|
case CurrentAction3d_Nothing:
|
||||||
{
|
{
|
||||||
myMouseGestureMap = myDefaultGestures;
|
myMouseGestureMap = myDefaultGestures;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CurrentAction3d::DynamicZooming:
|
case CurrentAction3d_DynamicZooming:
|
||||||
{
|
{
|
||||||
myMouseGestureMap.Bind(Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Zoom);
|
myMouseGestureMap.Bind(Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Zoom);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CurrentAction3d::GlobalPanning:
|
case CurrentAction3d_GlobalPanning:
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CurrentAction3d::WindowZooming:
|
case CurrentAction3d_WindowZooming:
|
||||||
{
|
{
|
||||||
myMouseGestureMap.Bind(Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_ZoomWindow);
|
myMouseGestureMap.Bind(Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_ZoomWindow);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CurrentAction3d::DynamicPanning:
|
case CurrentAction3d_DynamicPanning:
|
||||||
{
|
{
|
||||||
myMouseGestureMap.Bind(Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Pan);
|
myMouseGestureMap.Bind(Aspect_VKeyMouse_LeftButton, AIS_MouseGesture_Pan);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CurrentAction3d::DynamicRotation:
|
case CurrentAction3d_DynamicRotation:
|
||||||
{
|
{
|
||||||
myMouseGestureMap.Bind(Aspect_VKeyMouse_LeftButton, aRot);
|
myMouseGestureMap.Bind(Aspect_VKeyMouse_LeftButton, aRot);
|
||||||
break;
|
break;
|
||||||
@ -668,8 +667,10 @@ void View::onTransparencyChanged(int theVal)
|
|||||||
AIS_ListOfInteractive anAisObjectsList;
|
AIS_ListOfInteractive anAisObjectsList;
|
||||||
myContext->DisplayedObjects(anAisObjectsList);
|
myContext->DisplayedObjects(anAisObjectsList);
|
||||||
double aTranspValue = theVal / 10.;
|
double aTranspValue = theVal / 10.;
|
||||||
for (Handle(AIS_InteractiveObject) anAisObject : anAisObjectsList)
|
for(AIS_ListOfInteractive::Iterator anIter(anAisObjectsList);
|
||||||
|
anIter.More(); anIter.Next())
|
||||||
{
|
{
|
||||||
|
const Handle(AIS_InteractiveObject)& anAisObject = anIter.Value();
|
||||||
myContext->SetTransparency(anAisObject, aTranspValue, Standard_False);
|
myContext->SetTransparency(anAisObject, aTranspValue, Standard_False);
|
||||||
}
|
}
|
||||||
myContext->UpdateCurrentViewer();
|
myContext->UpdateCurrentViewer();
|
||||||
|
@ -38,11 +38,45 @@
|
|||||||
|
|
||||||
class TopoDS_Shape;
|
class TopoDS_Shape;
|
||||||
|
|
||||||
enum CurrentAction3d { Nothing, DynamicZooming, WindowZooming,
|
enum CurrentAction3d
|
||||||
DynamicPanning, GlobalPanning, DynamicRotation, ObjectDececting };
|
{
|
||||||
enum ViewAction { FitAll, FitArea, Zoom, Pan, GlobalPan, Front, Back, Top, Bottom,
|
CurrentAction3d_Nothing,
|
||||||
Left, Right, Axo, Rotation, Reset, HlrOff, HlrOn, Shading, Wireframe, Transparency };
|
CurrentAction3d_DynamicZooming,
|
||||||
enum RaytraceAction { ToolRaytracing, ToolShadows, ToolReflections, ToolAntialiasing };
|
CurrentAction3d_WindowZooming,
|
||||||
|
CurrentAction3d_DynamicPanning,
|
||||||
|
CurrentAction3d_GlobalPanning,
|
||||||
|
CurrentAction3d_DynamicRotation,
|
||||||
|
CurrentAction3d_ObjectDececting
|
||||||
|
};
|
||||||
|
enum ViewAction
|
||||||
|
{
|
||||||
|
ViewAction_FitAll,
|
||||||
|
ViewAction_FitArea,
|
||||||
|
ViewAction_Zoom,
|
||||||
|
ViewAction_Pan,
|
||||||
|
ViewAction_GlobalPan,
|
||||||
|
ViewAction_Front,
|
||||||
|
ViewAction_Back,
|
||||||
|
ViewAction_Top,
|
||||||
|
ViewAction_Bottom,
|
||||||
|
ViewAction_Left,
|
||||||
|
ViewAction_Right,
|
||||||
|
ViewAction_Axo,
|
||||||
|
ViewAction_Rotation,
|
||||||
|
ViewAction_Reset,
|
||||||
|
ViewAction_HlrOff,
|
||||||
|
ViewAction_HlrOn,
|
||||||
|
ViewAction_Shading,
|
||||||
|
ViewAction_Wireframe,
|
||||||
|
ViewAction_Transparency
|
||||||
|
};
|
||||||
|
enum RaytraceAction
|
||||||
|
{
|
||||||
|
RaytraceAction_Raytracing,
|
||||||
|
RaytraceAction_Shadows,
|
||||||
|
RaytraceAction_Reflections,
|
||||||
|
RaytraceAction_Antialiasing
|
||||||
|
};
|
||||||
|
|
||||||
//! Qt widget containing V3d_View and toolbar with view manipulation buttons.
|
//! Qt widget containing V3d_View and toolbar with view manipulation buttons.
|
||||||
//! Also use AIS_ViewController for redirecting user input (mouse, keyboard)
|
//! Also use AIS_ViewController for redirecting user input (mouse, keyboard)
|
||||||
@ -128,7 +162,7 @@ private:
|
|||||||
void initViewActions();
|
void initViewActions();
|
||||||
void initRaytraceActions();
|
void initRaytraceActions();
|
||||||
|
|
||||||
QAction* RegisterAction(QString theIconPath, QString thePromt, void (View::*theSlot)(void));
|
QAction* RegisterAction(QString theIconPath, QString thePromt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool myIsRaytracing;
|
bool myIsRaytracing;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user